Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 213269 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/wizards/plugin/NewProjectCreationPage.java (-80 lines)
Lines 11-26 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.wizards.plugin;
12
package org.eclipse.pde.internal.ui.wizards.plugin;
13
13
14
import java.util.TreeSet;
15
16
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.resources.IResource;
15
import org.eclipse.core.resources.IResource;
18
import org.eclipse.core.resources.IWorkspace;
16
import org.eclipse.core.resources.IWorkspace;
19
import org.eclipse.core.resources.ResourcesPlugin;
17
import org.eclipse.core.resources.ResourcesPlugin;
20
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.IStatus;
21
import org.eclipse.jdt.launching.IVMInstall;
22
import org.eclipse.jdt.launching.JavaRuntime;
23
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
24
import org.eclipse.jdt.ui.PreferenceConstants;
19
import org.eclipse.jdt.ui.PreferenceConstants;
25
import org.eclipse.jface.dialogs.Dialog;
20
import org.eclipse.jface.dialogs.Dialog;
26
import org.eclipse.jface.dialogs.IDialogSettings;
21
import org.eclipse.jface.dialogs.IDialogSettings;
Lines 31-37 Link Here
31
import org.eclipse.pde.internal.core.TargetPlatformHelper;
26
import org.eclipse.pde.internal.core.TargetPlatformHelper;
32
import org.eclipse.pde.internal.ui.IHelpContextIds;
27
import org.eclipse.pde.internal.ui.IHelpContextIds;
33
import org.eclipse.pde.internal.ui.PDEUIMessages;
28
import org.eclipse.pde.internal.ui.PDEUIMessages;
34
import org.eclipse.pde.internal.ui.launcher.VMHelper;
35
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.SWT;
36
import org.eclipse.swt.events.ModifyEvent;
30
import org.eclipse.swt.events.ModifyEvent;
37
import org.eclipse.swt.events.ModifyListener;
31
import org.eclipse.swt.events.ModifyListener;
Lines 42-54 Link Here
42
import org.eclipse.swt.widgets.Button;
36
import org.eclipse.swt.widgets.Button;
43
import org.eclipse.swt.widgets.Combo;
37
import org.eclipse.swt.widgets.Combo;
44
import org.eclipse.swt.widgets.Composite;
38
import org.eclipse.swt.widgets.Composite;
45
import org.eclipse.swt.widgets.Event;
46
import org.eclipse.swt.widgets.Group;
39
import org.eclipse.swt.widgets.Group;
47
import org.eclipse.swt.widgets.Label;
40
import org.eclipse.swt.widgets.Label;
48
import org.eclipse.swt.widgets.Listener;
49
import org.eclipse.swt.widgets.Text;
41
import org.eclipse.swt.widgets.Text;
50
import org.eclipse.ui.PlatformUI;
42
import org.eclipse.ui.PlatformUI;
51
import org.eclipse.ui.dialogs.PreferencesUtil;
52
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
43
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
53
44
54
45
Lines 65-72 Link Here
65
	private Combo fOSGiCombo;
56
	private Combo fOSGiCombo;
66
	private Button fOSGIButton;
57
	private Button fOSGIButton;
67
	private IStructuredSelection fSelection;
58
	private IStructuredSelection fSelection;
68
	private Button fExeEnvButton;
69
	private Combo fEEChoice;
70
	
59
	
71
	private static final String S_OSGI_PROJECT = "osgiProject"; //$NON-NLS-1$
60
	private static final String S_OSGI_PROJECT = "osgiProject"; //$NON-NLS-1$
72
	private static final String S_TARGET_NAME = "targetName"; //$NON-NLS-1$
61
	private static final String S_TARGET_NAME = "targetName"; //$NON-NLS-1$
Lines 86-92 Link Here
86
75
87
		createProjectTypeGroup(control);
76
		createProjectTypeGroup(control);
88
		createFormatGroup(control);
77
		createFormatGroup(control);
89
		createExecutionEnvironmentGroup(control);
90
		createWorkingSetGroup(
78
		createWorkingSetGroup(
91
				control,
79
				control,
92
				fSelection,
80
				fSelection,
Lines 103-158 Link Here
103
		setControl(control);
91
		setControl(control);
104
	}
92
	}
