Checking for null selection variable value in the command framework of Eclipse RCP -


how can check whether selection variable value null when open editor?

i want activate context menu command when editor opened, not dirty , nothing selected user. first 2 coditions working fine:

<and>     <with         variable="activepartid">         <equals             value="com.eclipse.someeditor">         </equals>     </with>     <with         variable="activepart">         <not>             <test                  property="com.eclipse.iseditordirty">             </test>         </not>     </with> <and> 

my current problem straightforward solution include condition:

<with variable="selection">     <count value="0" /> </with> 

unfortunately when editor first opened, count not 0. null. if user selects , deselects, becomes 0. ideas how check whether value of selection null or similar?

update

i tried creating property tester checks whether value of selection null, code not executed. think happens, because not go inside selection if user did not select/deselect anything.

<with variable="selection">     <test         property="com.eclipse.isselectionnullorempty">     </test> </with> 

try using 'instanceof' , 'and'. like:

<and>  <instanceof value="fully_qualified_class_name_of_your_selection_class"/>  <equals value="0" /> </and> 

hope helps.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -