summaryrefslogtreecommitdiffstats
authorChristian Walther2013-02-11 13:30:41 (EST)
committer Paul Webster2013-02-11 13:30:41 (EST)
commite5313ba78d7a1833f915a7334eacf93a631fbf4f (patch) (side-by-side diff)
tree62ad5c5e07c92e2e9d478623db39ed86754853c3
parent5985e3fbf97b2e7a50caa7ac206580e81466858b (diff)
downloadeclipse.platform.ui-e5313ba78d7a1833f915a7334eacf93a631fbf4f.zip
eclipse.platform.ui-e5313ba78d7a1833f915a7334eacf93a631fbf4f.tar.gz
eclipse.platform.ui-e5313ba78d7a1833f915a7334eacf93a631fbf4f.tar.bz2
Bug 384056 - Disabled icons not being used from extension
Respect the "disabledIcon" property set for toolbar contributions in org.eclipse.ui.menus or org.eclipse.ui.commandImages extensions. Previously, an automatically generated disabled icon would always be used.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
index c4e10c9..08287d1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Remy Chi Jian Suen <remy.suen@gmail.com> - Bug 221662 [Contributions] Extension point org.eclipse.ui.menus: sub menu contribution does not have icon even if specified
* Christian Walther (Indel AG) - Bug 398631: Use correct menu item icon from commandImages
+ * Christian Walther (Indel AG) - Bug 384056: Use disabled icon from extension definition
*******************************************************************************/
package org.eclipse.ui.internal.menus;
@@ -439,6 +440,30 @@ public class MenuAdditionCacheEntry {
} else {
item.setIconURI(iconUrl);
}
+
+ iconUrl = MenuHelper.getIconURI(commandAddition,
+ IWorkbenchRegistryConstants.ATT_DISABLEDICON);
+ if (iconUrl == null) {
+ ICommandImageService commandImageService = application.getContext().get(
+ ICommandImageService.class);
+ if (commandImageService != null) {
+ ImageDescriptor descriptor = commandImageService.getImageDescriptor(commandId,
+ ICommandImageService.TYPE_DISABLED,
+ ICommandImageService.IMAGE_STYLE_TOOLBAR);
+ if (descriptor == null) {
+ descriptor = commandImageService.getImageDescriptor(item.getElementId(),
+ ICommandImageService.TYPE_DISABLED,
+ ICommandImageService.IMAGE_STYLE_TOOLBAR);
+ }
+ if (descriptor != null) {
+ iconUrl = MenuHelper.getImageUrl(descriptor);
+ }
+ }
+ }
+ if (iconUrl != null) {
+ MenuHelper.setDisabledIconURI(item, iconUrl);
+ }
+
item.setTooltip(MenuHelper.getTooltip(commandAddition));
item.setType(MenuHelper.getStyle(commandAddition));
if (MenuHelper.hasPulldownStyle(commandAddition)) {