As you can see in the title of this post I have a question concerning folder icons in a common navigator view used by an eclipse-rcp application.
Is it basically possible to change the icon of a standard folder in the navigator view? My goal is to change the icon of the source folder of a created project. It is important to mention that there is an own created project nature.
So every created project with that specific nature should have a custom icon for the source folder, but actually I have no idea where I am able to modify that icon.
So the question is: Which part of the rcp-application is responsible to handle these icons? Since there is a specific project nature, I would say that the nature should add these customizations, right?
Here you can see the default folder structure. I would like to change the icon of the src folder.
Any help would be greatly appreciated!
Cheers!
Solution:
For more information, please visit this link.
(1) Add the extension point:
<extension point="org.eclipse.ui.decorators">
<decorator
id="at.fhjoanneum.segof.wsmleditor.natures.decorators.SourceFolderDecorator"
label="Source Folder Decorator"
state="true"
class= "at.fhjoanneum.segof.wsmleditor.natures.decorators.SourceFolderDecorator"
objectClass="org.eclipse.core.resources.IFolder"
adaptable="true">
<description>
Source Folder Decorator
</description>
</decorator>
</extension>
(2) Create the decorator class:
public class SourceFolderDecorator extends LabelProvider implements ILabelDecorator {
public SourceFolderDecorator() {
super();
}
@Override
public Image decorateImage(Image image, Object element) {
//return the image
return null;
}
Cheers!
In order to change the image of any object in the navigator, you can use a label decorator. Check the org.eclipse.ui.decorators
extension point.