Bug 3115 - Need to have the equivalent of Plugin.find(...) but without plugin activation (1GJ8B1Q)
Summary: Need to have the equivalent of Plugin.find(...) but without plugin activation...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: All Windows NT
: P3 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Debbie Wilson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:49 EDT by Vlad Klicnik CLA
Modified: 2002-04-30 14:52 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vlad Klicnik CLA 2001-10-10 22:49:41 EDT
Plugin.find(...) can be used to locate NL variants of non-Java resources (eg. html files).
	This is OK for most uses, but not for Workbench use, because the current call causes
	plugin activation (because you need to get a plugin object for this). Should have this
	call on PluginDescriptor instead.


NOTES:
Comment 1 DJ Houghton CLA 2002-04-11 12:12:44 EDT
Will investigate post 2.0.
Comment 2 DJ Houghton CLA 2002-04-22 13:29:58 EDT
Re-opening.
Comment 3 Jim des Rivieres CLA 2002-04-22 15:40:59 EDT
Proposal: add the following method to IProjectDescriptor:

/**
 * Returns a URL for the file at the given plug-in relative path. The file
 * is looked for in the plug-in and any of its fragments. The 
 * <code>translate</code> parameter controls whether the file should be
 * sought in locale-specific subdirectories.
 * Returns <code>null</code> if the URL could not be computed or created.
 * <p>
 * Unlike <code>Plugin.find</code>, this method does not require the plug-in
 * be activated; it looks in fragments; and it can handle locale-specific
 * variants.
 * </p>
 * 
 * @param filePath a plug-in relative path of a file in the plug-in
 *   installation location, or in one of its fragments
 * @param translated <code>true</code> if the file may be translated and
 *    should also be sought in locale-specific subdirectories, and 
 *    <code>false</code> if this file would never be translated or exist
 *    in locale-specific variants
 * @return a URL for the given path or <code>null</code>
 * @see Plugin#find
 * @since 2.0
 */
public URL find(IPath filePath, boolean translated);

Comment 4 Debbie Wilson CLA 2002-04-30 11:08:47 EDT
This functionality has been added to IPluginDescriptor (and PluginDescriptor 
internally).  These new find methods will not cause the plugin to be 
activated.  Note that the find methods in Plugin have now been changed to use 
the ones in IPluginDescriptor/PluginDescriptor.  

The URL returned from find (in Plugin/IPluginDescriptor/PluginDescriptor) is no 
longer a platform URL but a 'real' URL that does not need to be processed 
through Platform.resolve().  Processing through Platform.resolve() will just 
cause the same URL to be returned.

The decision to return non-platform URLs was made because in the Plugin.find 
code, a non-platform URL was returned if the thing being looked for was in a 
fragment directory and a platform URL was returned if it was found in a plugin 
directory.  For consistency, non-platform URLs will be returned in all cases.  
Fragments do not currently support platform URLs.

Another minor change - this code would look in the option root directory but 
not in the fragment or plugin root directory.  Now, if a $<option>$ is 
specified, the option root directory will not be searched but the root of the 
plugin and any fragments will.  For example:  if you were looking for 
$nl$/plugin.properties and your default locale was en_CA the old code would 
have searched the following directories:
<plugin root>/nl/en/CA
<fragment1 root>/nl/en/CA
<fragment2 root>/nl/en/CA
...
<plugin root>/nl/en
<fragment1 root>/nl/en
<fragment2 root>/nl/en
...
<plugin root>/nl
<fragment1 root>/nl
<fragment2 root>/nl
...
The new code will search the following directories:
<plugin root>/nl/en/CA
<fragment1 root>/nl/en/CA
<fragment2 root>/nl/en/CA
...
<plugin root>/nl/en
<fragment1 root>/nl/en
<fragment2 root>/nl/en
...
<plugin root>
<fragment1 root>
<fragment2 root>
...

This is now consistent with where we search for jar and system library files.