News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 
Download Current Issue
ISSUE 3/15/2010 PDF

Need Back Issues?
DOWNLOAD HERE

Receive the print Edition?


 
blogs tab
Microsoft lifts the hood on IE9
Microsoft is previewing IE9.
03/16/2010 01:10 PM EST

People Power enters the green technology market
People Power launches SuRF Developer's Kit for developers looking to get into green technology.
03/16/2010 11:51 AM EST

Windows Phone 7 will not support HTML 5
Windows Phone 7 will not support HTML 5.
03/15/2010 05:51 PM EST

 

Events calendar tab
3/14/2010 to 3/18/2010
Seattle, Wa.
SHARE

3/15/2010 to 3/18/2010
Santa Clara, Calif.
TechWeb

3/16/2010 to 3/19/2010
Las Vegas
Penton Media

3/17/2010 to 3/19/2010
Las Vegas
TechTarget

3/22/2010 to 3/25/2010
Santa Clara, Calif.
The Eclipse Foundation


 
Most Read Latest News Blog Resources

Tips: Creating Extension vs. Extension Points




June 4, 2008 — 
Do you know the difference between an Eclipse extension point and an Eclipse extension and what each is used for? From Eclipse Help, we get the following:
“Extension Points define new function points for the platform that other plugins can plug into… A plugin is a structured component that contributes code (or documentation or both) to the system and describes it in a structured way. Plugins can define extension points, well-defined function points that can be extended by other plugins. When a plugin contributes an implementation for an extension point, we say that it adds an extension to the platform. These extensions and extension points are declared in the plugin's manifest (plugin.xml) file.”
For example, there’s an extension point named org.eclipse.ui.views that was created to allow the addition of views into Eclipse. The idea is that you would create a new view class and, by using the extension point, you could inform Eclipse to use that class as one of its views. So those identifying how one can plug into Eclipse are creating Extension Points, and those making use of the Extension Points to define the required information or classes are making extensions.

Where can you plug into Eclipse? In my opinion, the first and best place to look is in Eclipse Help. Open up Eclipse Help and type “platform extension points” into the search area. The results of the search are shown in Figure 1. The list shown by selecting the third entry in the search result list contains the extension points the platform supports. The implication is that there are many extension points you can use to create your own extension to Eclipse, thus adding new functionality to Eclipse.

Selecting any of the extension points in Help, such as org.eclipse.ui.views, brings you to a page that shows a definition of the extension point, such as its id, description and configuration markup, along with examples of how to use it to create an extension. In the case of org.eclipse.ui.views, the example is as follows:

<extension point="org.eclipse.ui.views">
      <category
         id="com.xyz.views.XYZviews"
         name="XYZ"/>
      <view
         id="com.xyz.views.XYZView"
         name="XYZ View"
         category="com.xyz.views.XYZviews"
         class="com.xyz.views.XYZView"
         icon="icons/XYZ.gif"/>
   </extension>

It’s fairly easy to parse. The extension is for the extension point org.eclipse.ui.views. The view will be added to the menu category “XYZ” that has the id com.xyz.views.XYZviews. The view will be placed in that category, because it indicated that category id for the view. The view also has an id, name and icon associated with it. And most important, the corresponding Java class for the view is com.xyz.views.XYZView. It’s customary that the id and class name of the view are one and the same, but it isn’t required. Internally, you’ll need to know the id of the class to open it inside Eclipse. Having the id and class name the same just make it easier to know what the class is called when you know only the id.

So if you want to add a view to Eclipse, just create a new plugin project, the corresponding view class, and make sure the project’s plugin.xml file contains the entry above. That’s it—you’re done.

Ready to create your own extension point? I’ll save that for next time.


Share this link: http://www.sdtimes.com/link/32311
 

Add comment


Name*
Email*  
Country     


  • Comment
  • Preview
Loading