Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 77279 Details for
Bug 170941
Be able to specify a Execution Environment when launching a Eclipse Application
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
patch170941.txt (text/plain), 18.54 KB, created by
Adam Archer
on 2007-08-29 14:07:35 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Adam Archer
Created:
2007-08-29 14:07:35 EDT
Size:
18.54 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/ui/launcher/MainTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/MainTab.java,v >retrieving revision 1.10 >diff -u -r1.10 MainTab.java >--- src/org/eclipse/pde/ui/launcher/MainTab.java 8 Jun 2007 16:35:13 -0000 1.10 >+++ src/org/eclipse/pde/ui/launcher/MainTab.java 29 Aug 2007 18:00:56 -0000 >@@ -183,7 +183,10 @@ > * @see org.eclipse.pde.ui.launcher.AbstractLauncherTab#validateTab() > */ > public void validateTab() { >- setErrorMessage(fDataBlock.validate()); >+ String error = fDataBlock.validate(); >+ if (error == null) >+ error = fJreBlock.validate(); >+ setErrorMessage(error); > } > > } >Index: src/org/eclipse/pde/ui/launcher/IPDELauncherConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/IPDELauncherConstants.java,v >retrieving revision 1.9 >diff -u -r1.9 IPDELauncherConstants.java >--- src/org/eclipse/pde/ui/launcher/IPDELauncherConstants.java 11 Sep 2006 18:02:01 -0000 1.9 >+++ src/org/eclipse/pde/ui/launcher/IPDELauncherConstants.java 29 Aug 2007 18:00:56 -0000 >@@ -73,6 +73,12 @@ > String APP_TO_TEST = "testApplication"; //$NON-NLS-1$ > > /** >+ * Indicates whether the <code>VMINSTALL</code> or the <code>EXECUTION_ENVIRONMENT</code> >+ * setting should be used to launch. >+ */ >+ String VM_OR_EE = "vmOrEe"; //$NON-NLS-1$ >+ >+ /** > * Launch configuration attribute key. The value is a string specifying > * the name of the VM to launch with. If the value is <code>null</code>, > * the default workspace VM is used. >@@ -81,6 +87,12 @@ > > /** > * Launch configuration attribute key. The value is a string specifying >+ * the name of the EE to launch with. >+ */ >+ String EXECUTION_ENVIRONMENT = "execEnvironment"; //$NON-NLS-1$ >+ >+ /** >+ * Launch configuration attribute key. The value is a string specifying > * the user-entered bootstrap classpath entries. > */ > String BOOTSTRAP_ENTRIES = "bootstrap"; //$NON-NLS-1$ >Index: src/org/eclipse/pde/internal/ui/launcher/VMHelper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/VMHelper.java,v >retrieving revision 1.8 >diff -u -r1.8 VMHelper.java >--- src/org/eclipse/pde/internal/ui/launcher/VMHelper.java 8 Jun 2007 16:45:06 -0000 1.8 >+++ src/org/eclipse/pde/internal/ui/launcher/VMHelper.java 29 Aug 2007 18:00:56 -0000 >@@ -80,7 +80,22 @@ > public static IVMInstall createLauncher( > ILaunchConfiguration configuration) > throws CoreException { >- String vm = configuration.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null); >+ boolean vmSelected = configuration.getAttribute(IPDELauncherConstants.VM_OR_EE, "vm").equals("vm"); //$NON-NLS-1$ //$NON-NLS-2$ >+ String vm; >+ if (vmSelected) >+ vm = configuration.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null); >+ else { >+ String id = configuration.getAttribute(IPDELauncherConstants.EXECUTION_ENVIRONMENT, (String)null); >+ if (id != null) { >+ IExecutionEnvironment ee = getExecutionEnvironment(id); >+ if (ee == null) >+ throw new CoreException( >+ LauncherUtils.createErrorStatus(NLS.bind(PDEUIMessages.VMHelper_cannotFindExecEnv, id))); >+ vm = getVMInstallName(ee); >+ } >+ else >+ vm = getDefaultVMInstallName(); >+ } > IVMInstall launcher = getVMInstall(vm); > if (launcher == null) > throw new CoreException( >@@ -99,4 +114,28 @@ > return manager.getExecutionEnvironments(); > } > >+ public static IExecutionEnvironment getExecutionEnvironment(String id) { >+ IExecutionEnvironmentsManager manager = >+ JavaRuntime.getExecutionEnvironmentsManager(); >+ return manager.getEnvironment(id); >+ } >+ >+ public static String getVMInstallName(IExecutionEnvironment ee) throws CoreException { >+ IVMInstall vmi = ee.getDefaultVM(); >+ if (vmi == null) { >+ IVMInstall[] vmis = ee.getCompatibleVMs(); >+ for (int i = 0; i < vmis.length; i++) { >+ if (ee.isStrictlyCompatible(vmis[i])) { >+ vmi = vmis[i]; >+ break; >+ } >+ if (vmi == null) >+ vmi = vmis[i]; >+ } >+ if (vmi == null) >+ throw new CoreException( >+ LauncherUtils.createErrorStatus(NLS.bind(PDEUIMessages.VMHelper_noJreForExecEnv, ee.getId()))); >+ } >+ return vmi.getName(); >+ } > } >Index: src/org/eclipse/pde/internal/ui/launcher/JREBlock.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/JREBlock.java,v >retrieving revision 1.8 >diff -u -r1.8 JREBlock.java >--- src/org/eclipse/pde/internal/ui/launcher/JREBlock.java 8 Jun 2007 16:45:06 -0000 1.8 >+++ src/org/eclipse/pde/internal/ui/launcher/JREBlock.java 29 Aug 2007 18:00:56 -0000 >@@ -17,6 +17,8 @@ > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >+import org.eclipse.jdt.launching.environments.IExecutionEnvironment; >+import org.eclipse.osgi.util.NLS; > import org.eclipse.pde.internal.ui.PDEUIMessages; > import org.eclipse.pde.internal.ui.preferences.PDEPreferencesUtil; > import org.eclipse.pde.internal.ui.util.SWTUtil; >@@ -42,12 +44,18 @@ > private Listener fListener = new Listener(); > private Button fJavawButton; > private Button fJavaButton; >+ private Button fJreButton; >+ private Button fEeButton; >+ private Button fJrePrefButton; >+ private Button fEePrefButton; > private Combo fJreCombo; >+ private Combo fEeCombo; > private Text fBootstrap; > > class Listener extends SelectionAdapter implements ModifyListener { > public void widgetSelected(SelectionEvent e) { > fTab.updateLaunchConfigurationDialog(); >+ updateJREEnablement(); > } > public void modifyText(ModifyEvent e) { > fTab.updateLaunchConfigurationDialog(); >@@ -62,7 +70,7 @@ > Group group = new Group(parent, SWT.NONE); > group.setText(PDEUIMessages.MainTab_jreSection); > GridLayout layout = new GridLayout(); >- layout.numColumns = 2; >+ layout.numColumns = 3; > group.setLayout(layout); > group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); > >@@ -72,25 +80,20 @@ > } > > protected void createJRESection(Composite parent) { >- Label label = new Label(parent, SWT.NONE); >- label.setText(PDEUIMessages.BasicLauncherTab_jre); >- >- Composite composite = new Composite(parent, SWT.NONE); >- GridLayout layout = new GridLayout(); >- layout.numColumns = 2; >- layout.marginHeight = layout.marginWidth = 0; >- composite.setLayout(layout); >- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ fJreButton = new Button(parent, SWT.RADIO); >+ fJreButton.setText(PDEUIMessages.BasicLauncherTab_jre); >+ fJreButton.addSelectionListener(fListener); > >- fJreCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); >- fJreCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ fJreCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); >+ fJreCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); > fJreCombo.addSelectionListener(fListener); > >- Button button = new Button(composite, SWT.PUSH); >- button.setText(PDEUIMessages.BasicLauncherTab_installedJREs); >- button.addSelectionListener(new SelectionAdapter() { >+ fJrePrefButton = new Button(parent, SWT.PUSH); >+ fJrePrefButton.setText(PDEUIMessages.BasicLauncherTab_installedJREs); >+ fJrePrefButton.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > String currentVM = fJreCombo.getText(); >+ String currentEE = parseEESelection(fEeCombo.getText()); > boolean useDefault = VMHelper.getDefaultVMInstallName().equals(currentVM); > String[] pageIDs = new String[] {"org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"}; //$NON-NLS-1$ > if (PDEPreferencesUtil.showPreferencePage(pageIDs, fTab.getControl().getShell())) { >@@ -99,11 +102,36 @@ > fJreCombo.setText(VMHelper.getDefaultVMInstallName()); > else > fJreCombo.setText(currentVM); >+ setEECombo(); >+ setEEComboSelection(currentEE); > } > } > }); >- button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); >- SWTUtil.setButtonDimensionHint(button); >+ fJrePrefButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); >+ SWTUtil.setButtonDimensionHint(fJrePrefButton); >+ >+ fEeButton = new Button(parent, SWT.RADIO); >+ fEeButton.setText(PDEUIMessages.BasicLauncherTab_ee); >+ fEeButton.addSelectionListener(fListener); >+ >+ fEeCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); >+ fEeCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); >+ fEeCombo.addSelectionListener(fListener); >+ >+ fEePrefButton = new Button(parent, SWT.PUSH); >+ fEePrefButton.setText(PDEUIMessages.BasicLauncherTab_environments); >+ fEePrefButton.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ String currentEE = parseEESelection(fEeCombo.getText()); >+ String[] pageIDs = new String[] {"org.eclipse.jdt.debug.ui.jreProfiles"}; //$NON-NLS-1$ >+ if (PDEPreferencesUtil.showPreferencePage(pageIDs, fTab.getControl().getShell())) { >+ setEECombo(); >+ setEEComboSelection(currentEE); >+ } >+ } >+ }); >+ fEePrefButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); >+ SWTUtil.setButtonDimensionHint(fEePrefButton); > } > > protected void createJavaExecutableSection(Composite parent) { >@@ -116,7 +144,9 @@ > layout.marginHeight = layout.marginWidth = 0; > layout.horizontalSpacing = 20; > composite.setLayout(layout); >- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = 2; >+ composite.setLayoutData(gd); > > fJavawButton = new Button(composite, SWT.RADIO); > fJavawButton.setText(PDEUIMessages.BasicLauncherTab_javaExecDefault); // >@@ -134,6 +164,7 @@ > fBootstrap = new Text(parent, SWT.BORDER); > GridData gd = new GridData(GridData.FILL_HORIZONTAL); > gd.widthHint = 300; >+ gd.horizontalSpan = 2; > fBootstrap.setLayoutData(gd); > fBootstrap.addModifyListener(fListener); > } >@@ -142,18 +173,50 @@ > initializeJRESection(config); > initializeBootstrapEntriesSection(config); > } >- >+ > private void initializeJRESection(ILaunchConfiguration config) throws CoreException { > String javaCommand = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_JAVA_COMMAND, "javaw"); //$NON-NLS-1$ > fJavawButton.setSelection(javaCommand.equals("javaw")); //$NON-NLS-1$ > fJavaButton.setSelection(!fJavawButton.getSelection()); > >+ String vmEe = config.getAttribute(IPDELauncherConstants.VM_OR_EE, "vm"); //$NON-NLS-1$ >+ fJreButton.setSelection(vmEe.equals("vm")); //$NON-NLS-1$ >+ fEeButton.setSelection(!fJreButton.getSelection()); >+ > setJRECombo(); > String vmInstallName = > config.getAttribute(IPDELauncherConstants.VMINSTALL, VMHelper.getDefaultVMInstallName()); > fJreCombo.setText(vmInstallName); > if (fJreCombo.getSelectionIndex() == -1) > fJreCombo.setText(VMHelper.getDefaultVMInstallName()); >+ >+ setEECombo(); >+ String eeId = >+ config.getAttribute(IPDELauncherConstants.EXECUTION_ENVIRONMENT, (String) null); >+ setEEComboSelection(eeId); >+ >+ updateJREEnablement(); >+ } >+ >+ private void setEEComboSelection (String eeId) { >+ if (eeId != null) { >+ String[] items = fEeCombo.getItems(); >+ for (int i = 0; i < items.length; i++) { >+ if (parseEESelection(items[i]).equals(eeId)) { >+ fEeCombo.select(i); >+ break; >+ } >+ } >+ } >+ if (fEeCombo.getItemCount() > 0 && fEeCombo.getSelectionIndex() == -1) >+ fEeCombo.select(0); >+ } >+ >+ private void updateJREEnablement() { >+ fJreCombo.setEnabled(fJreButton.getSelection()); >+ fJrePrefButton.setEnabled(fJreButton.getSelection()); >+ fEeCombo.setEnabled(fEeButton.getSelection()); >+ fEePrefButton.setEnabled(fEeButton.getSelection()); > } > > private void initializeBootstrapEntriesSection(ILaunchConfiguration config) throws CoreException { >@@ -170,16 +233,25 @@ > String javaCommand = fJavawButton.getSelection() ? null : "java"; //$NON-NLS-1$ > config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JAVA_COMMAND, javaCommand); > >- if (fJreCombo.getSelectionIndex() == -1) >- return; >- >- String jre = fJreCombo.getText(); >- if (config.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null) != null) { >- config.setAttribute(IPDELauncherConstants.VMINSTALL, jre); >+ String vmEe = fJreButton.getSelection() ? "vm" : "ee"; //$NON-NLS-1$ //$NON-NLS-2$ >+ config.setAttribute(IPDELauncherConstants.VM_OR_EE, vmEe); >+ if (fJreButton.getSelection()) { >+ if (fJreCombo.getSelectionIndex() == -1) >+ return; >+ >+ String jre = fJreCombo.getText(); >+ if (config.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null) != null) { >+ config.setAttribute(IPDELauncherConstants.VMINSTALL, jre); >+ } else { >+ config.setAttribute( >+ IPDELauncherConstants.VMINSTALL, >+ jre.equals(VMHelper.getDefaultVMInstallName()) ? null : jre); >+ } > } else { >- config.setAttribute( >- IPDELauncherConstants.VMINSTALL, >- jre.equals(VMHelper.getDefaultVMInstallName()) ? null : jre); >+ if (fEeCombo.getSelectionIndex() == -1) >+ return; >+ >+ config.setAttribute(IPDELauncherConstants.EXECUTION_ENVIRONMENT, parseEESelection(fEeCombo.getText())); > } > } catch (CoreException e) { > } >@@ -195,11 +267,44 @@ > > private void setJRECombo() { > String[] jres = VMHelper.getVMInstallNames(); >- Arrays.sort(jres, new Comparator() { >+ Arrays.sort(jres, getComparator()); >+ fJreCombo.setItems(jres); >+ } >+ >+ private void setEECombo() { >+ IExecutionEnvironment[] eeObjects = VMHelper.getExecutionEnvironments(); >+ String[] ees = new String[eeObjects.length]; >+ for (int i = 0; i < eeObjects.length; i++) { >+ String vm; >+ try { >+ vm = VMHelper.getVMInstallName(eeObjects[i]); >+ } catch (CoreException e) { >+ vm = PDEUIMessages.BasicLauncherTab_unbound; >+ } >+ ees[i] = NLS.bind(PDEUIMessages.BasicLauncherTab_2, new String[] { eeObjects[i].getId(), vm }); >+ } >+ Arrays.sort(ees, getComparator()); >+ fEeCombo.setItems(ees); >+ } >+ >+ private Comparator getComparator() { >+ return new Comparator() { > public int compare(Object arg0, Object arg1) { > return arg0.toString().compareTo(arg1.toString()); > } >- }); >- fJreCombo.setItems(jres); >+ }; >+ } >+ >+ public String validate() { >+ if (fEeButton.getSelection() && fEeCombo.getText().indexOf(PDEUIMessages.BasicLauncherTab_unbound) != -1) >+ return NLS.bind(PDEUIMessages.BasicLauncherTab_noJreForEeMessage, parseEESelection(fEeCombo.getText())); >+ return null; >+ } >+ >+ private String parseEESelection (String selection) { >+ int index = selection.indexOf(" ("); //$NON-NLS-1$ >+ if (index == -1) >+ return selection; >+ return selection.substring(0, index); > } > } >Index: src/org/eclipse/pde/internal/ui/PDEUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java,v >retrieving revision 1.319 >diff -u -r1.319 PDEUIMessages.java >--- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 28 Aug 2007 22:05:14 -0000 1.319 >+++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 29 Aug 2007 18:00:56 -0000 >@@ -1085,12 +1085,22 @@ > public static String WorkspaceDataBlock_clearLog; > public static String WorkspaceDataBlock_clearWorkspace; > public static String BasicLauncherTab_javaExec; >+ >+ public static String BasicLauncherTab_unbound; > public static String ProgramBlock_runProduct; >+ >+ public static String BasicLauncherTab_2; >+ >+ public static String BasicLauncherTab_ee; > public static String BasicLauncherTab_jre; >+ >+ public static String BasicLauncherTab_environments; > public static String BasicLauncherTab_installedJREs; > public static String ProgramBlock_programToRun; > public static String BasicLauncherTab_bootstrap; > public static String BasicLauncherTab_javaExecDefault; >+ >+ public static String BasicLauncherTab_noJreForEeMessage; > public static String ProgramBlock_runApplication; > public static String JUnitProgramBlock_headless; > >@@ -2958,6 +2968,10 @@ > public static String HyperlinkActionOpenDescription; > public static String HyperlinkActionOpenBundle; > public static String HyperlinkActionOpenPackage; >+ >+ public static String VMHelper_cannotFindExecEnv; >+ >+ public static String VMHelper_noJreForExecEnv; > public static String HyperlinkActionOpenResource; > public static String HyperlinkActionOpenSchema; > public static String HyperlinkActionOpenTranslation; >Index: src/org/eclipse/pde/internal/ui/pderesources.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties,v >retrieving revision 1.917 >diff -u -r1.917 pderesources.properties >--- src/org/eclipse/pde/internal/ui/pderesources.properties 29 Aug 2007 15:29:34 -0000 1.917 >+++ src/org/eclipse/pde/internal/ui/pderesources.properties 29 Aug 2007 18:00:56 -0000 >@@ -443,10 +443,15 @@ > ProgramBlock_programToRun=Program to Run > ProgramBlock_runApplication=Run an &application: > BasicLauncherTab_javaExec=Java Executable: >+BasicLauncherTab_unbound=unbound >+BasicLauncherTab_2={0} ({1}) >+BasicLauncherTab_ee=E&xecution Environment: > BasicLauncherTab_jre =Runtim&e JRE: >+BasicLauncherTab_environments=En&vironments... > BasicLauncherTab_installedJREs = In&stalled JREs... > BasicLauncherTab_bootstrap=B&ootstrap Entries: > BasicLauncherTab_javaExecDefault=defa&ult >+BasicLauncherTab_noJreForEeMessage=No JREs in workspace compatible with specified execution environment: {0} > JUnitProgramBlock_headless=[No Application] - Headless Mode > > AdvancedLauncherTab_name = Plu&g-ins >@@ -2362,6 +2367,8 @@ > StateViewPage_showLeaves=Show leaf plug-ins > StateViewPage_openItem=Open > StateViewPage_focusOnTitle=Focus On >+VMHelper_cannotFindExecEnv=Cannot locate Execution Environment definition: "{0}". Launch aborted. >+VMHelper_noJreForExecEnv=No installed JREs satisfy this Execution Environment: "{0}". Launch aborted. > StateViewPage_title=Current PDE State Environment > StateViewPage_showOnlyUnresolved_label=Show only unresolved plug-ins > StateViewPage_focusActionDescription=Focus on selected item
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 170941
:
77279
|
77737