105
	
93
	
106
	private void createExecutionEnvironmentGroup(Composite container) {
107
		Group group = new Group(container, SWT.NONE);
108
		group.setText(PDEUIMessages.NewProjectCreationPage_targetEnvironment);
109
		GridLayout layout = new GridLayout();
110
		layout.numColumns = 3;
111
		group.setLayout(layout);
112
		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
113
		
114
		// Create label
115
		Label envs = new Label(group, SWT.NONE);	
116
		envs.setText(PDEUIMessages.NewProjectCreationPage_executionEnvironments_label);
117
118
		// Create combo
119
		fEEChoice = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
120
		fEEChoice.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
121
		
122
		// Gather EEs 
123
		IExecutionEnvironment[] exeEnvs = VMHelper.getExecutionEnvironments();
124
		TreeSet availableEEs = new TreeSet();		
125
		for (int i = 0; i < exeEnvs.length; i++) {
126
			availableEEs.add(exeEnvs[i].getId());		
127
		}
128
		
129
		// Set data 
130
		fEEChoice.setItems((String[]) availableEEs.toArray(new String[availableEEs.size()-1]));
131
		
132
		// Set default EE based on strict match to default VM
133
		IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
134
		String[] EEChoices = fEEChoice.getItems();
135
		for (int i = 0; i < EEChoices.length; i++) {			
136
			if(VMHelper.getExecutionEnvironment(EEChoices[i]).isStrictlyCompatible(defaultVM)) {
137
					fEEChoice.select(i);
138
					break;							
139
			}
140
		}		
141
		
142
		// Create button
143
		fExeEnvButton = createButton(group, SWT.PUSH, 1, 0);
144
		fExeEnvButton.setText(PDEUIMessages.NewProjectCreationPage_environmentsButton);		
145
		fExeEnvButton.addListener(SWT.Selection, new Listener() {
146
			public void handleEvent(Event event) {
147
				PreferencesUtil.createPreferenceDialogOn(
148
						getShell(), 
149
						"org.eclipse.jdt.debug.ui.jreProfiles", //$NON-NLS-1$
150
						new String[] { "org.eclipse.jdt.debug.ui.jreProfiles" }, null).open(); //$NON-NLS-1$ 
151
			}
152
		});
153
		updateExecEnvSection();
154
	}
155
	
156
	private void createProjectTypeGroup(Composite container) {
94
	private void createProjectTypeGroup(Composite container) {
157
		Group group = new Group(container, SWT.NONE);
95
		Group group = new Group(container, SWT.NONE);
158
		group.setText(PDEUIMessages.ProjectStructurePage_settings); 
96
		group.setText(PDEUIMessages.ProjectStructurePage_settings); 
Lines 171-177 Link Here
171
				fSourceText.setEnabled(enabled);
109
				fSourceText.setEnabled(enabled);
172
				fOutputlabel.setEnabled(enabled);
110
				fOutputlabel.setEnabled(enabled);
173
				fOutputText.setEnabled(enabled);
111
				fOutputText.setEnabled(enabled);
174
				updateExecEnvSection();
175
				setPageComplete(validatePage());
112
				setPageComplete(validatePage());
176
			}
113
			}
177
		});
114
		});
Lines 228-238 Link Here
228
			else
165
			else
229
				fTargetCombo.setText(ICoreConstants.TARGET33);
166
				fTargetCombo.setText(ICoreConstants.TARGET33);
230
		}
167
		}
231
		fTargetCombo.addSelectionListener(new SelectionAdapter(){
232
			public void widgetSelected(SelectionEvent e) {
233
				updateExecEnvSection();
234
			}
235
		});
236
		
168
		
237
	    fOSGIButton = createButton(group, SWT.RADIO, 1, 30);
169
	    fOSGIButton = createButton(group, SWT.RADIO, 1, 30);
238
    	fOSGIButton.setText(PDEUIMessages.NewProjectCreationPage_pPureOSGi); 	   
170
    	fOSGIButton.setText(PDEUIMessages.NewProjectCreationPage_pPureOSGi); 	   
Lines 252-267 Link Here
252
		
184
		
253
	}
185
	}
254
	
186
	
