Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » propertyTester crashes on different objects(Crash on evaluating a selection with two different types of objects.)
propertyTester crashes on different objects [message #700381] Sat, 23 July 2011 10:07 Go to next message
Philipp M. Fischer is currently offline Philipp M. FischerFriend
Messages: 67
Registered: November 2010
Location: Germany
Member
Hi Everyone,

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)

Finally, is this expected behaviour? Is there something I am missing out? Or is it maybe a bug which should be failed? What is your experience with the propertyTesters?

Cheers

Phil


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>
    ...
Re: propertyTester crashes on different objects [message #700944 is a reply to message #700381] Sun, 24 July 2011 09:26 Go to previous message
Philipp M. Fischer is currently offline Philipp M. FischerFriend
Messages: 67
Registered: November 2010
Location: Germany
Member
Ok,

The topic is now filed as bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=352938

Cheers
Previous Topic:Default Cut/Copy/Paste/Rename/DeleteCommands disabled
Next Topic:Use of different view ids for the same view part instance class
Goto Forum:
  


Current Time: Wed Apr 24 19:06:40 GMT 2024

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

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

Back to the top