How to change icon based on content in Project Explorer [message #332888] |
Wed, 12 November 2008 16:54  |
Eclipse User |
|
|
|
I've created my own file type and I want to associate an icon in the
Project Explorer for the file based on the content of the file. My files
have the same extensions but based on the header of the file they need to
show different icons. How would I do this?
|
|
|
|
Re: How to change icon based on content in Project Explorer [message #332902 is a reply to message #332888] |
Thu, 13 November 2008 10:29   |
Eclipse User |
|
|
|
Sue wrote:
> I've created my own file type and I want to associate an icon in the
> Project Explorer for the file based on the content of the file. My
> files have the same extensions but based on the header of the file
> they need to show different icons. How would I do this?
>
Per default views (Navigater, Package Explorer, Project Explorer, ...)
show the icon of the editor who is assigned to that file type per
default. Files (or content types) itself don't have an icon. You could
also try to use the navigatorContent extension point.
Dani
|
|
|
Re: How to change icon based on content in Project Explorer [message #332906 is a reply to message #332902] |
Thu, 13 November 2008 15:48   |
Eclipse User |
|
|
|
I guess I'm still confused. I have two different editors that open files
with the same extension. I would like the default editor for the file to
be based on the content of the file. That is, reading the header to
determine which editor to open. In the editor extension point, each
editor has a different icon associated with it. So, when I open the file
using "Open With" and select either editor, the correct icon shows up in
the editor. But, the tree just shows the one icon. (The icon for the
editor that is defined first.) How do I control the icon in the package
explorer tree?
|
|
|
Re: How to change icon based on content in Project Explorer [message #332907 is a reply to message #332906] |
Thu, 13 November 2008 16:25   |
Eclipse User |
|
|
|
Sue wrote:
> I guess I'm still confused. I have two different editors that open
> files with the same extension. I would like the default editor for
> the file to be based on the content of the file. That is, reading the
> header to determine which editor to open. In the editor extension
> point, each editor has a different icon associated with it. So, when
> I open the file using "Open With" and select either editor, the
> correct icon shows up in the editor. But, the tree just shows the one
> icon. (The icon for the editor that is defined first.) How do I
> control the icon in the package explorer tree?
>
Which version of Eclipse do you use? You need 3.4 or newer and make sure
that the 'File Icons Based On Content Analysis' label decorator is enabled.
Dani
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05144 seconds