can not deactivate handler (only toolbar) [message #890326] |
Thu, 21 June 2012 20:38  |
Eclipse User |
|
|
|
hi, I'm yuta.
I live in japan.
And, sorry to bad English.
I developing RCP product by eclipse3.7 and i have a question.
I can't deactivate handler(toolbar).
I wrote handler as follows.
----------------------------------------------
<handler
class="ExecuteHandler"
commandId="command">
<enabledWhen>
<with
variable="activeWorkbenchWindow">
<test
property="org.eclipse.ui.workbenchWindow.isPerspectiveOpen">
</test>
</with>
</enabledWhen>
</handler>
----------------------------------------------
and register to <extension point="org.eclipse.ui.menus"> as follows.
----------------------------------------------
<menuContribution
locationURI="menu:xxx">
<command
commandId="command"
style="push">
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:yyy">
<command
commandId="command"
style="push">
</command>
</menuContribution>
----------------------------------------------
then, close all perspective.
menu handler deactivated, but toolbar handler not deactivated.
they use same command but why only toolbar not deactivated?
I want to deactivate Both.
pls help me.
|
|
|
|
|
|
Re: can not deactivate handler (only toolbar) [message #892820 is a reply to message #891448] |
Fri, 29 June 2012 17:56  |
Eclipse User |
|
|
|
yuta kobayashi wrote on Mon, 25 June 2012 04:15
(in IPerspectiveListener4#perspectiveOpened, does not work well)
This depends on what you actually want to achieve with the listener.
You did not mention, what your aim is, when the IPerspectiveListener3#perspectiveOpened listener is invoked.
But the IPerspectiveListener3#perspectiveOpened is only invoked if a perpective is added to the org.eclipse.ui.internal.WorkbenchPage and not if it is already opened and the user activates the perspective.
@see WorkbenchPage#addPerspective(Perspective persp)
@see WorkbenchPage#createPerspective(PerspectiveDescriptor desc, boolean notify)
Only those two methods invoke the firePerspectiveOpened method of the org.eclipse.ui.internal.WorkbenchWindow
yuta kobayashi wrote on Mon, 25 June 2012 04:15
However, I can not understand why "re-evaluation" is necessary for only toolbar.
eclipse's bug?
I think the performance of the Client would lack, if the PropertyTester would be tested all the time.
But that would be necessary, if you want the handler´s state to be updated out of the box, because the toolbar is always visible to the user.
Concerning a menu the state is evaluated, when the user opens the menu, but the toolbar is kind of "always opened" and there is not user action to be done in order to see the toolbaritem.
Got it?
So the developer is reponsible to update the state by using the IEvaluationService, like Paul Webster explained.
Is that correct Paul?
Best regards,
Simon
|
|
|
Powered by
FUDForum. Page generated in 0.06412 seconds