[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.pde] Re: how to access a file in Plugin at runtime

Hi laurent,

thanks for the reply,

ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filepath)) can do what you seek, with filepath being a String relative to the workspace root (i.e. of the form '/' + pluginName + '/' + path).

the problem with this approach is for debugging: usually i started my plugin in a new runtime application for testing, so what I got using this approach is the runtime workspace, not the original one.




An other option would be to use Platform.getBundle(pluginID).getEntry(filepath) with filepath being a path relative to the plugin root.

I haven't tried this due to time limitations.


I think the best way to solve the relative path it like the following: save the file inside the src package, and access it from the accessing class like this:
ACCESSING_Class.getClass().getResourceAsStream("../ont.owl"); This worked well for the runtime application for tests as well.


best regards!
Jinhui