Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2004-03-03 17:29:10 +0000
committerDarin Wright2004-03-03 17:29:10 +0000
commit90966806bd7550d92026c91cade584e975c488c6 (patch)
treec573bc0bc11e8a71f0c48e7b0a6ba88f92ef1297 /org.eclipse.debug.ui/ui/org
parente4e9229beebbaf8bccd8234acba89ead2903c31e (diff)
downloadeclipse.platform.debug-90966806bd7550d92026c91cade584e975c488c6.tar.gz
eclipse.platform.debug-90966806bd7550d92026c91cade584e975c488c6.tar.xz
eclipse.platform.debug-90966806bd7550d92026c91cade584e975c488c6.zip
Bug 53640 - Registers view
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspectiveFactory.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/AbstractViewerState.java144
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersView.java72
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewContentProvider.java82
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.properties11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewerState.java87
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java122
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java32
15 files changed, 515 insertions, 118 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspectiveFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspectiveFactory.java
index fed6c9b04..607c5ea2e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspectiveFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspectiveFactory.java
@@ -43,6 +43,7 @@ public class DebugPerspectiveFactory implements IPerspectiveFactory {
IFolderLayout toolsFolder= layout.createFolder(IInternalDebugUIConstants.ID_TOOLS_FOLDER_VIEW, IPageLayout.RIGHT, (float) 0.50, IInternalDebugUIConstants.ID_NAVIGATOR_FOLDER_VIEW);
toolsFolder.addView(IDebugUIConstants.ID_VARIABLE_VIEW);
toolsFolder.addView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ toolsFolder.addPlaceholder(IDebugUIConstants.ID_REGISTER_VIEW);
IFolderLayout outlineFolder= layout.createFolder(IInternalDebugUIConstants.ID_OUTLINE_FOLDER_VIEW, IPageLayout.RIGHT, (float) 0.75, layout.getEditorArea());
outlineFolder.addView(IPageLayout.ID_OUTLINE);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
index 83772d2bd..714ac3325 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
*******************************************************************************/
package org.eclipse.debug.internal.ui;
@@ -132,6 +133,8 @@ public class DebugPluginImages {
declareRegistryImage(IDebugUIConstants.IMG_OBJS_STACKFRAME, OBJECT + "stckframe_obj.gif"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_OBJS_STACKFRAME_RUNNING, OBJECT + "stckframe_running_obj.gif"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_OBJS_VARIABLE, OBJECT + "genericvariable_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_REGISTER, OBJECT + "genericregister_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP, OBJECT + "genericreggroup_obj.gif"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT, OBJECT + "brkp_obj.gif"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED, OBJECT + "brkpd_obj.gif"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_OBJS_OS_PROCESS, OBJECT + "osprc_obj.gif"); //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index e1d07187d..aff0e7ea3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -371,6 +371,9 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener {
PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CHANGED_VARIABLE_RGB, new RGB(255, 0, 0));
prefs.setDefault(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP, false);
+ //Registers View
+ prefs.setDefault(IDebugPreferenceConstants.REGISTERS_DETAIL_PANE_ORIENTATION, IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_UNDERNEATH);
+
// Variable/Expression view default settings
prefs.setDefault(IDebugUIConstants.ID_VARIABLE_VIEW + '+' + "org.eclipse.debug.ui.ShowDetailPaneAction", true); //$NON-NLS-1$
prefs.setDefault(IDebugUIConstants.ID_EXPRESSION_VIEW + '+' + "org.eclipse.debug.ui.ShowDetailPaneAction", true); //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java
index e27a7fde9..c4bf74666 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
*******************************************************************************/
package org.eclipse.debug.internal.ui;
@@ -28,6 +29,8 @@ import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IDisconnect;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IRegister;
+import org.eclipse.debug.core.model.IRegisterGroup;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.ITerminate;
import org.eclipse.debug.core.model.IThread;
@@ -71,7 +74,11 @@ public class DefaultLabelProvider implements ILabelProvider {
if (element instanceof IDebugElement) {
// Group elements into debug elements and non-debug elements
// to reduce the number of instanceof checks performed
- if (element instanceof IVariable) {
+ if (element instanceof IRegister) {
+ return IDebugUIConstants.IMG_OBJS_REGISTER;
+ } else if (element instanceof IRegisterGroup) {
+ return IDebugUIConstants.IMG_OBJS_REGISTER_GROUP;
+ } else if (element instanceof IVariable) {
if (element instanceof IndexedVariablePartition) {
return IInternalDebugUIConstants.IMG_OBJS_ARRAY_PARTITION;
} else {
@@ -169,6 +176,8 @@ public class DefaultLabelProvider implements ILabelProvider {
label.append((((IDebugTarget)element).getName()));
} else if (element instanceof IExpression) {
label.append(getExpressionText((IExpression)element));
+ } else if (element instanceof IRegisterGroup) {
+ label.append(getRegisterGroupText((IRegisterGroup)element));
}
} else {
if (element instanceof IMarker) {
@@ -305,6 +314,16 @@ public class DefaultLabelProvider implements ILabelProvider {
return buffer.toString();
}
+ protected String getRegisterGroupText(IRegisterGroup registerGroup) {
+ StringBuffer buffer= new StringBuffer();
+ try {
+ buffer.append(registerGroup.getName());
+ } catch (DebugException de) {
+ DebugUIPlugin.log(de);
+ }
+ return buffer.toString();
+ }
+
protected String getMarkerText(IMarker marker) {
try {
if (marker.exists() && marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
index 1d4b056a7..0a7acc7a6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
*******************************************************************************/
package org.eclipse.debug.internal.ui;
@@ -53,6 +54,7 @@ public interface IDebugHelpContextIds {
public static final String BREAKPOINT_VIEW = PREFIX + "breakpoint_view_context"; //$NON-NLS-1$
public static final String EXPRESSION_VIEW = PREFIX + "expression_view_context"; //$NON-NLS-1$
public static final String LAUNCH_CONFIGURATION_VIEW = PREFIX + "launch_configuration_view_context"; //$NON-NLS-1$
+ public static final String REGISTERS_VIEW = PREFIX + "registers_view_context"; //$NON-NLS-1$
// Preference pages
public static final String DEBUG_PREFERENCE_PAGE = PREFIX + "debug_preference_page_context"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
index e4a6fc66e..3ddf33307 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
*******************************************************************************/
package org.eclipse.debug.internal.ui.preferences;
@@ -73,6 +74,7 @@ public interface IDebugPreferenceConstants {
*/
public static final String VARIABLES_DETAIL_PANE_ORIENTATION = "Variables.detail.orientation"; //$NON-NLS-1$
public static final String EXPRESSIONS_DETAIL_PANE_ORIENTATION = "Expressions.detail.orientation"; //$NON-NLS-1$
+ public static final String REGISTERS_DETAIL_PANE_ORIENTATION = "Registers.detail.orientation"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_RIGHT = "Variables.detail.orientation.right"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_UNDERNEATH = "Variables.detail.orientation.underneath"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_HIDDEN = "Variables.detail.orientation.hidden"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/AbstractViewerState.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/AbstractViewerState.java
new file mode 100644
index 000000000..5ca2b8a0d
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/AbstractViewerState.java
@@ -0,0 +1,144 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.debug.internal.ui.views;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * The abstract superclass for mementos of the expanded and
+ * selected items in a tree viewer.
+ */
+public abstract class AbstractViewerState {
+
+ // paths to expanded elements
+ private List fExpandedElements = null;
+ // paths to selected elements
+ private IPath[] fSelection = null;
+
+ /**
+ * Constructs a memento for the given viewer.
+ */
+ public AbstractViewerState(TreeViewer viewer) {
+ saveState(viewer);
+ }
+
+ /**
+ * Saves the current state of the given viewer into
+ * this memento.
+ *
+ * @param viewer viewer of which to save the state
+ */
+ public void saveState(TreeViewer viewer) {
+ List expanded = new ArrayList();
+ fExpandedElements = null;
+ TreeItem[] items = viewer.getTree().getItems();
+ try {
+ for (int i = 0; i < items.length; i++) {
+ collectExandedItems(items[i], expanded);
+ }
+ if (expanded.size() > 0) {
+ fExpandedElements = expanded;
+ }
+ } catch (DebugException e) {
+ fExpandedElements = null;
+ }
+ TreeItem[] selection = viewer.getTree().getSelection();
+ fSelection = new IPath[selection.length];
+ try {
+ for (int i = 0; i < selection.length; i++) {
+ fSelection[i] = encodeElement(selection[i]);
+ }
+ } catch (DebugException e) {
+ fSelection = null;
+ }
+ }
+
+ protected void collectExandedItems(TreeItem item, List expanded)
+ throws DebugException {
+ if (item.getExpanded()) {
+ expanded.add(encodeElement(item));
+ TreeItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ collectExandedItems(items[i], expanded);
+ }
+ }
+ }
+
+ /**
+ * Constructs a path representing the given tree item. The segments in the
+ * path denote parent items, and the last segment is the name of
+ * the given item.
+ *
+ * @param item tree item to encode
+ * @return path encoding the given item
+ * @throws DebugException if unable to generate a path
+ */
+ protected abstract IPath encodeElement(TreeItem item) throws DebugException;
+
+ /**
+ * Restores the state of the given viewer to this memento's
+ * saved state.
+ *
+ * @param viewer viewer to which state is restored
+ */
+ public void restoreState(TreeViewer viewer) {
+ if (fExpandedElements != null) {
+ List expansion = new ArrayList(fExpandedElements.size());
+ for (int i = 0; i < fExpandedElements.size(); i++) {
+ IPath path = (IPath) fExpandedElements.get(i);
+ if (path != null) {
+ Object obj;
+ try {
+ obj = decodePath(path, viewer);
+ if (obj != null) {
+ expansion.add(obj);
+ }
+ } catch (DebugException e) {
+ }
+ }
+ }
+ viewer.setExpandedElements(expansion.toArray());
+ }
+ if (fSelection != null) {
+ List selection = new ArrayList(fSelection.length);
+ for (int i = 0; i < fSelection.length; i++) {
+ IPath path = fSelection[i];
+ Object obj;
+ try {
+ obj = decodePath(path, viewer);
+ if (obj != null) {
+ selection.add(obj);
+ }
+ } catch (DebugException e) {
+ }
+ }
+ viewer.setSelection(new StructuredSelection(selection));
+ }
+ }
+
+ /**
+ * Returns an element in the given viewer that corresponds to the given
+ * path, or <code>null</code> if none.
+ *
+ * @param path encoded element path
+ * @param viewer viewer to search for the element in
+ * @return element represented by the path, or <code>null</code> if none
+ * @throws DebugException if unable to locate a variable
+ */
+ protected abstract Object decodePath(IPath path, TreeViewer viewer) throws DebugException;
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersView.java
new file mode 100644
index 000000000..f0677067a
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersView.java
@@ -0,0 +1,72 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.debug.internal.ui.views.registers;
+
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
+import org.eclipse.debug.internal.ui.views.AbstractViewerState;
+import org.eclipse.debug.internal.ui.views.variables.VariablesView;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.IContentProvider;
+
+/**
+ * Displays registers and their values with a detail area.
+ */
+public class RegistersView extends VariablesView {
+
+ /**
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#createContentProvider()
+ */
+ protected IContentProvider createContentProvider() {
+ RegistersViewContentProvider cp = new RegistersViewContentProvider(this);
+ cp.setExceptionHandler(this);
+ return cp;
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
+ */
+ protected String getHelpContextId() {
+ return IDebugHelpContextIds.REGISTERS_VIEW;
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
+ */
+ protected void configureToolBar(IToolBarManager tbm) {
+ super.configureToolBar(tbm);
+ tbm.add(new Separator(IDebugUIConstants.EMPTY_REGISTER_GROUP));
+ tbm.add(new Separator(IDebugUIConstants.REGISTER_GROUP));
+ }
+
+ /**
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getDetailPanePreferenceKey()
+ */
+ protected String getDetailPanePreferenceKey() {
+ return IDebugPreferenceConstants.REGISTERS_DETAIL_PANE_ORIENTATION;
+ }
+
+ /**
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getToggleActionLabel()
+ */
+ protected String getToggleActionLabel() {
+ return RegistersViewMessages.getString("RegistersView.0"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getViewerState()
+ */
+ protected AbstractViewerState getViewerState() {
+ return new RegistersViewerState(getVariablesViewer());
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewContentProvider.java
new file mode 100644
index 000000000..d7da176b3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewContentProvider.java
@@ -0,0 +1,82 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.debug.internal.ui.views.registers;
+
+import org.eclipse.debug.core.DebugException;
+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.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.views.IDebugExceptionHandler;
+import org.eclipse.debug.internal.ui.views.variables.VariablesViewContentProvider;
+import org.eclipse.debug.ui.IDebugView;
+
+/**
+ * Provides contents for the registers view
+ */
+public class RegistersViewContentProvider extends VariablesViewContentProvider {
+
+ public RegistersViewContentProvider(IDebugView view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ public Object[] getChildren(Object parent) {
+ Object[] children= null;
+ try {
+ if (parent instanceof IStackFrame) {
+ children = ((IStackFrame)parent).getRegisterGroups();
+ } else if (parent instanceof IRegisterGroup) {
+ children = ((IRegisterGroup)parent).getRegisters();
+ } else if (parent instanceof IVariable) {
+ children = super.getChildren( parent );
+ }
+ if (children != null) {
+ cache(parent, children);
+ return children;
+ }
+ } catch (DebugException de) {
+ if (getExceptionHandler() != null) {
+ getExceptionHandler().handleException(de);
+ } else {
+ DebugUIPlugin.log(de);
+ }
+ }
+ return new Object[0];
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ public boolean hasChildren(Object element) {
+ try {
+ if (element instanceof IStackFrame) {
+ return ((IStackFrame)element).hasRegisterGroups();
+ }
+ if (element instanceof IRegisterGroup) {
+ return ((IRegisterGroup)element).hasRegisters();
+ }
+ } catch (DebugException de) {
+ DebugUIPlugin.log(de);
+ return false;
+ }
+ return super.hasChildren(element);
+ }
+
+ /**
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesViewContentProvider#setExceptionHandler(org.eclipse.debug.internal.ui.views.IDebugExceptionHandler)
+ */
+ protected void setExceptionHandler(IDebugExceptionHandler handler) {
+ super.setExceptionHandler(handler);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java
new file mode 100644
index 000000000..56e9221a2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java
@@ -0,0 +1,33 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
+package org.eclipse.debug.internal.ui.views.registers;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class RegistersViewMessages {
+
+ private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.registers.RegistersViewMessages";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE =
+ ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private RegistersViewMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.properties
new file mode 100644
index 000000000..8f132d2fa
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.properties
@@ -0,0 +1,11 @@
+#########################################################################
+# Copyright (c) 2004 QNX Software Systems and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Common Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/cpl-v10.html
+#
+# Contributors:
+# QNX Software Systems - Initial API and implementation
+##########################################################################
+RegistersView.0=Registers View Only
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewerState.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewerState.java
new file mode 100644
index 000000000..c25b516e0
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewerState.java
@@ -0,0 +1,87 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.debug.internal.ui.views.registers;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IRegisterGroup;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.views.AbstractViewerState;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * Memento of the expanded and selected items in a registers viewer.
+ *
+ */
+public class RegistersViewerState extends AbstractViewerState {
+
+ public RegistersViewerState( TreeViewer viewer ) {
+ super( viewer );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.views.AbstractViewerState#encodeElement(org.eclipse.swt.widgets.TreeItem)
+ */
+ public IPath encodeElement( TreeItem item ) throws DebugException {
+ Object obj = item.getData();
+ String name = ( obj instanceof IRegisterGroup ) ?
+ ((IRegisterGroup)obj).getName() : ((IVariable)obj).getName();
+ IPath path = new Path( name );
+ TreeItem parent = item.getParentItem();
+ while( parent != null ) {
+ obj = parent.getData();
+ name = ( obj instanceof IRegisterGroup ) ?
+ ((IRegisterGroup)obj).getName() : ((IVariable)obj).getName();
+ path = new Path( name ).append( path );
+ parent = parent.getParentItem();
+ }
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.views.AbstractViewerState#decodePath(org.eclipse.core.runtime.IPath, org.eclipse.jface.viewers.TreeViewer)
+ */
+ public Object decodePath( IPath path, TreeViewer viewer ) throws DebugException {
+ ITreeContentProvider contentProvider = (ITreeContentProvider)viewer.getContentProvider();
+ String[] names = path.segments();
+ Object parent = viewer.getInput();
+ Object element = null;
+ for( int i = 0; i < names.length; i++ ) {
+ element = null;
+ Object[] children = contentProvider.getChildren( parent );
+ String name = names[i];
+ for( int j = 0; j < children.length; j++ ) {
+ if ( children[j] instanceof IRegisterGroup ) {
+ if ( name.equals( ((IRegisterGroup)children[j]).getName() ) ) {
+ element = children[j];
+ break;
+ }
+ }
+ else if ( children[j] instanceof IVariable ) {
+ if ( name.equals( ((IVariable)children[j]).getName() ) ) {
+ element = children[j];
+ break;
+ }
+ }
+ }
+ if ( element == null ) {
+ return null;
+ }
+ else {
+ parent = element;
+ }
+ }
+ return element;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
index 80fdbb5d4..101352f06 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.variables;
@@ -40,6 +41,7 @@ import org.eclipse.debug.internal.ui.actions.ToggleDetailPaneAction;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.debug.internal.ui.views.AbstractDebugEventHandler;
import org.eclipse.debug.internal.ui.views.AbstractDebugEventHandlerView;
+import org.eclipse.debug.internal.ui.views.AbstractViewerState;
import org.eclipse.debug.internal.ui.views.DebugViewDecoratingLabelProvider;
import org.eclipse.debug.internal.ui.views.DebugViewInterimLabelProvider;
import org.eclipse.debug.internal.ui.views.DebugViewLabelDecorator;
@@ -278,7 +280,7 @@ public class VariablesView extends AbstractDebugEventHandlerView implements ISel
* in the variables view when there is no state to go on for the
* current stack frame being displayed.
*/
- private ViewerState fLastState = null;
+ private AbstractViewerState fLastState = null;
/**
* Remembers which viewer (tree viewer or details viewer) had focus, so we
@@ -345,7 +347,7 @@ public class VariablesView extends AbstractDebugEventHandlerView implements ISel
if (current != null) {
// save state
- fLastState = new ViewerState(getVariablesViewer());
+ fLastState = getViewerState();
fSelectionStates.put(current, fLastState);
}
@@ -357,7 +359,7 @@ public class VariablesView extends AbstractDebugEventHandlerView implements ISel
// restore state
if (frame != null) {
- ViewerState state = (ViewerState)fSelectionStates.get(frame);
+ AbstractViewerState state = (AbstractViewerState)fSelectionStates.get(frame);
if (state == null) {
// attempt to restore selection/expansion based on last frame
state = fLastState;
@@ -1345,4 +1347,12 @@ public class VariablesView extends AbstractDebugEventHandlerView implements ISel
}
}
+ /**
+ * Returns the memento of the expanded and selected items in the viewer.
+ *
+ * @return the memento of the expanded and selected items in the viewer
+ */
+ protected AbstractViewerState getViewerState() {
+ return new ViewerState(getVariablesViewer());
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java
index 0d3fe815b..25e5d9fc3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ViewerState.java
@@ -7,19 +7,16 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.variables;
-
-import java.util.ArrayList;
-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.core.model.IVariable;
+import org.eclipse.debug.internal.ui.views.AbstractViewerState;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.TreeItem;
@@ -28,114 +25,19 @@ import org.eclipse.swt.widgets.TreeItem;
*
* @since 2.1
*/
-public class ViewerState {
+public class ViewerState extends AbstractViewerState {
- // paths to expanded variables
- private List fExpandedElements = null;
- // paths to selected variables
- private IPath[] fSelection = null;
-
/**
* Constructs a memento for the given viewer.
*/
public ViewerState(TreeViewer viewer) {
- saveState(viewer);
+ super(viewer);
}
/**
- * Saves the current state of the given viewer into
- * this memento.
- *
- * @param viewer viewer of which to save the state
- */
- public void saveState(TreeViewer viewer) {
- List expanded = new ArrayList();
- fExpandedElements = null;
- TreeItem[] items = viewer.getTree().getItems();
- try {
- for (int i = 0; i < items.length; i++) {
- collectExandedItesm(items[i], expanded);
- }
- if (expanded.size() > 0) {
- fExpandedElements = expanded;
- }
- } catch (DebugException e) {
- fExpandedElements = null;
- }
-
- TreeItem[] selection = viewer.getTree().getSelection();
- fSelection = new IPath[selection.length];
- try {
- for (int i = 0; i < selection.length; i++) {
- fSelection[i] = encodeVariable(selection[i]);
- }
- } catch (DebugException e) {
- fSelection = null;
- }
- }
-
- protected void collectExandedItesm(TreeItem item, List expanded) throws DebugException {
- if (item.getExpanded()) {
- expanded.add(encodeVariable(item));
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- collectExandedItesm(items[i], expanded);
- }
- }
- }
-
- /**
- * Restores the state of the given viewer to this mementos
- * saved state.
- *
- * @param viewer viewer to which state is restored
+ * @see org.eclipse.debug.internal.ui.views.AbstractViewerState#encodeElement(org.eclipse.swt.widgets.TreeItem)
*/
- public void restoreState(TreeViewer viewer) {
- if (fExpandedElements != null) {
- List expansion = new ArrayList(fExpandedElements.size());
- for (int i = 0; i < fExpandedElements.size(); i++) {
- IPath path = (IPath) fExpandedElements.get(i);
- if (path != null) {
- IVariable var;
- try {
- var = decodePath(path, viewer);
- if (var != null) {
- expansion.add(var);
- }
- } catch (DebugException e) {
- }
- }
- }
- viewer.setExpandedElements(expansion.toArray());
- }
- if (fSelection != null) {
- List selection = new ArrayList(fSelection.length);
- for (int i = 0; i < fSelection.length; i++) {
- IPath path = fSelection[i];
- IVariable var;
- try {
- var = decodePath(path, viewer);
- if (var != null) {
- selection.add(var);
- }
- } catch (DebugException e) {
- }
- }
-
- viewer.setSelection(new StructuredSelection(selection));
- }
- }
-
- /**
- * Constructs a path representing the given variable. The segments in the
- * path denote parent variable names, and the last segment is the name of
- * the given variable.
- *
- * @param item tree item containing the variable to encode
- * @return path encoding the given variable
- * @throws DebugException if unable to generate a path
- */
- protected IPath encodeVariable(TreeItem item) throws DebugException {
+ protected IPath encodeElement(TreeItem item) throws DebugException {
IVariable variable = (IVariable)item.getData();
IPath path = new Path(variable.getName());
TreeItem parent = item.getParentItem();
@@ -146,17 +48,11 @@ public class ViewerState {
}
return path;
}
-
+
/**
- * Returns a variable in the given viewer that corresponds to the given
- * path, or <code>null</code> if none.
- *
- * @param path encoded variable path
- * @param viewer viewer to search for the variable in
- * @return variable represented by the path, or <code>null</code> if none
- * @throws DebugException if unable to locate a variable
+ * @see org.eclipse.debug.internal.ui.views.AbstractViewerState#decodePath(org.eclipse.core.runtime.IPath, org.eclipse.jface.viewers.TreeViewer)
*/
- protected IVariable decodePath(IPath path, TreeViewer viewer) throws DebugException {
+ protected Object decodePath(IPath path, TreeViewer viewer) throws DebugException {
ITreeContentProvider contentProvider = (ITreeContentProvider)viewer.getContentProvider();
String[] names = path.segments();
Object parent = viewer.getInput();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
index 4e7414193..34e961294 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
*******************************************************************************/
package org.eclipse.debug.ui;
@@ -278,6 +279,12 @@ public interface IDebugUIConstants {
public static final String ID_EXPRESSION_VIEW= "org.eclipse.debug.ui.ExpressionView"; //$NON-NLS-1$
/**
+ * Register view identifier (value <code>"org.eclipse.debug.ui.RegisterView"</code>).
+ * @since 3.0
+ */
+ public static final String ID_REGISTER_VIEW= "org.eclipse.debug.ui.RegisterView"; //$NON-NLS-1$
+
+ /**
* Console view identifier (value <code>"org.eclipse.debug.ui.ConsoleView"</code>).
* @deprecated Use org.eclipse.ui.console.IConsoleConstants.ID_CONSOLE_VIEW
* @since 3.0
@@ -478,6 +485,20 @@ public interface IDebugUIConstants {
*/
public static final String IMG_OBJS_VARIABLE= "IMG_OBJS_VARIABLE"; //$NON-NLS-1$
+ /**
+ * Generic identifier of register group image.
+ *
+ * @since 3.0
+ */
+ public static final String IMG_OBJS_REGISTER_GROUP= "IMG_OBJS_REGISTER_GROUP"; //$NON-NLS-1$
+
+ /**
+ * Generic register image identifier.
+ *
+ * @since 3.0
+ */
+ public static final String IMG_OBJS_REGISTER= "IMG_OBJS_REGISTER"; //$NON-NLS-1$
+
// views
/**
@@ -693,6 +714,17 @@ public interface IDebugUIConstants {
*/
public static final String PROPERTY_GROUP = "propertyGroup"; //$NON-NLS-1$
+ /**
+ * Identifier for an empty group preceding a
+ * register group in a menu (value <code>"emptyRegisterGroup"</code>).
+ */
+ public static final String EMPTY_REGISTER_GROUP = "emptyRegisterGroup"; //$NON-NLS-1$
+
+ /**
+ * Identifier for a register group in a menu (value <code>"registerGroup"</code>).
+ */
+ public static final String REGISTER_GROUP = "registerGroup"; //$NON-NLS-1$
+
/**
* Id for the popup menu associated with the variables (tree viewer) part of the VariableView
*/

Back to the top