Community
Participate
Working Groups
Build ID: I20090313-0100 From 3.5 M6, Commands supports toggle & radio style menu contributions. Would it be a good idea to add an Extension Wizard for these type of contributions?
Is this a duplicate almost of bug#194669?
Toggling a Menu Command with two descriptions depending on state is already done the resolution of bug 395795. The trick is to use two 'push' style menuContributions with alternating visibility depending on presence or absence of the desired projectNature. <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="popup:org.eclipse.ui.projectConfigure?after=additions"> <command commandId="bug269138.addRemoveSampleNature" label="Disable Sample builder" style="push"> <visibleWhen checkEnabled="false"> <with variable="selection"> <count value="1"> </count> <iterate> <adapt type="org.eclipse.core.resources.IProject"> <test value="bug269138.sampleNature" property="org.eclipse.core.resources.projectNature"> </test> </adapt> </iterate> </with> </visibleWhen> </command> <command commandId="bug269138.addRemoveSampleNature" label="Enable Sample builder" style="push"> <visibleWhen checkEnabled="false"> <with variable="selection"> <count value="1"> </count> <iterate> <adapt type="org.eclipse.core.resources.IProject"> <not> <test value="bug269138.sampleNature" property="org.eclipse.core.resources.projectNature"> </test> </not> </adapt> </iterate> </with> </visibleWhen> </command> </menuContribution> </extension> The code for this can be extracted and put in a separated template. The above plugin.xml code is generated in org.eclipse.pde.internal.ui.templates.ide.BuilderTemplate.updateModel(IProgressMonitor) Attaching Mylyn context.
Created attachment 253494 [details] mylyn/context/zip