### Eclipse Workspace Patch 1.0 #P org.eclipse.pde.core Index: src/org/eclipse/pde/internal/core/PDECore.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECore.java,v retrieving revision 1.106 diff -u -r1.106 PDECore.java --- src/org/eclipse/pde/internal/core/PDECore.java 2 Jan 2008 15:56:17 -0000 1.106 +++ src/org/eclipse/pde/internal/core/PDECore.java 5 Feb 2008 16:24:30 -0000 @@ -13,22 +13,12 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.net.URL; - import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.*; +import org.eclipse.jdt.launching.JavaRuntime; import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.internal.core.builders.CompilerFlags; -import org.eclipse.pde.internal.core.builders.FeatureRebuilder; -import org.eclipse.pde.internal.core.builders.PluginRebuilder; +import org.eclipse.pde.internal.core.builders.*; import org.eclipse.pde.internal.core.schema.SchemaRegistry; import org.eclipse.update.configurator.ConfiguratorUtils; import org.osgi.framework.BundleContext; @@ -38,6 +28,7 @@ public static final IPath REQUIRED_PLUGINS_CONTAINER_PATH = new Path(PLUGIN_ID + ".requiredPlugins"); //$NON-NLS-1$ public static final IPath JAVA_SEARCH_CONTAINER_PATH = new Path(PLUGIN_ID + ".externalJavaSearch"); //$NON-NLS-1$ + public static final IPath JRE_CONTAINER_PATH = new Path(JavaRuntime.JRE_CONTAINER); public static final String BINARY_PROJECT_VALUE = "binary"; //$NON-NLS-1$ public static final String BINARY_REPOSITORY_PROVIDER = PLUGIN_ID + "." + "BinaryRepositoryProvider"; //$NON-NLS-1$ //$NON-NLS-2$ #P org.eclipse.pde.ui Index: src/org/eclipse/pde/internal/ui/wizards/plugin/ClasspathComputer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/ClasspathComputer.java,v retrieving revision 1.19 diff -u -r1.19 ClasspathComputer.java --- src/org/eclipse/pde/internal/ui/wizards/plugin/ClasspathComputer.java 25 Jan 2008 22:42:12 -0000 1.19 +++ src/org/eclipse/pde/internal/ui/wizards/plugin/ClasspathComputer.java 5 Feb 2008 16:24:31 -0000 @@ -49,11 +49,11 @@ // add JRE and set compliance options String ee = getExecutionEnvironment(model.getBundleDescription()); - result.add(createJREEntryUsingPreviousEntry(javaProject, ee)); + result.add(createEntryUsingPreviousEntry(javaProject, ee, PDECore.JRE_CONTAINER_PATH)); setComplianceOptions(JavaCore.create(project), ExecutionEnvironmentAnalyzer.getCompliance(ee)); // add pde container - result.add(createContainerEntry()); + result.add(createEntryUsingPreviousEntry(javaProject, ee, PDECore.REQUIRED_PLUGINS_CONTAINER_PATH)); IClasspathEntry[] entries = (IClasspathEntry[]) result.toArray(new IClasspathEntry[result.size()]); IJavaModelStatus validation = JavaConventions.validateClasspath(javaProject, entries, javaProject.getOutputLocation()); @@ -278,24 +278,28 @@ * has an existing JRE/EE classpath entry, the access rules, extra attributes and isExported settings of * the existing entry will be added to the new execution entry. * - * @param javaProject project to check for existing JRE/EE classpath entries + * @param javaProject project to check for existing classpath entries * @param ee id of the execution environment to create an entry for + * @param path id of the container to create an entry for + * * @return new classpath container entry * @throws CoreException if there is a problem accessing the classpath entries of the project */ - public static IClasspathEntry createJREEntryUsingPreviousEntry(IJavaProject javaProject, String ee) throws CoreException { - IClasspathEntry existingEntry = null; + public static IClasspathEntry createEntryUsingPreviousEntry(IJavaProject javaProject, String ee, IPath path) throws CoreException { IClasspathEntry[] entries = javaProject.getRawClasspath(); for (int i = 0; i < entries.length; i++) { - if (entries[i].getPath().segment(0).equals(JavaRuntime.JRE_CONTAINER)) { - existingEntry = entries[i]; - break; + if (entries[i].getPath().equals(path)) { + if (path.equals(PDECore.JRE_CONTAINER_PATH)) + return JavaCore.newContainerEntry(getEEPath(ee), entries[i].getAccessRules(), entries[i].getExtraAttributes(), entries[i].isExported()); + + return JavaCore.newContainerEntry(path, entries[i].getAccessRules(), entries[i].getExtraAttributes(), entries[i].isExported()); } } - if (existingEntry == null) { + + if (path.equals(PDECore.JRE_CONTAINER_PATH)) return createJREEntry(ee); - } - return JavaCore.newContainerEntry(getEEPath(ee), existingEntry.getAccessRules(), existingEntry.getExtraAttributes(), existingEntry.isExported()); + + return JavaCore.newContainerEntry(path); } /**