Starting Eclipse Plugin Development

I had been developing an Eclipse plugin for the last few weeks. Starting out the plugin development for a person with no idea of Eclipse plugin environment is very difficult. Here I’ll point out to the sources that helped me to solve the problem.

Start here:

http://meri-stuff.blogspot.com/2012/04/writing-eclipse-plugins-tutorial-part-1.htmlThis blog post describes how to create a simple plugin(http://meri-stuff.blogspot.com/2012/04/writing-eclipse-plugins-tutorial-part-1.html#SimplePluginProject) and also the terns associated with plugin development. It also gives overall idea about how to create menus, how to select a text etc.

Displaying markers

Plugins allow us to highlight certain portions of the text in the code editor. Markers are used for this. Markers can also be used to show errors, so that error is marked in compilation and the error is shown in Problems view. The following links show how to create and manipulate markers: http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-plugin-guide/section3.html http://cubussapiens.hu/tag/markers/

Create Dialog boxes within Eclipse

Some times our plugin might need to show some dialog boxes to the users. It can range from a simple Error message box to some complex dialog box. Dialog boxes can be created using JFace as mentioned here : http://eclipse.dzone.com/news/discover-eclipses-jface-dialog?page=0,0 How do I insert text in the active text editor? This is a common requirement. Find the solution here : http://wiki.eclipse.org/FAQ_How_do_I_insert_text_in_the_active_text_editor%3F

Formatting the code

Some times we might need to insert pieces of code into the code editor and it feel good if the code is formatted. Look here to see how to do it : http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_codeformatter.htm

Fiddling with the source code

What is the use of a plugin if you can’t get into the details of Java source code of the opened projects? Eclipse provides Java Model and Abstract Syntax Trees for this purpose. Java Model is an easy to use and fast model whereas AST is relatively slow, but ASTs contain much more details. Here are the some links to start with this:

http://www.eclipse.org/articles/article.php?file=Article-JavaCodeManipulation_AST/index.html

http://www.vogella.com/articles/EclipseJDT/article.html

http://www.ibm.com/developerworks/opensource/library/os-ast/

http://sahits.ch/blog/?p=228

Share Comments
comments powered by Disqus