1 /**********************************************************************
2 * Copyright (c) 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.tracing
.rcp
.ui
;
15 import org
.eclipse
.core
.runtime
.IProduct
;
16 import org
.eclipse
.core
.runtime
.Platform
;
17 import org
.eclipse
.jface
.resource
.StringConverter
;
18 import org
.eclipse
.osgi
.util
.NLS
;
19 import org
.eclipse
.swt
.events
.PaintEvent
;
20 import org
.eclipse
.swt
.events
.PaintListener
;
21 import org
.eclipse
.swt
.graphics
.Point
;
22 import org
.eclipse
.swt
.graphics
.RGB
;
23 import org
.eclipse
.swt
.graphics
.Rectangle
;
24 import org
.eclipse
.swt
.widgets
.Shell
;
25 import org
.eclipse
.tracecompass
.internal
.tracing
.rcp
.ui
.messages
.Messages
;
26 import org
.eclipse
.ui
.branding
.IProductConstants
;
27 import org
.eclipse
.ui
.splash
.BasicSplashHandler
;
30 * Custom splash handler
32 * @author Bernd Hufmann
34 public class SplashHandler
extends BasicSplashHandler
{
36 private static final Point VERSION_LOCATION
= new Point(10, 280);
37 private static final Rectangle PROCESS_BAR_RECTANGLE
= new Rectangle(10, 300, 480, 15);
38 private static final RGB FOREGROUND_COLOR
= new RGB(255, 255, 255);
41 public void init(Shell splash
) {
44 String progressString
= null;
46 // Try to get the progress bar and message updater.
47 IProduct product
= Platform
.getProduct();
48 if (product
!= null) {
49 progressString
= product
.getProperty(IProductConstants
.STARTUP_PROGRESS_RECT
);
51 Rectangle progressRect
= StringConverter
.asRectangle(progressString
, PROCESS_BAR_RECTANGLE
);
52 setProgressRect(progressRect
);
55 setForeground(FOREGROUND_COLOR
);
57 // Set the software version.
58 getContent().addPaintListener(new PaintListener() {
60 public void paintControl(PaintEvent e
) {
61 e
.gc
.setForeground(getForeground());
63 NLS
.bind(Messages
.SplahScreen_VersionString
,
64 TracingRcpPlugin
.getDefault().getBundle().getVersion().toString()),
65 VERSION_LOCATION
.x
, VERSION_LOCATION
.y
, true);