I want to add an action on the Project Explorer context menu. Is is possible to display different labels according to the nature of the project selected if the action is defined via org.eclipse.ui.popupMenus?
I tryied defining 2 contributions and try to hide one according to the nature, but I did’n find a way to test the project nature.
I want to add an action on the Project Explorer context menu. Is is
Share
You can try the method outlined in http://timezra.blogspot.com/2007/12/dynamic-labels-for-eclipse-context.html
Which is simply to create a dynamic contribution where you will get a method to return the
IMenuContribution[]list, and in the code you can check on whatever condition you want and return the appropriate contribution.Another approach is outlined in http://wiki.eclipse.org/Menu_Contributions#State_associated_with_the_command_is_propogated_to_UI_visible_elements
to have a
NAMEstate associated with the command and update it as needed, I haven’t tried it, but it seems more inline with what you ask.<state id="NAME" class="org.eclipse.jface.menus.TextState" />