Skip to main content


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 #606521] Wed, 01 September 2010 12:40 Go to next message
Sebastian is currently offline SebastianFriend
Messages: 4
Registered: September 2010
Junior Member
Hi there,

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

I thought i have to add an Attribute to my workinCopy (ILaunchConfigurationWorkingCopy).
I use the IJavaLaunchConfigurationConstants interface to set all my attributes for my workingCopy. And there are some Constants regarding source path to. 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).get Memento()

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.A TTR_SOURCE_PATH, projectRuntimeClasspathEntryMementos);


But when launch this configuration, there ist 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 :p

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
Re: How to add source lookup to my own launch configuration programmatically [message #606524 is a reply to message #606521] Thu, 02 September 2010 07:50 Go to previous message
Sebastian is currently offline SebastianFriend
Messages: 4
Registered: September 2010
Junior Member
Yesterday I found a kind of "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.A TTR_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
Previous Topic:Data on eclipse release history (3.6 3.5 3.4 ...)
Next Topic:Open associated perspective when opening a file
Goto Forum:
  


Current Time: Fri Apr 26 15:28:23 GMT 2024

Powered by FUDForum. Page generated in 0.03514 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top