Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 143162
Collapse All | Expand All

(-)schema/actionSets.exsd (-6 / +13 lines)
Lines 60-68 Link Here
60
60
61
   <element name="actionSet">
61
   <element name="actionSet">
62
      <annotation>
62
      <annotation>
63
         <appinfo>
64
            <meta.element labelAttribute="label"/>
65
         </appinfo>
66
         <documentation>
63
         <documentation>
67
            This element is used to define a group of actions and/or menus.
64
            This element is used to define a group of actions and/or menus.
68
         </documentation>
65
         </documentation>
Lines 111-119 Link Here
111
108
112
   <element name="action">
109
   <element name="action">
113
      <annotation>
110
      <annotation>
114
         <appinfo>
115
            <meta.element labelAttribute="label" icon="icon"/>
116
         </appinfo>
117
         <documentation>
111
         <documentation>
118
            This element defines an action that the user can invoke in the UI.
112
            This element defines an action that the user can invoke in the UI.
119
         </documentation>
113
         </documentation>
Lines 350-355 Link Here
350
               </documentation>
344
               </documentation>
351
            </annotation>
345
            </annotation>
352
         </attribute>
346
         </attribute>
347
         <attribute name="mode">
348
            <annotation>
349
               <documentation>
350
                  For actions appearing in a toolbar, &lt;code&gt;FORCE_TEXT&lt;/code&gt; will show text even if there is an icon.  See ActionContribuitonItem.
351
               </documentation>
352
            </annotation>
353
            <simpleType>
354
               <restriction base="string">
355
                  <enumeration value="FORCE_TEXT">
356
                  </enumeration>
357
               </restriction>
358
            </simpleType>
359
         </attribute>
353
      </complexType>
360
      </complexType>
354
   </element>
361
   </element>
355
362
(-)schema/menus.exsd (+13 lines)
Lines 747-752 Link Here
747
               </restriction>
747
               </restriction>
748
            </simpleType>
748
            </simpleType>
749
         </attribute>
749
         </attribute>
750
         <attribute name="mode">
751
            <annotation>
752
               <documentation>
753
                  For commands appearing in a toolbar, &lt;code&gt;FORCE_TEXT&lt;/code&gt; will show text even if there is an icon.  See CommandContributionItem.
754
               </documentation>
755
            </annotation>
756
            <simpleType>
757
               <restriction base="string">
758
                  <enumeration value="FORCE_TEXT">
759
                  </enumeration>
760
               </restriction>
761
            </simpleType>
762
         </attribute>
750
      </complexType>
763
      </complexType>
751
   </element>
764
   </element>
752
765
(-)schema/viewActions.exsd (-3 / +13 lines)
Lines 83-91 Link Here
83
83
84
   <element name="action">
84
   <element name="action">
85
      <annotation>
85
      <annotation>
86
         <appinfo>
87
            <meta.element labelAttribute="label" icon="icon"/>
88
         </appinfo>
89
         <documentation>
86
         <documentation>
90
            This element defines an action that the user can invoke in the UI.
87
            This element defines an action that the user can invoke in the UI.
91
         </documentation>
88
         </documentation>
Lines 273-278 Link Here
273
               </documentation>
270
               </documentation>
274
            </annotation>
271
            </annotation>
275
         </attribute>
272
         </attribute>
273
         <attribute name="mode">
274
            <annotation>
275
               <documentation>
276
                  For actions appearing in a toolbar, &lt;code&gt;FORCE_TEXT&lt;/code&gt; will show text even if there is an icon.  See ActionContribuitonItem.
277
               </documentation>
278
            </annotation>
279
            <simpleType>
280
               <restriction base="string">
281
                  <enumeration value="FORCE_TEXT">
282
                  </enumeration>
283
               </restriction>
284
            </simpleType>
285
         </attribute>
276
      </complexType>
286
      </complexType>
277
   </element>
287
   </element>
278
288
(-)schema/editorActions.exsd (-3 / +13 lines)
Lines 96-104 Link Here
96
96
97
   <element name="action">
97
   <element name="action">
98
      <annotation>
98
      <annotation>
99
         <appinfo>
100
            <meta.element labelAttribute="label" icon="icon"/>
101
         </appinfo>
102
         <documentation>
99
         <documentation>
103
            This element defines an action that the user can invoke in the UI.
100
            This element defines an action that the user can invoke in the UI.
104
         </documentation>
101
         </documentation>
Lines 322-327 Link Here
322
               </documentation>
319
               </documentation>
323
            </annotation>
320
            </annotation>
324
         </attribute>
321
         </attribute>
322
         <attribute name="mode">
323
            <annotation>
324
               <documentation>
325
                  For actions appearing in a toolbar, &lt;code&gt;FORCE_TEXT&lt;/code&gt; will show text even if there is an icon.  See ActionContribuitonItem.
326
               </documentation>
327
            </annotation>
328
            <simpleType>
329
               <restriction base="string">
330
                  <enumeration value="FORCE_TEXT">
331
                  </enumeration>
