Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug a plugin in Eclipse - i.e. a Java project without a Main method

I am currently trying to modify the behavior of an existing open-source plug-in for Eclipse.

I'm trying to understand how the plugin works. To do so, I opened it in "Debug" mode as an Eclipse application and I am testing it out after having inserted many breakpoints.

However, sine Eclipse plugins do not have a Main method, it's still really difficult for me to keep track of everything that is going on. The calls seem to jump arbitrarily (which I quickly realized was happening through all the interfaces and superclasses the plugin is inheriting) and I can't see exactly what's doing what.

What is the proper (read: BEST) way to debug a program with no Main method? How can I test, tweak, and explore and program - in this case a plugin - whose modus operandi I'm uncertain of?

like image 524
CodyBugstein Avatar asked Oct 04 '22 04:10

CodyBugstein


1 Answers

You need to run your plugin in a runtime workbench. This (simplistically) starts a new instance of Eclipse with all existing plugins installed, plus the plugin you want to debug. Make sure that you have the PDE tools installed in your Eclipse instance and then in the debug configurations area, double-click on Eclipse Application to generate a default runtime workbench launch config.

I'd also recommend that you read up on PDE (plugin development environment), and you can get an overview here: http://wiki.eclipse.org/PDE/FAQ. And you can read up on plugins in general here: http://eclipsepluginsite.com/. There are many tutorials and lots of information all over the web. So, google is your friend.

like image 55
Andrew Eisenberg Avatar answered Oct 13 '22 11:10

Andrew Eisenberg