rcp: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / rcp / org.eclipse.tracecompass.rcp.ui / src / org / eclipse / tracecompass / internal / tracing / rcp / ui / SplashHandler.java
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
13 package org.eclipse.tracecompass.internal.tracing.rcp.ui;
14
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;
28
29 /**
30 * Custom splash handler
31 *
32 * @author Bernd Hufmann
33 */
34 public 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.03617 seconds and 5 git commands to generate.