author | dadubrow |
Tue, 23 Feb 2010 13:51:39 -0600 | |
changeset 1011 | ac82c32cc589 |
parent 993 | df87e2d581e4 |
child 1013 | 83255eb26cdb |
permissions | -rw-r--r-- |
956 | 1 |
/* |
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
package com.nokia.cdt.internal.debug.launch.newwizard; |
|
19 |
||
20 |
import org.eclipse.core.runtime.IStatus; |
|
21 |
import org.eclipse.core.runtime.Status; |
|
22 |
import org.eclipse.jface.layout.GridDataFactory; |
|
23 |
import org.eclipse.jface.layout.GridLayoutFactory; |
|
24 |
import org.eclipse.swt.SWT; |
|
25 |
import org.eclipse.swt.events.ControlAdapter; |
|
26 |
import org.eclipse.swt.events.ControlEvent; |
|
27 |
import org.eclipse.swt.events.SelectionAdapter; |
|
28 |
import org.eclipse.swt.events.SelectionEvent; |
|
29 |
import org.eclipse.swt.layout.GridData; |
|
30 |
import org.eclipse.swt.widgets.Button; |
|
31 |
import org.eclipse.swt.widgets.Composite; |
|
32 |
import org.eclipse.swt.widgets.Control; |
|
33 |
import org.eclipse.swt.widgets.Label; |
|
34 |
import org.eclipse.swt.widgets.Link; |
|
35 |
import org.eclipse.swt.widgets.Shell; |
|
36 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
|
37 |
||
38 |
import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption; |
|
39 |
||
40 |
/** |
|
41 |
* This dialog allows in-depth configuration of the other settings in the launch. |
|
42 |
* Currently this only covers the build-before-launch options. |
|
43 |
*/ |
|
44 |
public class OtherSettingsDialog extends AbstractLaunchSettingsDialog { |
|
45 |
||
46 |
private Button fDisableBuildButton; |
|
47 |
private Button fEnableBuildButton; |
|
48 |
private Button fWorkspaceSettingsButton; |
|
49 |
private Link fWorkspaceSettingsLink; |
|
50 |
||
51 |
protected OtherSettingsDialog(Shell shell, LaunchWizardData data) { |
|
52 |
super(shell, data); |
|
53 |
} |
|
54 |
||
55 |
||
56 |
/* (non-Javadoc) |
|
57 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) |
|
58 |
*/ |
|
59 |
@Override |
|
60 |
protected Control createDialogArea(Composite parent) { |
|
61 |
Composite composite = initDialogArea(parent, |
|
969 | 62 |
Messages.getString("OtherSettingsDialog.Title"), //$NON-NLS-1$ |
956 | 63 |
LaunchWizardHelpIds.WIZARD_DIALOG_OTHER_SETTINGS); |
64 |
||
969 | 65 |
String description = Messages.getString("OtherSettingsDialog.Desc1") + //$NON-NLS-1$ |
66 |
Messages.getString("OtherSettingsDialog.Desc2") + //$NON-NLS-1$ |
|
67 |
Messages.getString("OtherSettingsDialog.Desc3"); //$NON-NLS-1$ |
|
956 | 68 |
|
69 |
final Label label = new Label(composite, SWT.WRAP); |
|
70 |
label.setText(description); |
|
1011
ac82c32cc589
bug 10773 - fix initial text of finish button + tweak width of other settings dialog to wrap text
dadubrow
parents:
993
diff
changeset
|
71 |
GridDataFactory.fillDefaults().grab(true, false).hint(400, SWT.DEFAULT).applyTo(label); |
956 | 72 |
|
73 |
// spacer |
|
74 |
new Label(composite, SWT.NONE); |
|
75 |
||
76 |
final Composite radio = new Composite(composite, SWT.NONE); |
|
77 |
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(radio); |
|
78 |
GridDataFactory.fillDefaults().grab(true, true).applyTo(radio); |
|
79 |
||
80 |
composite.addControlListener(new ControlAdapter() { |
|
81 |
@Override |
|
82 |
public void controlResized(ControlEvent e) { |
|
83 |
label.pack(); |
|
84 |
} |
|
85 |
}); |
|
86 |
||
87 |
fDisableBuildButton = new Button(radio, SWT.RADIO); |
|
88 |
fDisableBuildButton.setText(Messages.getString("OtherSettingsDialog.DisableButtonLabel")); //$NON-NLS-1$ |
|
89 |
fDisableBuildButton.setToolTipText(Messages.getString("OtherSettingsDialog.DisableButtonToolTip")); //$NON-NLS-1$ |
|
969 | 90 |
fDisableBuildButton.setData(UID, "OtherSettingsDialog.disableBuildButton"); //$NON-NLS-1$ |
956 | 91 |
|
92 |
GridDataFactory.fillDefaults().span(2, 1).applyTo(fDisableBuildButton); |
|
93 |
||
94 |
fDisableBuildButton.addSelectionListener(new SelectionAdapter() { |
|
95 |
@Override |
|
96 |
public void widgetSelected(SelectionEvent e) { |
|
97 |
data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.NEVER); |
|
98 |
} |
|
99 |
}); |
|
100 |
||
101 |
||
102 |
fEnableBuildButton = new Button(radio, SWT.RADIO); |
|
103 |
fEnableBuildButton.setText(Messages.getString("OtherSettingsDialog.EnableButtonLabel")); //$NON-NLS-1$ |
|
104 |
fEnableBuildButton.setToolTipText(Messages.getString("OtherSettingsDialog.EnableButtonToolTip")); //$NON-NLS-1$ |
|
969 | 105 |
fEnableBuildButton.setData(UID, "OtherSettingsDialog.enableBuildButon"); //$NON-NLS-1$ |
956 | 106 |
|
107 |
GridDataFactory.fillDefaults().span(2, 1).applyTo(fEnableBuildButton); |
|
108 |
||
109 |
fEnableBuildButton.addSelectionListener(new SelectionAdapter() { |
|
110 |
@Override |
|
111 |
public void widgetSelected(SelectionEvent e) { |
|
112 |
data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.ALWAYS); |
|
113 |
} |
|
114 |
}); |
|
115 |
||
116 |
||
117 |
fWorkspaceSettingsButton = new Button(radio, SWT.RADIO); |
|
118 |
fWorkspaceSettingsButton.setText(Messages.getString("OtherSettingsDialog.WorkspaceSettingsButtonLabel")); //$NON-NLS-1$ |
|
119 |
fWorkspaceSettingsButton.setToolTipText(Messages.getString("OtherSettingsDialog.WorkspaceSettingsButtonToolTip")); //$NON-NLS-1$ |
|
969 | 120 |
fWorkspaceSettingsButton.setData(UID, "OtherSettingsDialog.workspaceSettingsButton"); //$NON-NLS-1$ |
956 | 121 |
|
122 |
GridDataFactory.swtDefaults().span(1, 1).applyTo(fWorkspaceSettingsButton); |
|
123 |
||
124 |
fWorkspaceSettingsButton.addSelectionListener(new SelectionAdapter() { |
|
125 |
@Override |
|
126 |
public void widgetSelected(SelectionEvent e) { |
|
127 |
data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING); |
|
128 |
} |
|
129 |
}); |
|
130 |
||
131 |
||
132 |
fWorkspaceSettingsLink = new Link(radio, SWT.NONE); |
|
133 |
fWorkspaceSettingsLink.setText(Messages.getString("OtherSettingsDialog.WorkspaceSettingsLinkLabel")); //$NON-NLS-1$ |
|
969 | 134 |
fWorkspaceSettingsLink.setData(UID, "OtherSettingsDialog.workspaceSettingsLink"); //$NON-NLS-1$ |
956 | 135 |
|
136 |
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(true, false).span(1, 1).applyTo(fWorkspaceSettingsLink); |
|
137 |
||
138 |
fWorkspaceSettingsLink.addSelectionListener(new SelectionAdapter() { |
|
139 |
public void widgetSelected(SelectionEvent e) { |
|
140 |
PreferencesUtil.createPreferenceDialogOn( |
|
141 |
radio.getShell(), |
|
142 |
Messages.getString("OtherSettingsDialog.WorkspaceSettingsPageID"), //$NON-NLS-1$ |
|
143 |
null, |
|
144 |
null).open(); |
|
145 |
validate(); |
|
146 |
} |
|
147 |
}); |
|
148 |
||
149 |
switch (data.getBuildBeforeLaunch()) { |
|
150 |
case ALWAYS: |
|
151 |
fEnableBuildButton.setSelection(true); |
|
152 |
fEnableBuildButton.setFocus(); |
|
153 |
break; |
|
154 |
case NEVER: |
|
155 |
fDisableBuildButton.setSelection(true); |
|
156 |
fDisableBuildButton.setFocus(); |
|
157 |
break; |
|
158 |
case USE_WORKSPACE_SETTING: |
|
159 |
fWorkspaceSettingsButton.setSelection(true); |
|
160 |
fWorkspaceSettingsButton.setFocus(); |
|
161 |
break; |
|
162 |
} |
|
163 |
||
164 |
validate(); |
|
165 |
||
166 |
return radio; |
|
167 |
} |
|
168 |
||
169 |
@Override |
|
170 |
protected void validate() { |
|
171 |
IStatus status = Status.OK_STATUS; |
|
172 |
updateStatus(status); |
|
173 |
||
969 | 174 |
String wsState = ""; //$NON-NLS-1$ |
956 | 175 |
if (data.isWorkspaceBuildBeforeLaunch()) |
969 | 176 |
wsState = Messages.getString("OtherSettingsDialog.EnabledLabel"); //$NON-NLS-1$ |
956 | 177 |
else |
969 | 178 |
wsState = Messages.getString("OtherSettingsDialog.DisabledLabel"); //$NON-NLS-1$ |
956 | 179 |
|
180 |
fWorkspaceSettingsButton.setText( |
|
181 |
Messages.getString("OtherSettingsDialog.WorkspaceSettingsButtonLabel") + //$NON-NLS-1$ |
|
182 |
wsState); |
|
183 |
fWorkspaceSettingsButton.pack(); |
|
184 |
||
185 |
} |
|
186 |
} |
|
187 |