Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Editors updating command enablement
Editors updating command enablement [message #336263] Thu, 04 June 2009 05:18 Go to next message
Eclipse UserFriend
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 09:03 Go to previous message
Eclipse UserFriend
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 Apr 26 01:23:58 EDT 2025

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

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

Back to the top