How to add a decorator to the splash screen of your RCP application?
Decorated Splash Screen I wanted to add a decorator to the splash screen our RCP application Sigasi HDT to give our users a visual clue about which version they are running (beta, trial, ...). After some digging and searching for the correct Google search terms, this turned out to be really simple. There is an extension for that: org.eclipse.ui.splashHandlers
This extension point allows to contribute a splash handler in which you can add custom behavior to the splash screen.
In this extension you have to specify a splashHandler and a splashHandlerProductBinding. In splashHandler you specify the class that implements the custom behaviour. In splashHandlerProductBinding you bind your splashHandler to your RCP application (you could also customize the behaviour of Eclipse's splash screen).
For our product this is:
<extension point="org.eclipse.ui.splashHandlers"> <splashHandler class="com.sigasi.hdt.ui.SplashHandler" id="com.sigasi.hdt.ui.splashHandler"> </splashHandler> <splashHandlerProductBinding productId="com.sigasi.hdt.rcp.product" splashId="com.sigasi.hdt.ui.splashHandler"> </splashHandlerProductBinding> </extension>
The only thing left to do, is to implement the splashHandler (The quick fix in the Plugin Manifest Editor is a real time saver).
I extended the EclipseSplashHandler (org.eclipse.ui.internal.splash) and just overrided init to superpose a png image in top right corner.
package com.sigasi.hdt.ui; import com.sigasi.hdt.HdtPlugin; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.internal.splash.EclipseSplashHandler; import org.eclipse.ui.plugin.AbstractUIPlugin; @SuppressWarnings("restriction") public class SplashHandler extends EclipseSplashHandler { private static final String BETA_PNG = "icons/splash/beta.png"; private static final int BORDER = 10; private Image image; public SplashHandler() { super(); } @Override public void init(Shell splash) { super.init(splash); //here you could check some condition on which decoration to show ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(HdtPlugin.ID, BETA_PNG); if (descriptor != null) image = descriptor.createImage(); if (image !=null) { final int xposition = splash.getSize().x - image.getImageData().width - BORDER; final int yposition = BORDER; getContent().addPaintListener (new PaintListener () { public void paintControl (PaintEvent e) { e.gc.drawImage (image, xposition, yposition); } }); } } @Override public void dispose() { super.dispose(); if (image != null) image.dispose(); } }
- Tags:

Comments
Nice, but why not extend
Nice, but why not extend AbstractSplashHandler?
We should not use internal packages.
I know I shouldn't use
I know I shouldn't use internal packages, but I did not want to re-implement the progress bar and messages.
This splash screen extension
This splash screen extension point takes affect when the Workbench is starting up, right after the workspace-choose dialog. For the adventurous, it is possible to start decorating the splash screen even earlier using the org.eclipse.osgi.service.runnable.StartupMonitor service.
The StartupMonitor is more advanced and you need to worry about things that the Workbench takes care of for you with the extension point. (ie wrapping the native splash with a new SWT shell and periodically running the event loop).
Hello, I'm trying to use the
Hello, I'm trying to use the org.eclipse.osgi.service.runnable.StartupMonitor service that you mentioned but kind of don't know how. If you can point me in the right direction or better help me , I would very much appreciate it. Thanks !
For some more splash fun you
For some more splash fun you might want to take a look at the examples over at http://pookzilla.net/wp/2007/01/i-want-to-tell-you-story-ii/