Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Eclipse popup menu item enablement

Options
  • 06-12-2011 10:52am
    #1
    Registered Users Posts: 28


    Hi,

    I am fairly new to eclipse plugin development and want to disable an eclipse popup menu item base on a particular property value of the selected object. The property is private so I need to use a getter method to access the property.

    Is this possible using the enablement tags in the plugin XML? I.e. can I call the getter method from there to check if the return value is false?

    E.g. Can I do something like this in my plugin.xml
    <extension point="org.eclipse.ui.popupMenus">
             <objectContribution id="com.somedomain.MyPlugin.theId" >
             <enablement>
                        <and>
                            <objectClass name ="com.somedomain.SelectedObject"/>
                            <objectState name="com.somedomain.SelectedObject.getPropertyValue()" value="false"/>
                        </and>
             </enablement>      
          
          </objectContribution>
    


Comments

  • Registered Users Posts: 5,015 ✭✭✭Ludo


    Why not just add the menu for all relevant object types in the plugin.xml file and then in the menu handlers isEnabled() method, decide whether it is enabled or not for each particular case?


  • Registered Users Posts: 28 harry1


    Thanks for the reply!

    I figured it out anyway. I just added the enablements to my actions instead of the object contribution and used the getter method of the object class for the variable I am interested in.


Advertisement