Monday, July 12, 2010

Eclipse Pop-up Menu

org.eclipse.ui.popupMenus
****************************

Eclipse Pop-up menus are menuitems that appear when you right-click on an object in the Eclipse workbench.

Steps:

1) Create a Plug-in project with the.. While you are in the process of creating your plug-in project, when prompted for a template.. choose

' Plug-in project with pop-up menu'>>
next>>
finish

2)Open the Plugin.xml file

3)choose the 'extensions' tab. You will see th eextension structure as seen in the figure below:


4) Now, click on the ....(Object Contribution) item. This will populate the right tab with the details of 'id' and 'Object class'.(figure below)




5) Now, when you right-click on a object from the eclipse workbench, this Object class attribute is the value which determines, when right-clicked on which object, the pop-up needs to be visible as the context menu. Now, if you want to enable this pop-up meny when you click on a folder from any of the eclipse views, you have to browse to 'org.eclipse.core.resources.IFolder' in the field for Object class.


6) As a result of the above step, you will be able to view the pop-up when right-clicking on a folder object in your Eclipse wrkbench as seen in the figure below.

7) In your step 3), click on the ....(Action) item. This will populate the right tab with many details. Now when you click at the 'class' parameter from this view, It opens the class in an editor. This is the class where you can define the action that needs to be performed when you click on the popUpMenu Action(refer figure above)

And there you gooooo :)
***************************************

No comments:

Post a Comment