Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Command appearing enabled when editPart not in focus
Command appearing enabled when editPart not in focus [message #481177] Wed, 19 August 2009 20:17 Go to next message
Eclipse UserFriend
I have a command that appears in a toolbar in an editor and has a handler
with the following conditions:

<handler class="TestHandler" commandId="test">
<activeWhen>
<with variable="activePartId">
<equals value="testEditor"/>
</with>
</activeWhen>
<enabledWhen>
<with variable="activePart">
<test property="test.editable"/>
</with>
</enabledWhen>
</handler>

When the editor is in a state so that test.editable is false, the command
icon is disabled as expected. But when the editor loses focus, the icon
appears to be enabled again (until you try clicking it, at which point the
editor regains focus and disables the icon).

Is this a bug in Eclipse, or am I doing something wrong here?
Re: Command appearing enabled when editPart not in focus [message #481598 is a reply to message #481177] Fri, 21 August 2009 13:19 Go to previous messageGo to next message
Eclipse UserFriend
Something like this could happen if you provide a default handler for that command.

If the icon is in the editor itself then clicking on the editor would activate the editor so it could execute the toolbar item ... which will activate your handler and honour its enabledWhen.

PW
Re: Command appearing enabled when editPart not in focus [message #481626 is a reply to message #481598] Fri, 21 August 2009 19:26 Go to previous message
Eclipse UserFriend
Paul Webster wrote:
> Something like this could happen if you provide a default handler for that
command.

You're right; when I remove the default handler, the command is no longer
re-enabled when the editor looses focus. Wasn't obvious to me, but makes
sense.
Previous Topic:CVS update hook
Next Topic:EMF databinding to multiple fields
Goto Forum:
  


Current Time: Thu Jul 24 11:24:33 EDT 2025

Powered by FUDForum. Page generated in 0.03873 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top