Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Relative path of resource in plugin
Relative path of resource in plugin [message #115241] Fri, 22 August 2003 23:53 Go to next message
Eclipse UserFriend
I am developing a plugin that depends on a schema file. I ship the schema
file along with the plugin distribution - so I will have something like:

ECLIPSE_HOME/plugins/com.mycompany.myplugin/xml/myschema.xsd

How do I refer to this schema location programatically in my plugin? Is
there a "ECLISPE_HOME" property that I could access? Basically I need to
know the location of where my plugin is installed and then accesss the
schema file relative to that location. Also, how does one do this when
testing the plugin with the run-time workbench?

Thanks

Vijay
Re: Relative path of resource in plugin [message #115256 is a reply to message #115241] Sat, 23 August 2003 00:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: paull.NOSPAMcodetelligence.com

Can you use something like this (with your plugin name)?
MyPlugin.getDefault().getDescriptor().getInstallURL()

Paul
"Vijay Ganesan" <vijay@mindspring.com> wrote in message
news:bi6ofc$iol$1@eclipse.org...
>
> I am developing a plugin that depends on a schema file. I ship the schema
> file along with the plugin distribution - so I will have something like:
>
> ECLIPSE_HOME/plugins/com.mycompany.myplugin/xml/myschema.xsd
>
> How do I refer to this schema location programatically in my plugin? Is
> there a "ECLISPE_HOME" property that I could access? Basically I need to
> know the location of where my plugin is installed and then accesss the
> schema file relative to that location. Also, how does one do this when
> testing the plugin with the run-time workbench?
>
> Thanks
>
> Vijay
>
>
Re: Relative path of resource in plugin [message #115441 is a reply to message #115256] Sat, 23 August 2003 10:24 Go to previous messageGo to next message
Eclipse UserFriend
I had tried that before but getInstallURL() for my plugin gives:
platform:/plugin/com.x.myplugin_1.0.0/
I need to reference the xml/myschema.xsd file which is at:
ECLIPSE_HOME/plugins/com.x.myplugin_1.0.0/xml/myschema.xsd
Don't know how to go from the URL to this file location.

Vijay


"Paul L" <paull@NOSPAMcodetelligence.com> wrote in message
news:bi6qi8$juh$1@eclipse.org...
> Can you use something like this (with your plugin name)?
> MyPlugin.getDefault().getDescriptor().getInstallURL()
>
> Paul
> "Vijay Ganesan" <vijay@mindspring.com> wrote in message
> news:bi6ofc$iol$1@eclipse.org...
> >
> > I am developing a plugin that depends on a schema file. I ship the
schema
> > file along with the plugin distribution - so I will have something like:
> >
> > ECLIPSE_HOME/plugins/com.mycompany.myplugin/xml/myschema.xsd
> >
> > How do I refer to this schema location programatically in my plugin? Is
> > there a "ECLISPE_HOME" property that I could access? Basically I need to
> > know the location of where my plugin is installed and then accesss the
> > schema file relative to that location. Also, how does one do this when
> > testing the plugin with the run-time workbench?
> >
> > Thanks
> >
> > Vijay
> >
> >
>
>
Re: Relative path of resource in plugin [message #115462 is a reply to message #115241] Sat, 23 August 2003 10:26 Go to previous messageGo to next message
Eclipse UserFriend
You can start with the plugin registry and locate your own plugin.
This will allow you to access your own files, like the schema
Methods in org.eclipse.core.runtime that return IPluginRegistry
static IPluginRegistry Platform.getPluginRegistry()
Returns the plug-in registry for this platform.


Chris Laffra

"Vijay Ganesan" <vijay@mindspring.com> wrote in message
news:bi6ofc$iol$1@eclipse.org...
>
> I am developing a plugin that depends on a schema file. I ship the schema
> file along with the plugin distribution - so I will have something like:
>
> ECLIPSE_HOME/plugins/com.mycompany.myplugin/xml/myschema.xsd
>
> How do I refer to this schema location programatically in my plugin? Is
> there a "ECLISPE_HOME" property that I could access? Basically I need to
> know the location of where my plugin is installed and then accesss the
> schema file relative to that location. Also, how does one do this when
> testing the plugin with the run-time workbench?
>
> Thanks
>
> Vijay
>
>
Re: Relative path of resource in plugin [message #115487 is a reply to message #115462] Sat, 23 August 2003 14:08 Go to previous messageGo to next message
Eclipse UserFriend
Locating the plugin is no problem. From the plugin registry, what methods do
I use to get to the relative location of my plugin specific schema file? I
can get the plugin descriptor from which I can getInstallURL() which brings
me back to my previous question. (See my previous post)
thanks

Vijay


"Chris Laffra" <Chris_Laffra@oti.com> wrote in message
news:bi7thi$9ml$1@eclipse.org...
> You can start with the plugin registry and locate your own plugin.
> This will allow you to access your own files, like the schema
> Methods in org.eclipse.core.runtime that return IPluginRegistry
> static IPluginRegistry Platform.getPluginRegistry()
> Returns the plug-in registry for this platform.
>
>
> Chris Laffra
>
> "Vijay Ganesan" <vijay@mindspring.com> wrote in message
> news:bi6ofc$iol$1@eclipse.org...
> >
> > I am developing a plugin that depends on a schema file. I ship the
schema
> > file along with the plugin distribution - so I will have something like:
> >
> > ECLIPSE_HOME/plugins/com.mycompany.myplugin/xml/myschema.xsd
> >
> > How do I refer to this schema location programatically in my plugin? Is
> > there a "ECLISPE_HOME" property that I could access? Basically I need to
> > know the location of where my plugin is installed and then accesss the
> > schema file relative to that location. Also, how does one do this when
> > testing the plugin with the run-time workbench?
> >
> > Thanks
> >
> > Vijay
> >
> >
>
>
Re: Relative path of resource in plugin [message #115498 is a reply to message #115441] Sat, 23 August 2003 16:14 Go to previous messageGo to next message
Eclipse UserFriend
ok I figured it out.
URL installURL = myPlugin.getDefault().getDescriptor().getInstallURL()
URL fileURL = new URL(installURL, "xml/myschema.xsd")
URL locURL = Platform.asLocalURL(fileURL)
String fname = locURL.getFile()

Vijay




"Vijay Ganesan" <vijay@mindspring.com> wrote in message
news:bi7tdi$9jj$1@eclipse.org...
>
> I had tried that before but getInstallURL() for my plugin gives:
> platform:/plugin/com.x.myplugin_1.0.0/
> I need to reference the xml/myschema.xsd file which is at:
> ECLIPSE_HOME/plugins/com.x.myplugin_1.0.0/xml/myschema.xsd
> Don't know how to go from the URL to this file location.
>
> Vijay
>
>
> "Paul L" <paull@NOSPAMcodetelligence.com> wrote in message
> news:bi6qi8$juh$1@eclipse.org...
> > Can you use something like this (with your plugin name)?
> > MyPlugin.getDefault().getDescriptor().getInstallURL()
> >
> > Paul
> > "Vijay Ganesan" <vijay@mindspring.com> wrote in message
> > news:bi6ofc$iol$1@eclipse.org...
> > >
> > > I am developing a plugin that depends on a schema file. I ship the
> schema
> > > file along with the plugin distribution - so I will have something
like:
> > >
> > > ECLIPSE_HOME/plugins/com.mycompany.myplugin/xml/myschema.xsd
> > >
> > > How do I refer to this schema location programatically in my plugin?
Is
> > > there a "ECLISPE_HOME" property that I could access? Basically I need
to
> > > know the location of where my plugin is installed and then accesss the
> > > schema file relative to that location. Also, how does one do this when
> > > testing the plugin with the run-time workbench?
> > >
> > > Thanks
> > >
> > > Vijay
> > >
> > >
> >
> >
>
>
Re: Relative path of resource in plugin [message #115511 is a reply to message #115487] Sat, 23 August 2003 16:18 Go to previous message
Eclipse UserFriend
Did you try Platform.getLocation() ?

"Vijay Ganesan" <vijay@mindspring.com> wrote in message
news:bi8ain$i98$1@eclipse.org...
>
> Locating the plugin is no problem. From the plugin registry, what methods
do
> I use to get to the relative location of my plugin specific schema file? I
> can get the plugin descriptor from which I can getInstallURL() which
brings
> me back to my previous question. (See my previous post)
> thanks
>
> Vijay
>
>
> "Chris Laffra" <Chris_Laffra@oti.com> wrote in message
> news:bi7thi$9ml$1@eclipse.org...
> > You can start with the plugin registry and locate your own plugin.
> > This will allow you to access your own files, like the schema
> > Methods in org.eclipse.core.runtime that return IPluginRegistry
> > static IPluginRegistry Platform.getPluginRegistry()
> > Returns the plug-in registry for this platform.
> >
> >
> > Chris Laffra
> >
> > "Vijay Ganesan" <vijay@mindspring.com> wrote in message
> > news:bi6ofc$iol$1@eclipse.org...
> > >
> > > I am developing a plugin that depends on a schema file. I ship the
> schema
> > > file along with the plugin distribution - so I will have something
like:
> > >
> > > ECLIPSE_HOME/plugins/com.mycompany.myplugin/xml/myschema.xsd
> > >
> > > How do I refer to this schema location programatically in my plugin?
Is
> > > there a "ECLISPE_HOME" property that I could access? Basically I need
to
> > > know the location of where my plugin is installed and then accesss the
> > > schema file relative to that location. Also, how does one do this when
> > > testing the plugin with the run-time workbench?
> > >
> > > Thanks
> > >
> > > Vijay
> > >
> > >
> >
> >
>
>
Previous Topic:Change Eclipse Default Menu Labels
Next Topic:Problems with plugin as RMI client
Goto Forum:
  


Current Time: Fri May 09 23:37:03 EDT 2025

Powered by FUDForum. Page generated in 0.03927 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top