Search code examples
debuggingeclipse-plugineclipse-jdtprojects

Eclipse JDT: Debugging in the same IDE instance


I'm writing an Eclipse plugin that needs to specifically make use of Workspace, Projects, Packages, Compilation Units etc.

I already have a decent number of projects, packages, and compilation units in my workspace (not all related to my plugin though, but present nevertheless), which I would like to be able to use as a 'test dataset' for debugging.

When I click the toolbar icon of my plugin, I can print to the console the names of the projects returned by this statement:

IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();

However, when I launch the debugger, a new Eclipse IDE instance starts up with no projects visible in it anymore. While no project is visible, the projects array does list the project RemoteSystemTempFiles!

But this is completely useless for my debugging needs, as I need some good data set to step through during debugging.

Question: Is there any way to make my projects existing in the development instance of the IDE appear in the second, debugging instance also? Or, if not, can I somehow debug in the same IDE instance instead of starting a second one? I would hate to litter all my code with console-log messages - it's very tedious also to write them in the first place. Setting up the existing test data in the plugin's initialization code would also be way too much work, which I would like to avoid as well.


Solution

  • No you can't run or debug in the same instance. Eclipse will always start a new instance.

    You will have to set up the test workspace to contain the data you need to test with.