[ Programming Trail >> Java Trail >> Java Ide >> Eclipse Ide >> Eclipse Plugin Development]
Eclipse Plug-in Development
Every eclipse plug-in has four important parts. (1) Extension points, (2) Extensions, (3) Prerequisites, and (4) Run-time libraries. The following picture shows one such plug-in as seen by plug-in registry view (Window > Show View > Other > PDE Run-time > Plug-in Registry).
{white}____________{/white}
{white}_____{/white}(1){white}___________________________{/white} (2)
Figure (1) on the left shows the Outline view when you are programming the plug-in, and picture (2) on the right shows the plug-in registry view. Dependencies while coding translate to Prerequisites in the exported plug-in.
{brown}Extension versus Extension Point{/brown}
Be aware that the XML tags for these two are quite similar. An {brown}extension point{/brown} declares the availability of a plug-in's functionality to other plug-ins and is denoted by the {brown}{/brown} tag. An {brown}extension{/brown} uses a previously defined extension point and is denoted by the {brown}{/brown} tag having the point attribute naming the extension point it wishes to use [1].
Putiing a menu in your Plug-in
Adding a menu choice requires just a few lines of XML in the plug-in manifest file () and a class that handles the actual action [1].
Choose an Extension Point (e.g. org.eclipse.ui.actionSets), add an action set in it that will contain the menu heading and menu items. All this goes in plugin.xml. A simplified plugin.xml will look like this
Ofcourse this is a subset of the plugin.xml for easier understanding. The actual plugin.xml will have a some more lines in plugin.xml :).
You can put the menu item in any of the following places:
{white}_________________________{/white}(3) Main Menu
{white}____________{/white}(4) Right Click{white}____________________{/white}(5) Views Pull Down Menu
Right click (fig-4) may be done in a white space or specific selected objects (e.g. those who implement a particular interface).
Best Practices when writing a Eclipse plug-in
- Name of Plug-in project same as plug-in identifier
- Edit dependecy list rather than java build path
- You can put your plug-in outside the eclipse directory, this will help in multiple eclipse instances refering to a single directory for your plug-in (To do this you have to make some changes in the way you package your plug-in)
To delete a plug-in simply delete the directory in the Eclipse plug-ins directory.
External Links
- A First Look at Eclipse Plug-In Programming
See Also
- Eclipse IDE 101 Flash Tutorial
- Eclipse Tips and Tricks
- Eclipse Plugins
- Eclipse IDE Online Tutorials
- Eclipse Rich Client Platform Development
- Eclipse and CVS
References [1] Extend Eclipse's Java Development Tools
Contributors
Jyotirmaya Nanda (August 25, 2004)
I block the IP address(es) of users trying to vandalize my wiki. A simple mail to me can remove your IP from the blocked list. If you are new to wiki and want to try something out please do so at the Wiki Sand Box. Thank you !!.
|