Bug 559433 - [Tests] Fix resource handling in
StyledStringHighlighterTest

UI test should not dispose display and Display.getCurrent() can return
null while new Font() with null display will create a display which the
tests then not dispose.

Change-Id: I22b82f4504029a8189cc0c370ceef08231e4daf3
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/StyledStringHighlighterTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/StyledStringHighlighterTest.java
index 969775e..cc90f73 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/StyledStringHighlighterTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/StyledStringHighlighterTest.java
@@ -20,7 +20,6 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyleRange;
 import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.dialogs.StyledStringHighlighter;
 import org.eclipse.ui.tests.harness.util.UITestCase;
 import org.junit.Test;
@@ -35,14 +34,12 @@
 	}
 
 	private StyledStringHighlighter cut;
-	private static Display display;
 	private static Font font;
 	private static BoldStylerProvider boldStyler;
 
 	@Override
 	public void doSetUp() {
-		display = Display.getCurrent();
-		font = new Font(display, "Arial", 14, SWT.BOLD);
+		font = new Font(fWorkbench.getDisplay(), "Arial", 14, SWT.BOLD);
 		boldStyler = new BoldStylerProvider(font);
 		cut = new StyledStringHighlighter();
 	}
@@ -57,10 +54,6 @@
 			font.dispose();
 			font = null;
 		}
-		if (display != null && !display.isDisposed()) {
-			display.dispose();
-			display = null;
-		}
 	}
 
 	@Test