255
	private void updateExecEnvSection() {
256
		if (fTargetCombo.getText().equals(ICoreConstants.TARGET30) || !fJavaButton.getSelection()){
257
			fEEChoice.setEnabled(false);
258
			fExeEnvButton.setEnabled(false);
259
		} else {
260
			fEEChoice.setEnabled(true);
261
			fExeEnvButton.setEnabled(true);
262
		}
263
	}
264
	
265
	private void updateRuntimeDependency() {
187
	private void updateRuntimeDependency() {
266
		boolean depends = fEclipseButton.getSelection();
188
		boolean depends = fEclipseButton.getSelection();
267
		fTargetCombo.setEnabled(depends);
189
		fTargetCombo.setEnabled(depends);
Lines 308-315 Link Here
308
		fData.setHasBundleStructure(fOSGIButton.getSelection() || Double.parseDouble(fTargetCombo.getText()) >= 3.1);	
230
		fData.setHasBundleStructure(fOSGIButton.getSelection() || Double.parseDouble(fTargetCombo.getText()) >= 3.1);	
309
		fData.setOSGiFramework(fOSGIButton.getSelection() ? fOSGiCombo.getText() : null);
231
		fData.setOSGiFramework(fOSGIButton.getSelection() ? fOSGiCombo.getText() : null);
310
		fData.setWorkingSets(getSelectedWorkingSets());
232
		fData.setWorkingSets(getSelectedWorkingSets());
311
		if(fJavaButton.getSelection())
312
			fData.setExecutionEnvironment(fEEChoice.getText().trim());
313
	}
233
	}
314
	
234
	
315
    protected boolean validatePage() {
235
    protected boolean validatePage() {
(-)src/org/eclipse/pde/internal/ui/wizards/plugin/ContentPage.java (+9 lines)
Lines 71-76 Link Here
71
		return text;
71
		return text;
72
	}
72
	}
73
	
73
	
74
	protected Text createText(Composite parent, ModifyListener listener, int horizSpan){
75
		Text text = new Text(parent, SWT.BORDER | SWT.SINGLE);
76
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
77
		data.horizontalSpan = horizSpan;
78
		text.setLayoutData(data);
79
		text.addModifyListener(listener);
80
		return text;
81
	}
82
	
74
	protected abstract void validatePage();
83
	protected abstract void validatePage();
75
84
76
	protected String validateProperties() {
85
	protected String validateProperties() {
(-)src/org/eclipse/pde/internal/ui/wizards/plugin/PluginContentPage.java (-7 / +72 lines)
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);
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (-1 lines)
Lines 770-776 Link Here
770
NewProjectCreationPage_pDependsOnRuntime=&Eclipse version:
770
NewProjectCreationPage_pDependsOnRuntime=&Eclipse version:
771
NewProjectCreationPage_environmentsButton=En&vironments...
771
NewProjectCreationPage_environmentsButton=En&vironments...
772
NewProjectCreationPage_executionEnvironments_label=E&xecution Environment:
772
NewProjectCreationPage_executionEnvironments_label=E&xecution Environment:
773
NewProjectCreationPage_targetEnvironment=Target Environment
774
NewProjectCreationPage_invalidProjectName=Project name cannot contain %
773
NewProjectCreationPage_invalidProjectName=Project name cannot contain %
775
NewProjectCreationPage_invalidLocationPath=Location path cannot contain %
774
NewProjectCreationPage_invalidLocationPath=Location path cannot contain %
776
NewProjectCreationOperation_buildPropertiesFile = the build.properties file
775
NewProjectCreationOperation_buildPropertiesFile = the build.properties file
(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (-3 lines)
Lines 2422-2430 Link Here
2422
	
2422
	
2423
	public static String NewProjectCreationPage_environmentsButton;
2423
	public static String NewProjectCreationPage_environmentsButton;
2424
	
2424
	
2425
	public static String NewProjectCreationPage_targetEnvironment;
2426
	
2427
2428
	public static String RequiredExecutionEnvironmentSection_title;
2425
	public static String RequiredExecutionEnvironmentSection_title;
2429
2426
2430
	public static String PluginGeneralInfoSection_lazyStart;
2427
	public static String PluginGeneralInfoSection_lazyStart;

Return to bug 213269