Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Can a handler be enabled without being active?
Can a handler be enabled without being active? [message #480614] Mon, 17 August 2009 22:37 Go to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
If not: Why does Eclipse bother to evaluate enabledWhen even when
activeWhen is false?

(handler)
(activeWhen)
activeEditorId (with)
fooEditor
(enabledWhen)
activeEditor (with)
bar (test)

I'd expect the "receiver" in the bar PropertyTester to always be fooEditor
instances, but the test method is invoked for other editors as well!
Re: Can a handler be enabled without being active? [message #480702 is a reply to message #480614] Tue, 18 August 2009 09:44 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If the expressions are given to the IEvaluationService they will be evaluated on variable change. The IEvaluationService doesn't know active vs enabled.

1) your property type determines what the receiver will be ... if you make it IEditorPart instead of your concrete instance, for example.

2) as an optimization (especially for expressions that would be called a lot) you can use properties like:

<and>
<instanceof value="org.example.MyEditor"/>
<test property="org.example.bar" .../>
</and>

PW


Re: Can a handler be enabled without bein g active? [message #481175 is a reply to message #480702] Wed, 19 August 2009 23:58 Go to previous messageGo to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Paul Webster wrote:
> <and>
> <instanceof value="org.example.MyEditor"/>
> <test property="org.example.bar" .../>
> </and>

The additional instanceof here is equivalent to having a propertyTester
with type=org.example.MyEditor, right?
Re: Can a handler be enabled without bein g active? [message #481596 is a reply to message #481175] Fri, 21 August 2009 17:17 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Yes you should type your property testers as much as feasible. But because a property test with a type that doesn't match the current variable type throws an exception, it is often just better to use AND (instanceof, test) so that the tester won't be called if the type doesn't match.

PW


Previous Topic:[CVS] tags and branch
Next Topic:JSP editor detects java errors and warnings, but offers no fixes
Goto Forum:
  


Current Time: Mon Dec 22 01:31:49 GMT 2014

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

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