View | Details | Raw Unified | Return to bug 179213
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/wizards/plugin/NewProjectCreationOperation.java (-1 / +13 lines)
Lines 233-238 Link Here
233
					if (!framework.equals(ICoreConstants.EQUINOX))
233
					if (!framework.equals(ICoreConstants.EQUINOX))
234
						return;
234
						return;
235
				}
235
				}
236
				// Set required EE
237
				String exeEnvironment = ((AbstractFieldData)fData).getExecutionEnvironment();
238
				if(exeEnvironment != null) {
239
					bundle.setHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, exeEnvironment);
240
				}
236
			} 
241
			} 
237
			if (fData instanceof IPluginFieldData && ((IPluginFieldData)fData).doGenerateClass()) {
242
			if (fData instanceof IPluginFieldData && ((IPluginFieldData)fData).doGenerateClass()) {
238
				if (targetVersion.equals("3.1")) //$NON-NLS-1$
243
				if (targetVersion.equals("3.1")) //$NON-NLS-1$
Lines 405-411 Link Here
405
				project, data);
410
				project, data);
406
		IClasspathEntry[] entries = new IClasspathEntry[internalClassPathEntries.length + 2];
411
		IClasspathEntry[] entries = new IClasspathEntry[internalClassPathEntries.length + 2];
407
		System.arraycopy(internalClassPathEntries, 0, entries, 0, internalClassPathEntries.length);
412
		System.arraycopy(internalClassPathEntries, 0, entries, 0, internalClassPathEntries.length);
408
		entries[entries.length - 2] = ClasspathComputer.createJREEntry(null);
413
414
		// Set EE of new project
415
		String executionEnvironment = "";
416
		if(data instanceof AbstractFieldData) {
417
			executionEnvironment = ((AbstractFieldData) data).getExecutionEnvironment();
418
		}
419
		
420
		entries[entries.length - 2] = ClasspathComputer.createJREEntry(executionEnvironment);
409
		entries[entries.length - 1] = ClasspathComputer.createContainerEntry();
421
		entries[entries.length - 1] = ClasspathComputer.createContainerEntry();
410
		return entries;
422
		return entries;
411
	}
423
	}
(-)src/org/eclipse/pde/internal/ui/wizards/plugin/NewProjectCreationPage.java (+62 lines)
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() {
(-)src/org/eclipse/pde/internal/ui/wizards/plugin/AbstractFieldData.java (+8 lines)
Lines 28-33 Link Here
28
	private String fTargetVersion = "3.1"; //$NON-NLS-1$
28
	private String fTargetVersion = "3.1"; //$NON-NLS-1$
29
	private String fFramework;
29
	private String fFramework;
30
	private IWorkingSet[] fWorkingSets;
30
	private IWorkingSet[] fWorkingSets;
31
	private String fExecutionEnvironment;
31
32
32
	/* (non-Javadoc)
33
	/* (non-Javadoc)
33
	 * @see org.eclipse.pde.ui.IFieldData2#getId()
34
	 * @see org.eclipse.pde.ui.IFieldData2#getId()
Lines 160-163 Link Here
160
		fWorkingSets = workingSets;
161
		fWorkingSets = workingSets;
161
	}
162
	}
162
	
163
	
164
	public void setExecutionEnvironment(String executionEnvironment) {
165
		fExecutionEnvironment = executionEnvironment;
166
	}
167
	
168
	public String getExecutionEnvironment() {
169
		return fExecutionEnvironment;
170
	}	
163
}
171
}
(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+6 lines)
Lines 2389-2394 Link Here
2389
2389
2390
	public static String NewProjectCreationPage_ptarget;
2390
	public static String NewProjectCreationPage_ptarget;
2391
2391
2392
	public static String NewProjectCreationPage_executionEnvironments_label;
2393
	
2394
	public static String NewProjectCreationPage_environmentsButton;
2395
	
2396
	public static String NewProjectCreationPage_targetEnvironment;
2397
	
2392
	public static String RequiredExecutionEnvironmentSection_title;
2398
	public static String RequiredExecutionEnvironmentSection_title;
2393
2399
2394
	public static String PluginGeneralInfoSection_lazyStart;
2400
	public static String PluginGeneralInfoSection_lazyStart;
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (+3 lines)
Lines 763-768 Link Here
763
NewProjectCreationPage_ftarget=This fragment is targeted to run with:
763
NewProjectCreationPage_ftarget=This fragment is targeted to run with:
764
NewProjectCreationPage_ptarget=This plug-in is targeted to run with:
764
NewProjectCreationPage_ptarget=This plug-in is targeted to run with:
765
NewProjectCreationPage_pDependsOnRuntime=&Eclipse version:
765
NewProjectCreationPage_pDependsOnRuntime=&Eclipse version:
766
NewProjectCreationPage_environmentsButton=En&vironments...
767
NewProjectCreationPage_executionEnvironments_label=E&xecution Environment:
768
NewProjectCreationPage_targetEnvironment=Target Environment
766
NewProjectCreationPage_invalidProjectName=Project name cannot contain %
769
NewProjectCreationPage_invalidProjectName=Project name cannot contain %
767
NewProjectCreationPage_invalidLocationPath=Location path cannot contain %
770
NewProjectCreationPage_invalidLocationPath=Location path cannot contain %
768
NewProjectCreationOperation_buildPropertiesFile = the build.properties file
771
NewProjectCreationOperation_buildPropertiesFile = the build.properties file

Return to bug 179213