lttng: Don't call PlatformUI.getWorkbench() if the workbench is not running
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Tue, 24 Nov 2015 23:50:17 +0000 (18:50 -0500)
committerAlexandre Montplaisir <alexmonthy@efficios.com>
Wed, 9 Dec 2015 20:22:47 +0000 (15:22 -0500)
Workaround for Bug 480948.

Change-Id: Ib461f802f496bbfe5ad1ecef7fdea85ffd674eee
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/59294
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
lttng/org.eclipse.tracecompass.lttng2.kernel.ui/src/org/eclipse/tracecompass/internal/lttng2/kernel/ui/criticalpath/CriticalPathParameterProvider.java

index a425ffbb42dfd2c358aa8da9aaae099e62ec1b6c..102b76f3ee76d697c77d2464f568ab15a83c07af 100644 (file)
@@ -28,6 +28,7 @@ import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 
 /**
@@ -174,9 +175,21 @@ public class CriticalPathParameterProvider extends TmfAbstractAnalysisParamProvi
     }
 
     private void registerListener() {
-        final IWorkbench wb = PlatformUI.getWorkbench();
-
-        final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();
+        if (!PlatformUI.isWorkbenchRunning()) {
+            return;
+        }
+        IWorkbench wb = PlatformUI.getWorkbench();
+        if (wb == null) {
+            return;
+        }
+        IWorkbenchWindow wbw = wb.getActiveWorkbenchWindow();
+        if (wbw == null) {
+            return;
+        }
+        final IWorkbenchPage activePage = wbw.getActivePage();
+        if (activePage == null) {
+            return;
+        }
 
         /* Activate the update if critical path view visible */
         IViewPart view = activePage.findView(CriticalPathView.ID);
This page took 0.027052 seconds and 5 git commands to generate.