statesystem: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.rcp.ui / src / org / eclipse / tracecompass / internal / tracing / rcp / ui / SplashHandler.java
CommitLineData
1d44bc98
BH
1/**********************************************************************
2 * Copyright (c) 2014 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12
13package org.eclipse.tracecompass.internal.tracing.rcp.ui;
14
15import org.eclipse.core.runtime.IProduct;
16import org.eclipse.core.runtime.Platform;
17import org.eclipse.jface.resource.StringConverter;
18import org.eclipse.osgi.util.NLS;
19import org.eclipse.swt.events.PaintEvent;
20import org.eclipse.swt.events.PaintListener;
21import org.eclipse.swt.graphics.Point;
22import org.eclipse.swt.graphics.RGB;
23import org.eclipse.swt.graphics.Rectangle;
24import org.eclipse.swt.widgets.Shell;
25import org.eclipse.tracecompass.internal.tracing.rcp.ui.messages.Messages;
26import org.eclipse.ui.branding.IProductConstants;
27import org.eclipse.ui.splash.BasicSplashHandler;
28
29/**
30 * Custom splash handler
31 *
32 * @author Bernd Hufmann
33 */
34public class SplashHandler extends BasicSplashHandler {
35
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);
39
40 @Override
41 public void init(Shell splash) {
42 super.init(splash);
43
44 String progressString = null;
45
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);
50 }
51 Rectangle progressRect = StringConverter.asRectangle(progressString, PROCESS_BAR_RECTANGLE);
52 setProgressRect(progressRect);
53
54 // Set font color.
55 setForeground(FOREGROUND_COLOR);
56
57 // Set the software version.
58 getContent().addPaintListener(new PaintListener() {
59 @Override
60 public void paintControl(PaintEvent e) {
61 e.gc.setForeground(getForeground());
62 e.gc.drawText(
63 NLS.bind(Messages.SplahScreen_VersionString,
64 TracingRcpPlugin.getDefault().getBundle().getVersion().toString()),
65 VERSION_LOCATION.x, VERSION_LOCATION.y, true);
66 }
67 });
68 }
69}
This page took 0.044756 seconds and 5 git commands to generate.