Lines 10-20
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.pde.internal.ui.wizards.plugin; |
11 |
package org.eclipse.pde.internal.ui.wizards.plugin; |
12 |
|
12 |
|
|
|
13 |
import java.util.TreeSet; |
14 |
|
13 |
import org.eclipse.core.resources.IProject; |
15 |
import org.eclipse.core.resources.IProject; |
14 |
import org.eclipse.core.resources.IResource; |
16 |
import org.eclipse.core.resources.IResource; |
15 |
import org.eclipse.core.resources.IWorkspace; |
17 |
import org.eclipse.core.resources.IWorkspace; |
16 |
import org.eclipse.core.resources.ResourcesPlugin; |
18 |
import org.eclipse.core.resources.ResourcesPlugin; |
17 |
import org.eclipse.core.runtime.IStatus; |
19 |
import org.eclipse.core.runtime.IStatus; |
|
|
20 |
import org.eclipse.jdt.launching.IVMInstall; |
21 |
import org.eclipse.jdt.launching.JavaRuntime; |
22 |
import org.eclipse.jdt.launching.environments.IExecutionEnvironment; |
18 |
import org.eclipse.jdt.ui.PreferenceConstants; |
23 |
import org.eclipse.jdt.ui.PreferenceConstants; |
19 |
import org.eclipse.jface.dialogs.Dialog; |
24 |
import org.eclipse.jface.dialogs.Dialog; |
20 |
import org.eclipse.jface.dialogs.IDialogSettings; |
25 |
import org.eclipse.jface.dialogs.IDialogSettings; |
Lines 25-30
Link Here
|
25 |
import org.eclipse.pde.internal.core.TargetPlatformHelper; |
30 |
import org.eclipse.pde.internal.core.TargetPlatformHelper; |
26 |
import org.eclipse.pde.internal.ui.IHelpContextIds; |
31 |
import org.eclipse.pde.internal.ui.IHelpContextIds; |
27 |
import org.eclipse.pde.internal.ui.PDEUIMessages; |
32 |
import org.eclipse.pde.internal.ui.PDEUIMessages; |
|
|
33 |
import org.eclipse.pde.internal.ui.launcher.VMHelper; |
28 |
import org.eclipse.swt.SWT; |
34 |
import org.eclipse.swt.SWT; |
29 |
import org.eclipse.swt.events.ModifyEvent; |
35 |
import org.eclipse.swt.events.ModifyEvent; |
30 |
import org.eclipse.swt.events.ModifyListener; |
36 |
import org.eclipse.swt.events.ModifyListener; |
Lines 35-44
Link Here
|
35 |
import org.eclipse.swt.widgets.Button; |
41 |
import org.eclipse.swt.widgets.Button; |
36 |
import org.eclipse.swt.widgets.Combo; |
42 |
import org.eclipse.swt.widgets.Combo; |
37 |
import org.eclipse.swt.widgets.Composite; |
43 |
import org.eclipse.swt.widgets.Composite; |
|
|
44 |
import org.eclipse.swt.widgets.Event; |
38 |
import org.eclipse.swt.widgets.Group; |
45 |
import org.eclipse.swt.widgets.Group; |
39 |
import org.eclipse.swt.widgets.Label; |
46 |
import org.eclipse.swt.widgets.Label; |
|
|
47 |
import org.eclipse.swt.widgets.Listener; |
40 |
import org.eclipse.swt.widgets.Text; |
48 |
import org.eclipse.swt.widgets.Text; |
41 |
import org.eclipse.ui.PlatformUI; |
49 |
import org.eclipse.ui.PlatformUI; |
|
|
50 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
42 |
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; |
51 |
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; |
43 |
|
52 |
|
44 |
|
53 |
|
Lines 54-59
Link Here
|
54 |
private Combo fTargetCombo; |
63 |
private Combo fTargetCombo; |
55 |
private Combo fOSGiCombo; |
64 |
private Combo fOSGiCombo; |
56 |
private Button fOSGIButton; |
65 |
private Button fOSGIButton; |
|
|
66 |
private Button fExeEnvButton; |
67 |
private Combo fEEChoice; |
57 |
|
68 |
|
58 |
private static final String S_OSGI_PROJECT = "osgiProject"; //$NON-NLS-1$ |
69 |
private static final String S_OSGI_PROJECT = "osgiProject"; //$NON-NLS-1$ |
59 |
private static final String S_TARGET_NAME = "targetName"; //$NON-NLS-1$ |
70 |
private static final String S_TARGET_NAME = "targetName"; //$NON-NLS-1$ |
Lines 73-78
Link Here
|
73 |
|
84 |
|
74 |
createProjectTypeGroup(control); |
85 |
createProjectTypeGroup(control); |
75 |
createFormatGroup(control); |
86 |
createFormatGroup(control); |
|
|
87 |
createExecutionEnvironmentGroup(control); |
76 |
|
88 |
|
77 |
updateRuntimeDependency(); |
89 |
updateRuntimeDependency(); |
78 |
|
90 |
|
Lines 82-87
Link Here
|
82 |
: IHelpContextIds.NEW_PROJECT_STRUCTURE_PAGE); |
94 |
: IHelpContextIds.NEW_PROJECT_STRUCTURE_PAGE); |
83 |
setControl(control); |
95 |
setControl(control); |
84 |
} |
96 |
} |
|
|
97 |
|
98 |
private void createExecutionEnvironmentGroup(Composite container) { |
99 |
Group group = new Group(container, SWT.NONE); |
100 |
group.setText(PDEUIMessages.NewProjectCreationPage_targetEnvironment); |
101 |
GridLayout layout = new GridLayout(); |
102 |
layout.numColumns = 3; |
103 |
group.setLayout(layout); |
104 |
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
105 |
|
106 |
// Create label |
107 |
Label envs = new Label(group, SWT.NONE); |
108 |
envs.setText(PDEUIMessages.NewProjectCreationPage_executionEnvironments_label); |
109 |
|
110 |
// Create combo |
111 |
fEEChoice = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); |
112 |
fEEChoice.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
113 |
|
114 |
// Gather EEs |
115 |
IExecutionEnvironment[] exeEnvs = VMHelper.getExecutionEnvironments(); |
116 |
TreeSet availableEEs = new TreeSet(); |
117 |
for (int i = 0; i < exeEnvs.length; i++) { |
118 |
availableEEs.add(exeEnvs[i].getId()); |
119 |
} |
120 |
|
121 |
// Set data |
122 |
fEEChoice.setItems((String[]) availableEEs.toArray(new String[availableEEs.size()-1])); |
123 |
|
124 |
// Set default EE based on strict match to default VM |
125 |
IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); |
126 |
String[] EEChoices = fEEChoice.getItems(); |
127 |
for (int i = 0; i < EEChoices.length; i++) { |
128 |
if(VMHelper.getExecutionEnvironment(EEChoices[i]).isStrictlyCompatible(defaultVM)) { |
129 |
fEEChoice.select(i); |
130 |
break; |
131 |
} |
132 |
} |
133 |
|
134 |
// Create button |
135 |
fExeEnvButton = createButton(group, SWT.PUSH, 1, 0); |
136 |
fExeEnvButton.setText(PDEUIMessages.NewProjectCreationPage_environmentsButton); |
137 |
fExeEnvButton.addListener(SWT.Selection, new Listener() { |
138 |
public void handleEvent(Event event) { |
139 |
PreferencesUtil.createPreferenceDialogOn( |
140 |
getShell(), |
141 |
"org.eclipse.jdt.debug.ui.jreProfiles", //$NON-NLS-1$ |
142 |
new String[] { "org.eclipse.jdt.debug.ui.jreProfiles" }, null).open(); //$NON-NLS-1$ |
143 |
} |
144 |
}); |
145 |
} |
85 |
|
146 |
|
86 |
private void createProjectTypeGroup(Composite container) { |
147 |
private void createProjectTypeGroup(Composite container) { |
87 |
Group group = new Group(container, SWT.NONE); |
148 |
Group group = new Group(container, SWT.NONE); |
Lines 222-227
Link Here
|
222 |
fData.setHasBundleStructure(fOSGIButton.getSelection() || Double.parseDouble(fTargetCombo.getText()) >= 3.1); |
283 |
fData.setHasBundleStructure(fOSGIButton.getSelection() || Double.parseDouble(fTargetCombo.getText()) >= 3.1); |
223 |
fData.setOSGiFramework(fOSGIButton.getSelection() ? fOSGiCombo.getText() : null); |
284 |
fData.setOSGiFramework(fOSGIButton.getSelection() ? fOSGiCombo.getText() : null); |
224 |
fData.setWorkingSets(getSelectedWorkingSets()); |
285 |
fData.setWorkingSets(getSelectedWorkingSets()); |
|
|
286 |
fData.setExecutionEnvironment(fEEChoice.getText().trim()); |
225 |
} |
287 |
} |
226 |
|
288 |
|
227 |
protected boolean validatePage() { |
289 |
protected boolean validatePage() { |