Expressions definition iterate/or condition [message #328026] |
Mon, 12 May 2008 14:03  |
Eclipse User |
|
|
|
Originally posted by: clea.mittag.gmail.com
Hi,
I am trying to create an expression definition to work for
enabling/disabling a context menu. I have a tree viewer that contains a
number of different object types. I need to write a test that will return
true if the active menu selection is either object type A or object type
B, but returns false for all other types that may be in the tree.
My expression definition is using the activeMenuSelection(with) variable
test, then iterate, then an insteanceof test and a custom property tester
(for object B, we need to check another property, not just the class
type). Given the iterate documentation, my assumption was that I would
select the OR operator, and then nest the instanceof and property test
items under the iterate tag. The expressions framework would then return
true if either the instanceof test OR the property test returned true. But
it doesn't seem to work. I can get it working using (and) (not)
combinations, but that's kind of painful as I have to list a whole bunch
of tests. Am I not using the correct syntax for OR?
Here's what I have:
<handler class="MyHandler" commandId="AddTask">
<enabledWhen>
<with variable="activeMenuSelection">
<iterate operator="or">
<instanceof value="ObjectA"></instanceof>
<test property="ObjectBPropertyTester"></test>
</iterate>
</with>
</enabledWhen>
</handler>
I've also tried nesting OR tags after the iterate tag:
<handler class="MyHandler" commandId="AddTask">
<enabledWhen>
<with variable="activeMenuSelection">
<iterate operator="or">
<instanceof value="ObjectA"></instanceof>
<or>
<test property="ObjectBPropertyTester"></test>
</or>
</iterate>
</with>
</enabledWhen>
</handler>
... but that doesn't work either. Can someone point me in the right
direction for using an OR condition in an iterate tag?
Thanks in advance!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03401 seconds