Sigasi Eclipse Blog

Next Belgian Eclipse User Group Meeting (Tuesday February 23)

The program for the next Belgian Eclipse User Group is ready.

We present Yuri Kok and Wim Jongman, who will introduce us to Eclipse 4.
We are also eagerly looking forward to the presentations of our fellow community members.

Attendance is free, but registration is required and the number of participants is limited.

See you on Tuesday February 23th, 18h00 at PeopleWare in Lier.

How to add a decorator to the splash screen of your RCP application?

Decorated Splash ScreenDecorated 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();
	}
 
}

EDA Start-up story from the trenches

I just uploaded my slides for my Eclipse Summit Europe presentation "EDA Start-up story from the trenches" to SlideShare. For some reason adding the slides to my session page did not work, I will try that again later.

Dynamic menu items in Eclipse

I wanted to add a dynamic menu contribution item to the popup menu of project explorer. I could not immediately find out how to do this, so I decided to document it here. Eventually it turned out to be quite easy.

Belgian Eclipse Users Group Meeting at Sigasi was a great success!

Yesterday Sigasi hosted the third Belgian Eclipse User Group meeting. For the first time we reached a larger audience (I counted 23 attendees), so maybe we should have renamed it to the first real Belgian Eclipse User Group meeting...

Everybody was well on time and eager to meet other Belgian Eclipse users. I received a lot of compliments for bringing us all together to exchange experiences.

Syndicate content