Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Resolve 'sourcecontrol' location URIs in non-Jazz Eclipse plugins

 Hi,

I'm trying to sort out a problem for a client who uses our Eclipse plugins alongside Jazz/RTC. 

As part of our project builder we create a java.net.URLClassLoader configured with an entry for each of the classpath roots visible to the project containing the resource being built. These URLs might refer to a folder i.e. for a referenced source folder or a file e.g. a jar.

When the project under build references another project we convert the source folders of the referenced project to URLs by combining the project location with the relative path of the source folder:

IJavaProject javaProject = ... 

IClasspathEntry entry = ...

IFile file = javaProject.getProject(). getFile(entry.getPath(). removeFirstSegments(1));
URL url = new URL(file.getLocationURI( ).toURL().toString()+"/");

For standard Eclipse projects this works fine but when the referenced project is under the control of Jazz/RTC the resulting URL has the 'sourcecontrol' protocol. URLClassLoader doesn't like this as it is not a supported protocol by default. 

Our ultimate aim is to consume resources under classpath entries as InputStreams. Can anyone help with a way to resolve such resources when they are in Jazz/RTC projects? We are thinking along the lines of either a Jazz-specific URIHandler to process the sourcecontrol URIs, a conversion strategy into a file system path (I expect this is probably not possible in general) or some other API we can use as an alternative to the URLClassloader approach.

Regards,

Matthew Smith
Developer
Model Two Zero

0 votes



One answer

Permanent link
It sounds like you want the local path of the resource. This was an issue in Eclipse CDT and BIRT and you can follow the solution in those bugs for the correct way to get the local path from a URL.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=378882
https://bugs.eclipse.org/bugs/show_bug.cgi?id=403480

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937

Question asked: Sep 02 '13, 10:23 a.m.

Question was seen: 4,908 times

Last updated: Sep 03 '13, 9:19 a.m.

Confirmation Cancel Confirm