rcp: Add version to splash screen
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Fri, 14 Nov 2014 19:19:33 +0000 (14:19 -0500)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Sat, 6 Dec 2014 02:06:16 +0000 (21:06 -0500)
Change-Id: I00936d216604a8bebd8cc2d4f0c079ea7c31f004
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/36514
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
org.eclipse.tracecompass.rcp.branding/plugin.xml
org.eclipse.tracecompass.rcp.product/plugin_customization.ini
org.eclipse.tracecompass.rcp.product/tracing.product
org.eclipse.tracecompass.rcp.ui/plugin.xml
org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/SplashHandler.java [new file with mode: 0644]
org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/messages/Messages.java
org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/messages/messages.properties

index 0d8410e7ee0a2d2e2902747f45fb2b170eaded5c..e48bdbaf7c65edb52b55690a317c716401cb7ec5 100644 (file)
                   name="windowImages"
                   value="icons/png/tc_icon_16x16.png,icons/png/tc_icon_32x32.png,icons/png/tc_icon_48x48.png,icons/png/tc_icon_64x64.png,icons/png/tc_icon_128x128.png,icons/png/tc_icon_256x256.png">
             </property>
-            <property
-                  name="startupProgressRect"
-                  value="10,300,480,15">
-            </property>
-            <property
-                  name="startupForegroundColor"
-                  value="FFFFFF">
-            </property>
-            <property
-                  name="startupMessageRect"
-                  value="7,285,490,0">
-            </property>
             <property
                   name="preferenceCustomization"
                   value="plugin_customization.ini">
index 333fab9da760c08792618efc88d4a4c7a17b2fc3..fe9d173d4af4998962bbf6a9e9856cb09e95c172 100644 (file)
@@ -1 +1 @@
-org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true
+org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false
index a82414a019ac0305ca8b346cfa421d0724cc72db..26db5ea2fb2727f34054a2d62acebe2c5fcb6529 100644 (file)
@@ -40,10 +40,7 @@ http://www.eclipse.org/legal/epl-v10.html
    <windowImages i16="/org.eclipse.tracecompass.rcp.branding/icons/png/tc_icon_16x16.png" i32="/org.eclipse.tracecompass.rcp.branding/icons/png/tc_icon_32x32.png" i48="/org.eclipse.tracecompass.rcp.branding/icons/png/tc_icon_48x48.png" i64="/org.eclipse.tracecompass.rcp.branding/icons/png/tc_icon_64x64.png" i128="/org.eclipse.tracecompass.rcp.branding/icons/png/tc_icon_128x128.png" i256="/org.eclipse.tracecompass.rcp.branding/icons/png/tc_icon_256x256.png"/>
 
    <splash
-      location="org.eclipse.tracecompass.rcp.branding"
-      startupProgressRect="10,300,480,15"
-      startupMessageRect="7,285,490,0"
-      startupForegroundColor="FFFFFF" />
+      location="org.eclipse.tracecompass.rcp.branding" />
    <launcher name="tracecompass">
       <linux icon="../../../../org.eclipse.tracecompass.rcp.branding/icons/xpm/tc_icon_256x256.xpm"/>
       <macosx icon="../../../../org.eclipse.tracecompass.rcp.branding/icons/icns/tc_icon.icns"/>
index 83c305a0fdcd540509fb4314b96c1bd27936f8f8..538e6998184aa9e170b77816a559c3b12a8a604d 100644 (file)
             sequence="F1">
       </key>
    </extension>
+   <extension
+         point="org.eclipse.ui.splashHandlers">
+      <splashHandler
+            class="org.eclipse.tracecompass.internal.tracing.rcp.ui.SplashHandler"
+            id="org.eclipse.tracecompass.rcp.ui.splashHandler">
+      </splashHandler>
+      <splashHandlerProductBinding
+            productId="org.eclipse.tracecompass.rcp.branding.product"
+            splashId="org.eclipse.tracecompass.rcp.ui.splashHandler">
+      </splashHandlerProductBinding>
+   </extension>
 </plugin>
diff --git a/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/SplashHandler.java b/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/SplashHandler.java
new file mode 100644 (file)
index 0000000..df600ed
--- /dev/null
@@ -0,0 +1,69 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.tracing.rcp.ui;
+
+import org.eclipse.core.runtime.IProduct;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.StringConverter;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tracecompass.internal.tracing.rcp.ui.messages.Messages;
+import org.eclipse.ui.branding.IProductConstants;
+import org.eclipse.ui.splash.BasicSplashHandler;
+
+/**
+ * Custom splash handler
+ *
+ * @author Bernd Hufmann
+ */
+public class SplashHandler extends BasicSplashHandler {
+
+    private static final Point VERSION_LOCATION = new Point(10, 280);
+    private static final Rectangle PROCESS_BAR_RECTANGLE = new Rectangle(10, 300, 480, 15);
+    private static final RGB FOREGROUND_COLOR = new RGB(255, 255, 255);
+
+    @Override
+    public void init(Shell splash) {
+        super.init(splash);
+
+        String progressString = null;
+
+        // Try to get the progress bar and message updater.
+        IProduct product = Platform.getProduct();
+        if (product != null) {
+            progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
+        }
+        Rectangle progressRect = StringConverter.asRectangle(progressString, PROCESS_BAR_RECTANGLE);
+        setProgressRect(progressRect);
+
+        // Set font color.
+        setForeground(FOREGROUND_COLOR);
+
+        // Set the software version.
+        getContent().addPaintListener(new PaintListener() {
+            @Override
+            public void paintControl(PaintEvent e) {
+                e.gc.setForeground(getForeground());
+                e.gc.drawText(
+                        NLS.bind(Messages.SplahScreen_VersionString,
+                                TracingRcpPlugin.getDefault().getBundle().getVersion().toString()),
+                        VERSION_LOCATION.x, VERSION_LOCATION.y, true);
+            }
+        });
+    }
+}
index 894ad3fcfeea4c96bbf471169ce9477aef0aba12..e9ff78c32b701dfcd6a71af0512572241134741e 100644 (file)
@@ -34,6 +34,9 @@ public class Messages extends NLS {
     /** Error message for internal errors */
     public static String Application_InternalError;
 
+    /** Version string */
+    public static String SplahScreen_VersionString;
+
     /** Malformed command */
     public static String CliParser_MalformedCommand;
     /** Unkown command */
index e10d1cd0c4fb51c7f9dc3549a82254c830ad50c6..eb4fa567a97224f9f7ebbafddfcacb9379f1427d 100644 (file)
@@ -13,6 +13,7 @@ Application_WorkspaceCreationError=Workspace Creation Error
 Application_WorkspaceRootNotExistError=Workspace root {0} doesn't exists.\n\nPlease create the workspace root.
 Application_WorkspaceRootPermissionError=No permission to create workspace in workspace root {0}\n\nPlease change permission of the workspace root.
 Application_WorkspaceInUseError=Could not launch the application because the associated workspace is currently in use. \n\n{0}
+SplahScreen_VersionString=Version {0}
 Application_InternalError=Internal Error
 Application_WorkspaceSavingError=Problem saving workspace
 CliParser_MalformedCommand=malformed command
This page took 0.029302 seconds and 5 git commands to generate.