[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Project Icons

In 0.9 there is support for defining an image decoration for a given project
nature.
This does not replace the project icon, but adds a decoration to its top
right corner.
For example, Java projects have a little 'J' in their top right corner.

For consistency we want to keep the main project icon under control of the
Eclipse UI, especially since there are different variations of the icon,
depending on whether the project is open or closed.
But the decoration support still allows subtle "branding".
I recommend keeping the icon small, e.g. 7x7 pixels, and giving it a dark
foreground, with a white border one pixel wide, so that it can be seen
clearly when overlayed on the main project icon.

See the documentation for the projectNatureImages extension point in the
Eclipse UI plugin (org.eclipse.ui), which lets you map from a given project
nature ID to an icon.
This is defined by the Eclipse UI plugin, and is not API on IProject or
IProjectDescription, because the Core Resources plugin knows nothing about
icons or other aspects of UI presentation.
The decoration is applied wherever the project icon is used: e.g. in the
Navigator view, as well as in the Goto Resource dialog.

You could also look at how the JDT UI plugin (org.eclipse.jdt.ui) uses this
in its plugin.xml.  It has:
<extension point="org.eclipse.ui.projectNatureImages">
  <image id="org.eclipse.ui.javaProjectNatureImage"
natureId="org.eclipse.jdt.core.javanature"
icon="icons/full/ovr16/java_ovr.gif" />
 </extension>
Check out the details of the icon it uses too.

FYI, the algorithm used to find the decoration is:
    String[] ids = project.getDescription().getNatureIds();
    for (int i = 0; i < ids.length; ++i) {
        if there's a registered decoration for ids[i],
            use it and return;
    }
So, it will use only the first decoration found.
However, when adding a nature to a project, you do have control over where
it goes in the list.