Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2010-02-02 20:31:06 +0000
committerDarin Wright2010-02-02 20:31:06 +0000
commit1372ff6e62383837bc51acfe38aac16794c96312 (patch)
tree2d37300a82510a93812b4c85b0817bfa0e4e7f0f
parent2334bb969d1124a62e9cd9f4f2a428ef3f5a95a9 (diff)
downloadeclipse.platform.debug-1372ff6e62383837bc51acfe38aac16794c96312.tar.gz
eclipse.platform.debug-1372ff6e62383837bc51acfe38aac16794c96312.tar.xz
eclipse.platform.debug-1372ff6e62383837bc51acfe38aac16794c96312.zip
[r34x] back port Bug 212798 - Thread collapsed unexpectedly as threads are terminated
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java37
3 files changed, 64 insertions, 9 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java
index 2d9f89842..9900c092a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -56,10 +56,13 @@ public class ChildrenUpdate extends ViewerUpdateMonitor implements IChildrenUpda
int viewIndex = provider.modelToViewIndex(elementPath, modelIndex);
if (provider.shouldFilter(elementPath, element)) {
if (provider.addFilteredIndex(elementPath, modelIndex, element)) {
- if (ModelContentProvider.DEBUG_CONTENT_PROVIDER) {
- System.out.println("REMOVE(" + getElement() + ", modelIndex: " + modelIndex + " viewIndex: " + viewIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ if (viewer.getChildElement(elementPath, viewIndex) == null) {
+ // only remove the element if currently unmapped
+ if (ModelContentProvider.DEBUG_CONTENT_PROVIDER) {
+ System.out.println("REMOVE(" + getElement() + ", modelIndex: " + modelIndex + " viewIndex: " + viewIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ }
+ viewer.remove(elementPath, viewIndex);
}
- viewer.remove(elementPath, viewIndex);
}
} else {
if (provider.isFiltered(elementPath, modelIndex)) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
index 2cf5a345e..d99677a4e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1910,4 +1910,27 @@ public class InternalTreeModelViewer extends TreeViewer {
}
}
}
+
+ public Object getChildElement(TreePath path, int index) {
+ TreeItem childItem = null;
+ if (path.getSegmentCount() == 0) {
+ Tree tree = (Tree)getControl();
+ try {
+ childItem = tree.getItem(index);
+ } catch (IllegalArgumentException e) {}
+ } else {
+ try {
+ Widget[] items = internalFindItems(path);
+ if (items.length > 0) {
+ if (items[0] instanceof TreeItem) {
+ childItem = ((TreeItem)items[0]).getItem(index);
+ }
+ }
+ } catch (IllegalArgumentException e) {}
+ }
+ if (childItem != null) {
+ return childItem.getData();
+ }
+ return null;
+ }
}
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 e54077f5f..dbe8ee2f3 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -104,10 +104,39 @@ public class TreeModelContentProvider extends ModelContentProvider implements IL
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.viewers.ModelContentProvider#handleAdd(org.eclipse.debug.internal.ui.viewers.provisional.IModelDelta)
*/
protected void handleAdd(IModelDelta delta) {
- if (DEBUG_CONTENT_PROVIDER) {
- System.out.println("handleAdd(" + delta.getElement() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ IModelDelta parentDelta = delta.getParentDelta();
+ TreePath parentPath = getViewerTreePath(parentDelta);
+ Object element = delta.getElement();
+ int count = parentDelta.getChildCount();
+ if (count > 0) {
+ setModelChildCount(parentPath, count);
+ int viewCount = modelToViewChildCount(parentPath, count);
+ int modelIndex = count - 1;
+ int viewIndex = viewCount - 1;
+ if (shouldFilter(parentPath, element)) {
+ addFilteredIndex(parentPath, modelIndex, element);
+ if (DEBUG_CONTENT_PROVIDER) {
+ System.out.println("[filtered] handleAdd(" + delta.getElement() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ if (isFiltered(parentPath, modelIndex)) {
+ clearFilteredChild(parentPath, modelIndex);
+ }
+ if (DEBUG_CONTENT_PROVIDER) {
+ System.out.println("handleAdd(" + delta.getElement() + ") viewIndex: " + viewCount + " modelIndex: " + modelIndex); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ getTreeViewer().setChildCount(parentPath, viewCount);
+ getTreeViewer().replace(parentPath, viewIndex, element);
+ TreePath childPath = parentPath.createChildPath(element);
+ updateHasChildren(childPath);
+ doRestore(childPath, modelIndex, false, false);
+ }
+ } else {
+ if (DEBUG_CONTENT_PROVIDER) {
+ System.out.println("handleAdd(" + delta.getElement() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ doUpdateChildCount(getViewerTreePath(delta.getParentDelta()));
}
- doUpdateChildCount(getViewerTreePath(delta.getParentDelta()));
}
/* (non-Javadoc)

Back to the top