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 43573
Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java (-1 / +12 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Remy Chi Jian Suen <remy.suen@gmail.com> - Bug 43573 [Contributions] Support icon in <menu>
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.ui.internal;
12
package org.eclipse.ui.internal;
12
13
Lines 22-31 Link Here
22
import org.eclipse.jface.action.IToolBarManager;
23
import org.eclipse.jface.action.IToolBarManager;
23
import org.eclipse.jface.action.MenuManager;
24
import org.eclipse.jface.action.MenuManager;
24
import org.eclipse.jface.action.Separator;
25
import org.eclipse.jface.action.Separator;
26
import org.eclipse.jface.resource.ImageDescriptor;
25
import org.eclipse.ui.IWorkbenchActionConstants;
27
import org.eclipse.ui.IWorkbenchActionConstants;
26
import org.eclipse.ui.PlatformUI;
28
import org.eclipse.ui.PlatformUI;
27
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
29
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
28
import org.eclipse.ui.internal.registry.RegistryReader;
30
import org.eclipse.ui.internal.registry.RegistryReader;
31
import org.eclipse.ui.plugin.AbstractUIPlugin;
29
32
30
/**
33
/**
31
 * This class contains shared functionality for reading action contributions
34
 * This class contains shared functionality for reading action contributions
Lines 241-246 Link Here
241
            String id = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
244
            String id = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
242
            String label = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
245
            String label = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
243
            String path = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_PATH);
246
            String path = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_PATH);
247
            String icon = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
248
            ImageDescriptor image = null;
249
            if (icon != null) {
250
            	String extendingPluginId = menuElement.getDeclaringExtension()
251
						.getContributor().getName();
252
				image = AbstractUIPlugin.imageDescriptorFromPlugin(
253
						extendingPluginId, icon);
254
			}
244
            if (label == null) {
255
            if (label == null) {
245
				WorkbenchPlugin.log("Plugin \'" //$NON-NLS-1$
256
				WorkbenchPlugin.log("Plugin \'" //$NON-NLS-1$
246
						+ menuElement.getContributor().getName()
257
						+ menuElement.getContributor().getName()
Lines 297-303 Link Here
297
            // If the menu does not exist create it.
308
            // If the menu does not exist create it.
298
            IMenuManager newMenu = parent.findMenuUsingPath(id);
309
            IMenuManager newMenu = parent.findMenuUsingPath(id);
299
            if (newMenu == null) {
310
            if (newMenu == null) {
300
				newMenu = new MenuManager(label, id);
311
				newMenu = new MenuManager(label, image, id);
301
			}
312
			}
302
313
303
            // Add the menu
314
            // Add the menu
(-)schema/commonAction.exsd (+11 lines)
Lines 48-53 Link Here
48
               </documentation>
48
               </documentation>
49
            </annotation>
49
            </annotation>
50
         </attribute>
50
         </attribute>
51
         <attribute name="icon" type="string">
52
            <annotation>
53
               <documentation>
54
                  a relative path of an icon used to visually represent the action in its context.
55
The path is relative to the location of the plugin.xml file of the contributing plug-in.
56
               </documentation>
57
               <appinfo>
58
                  <meta.attribute kind="resource"/>
59
               </appinfo>
60
            </annotation>
61
         </attribute>
51
      </complexType>
62
      </complexType>
52
   </element>
63
   </element>
53
64

Return to bug 43573