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 37438 Details for
Bug 119025
Selection and detail string in Variables view lost if label changed
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]
work in progress
expansion.patch (text/plain), 8.23 KB, created by
Darin Wright
on 2006-03-31 16:59:26 EST
(
hide
)
Description:
work in progress
Filename:
MIME Type:
Creator:
Darin Wright
Created:
2006-03-31 16:59:26 EST
Size:
8.23 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java,v >retrieving revision 1.19 >diff -u -r1.19 ViewerState.java >--- ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java 2 Mar 2006 17:26:42 -0000 1.19 >+++ ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java 31 Mar 2006 21:53:11 -0000 >@@ -30,6 +30,9 @@ > */ > public class ViewerState extends AbstractViewerState { > >+ public ViewerState() { >+ } >+ > /** > * Constructs a memento for the given viewer. > */ >@@ -41,12 +44,18 @@ > * @see org.eclipse.debug.internal.ui.views.AbstractViewerState#encodeElement(org.eclipse.swt.widgets.TreeItem) > */ > protected IPath encodeElement(TreeItem item) throws DebugException { >- StringBuffer path = new StringBuffer(item.getText()); >+ StringBuffer path = new StringBuffer(); > TreeItem parent = item.getParentItem(); > while (parent != null) { >- path.insert(0, parent.getText()+'/'); >- parent = parent.getParentItem(); >+ int i = parent.indexOf(item); >+ path.insert(0, i); >+ path.insert(0, '/'); >+ item = parent; >+ parent = item.getParentItem(); > } >+ Tree tree = item.getParent(); >+ int i = tree.indexOf(item); >+ path.insert(0, i); > return new Path(path.toString()); > } > >@@ -55,40 +64,51 @@ > * org.eclipse.jface.viewers.TreeViewer) > */ > protected TreePath decodePath(IPath path, AsynchronousTreeViewer viewer) throws DebugException { >- String[] names = path.segments(); >+ String[] indicies = path.segments(); > Tree tree = viewer.getTree(); >- TreeItem[] items = tree.getItems(); >+ int index = -1; >+ try { >+ index = Integer.parseInt(indicies[0]); >+ } catch (NumberFormatException e) { >+ return null; >+ } >+ TreeItem item = null; >+ if (index < tree.getItemCount()) { >+ item = tree.getItem(index); >+ } else { >+ return null; >+ } > > List elements = new ArrayList(); > elements.add(viewer.getInput()); >- >- boolean pathFound = false; >- >- for (int i = 0; i < names.length; i++) { >- String name = names[i]; >- TreeItem item = findItem(name, items); >- if (item != null) { >- pathFound = true; >- elements.add(item.getData()); >- items = item.getItems(); >- } >+ Object element = item.getData(); >+ if (element != null) { >+ elements.add(element); >+ } else { >+ return null; > } > >- if (pathFound) { >- return new TreePath(elements.toArray()); >+ for (int i = 1; i < indicies.length; i++) { >+ try { >+ index = Integer.parseInt(indicies[i]); >+ } catch (NumberFormatException e) { >+ return null; >+ } >+ if (index < item.getItemCount()) { >+ item = item.getItem(index); >+ } else { >+ return null; >+ } >+ element = item.getData(); >+ if (element != null) { >+ elements.add(element); >+ } else { >+ return null; >+ } > } > >- return null; >+ return new TreePath(elements.toArray()); > } > >- private TreeItem findItem(String name, TreeItem[] items) { >- for (int i = 0; i < items.length; i++) { >- TreeItem item = items[i]; >- if (item.getText().equals(name)) { >- return item; >- } >- } >- return null; >- } > > } >Index: ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java,v >retrieving revision 1.130 >diff -u -r1.130 VariablesView.java >--- ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java 13 Mar 2006 20:41:03 -0000 1.130 >+++ ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java 31 Mar 2006 21:53:11 -0000 >@@ -478,7 +478,9 @@ > if (state == null) { > // attempt to restore selection/expansion based on last > // frame >- state = fLastState; >+ if (fLastState != null) { >+ state = (AbstractViewerState) fLastState.clone(); >+ } > } > if (state != null) { > state.restoreState(viewer); >Index: ui/org/eclipse/debug/internal/ui/views/AbstractViewerState.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/AbstractViewerState.java,v >retrieving revision 1.15 >diff -u -r1.15 AbstractViewerState.java >--- ui/org/eclipse/debug/internal/ui/views/AbstractViewerState.java 2 Mar 2006 17:26:42 -0000 1.15 >+++ ui/org/eclipse/debug/internal/ui/views/AbstractViewerState.java 31 Mar 2006 21:53:10 -0000 >@@ -11,9 +11,11 @@ > package org.eclipse.debug.internal.ui.views; > > import java.util.ArrayList; >+import java.util.Iterator; > import java.util.List; > > import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Path; > import org.eclipse.debug.core.DebugException; > import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer; > import org.eclipse.jface.viewers.TreePath; >@@ -24,12 +26,15 @@ > * The abstract superclass for mementos of the expanded and > * selected items in a tree viewer. > */ >-public abstract class AbstractViewerState { >+public abstract class AbstractViewerState implements Cloneable { > > // paths to expanded elements > private List fSavedExpansion = null; > private IPath[] fSelection; > >+ public AbstractViewerState() { >+ } >+ > /** > * Constructs a memento for the given viewer. > */ >@@ -178,4 +183,33 @@ > */ > protected abstract TreePath decodePath(IPath path, AsynchronousTreeViewer viewer) throws DebugException; > >-} >+ /* (non-Javadoc) >+ * @see java.lang.Object#clone() >+ */ >+ public Object clone() { >+ AbstractViewerState clone = null; >+ try { >+ clone = (AbstractViewerState) this.getClass().newInstance(); >+ } catch (InstantiationException e) { >+ return null; >+ } catch (IllegalAccessException e) { >+ return null; >+ } >+ if (fSavedExpansion != null) { >+ clone.fSavedExpansion = new ArrayList(fSavedExpansion.size()); >+ Iterator iterator = fSavedExpansion.iterator(); >+ while (iterator.hasNext()) { >+ IPath path = (IPath) iterator.next(); >+ IPath clonePath = Path.fromPortableString(path.toPortableString()); >+ clone.fSavedExpansion.add(clonePath); >+ } >+ } >+ if (fSelection != null) { >+ clone.fSelection = new IPath[fSelection.length]; >+ for (int i = 0; i < fSelection.length; i++) { >+ clone.fSelection[i] = Path.fromPortableString(fSelection[i].toPortableString()); >+ } >+ } >+ return clone; >+ } >+} >\ No newline at end of file >Index: ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java,v >retrieving revision 1.34 >diff -u -r1.34 MemoryBlocksTreeViewPane.java >--- ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java 15 Mar 2006 22:54:45 -0000 1.34 >+++ ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java 31 Mar 2006 21:53:10 -0000 >@@ -243,10 +243,12 @@ > } > } > >- class MemoryViewerState extends ViewerState >+ class MemoryViewerState extends ViewerState implements Cloneable > { > private Hashtable fPathMap = new Hashtable(); > private AsynchronousTreeViewer fViewer; >+ >+ public MemoryViewerState() {} > public MemoryViewerState(AsynchronousTreeViewer viewer) { > super(viewer); > fViewer = viewer; >@@ -270,6 +272,16 @@ > protected TreePath decodePath(IPath path, AsynchronousTreeViewer viewer) throws DebugException { > return (TreePath)fPathMap.get(path); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.internal.ui.views.AbstractViewerState#clone() >+ */ >+ public Object clone() { >+ MemoryViewerState clone = (MemoryViewerState) super.clone(); >+ clone.fViewer = fViewer; >+ clone.fPathMap = fPathMap; >+ return clone; >+ } > } > > class TreeViewPaneContextListener implements IDebugContextListener
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 119025
: 37438