Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Get image from platform image registry
Get image from platform image registry [message #334279] Fri, 30 January 2009 11:44 Go to next message
Dominique Poirier is currently offline Dominique PoirierFriend
Messages: 4
Registered: July 2009
Junior Member
Hello,

How to retrieve the image associated with a file type from the platform
image registry.

*.txt ---> icon text
*.java ---> icon with the letter J
...

As the package explorer treeview.

It is to create a little treeview from some files.
Re: Get image from platform image registry [message #334283 is a reply to message #334279] Fri, 30 January 2009 13:39 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can use the Common Navigator/Project Explorer for any IResource
based file viewer. Basically, the workbench label provider for an IFile
does:
org.eclipse.ui.internal.ide.model.WorkbenchFile.getBaseImage (IResource)

The code in getBaseImage(*) looks up the content type and then tries to
get an icon from the editor registry.

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


Re: Get image from platform image registry [message #334285 is a reply to message #334283] Fri, 30 January 2009 17:47 Go to previous message
Dominique Poirier is currently offline Dominique PoirierFriend
Messages: 4
Registered: July 2009
Junior Member
Thank-you Paul. That is exactly what I was looking for
Previous Topic:A command can have the checked state?
Next Topic:Automatically activate 'problems' view when errors occur in compilation
Goto Forum:
  


Current Time: Sun Nov 24 00:10:01 GMT 2024

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

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

Back to the top