Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-04-09 17:57:57 +0000
committerPawel Piech2012-04-09 17:57:57 +0000
commitd8d9bfa70f875a276bd38beba92329bfa1c872c5 (patch)
tree43d44e6754c01ea0d6d8a8cdfd38398627e03729
parentb5b70dd28365c6c1d984a5842c601e788bcf65cf (diff)
downloadeclipse.platform.debug-I20120411-2034.tar.gz
eclipse.platform.debug-I20120411-2034.tar.xz
eclipse.platform.debug-I20120411-2034.zip
Fixed busy state in variables view when switching frames rapidly.
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java2
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java76
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java15
3 files changed, 87 insertions, 6 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
index ff39eba06..c284880a2 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
@@ -432,7 +432,7 @@ public class TestModelUpdatesListener
public boolean isFinished(int flags) {
if (isTimedOut()) {
- throw new RuntimeException("Timed Out: " + toString(flags));
+ throw new RuntimeException("Timed Out: " + toString(flags));
}
if (fFailExpectation != null) {
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 4c365bca9..97de6f915 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
@@ -534,7 +534,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
* </p>
* @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#rescheduleUpdates
*/
- public void testCancelUpdates5() throws InterruptedException {
+ public void testCancelUpdatesOnRemoveElementWhileUpdatingSubTree() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
fViewer.setAutoExpandLevel(-1);
@@ -563,6 +563,80 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
}
+ /**
+ * This test forces the viewer to cancel updates upon setInput().
+ * <p>
+ * - Wait until CHILDREN update started then refresh<br>
+ * - Process queued updates in order.<br>
+ * </p>
+ */
+ public void testCanceledUpdatesOnSetInput() throws InterruptedException {
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
+
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ model.validateData(fViewer, TreePath.EMPTY);
+
+ model.setQeueueingUpdate(false);
+
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ fListener.addChildreCountUpdate(TreePath.EMPTY);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+
+ // Wait for the delta to be processed.
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES))
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+
+ TestModel model2 = new TestModel();
+ model2.setRoot(new TestElement(model2, "root", new TestElement[0]));
+ fViewer.setInput(model2.getRootElement());
+
+ while (!fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+
+ }
+
+ /**
+ * This test forces the viewer to cancel updates upon setInput().
+ * <p>
+ * - Wait until CHILDREN update started then refresh<br>
+ * - Process queued updates in order.<br>
+ * </p>
+ */
+ public void testCanceledUpdatesOnSetNullInput() throws InterruptedException {
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
+
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ model.validateData(fViewer, TreePath.EMPTY);
+
+ model.setQeueueingUpdate(false);
+
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ fListener.addChildreCountUpdate(TreePath.EMPTY);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+
+ // Wait for the delta to be processed.
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES))
+ if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+
+ fViewer.setInput(null);
+
+ while (!fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+
+ }
+
private void completeQueuedUpdatesOfType(TestModel model, Class updateClass) {
List updatesToComplete = new LinkedList();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
index 386fe8c38..20057d563 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
@@ -104,6 +104,12 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
private ListenerList fUpdateListeners = new ListenerList();
/**
+ * Flag indicating whether we are currently in a model sequence.
+ * @see IViewerUpdateListener
+ */
+ private boolean fModelSequenceRunning = false;
+
+ /**
* Map of updates in progress: element path -> list of requests
*/
private Map fRequestsInProgress = new HashMap();
@@ -194,7 +200,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
if (newInput != null) {
installModelProxy(newInput, TreePath.EMPTY);
fStateTracker.restoreViewerState(newInput);
- }
+ }
}
public void addViewerUpdateListener(IViewerUpdateListener listener) {
@@ -579,14 +585,14 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
void updateStarted(ViewerUpdateMonitor update) {
Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- boolean begin = fRequestsInProgress.isEmpty();
List requests = (List) fRequestsInProgress.get(update.getSchedulingPath());
if (requests == null) {
requests = new ArrayList();
fRequestsInProgress.put(update.getSchedulingPath(), requests);
}
requests.add(update);
- if (begin) {
+ if (!fModelSequenceRunning) {
+ fModelSequenceRunning = true;
if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("MODEL SEQUENCE BEGINS"); //$NON-NLS-1$
}
@@ -647,7 +653,8 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
fRequestsInProgress.remove(update.getSchedulingPath());
}
}
- if (fRequestsInProgress.isEmpty() && fWaitingRequests.isEmpty()) {
+ if (fRequestsInProgress.isEmpty() && fWaitingRequests.isEmpty() && fModelSequenceRunning) {
+ fModelSequenceRunning = false;
if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("MODEL SEQUENCE ENDS"); //$NON-NLS-1$
}

Back to the top