Bug 269138 - [templates] New extension wizards for commands with toggle & radio state
Summary: [templates] New extension wizards for commands with toggle & radio state
Status: NEW
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-18 02:05 EDT by Prakash Rangaraj CLA
Modified: 2015-05-15 05:50 EDT (History)
2 users (show)

See Also:


Attachments
mylyn/context/zip (1.02 KB, application/octet-stream)
2015-05-15 05:50 EDT, maarten meijer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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