Bug 578159 - Access Display directly instead via the PlatformUI
singleton

Change-Id: If8311c27bcaba9dc0b3a0bf303ea31d7656b256b
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/189516
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Karsten Thoms <karsten.thoms@karakun.com>
diff --git a/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/EventLoopMonitorThread.java b/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/EventLoopMonitorThread.java
index ebf4927..dd6d258 100644
--- a/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/EventLoopMonitorThread.java
+++ b/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/EventLoopMonitorThread.java
@@ -36,8 +36,6 @@
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.monitoring.IUiFreezeEventLogger;
 import org.eclipse.ui.monitoring.PreferenceConstants;
 import org.eclipse.ui.monitoring.StackSample;
@@ -689,12 +687,7 @@
 	}
 
 	private static Display getDisplay() throws IllegalStateException {
-		IWorkbench workbench = PlatformUI.getWorkbench();
-		if (workbench == null) {
-			throw new IllegalStateException(Messages.EventLoopMonitorThread_workbench_was_null);
-		}
-
-		Display display = workbench.getDisplay();
+		Display display = Display.getDefault();
 		if (display == null) {
 			throw new IllegalStateException(Messages.EventLoopMonitorThread_display_was_null);
 		}
diff --git a/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/Messages.java b/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/Messages.java
index ee5f9b9..50c7970 100644
--- a/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/Messages.java
+++ b/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/Messages.java
@@ -39,7 +39,6 @@
 	public static String EventLoopMonitorThread_logging_disabled_error;
 	public static String EventLoopMonitorThread_warning_threshold_error_1;
 	public static String EventLoopMonitorThread_max_event_loop_depth_exceeded_1;
-	public static String EventLoopMonitorThread_workbench_was_null;
 	public static String FilterHandler_missing_thread_error;
 	public static String MonitoringStartup_initialization_error;
 
diff --git a/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/Messages.properties b/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/Messages.properties
index bcc23f1..d8f40b6 100644
--- a/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/Messages.properties
+++ b/bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/Messages.properties
@@ -34,6 +34,5 @@
 EventLoopMonitorThread_logging_disabled_error=Event loop monitoring is enabled but logging of UI freezes is disabled.
 EventLoopMonitorThread_warning_threshold_error_1=The warning threshold must be greater than 0. It is currently {0}.
 EventLoopMonitorThread_max_event_loop_depth_exceeded_1=Maximum expected event loop depth of {0} is exceeded. Disabling Event Loop Monitor.
-EventLoopMonitorThread_workbench_was_null=Unable to access Workbench.
 FilterHandler_missing_thread_error=Did not encounter the UI thread in stack traces.
 MonitoringStartup_initialization_error=Error initializing the UI freeze monitoring thread.