File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New folder inside an existing plugin

 
Marco Rossi
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am extending org.eclipse.wst.xml.ui and I have created a "properties" folder which contains, of course, some properties file I need during execution.

This "properties" folder is at the root of the plugin, but how can I access to it?
I mean, which is the path?

"./properties"? I tried but it seems not working.

Thanks
Marco
 
John Jai
Rancher
Posts: 1776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the properties file is inside your source you can use
 
Marco Rossi
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example:

my source code is in the folder org.eclipse.wst.xml.ui which contains some of classes for default XML Editor inside Eclipse.

I have added org.eclipse.wst.xml.ui/properties.

So, I will try with your code but, what is "Trial"?

Thanks
Marco
 
John Jai
Rancher
Posts: 1776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trial can be any of your custom class where you wish to refer the .properties file.
 
Marco Rossi
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Jai wrote:Trial can be any of your custom class where you wish to refer the .properties file.


Therefore is it the name of the class where I am calling the properties file from?
 
John Jai
Rancher
Posts: 1776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Therefore is it the name of the class where I am calling the properties file from?

Not necessarily be. But please try and let us know if you were able to access the .properties file. It can be any class present in your source file.
 
Marco Rossi
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks.
I will try tomorrow at work, not I am at home

I will write tomorrow.

Thanks
Marco
 
Marco Rossi
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems not working...I explain better what I am doing.

I have Test1.java whose path is /org/eclipse/wst/xml/ui/internal/contentassist/Test1.java

Here I am trying to load a file which is in the root of my plugin inside folder /properties.

I tried with



but I get a NullPointerException

Thanks
Marco
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not supposed to use the Class and resource to load from a Plugin. An Eclipse plugin is a bundle and lives in a Context of an OSGi-instance. Hence, you need to use the Bundle and Context.



Of course, if you are in the bundle you want to read from, you can get the Bundle from the current Context.

Alternatively you can also use URL directly.

 
Marco Rossi
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ove Lindström wrote:You are not supposed to use the Class and resource to load from a Plugin. An Eclipse plugin is a bundle and lives in a Context of an OSGi-instance. Hence, you need to use the Bundle and Context.



This works fine.

Thanks a lot
Marco
 
Campbell Ritchie
Sheriff
Pie
Posts: 47253
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult for "beginning". Moving thread.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic