Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Handler enablement spreading across plugin.xml and Java code?
Handler enablement spreading across plugin.xml and Java code? [message #323975] Tue, 15 January 2008 04:57 Go to next message
Eclipse UserFriend
How to deal with the possibility that the enabled state of a handler
depends both on the selection (as expressed in a core expression) and
some other application state that cannot be expressed using a core
expression? I noticed that #isEnabled still gets called after the core
expression evaluates to true, so my implementation of #isEnabled takes
this other app state into account. All works as it's supposed to, but I
find it rather ugly that my logic determining enablement is now
partially in plugin.xml and partially in the handler's code.

Is there a better of way of doing this?

Thanks all,
Jasper.
Re: Handler enablement spreading across plugin.xml and Java code? [message #323982 is a reply to message #323975] Tue, 15 January 2008 08:07 Go to previous message
Eclipse UserFriend
Yes, in 3.2/3.3 a command enabled state = core expression & handle
isEnabled()


You can write a property tester which will call your implementation of
org.eclipse.core.expressions.PropertyTester and then use the test
element in your core expression to call it ... then it's not part of
your handler and could be shared amongst multiple handlers.

The downside in 3.3 is that property testers are not always re-evaluated
when you would desire it (the are on menu shown but not on property
change itself). In 3.4 you will be able to request a property change
re-evaluation.

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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Previous Topic:Scrollable TableViewer in Form
Next Topic:Interface Selection Wizard Component
Goto Forum:
  


Current Time: Fri Jul 04 18:58:30 EDT 2025

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

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

Back to the top