Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change custom perspective's icon in eclipse?

I want to change my custom perspective's icon in eclipse. I have searched a lot but I didn't find any solution.

like image 919
fatihsuat Avatar asked Mar 16 '13 12:03

fatihsuat


People also ask

Where are Eclipse perspectives stored?

the saved perspective's settings will be included in the preferences file. when you've updated the layout, just resave and overwrite the perspective and export the preferences again. to save your perspective, select window > save perspective as… from the application menu.

What is open perspective in Eclipse?

In Eclipse the user can open a new perspective with a particular type, switch from one perspective to another with different type, or change the type (layout) of an existing perspective as they move from one task to another.


2 Answers

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:

initial icon of the custom perspective

So I closed Eclipse, changed the icon paths in workbench.xmi, saved the file, reopened the IDE, and got the new icon displayed:

new icon of the custom perspective

Note: I use Eclipse 4.6.0 (Neon) but this solution would work for all Eclipse 4 versions.

like image 58
sudeep Avatar answered Oct 23 '22 04:10

sudeep


If you stored an existing perspective under a different name as your custom perspective, then it is not possible to change the icon.

You would have to define the perspective by writing a small Eclipse plugin to be able to change the icon.

like image 22
Bananeweizen Avatar answered Oct 23 '22 03:10

Bananeweizen