Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Retrieving the file icon associated to a resource
Retrieving the file icon associated to a resource [message #198490] Fri, 20 February 2004 10:02 Go to next message
Eclipse UserFriend
Originally posted by: pierre.moreau.m-p-s.fr

Dear all,

I have not found a simple method to retreive the icon image displayed by
the resource navigator for a specific extension. I suppose it is stored in
the image registry...

I there a trick, can somebody help?

TIA
Pierre
Re: Retrieving the file icon associated to a resource [message #199044 is a reply to message #198490] Sat, 21 February 2004 14:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: phil.williams.toadmail.com

I am not sure if this is what is used in the navigator, but you might
want to take a look at org.eclipse.ui.dialogs.FileSystemElement. There
is a workbench adaptor in that class that gets the correct icon for a
file type.

HTH,
Phil

Pierre Moreau wrote:

>Dear all,
>
>I have not found a simple method to retreive the icon image displayed by
>the resource navigator for a specific extension. I suppose it is stored in
>the image registry...
>
>I there a trick, can somebody help?
>
>TIA
>Pierre
>
>
>
>
Re: Retrieving the file icon associated to a resource [message #200414 is a reply to message #198490] Mon, 23 February 2004 19:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

PlatformUI.getWorkbench().getEditorRegistry().getImageDescri ptor(filename);
--

Pierre Moreau wrote:
> I have not found a simple method to retreive the icon image displayed by
> the resource navigator for a specific extension. I suppose it is stored in
> the image registry...
Re: Retrieving the file icon associated to a resource [message #200746 is a reply to message #199044] Tue, 24 February 2004 04:36 Go to previous message
Eclipse UserFriend
Originally posted by: pierre.moreau.m-p-s.fr

Thanx Phil & John,

Phil showed me the track.
I found that piece of code working to get the image descriptor:

...
IFile file = (IFile) element;
IWorkbenchAdapter adap = (IWorkbenchAdapter)
file.getAdapter(IWorkbenchAdapter.class);
ImageDescriptor desc = adap.getImageDescriptor(file);
...

John solution is even more sexy.

BR
Pierre §8-}


Phil Williams wrote:

> I am not sure if this is what is used in the navigator, but you might
> want to take a look at org.eclipse.ui.dialogs.FileSystemElement. There
> is a workbench adaptor in that class that gets the correct icon for a
> file type.

> HTH,
> Phil

> Pierre Moreau wrote:

> >Dear all,
> >
> >I have not found a simple method to retreive the icon image displayed by
> >the resource navigator for a specific extension. I suppose it is stored in
> >the image registry...
> >
> >I there a trick, can somebody help?
> >
> >TIA
> >Pierre
> >
> >
> >
> >
Previous Topic:question of resource bundle handling in Eclipse
Next Topic:Eclipse cursor looks funny
Goto Forum:
  


Current Time: Fri May 09 21:24:42 EDT 2025

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

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

Back to the top