Tuesday, July 27, 2010

Add Actions-sets in existing Perspectives

Assumption/PRE-required knowledge : Actionsets has already been created in your plugin. I will only be using the ID declared fr this action set in order to customize its visibility on existing Perspectives.

Example Objective: To display my Actionset with id =”myActionSet” only in Debug perspective(id : org.eclipse.debug.ui.DebugPerspective")

Steps:

There are two ways of doing this.. One is through the class implementation as in (1) below), while is other is by using only plugin.xml file(2) below)

  1. Class implementation: As a first step, we need to register our plug-in as a perspective change listener.
--> include the below xml snippet in plugin.xml

--> Now, implement the class EarlyStartup mentioned in your xml code. This class should implement the IStartup interface and implement the method perspectiveActivated from within the method earlyStartup(). This method is responsible for the action performed every time a perspective is activated.
--------

--------
With the above code, your action sets will be visible only in perspectives related to JAVA, such as : Java, Java Browsing and Java Type Hierarchy.

***************************************************************

2. Extend your plug-in with the extension -Perspective Extensions(refer the blog - 'Customizing existing Perspective')

References:







No comments:

Post a Comment