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 131648 Details for
Bug 269111
[launcher] start levels don't get added when launching without a configurator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
org.eclipse.pde.patch
clipboard.txt (text/plain), 57.68 KB, created by
Chris Aniszczyk
on 2009-04-13 10:08:28 EDT
(
hide
)
Description:
org.eclipse.pde.patch
Filename:
MIME Type:
Creator:
Chris Aniszczyk
Created:
2009-04-13 10:08:28 EDT
Size:
57.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/launcher/OSGiValidationOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/OSGiValidationOperation.java,v >retrieving revision 1.2 >diff -u -r1.2 OSGiValidationOperation.java >--- src/org/eclipse/pde/internal/ui/launcher/OSGiValidationOperation.java 29 Apr 2007 02:02:08 -0000 1.2 >+++ src/org/eclipse/pde/internal/ui/launcher/OSGiValidationOperation.java 13 Apr 2009 14:08:22 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >+ * Copyright (c) 2007, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * EclipseSource Corporation - ongoing enhancements > *******************************************************************************/ > package org.eclipse.pde.internal.ui.launcher; > >@@ -21,7 +22,7 @@ > } > > protected IPluginModelBase[] getModels() throws CoreException { >- return BundleLauncherHelper.getMergedBundles(fLaunchConfiguration); >+ return BundleLauncherHelper.getMergedBundles(fLaunchConfiguration, true); > } > > } >Index: src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java,v >retrieving revision 1.33 >diff -u -r1.33 LaunchPluginValidator.java >--- src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java 28 Jan 2009 14:32:37 -0000 1.33 >+++ src/org/eclipse/pde/internal/ui/launcher/LaunchPluginValidator.java 13 Apr 2009 14:08:22 -0000 >@@ -14,144 +14,18 @@ > import org.eclipse.core.resources.IProject; > import org.eclipse.core.runtime.*; > import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jface.dialogs.IDialogConstants; >-import org.eclipse.osgi.service.resolver.BundleDescription; > import org.eclipse.pde.core.plugin.*; >-import org.eclipse.pde.internal.build.IPDEBuildConstants; >-import org.eclipse.pde.internal.core.*; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.SearchablePluginsManager; > import org.eclipse.pde.internal.ui.IPDEUIConstants; > import org.eclipse.pde.ui.launcher.IPDELauncherConstants; > import org.eclipse.swt.widgets.Display; > > public class LaunchPluginValidator { > >- public static void checkBackwardCompatibility(ILaunchConfiguration configuration, boolean save) throws CoreException { >- ILaunchConfigurationWorkingCopy wc = null; >- if (configuration.isWorkingCopy()) { >- wc = (ILaunchConfigurationWorkingCopy) configuration; >- } else { >- wc = configuration.getWorkingCopy(); >- } >- >- String value = configuration.getAttribute("wsproject", (String) null); //$NON-NLS-1$ >- if (value != null) { >- wc.setAttribute("wsproject", (String) null); //$NON-NLS-1$ >- if (value.indexOf(';') != -1) { >- value = value.replace(';', ','); >- } else if (value.indexOf(':') != -1) { >- value = value.replace(':', ','); >- } >- value = (value.length() == 0 || value.equals(",")) //$NON-NLS-1$ >- ? null >- : value.substring(0, value.length() - 1); >- >- boolean automatic = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true); >- String attr = automatic ? IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS; >- wc.setAttribute(attr, value); >- } >- >- String value2 = configuration.getAttribute("extplugins", (String) null); //$NON-NLS-1$ >- if (value2 != null) { >- wc.setAttribute("extplugins", (String) null); //$NON-NLS-1$ >- if (value2.indexOf(';') != -1) { >- value2 = value2.replace(';', ','); >- } else if (value2.indexOf(':') != -1) { >- value2 = value2.replace(':', ','); >- } >- value2 = (value2.length() == 0 || value2.equals(",")) ? null : value2.substring(0, value2.length() - 1); //$NON-NLS-1$ >- wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, value2); >- } >- >- String version = configuration.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, (String) null); >- boolean newApp = TargetPlatformHelper.usesNewApplicationModel(); >- boolean upgrade = !"3.3".equals(version) && newApp; //$NON-NLS-1$ >- if (!upgrade) >- upgrade = TargetPlatformHelper.getTargetVersion() >= 3.2 && version == null; >- if (upgrade) { >- wc.setAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, newApp ? "3.3" : "3.2a"); //$NON-NLS-1$ //$NON-NLS-2$ >- boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true); >- boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false); >- boolean automaticAdd = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true); >- if (!usedefault && !useFeatures) { >- ArrayList list = new ArrayList(); >- if (version == null) { >- list.add("org.eclipse.core.contenttype"); //$NON-NLS-1$ >- list.add("org.eclipse.core.jobs"); //$NON-NLS-1$ >- list.add(IPDEBuildConstants.BUNDLE_EQUINOX_COMMON); >- list.add("org.eclipse.equinox.preferences"); //$NON-NLS-1$ >- list.add("org.eclipse.equinox.registry"); //$NON-NLS-1$ >- list.add("org.eclipse.core.runtime.compatibility.registry"); //$NON-NLS-1$ >- } >- if (!"3.3".equals(version) && newApp) //$NON-NLS-1$ >- list.add("org.eclipse.equinox.app"); //$NON-NLS-1$ >- StringBuffer extensions = new StringBuffer(configuration.getAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, "")); //$NON-NLS-1$ >- StringBuffer target = new StringBuffer(configuration.getAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, "")); //$NON-NLS-1$ >- for (int i = 0; i < list.size(); i++) { >- String plugin = list.get(i).toString(); >- IPluginModelBase model = PluginRegistry.findModel(plugin); >- if (model == null) >- continue; >- if (model.getUnderlyingResource() != null) { >- if (automaticAdd) >- continue; >- if (extensions.length() > 0) >- extensions.append(","); //$NON-NLS-1$ >- extensions.append(plugin); >- } else { >- if (target.length() > 0) >- target.append(","); //$NON-NLS-1$ >- target.append(plugin); >- } >- } >- if (extensions.length() > 0) >- wc.setAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, extensions.toString()); >- if (target.length() > 0) >- wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, target.toString()); >- } >- } >- >- if (save && (value != null || value2 != null || upgrade)) >- wc.doSave(); >- } >- >- private static void addToMap(Map map, IPluginModelBase[] models) { >- for (int i = 0; i < models.length; i++) { >- addToMap(map, models[i]); >- } >- } >- >- private static void addToMap(Map map, IPluginModelBase model) { >- BundleDescription desc = model.getBundleDescription(); >- if (desc != null) { >- String id = desc.getSymbolicName(); >- // the reason that we are using a map is to easily check >- // if a plug-in with a certain id is among the plug-ins we are launching with. >- // Therefore, now that we support multiple plug-ins by the same ID, >- // once a particular ID is used up as a key, the rest can be entered >- // with key == id_version, for easy retrieval of values later on, >- // and without the need to create complicated data structures for values. >- if (!map.containsKey(id)) { >- map.put(id, model); >- } else { >- // since other code grabs only the model matching the "id", we want to make >- // sure the model matching the "id" has the highest version (because for singletons >- // the runtime will only resolve the highest version). Bug 218393 >- IPluginModelBase oldModel = (IPluginModelBase) map.get(id); >- String oldVersion = oldModel.getPluginBase().getVersion(); >- String newVersion = model.getPluginBase().getVersion(); >- if (oldVersion.compareTo(newVersion) < 0) { >- map.put(id + "_" + oldModel.getBundleDescription().getBundleId(), oldModel); //$NON-NLS-1$ >- map.put(id, model); >- } else { >- map.put(id + "_" + desc.getBundleId(), model); //$NON-NLS-1$ >- } >- } >- } >- } >- > private static IPluginModelBase[] getSelectedWorkspacePlugins(ILaunchConfiguration configuration) throws CoreException { > > boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true); >@@ -217,42 +91,6 @@ > return set; > } > >- public static IPluginModelBase[] getPluginList(ILaunchConfiguration config) throws CoreException { >- Map map = getPluginsToRun(config); >- return (IPluginModelBase[]) map.values().toArray(new IPluginModelBase[map.size()]); >- } >- >- public static Map getPluginsToRun(ILaunchConfiguration config) throws CoreException { >- >- checkBackwardCompatibility(config, true); >- >- TreeMap map = new TreeMap(); >- if (config.getAttribute(IPDELauncherConstants.USE_DEFAULT, true)) { >- addToMap(map, PluginRegistry.getActiveModels()); >- return map; >- } >- >- if (config.getAttribute(IPDELauncherConstants.USEFEATURES, false)) { >- addToMap(map, PluginRegistry.getWorkspaceModels()); >- return map; >- } >- >- addToMap(map, getSelectedWorkspacePlugins(config)); >- >- Map exModels = BundleLauncherHelper.getTargetBundleMap(config, null, IPDELauncherConstants.SELECTED_TARGET_PLUGINS); >- >- Iterator it = exModels.keySet().iterator(); >- while (it.hasNext()) { >- IPluginModelBase model = (IPluginModelBase) it.next(); >- String id = model.getPluginBase().getId(); >- IPluginModelBase existing = (IPluginModelBase) map.get(id); >- // only allow dups if plug-in existing in map is not a workspace plug-in >- if (existing == null || existing.getUnderlyingResource() == null) >- addToMap(map, model); >- } >- return map; >- } >- > public static IProject[] getAffectedProjects(ILaunchConfiguration config) throws CoreException { > // if restarting, no need to check projects for errors > if (config.getAttribute(IPDEUIConstants.RESTART, false)) >Index: src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java,v >retrieving revision 1.11 >diff -u -r1.11 BundleLauncherHelper.java >--- src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java 18 Mar 2009 16:33:09 -0000 1.11 >+++ src/org/eclipse/pde/internal/ui/launcher/BundleLauncherHelper.java 13 Apr 2009 14:08:21 -0000 >@@ -14,10 +14,12 @@ > import java.util.*; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.osgi.service.resolver.BundleDescription; > import org.eclipse.pde.core.plugin.*; > import org.eclipse.pde.internal.build.IPDEBuildConstants; > import org.eclipse.pde.internal.core.TargetPlatformHelper; >+import org.eclipse.pde.internal.ui.IPDEUIConstants; > import org.eclipse.pde.ui.launcher.IPDELauncherConstants; > > public class BundleLauncherHelper { >@@ -32,15 +34,41 @@ > return getTargetBundleMap(configuration, null, IPDELauncherConstants.TARGET_BUNDLES); > } > >- public static Map getMergedBundleMap(ILaunchConfiguration configuration) throws CoreException { >+ public static Map getMergedBundleMap(ILaunchConfiguration configuration, boolean osgi) throws CoreException { > Set set = new HashSet(); >- Map map = getWorkspaceBundleMap(configuration, set, IPDELauncherConstants.WORKSPACE_BUNDLES); >- map.putAll(getTargetBundleMap(configuration, set, IPDELauncherConstants.TARGET_BUNDLES)); >+ Map map = new HashMap(); >+ >+ // if we are using the eclipse-based launcher, we need special checks >+ if (!osgi) { >+ >+ checkBackwardCompatibility(configuration, true); >+ >+ if (configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true)) { >+ IPluginModelBase[] models = PluginRegistry.getActiveModels(); >+ for (int i = 0; i < models.length; i++) { >+ addBundleToMap(map, models[i], "default:default"); //$NON-NLS-1$ >+ } >+ return map; >+ } >+ >+ if (configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false)) { >+ IPluginModelBase[] models = PluginRegistry.getWorkspaceModels(); >+ for (int i = 0; i < models.length; i++) { >+ addBundleToMap(map, models[i], "default:default"); //$NON-NLS-1$ >+ } >+ return map; >+ } >+ } >+ >+ String workspace = osgi == false ? IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.WORKSPACE_BUNDLES; >+ String target = osgi == false ? IPDELauncherConstants.SELECTED_TARGET_PLUGINS : IPDELauncherConstants.TARGET_BUNDLES; >+ map = getWorkspaceBundleMap(configuration, set, workspace); >+ map.putAll(getTargetBundleMap(configuration, set, target)); > return map; > } > >- public static IPluginModelBase[] getMergedBundles(ILaunchConfiguration configuration) throws CoreException { >- Map map = getMergedBundleMap(configuration); >+ public static IPluginModelBase[] getMergedBundles(ILaunchConfiguration configuration, boolean osgi) throws CoreException { >+ Map map = getMergedBundleMap(configuration, osgi); > return (IPluginModelBase[]) map.keySet().toArray(new IPluginModelBase[map.size()]); > } > >@@ -67,7 +95,6 @@ > for (int i = 0; i < models.length; i++) { > IPluginBase base = models[i].getPluginBase(); > >- // TODO Very similar to logic in LaunchPluginValidator > // match only if... > // a) if we have the same version > // b) no version >@@ -191,4 +218,93 @@ > return buffer.toString(); > } > >+ public static void checkBackwardCompatibility(ILaunchConfiguration configuration, boolean save) throws CoreException { >+ ILaunchConfigurationWorkingCopy wc = null; >+ if (configuration.isWorkingCopy()) { >+ wc = (ILaunchConfigurationWorkingCopy) configuration; >+ } else { >+ wc = configuration.getWorkingCopy(); >+ } >+ >+ String value = configuration.getAttribute("wsproject", (String) null); //$NON-NLS-1$ >+ if (value != null) { >+ wc.setAttribute("wsproject", (String) null); //$NON-NLS-1$ >+ if (value.indexOf(';') != -1) { >+ value = value.replace(';', ','); >+ } else if (value.indexOf(':') != -1) { >+ value = value.replace(':', ','); >+ } >+ value = (value.length() == 0 || value.equals(",")) //$NON-NLS-1$ >+ ? null >+ : value.substring(0, value.length() - 1); >+ >+ boolean automatic = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true); >+ String attr = automatic ? IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS; >+ wc.setAttribute(attr, value); >+ } >+ >+ String value2 = configuration.getAttribute("extplugins", (String) null); //$NON-NLS-1$ >+ if (value2 != null) { >+ wc.setAttribute("extplugins", (String) null); //$NON-NLS-1$ >+ if (value2.indexOf(';') != -1) { >+ value2 = value2.replace(';', ','); >+ } else if (value2.indexOf(':') != -1) { >+ value2 = value2.replace(':', ','); >+ } >+ value2 = (value2.length() == 0 || value2.equals(",")) ? null : value2.substring(0, value2.length() - 1); //$NON-NLS-1$ >+ wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, value2); >+ } >+ >+ String version = configuration.getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, (String) null); >+ boolean newApp = TargetPlatformHelper.usesNewApplicationModel(); >+ boolean upgrade = !"3.3".equals(version) && newApp; //$NON-NLS-1$ >+ if (!upgrade) >+ upgrade = TargetPlatformHelper.getTargetVersion() >= 3.2 && version == null; >+ if (upgrade) { >+ wc.setAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, newApp ? "3.3" : "3.2a"); //$NON-NLS-1$ //$NON-NLS-2$ >+ boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true); >+ boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false); >+ boolean automaticAdd = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true); >+ if (!usedefault && !useFeatures) { >+ ArrayList list = new ArrayList(); >+ if (version == null) { >+ list.add("org.eclipse.core.contenttype"); //$NON-NLS-1$ >+ list.add("org.eclipse.core.jobs"); //$NON-NLS-1$ >+ list.add(IPDEBuildConstants.BUNDLE_EQUINOX_COMMON); >+ list.add("org.eclipse.equinox.preferences"); //$NON-NLS-1$ >+ list.add("org.eclipse.equinox.registry"); //$NON-NLS-1$ >+ list.add("org.eclipse.core.runtime.compatibility.registry"); //$NON-NLS-1$ >+ } >+ if (!"3.3".equals(version) && newApp) //$NON-NLS-1$ >+ list.add("org.eclipse.equinox.app"); //$NON-NLS-1$ >+ StringBuffer extensions = new StringBuffer(configuration.getAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, "")); //$NON-NLS-1$ >+ StringBuffer target = new StringBuffer(configuration.getAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, "")); //$NON-NLS-1$ >+ for (int i = 0; i < list.size(); i++) { >+ String plugin = list.get(i).toString(); >+ IPluginModelBase model = PluginRegistry.findModel(plugin); >+ if (model == null) >+ continue; >+ if (model.getUnderlyingResource() != null) { >+ if (automaticAdd) >+ continue; >+ if (extensions.length() > 0) >+ extensions.append(","); //$NON-NLS-1$ >+ extensions.append(plugin); >+ } else { >+ if (target.length() > 0) >+ target.append(","); //$NON-NLS-1$ >+ target.append(plugin); >+ } >+ } >+ if (extensions.length() > 0) >+ wc.setAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, extensions.toString()); >+ if (target.length() > 0) >+ wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, target.toString()); >+ } >+ } >+ >+ if (save && (value != null || value2 != null || upgrade)) >+ wc.doSave(); >+ } >+ > } >Index: src/org/eclipse/pde/internal/ui/launcher/LaunchConfigurationHelper.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchConfigurationHelper.java,v >retrieving revision 1.45 >diff -u -r1.45 LaunchConfigurationHelper.java >--- src/org/eclipse/pde/internal/ui/launcher/LaunchConfigurationHelper.java 2 Feb 2009 19:21:21 -0000 1.45 >+++ src/org/eclipse/pde/internal/ui/launcher/LaunchConfigurationHelper.java 13 Apr 2009 14:08:22 -0000 >@@ -79,7 +79,7 @@ > return mgr.performStringSubstitution(text); > } > >- public static Properties createConfigIniFile(ILaunchConfiguration configuration, String productID, Map map, File directory) throws CoreException { >+ public static Properties createConfigIniFile(ILaunchConfiguration configuration, String productID, Map bundles, Map bundlesWithStartLevels, File directory) throws CoreException { > Properties properties = null; > // if we are to generate a config.ini, start with the values in the target platform's config.ini - bug 141918 > if (configuration.getAttribute(IPDELauncherConstants.CONFIG_GENERATE_DEFAULT, true)) { >@@ -93,7 +93,7 @@ > // if target's config.ini has the osgi.bundles header, then parse and compute the proper osgi.bundles value > String bundleList = properties.getProperty(PROP_OSGI_BUNDLES); > if (bundleList != null) >- properties.setProperty(PROP_OSGI_BUNDLES, computeOSGiBundles(TargetPlatformHelper.stripPathInformation(bundleList), map)); >+ properties.setProperty(PROP_OSGI_BUNDLES, computeOSGiBundles(TargetPlatformHelper.stripPathInformation(bundleList), bundles, bundlesWithStartLevels)); > } else { > String templateLoc = configuration.getAttribute(IPDELauncherConstants.CONFIG_TEMPLATE_LOCATION, (String) null); > if (templateLoc != null) { >@@ -106,7 +106,7 @@ > } > // whether we create a new config.ini or read from one as a template, we should add the required properties - bug 161265 > if (properties != null) { >- addRequiredProperties(properties, productID, map); >+ addRequiredProperties(properties, productID, bundles, bundlesWithStartLevels); > } else { > properties = new Properties(); > } >@@ -119,50 +119,32 @@ > boolean autostart = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, false); > > // if we are launching using P2, write out P2 files (bundles.txt) and add P2 property to config.ini >- if (osgiBundles != null && osgiBundles.indexOf(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR) != -1 && map.containsKey(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR)) { >- >- // TODO we need to clean this up... our original list should have start level information >- // this causes a performance impact >+ if (osgiBundles != null && osgiBundles.indexOf(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR) != -1 && bundles.containsKey(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR)) { > URL bundlesTxt = null; > boolean usedefault = configuration.getAttribute(IPDELauncherConstants.USE_DEFAULT, true); > boolean useFeatures = configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false); > if (usedefault || useFeatures) { >- bundlesTxt = P2Utils.writeBundlesTxt(map.values(), osgiBundles, directory); >+ bundlesTxt = P2Utils.writeBundlesTxt(bundlesWithStartLevels, 4, false, directory, osgiBundles); > } else { >- Map models = new HashMap(); >- Map modelsWithStartLevels = new HashMap(); >- modelsWithStartLevels.putAll(BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.SELECTED_TARGET_PLUGINS)); >- boolean automaticAdd = configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true); >- String attribute = automaticAdd ? IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS : IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS; >- modelsWithStartLevels.putAll(BundleLauncherHelper.getWorkspaceBundleMap(configuration, null, attribute)); >- IPluginModelBase[] plugins = (IPluginModelBase[]) map.values().toArray(new IPluginModelBase[map.size()]); >- for (int i = 0; i < plugins.length; i++) { >- IPluginModelBase model = plugins[i]; >- String startLevel = (String) modelsWithStartLevels.get(model); >- if (startLevel != null) { >- models.put(model, startLevel); >- } >- } >- bundlesTxt = P2Utils.writeBundlesTxt(models, start, autostart, directory); >+ bundlesTxt = P2Utils.writeBundlesTxt(bundlesWithStartLevels, start, autostart, directory, null); > } > > if (bundlesTxt != null) { > properties.setProperty("org.eclipse.equinox.simpleconfigurator.configUrl", bundlesTxt.toString()); //$NON-NLS-1$ >- > // if we have simple configurator and update configurator together, ensure update doesn't reconcile >- if (map.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR) != null) { >+ if (bundles.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR) != null) { > properties.setProperty("org.eclipse.update.reconcile", "false"); //$NON-NLS-1$ //$NON-NLS-2$ > } > } > } > >- setBundleLocations(map, properties); >+ setBundleLocations(bundles, properties); > > save(new File(directory, "config.ini"), properties); //$NON-NLS-1$ > return properties; > } > >- private static void addRequiredProperties(Properties properties, String productID, Map map) { >+ private static void addRequiredProperties(Properties properties, String productID, Map bundles, Map bundlesWithStartLevels) { > if (!properties.containsKey("osgi.install.area")) //$NON-NLS-1$ > properties.setProperty("osgi.install.area", "file:" + TargetPlatform.getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ > if (!properties.containsKey("osgi.configuration.cascaded")) //$NON-NLS-1$ >@@ -170,12 +152,12 @@ > if (!properties.containsKey(PROP_OSGI_FRAMEWORK)) > properties.setProperty(PROP_OSGI_FRAMEWORK, IPDEBuildConstants.BUNDLE_OSGI); > if (!properties.containsKey("osgi.splashPath") && productID != null) //$NON-NLS-1$ >- addSplashLocation(properties, productID, map); >+ addSplashLocation(properties, productID, bundles); > // if osgi.splashPath is set, try to resolve relative paths to absolute paths > if (properties.containsKey("osgi.splashPath")) //$NON-NLS-1$ >- resolveLocationPath(properties.getProperty("osgi.splashPath"), properties, map); //$NON-NLS-1$ >+ resolveLocationPath(properties.getProperty("osgi.splashPath"), properties, bundles); //$NON-NLS-1$ > if (!properties.containsKey(PROP_OSGI_BUNDLES)) >- properties.setProperty(PROP_OSGI_BUNDLES, computeOSGiBundles(TargetPlatform.getBundleList(), map)); >+ properties.setProperty(PROP_OSGI_BUNDLES, computeOSGiBundles(TargetPlatform.getBundleList(), bundles, bundlesWithStartLevels)); > if (!properties.containsKey("osgi.bundles.defaultStartLevel")) //$NON-NLS-1$ > properties.setProperty("osgi.bundles.defaultStartLevel", "4"); //$NON-NLS-1$ //$NON-NLS-2$ > } >@@ -186,16 +168,17 @@ > * launching with. The list of bundles must have already had it's path information > * removed. > * @param bundleList list of bundles without path information >- * @param map map of bundle id to bundle model, contains all bundles being launched with >+ * @param bundles map of bundle id to bundle model, contains all bundles being launched with >+ * @param bundlesWithStartLevels map of bundles of start level > * @return string list of osgi bundles > */ >- private static String computeOSGiBundles(String bundleList, Map map) { >+ private static String computeOSGiBundles(String bundleList, Map bundles, Map bundlesWithStartLevels) { > > // if p2 and only simple configurator and > // if simple configurator isn't selected & isn't in bundle list... hack it > > // if using p2's simple configurator, a bundles.txt will be written, so we only need simple configurator in the config.ini >- if (map.get(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR) != null) >+ if (bundles.get(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR) != null) > return "org.eclipse.equinox.simpleconfigurator@1:start"; //$NON-NLS-1$ > > StringBuffer buffer = new StringBuffer(); >@@ -205,7 +188,7 @@ > String token = tokenizer.nextToken(); > int index = token.indexOf('@'); > String id = index != -1 ? token.substring(0, index) : token; >- if (map.containsKey(id)) { >+ if (bundles.containsKey(id)) { > if (buffer.length() > 0) > buffer.append(','); > buffer.append(id); >@@ -218,17 +201,18 @@ > // if org.eclipse.update.configurator is not included (LIKE IN BASIC RCP APPLICATION), then write out all bundles in osgi.bundles - bug 170772 > if (!initialBundleSet.contains(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR)) { > initialBundleSet.add(IPDEBuildConstants.BUNDLE_OSGI); >- Iterator iter = map.keySet().iterator(); >+ Iterator iter = bundlesWithStartLevels.keySet().iterator(); > while (iter.hasNext()) { >- String id = iter.next().toString(); >+ IPluginModelBase model = (IPluginModelBase) iter.next(); >+ String id = model.getPluginBase().getId(); > if (!initialBundleSet.contains(id)) { > if (buffer.length() > 0) > buffer.append(','); >+ >+ String slinfo = (String) bundlesWithStartLevels.get(model); > buffer.append(id); >- // if we are working with core.runtime, we need to ensure it's started >- if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(id)) { >- buffer.append("@start"); //$NON-NLS-1$ >- } >+ buffer.append('@'); >+ buffer.append(slinfo); > } > } > } >@@ -360,15 +344,16 @@ > while (tokenizer.hasMoreTokens()) { > String token = tokenizer.nextToken().trim(); > String url = getBundleURL(token, map, false); >- int index = -1; >+ int i = -1; > if (url == null) { >- index = token.indexOf('@'); >- if (index != -1) >- url = getBundleURL(token.substring(0, index), map, false); >+ i = token.indexOf('@'); >+ if (i != -1) { >+ url = getBundleURL(token.substring(0, i), map, false); >+ } > if (url == null) { >- index = token.indexOf(':'); >- if (index != -1) >- url = getBundleURL(token.substring(0, index), map, false); >+ i = token.indexOf(':'); >+ if (i != -1) >+ url = getBundleURL(token.substring(0, i), map, false); > } > } > if (url != null) { >@@ -376,14 +361,43 @@ > buffer.append(","); //$NON-NLS-1$ > } > buffer.append("reference:" + url); //$NON-NLS-1$ >- if (index != -1) >- buffer.append(token.substring(index)); >+ if (i != -1) { >+ String slinfo = token.substring(i + 1); >+ buffer.append(getStartData(slinfo, false)); >+ } > } > } > properties.setProperty(PROP_OSGI_BUNDLES, buffer.toString()); > } > } > >+ /** >+ * Convenience method to parses the startData ("startLevel:autoStart"), convert it to the >+ * format expected by the OSGi bundles property, and append to a StringBuffer. >+ * @param startData data to parse ("startLevel:autoStart") >+ * @param defaultAuto default auto start setting >+ */ >+ public static String getStartData(String startData, boolean defaultAuto) { >+ StringBuffer buffer = new StringBuffer(); >+ int index = startData.indexOf(':'); >+ String level = index > 0 ? startData.substring(0, index) : "default"; //$NON-NLS-1$ >+ String auto = index > 0 && index < startData.length() - 1 ? startData.substring(index + 1) : "default"; //$NON-NLS-1$ >+ if ("default".equals(auto)) //$NON-NLS-1$ >+ auto = Boolean.toString(defaultAuto); >+ if (!level.equals("default") || "true".equals(auto) || "start".equals(auto)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ buffer.append("@"); //$NON-NLS-1$ >+ >+ if (!level.equals("default")) { //$NON-NLS-1$ >+ buffer.append(level); >+ if ("start".equals(auto) || "true".equals(auto)) //$NON-NLS-1$ //$NON-NLS-2$ >+ buffer.append(":"); //$NON-NLS-1$ >+ } >+ if ("start".equals(auto) || "true".equals(auto)) { //$NON-NLS-1$ //$NON-NLS-2$ >+ buffer.append("start"); //$NON-NLS-1$ >+ } >+ return buffer.toString(); >+ } >+ > public static void save(File file, Properties properties) { > try { > FileOutputStream stream = new FileOutputStream(file); >Index: src/org/eclipse/pde/internal/ui/launcher/EclipsePluginValidationOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/EclipsePluginValidationOperation.java,v >retrieving revision 1.5 >diff -u -r1.5 EclipsePluginValidationOperation.java >--- src/org/eclipse/pde/internal/ui/launcher/EclipsePluginValidationOperation.java 16 Jan 2008 17:08:30 -0000 1.5 >+++ src/org/eclipse/pde/internal/ui/launcher/EclipsePluginValidationOperation.java 13 Apr 2009 14:08:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >+ * Copyright (c) 2007, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * EclipseSource Corporation - ongoing enhancements > *******************************************************************************/ > package org.eclipse.pde.internal.ui.launcher; > >@@ -35,7 +36,7 @@ > } > > protected IPluginModelBase[] getModels() throws CoreException { >- return LaunchPluginValidator.getPluginList(fLaunchConfiguration); >+ return BundleLauncherHelper.getMergedBundles(fLaunchConfiguration, false); > } > > public void run(IProgressMonitor monitor) throws CoreException { >Index: src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfigurationTabGroup.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfigurationTabGroup.java,v >retrieving revision 1.12 >diff -u -r1.12 AbstractPDELaunchConfigurationTabGroup.java >--- src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfigurationTabGroup.java 23 Mar 2008 19:53:41 -0000 1.12 >+++ src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfigurationTabGroup.java 13 Apr 2009 14:08:23 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * EclipseSource Corporation - ongoing enhancements > *******************************************************************************/ > package org.eclipse.pde.ui.launcher; > >@@ -18,8 +19,8 @@ > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; > import org.eclipse.pde.internal.core.TargetPlatformHelper; > import org.eclipse.pde.internal.ui.IPDEUIConstants; >+import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper; > import org.eclipse.pde.internal.ui.launcher.LaunchArgumentsHelper; >-import org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator; > import org.eclipse.swt.custom.BusyIndicator; > import org.eclipse.swt.widgets.Display; > >@@ -93,7 +94,7 @@ > wc.setAttribute(IPDELauncherConstants.LOCATION, value); > } > >- LaunchPluginValidator.checkBackwardCompatibility(wc, false); >+ BundleLauncherHelper.checkBackwardCompatibility(wc, false); > if (wc.isDirty()) { > wc.doSave(); > } >Index: src/org/eclipse/pde/ui/launcher/EquinoxLaunchConfiguration.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EquinoxLaunchConfiguration.java,v >retrieving revision 1.35 >diff -u -r1.35 EquinoxLaunchConfiguration.java >--- src/org/eclipse/pde/ui/launcher/EquinoxLaunchConfiguration.java 7 Dec 2008 00:00:21 -0000 1.35 >+++ src/org/eclipse/pde/ui/launcher/EquinoxLaunchConfiguration.java 13 Apr 2009 14:08:23 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * EclipseSource Corporation - ongoing enhancements > *******************************************************************************/ > package org.eclipse.pde.ui.launcher; > >@@ -74,7 +75,7 @@ > String bundles = null; > if (fAllBundles.containsKey(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR)) { > // If simple configurator is being used, we need to write out the bundles.txt instead of writing out the list in the config.ini >- URL bundlesTxt = P2Utils.writeBundlesTxt(fModels, start, autostart, getConfigDir(configuration)); >+ URL bundlesTxt = P2Utils.writeBundlesTxt(fModels, start, autostart, getConfigDir(configuration), null); > if (bundlesTxt != null) { > properties.setProperty("org.eclipse.equinox.simpleconfigurator.configUrl", bundlesTxt.toString()); //$NON-NLS-1$ > if (fAllBundles.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR) != null) { >@@ -153,7 +154,7 @@ > * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor) > */ > protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { >- fModels = BundleLauncherHelper.getMergedBundleMap(configuration); >+ fModels = BundleLauncherHelper.getMergedBundleMap(configuration, true); > fAllBundles = new HashMap(fModels.size()); > Iterator iter = fModels.keySet().iterator(); > while (iter.hasNext()) { >Index: src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfiguration.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfiguration.java,v >retrieving revision 1.29 >diff -u -r1.29 AbstractPDELaunchConfiguration.java >--- src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfiguration.java 27 Nov 2008 17:13:52 -0000 1.29 >+++ src/org/eclipse/pde/ui/launcher/AbstractPDELaunchConfiguration.java 13 Apr 2009 14:08:22 -0000 >@@ -207,7 +207,7 @@ > public String[] getVMArguments(ILaunchConfiguration configuration) throws CoreException { > String[] vmArgs = new ExecutionArguments(LaunchArgumentsHelper.getUserVMArguments(configuration), "").getVMArgumentsArray(); //$NON-NLS-1$ > // For p2 target, add "-Declipse.p2.data.area=@config.dir/p2" unless already specified by user >- Map bundleMap = LaunchPluginValidator.getPluginsToRun(configuration); >+ Map bundleMap = BundleLauncherHelper.getMergedBundleMap(configuration, false); > if (bundleMap.containsKey("org.eclipse.equinox.p2.core")) { //$NON-NLS-1$ > for (int i = 0; i < vmArgs.length; i++) { > String arg = vmArgs[i]; >Index: src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java,v >retrieving revision 1.33 >diff -u -r1.33 EclipseApplicationLaunchConfiguration.java >--- src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java 18 Mar 2009 20:52:44 -0000 1.33 >+++ src/org/eclipse/pde/ui/launcher/EclipseApplicationLaunchConfiguration.java 13 Apr 2009 14:08:23 -0000 >@@ -37,6 +37,13 @@ > */ > public class EclipseApplicationLaunchConfiguration extends AbstractPDELaunchConfiguration { > >+ // used to generate the dev classpath entries >+ // key is bundle ID, value is a model >+ private Map fAllBundles; >+ >+ // key is a model, value is startLevel:autoStart >+ private Map fModels; >+ > /** > * To avoid duplicating variable substitution (and duplicate prompts) > * this variable will store the substituted workspace location. >@@ -76,9 +83,6 @@ > } > > boolean showSplash = true; >- // TODO fix getPluginstoRun to return a map that is model/startlevel >- // model after EquinoxLaunchConfiguration >- Map pluginMap = LaunchPluginValidator.getPluginsToRun(configuration); > if (configuration.getAttribute(IPDELauncherConstants.USEFEATURES, false)) { > validateFeatures(); > IPath installPath = PDEPlugin.getWorkspace().getRoot().getLocation(); >@@ -94,21 +98,21 @@ > programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", true)); //$NON-NLS-1$ > } else { > String productID = LaunchConfigurationHelper.getProductID(configuration); >- Properties prop = LaunchConfigurationHelper.createConfigIniFile(configuration, productID, pluginMap, getConfigDir(configuration)); >+ Properties prop = LaunchConfigurationHelper.createConfigIniFile(configuration, productID, fAllBundles, fModels, getConfigDir(configuration)); > showSplash = prop.containsKey("osgi.splashPath") || prop.containsKey("splashLocation"); //$NON-NLS-1$ //$NON-NLS-2$ > String brandingId = LaunchConfigurationHelper.getContributingPlugin(productID); >- TargetPlatform.createPlatformConfiguration(getConfigDir(configuration), (IPluginModelBase[]) pluginMap.values().toArray(new IPluginModelBase[pluginMap.size()]), brandingId != null ? (IPluginModelBase) pluginMap.get(brandingId) : null); >- TargetPlatformHelper.checkPluginPropertiesConsistency(pluginMap, getConfigDir(configuration)); >+ TargetPlatform.createPlatformConfiguration(getConfigDir(configuration), (IPluginModelBase[]) fAllBundles.values().toArray(new IPluginModelBase[fAllBundles.size()]), brandingId != null ? (IPluginModelBase) fAllBundles.get(brandingId) : null); >+ TargetPlatformHelper.checkPluginPropertiesConsistency(fAllBundles, getConfigDir(configuration)); > programArgs.add("-configuration"); //$NON-NLS-1$ > programArgs.add("file:" + new Path(getConfigDir(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$ > > // add the output folder names > programArgs.add("-dev"); //$NON-NLS-1$ >- programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", pluginMap)); //$NON-NLS-1$ >+ programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigDir(configuration).toString() + "/dev.properties", fAllBundles)); //$NON-NLS-1$ > } > // necessary for PDE to know how to load plugins when target platform = host platform > // see PluginPathFinder.getPluginPaths() and PluginPathFinder.isDevLaunchMode() >- IPluginModelBase base = (IPluginModelBase) pluginMap.get(PDECore.PLUGIN_ID); >+ IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID); > if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) < 0) //$NON-NLS-1$ > programArgs.add("-pdelaunch"); //$NON-NLS-1$ > >@@ -238,6 +242,14 @@ > */ > protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { > fWorkspaceLocation = null; >+ >+ fModels = BundleLauncherHelper.getMergedBundleMap(configuration, false); >+ fAllBundles = new HashMap(fModels.size()); >+ Iterator iter = fModels.keySet().iterator(); >+ while (iter.hasNext()) { >+ IPluginModelBase model = (IPluginModelBase) iter.next(); >+ fAllBundles.put(model.getPluginBase().getId(), model); >+ } > validateConfigIni(configuration); > super.preLaunchCheck(configuration, launch, monitor); > } >@@ -263,7 +275,7 @@ > */ > public String[] getVMArguments(ILaunchConfiguration configuration) throws CoreException { > String[] vmArgs = super.getVMArguments(configuration); >- IPluginModelBase base = (IPluginModelBase) LaunchPluginValidator.getPluginsToRun(configuration).get(PDECore.PLUGIN_ID); >+ IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID); > if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) >= 0) { //$NON-NLS-1$ > // necessary for PDE to know how to load plugins when target platform = host platform > // see PluginPathFinder.getPluginPaths() and PluginPathFinder.isDevLaunchMode() >Index: src/org/eclipse/pde/ui/launcher/JUnitLaunchConfigurationDelegate.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitLaunchConfigurationDelegate.java,v >retrieving revision 1.29 >diff -u -r1.29 JUnitLaunchConfigurationDelegate.java >--- src/org/eclipse/pde/ui/launcher/JUnitLaunchConfigurationDelegate.java 7 Jan 2009 19:54:56 -0000 1.29 >+++ src/org/eclipse/pde/ui/launcher/JUnitLaunchConfigurationDelegate.java 13 Apr 2009 14:08:23 -0000 >@@ -7,15 +7,14 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >- * Code 9 Corporation - ongoing enhancements >+ * EclipseSource Corporation - ongoing enhancements > * David Saff <saff@mit.edu> - bug 102632 > * Ketan Padegaonkar <KetanPadegaonkar@gmail.com> - bug 250340 > *******************************************************************************/ > package org.eclipse.pde.ui.launcher; > > import java.io.File; >-import java.util.List; >-import java.util.Map; >+import java.util.*; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.runtime.*; > import org.eclipse.debug.core.*; >@@ -47,7 +46,12 @@ > > protected File fConfigDir = null; > >- private Map fPluginMap; >+ // used to generate the dev classpath entries >+ // key is bundle ID, value is a model >+ private Map fAllBundles; >+ >+ // key is a model, value is startLevel:autoStart >+ private Map fModels; > > /* > * (non-Javadoc) >@@ -123,17 +127,17 @@ > > // Create the platform configuration for the runtime workbench > String productID = LaunchConfigurationHelper.getProductID(configuration); >- LaunchConfigurationHelper.createConfigIniFile(configuration, productID, fPluginMap, getConfigurationDirectory(configuration)); >+ LaunchConfigurationHelper.createConfigIniFile(configuration, productID, fAllBundles, fModels, getConfigurationDirectory(configuration)); > String brandingId = LaunchConfigurationHelper.getContributingPlugin(productID); >- TargetPlatform.createPlatformConfiguration(getConfigurationDirectory(configuration), (IPluginModelBase[]) fPluginMap.values().toArray(new IPluginModelBase[fPluginMap.size()]), brandingId != null ? (IPluginModelBase) fPluginMap.get(brandingId) : null); >- TargetPlatformHelper.checkPluginPropertiesConsistency(fPluginMap, getConfigurationDirectory(configuration)); >+ TargetPlatform.createPlatformConfiguration(getConfigurationDirectory(configuration), (IPluginModelBase[]) fAllBundles.values().toArray(new IPluginModelBase[fAllBundles.size()]), brandingId != null ? (IPluginModelBase) fAllBundles.get(brandingId) : null); >+ TargetPlatformHelper.checkPluginPropertiesConsistency(fAllBundles, getConfigurationDirectory(configuration)); > > programArgs.add("-configuration"); //$NON-NLS-1$ > programArgs.add("file:" + new Path(getConfigurationDirectory(configuration).getPath()).addTrailingSeparator().toString()); //$NON-NLS-1$ > > // Specify the output folder names > programArgs.add("-dev"); //$NON-NLS-1$ >- programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigurationDirectory(configuration).toString() + "/dev.properties", fPluginMap)); //$NON-NLS-1$ >+ programArgs.add(ClasspathHelper.getDevEntriesProperties(getConfigurationDirectory(configuration).toString() + "/dev.properties", fAllBundles)); //$NON-NLS-1$ > > // necessary for PDE to know how to load plugins when target platform = host platform > // see PluginPathFinder.getPluginPaths() >@@ -207,7 +211,7 @@ > // if application is not set, we should launch the default UI test app > // Check to see if we should launch the legacy UI app > if (application == null) { >- IPluginModelBase model = (IPluginModelBase) fPluginMap.get("org.eclipse.pde.junit.runtime"); //$NON-NLS-1$ >+ IPluginModelBase model = (IPluginModelBase) fAllBundles.get("org.eclipse.pde.junit.runtime"); //$NON-NLS-1$ > BundleDescription desc = model != null ? model.getBundleDescription() : null; > if (desc != null) { > Version version = desc.getVersion(); >@@ -252,14 +256,12 @@ > String vmArgs = LaunchArgumentsHelper.getUserVMArguments(configuration); > > // necessary for PDE to know how to load plugins when target platform = host platform >- // see PluginPathFinder.getPluginPaths() and PluginPathFinder.isDevLaunchMode() >- Map pluginsToRun = LaunchPluginValidator.getPluginsToRun(configuration); >- IPluginModelBase base = (IPluginModelBase) pluginsToRun.get(PDECore.PLUGIN_ID); >+ IPluginModelBase base = (IPluginModelBase) fAllBundles.get(PDECore.PLUGIN_ID); > if (base != null && VersionUtil.compareMacroMinorMicro(base.getBundleDescription().getVersion(), new Version("3.3.1")) >= 0) { //$NON-NLS-1$ > vmArgs = concatArg(vmArgs, "-Declipse.pde.launch=true"); //$NON-NLS-1$ > } > // For p2 target, add "-Declipse.p2.data.area=@config.dir/p2" unless already specified by user >- if (pluginsToRun.containsKey("org.eclipse.equinox.p2.core")) { //$NON-NLS-1$ >+ if (fAllBundles.containsKey("org.eclipse.equinox.p2.core")) { //$NON-NLS-1$ > if (vmArgs.indexOf("-Declipse.p2.data.area=") < 0) { //$NON-NLS-1$ > vmArgs = concatArg(vmArgs, "-Declipse.p2.data.area=@config.dir" + File.separator + "p2"); //$NON-NLS-1$ //$NON-NLS-2$ > } >@@ -381,17 +383,23 @@ > * @see org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor) > */ > protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { >- // Get the list of plug-ins to run >- fPluginMap = LaunchPluginValidator.getPluginsToRun(configuration); >- > fWorkspaceLocation = null; >+ fModels = BundleLauncherHelper.getMergedBundleMap(configuration, false); >+ fAllBundles = new HashMap(fModels.size()); >+ Iterator iter = fModels.keySet().iterator(); >+ while (iter.hasNext()) { >+ IPluginModelBase model = (IPluginModelBase) iter.next(); >+ fAllBundles.put(model.getPluginBase().getId(), model); >+ } > > // implicitly add the plug-ins required for JUnit testing if necessary > String[] requiredPlugins = getRequiredPlugins(configuration); > for (int i = 0; i < requiredPlugins.length; i++) { > String id = requiredPlugins[i]; >- if (!fPluginMap.containsKey(id)) { >- fPluginMap.put(id, findPlugin(id)); >+ if (!fAllBundles.containsKey(id)) { >+ IPluginModelBase model = findPlugin(id); >+ fAllBundles.put(id, model); >+ fModels.put(model, "default:default"); //$NON-NLS-1$ > } > } > >Index: src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectFromLaunchOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectFromLaunchOperation.java,v >retrieving revision 1.4 >diff -u -r1.4 CreateFeatureProjectFromLaunchOperation.java >--- src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectFromLaunchOperation.java 30 Jul 2008 21:25:34 -0000 1.4 >+++ src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectFromLaunchOperation.java 13 Apr 2009 14:08:22 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2008 IBM Corporation and others. >+ * Copyright (c) 2007, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * EclipseSource Corporation - ongoing enhancements > *******************************************************************************/ > > package org.eclipse.pde.internal.ui.wizards.feature; >@@ -21,7 +22,6 @@ > import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel; > import org.eclipse.pde.internal.core.ifeature.IFeature; > import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper; >-import org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator; > import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut; > import org.eclipse.pde.ui.launcher.IPDELauncherConstants; > import org.eclipse.swt.widgets.Shell; >@@ -47,10 +47,10 @@ > String id = type.getIdentifier(); > // if it is an Eclipse launch > if (id.equals(EclipseLaunchShortcut.CONFIGURATION_TYPE)) >- models = LaunchPluginValidator.getPluginList(fLaunchConfig); >+ models = BundleLauncherHelper.getMergedBundles(fLaunchConfig, false); > // else if it is an OSGi launch > else if (id.equals(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE)) >- models = BundleLauncherHelper.getMergedBundles(fLaunchConfig); >+ models = BundleLauncherHelper.getMergedBundles(fLaunchConfig, true); > } catch (CoreException e) { > } > IPluginBase[] result = new IPluginBase[models == null ? 0 : models.length]; >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/P2Utils.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/P2Utils.java,v >retrieving revision 1.19 >diff -u -r1.19 P2Utils.java >--- src/org/eclipse/pde/internal/core/P2Utils.java 15 Mar 2009 21:40:01 -0000 1.19 >+++ src/org/eclipse/pde/internal/core/P2Utils.java 13 Apr 2009 14:08:26 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * EclipseSource Corporation - ongoing enhancements > *******************************************************************************/ > package org.eclipse.pde.internal.core; > >@@ -18,7 +19,6 @@ > import org.eclipse.core.runtime.*; > import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo; > import org.eclipse.equinox.internal.provisional.simpleconfigurator.manipulator.SimpleConfiguratorManipulator; >-import org.eclipse.osgi.service.resolver.BundleDescription; > import org.eclipse.pde.core.plugin.IPluginBase; > import org.eclipse.pde.core.plugin.IPluginModelBase; > import org.eclipse.pde.internal.build.BundleHelper; >@@ -189,12 +189,35 @@ > * @param defaultStartLevel start level to use when "default" is the start level > * @param defaultAutoStart auto start setting to use when "default" is the auto start setting > * @param directory configuration directory to create the files in >+ * @param osgiBundleList a list of bundles coming from a template config.ini > * @return URL location of the bundles.info or <code>null</code> > */ >- public static URL writeBundlesTxt(Map bundles, int defaultStartLevel, boolean defaultAutoStart, File directory) { >+ public static URL writeBundlesTxt(Map bundles, int defaultStartLevel, boolean defaultAutoStart, File directory, String osgiBundleList) { > if (bundles.size() == 0) { > return null; > } >+ >+ // Parse the osgi bundle list for start levels >+ Map osgiStartLevels = new HashMap(); >+ if (osgiBundleList != null) { >+ StringTokenizer tokenizer = new StringTokenizer(osgiBundleList, ","); //$NON-NLS-1$ >+ while (tokenizer.hasMoreTokens()) { >+ String token = tokenizer.nextToken(); >+ int index = token.indexOf('@'); >+ if (index != -1) { >+ String modelName = token.substring(0, index); >+ String startData = token.substring(index + 1); >+ index = startData.indexOf(':'); >+ String level = index > 0 ? startData.substring(0, index) : "default"; //$NON-NLS-1$ >+ String auto = index > 0 && index < startData.length() - 1 ? startData.substring(index + 1) : "default"; //$NON-NLS-1$ >+ if ("start".equals(auto)) { //$NON-NLS-1$ >+ auto = "true"; //$NON-NLS-1$ >+ } >+ osgiStartLevels.put(modelName, level + ':' + auto); >+ } >+ } >+ } >+ > List bundleInfo = new ArrayList(bundles.size()); > List sourceInfo = new ArrayList(bundles.size()); > for (Iterator iterator = bundles.keySet().iterator(); iterator.hasNext();) { >@@ -215,6 +238,10 @@ > info.setSymbolicName(base.getId()); > info.setVersion(base.getVersion()); > String currentLevel = (String) bundles.get(currentModel); >+ // override the start level setting if something comes from the config.ini >+ if (osgiStartLevels.containsKey(base.getId())) { >+ currentLevel = (String) osgiStartLevels.get(base.getId()); >+ } > int index = currentLevel.indexOf(':'); > String levelString = index > 0 ? currentLevel.substring(0, index) : "default"; //$NON-NLS-1$ > String auto = index > 0 && index < currentLevel.length() - 1 ? currentLevel.substring(index + 1) : "default"; //$NON-NLS-1$ >@@ -269,73 +296,4 @@ > } > } > >- /** >- * Creates a bundles.info file in the given directory containing the name, >- * version, location, start level and expected state of every bundle in the >- * given collection. Will also create a source.info file containing >- * a list of all source bundles found in the given collection. If a bundle >- * has a specified start level in the osgi bundle list, that value is used >- * instead of the default. Returns the URL location of the bundle.txt or >- * <code>null</code> if there was a problem creating it. >- * >- * @param bundles collection of IPluginModelBase objects to write into the bundles.info/source.info >- * @param osgiBundleList comma separated list of bundles specified in a template config.ini, used to override start levels >- * @param directory directory to create the bundles.info and source.info files in >- * @return URL location of the bundles.info or <code>null</code> >- */ >- public static URL writeBundlesTxt(Collection bundles, String osgiBundleList, File directory) { >- // Parse the osgi bundle list for start levels >- Map osgiStartLevels = new HashMap(); >- StringTokenizer tokenizer = new StringTokenizer(osgiBundleList, ","); //$NON-NLS-1$ >- while (tokenizer.hasMoreTokens()) { >- String token = tokenizer.nextToken(); >- int index = token.indexOf('@'); >- if (index != -1) { >- String modelName = token.substring(0, index); >- String startData = token.substring(index + 1); >- index = startData.indexOf(':'); >- String level = index > 0 ? startData.substring(0, index) : "default"; //$NON-NLS-1$ >- String auto = index > 0 && index < startData.length() - 1 ? startData.substring(index + 1) : "default"; //$NON-NLS-1$ >- if ("start".equals(auto)) { //$NON-NLS-1$ >- auto = "true"; //$NON-NLS-1$ >- } >- osgiStartLevels.put(modelName, level + ':' + auto); >- } >- } >- >- // Create a map of bundles to start levels >- String defaultAppend = "default:default"; //$NON-NLS-1$ >- Map bundleMap = new HashMap(bundles.size()); >- for (Iterator iterator = bundles.iterator(); iterator.hasNext();) { >- IPluginModelBase currentModel = (IPluginModelBase) iterator.next(); >- BundleDescription desc = currentModel.getBundleDescription(); >- if (desc != null) { >- String modelName = desc.getSymbolicName(); >- if (modelName != null && osgiStartLevels.containsKey(modelName)) { >- bundleMap.put(currentModel, osgiStartLevels.get(modelName)); >- } else if (IPDEBuildConstants.BUNDLE_DS.equals(modelName)) { >- bundleMap.put(currentModel, "1:true"); //$NON-NLS-1$ >- } else if (IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR.equals(modelName)) { >- bundleMap.put(currentModel, "1:true"); //$NON-NLS-1$ >- } else if (IPDEBuildConstants.BUNDLE_EQUINOX_COMMON.equals(modelName)) { >- bundleMap.put(currentModel, "2:true"); //$NON-NLS-1$ >- } else if (IPDEBuildConstants.BUNDLE_OSGI.equals(modelName)) { >- bundleMap.put(currentModel, "-1:true"); //$NON-NLS-1$ >- } else if (IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR.equals(modelName)) { >- bundleMap.put(currentModel, "3:true"); //$NON-NLS-1$ >- } else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(modelName)) { >- if (TargetPlatformHelper.getTargetVersion() > 3.1) { >- bundleMap.put(currentModel, "default:true"); //$NON-NLS-1$ >- } else { >- bundleMap.put(currentModel, "2:true"); //$NON-NLS-1$ >- } >- } else { >- bundleMap.put(currentModel, defaultAppend); >- } >- } >- } >- >- return writeBundlesTxt(bundleMap, 4, false, directory); >- } >- > }
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 269111
:
129291
|
131513
| 131648 |
131649