Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Editors updating command enablement
Editors updating command enablement [message #336263] Thu, 04 June 2009 09:18 Go to next message
Rob is currently offline Rob
Messages: 27
Registered: July 2009
Junior Member
Hi all,

I have created my own app, and I have added commands to my main menu using
CommandContributionItems in the ApplicationActionBarAdvisor. I have
configured the enablement of these commands in the plugin.xml <handlers>
tag. Everything seems to be working ok for most of the commands.

I have also created my own editor (extending TextEditor). The problem is
that I have some commands that I want to be enabled as soon as my editor
goes dirty. However, when I make my editor dirty, the enabled state of the
command is not checked, and it remains disabled in my main menu. I know
it's not being called because part of the <enabledWhen> tag is a
propertytester which is not being called.

Would anyone know how to get the editor to tell the handler to check its
enabled state when it is made dirty? I tried getting my editor to
implement IDocumentListener, so that when documentChanged() is called, I
could try to update the handler, but I don't know what sort of event to
fire in this case.

Any help would be greatly appreciated!
Re: Editors updating command enablement [message #336268 is a reply to message #336263] Thu, 04 June 2009 13:03 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If you are checking the dirty state already in a property tester, all
you need to do is request that property be re-evaluated when the dirty
state changes. See
org.eclipse.ui.services.IEvaluationService.requestEvaluation (String)

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Migrating a Europa custom installer to Galileo P2
Next Topic:Making an executable jar that includes a properties xml
Goto Forum:
  


Current Time: Sat Oct 25 07:25:03 GMT 2014

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

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