[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [platform-ui-dev] How can i change enable/disable state of ac tions defined by "Acti onSet" extension?
|
Title: Message
Hi
Kostya,
What you are asking
to do is quite possible. In fact, I needed to do something similar in the
product that I am working on.
The
IWorkbenchWindowActionDelegate interface is not quite enough to do this.
In addition, it is important that the action delegate also implement
the IActionDelegate2 interface. The IActionDelegate2 interface provides a
way for the action delegate to be informed of the proxy action when the Add-in
that provides the action is loaded. This is done via the following
IActionDelegate2 method:
public void
init(IAction action);
The IAction that is
passed into this method is the proxy action for this action delegate. You
can enable/disable the action using the proxy action as
needed.
You may want to
manage this from the Add-in.
Hope this
helps!
Aaron
Hello All!
I met a problem with actions enablement!
I have several actions which are grouped into
"action set" by coresponding extension in plugin.xml. Logically this actions
don't relate to any view or editor, they correspond to my own self-defined
perspective.These actions are appeared in Main menu and work fine ("run"
methods leads to expected results). But i cann't find a way to control
enablement of these actions, because i implement IWorkbenchWindowActionDelegatenot not
Action directly.
I tried to use special <enablement> element
of "action" extenstion with <systemProperty> condition but don't get
necessary behavoir. Enablement was changed only if SelectionChanged
event occured in some View o Editor Part. But such behavoir do not cover
situation when execution of one action affect on enable state of other
action.
Problem may be simplified to the following
situation:
i want to have 2 actions which
can change enblement of each other. In other words when i click into one
button on main tool bar, another button become disable and vice versa.
Could you help me solve my problem?
With best wishes,
Konstantin Laskovenko,
Mirasoft Ltd,
Kiev, Ukraine.