Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Would like to get plugin installed location
Would like to get plugin installed location [message #195237] Tue, 20 February 2007 22:20 Go to next message
Eclipse UserFriend
Originally posted by: subramanianj.schneider.com

I have installed Eclipse in directory(C:\Eclipse\eclipse\plugins) and
would like to get this path from my plugin code. I have tried

String location = DebugPlugin.getDefault().getStateLocation();

would return plugin location of workspace and not the installed location.

Could someone please help me getting installed location.

thanks
JP
Re: Would like to get plugin installed location [message #195303 is a reply to message #195237] Wed, 21 February 2007 07:49 Go to previous messageGo to next message
Sophie Andrieu is currently offline Sophie AndrieuFriend
Messages: 38
Registered: July 2009
Member
With this code :
URL url = FileLocator.find(MyPlugin.getDefault().getBundle(), new
Path(""), null);
try {
url = FileLocator.resolve(url);
}catch (IOException ioe){}

=> You have the plugin install path location...


With this code :
Platform.getInstallLocation().getURL().getPath()

=> You have Eclipse install path location



Sophie Andrieu
Re: Would like to get plugin installed location [message #195363 is a reply to message #195303] Wed, 21 February 2007 15:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subramanianj.schneider.com

Thanks Sophie. I have put my question wrong. Sorry that was my bad.

I have a my plugin called xxxPlugin and have file(xxx.properties) inside
that plugin and would like to read file(xxx.properties) in the
code(org.sni.eclipse.xxxAction) that exists in xxxPlugin.


xxxPlugin
|
|
--org.sni.eclipse
| |
| - xxxAction
|
--xxx.properties

Could you please let me know, how to read that file.
Re: Would like to get plugin installed location [message #195370 is a reply to message #195363] Wed, 21 February 2007 15:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

JP,

Try MyPlugin.getDefault().getBundle().getEntry("xxx.properties").


JP Subramanian wrote:
> Thanks Sophie. I have put my question wrong. Sorry that was my bad.
>
> I have a my plugin called xxxPlugin and have file(xxx.properties)
> inside that plugin and would like to read file(xxx.properties) in the
> code(org.sni.eclipse.xxxAction) that exists in xxxPlugin.
>
>
> xxxPlugin
> |
> |
> --org.sni.eclipse
> | |
> | - xxxAction
> |
> --xxx.properties
> Could you please let me know, how to read that file.
>
>
>
Re: Would like to get plugin installed location [message #195423 is a reply to message #195370] Wed, 21 February 2007 19:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subramanianj.schneider.com

Thanks Ed.

Here is the code used to read resource file in plugin.

InputStream ios = myActivator.getDefault().getBundle().getResource(
"jp.properties").openStream();
BufferedReader in = new BufferedReader(new InputStreamReader(ios));
String inputLine;
while ((inputLine = in.readLine()) != null)
{
System.out.println(inputLine);
}
in.close();
Re: Would like to get plugin installed location [message #195484 is a reply to message #195423] Thu, 22 February 2007 08:04 Go to previous message
Sophie Andrieu is currently offline Sophie AndrieuFriend
Messages: 38
Registered: July 2009
Member
You can also use the following code (for a file named
'messages.properties' for example) :

ResourceBundle.getBundle("messages").getString(key)


Sophie
Previous Topic:TextMergeViewer
Next Topic:update the classpath
Goto Forum:
  


Current Time: Mon Sep 23 01:40:51 GMT 2024

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

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

Back to the top