Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2006-11-15 19:46:40 +0000
committerDarin Wright2006-11-15 19:46:40 +0000
commitc130146e210d0c6b4c0330c63f9629144c06f4ad (patch)
tree09427478ba064a63270d2b46fc0b85098fa43306
parent161787ce7b058fa78e76abcd190587d5ba7754d0 (diff)
downloadeclipse.platform.debug-c130146e210d0c6b4c0330c63f9629144c06f4ad.tar.gz
eclipse.platform.debug-c130146e210d0c6b4c0330c63f9629144c06f4ad.tar.xz
eclipse.platform.debug-c130146e210d0c6b4c0330c63f9629144c06f4ad.zip
Bug 153500 Asynchronous model viewer [expansion state in expressions view]
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionsViewMementoProvider.java65
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java5
2 files changed, 70 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionsViewMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionsViewMementoProvider.java
new file mode 100644
index 000000000..a2ba87e7f
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionsViewMementoProvider.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.IExpressionManager;
+import org.eclipse.debug.core.model.IExpression;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.ui.IMemento;
+
+/**
+ * Memento provider for expressions view.
+ *
+ * @since 3.3
+ */
+public class ExpressionsViewMementoProvider extends ElementMementoProvider {
+
+ /**
+ * memento attribute
+ */
+ private static final String ELEMENT_NAME = "ELEMENT_NAME"; //$NON-NLS-1$
+
+ private static final String EXP_MGR = "EXP_MGR"; //$NON-NLS-1$
+
+ protected boolean encodeElement(Object element, IMemento memento, IPresentationContext context) throws CoreException {
+ if (element instanceof IExpressionManager) {
+ memento.putString(ELEMENT_NAME, EXP_MGR);
+ } else if (element instanceof IExpression) {
+ memento.putString(ELEMENT_NAME, ((IExpression) element).getExpressionText());
+ } else if (element instanceof IVariable) {
+ memento.putString(ELEMENT_NAME, ((IVariable) element).getName());
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ 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 IExpressionManager) {
+ elementName = EXP_MGR;
+ } else if (element instanceof IVariable) {
+ elementName = ((IVariable)element).getName();
+ } else if (element instanceof IExpression) {
+ elementName = ((IExpression)element).getExpressionText();
+ }
+ if (elementName != null) {
+ return elementName.equals(mementoName);
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
index 6c828dd4e..930fdeaa4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
@@ -48,6 +48,7 @@ import org.eclipse.debug.internal.ui.model.elements.DebugTargetContentProvider;
import org.eclipse.debug.internal.ui.model.elements.ExpressionContentProvider;
import org.eclipse.debug.internal.ui.model.elements.ExpressionLabelProvider;
import org.eclipse.debug.internal.ui.model.elements.ExpressionManagerContentProvider;
+import org.eclipse.debug.internal.ui.model.elements.ExpressionsViewMementoProvider;
import org.eclipse.debug.internal.ui.model.elements.LaunchContentProvider;
import org.eclipse.debug.internal.ui.model.elements.LaunchManagerContentProvider;
import org.eclipse.debug.internal.ui.model.elements.RegisterGroupContentProvider;
@@ -122,6 +123,7 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
private static IElementContentProvider fgCPRegisterGroup = new RegisterGroupContentProvider();
private static IElementMementoProvider fgMPFrame = new VariablesViewElementMementoProvider();
+ private static IElementMementoProvider fgMPExpressions = new ExpressionsViewMementoProvider();
private static IColumnPresentationFactoryAdapter fgVariableColumnFactory = new VariableColumnFactoryAdapter();
@@ -271,6 +273,9 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
if (adaptableObject instanceof IStackFrame) {
return fgMPFrame;
}
+ if (adaptableObject instanceof IExpressionManager) {
+ return fgMPExpressions;
+ }
}
if (adapterType.equals(IElementEditor.class)) {

Back to the top