Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariablesViewElementMementoProvider.java37
2 files changed, 34 insertions, 26 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java
index 7ca49fe0c..7b73b489c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.ui.IMemento;
/**
@@ -31,10 +32,8 @@ public abstract class ElementMementoProvider implements IElementMementoProvider
public void compareElement(final IElementCompareRequest request) {
Job job = new Job("compare element") { //$NON-NLS-1$
protected IStatus run(IProgressMonitor monitor) {
- Object element = request.getElement();
- IMemento memento = request.getMemento();
try {
- request.setEqual(isEqual(element, memento));
+ request.setEqual(isEqual(request.getElement(), request.getMemento(), request.getPresentationContext()));
} catch (CoreException e) {
request.setStatus(e.getStatus());
}
@@ -50,11 +49,12 @@ public abstract class ElementMementoProvider implements IElementMementoProvider
/**
* Returns whether the memento represents the given element.
*
- * @param element
- * @param memento
+ * @param element the element to compare to the memento
+ * @param memento memento
+ * @param context the context the compare is in
* @return whether the memento represents the given element
*/
- protected abstract boolean isEqual(Object element, IMemento memento) throws CoreException;
+ protected abstract boolean isEqual(Object element, IMemento memento, IPresentationContext context) throws CoreException;
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#encodeElement(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest)
@@ -62,10 +62,8 @@ public abstract class ElementMementoProvider implements IElementMementoProvider
public void encodeElement(final IElementMementoRequest request) {
Job job = new Job("encode element") { //$NON-NLS-1$
protected IStatus run(IProgressMonitor monitor) {
- Object element = request.getElement();
- IMemento memento = request.getMemento();
try {
- if (!encodeElement(element, memento)) {
+ if (!encodeElement(request.getElement(), request.getMemento(), request.getPresentationContext())) {
request.setCanceled(true);
}
} catch (CoreException e) {
@@ -84,11 +82,12 @@ public abstract class ElementMementoProvider implements IElementMementoProvider
* Encodes the specified element into the given memento.
* Returns whether the element could be encoded
*
- * @param element
- * @param memento
+ * @param element the element to encode
+ * @param memento the memento to write to
+ * @param context presentation context
* @return false if cancelled/not supported
* @throws CoreException
*/
- protected abstract boolean encodeElement(Object element, IMemento memento) throws CoreException;
+ protected abstract boolean encodeElement(Object element, IMemento memento, IPresentationContext context) throws CoreException;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariablesViewElementMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariablesViewElementMementoProvider.java
index 9e51161e6..e9d5cd128 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariablesViewElementMementoProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariablesViewElementMementoProvider.java
@@ -11,8 +11,11 @@
package org.eclipse.debug.internal.ui.model.elements;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IRegisterGroup;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.ui.IMemento;
/**
@@ -25,35 +28,41 @@ public class VariablesViewElementMementoProvider extends ElementMementoProvider
*/
private static final String ELEMENT_NAME = "ELEMENT_NAME"; //$NON-NLS-1$
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.elements.ElementMementoProvider#encodeElement(java.lang.Object, org.eclipse.ui.IMemento)
- */
- protected boolean encodeElement(Object element, IMemento memento) throws CoreException {
+ protected boolean encodeElement(Object element, IMemento memento, IPresentationContext context) throws CoreException {
if (element instanceof IStackFrame) {
IStackFrame frame = (IStackFrame) element;
- memento.putString(ELEMENT_NAME, frame.getName());
+ if (IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId())) {
+ // for registers view attempt to maintain expansion for target rather than each frame
+ memento.putString(ELEMENT_NAME, frame.getModelIdentifier());
+ } else {
+ memento.putString(ELEMENT_NAME, frame.getName());
+ }
} else if (element instanceof IVariable) {
- IVariable variable = (IVariable) element;
- memento.putString(ELEMENT_NAME, variable.getName());
+ memento.putString(ELEMENT_NAME, ((IVariable) element).getName());
+ } else if (element instanceof IRegisterGroup) {
+ memento.putString(ELEMENT_NAME, ((IRegisterGroup) element).getName());
} else {
return false;
}
return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.elements.ElementMementoProvider#isEqual(java.lang.Object, org.eclipse.ui.IMemento)
- */
- protected boolean isEqual(Object element, IMemento memento) throws CoreException {
+ protected boolean isEqual(Object element, IMemento memento, IPresentationContext context) throws CoreException {
String mementoName = memento.getString(ELEMENT_NAME);
if (mementoName != null) {
String elementName = null;
if (element instanceof IStackFrame) {
IStackFrame frame = (IStackFrame) element;
- elementName = frame.getName();
+ if (IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId())) {
+ // for registers view attempt to maintain expansion for target rather than each frame
+ elementName = frame.getModelIdentifier();
+ } else {
+ elementName = frame.getName();
+ }
} else if (element instanceof IVariable) {
- IVariable variable = (IVariable) element;
- elementName = variable.getName();
+ elementName = ((IVariable)element).getName();
+ } else if (element instanceof IRegisterGroup) {
+ elementName = ((IRegisterGroup)element).getName();
}
if (elementName != null) {
return elementName.equals(mementoName);

Back to the top