Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to add source lookup to my own launch configuration programmatically
How to add source lookup to my own launch configuration programmatically [message #556460] Wed, 01 September 2010 08:40 Go to next message
Sebastian is currently offline Sebastian
Messages: 4
Registered: September 2010
Junior Member
Hi there,

I'm trying to launch my own launch configuration with my own attributes. Everything works fine. But of course, when I set a Breakpoint the debugger can't find any source files. I always have to manually add them with the help of the "Edit source lookup path"-Dialog in Eclipse. But I would like to add some source lookups to my configuration programmatically.

I thought i have to add an Attribute to my workingCopy (ILaunchConfigurationWorkingCopy).
I use the IJavaLaunchConfigurationConstants interface to set all my attributes for my workingCopy. And there are some Constants regarding source path too. ATTR_SOURCE_PATH sounded promising. This attribute needs a List of runtime casspath entries as memento strings.

Ok. How to get them? Perhaps like this:
JavaRuntime.newProjectRuntimeClasspathEntry(javaProject).getMemento()


Looks good? In this way I add a few mementos to a list and set the ATTR_SOURCE_PATH Attribute

List<String> projectRuntimeClasspathEntryMementos = getProjectRuntimeClasspathEntryMementos(javaProjects);
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH, projectRuntimeClasspathEntryMementos);


But when I launch this configuration, there is still only the default source path.

What am i doing wrong? Do I have to use a SourceContainer like this somewhere?
ProjectSourceContainer projectSourceContainer = new ProjectSourceContainer(javaProject.getProject(), true);

If so, where is the "workingCopy.addSourceContainer(...)"-Method Razz

I found some interesting sources but i couldn't figure it out.

* http://www.eclipse.org/articles/Article-Launch-Framework/lau nch.html

* http://www.eclipse.org/articles/Article-Java-launch/launchin g-java.html

* http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. jdt.doc.isv/reference/api/org/eclipse/jdt/launching/sourcelo okup/IJavaSourceLocation.html

* http://www.jarvana.com/jarvana/view/org/eclipse/jdt/doc/isv/ 3.2.1-r321_v20060907/isv-3.2.1-r321_v20060907.jar!/reference /api/org/eclipse/jdt/launching/IJavaLaunchConfigurationConst ants.html

Kind regards
Sebastian

[Updated on: Wed, 01 September 2010 08:45]

Report message to a moderator

Re: How to add source lookup to my own launch configuration programmatically [message #556639 is a reply to message #556460] Thu, 02 September 2010 03:50 Go to previous messageGo to next message
Sebastian is currently offline Sebastian
Messages: 4
Registered: September 2010
Junior Member
Yesterday I found kind of a "solution" for my problem. It behaves like I want it to but it is still not quite right.

If I tell my working directory that it shouldn't use the default source path by inserting this

workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_SOURCE_PATH, false);


than Eclipse can find the sources. But in the SourceLookupDialog the projects i added can now be found under "Default". Normaly there would be the rt.jar and so one but they are gone now.

Well now I could add these jar files manually again like I did with my projects but I would like to not touch the Default "folder" and add my projects as new "folders" (by "folders" I mean containers of course).

Perhaps somebody has a nicer solution than me.

Greetings
Sebastian

[Updated on: Thu, 02 September 2010 03:51]

Report message to a moderator

Re: How to add source lookup to my own launch configuration programmatically [message #705250 is a reply to message #556460] Fri, 29 July 2011 12:08 Go to previous message
Bob Walker is currently offline Bob Walker
Messages: 31
Registered: July 2009
Member
Does anyone have a response for this? I'm still seeing the same behaviour - I'm *guessing* that ATTR_SOURCE_PATH is the right way to go, but the documentation is pretty scant and trial and error has got me nowhere.

Any help gratefully appreciated!
Previous Topic:Refresh the view in eclipse plugin
Next Topic:How to add my own wizards directly to the "new" menu
Goto Forum:
  


Current Time: Sat Jul 26 05:18:50 EDT 2014

Powered by FUDForum. Page generated in 0.02564 seconds