|
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 88-116
Link Here
|
| 88 |
|
100 |
|
| 89 |
private void createPluginPropertiesGroup(Composite container) { |
101 |
private void createPluginPropertiesGroup(Composite container) { |
| 90 |
Group propertiesGroup = new Group(container, SWT.NONE); |
102 |
Group propertiesGroup = new Group(container, SWT.NONE); |
| 91 |
propertiesGroup.setLayout(new GridLayout(2, false)); |
103 |
propertiesGroup.setLayout(new GridLayout(3, false)); |
| 92 |
propertiesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
104 |
propertiesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 93 |
propertiesGroup.setText(PDEUIMessages.ContentPage_pGroup); |
105 |
propertiesGroup.setText(PDEUIMessages.ContentPage_pGroup); |
| 94 |
|
106 |
|
| 95 |
Label label = new Label(propertiesGroup, SWT.NONE); |
107 |
Label label = new Label(propertiesGroup, SWT.NONE); |
| 96 |
label.setText(PDEUIMessages.ContentPage_pid); |
108 |
label.setText(PDEUIMessages.ContentPage_pid); |
| 97 |
fIdText = createText(propertiesGroup, propertiesListener); |
109 |
fIdText = createText(propertiesGroup, propertiesListener, 2); |
| 98 |
|
110 |
|
| 99 |
label = new Label(propertiesGroup, SWT.NONE); |
111 |
label = new Label(propertiesGroup, SWT.NONE); |
| 100 |
label.setText(PDEUIMessages.ContentPage_pversion); |
112 |
label.setText(PDEUIMessages.ContentPage_pversion); |
| 101 |
fVersionText = createText(propertiesGroup, propertiesListener); |
113 |
fVersionText = createText(propertiesGroup, propertiesListener, 2); |
| 102 |
|
114 |
|
| 103 |
label = new Label(propertiesGroup, SWT.NONE); |
115 |
label = new Label(propertiesGroup, SWT.NONE); |
| 104 |
label.setText(PDEUIMessages.ContentPage_pname); |
116 |
label.setText(PDEUIMessages.ContentPage_pname); |
| 105 |
fNameText = createText(propertiesGroup, propertiesListener); |
117 |
fNameText = createText(propertiesGroup, propertiesListener, 2); |
| 106 |
|
118 |
|
| 107 |
label = new Label(propertiesGroup, SWT.NONE); |
119 |
label = new Label(propertiesGroup, SWT.NONE); |
| 108 |
label.setText(PDEUIMessages.ContentPage_pprovider); |
120 |
label.setText(PDEUIMessages.ContentPage_pprovider); |
| 109 |
fProviderText = createText(propertiesGroup, propertiesListener); |
121 |
fProviderText = createText(propertiesGroup, propertiesListener, 2); |
| 110 |
|
122 |
|
| 111 |
fLibraryLabel = new Label(propertiesGroup, SWT.NONE); |
123 |
fLibraryLabel = new Label(propertiesGroup, SWT.NONE); |
| 112 |
fLibraryLabel.setText(PDEUIMessages.ProjectStructurePage_library); |
124 |
fLibraryLabel.setText(PDEUIMessages.ProjectStructurePage_library); |
| 113 |
fLibraryText = createText(propertiesGroup, propertiesListener); |
125 |
fLibraryText = createText(propertiesGroup, propertiesListener, 2); |
|
|
126 |
|
| 127 |
createExecutionEnvironmentControls(propertiesGroup); |
| 128 |
} |
| 129 |
|
| 130 |
private void createExecutionEnvironmentControls(Composite container) { |
| 131 |
// Create label |
| 132 |
fEELabel = new Label(container, SWT.NONE); |
| 133 |
fEELabel.setText(PDEUIMessages.NewProjectCreationPage_executionEnvironments_label); |
| 134 |
|
| 135 |
// Create combo |
| 136 |
fEEChoice = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); |
| 137 |
fEEChoice.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 138 |
|
| 139 |
// Gather EEs |
| 140 |
IExecutionEnvironment[] exeEnvs = VMHelper.getExecutionEnvironments(); |
| 141 |
TreeSet availableEEs = new TreeSet(); |
| 142 |
for (int i = 0; i < exeEnvs.length; i++) { |
| 143 |
availableEEs.add(exeEnvs[i].getId()); |
| 144 |
} |
| 145 |
|
| 146 |
// Set data |
| 147 |
fEEChoice.setItems((String[]) availableEEs.toArray(new String[availableEEs.size()-1])); |
| 148 |
|
| 149 |
// Set default EE based on strict match to default VM |
| 150 |
IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); |
| 151 |
String[] EEChoices = fEEChoice.getItems(); |
| 152 |
for (int i = 0; i < EEChoices.length; i++) { |
| 153 |
if(VMHelper.getExecutionEnvironment(EEChoices[i]).isStrictlyCompatible(defaultVM)) { |
| 154 |
fEEChoice.select(i); |
| 155 |
break; |
| 156 |
} |
| 157 |
} |
| 158 |
|
| 159 |
// Create button |
| 160 |
fExeEnvButton = new Button(container, SWT.PUSH); |
| 161 |
fExeEnvButton.setLayoutData(new GridData()); |
| 162 |
fExeEnvButton.setText(PDEUIMessages.NewProjectCreationPage_environmentsButton); |
| 163 |
fExeEnvButton.addListener(SWT.Selection, new Listener() { |
| 164 |
public void handleEvent(Event event) { |
| 165 |
PreferencesUtil.createPreferenceDialogOn( |
| 166 |
getShell(), |
| 167 |
"org.eclipse.jdt.debug.ui.jreProfiles", //$NON-NLS-1$ |
| 168 |
new String[] { "org.eclipse.jdt.debug.ui.jreProfiles" }, null).open(); //$NON-NLS-1$ |
| 169 |
} |
| 170 |
}); |
| 114 |
} |
171 |
} |
| 115 |
|
172 |
|
| 116 |
private void createPluginClassGroup(Composite container) { |
173 |
private void createPluginClassGroup(Composite container) { |
|
Lines 166-171
Link Here
|
| 166 |
data.setUIPlugin(fUIPlugin.getSelection()); |
223 |
data.setUIPlugin(fUIPlugin.getSelection()); |
| 167 |
data.setDoGenerateClass(fGenerateClass.isEnabled() && fGenerateClass.getSelection()); |
224 |
data.setDoGenerateClass(fGenerateClass.isEnabled() && fGenerateClass.getSelection()); |
| 168 |
data.setRCPApplicationPlugin(!fData.isSimple() && !isPureOSGi() && fYesButton.getSelection()); |
225 |
data.setRCPApplicationPlugin(!fData.isSimple() && !isPureOSGi() && fYesButton.getSelection()); |
|
|
226 |
if(fEEChoice.isEnabled()) |
| 227 |
fData.setExecutionEnvironment(fEEChoice.getText().trim()); |
| 169 |
} |
228 |
} |
| 170 |
|
229 |
|
| 171 |
private void createRCPGroup(Composite container){ |
230 |
private void createRCPGroup(Composite container){ |
|
Lines 239-245
Link Here
|
| 239 |
int oldfChanged = fChangedGroups; |
298 |
int oldfChanged = fChangedGroups; |
| 240 |
fClassText.setText(computeId().toLowerCase(Locale.ENGLISH) + ".Activator"); //$NON-NLS-1$ |
299 |
fClassText.setText(computeId().toLowerCase(Locale.ENGLISH) + ".Activator"); //$NON-NLS-1$ |
| 241 |
fChangedGroups = oldfChanged; |
300 |
fChangedGroups = oldfChanged; |
| 242 |
} |
301 |
} |
|
|
302 |
|
| 303 |
boolean allowEESelection = !fData.isSimple() && fData.hasBundleStructure(); |
| 304 |
fEELabel.setEnabled(allowEESelection); |
| 305 |
fEEChoice.setEnabled(allowEESelection); |
| 306 |
fExeEnvButton.setEnabled(allowEESelection); |
| 307 |
|
| 243 |
fRCPGroup.setVisible(!fData.isSimple() && !isPureOSGi()); |
308 |
fRCPGroup.setVisible(!fData.isSimple() && !isPureOSGi()); |
| 244 |
} |
309 |
} |
| 245 |
super.setVisible(visible); |
310 |
super.setVisible(visible); |