|
Lines 12-20
Link Here
|
| 12 |
package org.eclipse.pde.internal.ui.wizards.plugin; |
12 |
package org.eclipse.pde.internal.ui.wizards.plugin; |
| 13 |
|
13 |
|
| 14 |
import java.util.Locale; |
14 |
import java.util.Locale; |
|
|
15 |
import java.util.TreeSet; |
| 15 |
|
16 |
|
| 16 |
import org.eclipse.core.runtime.IStatus; |
17 |
import org.eclipse.core.runtime.IStatus; |
| 17 |
import org.eclipse.jdt.core.JavaConventions; |
18 |
import org.eclipse.jdt.core.JavaConventions; |
|
|
19 |
import org.eclipse.jdt.launching.IVMInstall; |
| 20 |
import org.eclipse.jdt.launching.JavaRuntime; |
| 21 |
import org.eclipse.jdt.launching.environments.IExecutionEnvironment; |
| 18 |
import org.eclipse.jface.dialogs.Dialog; |
22 |
import org.eclipse.jface.dialogs.Dialog; |
| 19 |
import org.eclipse.jface.dialogs.IDialogSettings; |
23 |
import org.eclipse.jface.dialogs.IDialogSettings; |
| 20 |
import org.eclipse.jface.dialogs.IMessageProvider; |
24 |
import org.eclipse.jface.dialogs.IMessageProvider; |
|
Lines 22-27
Link Here
|
| 22 |
import org.eclipse.pde.internal.core.util.PDEJavaHelper; |
26 |
import org.eclipse.pde.internal.core.util.PDEJavaHelper; |
| 23 |
import org.eclipse.pde.internal.ui.IHelpContextIds; |
27 |
import org.eclipse.pde.internal.ui.IHelpContextIds; |
| 24 |
import org.eclipse.pde.internal.ui.PDEUIMessages; |
28 |
import org.eclipse.pde.internal.ui.PDEUIMessages; |
|
|
29 |
import org.eclipse.pde.internal.ui.launcher.VMHelper; |
| 25 |
import org.eclipse.pde.internal.ui.wizards.IProjectProvider; |
30 |
import org.eclipse.pde.internal.ui.wizards.IProjectProvider; |
| 26 |
import org.eclipse.swt.SWT; |
31 |
import org.eclipse.swt.SWT; |
| 27 |
import org.eclipse.swt.events.ModifyEvent; |
32 |
import org.eclipse.swt.events.ModifyEvent; |
|
Lines 31-41
Link Here
|
| 31 |
import org.eclipse.swt.layout.GridData; |
36 |
import org.eclipse.swt.layout.GridData; |
| 32 |
import org.eclipse.swt.layout.GridLayout; |
37 |
import org.eclipse.swt.layout.GridLayout; |
| 33 |
import org.eclipse.swt.widgets.Button; |
38 |
import org.eclipse.swt.widgets.Button; |
|
|
39 |
import org.eclipse.swt.widgets.Combo; |
| 34 |
import org.eclipse.swt.widgets.Composite; |
40 |
import org.eclipse.swt.widgets.Composite; |
|
|
41 |
import org.eclipse.swt.widgets.Event; |
| 35 |
import org.eclipse.swt.widgets.Group; |
42 |
import org.eclipse.swt.widgets.Group; |
| 36 |
import org.eclipse.swt.widgets.Label; |
43 |
import org.eclipse.swt.widgets.Label; |
|
|
44 |
import org.eclipse.swt.widgets.Listener; |
| 37 |
import org.eclipse.swt.widgets.Text; |
45 |
import org.eclipse.swt.widgets.Text; |
| 38 |
import org.eclipse.ui.PlatformUI; |
46 |
import org.eclipse.ui.PlatformUI; |
|
|
47 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
| 39 |
|
48 |
|
| 40 |
public class PluginContentPage extends ContentPage { |
49 |
public class PluginContentPage extends ContentPage { |
| 41 |
protected final static int P_CLASS_GROUP = 2; |
50 |
protected final static int P_CLASS_GROUP = 2; |
|
Lines 44-49
Link Here
|
| 44 |
private Button fGenerateClass; |
53 |
private Button fGenerateClass; |
| 45 |
private Button fUIPlugin; |
54 |
private Button fUIPlugin; |
| 46 |
private Label fClassLabel; |
55 |
private Label fClassLabel; |
|
|
56 |
private Label fEELabel; |
| 57 |
private Button fExeEnvButton; |
| 58 |
private Combo fEEChoice; |
| 47 |
|
59 |
|
| 48 |
private Label fLabel; |
60 |
private Label fLabel; |
| 49 |
private Button fYesButton; |
61 |
private Button fYesButton; |
|
Lines 53-58
Link Here
|
| 53 |
private final static String S_UI_PLUGIN = "uiPlugin"; //$NON-NLS-1$ |
65 |
private final static String S_UI_PLUGIN = "uiPlugin"; //$NON-NLS-1$ |
| 54 |
private final static String S_RCP_PLUGIN = "rcpPlugin"; //$NON-NLS-1$ |
66 |
private final static String S_RCP_PLUGIN = "rcpPlugin"; //$NON-NLS-1$ |
| 55 |
|
67 |
|
|
|
68 |
private final static String NO_EXECUTION_ENVIRONMENT = "<No Execution Environment>"; |
| 69 |
|
| 56 |
private ModifyListener classListener = new ModifyListener() { |
70 |
private ModifyListener classListener = new ModifyListener() { |
| 57 |
public void modifyText(ModifyEvent e) { |
71 |
public void modifyText(ModifyEvent e) { |
| 58 |
if (fInitialized) |
72 |
if (fInitialized) |
|
Lines 88-116
Link Here
|
| 88 |
|
102 |
|
| 89 |
private void createPluginPropertiesGroup(Composite container) { |
103 |
private void createPluginPropertiesGroup(Composite container) { |
| 90 |
Group propertiesGroup = new Group(container, SWT.NONE); |
104 |
Group propertiesGroup = new Group(container, SWT.NONE); |
| 91 |
propertiesGroup.setLayout(new GridLayout(2, false)); |
105 |
propertiesGroup.setLayout(new GridLayout(3, false)); |
| 92 |
propertiesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
106 |
propertiesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 93 |
propertiesGroup.setText(PDEUIMessages.ContentPage_pGroup); |
107 |
propertiesGroup.setText(PDEUIMessages.ContentPage_pGroup); |
| 94 |
|
108 |
|
| 95 |
Label label = new Label(propertiesGroup, SWT.NONE); |
109 |
Label label = new Label(propertiesGroup, SWT.NONE); |
| 96 |
label.setText(PDEUIMessages.ContentPage_pid); |
110 |
label.setText(PDEUIMessages.ContentPage_pid); |
| 97 |
fIdText = createText(propertiesGroup, propertiesListener); |
111 |
fIdText = createText(propertiesGroup, propertiesListener, 2); |
| 98 |
|
112 |
|
| 99 |
label = new Label(propertiesGroup, SWT.NONE); |
113 |
label = new Label(propertiesGroup, SWT.NONE); |
| 100 |
label.setText(PDEUIMessages.ContentPage_pversion); |
114 |
label.setText(PDEUIMessages.ContentPage_pversion); |
| 101 |
fVersionText = createText(propertiesGroup, propertiesListener); |
115 |
fVersionText = createText(propertiesGroup, propertiesListener, 2); |
| 102 |
|
116 |
|
| 103 |
label = new Label(propertiesGroup, SWT.NONE); |
117 |
label = new Label(propertiesGroup, SWT.NONE); |
| 104 |
label.setText(PDEUIMessages.ContentPage_pname); |
118 |
label.setText(PDEUIMessages.ContentPage_pname); |
| 105 |
fNameText = createText(propertiesGroup, propertiesListener); |
119 |
fNameText = createText(propertiesGroup, propertiesListener, 2); |
| 106 |
|
120 |
|
| 107 |
label = new Label(propertiesGroup, SWT.NONE); |
121 |
label = new Label(propertiesGroup, SWT.NONE); |
| 108 |
label.setText(PDEUIMessages.ContentPage_pprovider); |
122 |
label.setText(PDEUIMessages.ContentPage_pprovider); |
| 109 |
fProviderText = createText(propertiesGroup, propertiesListener); |
123 |
fProviderText = createText(propertiesGroup, propertiesListener, 2); |
| 110 |
|
124 |
|
| 111 |
fLibraryLabel = new Label(propertiesGroup, SWT.NONE); |
125 |
fLibraryLabel = new Label(propertiesGroup, SWT.NONE); |
| 112 |
fLibraryLabel.setText(PDEUIMessages.ProjectStructurePage_library); |
126 |
fLibraryLabel.setText(PDEUIMessages.ProjectStructurePage_library); |
| 113 |
fLibraryText = createText(propertiesGroup, propertiesListener); |
127 |
fLibraryText = createText(propertiesGroup, propertiesListener, 2); |
|
|
128 |
|
| 129 |
createExecutionEnvironmentControls(propertiesGroup); |
| 130 |
} |
| 131 |
|
| 132 |
private void createExecutionEnvironmentControls(Composite container) { |
| 133 |
// Create label |
| 134 |
fEELabel = new Label(container, SWT.NONE); |
| 135 |
fEELabel.setText(PDEUIMessages.NewProjectCreationPage_executionEnvironments_label); |
| 136 |
|
| 137 |
// Create combo |
| 138 |
fEEChoice = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); |
| 139 |
fEEChoice.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 140 |
|
| 141 |
// Gather EEs |
| 142 |
IExecutionEnvironment[] exeEnvs = VMHelper.getExecutionEnvironments(); |
| 143 |
TreeSet availableEEs = new TreeSet(); |
| 144 |
for (int i = 0; i < exeEnvs.length; i++) { |
| 145 |
availableEEs.add(exeEnvs[i].getId()); |
| 146 |
} |
| 147 |
availableEEs.add(NO_EXECUTION_ENVIRONMENT); |
| 148 |
|
| 149 |
// Set data |
| 150 |
fEEChoice.setItems((String[]) availableEEs.toArray(new String[availableEEs.size()-1])); |
| 151 |
fEEChoice.addSelectionListener(new SelectionAdapter(){ |
| 152 |
public void widgetSelected(SelectionEvent e) { |
| 153 |
validatePage(); |
| 154 |
} |
| 155 |
}); |
| 156 |
|
| 157 |
// Set default EE based on strict match to default VM |
| 158 |
IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); |
| 159 |
String[] EEChoices = fEEChoice.getItems(); |
| 160 |
for (int i = 0; i < EEChoices.length; i++) { |
| 161 |
if (!EEChoices[i].equals(NO_EXECUTION_ENVIRONMENT)){ |
| 162 |
if(VMHelper.getExecutionEnvironment(EEChoices[i]).isStrictlyCompatible(defaultVM)) { |
| 163 |
fEEChoice.select(i); |
| 164 |
break; |
| 165 |
} |
| 166 |
} |
| 167 |
} |
| 168 |
|
| 169 |
// Create button |
| 170 |
fExeEnvButton = new Button(container, SWT.PUSH); |
| 171 |
fExeEnvButton.setLayoutData(new GridData()); |
| 172 |
fExeEnvButton.setText(PDEUIMessages.NewProjectCreationPage_environmentsButton); |
| 173 |
fExeEnvButton.addListener(SWT.Selection, new Listener() { |
| 174 |
public void handleEvent(Event event) { |
| 175 |
PreferencesUtil.createPreferenceDialogOn( |
| 176 |
getShell(), |
| 177 |
"org.eclipse.jdt.debug.ui.jreProfiles", //$NON-NLS-1$ |
| 178 |
new String[] { "org.eclipse.jdt.debug.ui.jreProfiles" }, null).open(); //$NON-NLS-1$ |
| 179 |
} |
| 180 |
}); |
| 114 |
} |
181 |
} |
| 115 |
|
182 |
|
| 116 |
private void createPluginClassGroup(Composite container) { |
183 |
private void createPluginClassGroup(Composite container) { |
|
Lines 166-171
Link Here
|
| 166 |
data.setUIPlugin(fUIPlugin.getSelection()); |
233 |
data.setUIPlugin(fUIPlugin.getSelection()); |
| 167 |
data.setDoGenerateClass(fGenerateClass.isEnabled() && fGenerateClass.getSelection()); |
234 |
data.setDoGenerateClass(fGenerateClass.isEnabled() && fGenerateClass.getSelection()); |
| 168 |
data.setRCPApplicationPlugin(!fData.isSimple() && !isPureOSGi() && fYesButton.getSelection()); |
235 |
data.setRCPApplicationPlugin(!fData.isSimple() && !isPureOSGi() && fYesButton.getSelection()); |
|
|
236 |
if(fEEChoice.isEnabled() && !fEEChoice.getText().equals(NO_EXECUTION_ENVIRONMENT)) { |
| 237 |
fData.setExecutionEnvironment(fEEChoice.getText().trim()); |
| 238 |
} else { |
| 239 |
fData.setExecutionEnvironment(null); |
| 240 |
} |
| 169 |
} |
241 |
} |
| 170 |
|
242 |
|
| 171 |
private void createRCPGroup(Composite container){ |
243 |
private void createRCPGroup(Composite container){ |
|
Lines 239-245
Link Here
|
| 239 |
int oldfChanged = fChangedGroups; |
311 |
int oldfChanged = fChangedGroups; |
| 240 |
fClassText.setText(computeId().toLowerCase(Locale.ENGLISH) + ".Activator"); //$NON-NLS-1$ |
312 |
fClassText.setText(computeId().toLowerCase(Locale.ENGLISH) + ".Activator"); //$NON-NLS-1$ |
| 241 |
fChangedGroups = oldfChanged; |
313 |
fChangedGroups = oldfChanged; |
| 242 |
} |
314 |
} |
|
|
315 |
|
| 316 |
boolean allowEESelection = !fData.isSimple() && fData.hasBundleStructure(); |
| 317 |
fEELabel.setEnabled(allowEESelection); |
| 318 |
fEEChoice.setEnabled(allowEESelection); |
| 319 |
fExeEnvButton.setEnabled(allowEESelection); |
| 320 |
|
| 243 |
fRCPGroup.setVisible(!fData.isSimple() && !isPureOSGi()); |
321 |
fRCPGroup.setVisible(!fData.isSimple() && !isPureOSGi()); |
| 244 |
} |
322 |
} |
| 245 |
super.setVisible(visible); |
323 |
super.setVisible(visible); |
|
Lines 265-270
Link Here
|
| 265 |
setMessage(status.getMessage(), IMessageProvider.WARNING); |
343 |
setMessage(status.getMessage(), IMessageProvider.WARNING); |
| 266 |
} |
344 |
} |
| 267 |
} |
345 |
} |
|
|
346 |
if (errorMessage == null){ |
| 347 |
String eeid = fEEChoice.getText(); |
| 348 |
if(eeid != null && fEEChoice.isEnabled()) { |
| 349 |
IExecutionEnvironment ee = VMHelper.getExecutionEnvironment(eeid); |
| 350 |
IVMInstall[] vms = ee.getCompatibleVMs(); |
| 351 |
if(vms.length == 0) { |
| 352 |
errorMessage = PDEUIMessages.NewProjectCreationPage_invalidEE; |
| 353 |
} |
| 354 |
} |
| 355 |
} |
| 268 |
setErrorMessage(errorMessage); |
356 |
setErrorMessage(errorMessage); |
| 269 |
setPageComplete(errorMessage == null); |
357 |
setPageComplete(errorMessage == null); |
| 270 |
} |
358 |
} |