RE: [platform-ui-dev] Changes to action enablement
IWorkbench.refreshPluginActions should be called in
AbstractUIPlugin.startup() so we don't have to worry about it.
From: David Springgay/OTT/OTI [mailto:David_Springgay@xxxxxxx]
Sent: Thursday, November 29, 2001 7:52 PM
Subject: [platform-ui-dev] Changes to action enablement
In version 1 of Eclipse the enablement and visibility of window, view,
editor and popup menu action extensions was defined using a limited set of
elements in xml. The existing tags cannot adequately describe the
conditions when an action should be enabled or visible. To resolve these
issues, the following approach has been prototyped:
- if a plug-in is loaded, we will instantiate every action in the plug-in.
- new features have been added to the XML to define action enablement and
visibility. These features can be used to test system properties, plugin
installation, and object state. In addition, they can be combined using
AND, OR, and NOT tags. These features extend the existing markup, and do
not replace it.
A number of people rallied for eager plugin loading. This is infeasable.
Within the workbench action enablement should be quick to calculate. If it
is too expensive to calculate the enablement, the action should be
optimistically enabled, and a dialog should appear if the action is invoked
and cannot perform the required operation. See the CVS actions as an
example. This heuristic for expensive actions can also be applied to
action extension enablement. If we load a plugin to enable an action, it
may induce a tremendous delay, especially when there may be hundreds of
plugins in Eclipse. To avoid this delay, we must define the action
enablement criteria using XML. If it is not possible to define the
enablement criteria accurately using xml, the action should be enabled
The latest drop contains the following changes:
- an IWorkbench.refreshPluginActions(String pluginId) method has been
added. Using this method, you can trigger the creation of action delegates
for a particular plugin. The delegates are created only if the plugin
itself has been activated.
- a new enablement element has been added to action markup. This can be
used to define the enablement criteria for any action, and is a sub element
of the action element.
- a new visibility element has been added to popup menu extension action
markup. This can be used to define the visibility criteria for the action,
and is a sub element of the object contribution element.
For more information on the visibility and enablement criteria, see the
attached html doc.
(See attached file: expressions.html)
If you have any comments on the enablement criteria, please respond.