1 11 package org.eclipse.ui.internal.splash; 12 13 import org.eclipse.core.runtime.IProduct; 14 import org.eclipse.core.runtime.Platform; 15 import org.eclipse.jface.resource.StringConverter; 16 import org.eclipse.swt.events.PaintEvent; 17 import org.eclipse.swt.events.PaintListener; 18 import org.eclipse.swt.graphics.Point; 19 import org.eclipse.swt.graphics.RGB; 20 import org.eclipse.swt.graphics.Rectangle; 21 import org.eclipse.swt.widgets.Shell; 22 import org.eclipse.ui.branding.IProductConstants; 23 import org.eclipse.ui.internal.util.PrefUtil; 24 import org.eclipse.ui.splash.BasicSplashHandler; 25 26 30 public class EclipseSplashHandler extends BasicSplashHandler { 31 32 public void init(Shell splash) { 33 super.init(splash); 34 String progressRectString = null; 35 String messageRectString = null; 36 String foregroundColorString = null; 37 IProduct product = Platform.getProduct(); 38 if (product != null) { 39 progressRectString = product 40 .getProperty(IProductConstants.STARTUP_PROGRESS_RECT); 41 messageRectString = product 42 .getProperty(IProductConstants.STARTUP_MESSAGE_RECT); 43 foregroundColorString = product 44 .getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR); 45 } 46 Rectangle progressRect = StringConverter.asRectangle( 47 progressRectString, new Rectangle(10, 10, 300, 15)); 48 setProgressRect(progressRect); 49 50 Rectangle messageRect = StringConverter.asRectangle(messageRectString, 51 new Rectangle(10, 35, 300, 15)); 52 setMessageRect(messageRect); 53 54 int foregroundColorInteger; 55 try { 56 foregroundColorInteger = Integer 57 .parseInt(foregroundColorString, 16); 58 } catch (Exception ex) { 59 foregroundColorInteger = 0xD2D7FF; } 61 62 setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, 63 (foregroundColorInteger & 0xFF00) >> 8, 64 foregroundColorInteger & 0xFF)); 65 if (PrefUtil.getInternalPreferenceStore().getBoolean( 67 "SHOW_BUILDID_ON_STARTUP")) { final String buildId = System.getProperty( 69 "eclipse.buildId", "Unknown Build"); String buildIdLocString = product.getProperty("buildIdLocation"); final Point buildIdPoint = StringConverter.asPoint(buildIdLocString, 74 new Point(322, 190)); 75 getContent().addPaintListener(new PaintListener() { 76 77 public void paintControl(PaintEvent e) { 78 e.gc.setForeground(getForeground()); 79 e.gc.drawText(buildId, buildIdPoint.x, buildIdPoint.y, true); 80 } 81 }); 82 } 83 else { 84 getContent(); } 86 } 87 } 88 | Popular Tags |