Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 93338 Details for
Bug 143162
[Actions] Allow to set MODE_FORCE_TEXT in Action
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Force mode in actions and commands v01
mode-v01.txt (text/plain), 14.92 KB, created by
Paul Webster
on 2008-03-24 20:09:33 EDT
(
hide
)
Description:
Force mode in actions and commands v01
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2008-03-24 20:09:33 EDT
Size:
14.92 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui >Index: schema/actionSets.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui/schema/actionSets.exsd,v >retrieving revision 1.22 >diff -u -r1.22 actionSets.exsd >--- schema/actionSets.exsd 26 Feb 2008 17:57:27 -0000 1.22 >+++ schema/actionSets.exsd 25 Mar 2008 00:08:45 -0000 >@@ -60,9 +60,6 @@ > > <element name="actionSet"> > <annotation> >- <appinfo> >- <meta.element labelAttribute="label"/> >- </appinfo> > <documentation> > This element is used to define a group of actions and/or menus. > </documentation> >@@ -111,9 +108,6 @@ > > <element name="action"> > <annotation> >- <appinfo> >- <meta.element labelAttribute="label" icon="icon"/> >- </appinfo> > <documentation> > This element defines an action that the user can invoke in the UI. > </documentation> >@@ -350,6 +344,19 @@ > </documentation> > </annotation> > </attribute> >+ <attribute name="mode"> >+ <annotation> >+ <documentation> >+ For actions appearing in a toolbar, <code>FORCE_TEXT</code> will show text even if there is an icon. See ActionContribuitonItem. >+ </documentation> >+ </annotation> >+ <simpleType> >+ <restriction base="string"> >+ <enumeration value="FORCE_TEXT"> >+ </enumeration> >+ </restriction> >+ </simpleType> >+ </attribute> > </complexType> > </element> > >Index: schema/menus.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui/schema/menus.exsd,v >retrieving revision 1.57 >diff -u -r1.57 menus.exsd >--- schema/menus.exsd 20 Mar 2008 15:12:55 -0000 1.57 >+++ schema/menus.exsd 25 Mar 2008 00:08:47 -0000 >@@ -747,6 +747,19 @@ > </restriction> > </simpleType> > </attribute> >+ <attribute name="mode"> >+ <annotation> >+ <documentation> >+ For commands appearing in a toolbar, <code>FORCE_TEXT</code> will show text even if there is an icon. See CommandContributionItem. >+ </documentation> >+ </annotation> >+ <simpleType> >+ <restriction base="string"> >+ <enumeration value="FORCE_TEXT"> >+ </enumeration> >+ </restriction> >+ </simpleType> >+ </attribute> > </complexType> > </element> > >Index: schema/viewActions.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui/schema/viewActions.exsd,v >retrieving revision 1.17 >diff -u -r1.17 viewActions.exsd >--- schema/viewActions.exsd 26 Feb 2008 17:57:27 -0000 1.17 >+++ schema/viewActions.exsd 25 Mar 2008 00:08:47 -0000 >@@ -83,9 +83,6 @@ > > <element name="action"> > <annotation> >- <appinfo> >- <meta.element labelAttribute="label" icon="icon"/> >- </appinfo> > <documentation> > This element defines an action that the user can invoke in the UI. > </documentation> >@@ -273,6 +270,19 @@ > </documentation> > </annotation> > </attribute> >+ <attribute name="mode"> >+ <annotation> >+ <documentation> >+ For actions appearing in a toolbar, <code>FORCE_TEXT</code> will show text even if there is an icon. See ActionContribuitonItem. >+ </documentation> >+ </annotation> >+ <simpleType> >+ <restriction base="string"> >+ <enumeration value="FORCE_TEXT"> >+ </enumeration> >+ </restriction> >+ </simpleType> >+ </attribute> > </complexType> > </element> > >Index: schema/editorActions.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui/schema/editorActions.exsd,v >retrieving revision 1.23 >diff -u -r1.23 editorActions.exsd >--- schema/editorActions.exsd 26 Feb 2008 17:57:27 -0000 1.23 >+++ schema/editorActions.exsd 25 Mar 2008 00:08:46 -0000 >@@ -96,9 +96,6 @@ > > <element name="action"> > <annotation> >- <appinfo> >- <meta.element labelAttribute="label" icon="icon"/> >- </appinfo> > <documentation> > This element defines an action that the user can invoke in the UI. > </documentation> >@@ -322,6 +319,19 @@ > </documentation> > </annotation> > </attribute> >+ <attribute name="mode"> >+ <annotation> >+ <documentation> >+ For actions appearing in a toolbar, <code>FORCE_TEXT</code> will show text even if there is an icon. See ActionContribuitonItem. >+ </documentation> >+ </annotation> >+ <simpleType> >+ <restriction base="string"> >+ <enumeration value="FORCE_TEXT"> >+ </enumeration> >+ </restriction> >+ </simpleType> >+ </attribute> > </complexType> > </element> > >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java,v >retrieving revision 1.26 >diff -u -r1.26 PluginActionBuilder.java >--- Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java 22 May 2007 17:22:06 -0000 1.26 >+++ Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java 25 Mar 2008 00:08:48 -0000 >@@ -369,7 +369,7 @@ > > // Add action. > try { >- insertAfter(parent, mgroup, ad.getAction()); >+ insertAfter(parent, mgroup, ad); > } catch (IllegalArgumentException e) { > WorkbenchPlugin > .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$ >@@ -441,7 +441,7 @@ > } > // Add action to tool bar. > try { >- insertAfter(toolbar, tgroup, ad.getAction()); >+ insertAfter(toolbar, tgroup, ad); > } catch (IllegalArgumentException e) { > WorkbenchPlugin > .log("Plug-in '" + ad.getPluginId() //$NON-NLS-1$ >@@ -463,8 +463,10 @@ > * Subclasses may override. > */ > protected void insertAfter(IContributionManager mgr, String refId, >- PluginAction action) { >- insertAfter(mgr, refId, new PluginActionContributionItem(action)); >+ ActionDescriptor desc) { >+ final PluginActionContributionItem item = new PluginActionContributionItem(desc.getAction()); >+ item.setMode(desc.getMode()); >+ insertAfter(mgr, refId, item); > } > > /** >Index: Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java,v >retrieving revision 1.34 >diff -u -r1.34 PluginActionSetBuilder.java >--- Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java 24 Feb 2006 18:36:11 -0000 1.34 >+++ Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java 25 Mar 2008 00:08:49 -0000 >@@ -382,6 +382,7 @@ > PluginAction action = ad.getAction(); > ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem( > action); >+ actionContribution.setMode(ad.getMode()); > > bars.addAdjunctContribution(actionContribution); > >@@ -438,6 +439,7 @@ > PluginAction action = ad.getAction(); > ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem( > action); >+ actionContribution.setMode(ad.getMode()); > > // retreive the toolbar from the action bars. > IToolBarManager toolBar = bars.getToolBarManager(toolBarId); >@@ -590,6 +592,7 @@ > PluginAction action = ad.getAction(); > PluginActionCoolBarContributionItem actionContribution = new PluginActionCoolBarContributionItem( > action); >+ actionContribution.setMode(ad.getMode()); > > bars.removeAdjunctContribution(actionContribution); > >Index: Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java,v >retrieving revision 1.28 >diff -u -r1.28 ActionDescriptor.java >--- Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java 8 May 2006 20:55:35 -0000 1.28 >+++ Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java 25 Mar 2008 00:08:48 -0000 >@@ -12,6 +12,7 @@ > > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.ActionContributionItem; > import org.eclipse.jface.action.IAction; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IPluginContribution; >@@ -45,6 +46,8 @@ > > private String toolbarGroupId; > >+ private int mode = 0; >+ > /** > * Popup constant. Value <code>0x1</code>. > */ >@@ -124,6 +127,9 @@ > String disabledIcon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_DISABLEDICON); > String description = actionElement.getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION); > String accelerator = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ACCELERATOR); >+ if ("FORCE_TEXT".equals(actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_MODE))) { //$NON-NLS-1$ >+ mode = ActionContributionItem.MODE_FORCE_TEXT; >+ } > > // Verify input. > if (label == null) { >@@ -372,4 +378,8 @@ > public String getPluginId() { > return pluginId; > } >+ >+ public int getMode() { >+ return mode; >+ } > } >Index: Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java,v >retrieving revision 1.40 >diff -u -r1.40 CommandContributionItem.java >--- Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java 24 Mar 2008 19:22:01 -0000 1.40 >+++ Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java 25 Mar 2008 00:08:50 -0000 >@@ -84,6 +84,15 @@ > */ > public static final int STYLE_PULLDOWN = SWT.DROP_DOWN; > >+ /** >+ * Mode bit: Show text on tool items or buttons, even if an image is >+ * present. If this mode bit is not set, text is only shown on tool items if >+ * there is no image present. >+ * >+ * @since 3.4 >+ */ >+ public static int MODE_FORCE_TEXT = 1; >+ > private LocalResourceManager localResourceManager; > > private Listener menuItemListener; >@@ -126,6 +135,8 @@ > > private String helpContextId; > >+ private int mode = 0; >+ > /** > * This is <code>true</code> when the menu contribution's visibleWhen > * checkEnabled attribute is <code>true</code>. >@@ -485,7 +496,10 @@ > } > if (icon != null) { > updateIcons(); >- } else if (text != null) { >+ } >+ >+ if ((icon == null || (mode & MODE_FORCE_TEXT) == MODE_FORCE_TEXT) >+ && text != null) { > item.setText(text); > } > >@@ -737,4 +751,8 @@ > } > return super.isVisible(); > } >+ >+ public int getMode() { >+ return mode; >+ } > } >Index: Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java,v >retrieving revision 1.3 >diff -u -r1.3 CommandContributionItemParameter.java >--- Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java 7 Dec 2007 18:39:03 -0000 1.3 >+++ Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java 25 Mar 2008 00:08:50 -0000 >@@ -109,6 +109,12 @@ > public boolean visibleEnabled; > > /** >+ * Any number of mode bits, like >+ * {@link CommandContributionItem#MODE_FORCE_TEXT}. >+ */ >+ public int mode; >+ >+ /** > * Create the parameter object. Nullable attributes can be set directly. > * > * @param serviceLocator >Index: Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java,v >retrieving revision 1.36 >diff -u -r1.36 IWorkbenchRegistryConstants.java >--- Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java 24 Mar 2008 19:21:59 -0000 1.36 >+++ Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java 25 Mar 2008 00:08:50 -0000 >@@ -1319,4 +1319,6 @@ > public static final String TAG_VARIABLE = "variable"; //$NON-NLS-1$ > > public static final String ATT_PRIORITY_LEVEL = "priorityLevel"; //$NON-NLS-1$ >+ >+ public static final String ATT_MODE = "mode"; //$NON-NLS-1$ > } >Index: Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java,v >retrieving revision 1.47 >diff -u -r1.47 MenuAdditionCacheEntry.java >--- Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java 24 Mar 2008 19:21:59 -0000 1.47 >+++ Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java 25 Mar 2008 00:08:49 -0000 >@@ -355,6 +355,7 @@ > if (inToolbar()) { > parm.iconStyle = ICommandImageService.IMAGE_STYLE_TOOLBAR; > } >+ parm.mode = getMode(commandAddition); > return new CommandContributionItem(parm); > } > >@@ -397,6 +398,13 @@ > static String getName(IConfigurationElement element) { > return element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME); > } >+ >+ static int getMode(IConfigurationElement element) { >+ if ("FORCE_TEXT".equals(element.getAttribute(IWorkbenchRegistryConstants.ATT_MODE))) { //$NON-NLS-1$ >+ return CommandContributionItem.MODE_FORCE_TEXT; >+ } >+ return 0; >+ } > > static String getLabel(IConfigurationElement element) { > return element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 143162
: 93338