Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366855

Summary: MenuHelper.getIconURI() has no provision for non-File- or URL-based imagedescriptors
Product: [Eclipse Project] Platform Reporter: Brian de Alwis <bsd>
Component: UIAssignee: Brian de Alwis <bsd>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: remy.suen
Version: 4.2   
Target Milestone: 4.2 M5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch to MenuHelper none

Description Brian de Alwis CLA 2011-12-15 13:32:51 EST
Created attachment 208463 [details]
Patch to MenuHelper

Build: 4.2M4

I have an editor that adds actions to the toolbar.  These actions are actually wrapped instances of Swing/AWT Action objects, and have a custom ImageDescriptor that wraps a Swing IconImage.  Although this ImageDescriptor actually has a URL, but MenuHelper#getIconURI() specifically only handles FileImageDescriptor and URLImageDescriptor.  As a result, the actions are treated as if it has no icon, and the action text is shown instead.

I think we should enhance MenuHelper#getIconURI() to use the adapter manager framework, so as to provide an opportunity for non-{File,URL}ImageDescriptors to provide a URL/URI.
Comment 1 Brian de Alwis CLA 2011-12-16 17:07:38 EST
Fixed in commit d533f63b331c66c0efaf2432d0dbccbb125f7ee4:

Add code to use IAdaptable/IAdapterManager to adapt the ImageDescriptor to a URL.
Comment 2 Brian de Alwis CLA 2012-01-24 13:56:57 EST
Verified in I20120123-2200.