debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java
changeset 2163 f0a9f2d04d4a
parent 1013 83255eb26cdb
equal deleted inserted replaced
2162:aa3898248f39 2163:f0a9f2d04d4a
    32 import org.eclipse.swt.widgets.Label;
    32 import org.eclipse.swt.widgets.Label;
    33 import org.eclipse.swt.widgets.Link;
    33 import org.eclipse.swt.widgets.Link;
    34 import org.eclipse.swt.widgets.Shell;
    34 import org.eclipse.swt.widgets.Shell;
    35 import org.eclipse.ui.dialogs.PreferencesUtil;
    35 import org.eclipse.ui.dialogs.PreferencesUtil;
    36 
    36 
    37 import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption;
    37 import com.nokia.cdt.internal.debug.launch.newwizard.IOtherSettingsWizardData.EBuildBeforeLaunchOption;
    38 
    38 
    39 /**
    39 /**
    40  *	This dialog allows in-depth configuration of the other settings in the launch.
    40  *	This dialog allows in-depth configuration of the other settings in the launch.
    41  *  Currently this only covers the build-before-launch options.
    41  *  Currently this only covers the build-before-launch options.
    42  */
    42  */
    44 
    44 
    45 	private Button fDisableBuildButton;
    45 	private Button fDisableBuildButton;
    46 	private Button fEnableBuildButton;
    46 	private Button fEnableBuildButton;
    47 	private Button fWorkspaceSettingsButton;
    47 	private Button fWorkspaceSettingsButton;
    48 	private Link fWorkspaceSettingsLink;
    48 	private Link fWorkspaceSettingsLink;
       
    49 	private IOtherSettingsWizardData otherSettingsWizardData;
    49 
    50 
    50 	protected OtherSettingsDialog(Shell shell, LaunchWizardData data) {
    51 	protected OtherSettingsDialog(Shell shell, IWizardData data) {
    51 		super(shell, data);
    52 		super(shell, data);
       
    53 		otherSettingsWizardData = (IOtherSettingsWizardData) data;
    52 	}
    54 	}
    53 
    55 
    54 	
    56 	
    55 	/* (non-Javadoc)
    57 	/* (non-Javadoc)
    56 	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
    58 	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
    91 		GridDataFactory.fillDefaults().span(2, 1).applyTo(fDisableBuildButton);
    93 		GridDataFactory.fillDefaults().span(2, 1).applyTo(fDisableBuildButton);
    92 		
    94 		
    93 		fDisableBuildButton.addSelectionListener(new SelectionAdapter() {
    95 		fDisableBuildButton.addSelectionListener(new SelectionAdapter() {
    94 			@Override
    96 			@Override
    95 			public void widgetSelected(SelectionEvent e) {
    97 			public void widgetSelected(SelectionEvent e) {
    96 				data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.NEVER);
    98 				otherSettingsWizardData.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.NEVER);
    97 			}
    99 			}
    98 		});
   100 		});
    99 		
   101 		
   100 		
   102 		
   101 		fEnableBuildButton = new Button(radio, SWT.RADIO);
   103 		fEnableBuildButton = new Button(radio, SWT.RADIO);
   106 		GridDataFactory.fillDefaults().span(2, 1).applyTo(fEnableBuildButton);
   108 		GridDataFactory.fillDefaults().span(2, 1).applyTo(fEnableBuildButton);
   107 		
   109 		
   108 		fEnableBuildButton.addSelectionListener(new SelectionAdapter() {
   110 		fEnableBuildButton.addSelectionListener(new SelectionAdapter() {
   109 			@Override
   111 			@Override
   110 			public void widgetSelected(SelectionEvent e) {
   112 			public void widgetSelected(SelectionEvent e) {
   111 				data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.ALWAYS);
   113 				otherSettingsWizardData.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.ALWAYS);
   112 			}
   114 			}
   113 		});
   115 		});
   114 		
   116 		
   115 
   117 
   116 		fWorkspaceSettingsButton = new Button(radio, SWT.RADIO);
   118 		fWorkspaceSettingsButton = new Button(radio, SWT.RADIO);
   121 		GridDataFactory.swtDefaults().span(1, 1).applyTo(fWorkspaceSettingsButton);
   123 		GridDataFactory.swtDefaults().span(1, 1).applyTo(fWorkspaceSettingsButton);
   122 
   124 
   123 		fWorkspaceSettingsButton.addSelectionListener(new SelectionAdapter() {
   125 		fWorkspaceSettingsButton.addSelectionListener(new SelectionAdapter() {
   124 			@Override
   126 			@Override
   125 			public void widgetSelected(SelectionEvent e) {
   127 			public void widgetSelected(SelectionEvent e) {
   126 				data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING);
   128 				otherSettingsWizardData.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING);
   127 			}
   129 			}
   128 		});
   130 		});
   129 		
   131 		
   130 		
   132 		
   131 		fWorkspaceSettingsLink = new Link(radio, SWT.NONE);
   133 		fWorkspaceSettingsLink = new Link(radio, SWT.NONE);
   143 						null).open();
   145 						null).open();
   144 				validate();
   146 				validate();
   145 			}
   147 			}
   146 		});
   148 		});
   147 		
   149 		
   148 		switch (data.getBuildBeforeLaunch()) {
   150 		switch (otherSettingsWizardData.getBuildBeforeLaunch()) {
   149 		case ALWAYS:
   151 		case ALWAYS:
   150 			fEnableBuildButton.setSelection(true);
   152 			fEnableBuildButton.setSelection(true);
   151 			fEnableBuildButton.setFocus();
   153 			fEnableBuildButton.setFocus();
   152 			break;
   154 			break;
   153 		case NEVER:
   155 		case NEVER:
   169 	protected void validate() {
   171 	protected void validate() {
   170 		IStatus status = Status.OK_STATUS;
   172 		IStatus status = Status.OK_STATUS;
   171 		updateStatus(status);
   173 		updateStatus(status);
   172 		
   174 		
   173 		String wsState = ""; //$NON-NLS-1$
   175 		String wsState = ""; //$NON-NLS-1$
   174 		if (data.isWorkspaceBuildBeforeLaunch())
   176 		if (otherSettingsWizardData.isWorkspaceBuildBeforeLaunch())
   175 			wsState = Messages.getString("OtherSettingsDialog.EnabledLabel"); //$NON-NLS-1$
   177 			wsState = Messages.getString("OtherSettingsDialog.EnabledLabel"); //$NON-NLS-1$
   176 		else
   178 		else
   177 			wsState = Messages.getString("OtherSettingsDialog.DisabledLabel"); //$NON-NLS-1$
   179 			wsState = Messages.getString("OtherSettingsDialog.DisabledLabel"); //$NON-NLS-1$
   178 		
   180 		
   179 		fWorkspaceSettingsButton.setText(
   181 		fWorkspaceSettingsButton.setText(