Andrius Velykis Andrius Velykis

Creating icons for Eclipse RCP launcher

CZT IDE launchers for different OSes

Eclipse IDE can be extended by creating plug-ins that complement the existing IDE features. Furthermore, the plug-ins can be released as a standalone application (that may resemble Eclipse IDE) with custom branding and a streamlined selection of features, geared for a specific task. This is done by using the Eclipse Rich Client Platform (RCP) and the branding features available within it.

One of the most visible features of a standalone application is the application icon. Eclipse is a cross-platform application, however the application launchers for each operating system (OS) are native, thus they require different icons. In this post I tried to collect my notes on creating these different icons for different OS builds: their formats, and hints on producing them.

These instructions are for building a branded Eclipse product using Eclipse Tycho with Eclipse Juno (4.2) as the base platform. The experiences come from packaging a standalone IDE for developing Z formal specifications, which will be released as part of the latest Community Z Tools in the nearest future.

Setup

Eclipse launcher can be branded using a corresponding .product file. The Launching tab allows setting icons for each OS.

To set the launcher file name, indicate it in Launcher Name field. For example, if you write “CZT” there, there will be a CZT.exe in Windows, CZT.app in Mac OS X and CZT executable in Linux.

Eclipse .product Launching configuration

Relative paths

The launcher icons need not be packaged into plug-ins, because they are only used to customise the launcher. So we do not need to put these icons into the branding plug-in, and can store them together with the .product file.

If the launcher icons are in the same project as the .product file, they must be indicated using a relative path. For example, if the icons are in /icons folder of the project, use the following path for icon: /icons/czt.icns.

If you select the icon using Browse button in the Product Configuration Editor, it will prepend the project name as well, e.g. /net.sourceforge.czt.eclipse.product/icons/czt.icns. When building with Tycho, it will fail to resolve the relative path because of the project part. So correct it to be relative to the .product file, e.g. /icons/czt.icns.

Linux

CZT IDE launcher for Linux

Linux launcher file does not actually have an icon. However, a icon file (XPM) can be provided for users to customise their shortcuts.

Eclipse bundles for Linux provide an XPM icon of size 256×256. Note that the file is included in the Linux product bundle as is, so the suggested name for it is icon.xpm.

To create an XPM icon file, I used GIMP. Unfortunately GIMP cannot read or write XPM files on Mac OS X (I tried version 2.8.2). To work around this, I used a virtual Ubuntu Linux machine running on VirtualBox. I installed GIMP there and could export (Save As) the XPM file.

When creating the XPM file I used a 256×256 PNG file with transparency as my source. During export, GIMP asks to indicate Threshold Alpha value to handle the partial transparency in the icon. I found that the default value of 127 gives me the best result, but try what suits you.

Mac OS X

CZT IDE launcher for Mac OS X

Mac OS X launcher requires a single ICNS file that will be part of the <Launcher>.app folder. The file is standard Mac OS X icon file and supports multiple icons (e.g. PNG files with transparency) of the following sizes:

16×16, 32×32, 128×128, 256×256, 512×512.

Note that the icons should come in pairs (standard and high resolution, e.g. for Retina displays). The high resolution is double the pixels of a standard one.

The instructions to produce icons are available in Apple documentation. You need to put icons named icon_<sizeinpoints>x<sizeinpoints>[@<scale>].png, e.g. icon_16x16.png, icon_16x16@2x.png, etc, into an .iconset folder. Then run iconutil tool to produce the ICNS file for Eclipse. Refer to Apple documentation for details.

Alternatively, the ICNS file can be produced using the Icon Composer app (available with developer tools), but this method is no longer recommended by Apple.

Windows

CZT IDE launcher for Windows

Windows launcher is produced by replacing icons in Eclipse executable with provided ones. So if the replacement fails, the executable will contain Eclipse icons.

To use with Tycho, you need to create a multi-icon ICO file. The .product _file also provides fields to specify 7 separate _BMP images to use as icons. Unfortunately, I could not manage to get it to work with Tycho 0.15.0 - it seemed to only pick the first one.

The ICO file supports all resolutions outlined in the .product file, in 32-bit (RGB / Alpha Channel) and 8-bit (256 colors, indexed) BMP icons:

  1. 32-bit: 16×16, 32×32, 48×48, 256×256.

  2. 8-bit: 16×16, 24×24 (for older Eclipse versions?), 32×32, 48×48

To convert from transparent PNG to BMP files, I used GIMP. For 32-bit files, just export to BMP file. For 8-bit files, first convert to 255 colours using Image > Mode > Indexed… and select Generate optimum palette with 255 colours. Then export to BMP file with a warning about losing the transparency.

After producing all BMP files, combine them in GIMP using different layers and export as ICO file. Alternatively, use icon software such as IcoFX (15 days fully-functional trial on Windows) to produce the multi-icon ICO.

For Eclipse, you need to make sure that the 256×256 icon is uncompressed, otherwise Tycho will not use it. When you have the ICO file (or if you are producing it with GIMP), re-save it with GIMP and deselect Compressed (PNG) for all layers during export.

Tycho 0.16.0 required for 256×256

Tycho 0.15.0 does not support ICO files containing 256×256 resolution images. There is a bug in IconExe that prevents such file to be used altogether. It is fixed in Tycho 0.16.0, however, so use it if you need large icons. Otherwise, make sure your ICO file does not contain large 256×256 icons.

Further information

Similar information is available for branding Eclipse itself with some additional links.

Topics: Coding - CZT - Eclipse - howto # Top


comments powered by Disqus