Bug 15381

Summary: PluginModel returns incorrect location
Product: [Eclipse Project] Platform Reporter: Dejan Glozic <dejan>
Component: ResourcesAssignee: Debbie Wilson <debbie_wilson>
Status: RESOLVED WORKSFORME QA Contact:
Severity: blocker    
Priority: P3 CC: dj.houghton
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on:    
Bug Blocks: 15341    

Description Dejan Glozic CLA 2002-05-06 17:49:43 EDT
Using the new feature builds:

The plug-in location is now in directories with id_version convention. However, 
method 'getLocation' on PluginModel still returns the path that contains id 
only (no version).

This is a blocker for PDE's support of new source locations because PDE looks 
for source files relative to plug-in location (as parsed by Core).
Comment 1 Debbie Wilson CLA 2002-05-07 10:58:16 EDT
Dejan,
I'm not seeing the same behaviour.  I picked up build 20020502, imported all 
plugins and then ran a little test method that looked like:
public void baseTest() {
	PluginRegistryModel registry = (PluginRegistryModel)
InternalPlatform.getPluginRegistry();
	PluginDescriptorModel[] plugins = registry.getPlugins();
	for (int i = 0; i < plugins.length; i++) {
		System.out.println("Plugin " + plugins[i].getId() + " located 
at " + plugins[i].getLocation());
	}
}

The location looked fine.  Note that in your dev and target areas one has the 
directory convention with id_version for the plugins while the other does not.  
So I made sure some of the plugin directories in my dev also had the directory 
format id_version and repeated the above test.  I got the right location (i.e. 
<devRoot>/eclipse/plugins/org.eclipse.resources_1.9.0.
The output from this test looked like:
...
Plugin org.eclipse.core.resources located at 
file:/c:/20020502/eclipse//plugins/org.eclipse.core.resources_1.9.0/
...

The value returned by getLocation()is a string called location and stored in 
the PluginModel.  This string is set up at plugin parse time.  We are given a 
URL which we hand to the parser.  If parsing completes successfully (i.e. we 
get a valid PluginDescriptorModel or PluginFragmentModel) we convert the URL we 
were given to a string, strip off the "plugin.xml" or "fragment.xml" portion of 
this string and store the remainder in 'location'.  See 
org.eclipse.core.runtime/org.eclipse.core.internal.plugins/RegistryLoader/proces
sPluginPathFile for where this happens.  This location is then stored in the 
cache file and read back the next time you startup.
Comment 2 Dejan Glozic CLA 2002-05-07 11:04:00 EDT
On second thought, I think it is me :-). Now that I think about it, I was 
testing the unit using binary projects in the run-time instance, the the run-
time instance takes plug-ins from the workspace of the design-time instance. 
These plug-ins are actually projects and they do not have versions.

Sorry for taking your time. You can close this as 'worksforme'.
Comment 3 Debbie Wilson CLA 2002-05-07 11:20:05 EDT
Dejan and I are both in agreement to close this report.