Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access relative path from eclipse-plugin

Does anyone know how to get a file with uri from a self-made Eclipse Plug-in?

Absolute paths would be no problem:

URI.createFileURI("C:/Users/hp/workspace(dke)/SMartGen/StarSchema.profile.uml");

But how do I access local resources relatively?

URI.createFileURI("jar:file:/%ECLIPSE_HOME%/plugins/SMartGen.jar!StarSchema.profile.uml");

doesn't work this way....

Happy for every answer.

lg martin

like image 975
Martin Avatar asked May 17 '26 09:05

Martin


1 Answers

Use the FileLocator.

Example:

URL iconUrl = FileLocator.find(Platform.getBundle("myBundle"), new Path("icons/someIcon.png"), null);

This will get the URL of a file "someIcon.png" that is located in the "icons" folder in the bundle "myBundle".

like image 195
Sandman Avatar answered May 20 '26 19:05

Sandman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!