Querying for plugin location [message #335689] |
Tue, 21 April 2009 17:29  |
Eclipse User |
|
|
|
Hi,
I am trying to determine the location of plugins that contribute to an
extension point defined in my plugin.
My code is as follows:
IExtensionPoint ep =
Platform.getExtensionRegistry().getExtensionPoint(myExtensio n >);
for (IExtension e : ep.getExtensions()) {
for (IConfigurationElement configElement : e
.getConfigurationElements()) {
/* get the location on disk of the plugin */
Bundle bundle = Platform.getBundle(configElement
.getContributor().getName());
String pluginLoc = FileLocator
.resolve(bundle.getEntry("/")).getPath();
On windows this evaluates to : /C:/tmp while on linux it evaluates to
/tmp. For different platforms I have to process this field differently.
Is there a platform independent way of getting the plugin location?
Thanks
Amit
|
|
|
|
|
|
|
Re: Querying for plugin location [message #335744 is a reply to message #335738] |
Sat, 25 April 2009 01:19  |
Eclipse User |
|
|
|
"Amit Mookerjee" <amitm@ti.com> wrote in message
news:94b511c788662089ad07ac153709b020$1@www.eclipse.org...
>> What does that directory contain, and who creates it?
> Walter,
> We are releasing our product with an eclipse extension.
> This product is integrated in a eclipse based IDE. The plugins provide
> useful information about the product to the IDE - like the location of
> repositories containing target content.
>
> Our product directory structure is as follows:
>
> [<prod_dir>]
> [eclipse]
> [features]
> [plugins]
> [<product>_versionname]
> plugin.xml
> [META-INF]
> .eclipseextension
> [packages]
>
> The directory structure is fixed. The eclipse folder always exists at the
> top level. So the plugin always knows the location of other elements in
> the product -like the [packages] folder - relative to its location. The
> IDE needs to compute the absolute path of these elements by querying the
> extension in the plugin. And this is where the problem arises.
Hmm, yeah, I see why you're having problems. Linked plugins probably get a
bit less exercise than the normal kind, just because Eclipse itself isn't
built on them, and then the question you're (programmatically) asking is one
that Eclipse is sadly not very interested in helping you answer. Eclipse is
trying to abstract away the fact that your plugin lives in a filesystem
somewhere; it doesn't want you to make that assumption.
I'm afraid I don't have any ideas better than the one you led with. Sorry!
It does seem like kind of a hole in the functionality (unless someone else
thinks of something I'm missing). I wonder if you should submit a feature
request in Bugzilla. I'm not sure what the API would look like; in
particular, if you have a method like Platform.getBundleLocation(Bundle), I
think you'd want it to return something consistently useful regardless of
whether the plugin is linked or not and whether it is expanded or packaged
as a jar. I'm not sure quite what that would be. But it's worth giving it
some thought.
|
|
|
Powered by
FUDForum. Page generated in 0.53539 seconds