views:

25

answers:

1

I am trying to generate the fullURI of a file(a .javajet template) to read it a generate code out of it. When I get the Platform.getBundle(pluginId()).getEntry("/") it gives me the following string :

bundleentry://1074.fwk5184781/templates/FlowMain.javajet which is obviously wrong and hence the template file is not found. The code is as follows :

private String getUri(String pluginId, String relativeUri) { String base = Platform.getBundle(pluginId).getEntry("/").toString(); String result = base + relativeUri; return result; }

Any idea on how to get the complete URI of this file ?

A: 

To get the workspace location you can use Platform.getLocation().

If you have a handle on your project you can also use IProject.getLocation() to get the location of the project.

Or you can just call IFile..getFullPath().

Florian
I am trying to achieve something like this - http://www.eclipse.org/articles/Article-JET2/jet_tutorial2.html
Ved
Doest this work for you: Bundle bundle = Platform.getBundle(pluginId); Path path = new Path("your/file.javajet"); URL fileURL = Platform.find(bundle, path);
Florian
What about this: Path path = new Path(Platform.resolve(Platform.find(plugin.getBundle(), new Path(filePath))).getFile()).toFile().toString(); This is quite a hack and there is probably a better way but it seems to work.
Florian