• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

New folder inside an existing plugin

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the properties file is inside your source you can use
 
Marco Rossi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Marshal
Posts: 80755
486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too difficult for "beginning". Moving thread.
 
reply
    Bookmark Topic Watch Topic
  • New Topic