Monday 15 February 2010

eclipse - Eclipe RCP using custom config file -



eclipse - Eclipe RCP using custom config file -

i'd utilize kind of ini/xml configuration file can accessed user @ time , alter configuration. need ability allow user alter these configs without starting application, needs these configs before startup.

my problem file need @ 2 places depending on context:

while developing within 1 of bundles in custom directory (something config/config.ini)

when export application, directory gets placed within root of application folder (so eclipse/config/config.ini)

so far how access 1 file while testing , in exported application?

because when this:

url resource = mycustomclass.class.getclassloader().getresource("/config/config.ini");

where mycustomclass class in project file in, can access file while developing/testing, doesnt work in exported application

while if like:

bundle bundle = platform.getbundle("my.project.sub"); ipath path = new path("config/config.ini"); url url = filelocator.find(bundle, path, null);

this works while in developing doesnt work in exported application, mean file isnt in bundle got exported.

what best way deal this?

if want using default config.ini properties.

the best way access :

system.getproperty("propertyename")

you can see : eclipse rcp config.ini

eclipse eclipse-plugin eclipse-rcp

No comments:

Post a Comment