How to find a plugin's install directory now that getDescriptor is deprecated? [message #252977] |
Wed, 16 June 2004 02:53  |
Eclipse User |
|
|
|
Originally posted by: paul.wells.modelistic.com
Hi,
I'm porting a plugin from Eclipse 2.1.3 to Eclipse Platform Version: 3.0.0
Build id: 200405211200, wading through the now deprecated method calls.
I'm having difficulty with this one:
MyPlugin.getInstance().getDescriptor().getInstallURL()
- getDescriptor() is now deprecated, but there's no alternative route
suggested by the documentation.
The reason I need the install URL is because there are other configuration
files shipped with the plugin which need to be read. These files all sit
in a directory (standardProfiles) off the plugin's install directory, and
a loaded after doing a directory listing.
Using some code adapted from AbstractUIPlugin.imageDescriptorFromPlugin:
Bundle bundle = Platform.getBundle(PLUGIN_ID);
if (!BundleUtility.isReady(bundle))
return null;
URL fullPathString = BundleUtility.find(bundle, "standardProfiles");
if (fullPathString == null)
return null;
... I always find that the URL is "/standardProfiles" which is no help.
What's the proper way to locate a directory off the plugin's install
directory?
|
|
|
|
|
|
Re: How to find a plugin's install directory now that getDescriptor is deprecate [message #253241 is a reply to message #252999] |
Wed, 16 June 2004 12:15  |
Eclipse User |
|
|
|
Originally posted by: paul.wells.modelistic.com
Guillaume Gariazzo wrote:
> Paul Wells wrote:
> > Hi,
> >
> > I'm porting a plugin from Eclipse 2.1.3 to Eclipse Platform Version: 3.0.0
> > Build id: 200405211200, wading through the now deprecated method calls.
> >
> > I'm having difficulty with this one:
> >
> > MyPlugin.getInstance().getDescriptor().getInstallURL()
> >
> Have a look at Platform.asLocalURL to get a full path to the directory.
> All Bundle related functions give pathes relative to the platform or the
> plugin itself.
Guillaume,
That works. Thanks for your help.
Paul
|
|
|
Powered by
FUDForum. Page generated in 0.36309 seconds