[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Actions sets in 0.043
|
If you used action sets in 0.035 to extend the Workbench menu and toolbar
with custom actions, you'll notice in 0.043 IActionSet and its
implementation ActionSet are no longer part of the API. That's because you
now add all the menu and toolbar items using the com.ibm.eclipse.ui.actionSets extension-point instead of subclassing
ActionSet. Here's a simple example:
<extension point = "com.ibm.eclipse.ui.actionSets">
<actionSet
id="org.eclipse.examples.helloworld.HelloWorldActionSet"
label="Hello World"
visible="true"
description="The action set for the Eclipse Hello World
example">
<menu
id="org.eclipse.examples.helloworld.HelloWorldMenu"
label="Samples">
<separator name="samples"/>
</menu>
<action
id="org.eclipse.examples.helloworld.actions.HelloWorldAction"
menubarPath="org.eclipse.examples.helloworld.HelloWorldMenu/samples"
toolbarPath="Normal"
label="Hello World"
tooltip="Press to see a message"
icon="icons/helloworld.gif"
class="org.eclipse.examples.helloworld.HelloWorldAction"/>
</actionSet>
</extension>
Class org.eclipse.examples.helloworld.HelloWorldAction implements
IWorkbenchWindowActionDelegate to perform the action. The Workbench
actually creates an action proxy (an IAction) for
org.eclipse.examples.helloworld.actions.HelloWorldAction. This proxy hangs
on to all the UI information from the extension-point markup so it can be
displayed on the menu and toolbar, but does not actually instantiate the
HelloWorldAction until it is actually used. Then the proxy delegates
(hence the name of the IWorkbenchWindowActionDelegate interface) to the
HelloWorldAction which does the real work. This delays the loading of your
plug-in classes and their referenced classes until they are needed. The
delegation happens through the IWorkbenchWindowActionDelegate.run(IAction
proxyAction) method. The proxyAction argument is the actual proxy action
initially created by the Workbench and contains all the UI information
(label, tooltip, icon, etc.) above in case your action implementation
needs to change anything, including selectability.