Avoid displaying error dialogs in JUnit mode.
authorEd Swartz <ed.swartz@nokia.com>
Mon, 16 Nov 2009 10:25:45 -0600
changeset 592 e03ece49757c
parent 591 a8e3469fafa4
child 593 7dbb2f97454a
Avoid displaying error dialogs in JUnit mode.
core/com.nokia.carbide.cpp.sysdoc.hover/src/com/nokia/carbide/cpp/sysdoc/internal/hover/core/HoverManager.java
core/com.nokia.carbide.cpp.sysdoc.hover/src/com/nokia/carbide/cpp/sysdoc/internal/hover/uitlis/DialogHelper.java
--- a/core/com.nokia.carbide.cpp.sysdoc.hover/src/com/nokia/carbide/cpp/sysdoc/internal/hover/core/HoverManager.java	Mon Nov 16 10:11:24 2009 -0600
+++ b/core/com.nokia.carbide.cpp.sysdoc.hover/src/com/nokia/carbide/cpp/sysdoc/internal/hover/core/HoverManager.java	Mon Nov 16 10:25:45 2009 -0600
@@ -16,6 +16,9 @@
  */
 package com.nokia.carbide.cpp.sysdoc.internal.hover.core;
 
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.testing.TestableObject;
+
 import com.nokia.carbide.cpp.sysdoc.hover.Activator;
 import com.nokia.carbide.cpp.sysdoc.internal.hover.dal.devlib.DevLibProperties;
 import com.nokia.carbide.cpp.sysdoc.internal.hover.dal.devlib.locator.DevLiblocatorFactory;
@@ -200,4 +203,13 @@
 	public static HoverManager getInstance() {
 		return instance;
 	}
+	
+	public static boolean isJunitRunning() {
+		boolean result = false;
+		TestableObject testableObject = PlatformUI.getTestableObject();
+		if (testableObject != null) {
+			result = testableObject.getTestHarness() != null;
+		}
+		return result;
+	}
 }
--- a/core/com.nokia.carbide.cpp.sysdoc.hover/src/com/nokia/carbide/cpp/sysdoc/internal/hover/uitlis/DialogHelper.java	Mon Nov 16 10:11:24 2009 -0600
+++ b/core/com.nokia.carbide.cpp.sysdoc.hover/src/com/nokia/carbide/cpp/sysdoc/internal/hover/uitlis/DialogHelper.java	Mon Nov 16 10:25:45 2009 -0600
@@ -44,7 +44,7 @@
 
 			}
 		};
-		if (!HoverManager.isTestMode()) {
+		if (!HoverManager.isTestMode() && !HoverManager.isJunitRunning()) {
 			ExecutorAgent.run(mssageRunnable);
 		}
 	}