How can I change custom perspective's icon in eclipse?
eclipse, icons, perspective
Solution
The icon for a perspective can be changed by updating the `iconURI` attribute of the perspective's definition in `workbench.xmi` file. This file is located inside the .metadata directory of the workspace. e.g. `/My-Workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi`.
There are usually two lines with the `iconURI` attribute. For example:
<children xsi:type="advanced:Perspective" ... iconURI="platform:/plugin/com.atlassian.clover.eclipse.core/icons/cview16/clover.gif" tooltip="Clover">
and
<snippets xsi:type="advanced:Perspective" ... iconURI="platform:/plugin/com.atlassian.clover.eclipse.core/icons/cview16/clover.gif" tooltip="Clover">
The icon URI is a path to an image within an Eclipse plugin. (Plugins are located at `{ECLIPSE_HOME}/plugins` directory.)
The `workbench.xmi` file needs to be edited after closing the Eclipse IDE, because the file gets overwritten when you exit from Eclipse.
In this example I created a custom perspective named Clover by modifying the Java Perspective available in Eclipse, and saving it as "Clover". Initially my perspective had the same icon as the Java perspective:
So I closed Eclipse, changed the icon paths in `workbench.xmi`, saved the file, reopened the IDE, and got the new icon displayed:
Note: I use Eclipse 4.6.0 (Neon) but this solution would work for all Eclipse 4 versions.
Problem
I want to change my custom perspective's icon in eclipse. I have searched a lot but I didn't find any solution.