|
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 |