Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Loading Icons From Another Plugin
Loading Icons From Another Plugin [message #333718] Sat, 27 December 2008 00:21 Go to next message
Ewan is currently offline EwanFriend
Messages: 5
Registered: July 2009
Junior Member
Hi Guys,

I have been struggling with this one for a while so any help would be
appreciated.

Basically, I wish to access some of the standard JDT icons for use within
my own plugin such as field_private_obj.gif. (I wish to find the URL - not
load the ImageDescriptor)

If I copy the jdt jar which contains the icons into my own plugin
classpath I can access the icons via ......

URL theURL = FileLocator.find(MyPlugin.getDefault().getBundle(), new
Path("icons/full/obj16/field_private_obj.gif"),null);

However, its not very clean to copy the icons and I would prefer to access
the originals. The issue is I cant seem to find the appropriate JDT class
to substitute. JDIDebugPlugin does not seem to work - if indeed this is
the right route to go down.

i.e.

URL theURL = FileLocator.find(<<Some JDT Plugin
Class>>.getDefault().getBundle(), new
Path("icons/full/obj16/field_private_obj.gif"),null);

Any thoughts on which plugin class to use or if there is a completely
separate mechanism. Please note - I want to find the URL not the swt image
descriptor or load the images from an image directory.

Kind Regards,

Mathew
Re: Loading Icons From Another Plugin [message #333741 is a reply to message #333718] Tue, 30 December 2008 14:21 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can use the platform URL:
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/reference/misc/platform-scheme-uri.html

i.e. new URL("platform:/plugin/com.myplugin/icons/me.gif");

This is already supported (although not by the tooling) in most of the
org.eclipse.ui extension points that have "icons" type attributes as
well, or any other plugins that use
org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPl ugin(String,
String)

Is it that you want to load it from the URL over simply getting a
framework supplied ImageDescriptor? Or that you aren't using SWT at
all, and need the URL and its InputStream?

Although once you have the URL you can use
ImageDescriptor.createFromURL(*) to get the image descriptor.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Opening of editors on file extensions
Next Topic:Running Update Manager from Command Prompt
Goto Forum:
  


Current Time: Thu Dec 26 13:31:18 GMT 2024

Powered by FUDForum. Page generated in 0.03165 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top