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 77557 Details for
Bug 198641
Eclipse does not pass the PDE target platform settings to a launched instance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch against CVS Head
bug198641.patch (text/plain), 12.54 KB, created by
dakshinamurthy.karra
on 2007-09-03 02:36:58 EDT
(
hide
)
Description:
Patch against CVS Head
Filename:
MIME Type:
Creator:
dakshinamurthy.karra
Created:
2007-09-03 02:36:58 EDT
Size:
12.54 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/PDEClasspathContainer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEClasspathContainer.java,v >retrieving revision 1.25 >diff -u -r1.25 PDEClasspathContainer.java >--- src/org/eclipse/pde/internal/core/PDEClasspathContainer.java 15 Jul 2007 05:21:08 -0000 1.25 >+++ src/org/eclipse/pde/internal/core/PDEClasspathContainer.java 3 Sep 2007 06:23:43 -0000 >@@ -13,11 +13,17 @@ > import java.io.File; > import java.util.ArrayList; > import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; > >+import org.eclipse.core.resources.IFolder; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IResourceChangeEvent; >+import org.eclipse.core.resources.IResourceChangeListener; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.IAccessRule; > import org.eclipse.jdt.core.IClasspathAttribute; >@@ -27,6 +33,7 @@ > import org.eclipse.pde.core.plugin.IPluginLibrary; > import org.eclipse.pde.core.plugin.IPluginModelBase; > import org.eclipse.pde.core.plugin.PluginRegistry; >+import org.eclipse.pde.internal.build.Utils; > > public class PDEClasspathContainer { > >@@ -44,8 +51,25 @@ > } > } > >+ private static class PrebuildActions implements IResourceChangeListener { >+ private List actions = new ArrayList() ; >+ >+ public void resourceChanged(IResourceChangeEvent event) { >+ for (Iterator iterator = actions.iterator(); iterator.hasNext();) { >+ Runnable action = (Runnable) iterator.next(); >+ action.run(); >+ } >+ actions.clear(); >+ } >+ >+ public void addAction(Runnable runnable) { >+ actions.add(runnable); >+ } >+ } >+ > private static HashMap ACCESSIBLE_RULES = new HashMap(); > private static HashMap DISCOURAGED_RULES = new HashMap(); >+ private static PrebuildActions workspaceRunnable ; > > private static final IAccessRule EXCLUDE_ALL_RULE = > JavaCore.newAccessRule(new Path("**/*"), IAccessRule.K_NON_ACCESSIBLE|IAccessRule.IGNORE_IF_BETTER); //$NON-NLS-1$ >@@ -76,7 +100,11 @@ > } > > protected static void addExternalPlugin(IPluginModelBase model, Rule[] rules, ArrayList entries) throws CoreException { >- if (new File(model.getInstallLocation()).isFile()) { >+ // bug# 198641 >+ String[] devPaths = DevEntryHelper.getDevClassPath(model.getBundleDescription().getSymbolicName()); >+ if (devPaths.length > 0) { >+ addDevPluginPaths(entries, devPaths); >+ } else if (new File(model.getInstallLocation()).isFile()) { > IPath srcPath = ClasspathUtilCore.getSourceAnnotation(model, "."); //$NON-NLS-1$ > if (srcPath == null) > srcPath = new Path(model.getInstallLocation()); >@@ -100,7 +128,68 @@ > } > } > } >+ >+ protected static void addDevPluginPaths(ArrayList entries, String[] paths) { >+ for (int i = 0; i < paths.length; i++) { >+ IClasspathEntry entry ; >+ File file = new File(paths[i]); >+ if (file.isFile()) { >+ entry = JavaCore.newLibraryEntry(Path.fromPortableString(paths[i]), null, null); >+ } else { >+ entry = getFolderEntry(paths[i]); >+ } >+ >+ if (entry != null) >+ entries.add(entry); >+ } >+ return ; >+ } > >+ private static IClasspathEntry getFolderEntry(String path) { >+ final IPath ipath = Path.fromPortableString(path); >+ IProject project ; >+ project = getLinkedFolder(); >+ if (project == null) >+ return null ; >+ String[] segments = ipath.segments(); >+ String linkedFolder = Utils.getStringFromArray(segments, "_"); >+ final IFolder folder = project.getFolder(linkedFolder); >+ if (!folder.exists()) { >+ workspaceRunnable.addAction(new Runnable() { >+ public void run() { >+ try { >+ if (!folder.exists()) { >+ folder.createLink(ipath, IResource.REPLACE, new NullProgressMonitor()); >+ } >+ } catch (CoreException e) { >+ e.printStackTrace(); >+ } >+ } >+ }); >+ } >+ return JavaCore.newLibraryEntry(folder.getFullPath(), null, null); >+ } >+ >+ private static IProject getLinkedFolder() { >+ final IProject project = PDECore.getWorkspace().getRoot().getProject("__host_plugins__"); >+ if (!project.exists() || !project.isOpen()) >+ workspaceRunnable.addAction(new Runnable() { >+ public void run() { >+ try { >+ if (!project.exists()) { >+ project.create(new NullProgressMonitor()); >+ } >+ if (!project.isOpen()) { >+ project.open(new NullProgressMonitor()); >+ } >+ } catch (CoreException e) { >+ e.printStackTrace(); >+ } >+ } >+ }); >+ return project ; >+ } >+ > protected static void addLibraryEntry(IPath path, IPath srcPath, Rule[] rules, IClasspathAttribute[] attributes, ArrayList entries) { > IClasspathEntry entry = null; > if (rules != null) { >@@ -176,5 +265,21 @@ > } > return null; > } >+ >+ public static void start() { >+ if (workspaceRunnable == null) { >+ workspaceRunnable = new PrebuildActions(); >+ JavaCore.addPreProcessingResourceChangedListener( >+ workspaceRunnable, >+ IResourceChangeEvent.PRE_BUILD); >+ } >+ } >+ >+ public static void stop() { >+ if (workspaceRunnable != null) { >+ JavaCore.removePreProcessingResourceChangedListener(workspaceRunnable); >+ workspaceRunnable = null ; >+ } >+ } > > } >Index: src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java,v >retrieving revision 1.91 >diff -u -r1.91 RequiredPluginsClasspathContainer.java >--- src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java 8 Jun 2007 16:06:51 -0000 1.91 >+++ src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java 3 Sep 2007 06:23:47 -0000 >@@ -144,6 +144,9 @@ > } > } > >+ // add default classpath passed through -dev argument bug# 198641 >+ addDevPluginPaths(entries, DevEntryHelper.getDevDefaultPath()); >+ > // add dependencies > BundleSpecification[] required = desc.getRequiredBundles(); > for (int i = 0; i < required.length; i++) { >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.104 >diff -u -r1.104 PDECore.java >--- src/org/eclipse/pde/internal/core/PDECore.java 29 Aug 2007 19:03:59 -0000 1.104 >+++ src/org/eclipse/pde/internal/core/PDECore.java 3 Sep 2007 06:23:46 -0000 >@@ -250,6 +250,7 @@ > fPluginRebuilder.start(); > fFeatureRebuilder = new FeatureRebuilder(); > fFeatureRebuilder.start(); >+ PDEClasspathContainer.start(); // bug# 198641 > } > > public BundleContext getBundleContext() { >@@ -288,5 +289,6 @@ > fExtensionRegistry.stop(); > fExtensionRegistry = null; > } >+ PDEClasspathContainer.stop(); // bug# 198641 > } > } >Index: src/org/eclipse/pde/internal/core/ClasspathHelper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ClasspathHelper.java,v >retrieving revision 1.23 >diff -u -r1.23 ClasspathHelper.java >--- src/org/eclipse/pde/internal/core/ClasspathHelper.java 8 Jun 2007 16:06:51 -0000 1.23 >+++ src/org/eclipse/pde/internal/core/ClasspathHelper.java 3 Sep 2007 06:23:42 -0000 >@@ -59,6 +59,7 @@ > } > } > Properties properties = new Properties(); >+ properties.putAll(DevEntryHelper.getDevProperties()); // bug# 198641 > IPluginModelBase[] models = PluginRegistry.getWorkspaceModels(); > for (int i = 0; i < models.length; i++) { > String id = models[i].getPluginBase().getId(); >@@ -97,6 +98,7 @@ > } > } > Properties properties = new Properties(); >+ properties.putAll(DevEntryHelper.getDevProperties()); // bug# 198641 > Iterator iter = map.values().iterator(); > while (iter.hasNext()) { > IPluginModelBase model = (IPluginModelBase)iter.next(); >Index: src/org/eclipse/pde/internal/core/PluginPathFinder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PluginPathFinder.java,v >retrieving revision 1.24 >diff -u -r1.24 PluginPathFinder.java >--- src/org/eclipse/pde/internal/core/PluginPathFinder.java 29 Aug 2007 17:20:30 -0000 1.24 >+++ src/org/eclipse/pde/internal/core/PluginPathFinder.java 3 Sep 2007 06:23:46 -0000 >@@ -90,7 +90,7 @@ > } > > public static URL[] getPluginPaths(String platformHome) { >- if (new Path(platformHome).equals(new Path(TargetPlatform.getDefaultLocation())) && !isDevLaunchMode()) >+ if (new Path(platformHome).equals(new Path(TargetPlatform.getDefaultLocation()))) // bug# 198641 > return ConfiguratorUtils.getCurrentPlatformConfiguration().getPluginPath(); > > File file = new File(platformHome, "configuration/org.eclipse.update/platform.xml"); //$NON-NLS-1$ >Index: src/org/eclipse/pde/internal/core/DevEntryHelper.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/DevEntryHelper.java >diff -N src/org/eclipse/pde/internal/core/DevEntryHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/DevEntryHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,109 @@ >+// bug# 198641 >+package org.eclipse.pde.internal.core; >+ >+import java.io.IOException; >+import java.io.InputStream; >+import java.net.MalformedURLException; >+import java.net.URL; >+import java.util.Enumeration; >+import java.util.Properties; >+ >+import org.eclipse.core.runtime.FileLocator; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.internal.build.BundleHelper; >+import org.eclipse.pde.internal.build.IPDEBuildConstants; >+import org.eclipse.pde.internal.build.Messages; >+import org.eclipse.pde.internal.build.Utils; >+import org.osgi.framework.Bundle; >+ >+public class DevEntryHelper { >+ private Properties devProperties = new Properties(); >+ private String[] devDefaultPath ; >+ >+ private static DevEntryHelper instance ; >+ >+ private static DevEntryHelper getInstance() { >+ if (instance == null) { >+ instance = new DevEntryHelper(System.getProperty("osgi.dev")); >+ } >+ return instance; >+ } >+ >+ private DevEntryHelper(String osgiDev) { >+ // Check the osgi.dev property to see if dev classpath entries have been defined. >+ if (osgiDev != null) { >+ try { >+ URL location = new URL(osgiDev); >+ load(location); >+ } catch (MalformedURLException e) { >+ devDefaultPath = Utils.getArrayFromString(osgiDev); >+ } >+ } >+ } >+ >+ public static String[] getDevDefaultPath() { >+ String[] path = getInstance().devDefaultPath; >+ if (path == null) >+ path = getDevClassPath("*"); >+ return path ; >+ } >+ >+ public static Properties getDevProperties() { >+ return getInstance().devProperties; >+ } >+ >+ /* >+ * Load the given properties file >+ */ >+ private void load(URL url) { >+ Properties props = new Properties(); >+ try { >+ InputStream is = null; >+ try { >+ is = url.openStream(); >+ props.load(is); >+ } finally { >+ if (is != null) >+ is.close(); >+ } >+ } catch (IOException e) { >+ String message = NLS.bind(Messages.exception_missingFile, url.toExternalForm()); >+ BundleHelper.getDefault().getLog().log(new Status(IStatus.WARNING, IPDEBuildConstants.PI_PDEBUILD, IPDEBuildConstants.EXCEPTION_READING_FILE, message, null)); >+ } >+ convertRelativePaths(props); >+ } >+ >+ private void convertRelativePaths(Properties props) { >+ Enumeration keys = props.keys(); >+ while (keys.hasMoreElements()) { >+ String bundleName = (String) keys.nextElement(); >+ String path = props.getProperty(bundleName); >+ Bundle bundle = Platform.getBundle(bundleName); >+ if (bundle != null) { >+ addAbsolutePath(bundle, path); >+ } >+ } >+ } >+ >+ private void addAbsolutePath(Bundle bundle, String pathList) { >+ String[] paths = Utils.getArrayFromString(pathList); >+ for (int i = 0; i < paths.length; i++) { >+ URL convertedPathURL = bundle.getEntry(paths[i]); >+ if (convertedPathURL != null) { >+ try { >+ paths[i] = FileLocator.toFileURL(convertedPathURL).getFile(); >+ } catch (IOException e) { >+ } >+ } >+ } >+ devProperties.setProperty(bundle.getSymbolicName(), Utils.getStringFromArray(paths, ",")); >+ } >+ >+ public static String[] getDevClassPath(String symbolicName) { >+ String devPath = getInstance().devProperties.getProperty(symbolicName); >+ return Utils.getArrayFromString(devPath); >+ } >+}
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 198641
: 77557