Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/RemoteTreeViewer.java')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/RemoteTreeViewer.java86
1 files changed, 44 insertions, 42 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/RemoteTreeViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/RemoteTreeViewer.java
index 7996c8470..6f4041f3e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/RemoteTreeViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/RemoteTreeViewer.java
@@ -305,56 +305,58 @@ public class RemoteTreeViewer extends TreeViewer {
Widget widget = findItem(parent);
if (widget != null) {
Item[] currentChildren = getChildren(widget);
- if (offset < currentChildren.length) {
- Object[] pruned = new Object[currentChildren.length - offset];
- System.arraycopy(currentChildren, offset, pruned, 0, pruned.length);
- remove(pruned);
+ for (int i = offset; i < currentChildren.length; i++) {
+ disassociate(currentChildren[i]);
+ currentChildren[i].dispose();
}
}
}
-
-
- public synchronized void replace(Object parent, Object[] children, int offset) {
- Widget widget = findItem(parent);
- if (widget == null) {
- add(parent, children);
- return;
- }
- Item[] currentChildren = getChildren(widget);
- if (offset >= currentChildren.length) {
- // append
- add(parent, children);
- } else {
- // replace
- for (int i = 0; i < children.length; i++) {
- Object child = children[i];
- if (offset < currentChildren.length) {
+ public synchronized void replace(final Object parent, final Object[] children, final int offset) {
+ preservingSelection(new Runnable() {
+ public void run() {
+ Widget widget = findItem(parent);
+ if (widget == null) {
+ add(parent, children);
+ return;
+ }
+ Item[] currentChildren = getChildren(widget);
+ int pos = offset;
+ if (pos >= currentChildren.length) {
+ // append
+ add(parent, children);
+ } else {
// replace
- Item item = currentChildren[offset];
- Object data = item.getData();
- if (!child.equals(data)) {
- associate(child, item);
- internalRefresh(item, child, true, true);
- } else {
- internalRefresh(item, child, false, true);
+ for (int i = 0; i < children.length; i++) {
+ Object child = children[i];
+ if (pos < currentChildren.length) {
+ // replace
+ Item item = currentChildren[pos];
+ Object data = item.getData();
+ if (!child.equals(data)) {
+ associate(child, item);
+ internalRefresh(item, child, true, true);
+ } else {
+ internalRefresh(item, child, false, true);
+ }
+ } else {
+ // add
+ int numLeft = children.length - i;
+ if (numLeft > 1) {
+ Object[] others = new Object[numLeft];
+ System.arraycopy(children, i, others, 0, numLeft);
+ add(parent, others);
+ } else {
+ add(parent, child);
+ }
+ return;
+ }
+ pos++;
}
- } else {
- // add
- int numLeft = children.length - i;
- if (numLeft > 1) {
- Object[] others = new Object[numLeft];
- System.arraycopy(children, i, others, 0, numLeft);
- add(parent, others);
- } else {
- add(parent, child);
- }
- return;
}
- offset++;
+ runDeferredUpdates();
}
- }
- runDeferredUpdates();
+ });
}
}

Back to the top