Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Command appearing enabled when editPart not in focus
Command appearing enabled when editPart not in focus [message #481177] Thu, 20 August 2009 00:17 Go to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
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 17:19 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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 23:26 Go to previous message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
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: Fri Mar 29 01:09:59 GMT 2024

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

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

Back to the top