aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Walther2013-02-11 13:22:13 (EST)
committerPaul Webster2013-02-11 13:22:33 (EST)
commit5985e3fbf97b2e7a50caa7ac206580e81466858b (patch)
tree3097fc4b9c6eb0749ef593ed1cd9382b4fc8e42a
parent5d257381db57a05fe00b8e484c53d67a78dd2a01 (diff)
downloadeclipse.platform.ui-5985e3fbf97b2e7a50caa7ac206580e81466858b.zip
eclipse.platform.ui-5985e3fbf97b2e7a50caa7ac206580e81466858b.tar.gz
eclipse.platform.ui-5985e3fbf97b2e7a50caa7ac206580e81466858b.tar.bz2
Bug 398631 - Menu item missing icon from commandImages
Fix missing icons on menu items when specified in an org.eclipse.ui.commandImages extension rather than directly in the org.eclipse.ui.menus extension, and the item has an explicit ID different from the command ID. Done in the same way as 4422d10 did it for toolbar items. I’m not sure if looking up icons in the commandImages service by element ID rather than command ID is even an intentional feature, I don’t see it mentioned in the commandImages docs.
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java9
1 files changed, 7 insertions, 2 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 6795f38..c4e10c9 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 IBM Corporation and others.
+ * Copyright (c) 2006, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* 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
*******************************************************************************/
package org.eclipse.ui.internal.menus;
@@ -247,7 +248,11 @@ public class MenuAdditionCacheEntry {
ICommandImageService commandImageService = application.getContext().get(
ICommandImageService.class);
ImageDescriptor descriptor = commandImageService == null ? null : commandImageService
- .getImageDescriptor(item.getElementId());
+ .getImageDescriptor(commandId);
+ if (descriptor == null) {
+ descriptor = commandImageService == null ? null : commandImageService
+ .getImageDescriptor(item.getElementId());
+ }
if (descriptor != null) {
item.setIconURI(MenuHelper.getImageUrl(descriptor));
}