Change Eclipse's icon based on workspace chosen

Chetan Sachdev picture Chetan Sachdev · May 12, 2009 · Viewed 7.7k times · Source

Is it possible in some way to change icon of the Eclipse workspace based on the workspace chosen? I have multiple workspace open running in different Eclipse instances and it becomes complex to recognize. I tried the location argument, which shows the location, but it changes based on selection of directory in the Package Explorer/Navigator. Any tips?

Answer

Andrew Niefer picture Andrew Niefer · May 12, 2009

In Eclipse, products are define using the products extension point. Among other things, this extension point defines branding icons. These affect the windows task bar, and also the icons in the alt-tab list.

What you could do is create your own plug-in that defines new products that each use a different icon, these products can then just run the regular eclipse application. You can switch between products on the command line.

The product extension point would be like this:

  <extension id="my_product_1" point="org.eclipse.core.runtime.products">
      <product application="org.eclipse.ui.ide.workbench" name="My Product">
         <property name="windowImages" value="icons/sample2.gif" />
         <property name="appName"      value="My Product"/>
         <property name="aboutImage"   value="product_lg.gif"/>
         <property name="aboutText"    value="My Product"/>
      </product>
   </extension>

You can create several in the same plug-in, each referring to a different icon. You can see an example by creating a new plug-in using the RCP Mail Template.

You refer to this product on the command line with "-product [plug-in id].[product-id]". So you can create several windows shortcuts with different command lines, specifying different products and workspaces:

eclipse -product org.my.plugin.my_product_1 -data /path/workspace1
eclipse -product org.my.plugin.my_product_2 -data /path/workspace2 

In Eclipse 3.3 and earlier, you can just copy your plug-in into the eclipse/plugins directory for it to be used. In 3.5 there is an option during plug-in export to "Install into host". In 3.4 (and 3.5) there is the dropins folder.