Bug 269138

Summary: [templates] New extension wizards for commands with toggle & radio state
Product: [Eclipse Project] PDE Reporter: Prakash Rangaraj <prakash>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: contact, mjmeijer
Version: 3.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
mylyn/context/zip none

Description Prakash Rangaraj CLA 2009-03-18 02:05:09 EDT
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?
Comment 1 maarten meijer CLA 2013-01-07 19:08:11 EST
Is this a duplicate almost of bug#194669?
Comment 2 maarten meijer CLA 2015-05-15 05:49:58 EDT
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.
Comment 3 maarten meijer CLA 2015-05-15 05:50:04 EDT
Created attachment 253494 [details]
mylyn/context/zip