aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek Pospychala2012-08-03 03:03:13 (EDT)
committerJacek Pospychala2012-08-03 03:03:13 (EDT)
commit62397116961a3cbf3a83f1407db3397abff3348c (patch)
tree2762a72cbabf7ee2071b419f23cddff4e00cc7fe
parent9f9e752b1db07a6ee14318813045c3bcbaa3db64 (diff)
downloadorg.eclipse.pdt-62397116961a3cbf3a83f1407db3397abff3348c.zip
org.eclipse.pdt-62397116961a3cbf3a83f1407db3397abff3348c.tar.gz
org.eclipse.pdt-62397116961a3cbf3a83f1407db3397abff3348c.tar.bz2
Bug 386537 - Tests failing due to NullPointerException
-rw-r--r--tests/org.eclipse.php.ui.tests/src/org/eclipse/php/ui/tests/contentassist/ContentAssistTests.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/org.eclipse.php.ui.tests/src/org/eclipse/php/ui/tests/contentassist/ContentAssistTests.java b/tests/org.eclipse.php.ui.tests/src/org/eclipse/php/ui/tests/contentassist/ContentAssistTests.java
index 5dd3e0f..6acdac1 100644
--- a/tests/org.eclipse.php.ui.tests/src/org/eclipse/php/ui/tests/contentassist/ContentAssistTests.java
+++ b/tests/org.eclipse.php.ui.tests/src/org/eclipse/php/ui/tests/contentassist/ContentAssistTests.java
@@ -40,6 +40,7 @@ import org.eclipse.php.internal.ui.PHPUiPlugin;
import org.eclipse.php.internal.ui.editor.PHPStructuredEditor;
import org.eclipse.php.ui.tests.PHPUiTests;
import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
@@ -196,11 +197,12 @@ public class ContentAssistTests extends AbstractPDTTTest {
protected static String executeAutoInsert(int offset) {
StructuredTextViewer viewer = null;
- int tries = 3;
- while ((tries-- > 0) && ((viewer = fEditor.getTextViewer()) == null)) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
+ Display display = Display.getDefault();
+ long timeout = System.currentTimeMillis() + 3000;
+ while ((System.currentTimeMillis() < timeout)
+ && ((viewer = fEditor.getTextViewer()) == null)) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
}
}
StyledText textWidget = viewer.getTextWidget();