Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 39194 Details for
Bug 127025
system thread filter loses selection/collapses on first invocation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
undo-model-changes.patch (text/plain), 17.99 KB, created by
Darin Wright
on 2006-04-21 13:54:34 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Darin Wright
Created:
2006-04-21 13:54:34 EDT
Size:
17.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java,v >retrieving revision 1.16 >diff -u -r1.16 AsynchronousTableViewer.java >--- ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java 21 Apr 2006 14:29:36 -0000 1.16 >+++ ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java 21 Apr 2006 17:42:42 -0000 >@@ -473,13 +473,17 @@ > } > } > >- /* (non-Javadoc) >- * @see org.eclipse.debug.internal.ui.viewers.AsynchronousViewer#clearChildren(org.eclipse.swt.widgets.Widget) >- */ >- protected void clearChildren(Widget item) { >- if (item instanceof Table) { >- fTable.clearAll(); >- } >+ public void nodeChanged(ModelNode node) { >+ Widget widget = findItem(node); >+ if (widget != null && !widget.isDisposed()) { >+ if (widget instanceof TableItem) { >+ clear(widget); >+ return; >+ } >+ widget.setData(node.getElement()); >+ internalRefresh(node); >+ } > } > >+ > } >Index: ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java,v >retrieving revision 1.46 >diff -u -r1.46 AsynchronousTreeViewer.java >--- ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java 21 Apr 2006 14:29:36 -0000 1.46 >+++ ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java 21 Apr 2006 17:42:42 -0000 >@@ -747,6 +747,28 @@ > return paths; > } > >+ /** >+ * Container status of a node changed >+ * >+ * @param node >+ */ >+ protected void nodeContainerChanged(ModelNode node) { >+ Widget widget = findItem(node); >+ if (widget != null && !widget.isDisposed()) { >+ boolean expanded = true; >+ if (node.isContainer() && getItemCount(widget) == 0) { >+ setItemCount(widget, 1); >+ } >+ if (widget instanceof TreeItem) { >+ expanded = ((TreeItem) widget).getExpanded(); >+ } >+ if (expanded) { >+ updateChildren(node); >+ } >+ } >+ attemptPendingUpdates(); >+ } >+ > protected int getItemCount(Widget widget) { > if (widget instanceof TreeItem) { > return ((TreeItem) widget).getItemCount(); >@@ -848,18 +870,6 @@ > fTree.clearAll(true); > } > } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.internal.ui.viewers.AsynchronousViewer#clearChildren(org.eclipse.swt.widgets.Widget) >- */ >- protected void clearChildren(Widget widget) { >- if (widget instanceof TreeItem && !widget.isDisposed()) { >- TreeItem item = (TreeItem) widget; >- item.clearAll(true); >- } else { >- fTree.clearAll(true); >- } >- } > > /* > * (non-Javadoc) >@@ -1159,6 +1169,24 @@ > return new AsynchronousTreeModel(this); > } > >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.internal.ui.viewers.AsynchronousModelViewer#nodeChanged(org.eclipse.debug.internal.ui.viewers.ModelNode) >+ */ >+ public void nodeChanged(ModelNode node) { >+ Widget widget = findItem(node); >+ if (widget != null && !widget.isDisposed()) { >+ if (widget instanceof TreeItem) { >+ clear(widget); >+ return; >+ } >+ widget.setData(node.getElement()); >+ mapElement(node, widget); >+ internalRefresh(node); >+ attemptPendingUpdates(); >+ } >+ } >+ > /** > * Attempt pending udpates. Subclasses may override but should call super. > */ >@@ -1494,26 +1522,6 @@ > } > return bool.booleanValue(); > } >- >- /** >- * Notification the container status of a node has changed/been computed. >- * >- * @param node >- */ >- protected void nodeContainerChanged(ModelNode node) { >- Widget widget = findItem(node); >- if (widget != null && !widget.isDisposed()) { >- if (node.isContainer()) { >- if (widget instanceof TreeItem) { >- if (((TreeItem)widget).getExpanded()) { >- updateChildren(node); >- } >- } else { >- updateChildren(node); >- } >- attemptPendingUpdates(); >- } >- } >- } >+ > > } >Index: ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java,v >retrieving revision 1.36 >diff -u -r1.36 AsynchronousViewer.java >--- ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java 21 Apr 2006 14:29:36 -0000 1.36 >+++ ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java 21 Apr 2006 17:42:43 -0000 >@@ -113,6 +113,16 @@ > > protected static final String OLD_LABEL = "old_label"; //$NON-NLS-1$ > protected static final String OLD_IMAGE = "old_image"; //$NON-NLS-1$ >+ >+ /** >+ * Map of parent nodes for which children were needed to "set data" >+ * in the virtual widget. A parent is added to this map when we try go >+ * get children but they aren't there yet. The children are retrieved >+ * asynchronously, and later put back into the widgetry. >+ * The value is an array of ints of the indicies of the children that >+ * were requested. >+ */ >+ private Map fParentsPendingChildren = new HashMap(); > > /** > * Creates a new viewer >@@ -228,6 +238,7 @@ > * @see org.eclipse.jface.viewers.Viewer#inputChanged(java.lang.Object, java.lang.Object) > */ > protected synchronized void inputChanged(Object input, Object oldInput) { >+ fParentsPendingChildren.clear(); > if (fUpdatePolicy == null) { > fUpdatePolicy = createUpdatePolicy(); > fUpdatePolicy.init(this); >@@ -834,6 +845,22 @@ > widget.dispose(); > } > } >+ >+ /** >+ * Unmaps the node from its widget and all of its children nodes from >+ * their widgets. >+ * >+ * @param node >+ */ >+ protected void unmapNode(ModelNode node) { >+ unmapElement(node); >+ ModelNode[] childrenNodes = node.getChildrenNodes(); >+ if (childrenNodes != null) { >+ for (int i = 0; i < childrenNodes.length; i++) { >+ unmapNode(childrenNodes[i]); >+ } >+ } >+ } > > /** > * A node in the model has been updated >@@ -843,8 +870,8 @@ > protected void nodeChanged(ModelNode node) { > Widget widget = findItem(node); > if (widget != null) { >- clear(widget); >- attemptPendingUpdates(); >+ widget.setData(node.getElement()); >+ internalRefresh(node); > } > } > >@@ -865,18 +892,38 @@ > } > > /** >- * Clears the given widget >+ * Called when nodes are set in the model. The children may not have been >+ * retrieved yet when the tree got the call to "set data". > * >- * @param item >+ * @param parent >+ * @param children > */ >+ protected void nodeChildrenSet(ModelNode parent, ModelNode[] children) { >+ int[] indicies = removePendingChildren(parent); >+ Widget widget = findItem(parent); >+ if (widget != null && !widget.isDisposed()) { >+ if (indicies != null) { >+ for (int i = 0; i < indicies.length; i++) { >+ int index = indicies[i]; >+ Widget item = getChildWidget(widget, index); >+ if (item != null) { >+ if (index < children.length) { >+ ModelNode childNode = children[index]; >+ mapElement(childNode, item); >+ item.setData(childNode.getElement()); >+ internalRefresh(childNode); >+ } >+ } >+ } >+ setItemCount(widget, children.length); >+ } else { >+ setItemCount(widget, children.length); >+ } >+ } >+ attemptPendingUpdates(); >+ } >+ > protected abstract void clear(Widget item); >- >- /** >- * Clears the children of the widget. >- * >- * @param item >- */ >- protected abstract void clearChildren(Widget item); > > /** > * Returns the child widet at the given index for the given parent or >@@ -902,36 +949,22 @@ > protected void attemptPendingUpdates() { > attemptSelection(false); > } >- >+ > /** >- * Notification a node's children have changed. >- * Updates the child count for the parent's widget >- * and clears children to be updated. >+ * The children of a node have changed. > * >- * @param parentNode >+ * @param parent > */ > protected void nodeChildrenChanged(ModelNode parentNode) { >- Widget widget = findItem(parentNode); >- if (widget != null && !widget.isDisposed()) { >- int childCount = parentNode.getChildCount(); >- clearChildren(widget); >- setItemCount(widget, childCount); >- attemptPendingUpdates(); >- } >- } >- >- /** >- * Unmaps the node from its widget and all of its children nodes from >- * their widgets. >- * >- * @param node >- */ >- protected void unmapNode(ModelNode node) { >- unmapElement(node); >- ModelNode[] childrenNodes = node.getChildrenNodes(); >+ ModelNode[] childrenNodes = parentNode.getChildrenNodes(); > if (childrenNodes != null) { >- for (int i = 0; i < childrenNodes.length; i++) { >- unmapNode(childrenNodes[i]); >+ nodeChildrenSet(parentNode, childrenNodes); >+ } else { >+ Widget widget = findItem(parentNode); >+ if (widget != null && !widget.isDisposed()) { >+ int childCount = parentNode.getChildCount(); >+ setItemCount(widget, childCount); >+ attemptPendingUpdates(); > } > } > } >@@ -964,6 +997,38 @@ > return findItem((Object)node); > } > >+ /** >+ * Note that the child at the specified index was requested by a widget >+ * when revealed but that the data was not in the model yet. When the data >+ * becomes available, map it to its widget. >+ * >+ * @param parent >+ * @param index >+ */ >+ protected synchronized void addPendingChildIndex(ModelNode parent, int index) { >+ int[] indicies = (int[]) fParentsPendingChildren.get(parent); >+ if (indicies == null) { >+ indicies = new int[]{index}; >+ } else { >+ int[] next = new int[indicies.length + 1]; >+ System.arraycopy(indicies, 0, next, 0, indicies.length); >+ next[indicies.length] = index; >+ indicies = next; >+ } >+ fParentsPendingChildren.put(parent, indicies); >+ } >+ >+ /** >+ * Removes and returns and children indicies that were pending for the given >+ * parent node. May return <code>null</code>. >+ * >+ * @param parent >+ * @return indicies of children that data were requested for or <code>null</code> >+ */ >+ protected int[] removePendingChildren(ModelNode parent) { >+ return (int[]) fParentsPendingChildren.remove(parent); >+ } >+ > /* > * (non-Javadoc) > * >@@ -994,7 +1059,9 @@ > internalRefresh(child); > } > }); >- } >+ } else { >+ addPendingChildIndex(node, index); >+ } > return; > } > } >Index: ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeModel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeModel.java,v >retrieving revision 1.2 >diff -u -r1.2 AsynchronousTreeModel.java >--- ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeModel.java 21 Apr 2006 14:29:36 -0000 1.2 >+++ ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeModel.java 21 Apr 2006 17:42:42 -0000 >@@ -139,6 +139,7 @@ > preservingSelection(new Runnable() { > public void run() { > viewer.nodeDisposed(node); >+ viewer.nodeChildrenChanged(parentNode); > } > }); > } >@@ -239,7 +240,7 @@ > * @param node > * @param containsChildren > */ >- void setIsContainer(final ModelNode node, boolean containsChildren) { >+ void setIsContainer(ModelNode node, boolean containsChildren) { > ModelNode[] prevChildren = null; > synchronized (this) { > prevChildren = node.getChildrenNodes(); >@@ -254,12 +255,20 @@ > } > } > // update tree outside lock >- preservingSelection(new Runnable() { >- public void run() { >- getViewer().nodeChildrenChanged(node); >- getTreeViewer().nodeContainerChanged(node); >- } >- }); >- >+ AsynchronousTreeViewer viewer = getTreeViewer(); >+ if (containsChildren) { >+ if (prevChildren == null) { >+ viewer.nodeChildrenChanged(node); >+ viewer.nodeContainerChanged(node); >+ } else { >+ viewer.nodeContainerChanged(node); >+ } >+ } else if (!containsChildren && prevChildren != null) { >+ for (int i = 0; i < prevChildren.length; i++) { >+ ModelNode child = prevChildren[i]; >+ viewer.nodeDisposed(child); >+ } >+ viewer.nodeChildrenChanged(node); >+ } > } > } >Index: ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java,v >retrieving revision 1.2 >diff -u -r1.2 AsynchronousModel.java >--- ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java 21 Apr 2006 14:29:36 -0000 1.2 >+++ ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java 21 Apr 2006 17:42:42 -0000 >@@ -475,7 +475,6 @@ > > ModelNode[] prevKids = null; > ModelNode[] newChildren = null; >- ModelNode[] unmap = null; > > synchronized (this) { > if (isDisposed()) { >@@ -491,49 +490,55 @@ > } > parentNode.setChildren(newChildren); > } else { >- newChildren = new ModelNode[children.length]; >- unmap = new ModelNode[prevKids.length]; >- for (int i = 0; i < prevKids.length; i++) { >- unmap[i] = prevKids[i]; >- } >- for (int i = 0; i < children.length; i++) { >- Object child = children[i]; >- boolean found = false; >- for (int j = 0; j < prevKids.length; j++) { >- ModelNode prevKid = prevKids[j]; >- if (prevKid != null && child.equals(prevKid.getElement())) { >- newChildren[i] = prevKid; >- prevKids[j] = null; >- found = true; >- break; >- } >- } >- if (!found) { >- newChildren[i] = new ModelNode(parentNode, child); >- mapElement(child, newChildren[i]); >- } >- } >- for (int i = 0; i < prevKids.length; i++) { >- ModelNode kid = prevKids[i]; >- if (kid != null) { >- kid.dispose(); >- unmapNode(kid); >- } >- } >- parentNode.setChildren(newChildren); >+ for (int i = 0; i < prevKids.length; i++) { >+ ModelNode kid = prevKids[i]; >+ if (i >= children.length) { >+ kid.dispose(); >+ unmapNode(kid); >+ } else { >+ ModelNode prevNode = prevKids[i]; >+ Object nextChild = children[i]; >+ if (!prevNode.getElement().equals(nextChild)) { >+ unmapNode(prevNode); >+ } >+ mapElement(nextChild, prevNode); >+ } >+ } >+ // create new children >+ if (children.length > prevKids.length) { >+ newChildren = new ModelNode[children.length]; >+ System.arraycopy(prevKids, 0, newChildren, 0, prevKids.length); >+ for (int i = prevKids.length; i < children.length; i ++) { >+ Object child = children[i]; >+ ModelNode childNode = new ModelNode(parentNode, child); >+ mapElement(child, childNode); >+ newChildren[i] = childNode; >+ } >+ parentNode.setChildren(newChildren); >+ } >+ if (children.length < prevKids.length) { >+ newChildren = new ModelNode[children.length]; >+ System.arraycopy(prevKids, 0, newChildren, 0, children.length); >+ parentNode.setChildren(newChildren); >+ } > } > } > > //update viewer outside the lock >- final ModelNode[] finalUnmap = unmap; >+ final ModelNode[] finalPrevKids = prevKids; > preservingSelection(new Runnable() { > public void run() { >- if (finalUnmap != null) { >- for (int i = 0; i < finalUnmap.length; i++) { >- viewer.unmapNode(finalUnmap[i]); >- } >+ if (finalPrevKids != null) { >+ for (int i = 0; i < finalPrevKids.length; i++) { >+ ModelNode kid = finalPrevKids[i]; >+ if (i >= children.length) { >+ viewer.nodeDisposed(kid); >+ } else { >+ viewer.nodeChanged(kid); >+ } >+ } > } >- viewer.nodeChildrenChanged(parentNode); >+ viewer.nodeChildrenChanged(parentNode); > } > }); > >Index: ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java,v >retrieving revision 1.12 >diff -u -r1.12 AsyncVirtualContentTableViewer.java >--- ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java 21 Apr 2006 14:29:36 -0000 1.12 >+++ ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java 21 Apr 2006 17:42:43 -0000 >@@ -488,8 +488,11 @@ > // is causing the table viewer to not scroll or move cursor properly. > // #interalRefresh on a child will never cause a structural > // change in a table viewer. As a result, there is no need to preserve selection >- internalRefresh(child); >- } >+ internalRefresh(child); >+ >+ } else { >+ addPendingChildIndex(node, index); >+ } > return; > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 127025
:
39118
| 39194 |
39201
|
39227
|
39265
|
39347