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
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Eclipse popup menu item enablement

  • 06-12-2011 10:52AM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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