332
               </restriction>
333
            </simpleType>
334
         </attribute>
325
      </complexType>
335
      </complexType>
326
   </element>
336
   </element>
327
337
(-)Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java (-4 / +6 lines)
Lines 369-375 Link Here
369
369
370
            // Add action.
370
            // Add action.
371
            try {
371
            try {
372
                insertAfter(parent, mgroup, ad.getAction());
372
                insertAfter(parent, mgroup, ad);
373
            } catch (IllegalArgumentException e) {
373
            } catch (IllegalArgumentException e) {
374
                WorkbenchPlugin
374
                WorkbenchPlugin
375
                        .log("Plug-in '" + ad.getPluginId() + "' contributed an invalid Menu Extension (Group: '" + mgroup + "' is missing): " + ad.getId()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
375
                        .log("Plug-in '" + ad.getPluginId() + "' contributed an invalid Menu Extension (Group: '" + mgroup + "' is missing): " + ad.getId()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Lines 441-447 Link Here
441
            }
441
            }
442
            // Add action to tool bar.
442
            // Add action to tool bar.
443
            try {
443
            try {
444
                insertAfter(toolbar, tgroup, ad.getAction());
444
                insertAfter(toolbar, tgroup, ad);
445
            } catch (IllegalArgumentException e) {
445
            } catch (IllegalArgumentException e) {
446
                WorkbenchPlugin
446
                WorkbenchPlugin
447
                        .log("Plug-in '" + ad.getPluginId()  //$NON-NLS-1$
447
                        .log("Plug-in '" + ad.getPluginId()  //$NON-NLS-1$
Lines 463-470 Link Here
463
         * Subclasses may override.
463
         * Subclasses may override.
464
         */
464
         */
465
        protected void insertAfter(IContributionManager mgr, String refId,
465
        protected void insertAfter(IContributionManager mgr, String refId,
466
                PluginAction action) {
466
                ActionDescriptor desc) {
467
            insertAfter(mgr, refId, new PluginActionContributionItem(action));
467
            final PluginActionContributionItem item = new PluginActionContributionItem(desc.getAction());
468
            item.setMode(desc.getMode());
469
			insertAfter(mgr, refId, item);
468
        }
470
        }
469
471
470
        /**
472
        /**
(-)Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java (+3 lines)
Lines 382-387 Link Here
382
            PluginAction action = ad.getAction();
382
            PluginAction action = ad.getAction();
383
            ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
383
            ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
384
                    action);
384
                    action);
385
            actionContribution.setMode(ad.getMode());
385
386
386
            bars.addAdjunctContribution(actionContribution);
387
            bars.addAdjunctContribution(actionContribution);
387
388
Lines 438-443 Link Here
438
            PluginAction action = ad.getAction();
439
            PluginAction action = ad.getAction();
439
            ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
440
            ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
440
                    action);
441
                    action);
442
            actionContribution.setMode(ad.getMode());
441
443
442
            // retreive the toolbar from the action bars.
444
            // retreive the toolbar from the action bars.
443
            IToolBarManager toolBar = bars.getToolBarManager(toolBarId);
445
            IToolBarManager toolBar = bars.getToolBarManager(toolBarId);
Lines 590-595 Link Here
590
            PluginAction action = ad.getAction();
592
            PluginAction action = ad.getAction();
591
            PluginActionCoolBarContributionItem actionContribution = new PluginActionCoolBarContributionItem(
593
            PluginActionCoolBarContributionItem actionContribution = new PluginActionCoolBarContributionItem(
592
                    action);
594
                    action);
595
            actionContribution.setMode(ad.getMode());
593
596
594
            bars.removeAdjunctContribution(actionContribution);
597
            bars.removeAdjunctContribution(actionContribution);
595
598
(-)Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java (+10 lines)
Lines 12-17 Link Here
12
12
13
import org.eclipse.core.runtime.IConfigurationElement;
13
import org.eclipse.core.runtime.IConfigurationElement;
14
import org.eclipse.jface.action.Action;
14
import org.eclipse.jface.action.Action;
15
import org.eclipse.jface.action.ActionContributionItem;
15
import org.eclipse.jface.action.IAction;
16
import org.eclipse.jface.action.IAction;
16
import org.eclipse.ui.IEditorPart;
17
import org.eclipse.ui.IEditorPart;
17
import org.eclipse.ui.IPluginContribution;
18
import org.eclipse.ui.IPluginContribution;
Lines 45-50 Link Here
45
46
46
    private String toolbarGroupId;
47
    private String toolbarGroupId;
47
48
49
	private int mode = 0;
50
48
    /**
51
    /**
49
     * Popup constant.  Value <code>0x1</code>.
52
     * Popup constant.  Value <code>0x1</code>.
50
     */
53
     */
Lines 124-129 Link Here
124
        String disabledIcon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_DISABLEDICON);
127
        String disabledIcon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_DISABLEDICON);
125
        String description = actionElement.getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
128
        String description = actionElement.getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
126
        String accelerator = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ACCELERATOR);
129
        String accelerator = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ACCELERATOR);
130
        if ("FORCE_TEXT".equals(actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_MODE))) { //$NON-NLS-1$
131
        	mode  = ActionContributionItem.MODE_FORCE_TEXT;
132
        }
127
133
128
        // Verify input.
134
        // Verify input.
129
        if (label == null) {
135
        if (label == null) {
Lines 372-375 Link Here
372
    public String getPluginId() {
378
    public String getPluginId() {
373
        return pluginId;
379
        return pluginId;
374
    }
380
    }
381
    
382
    public int getMode() {
383
    	return mode;
384
    }
375
}
385
}
(-)Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java (-1 / +19 lines)
Lines 84-89 Link Here
84
	 */
84
	 */
85
	public static final int STYLE_PULLDOWN = SWT.DROP_DOWN;
85
	public static final int STYLE_PULLDOWN = SWT.DROP_DOWN;
86
86
87
	/**
88
	 * Mode bit: Show text on tool items or buttons, even if an image is
89
	 * present. If this mode bit is not set, text is only shown on tool items if
90
	 * there is no image present.
91
	 * 
92
	 * @since 3.4
93
	 */
94
	public static int MODE_FORCE_TEXT = 1;
95
87
	private LocalResourceManager localResourceManager;
96
	private LocalResourceManager localResourceManager;
88
97
89
	private Listener menuItemListener;
98
	private Listener menuItemListener;
Lines 126-131 Link Here
126
135
127
	private String helpContextId;
136
	private String helpContextId;
128
137
138
	private int mode = 0;
139
129
	/**
140
	/**
130
	 * This is <code>true</code> when the menu contribution's visibleWhen
141
	 * This is <code>true</code> when the menu contribution's visibleWhen
131
	 * checkEnabled attribute is <code>true</code>.
142
	 * checkEnabled attribute is <code>true</code>.
Lines 485-491 Link Here
485
				}
496
				}
486
				if (icon != null) {
497
				if (icon != null) {
487
					updateIcons();
498
					updateIcons();
488
				} else if (text != null) {
499
				}
500
501
				if ((icon == null || (mode & MODE_FORCE_TEXT) == MODE_FORCE_TEXT)
502
						&& text != null) {
489
					item.setText(text);
503
					item.setText(text);
490
				}
504
				}
491
505
Lines 737-740 Link Here
737
		}
751
		}
738
		return super.isVisible();
752
		return super.isVisible();
739
	}
753
	}
754
755
	public int getMode() {
756
		return mode;
757
	}
740
}
758
}
(-)Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java (+6 lines)
Lines 109-114 Link Here
109
	public boolean visibleEnabled;
109
	public boolean visibleEnabled;
110
110
111
	/**
111
	/**
112
	 * Any number of mode bits, like
113
	 * {@link CommandContributionItem#MODE_FORCE_TEXT}.
114
	 */
115
	public int mode;
116
117
	/**
112
	 * Create the parameter object. Nullable attributes can be set directly.
118
	 * Create the parameter object. Nullable attributes can be set directly.
113
	 * 
119
	 * 
114
	 * @param serviceLocator
120
	 * @param serviceLocator
(-)Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java (+2 lines)
Lines 1319-1322 Link Here
1319
	public static final String TAG_VARIABLE = "variable"; //$NON-NLS-1$
1319
	public static final String TAG_VARIABLE = "variable"; //$NON-NLS-1$
1320
1320
1321
	public static final String ATT_PRIORITY_LEVEL = "priorityLevel"; //$NON-NLS-1$
1321
	public static final String ATT_PRIORITY_LEVEL = "priorityLevel"; //$NON-NLS-1$
1322
	
1323
	public static final String ATT_MODE = "mode"; //$NON-NLS-1$
1322
}
1324
}
(-)Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java (+8 lines)
Lines 355-360 Link Here
355
		if (inToolbar()) {
355
		if (inToolbar()) {
356
			parm.iconStyle = ICommandImageService.IMAGE_STYLE_TOOLBAR;
356
			parm.iconStyle = ICommandImageService.IMAGE_STYLE_TOOLBAR;
357
		}
357
		}
358
		parm.mode = getMode(commandAddition);
358
		return new CommandContributionItem(parm);
359
		return new CommandContributionItem(parm);
359
	}
360
	}
360
361
Lines 397-402 Link Here
397
	static String getName(IConfigurationElement element) {
398
	static String getName(IConfigurationElement element) {
398
		return element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
399
		return element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
399
	}
400
	}
401
	
402
	static int getMode(IConfigurationElement element) {
403
		if ("FORCE_TEXT".equals(element.getAttribute(IWorkbenchRegistryConstants.ATT_MODE))) { //$NON-NLS-1$
404
			return CommandContributionItem.MODE_FORCE_TEXT;
405
		}
406
		return 0;
407
	}
400
408
401
	static String getLabel(IConfigurationElement element) {
409
	static String getLabel(IConfigurationElement element) {
402
		return element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
410
		return element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);

Return to bug 143162