| Summary: | [Commands] two propertyTester are crashing on selection with two different objects | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Phil F. <phil.m.fischer> | ||||
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | phil.m.fischer, remy.suen | ||||
| Version: | 3.6.2 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
Please attach the stack trace of the error. (In reply to comment #1) > Please attach the stack trace of the error. There is no stack trace, since the error is caught internally in the core expressions code, and nothing is forwarded. I will check, if i can comeup with some little example code in the near future, if the current info is not enough. (In reply to comment #2) > ... I will check, if i can comeup with > some little example code in the near future, if the current info is not enough. That would help a lot. Created attachment 200471 [details]
plugin project with example
I've added the example to this plugin (it's the RCP mail app, but that's not important).
The 2 testers:
z.ex.rcp.mail.PropertyTester1
z.ex.rcp.mail.PropertyTester2
<visibleWhen
checkEnabled="false">
<iterate
operator="or">
<or>
<test
forcePluginActivation="true"
property="z.ex.rcp.mail.propertyTester1.test">
</test>
<test
forcePluginActivation="true"
property="z.ex.rcp.mail.propertyTester2.test">
</test>
</or></iterate>
</visibleWhen>
If the first tester doesn't apply to that resource type, the second is *not* applied.
PW
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build Identifier: I am working on a RCP based on Eclipse 3.6. Within my RCP I am having selections of two different objects "ObjectA" and "ObjectB". A selection may contain both objects at a time. Furthermore I have a command for editing the selected object. In order to enable it I am providing a commandHandler with it the "enabledWhen" expression. This expression is iterating through the selection and uses two "propertyTester" to check the objects. The problem i was facing that in case i have a selction with both objects contained. Only the first "propertyTester" in the "or" expression is evaluated. As soon as the second one is evaluated, the core expressions are bailöing out with a "SWTCoreException". Changing the order of the "propertyTester" makes the other one work but the first one fail. (see the first code block) To work around this problem I added an "and" expression to the "propertyTester" having an "instanceOf" called before the tester. By this both "propertyTesters" are never getting called in the same expression. And everything works fine and the way i expected. (see the second code block) For me this loks strange and I suspect a bug. Code Block I (command, commandHandler and propertyTester): <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <extension point="org.eclipse.core.expressions.propertyTesters"> <propertyTester class="org.phil.tester.test.propertyTester.PropertyTesterObjectA" id="org.phil.tester.test.propertyTesterA" namespace="org.phil.tester.test.objectA" properties="test" type="SelectionObjectA"> </propertyTester> <propertyTester class="org.phil.tester.test.propertyTester.PropertyTesterObjectB" id="org.phil.tester.test.propertyTesterB" namespace="org.phil.tester.test.objectB" properties="test" type="SelectionObjectB"> </propertyTester> </extension> <extension id="org.phil.tester.test.command.editObject" name="Edit Selection Object" point="org.eclipse.ui.commands"> </extension> <extension point="org.eclipse.ui.handlers"> <handler class="org.phil.tester.test.commandHandler.CommandHandlerEditObject" commandId="org.phil.tester.test.command.editObject"> <enabledWhen> <iterate ifEmpty="false" operator="or"> <or> <test forcePluginActivation="true" property="org.phil.tester.test.propertyTesterA.test"> </test> <test forcePluginActivation="true" property="org.phil.tester.test.propertyTesterB.test"> </test> </or> </iterate> </enabledWhen> </handler> </extension> </plugin> Code Block II (the changed expression adding "and"): ... <enabledWhen> <iterate ifEmpty="false" operator="or"> <or> <and> <instanceof value="ObjectA"> </instanceof> <test forcePluginActivation="true" property="org.phil.tester.test.propertyTesterA.test"> </test> </and> <and> <instanceof value="ObjectA"> </instanceof> <test forcePluginActivation="true" property="org.phil.tester.test.propertyTesterB.test"> </test> </and> </or> </iterate> </enabledWhen> ... Reproducible: Always