Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2011-04-26 21:06:17 +0000
committerPawel Piech2011-04-26 21:06:17 +0000
commitcbbafc030ab4f59fa260c6de46a53145673f827a (patch)
tree3a8a325117fecb9d06770781a68dbe552f36eed2 /org.eclipse.debug.tests
parent5887b944fd1ebf7b11bd483d5f6382dfbecd5bf1 (diff)
downloadeclipse.platform.debug-cbbafc030ab4f59fa260c6de46a53145673f827a.tar.gz
eclipse.platform.debug-cbbafc030ab4f59fa260c6de46a53145673f827a.tar.xz
eclipse.platform.debug-cbbafc030ab4f59fa260c6de46a53145673f827a.zip
Bug 343308 - some tests timeout while running via XVnc on the Mac Hudson slaves
- Changed Display.sleep() calls to Thread.sleep(0)
Diffstat (limited to 'org.eclipse.debug.tests')
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java18
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java26
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java34
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java104
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java60
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java22
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java14
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java20
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java22
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java132
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java50
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java2
12 files changed, 252 insertions, 252 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java
index 0230e6b9a..cf9af6ab8 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java
@@ -68,7 +68,7 @@ abstract public class CheckTests extends TestCase {
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
protected void runTest() throws Throwable {
@@ -79,7 +79,7 @@ abstract public class CheckTests extends TestCase {
}
}
- public void testSimpleSingleLevel() {
+ public void testSimpleSingleLevel() throws InterruptedException {
// Create the model with test data
TestModel model = TestModel.simpleSingleLevel();
@@ -96,12 +96,12 @@ abstract public class CheckTests extends TestCase {
fViewer.setInput(model.getRootElement());
// Wait for the updates to complete.
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testSimpleMultiLevel() {
+ public void testSimpleMultiLevel() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -111,7 +111,7 @@ abstract public class CheckTests extends TestCase {
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -126,7 +126,7 @@ abstract public class CheckTests extends TestCase {
// fViewer.setInput(model.getRootElement());
//
// // Wait for the updates to complete and validate.
-// while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+// while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// model.validateData(fViewer, TreePath.EMPTY);
//
// InternalTreeModelViewer treeViewer = ((InternalTreeModelViewer)fViewer);
@@ -146,7 +146,7 @@ abstract public class CheckTests extends TestCase {
// Assert.assertTrue(element.getChecked() != initialCheckState);
// }
- public void testUpdateCheck() {
+ public void testUpdateCheck() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -157,7 +157,7 @@ abstract public class CheckTests extends TestCase {
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -169,7 +169,7 @@ abstract public class CheckTests extends TestCase {
fListener.reset(elementPath, element, -1, true, false);
model.postDelta(delta);
while (!fListener.isFinished(TestModelUpdatesListener.LABEL_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java
index 0ba1bcd50..ceaa82751 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java
@@ -80,19 +80,19 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
fShell.open();
}
- void destroyViewer() {
+ void destroyViewer() throws InterruptedException {
fListener.dispose();
fViewer.getPresentationContext().dispose();
// Close the shell.
fShell.close();
while (!fShell.isDisposed()) {
if (!fDisplay.readAndDispatch()) {
- fDisplay.sleep();
+ Thread.sleep(0);
}
}
}
- void recreateViewer() {
+ void recreateViewer() throws InterruptedException {
destroyViewer();
createViewer();
}
@@ -211,7 +211,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
}
- private TestModel makeModel(MyColumnPresentation cp, String rootSufffix) {
+ private TestModel makeModel(MyColumnPresentation cp, String rootSufffix) throws InterruptedException {
MyModel model = new MyModel(cp);
model.setRoot(new TestElement(model, "root" + rootSufffix, new TestElement[] {
new TestElement(model, "1", true, true, new TestElement[0]),
@@ -224,7 +224,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch()) {
- fDisplay.sleep();
+ Thread.sleep(0);
}
}
model.validateData(fViewer, TreePath.EMPTY);
@@ -239,9 +239,9 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
* average of tree width / number of visible columns, which is the logic
* in InternalTreeModelViewer.
*/
- public void testInitialColumnAverageWidth() {
+ public void testInitialColumnAverageWidth() throws InterruptedException {
// Try to wait for the shell painting to settle
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
fResized = false;
MyColumnPresentation colPre = new MyColumnPresentation();
@@ -270,9 +270,9 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
* Also, we verify that the initial columns width is the width computed by
* the IColumnPresentation2 implementation.
*/
- public void testInitialColumnWidth() {
+ public void testInitialColumnWidth() throws InterruptedException {
// Try to wait for the shell painting to settle
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
fResized = false;
MyColumnPresentation2 colPre = new MyColumnPresentation2();
@@ -299,7 +299,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
* is not used when there are user settings inside the viewer which are
* created from user resizing columns.
*/
- public void testRespectUserSettings() {
+ public void testRespectUserSettings() throws InterruptedException {
MyColumnPresentation2 colPre = new MyColumnPresentation2();
makeModel(colPre, "m2");
TreeColumn[] columns = fViewer.getTree().getColumns();
@@ -327,13 +327,13 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
fViewer.setShowColumns(false);
do {
if (!fDisplay.readAndDispatch()) {
- fDisplay.sleep();
+ Thread.sleep(0);
}
} while (fViewer.getTree().getColumns().length > 0);
fViewer.setShowColumns(true);
do {
if (!fDisplay.readAndDispatch()) {
- fDisplay.sleep();
+ Thread.sleep(0);
}
} while (fViewer.getTree().getColumns().length != newWidths.length);
// verify user resized widths are used instead of the initial widths from IColumnPresentation2
@@ -349,7 +349,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
* is not used when there are user settings inside the viewer which are
* restored from memento, e.g., restoring workspace, etc.
*/
- public void testRespectMemento() {
+ public void testRespectMemento() throws InterruptedException {
MyColumnPresentation2 colPre = new MyColumnPresentation2();
makeModel(colPre, "m2");
TreeColumn[] columns = fViewer.getTree().getColumns();
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java
index 3a76e5ae8..ece0b3e0c 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java
@@ -76,7 +76,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
protected void runTest() throws Throwable {
@@ -87,7 +87,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
}
}
- public void testSimpleSingleLevel() {
+ public void testSimpleSingleLevel() throws InterruptedException {
// Create the model with test data
TestModel model = TestModel.simpleSingleLevel();
@@ -104,12 +104,12 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
fViewer.setInput(model.getRootElement());
// Wait for the updates to complete.
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testSimpleMultiLevel() {
+ public void testSimpleMultiLevel() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -119,7 +119,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -175,7 +175,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
* use data from stale updates to populate the viewer.<br>
* See bug 210027
*/
- public void testLabelUpdatesCompletedOutOfSequence1() {
+ public void testLabelUpdatesCompletedOutOfSequence1() throws InterruptedException {
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureLabelUpdates = true;
@@ -188,7 +188,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
// Wait for view to start retrieving content.
fViewer.setInput(model.getRootElement());
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
List firstUpdates = model.fCapturedUpdates;
model.fCapturedUpdates = new ArrayList(2);
@@ -199,7 +199,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
// Complete the second set of children updates
@@ -214,7 +214,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
capturedUpdate.done();
}
- while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
@@ -228,7 +228,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
* updates.<br>
* See bug 210027
*/
- public void testLabelUpdatesCompletedOutOfSequence2() {
+ public void testLabelUpdatesCompletedOutOfSequence2() throws InterruptedException {
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureLabelUpdates = true;
@@ -241,7 +241,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
// Wait for view to start retrieving content.
fViewer.setInput(model.getRootElement());
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
List firstUpdates = model.fCapturedUpdates;
model.fCapturedUpdates = new ArrayList(2);
@@ -254,7 +254,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
// Complete the second set of children updates
@@ -269,7 +269,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
capturedUpdate.done();
}
- while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
@@ -284,7 +284,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
* point, then this test should be re-enabled.<br>
* See bug 210027
*/
- public void _x_testChildrenUpdatesCompletedOutOfSequence() {
+ public void _x_testChildrenUpdatesCompletedOutOfSequence() throws InterruptedException {
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureChildrenUpdates = true;
@@ -297,7 +297,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
// Wait for view to start retrieving content.
fViewer.setInput(model.getRootElement());
while (!areCapturedChildrenUpdatesComplete(model.fCapturedUpdates, model.getRootElement().fChildren.length)) {
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
IChildrenUpdate[] firstUpdates = (IChildrenUpdate[])model.fCapturedUpdates.toArray(new IChildrenUpdate[0]);
model.fCapturedUpdates.clear();
@@ -310,7 +310,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!areCapturedChildrenUpdatesComplete(model.fCapturedUpdates, model.getRootElement().fChildren.length)) {
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
// Complete the second set of children updates
@@ -323,7 +323,7 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
firstUpdates[i].done();
}
- while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
index a7e69d457..16fd3485a 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
@@ -72,7 +72,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
protected void runTest() throws Throwable {
@@ -83,7 +83,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
- public void testUpdateLabel() {
+ public void testUpdateLabel() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -94,7 +94,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -105,11 +105,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(elementPath, element, -1, true, false);
model.postDelta(delta);
while (!fListener.isFinished(LABEL_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testRefreshStruct() {
+ public void testRefreshStruct() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -120,7 +120,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -135,11 +135,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(elementPath, element, -1, true, false);
model.postDelta(delta);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testRefreshStruct2() {
+ public void testRefreshStruct2() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -150,7 +150,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
String prefix = "new - ";
@@ -185,11 +185,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testInsert() {
+ public void testInsert() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -201,7 +201,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -220,7 +220,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.setFailOnRedundantUpdates(false);
model.postDelta(delta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -228,7 +228,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
* This test checks that insert and select delta flags are processed in correct order:
* insert then select.
*/
- public void testInsertAndSelect() {
+ public void testInsertAndSelect() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -241,7 +241,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished())
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
@@ -269,7 +269,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.postDelta(rootDelta);
while (!fListener.isFinished())
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -278,7 +278,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
* This test checks that insert and remove deltas are processed in correct order:
* remove deltas are processed first then insert deltas.
*/
- public void testInsertAndRemove() {
+ public void testInsertAndRemove() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -287,7 +287,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished())
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
@@ -315,13 +315,13 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.postDelta(combinedDelta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testAddElement() {
+ public void testAddElement() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -332,7 +332,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -347,12 +347,12 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.setFailOnRedundantUpdates(false);
model.postDelta(delta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
// This test currently fails. When (if) bug 311442 gets address we should re-enable it.
- public void _x_testAddUnexpandedElement() {
+ public void _x_testAddUnexpandedElement() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -365,7 +365,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Update the model
TreePath parentPath = model.findElement("1");
@@ -379,7 +379,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.setFailOnRedundantUpdates(false);
model.postDelta(rootDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Update the elements that were added.
fListener.reset();
@@ -392,18 +392,18 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.postDelta(rootDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
((ITreeModelContentProviderTarget)fViewer).expandToLevel(parentPath, 1);
while (fListener.isFinished(CONTENT_UPDATES_STARTED) && !fListener.isFinished(CONTENT_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, parentPath);
}
- public void _x_testRefreshUnexpandedElementsChildren() {
+ public void _x_testRefreshUnexpandedElementsChildren() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -416,7 +416,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Expand elment "2"
TreePath parentPath = model.findElement("2");
@@ -424,7 +424,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
((ITreeModelContentProviderTarget)fViewer).expandToLevel(parentPath, 1);
while (fListener.isFinished(CONTENT_UPDATES_STARTED) && !fListener.isFinished(CONTENT_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Collapse back element "2"
((ITreeModelContentProviderTarget)fViewer).setExpandedState(parentPath, false);
@@ -439,20 +439,20 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.postDelta(rootDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Expand back element "2"
fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
((ITreeModelContentProviderTarget)fViewer).expandToLevel(parentPath, 1);
while (fListener.isFinished(CONTENT_UPDATES_STARTED) && !fListener.isFinished(CONTENT_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, parentPath, true);
}
- public void testRemove() {
+ public void testRemove() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -463,7 +463,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -474,11 +474,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset();
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testExpandAndSelect() {
+ public void testExpandAndSelect() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
// Create the listener
@@ -486,7 +486,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Create the delta
@@ -540,7 +540,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.postDelta(deltaRoot);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Validate the expansion state AFTER posting the delta.
@@ -561,7 +561,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
/**
* This test verifies that expand and select updates are being ignored.
*/
- public void testExpandAndSelect_simple() {
+ public void testExpandAndSelect_simple() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
// Create the listener
@@ -569,7 +569,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Create the delta
@@ -598,7 +598,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
break;
}
}
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -615,7 +615,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
- public void testCompositeModelRefreshStruct() {
+ public void testCompositeModelRefreshStruct() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.compositeMultiLevel();
@@ -627,7 +627,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Update the model
@@ -644,11 +644,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(m4_2_1Path, m4_2_1, -1, true, false);
model.postDelta(delta);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testCompositeModelAddElement() {
+ public void testCompositeModelAddElement() throws InterruptedException {
TestModel model = TestModel.compositeMultiLevel();
fViewer.setAutoExpandLevel(-1);
@@ -658,7 +658,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
TreePath m3_1Path = model.findElement("m3.1");
@@ -674,19 +674,19 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
m3.postDelta(delta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- public void testBug292322() {
+ public void testBug292322() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Update the model: remove one child of an un-expanded element, then
@@ -700,7 +700,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
//fListener.addChildreCountUpdate(parentPath);
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate the viewer data.
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -713,7 +713,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(parentPath, parentElement, 0, false, false);
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate the viewer data.
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -726,7 +726,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(parentPath, parentElement, 0, false, false);
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate the viewer data.
model.validateData(fViewer, TreePath.EMPTY, true);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
index 15d1b0e73..ffa53e9f9 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
@@ -69,7 +69,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
protected void runTest() throws Throwable {
@@ -92,7 +92,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
* Restore REVEAL on simple model with elements without children.
*
*/
- public void testRestoreTopIndex() {
+ public void testRestoreTopIndex() throws InterruptedException {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = new TestModel();
@@ -113,7 +113,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Stop forcing view updates.
@@ -138,12 +138,12 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fViewer.setInput(null);
while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set the viewer input back to the model to trigger RESTORE operation.
fListener.reset(false, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
while (fDisplay.readAndDispatch ()) {}
// check if REVEAL was restored OK
@@ -158,7 +158,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
*
* See bug 324100
*/
- public void testRestoreTopAndExpand() {
+ public void testRestoreTopAndExpand() throws InterruptedException {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = new TestModel();
@@ -188,7 +188,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Expand first element
@@ -207,7 +207,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
model.postDelta(rootDelta);
while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate that the first node is expanded
Assert.assertTrue(getCTargetViewer().getExpandedState(firstElemPath) == true);
@@ -231,12 +231,12 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.reset(true, false);
fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set the viewer input back to the model
fListener.reset(false, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
while (fDisplay.readAndDispatch ()) {}
// check if REVEAL was restored OK
@@ -251,7 +251,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
*
* See bug 324100
*/
- public void testRestoreTopTriggersExpand() {
+ public void testRestoreTopTriggersExpand() throws InterruptedException {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = new TestModel();
@@ -283,7 +283,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
int indexLastElem = elements.length-1;
@@ -313,12 +313,12 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fViewer.setInput(null);
while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set the viewer input back to the model.
fListener.reset(false, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
while (fDisplay.readAndDispatch ()) {}
// check if REVEAL was restored OK
@@ -332,7 +332,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
* This test verifies that canceling a reveal pending state delta is
* properly handled when a new reveal delta is received from the model.
*/
- public void testRestoreRevealAfterRevealCancel() {
+ public void testRestoreRevealAfterRevealCancel() throws InterruptedException {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -344,7 +344,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Stop autopopulating the view.
@@ -357,7 +357,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Trigger save of state.
fListener.reset();
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) fDisplay.sleep ();
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) Thread.sleep(0);
// Set input back to root element.
// Note: Wait only for the processing of the delta and the start of state restore, not for all updates
@@ -366,7 +366,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 1, STATE_UPDATES);
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Update the viewer with new selection delta to something new in the view
ModelDelta revealDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.REVEAL);
@@ -375,17 +375,17 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.reset();
model.postDelta(revealDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Clear view then reset it again.
fListener.reset();
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) fDisplay.sleep ();
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) Thread.sleep(0);
autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished(STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
autopopulateAgent.dispose();
}
@@ -394,7 +394,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
* This test verifies that canceling a reveal pending state delta is
* properly handled when a new reveal delta is received from the model.
*/
- public void testRestoreRevealAfterRevealCancel2() {
+ public void testRestoreRevealAfterRevealCancel2() throws InterruptedException {
if (Platform.getOS().equals(Platform.OS_MACOSX)) {
// skip this test on Mac - see bug 327557
return;
@@ -410,7 +410,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Stop auto-populating and auto-expanding the view.
@@ -424,7 +424,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Trigger save of state.
fListener.reset();
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) fDisplay.sleep ();
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) Thread.sleep(0);
// Set input back to root element.
// Note: Wait only for the processing of the delta and the start of state restore, not for all updates
@@ -435,7 +435,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 0, STATE_UPDATES);
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished(STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Update the viewer with new selection delta to something new in the view
TreePath pathToBeRevealed = model.findElement("2.1");
@@ -451,7 +451,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Wait for the second model delta to process
model.postDelta(revealDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES | LABEL_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// check if REVEAL was triggered by the delta and not by the
// state restore operation
@@ -468,7 +468,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
*
* See bug 324100
*/
- public void testRestoreDeepTreeAndReveal() {
+ public void testRestoreDeepTreeAndReveal() throws InterruptedException {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleDeepMultiLevel();
@@ -481,7 +481,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Stop forcing view updates.
@@ -501,13 +501,13 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.reset(true, false);
fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set the viewer input back to the model
fListener.reset(false, false);
fListener.addUpdates(getCTargetViewer(), originalTopPath, (TestElement)originalTopPath.getLastSegment(), 0, STATE_UPDATES);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(STATE_UPDATES | CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(STATE_UPDATES | CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
while (fDisplay.readAndDispatch ()) {}
// check if REVEAL was restored OK
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java
index 99132133e..373e67132 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java
@@ -69,7 +69,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
protected void runTest() throws Throwable {
@@ -108,7 +108,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
* not automatically materialized.
* (bug 305739 and bug 304277)
*/
- public void testExpandLargeSubTree() {
+ public void testExpandLargeSubTree() throws InterruptedException {
// Create test model with lots of children.
TestModel model = largeSubtreeModel(1000);
@@ -117,7 +117,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Populate initial view content
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, true);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Create delta to expand the "1" element.
TestElement rootElement = model.getRootElement();
@@ -141,7 +141,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
model.postDelta(rootDelta);
while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE | LABEL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
/**
@@ -149,7 +149,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
* then selected and replaced, that no extra elements are retrieved.
* (bug 304277 comment #24, and bug 305739 comment #9).
*/
- public void testReplaceAndSelectInSubTreeTree() {
+ public void testReplaceAndSelectInSubTreeTree() throws InterruptedException {
// Create test model with lots of children.
TestModel model = largeSubtreeModel(1000);
@@ -165,7 +165,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
fListener.setFailOnRedundantUpdates(false);
fViewer.setInput(model.getRootElement());
fListener.addLabelUpdate(model.findElement("1.0"));
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set selection so that the initial selection is not empty
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("1.0")} ));
@@ -191,7 +191,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
model.postDelta(rootDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | LABEL_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
Assert.assertEquals(((IStructuredSelection)fViewer.getSelection()).getFirstElement(), _1_0_newElement);
@@ -199,7 +199,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
/**
*/
- public void testContentRefresh() {
+ public void testContentRefresh() throws InterruptedException {
// Create test model with lots of children.
TestModel model = largeSubtreeModel(1000);
@@ -209,7 +209,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Populate initial view content
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Turn off autoexpand
fViewer.setAutoExpandLevel(0);
@@ -218,7 +218,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
fListener.reset();
fListener.setFailOnRedundantUpdates(false);
fViewer.reveal(model.findElement("1"), 500);
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Create delta to refresh the "1" element.
TestElement rootElement = model.getRootElement();
@@ -249,7 +249,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
model.postDelta(rootDelta);
while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java
index f9eb7397f..c184485e8 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java
@@ -66,7 +66,7 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
protected void runTest() throws Throwable {
@@ -84,7 +84,7 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
*/
abstract protected int getTestModelDepth();
- public void testRefreshStruct() {
+ public void testRefreshStruct() throws InterruptedException {
TestModel model = new TestModel();
model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
model.setElementChildren(TreePath.EMPTY, makeModelElements(model, getTestModelDepth(), "model"));
@@ -96,7 +96,7 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
@@ -113,7 +113,7 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
meter.start();
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
meter.stop();
System.gc();
@@ -126,7 +126,7 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
}
}
- public void testRefreshStructReplaceElements() {
+ public void testRefreshStructReplaceElements() throws InterruptedException {
TestModel model = new TestModel();
model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
model.setElementChildren(TreePath.EMPTY, makeModelElements(model, getTestModelDepth(), "model"));
@@ -138,7 +138,7 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
@@ -154,7 +154,7 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
meter.start();
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
meter.stop();
System.gc();
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java
index 5303f9ecf..73c592a5a 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java
@@ -81,13 +81,13 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
/**
* This test verifies that content updates are still being performed.
*/
- public void testRefreshStruct() {
+ public void testRefreshStruct() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -98,7 +98,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -113,14 +113,14 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(elementPath, element, -1, true, false);
model.postDelta(delta);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
/**
* This test verifies that expand and select updates are being ignored.
*/
- public void testExpandAndSelect() {
+ public void testExpandAndSelect() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
// Create the listener
@@ -128,7 +128,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Create the delta
@@ -161,7 +161,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
break;
}
}
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -180,7 +180,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
- public void testPreserveExpandedOnSubTreeContent() {
+ public void testPreserveExpandedOnSubTreeContent() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -192,7 +192,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Turn off auto-expansion
@@ -218,7 +218,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Post the sub-tree update
model.postDelta(rootDelta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java
index 18b5daee9..3c70b8a45 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java
@@ -70,7 +70,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
private static class SelectionListener implements ISelectionChangedListener {
@@ -81,12 +81,12 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
}
}
- private TestModel makeMultiLevelModel() {
+ private TestModel makeMultiLevelModel() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
fViewer.setAutoExpandLevel(-1);
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
return model;
}
@@ -97,7 +97,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
* - verify that selection chagned listener is called
* - verify that the selection is in the viewer is correct
*/
- public void testSimpleSetSelection() {
+ public void testSimpleSetSelection() throws InterruptedException {
// Create the model and populate the view.
TestModel model = makeMultiLevelModel();
@@ -120,7 +120,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
* from being set and verify that a FORCE flag can override the selection
* policy.
*/
- public void testSelectionPolicy() {
+ public void testSelectionPolicy() throws InterruptedException {
// Create the model and populate the view.
final TestModel model = makeMultiLevelModel();
@@ -165,7 +165,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
delta_3_3_3.setFlags(IModelDelta.SELECT);
fViewer.updateViewer(baseDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
assertEquals(selection_3_3_1, fViewer.getSelection());
// Add the *force* flag to the selection delta and update viewer again.
@@ -173,7 +173,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
delta_3_3_3.setFlags(IModelDelta.SELECT | IModelDelta.FORCE);
fViewer.updateViewer(baseDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
assertEquals(selection_3_3_3, fViewer.getSelection());
}
@@ -185,7 +185,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
* - update the view with remove delta
* -> The selection should be re-set to empty.
*/
- public void testSelectRemove() {
+ public void testSelectRemove() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
// Create the model and populate the view.
@@ -213,7 +213,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
fListener.reset();
model.postDelta(delta);
while (!fListener.isFinished(TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check to make sure the selection was made
//assertTrue(listener.fEvents.size() == 1);
@@ -231,7 +231,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
* - then refresh the view.
* -> The selection should be re-set to empty.
*/
- public void testSelectRemoveRefreshStruct() {
+ public void testSelectRemoveRefreshStruct() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
// Create the model and populate the view.
@@ -261,7 +261,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// Refresh the viewer
model.postDelta( new ModelDelta(model.getRootElement(), IModelDelta.CONTENT) );
while (!fListener.isFinished(TestModelUpdatesListener.ALL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check to make sure the selection was made
// Commented out until JFace bug 219887 is fixed.
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
index b659716f6..3828e03c2 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
@@ -69,13 +69,13 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception, InterruptedException {
fListener.dispose();
fViewer.getPresentationContext().dispose();
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
protected void runTest() throws Throwable {
@@ -90,7 +90,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
return (ITreeModelContentProviderTarget)fViewer;
}
- public void testUpdateViewer() {
+ public void testUpdateViewer() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -103,7 +103,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Create the update delta
@@ -139,7 +139,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fViewer.updateViewer(updateDelta);
while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Extract the new state from viewer
ModelDelta savedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -217,7 +217,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
return sel1Set.equals(sel2Set);
}
- private void expandAlternateElements(TestModel model, boolean waitForAllUpdates) {
+ private void expandAlternateElements(TestModel model, boolean waitForAllUpdates) throws InterruptedException {
fListener.reset();
fListener.setFailOnRedundantUpdates(false);
@@ -248,10 +248,10 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
model.postDelta(rootDelta);
while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
- public void testPreserveExpandedOnRemove() {
+ public void testPreserveExpandedOnRemove() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -262,7 +262,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(model, true);
@@ -278,7 +278,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset();
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -292,7 +292,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
Assert.assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
- public void testPreserveExpandedOnInsert() {
+ public void testPreserveExpandedOnInsert() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -303,7 +303,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(model, true);
@@ -322,7 +322,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addChildreUpdate(TreePath.EMPTY, 0);
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -338,7 +338,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
Assert.assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
- public void testPreserveExpandedOnMultLevelContent() {
+ public void testPreserveExpandedOnMultLevelContent() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -349,7 +349,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(model, true);
@@ -376,7 +376,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Post the multi-content update delta
model.postDelta(rootDelta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -391,7 +391,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
}
- public void testPreserveExpandedOnSubTreeContent() {
+ public void testPreserveExpandedOnSubTreeContent() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -403,7 +403,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Turn off auto-expansion
@@ -429,7 +429,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Post the sub-tree update
model.postDelta(rootDelta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -442,7 +442,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
Assert.assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
- public void _X_testPreserveExpandedOnContentStress() {
+ public void _X_testPreserveExpandedOnContentStress() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -453,7 +453,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(model, true);
@@ -476,7 +476,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addUpdates(getCTargetViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -497,7 +497,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addUpdates(getCTargetViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -512,7 +512,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
}
}
- public void _X_testPreserveLargeModelOnContent() {
+ public void _X_testPreserveLargeModelOnContent() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(100);
@@ -523,7 +523,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(model, false);
@@ -539,7 +539,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("2")) == false);
@@ -557,7 +557,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("2")) == false);
@@ -575,7 +575,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
* following a content refresh, the state restore logic will
* not override the selection requested by the model.
*/
- public void testPreserveSelectionDeltaAfterContent() {
+ public void testPreserveSelectionDeltaAfterContent() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -587,7 +587,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Set a selection in view
@@ -600,7 +600,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Update the viewer with new selection delta to something new in the view
ModelDelta selectDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.SELECT);
@@ -609,18 +609,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.resetModelChanged();
model.postDelta(selectDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Wait for all the updates to complete (note: we're not resetting the listener.
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check to make sure that the state restore didn't change the selection.
Assert.assertEquals(new TreeSelection(model.findElement("2.1")), fViewer.getSelection());
}
- public void testPreserveCollapseDeltaAfterContent() {
+ public void testPreserveCollapseDeltaAfterContent() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -632,7 +632,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Turn off auto-expand
@@ -645,7 +645,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Update the viewer to collapse an element
ModelDelta collapseDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.COLLAPSE);
@@ -667,18 +667,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Wait for the second model delta to process
model.postDelta(collapseDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Wait for all the updates to complete (note: we're not resetting the listener.
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check to make sure that the state restore didn't change the selection.
Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == false);
}
- public void testPreserveExpandDeltaAfterContent() {
+ public void testPreserveExpandDeltaAfterContent() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -689,7 +689,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Reset the listener (ignore redundant updates)
@@ -699,7 +699,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Update the viewer to expand an element
ModelDelta expandDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.EXPAND);
@@ -708,19 +708,19 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.resetModelChanged();
model.postDelta(expandDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Wait for all the updates to complete (note: we're not resetting the listener.
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check to make sure that the state restore didn't change the selection.
Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
}
- public void testSaveAndRestore1() {
+ public void testSaveAndRestore1() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -731,7 +731,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
// Expand some, but not all elements
@@ -749,7 +749,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set the viewer input back to the model. When view updates are complete
// the viewer
@@ -757,7 +757,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
// TODO: add state updates somehow?
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Extract the restored state from viewer
ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -768,7 +768,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
}
}
- public void testSaveAndRestore2() {
+ public void testSaveAndRestore2() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -780,7 +780,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Set a selection in view
@@ -800,7 +800,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fViewer.setInput(null);
while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set the viewer input back to the model. When view updates are complete
// the viewer
@@ -808,7 +808,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
// TODO: add state updates somehow?
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Extract the restored state from viewer
ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -820,7 +820,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
}
- public void testSaveAndRestoreLarge() {
+ public void testSaveAndRestoreLarge() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(100);
@@ -831,7 +831,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
expandAlternateElements(model, false);
@@ -850,14 +850,14 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fViewer.setInput(null);
while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set the viewer input back to the model. When view updates are complete
// the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset();
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data (only select visible elements).
Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("1")) == true);
@@ -877,7 +877,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
* to contain much fewer elements. The restore logic should discard the
* rest of the saved state delta once all the elements are visible.
*/
- public void testSaveAndRestorePartialStateLarge() {
+ public void testSaveAndRestorePartialStateLarge() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(100);
@@ -888,7 +888,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
expandAlternateElements(model, false);
@@ -907,7 +907,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fViewer.setInput(null);
while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
TestElement[] elements = model.getRootElement().getChildren();
@@ -922,7 +922,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fViewer.setInput(model.getRootElement());
// MONITOR FOR THE STATE RESTORE TO COMPLETE
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE| STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE| STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Validate data
Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("1")) == true);
@@ -937,7 +937,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
Assert.assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
- public void testPreserveCollapseAndSelectDeltaAfterSaveAndRestore() {
+ public void testPreserveCollapseAndSelectDeltaAfterSaveAndRestore() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -949,7 +949,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY, true);
fViewer.setSelection(new TreeSelection(model.findElement("3")));
@@ -961,7 +961,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(false, false);
fViewer.setInput(null);
while (!fListener.isFinished(STATE_SAVE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Set the viewer input back to the model. When view updates are complete
// the viewer
@@ -975,27 +975,27 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Wait till we restore state of elements we want to collapse and select
while (!fListener.isFinished(STATE_RESTORE_STARTED | STATE_UPDATES | CHILDREN_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Post first collapse delta
model.postDelta(model.makeElementDelta(model.findElement("2"), IModelDelta.COLLAPSE));
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Post second collapse delta
fListener.resetModelChanged();
model.postDelta(model.makeElementDelta(model.findElement("3"), IModelDelta.COLLAPSE));
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Post select delta
model.postDelta(model.makeElementDelta(model.findElement("1"), IModelDelta.SELECT));
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Wait for all the updates to complete (note: we're not resetting the listener).
while (!fListener.isFinished(STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Check to make sure that the state restore didn't change the selection.
Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("2")) == false);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
index 293cf05ff..1044f62d1 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
@@ -66,7 +66,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
protected void runTest() throws Throwable {
@@ -83,7 +83,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
* - replaces the list of elements with a shorter list of elements
* - refreshes the viewer
*/
- public void testRemoveElements() {
+ public void testRemoveElements() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -92,7 +92,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -112,7 +112,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fListener.reset(rootPath, root, -1, false, false);
model.postDelta(new ModelDelta(root, IModelDelta.CONTENT));
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -122,7 +122,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
* - sets a list of children to one of the elements
* - refreshes the viewer
*/
- public void testAddNewChildren() {
+ public void testAddNewChildren() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -131,7 +131,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -153,26 +153,26 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Refresh the viewer
model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
- private void removeElement(TestModel model, int index, boolean validate) {
+ private void removeElement(TestModel model, int index, boolean validate) throws InterruptedException {
ModelDelta delta = model.removeElementChild(TreePath.EMPTY, index);
// Remove delta should generate no new updates, but we still need to wait for the event to
// be processed.
fListener.reset();
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
if (validate) {
model.validateData(fViewer, TreePath.EMPTY);
}
}
- private void addElement(TestModel model, String label, int position, boolean validate) {
+ private void addElement(TestModel model, String label, int position, boolean validate) throws InterruptedException {
ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, position, new TestElement(model, label, new TestElement[0]));
// Remove delta should generate no new updates, but we still need to wait for the event to
@@ -182,14 +182,14 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
if (validate) {
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_UPDATES_COMPLETE | LABEL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
} else {
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
}
- private void insertElement(TestModel model, String label, int position, boolean validate) {
+ private void insertElement(TestModel model, String label, int position, boolean validate) throws InterruptedException {
ModelDelta delta = model.insertElementChild(TreePath.EMPTY, position, new TestElement(model, label, new TestElement[0]));
// Remove delta should generate no new updates, but we still need to wait for the event to
@@ -199,14 +199,14 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
if (validate) {
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_UPDATES_COMPLETE | LABEL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
} else {
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
}
- public void testRepeatedAddRemoveElement() {
+ public void testRepeatedAddRemoveElement() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleSingleLevel();
@@ -217,7 +217,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -238,7 +238,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
* <br>
* See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
*/
- public void _X_testContentPlusAddRemoveUpdateRaceConditionsElement() {
+ public void _X_testContentPlusAddRemoveUpdateRaceConditionsElement() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -247,7 +247,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
// Create a listener to listen only to a children count update for the root.
@@ -261,7 +261,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
childrenCountUpdateListener.addChildreCountUpdate(TreePath.EMPTY);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
// Wait until the delta is processed
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
removeElement(model, 5, false);
removeElement(model, 4, false);
@@ -273,7 +273,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Wait until the children count update is completed using the count from
// before elements were removed.
while (!childrenCountUpdateListener.isFinished(CHILD_COUNT_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
insertElement(model, "1 - " + pass, 0, false);
insertElement(model, "2 - " + pass, 1, false);
@@ -283,7 +283,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
insertElement(model, "6 - " + pass, 5, false);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -297,7 +297,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
* due to a remove event from the model.
* @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#rescheduleUpdates
*/
- public void testRescheduleUpdates() {
+ public void testRescheduleUpdates() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -306,7 +306,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
model.validateData(fViewer, TreePath.EMPTY);
for (int i = 0; i < 5; i++) {
@@ -317,7 +317,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
// Wait for the delta to be processed.
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
// Update the model
removeElement(model, 0, true);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
index 7ff53f54c..e3b2ea827 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
@@ -67,7 +67,7 @@ public class VirtualViewerLazyModeTests extends TestCase {
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
public void test() {

Back to the top