Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Burns2003-08-07 23:55:52 +0000
committerJared Burns2003-08-07 23:55:52 +0000
commit4d13031db2d6df3beb6fea2ec97466c5076425c6 (patch)
tree469d859c0561d5a35f142602177da1b9997a7232 /org.eclipse.debug.ui/ui
parentc89741f2c7516db5a13b9d9b420eed62bfa25287 (diff)
downloadeclipse.platform.debug-4d13031db2d6df3beb6fea2ec97466c5076425c6.tar.gz
eclipse.platform.debug-4d13031db2d6df3beb6fea2ec97466c5076425c6.tar.xz
eclipse.platform.debug-4d13031db2d6df3beb6fea2ec97466c5076425c6.zip
Bug 27281 - The watch expressions don't persist across workbench invocations
Diffstat (limited to 'org.eclipse.debug.ui/ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddWatchExpressionAction.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConvertToWatchExpressionAction.java46
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditWatchExpressionAction.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ReevaluateWatchExpressionAction.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/StatusDialog.java163
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/StatusInfo.java171
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchAction.java87
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchExpressionAction.java107
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchExpressionDialog.java142
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewContentProvider.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewEventHandler.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java15
14 files changed, 966 insertions, 10 deletions
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 2c4e1baae..567b9ed83 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
@@ -31,6 +31,7 @@ import org.eclipse.debug.core.model.ITerminate;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.core.model.IWatchExpression;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -169,6 +170,8 @@ public class DefaultLabelProvider implements ILabelProvider {
label.append(((ILaunchConfiguration)element).getName());
} else if (element instanceof ILaunchConfigurationType) {
label.append(((ILaunchConfigurationType)element).getName());
+ } else if (element instanceof String) {
+ label.append(element);
} else {
label.append(getAdapterLabel(element));
}
@@ -221,10 +224,13 @@ public class DefaultLabelProvider implements ILabelProvider {
}
protected String getExpressionText(IExpression expression) {
+ if (expression instanceof IWatchExpression) {
+ return getWatchExpressionText((IWatchExpression) expression);
+ }
StringBuffer buffer= new StringBuffer(expression.getExpressionText());
String valueString= null;
IValue value= expression.getValue();
- if ((valueString == null) || (valueString.length() < 1)) {
+ if (value != null && (valueString == null || valueString.length() < 1)) {
try {
valueString= value.getValueString();
} catch (DebugException de) {
@@ -238,6 +244,35 @@ public class DefaultLabelProvider implements ILabelProvider {
return buffer.toString();
}
+ /**
+ * @param expression
+ * @return
+ */
+ protected String getWatchExpressionText(IWatchExpression expression) {
+ StringBuffer result= new StringBuffer();
+ result.append('"').append(expression.getExpressionText()).append('"');
+ if (expression.isPending()) {
+ result.append(" (pending)");
+ } else if (expression.hasErrors()) {
+ result.append(" <error(s)_during_the_evaluation>");
+ } else {
+ IValue value= expression.getValue();
+ if (value != null) {
+ String valueString= DebugUIPlugin.getModelPresentation().getText(value);
+ if (valueString.length() > 0) {
+ result.append(" = ").append(valueString); //$NON-NLS-1$
+ }
+ }
+ }
+ if (expression.isObsolete()) {
+ result.append(" (obsolete)");
+ }
+ if (!expression.isEnabled()) {
+ result.append(" (disabled)");
+ }
+ return result.toString();
+ }
+
protected String getVariableText(IVariable variable) {
StringBuffer buffer= new StringBuffer();
try {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddWatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddWatchExpressionAction.java
new file mode 100644
index 000000000..ce09fa9bf
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddWatchExpressionAction.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.WatchExpression;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+
+/**
+ * Open a watch expression dialog and add the created watch expression to the
+ * expression view.
+ */
+public class AddWatchExpressionAction extends WatchExpressionAction implements IViewActionDelegate {
+
+ /**
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ public void init(IViewPart view) {
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ // create a watch expression
+ WatchExpression watchExpression= new WatchExpression(""); //$NON-NLS-1$
+ // open the watch expression dialog
+ if (new WatchExpressionDialog(DebugUIPlugin.getShell(), watchExpression, false).open() == Window.OK) {
+ // if OK is selected, add the expression to the expression view and try to evaluate the expression.
+ DebugPlugin.getDefault().getExpressionManager().addExpression(watchExpression);
+ watchExpression.setExpressionContext(getContext());
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConvertToWatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConvertToWatchExpressionAction.java
new file mode 100644
index 000000000..c2b775560
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConvertToWatchExpressionAction.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+
+import java.util.Iterator;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IExpressionManager;
+import org.eclipse.debug.core.model.IExpression;
+import org.eclipse.debug.core.model.WatchExpression;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * Convert one or more expressions to the equivalent watch expressions.
+ * Refresh and re-evaluate the expressions if possible.
+ */
+public class ConvertToWatchExpressionAction extends WatchExpressionAction {
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IStructuredSelection selection= getCurrentSelection();
+ IExpressionManager expressionManager= DebugPlugin.getDefault().getExpressionManager();
+ for (Iterator iter= selection.iterator(); iter.hasNext();) {
+ IExpression expression= (IExpression) iter.next();
+ // create the new watch expression
+ WatchExpression watchExpression= new WatchExpression(expression.getExpressionText());
+ expressionManager.removeExpression(expression);
+ expressionManager.addExpression(watchExpression);
+ // refresh and re-evaluate
+ watchExpression.setExpressionContext(getContext());
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditWatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditWatchExpressionAction.java
new file mode 100644
index 000000000..c7a5f4c63
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditWatchExpressionAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+
+import org.eclipse.debug.core.model.WatchExpression;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.window.Window;
+
+/**
+ * Open the watch expression dialog for the select watch expression.
+ * Re-evaluate and refresh the watch expression is necessary.
+ */
+public class EditWatchExpressionAction extends WatchExpressionAction {
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ WatchExpression watchExpression= (WatchExpression)getCurrentSelection().getFirstElement();
+ // display the watch expression dialog for the currently selected watch expression
+ if (new WatchExpressionDialog(DebugUIPlugin.getShell(), watchExpression, true).open() == Window.OK) {
+ // re-evaluate and refresh if necessary
+ watchExpression.setExpressionContext(getContext());
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ReevaluateWatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ReevaluateWatchExpressionAction.java
new file mode 100644
index 000000000..c28dced05
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ReevaluateWatchExpressionAction.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+
+import java.util.Iterator;
+
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.WatchExpression;
+import org.eclipse.jface.action.IAction;
+
+/**
+ * Ask to re-evaluate one or more watch expressions in the context of the
+ * currently selected thread.
+ */
+public class ReevaluateWatchExpressionAction extends WatchExpressionAction {
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IDebugElement context = getContext();
+ for (Iterator iter= getCurrentSelection().iterator(); iter.hasNext();) {
+ ((WatchExpression) iter.next()).setExpressionContext(context);
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/StatusDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/StatusDialog.java
new file mode 100644
index 000000000..dfc0d1c24
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/StatusDialog.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.internal.MessageLine;
+
+/**
+ * An abstract base class for dialogs with a status bar and ok/cancel buttons.
+ * The status message must be passed over as StatusInfo object and can be
+ * an error, warning or ok. The OK button is enabled or disabled depending
+ * on the status.
+ * Copied from org.eclipse.jdt.internal.ui.StatusDialog
+ */
+public abstract class StatusDialog extends Dialog {
+
+ private Button fOkButton;
+ private MessageLine fStatusLine;
+ private IStatus fLastStatus;
+ private String fTitle;
+ private Image fImage;
+
+ /**
+ * Creates an instane of a status dialog.
+ */
+ public StatusDialog(Shell parent) {
+ super(parent);
+ fLastStatus = new StatusInfo();
+ }
+
+ /**
+ * Specifies whether status line appears to the left of the buttons (default)
+ * or above them.
+ *
+ * @param aboveButtons if <code>true</code> status line is placed above buttons; if
+ * <code>false</code> to the right
+ */
+ public void setStatusLineAboveButtons(boolean aboveButtons) {
+ }
+
+ /**
+ * Update the dialog's status line to reflect the given status.
+ * It is save to call this method before the dialog has been opened.
+ */
+ protected void updateStatus(IStatus status) {
+ fLastStatus = status;
+ if (fStatusLine != null && !fStatusLine.isDisposed()) {
+ updateButtonsEnableState(status);
+ fStatusLine.setErrorStatus(status);
+ }
+ }
+
+ /**
+ * Returns the last status.
+ */
+ public IStatus getStatus() {
+ return fLastStatus;
+ }
+
+ /**
+ * Updates the status of the ok button to reflect the given status.
+ * Subclasses may override this method to update additional buttons.
+ * @param status the status.
+ */
+ protected void updateButtonsEnableState(IStatus status) {
+ if (fOkButton != null && !fOkButton.isDisposed())
+ fOkButton.setEnabled(!status.matches(IStatus.ERROR));
+ }
+
+ /*
+ * @see Window#create(Shell)
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ if (fTitle != null)
+ shell.setText(fTitle);
+ }
+
+ /*
+ * @see Window#create()
+ */
+ public void create() {
+ super.create();
+ if (fLastStatus != null) {
+ // policy: dialogs are not allowed to come up with an error message
+ if (fLastStatus.matches(IStatus.ERROR)) {
+ StatusInfo status = new StatusInfo();
+ status.setError(""); //$NON-NLS-1$
+ fLastStatus = status;
+ }
+ updateStatus(fLastStatus);
+ }
+ }
+
+ /*
+ * @see Dialog#createButtonsForButtonBar(Composite)
+ */
+ protected void createButtonsForButtonBar(Composite parent) {
+ fOkButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ /*
+ * @see Dialog#createButtonBar(Composite)
+ */
+ protected Control createButtonBar(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ fStatusLine = new MessageLine(composite);
+ fStatusLine.setAlignment(SWT.LEFT);
+ fStatusLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fStatusLine.setErrorStatus(null); //$NON-NLS-1$
+ applyDialogFont(composite);
+ super.createButtonBar(composite);
+ return composite;
+ }
+
+ /**
+ * Sets the title for this dialog.
+ * @param title the title.
+ */
+ public void setTitle(String title) {
+ fTitle = title != null ? title : ""; //$NON-NLS-1$
+ Shell shell = getShell();
+ if ((shell != null) && !shell.isDisposed())
+ shell.setText(fTitle);
+ }
+
+ /**
+ * Sets the image for this dialog.
+ * @param image the image.
+ */
+ public void setImage(Image image) {
+ fImage = image;
+ Shell shell = getShell();
+ if ((shell != null) && !shell.isDisposed())
+ shell.setImage(fImage);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/StatusInfo.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/StatusInfo.java
new file mode 100644
index 000000000..e76b191cc
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/StatusInfo.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jface.util.Assert;
+
+/**
+ * A settable IStatus.
+ * Can be an error, warning, info or ok. For error, info and warning states,
+ * a message describes the problem.
+ */
+public class StatusInfo implements IStatus {
+
+ private String fStatusMessage;
+ private int fSeverity;
+
+ /**
+ * Creates a status set to OK (no message)
+ */
+ public StatusInfo() {
+ this(OK, null);
+ }
+
+ /**
+ * Creates a status .
+ * @param severity The status severity: ERROR, WARNING, INFO and OK.
+ * @param message The message of the status. Applies only for ERROR,
+ * WARNING and INFO.
+ */
+ public StatusInfo(int severity, String message) {
+ fStatusMessage= message;
+ fSeverity= severity;
+ }
+
+ /**
+ * Returns if the status' severity is OK.
+ */
+ public boolean isOK() {
+ return fSeverity == IStatus.OK;
+ }
+
+ /**
+ * Returns if the status' severity is WARNING.
+ */
+ public boolean isWarning() {
+ return fSeverity == IStatus.WARNING;
+ }
+
+ /**
+ * Returns if the status' severity is INFO.
+ */
+ public boolean isInfo() {
+ return fSeverity == IStatus.INFO;
+ }
+
+ /**
+ * Returns if the status' severity is ERROR.
+ */
+ public boolean isError() {
+ return fSeverity == IStatus.ERROR;
+ }
+
+ /**
+ * @see IStatus#getMessage
+ */
+ public String getMessage() {
+ return fStatusMessage;
+ }
+
+ /**
+ * Sets the status to ERROR.
+ * @param The error message (can be empty, but not null)
+ */
+ public void setError(String errorMessage) {
+ Assert.isNotNull(errorMessage);
+ fStatusMessage= errorMessage;
+ fSeverity= IStatus.ERROR;
+ }
+
+ /**
+ * Sets the status to WARNING.
+ * @param The warning message (can be empty, but not null)
+ */
+ public void setWarning(String warningMessage) {
+ Assert.isNotNull(warningMessage);
+ fStatusMessage= warningMessage;
+ fSeverity= IStatus.WARNING;
+ }
+
+ /**
+ * Sets the status to INFO.
+ * @param The info message (can be empty, but not null)
+ */
+ public void setInfo(String infoMessage) {
+ Assert.isNotNull(infoMessage);
+ fStatusMessage= infoMessage;
+ fSeverity= IStatus.INFO;
+ }
+
+ /**
+ * Sets the status to OK.
+ */
+ public void setOK() {
+ fStatusMessage= null;
+ fSeverity= IStatus.OK;
+ }
+
+ /*
+ * @see IStatus#matches(int)
+ */
+ public boolean matches(int severityMask) {
+ return (fSeverity & severityMask) != 0;
+ }
+
+ /**
+ * Returns always <code>false</code>.
+ * @see IStatus#isMultiStatus()
+ */
+ public boolean isMultiStatus() {
+ return false;
+ }
+
+ /*
+ * @see IStatus#getSeverity()
+ */
+ public int getSeverity() {
+ return fSeverity;
+ }
+
+ /*
+ * @see IStatus#getPlugin()
+ */
+ public String getPlugin() {
+ return DebugUIPlugin.getUniqueIdentifier();
+ }
+
+ /**
+ * Returns always <code>null</code>.
+ * @see IStatus#getException()
+ */
+ public Throwable getException() {
+ return null;
+ }
+
+ /**
+ * Returns always the error severity.
+ * @see IStatus#getCode()
+ */
+ public int getCode() {
+ return fSeverity;
+ }
+
+ /**
+ * Returns always <code>null</code>.
+ * @see IStatus#getChildren()
+ */
+ public IStatus[] getChildren() {
+ return new IStatus[0];
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchAction.java
new file mode 100644
index 000000000..f79fbdbce
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchAction.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.core.model.WatchExpression;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ *
+ */
+public class WatchAction implements IObjectActionDelegate {
+
+ private ISelection fSelection;
+
+ /**
+ * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ if (fSelection == null) {
+ return;
+ }
+ if (fSelection instanceof IStructuredSelection) {
+ Iterator iter = ((IStructuredSelection) fSelection).iterator();
+ while (iter.hasNext()) {
+ IVariable variable = (IVariable) iter.next();
+ createExpression(variable);
+ }
+ } else if (fSelection instanceof IVariable) {
+ createExpression((IVariable) fSelection);
+ }
+ }
+
+ private void createExpression(IVariable variable) {
+ WatchExpression expression;
+ try {
+ expression = new WatchExpression(variable.getName());
+ } catch (DebugException e) {
+ DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), "Error creating watch", "An exception occurred while attempting to create watch item.", e);
+ return;
+ }
+ DebugPlugin.getDefault().getExpressionManager().addExpression(expression);
+ IAdaptable object = DebugUITools.getDebugContext();
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ expression.setExpressionContext(context);
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ fSelection = selection;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchExpressionAction.java
new file mode 100644
index 000000000..3e353e7fd
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchExpressionAction.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Generic abstract class for the actions associated to the java watch
+ * expressions.
+ */
+public abstract class WatchExpressionAction implements IObjectActionDelegate, IActionDelegate2 {
+ IWorkbenchPart fPart = null;
+ /**
+ * Finds the currently selected context in the UI.
+ */
+ protected IDebugElement getContext() {
+ IAdaptable object = DebugUITools.getDebugContext();
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ return context;
+ }
+ /**
+ * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ fPart = targetPart;
+ }
+
+ /**
+ * @see IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection sel) {
+ }
+
+ protected IStructuredSelection getCurrentSelection() {
+ IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
+ if (page != null) {
+ ISelection selection = page.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return (IStructuredSelection) selection;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Displays the given error message in the status line.
+ *
+ * @param message
+ */
+ protected void showErrorMessage(String message) {
+ if (fPart instanceof IViewPart) {
+ IViewSite viewSite = ((IViewPart) fPart).getViewSite();
+ IStatusLineManager manager = viewSite.getActionBars().getStatusLineManager();
+ manager.setErrorMessage(message);
+ Display.getCurrent().beep();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ fPart = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchExpressionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchExpressionDialog.java
new file mode 100644
index 000000000..eb5f652c3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/WatchExpressionDialog.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+
+import org.eclipse.debug.core.model.WatchExpression;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.help.WorkbenchHelp;
+
+/**
+ * Dialog for edit watch expression.
+ */
+public class WatchExpressionDialog extends StatusDialog {
+
+ /**
+ * The detail formatter to edit.
+ */
+ private WatchExpression fWatchExpression;
+
+ // widgets
+ private SourceViewer fSnippetViewer;
+ private Button fCheckBox;
+
+ public WatchExpressionDialog(Shell parent, WatchExpression watchExpression, boolean editDialog) {
+ super(parent);
+ fWatchExpression= watchExpression;
+ setShellStyle(getShellStyle() | SWT.MAX | SWT.RESIZE);
+ String helpContextId = null;
+ if (editDialog) {
+ setTitle("Edit Watch Expression");
+ //helpContextId = IJavaDebugHelpContextIds.EDIT_WATCH_EXPRESSION_DIALOG;
+ } else {
+ setTitle("Add Watch Expression");
+ //helpContextId = IJavaDebugHelpContextIds.ADD_WATCH_EXPRESSION_DIALOG;
+ }
+ WorkbenchHelp.setHelp(parent, helpContextId);
+ }
+
+ /**
+ * Create the dialog area.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ Font font = parent.getFont();
+
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ GridData gd= new GridData(GridData.FILL_BOTH);
+ container.setLayoutData(gd);
+
+ // snippet label
+ Label label= new Label(container, SWT.NONE);
+ label.setText("E&xpression:");
+ gd= new GridData(GridData.BEGINNING);
+ label.setLayoutData(gd);
+ label.setFont(font);
+
+ fSnippetViewer= new SourceViewer(container, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ fSnippetViewer.setInput(this);
+
+
+ IDocument document= new Document();
+ //IDocumentPartitioner partitioner= new RuleBasedPartitioner(...);
+ //document.setDocumentPartitioner(partitioner);
+ //partitioner.connect(document);
+ fSnippetViewer.configure(new SourceViewerConfiguration());
+ fSnippetViewer.setEditable(true);
+ fSnippetViewer.setDocument(document);
+ document.addDocumentListener(new IDocumentListener() {
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ }
+ public void documentChanged(DocumentEvent event) {
+ checkValues();
+ }
+ });
+
+ fSnippetViewer.getTextWidget().setFont(JFaceResources.getTextFont());
+
+ Control control= fSnippetViewer.getControl();
+ gd= new GridData(GridData.FILL_BOTH);
+ gd.heightHint= convertHeightInCharsToPixels(10);
+ gd.widthHint= convertWidthInCharsToPixels(80);
+ control.setLayoutData(gd);
+ fSnippetViewer.getDocument().set(fWatchExpression.getExpressionText());
+
+ // enable checkbox
+ fCheckBox= new Button(container, SWT.CHECK | SWT.LEFT);
+ fCheckBox.setText("&Enable");
+ fCheckBox.setSelection(fWatchExpression.isEnabled());
+ fCheckBox.setFont(font);
+
+ applyDialogFont(container);
+ fSnippetViewer.getControl().setFocus();
+ return container;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed() {
+ fWatchExpression.setEnabled(fCheckBox.getSelection());
+ fWatchExpression.setExpressionText(fSnippetViewer.getDocument().get());
+ super.okPressed();
+ }
+
+ /**
+ * Check the field values and display a message in the status if needed.
+ */
+ private void checkValues() {
+ StatusInfo status= new StatusInfo();
+ if (fSnippetViewer.getDocument().get().trim().length() == 0) {
+ status.setError("Expression must not be empty");
+ }
+ updateStatus(status);
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
index e9f7473c9..e10d876c3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
@@ -12,22 +12,29 @@ package org.eclipse.debug.internal.ui.views.expression;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IWatchExpression;
+import org.eclipse.debug.internal.ui.ColorManager;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.debug.internal.ui.views.AbstractDebugEventHandler;
import org.eclipse.debug.internal.ui.views.variables.VariablesView;
+import org.eclipse.debug.internal.ui.views.variables.VariablesViewContentProvider;
import org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages;
+import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
@@ -35,7 +42,42 @@ import org.eclipse.ui.IWorkbenchPart;
* Displays expressions and their values with a detail
* area.
*/
-public class ExpressionView extends VariablesView {
+public class ExpressionView extends VariablesView {
+ protected class ExpressionViewLabelProvider extends VariablesView.VariablesViewLabelProvider {
+ /**
+ * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
+ */
+ public Color getForeground(Object element) {
+ boolean watchExpressionWithError= false;
+ IWatchExpression watch= null;
+ if (element instanceof IWatchExpression) {
+ watch= (IWatchExpression) element;
+ } else if (element instanceof String) {
+ Object parent= ((VariablesViewContentProvider) getVariablesViewer().getContentProvider()).getParent(element);
+ if (parent instanceof IWatchExpression) {
+ watch= (IWatchExpression) parent;
+ }
+ }
+ if (watch != null && watch.hasErrors()) {
+ watchExpressionWithError= true;
+ }
+ if (watchExpressionWithError) {
+ return ColorManager.getDefault().getColor(new RGB(255, 0, 0));
+ }
+ return super.getForeground(element);
+ }
+
+ public ExpressionViewLabelProvider(IDebugModelPresentation presentation) {
+ super(presentation);
+ }
+ }
+ /**
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#createLabelProvider()
+ */
+ protected IBaseLabelProvider createLabelProvider() {
+ return new ExpressionViewLabelProvider(getModelPresentation());
+ }
+
/**
* Creates this view's content provider.
*
@@ -103,10 +145,15 @@ public class ExpressionView extends VariablesView {
*/
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (selection instanceof IStructuredSelection) {
- Object context = null;
+ IDebugElement context = null;
IStructuredSelection ss = (IStructuredSelection)selection;
if (ss.size() < 2) {
- context = ss.getFirstElement();
+ Object object = ss.getFirstElement();
+ if (object instanceof IDebugElement) {
+ context= (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context= ((ILaunch) object).getDebugTarget();
+ }
}
// update watch expressions with new context
IExpression[] expressions = DebugPlugin.getDefault().getExpressionManager().getExpressions();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewContentProvider.java
index b7af1a367..6336ce421 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewContentProvider.java
@@ -17,6 +17,7 @@ import org.eclipse.debug.core.IExpressionManager;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.core.model.IWatchExpression;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.views.variables.VariablesViewContentProvider;
import org.eclipse.debug.ui.IDebugView;
@@ -40,8 +41,16 @@ public class ExpressionViewContentProvider extends VariablesViewContentProvider
if (parent instanceof IExpressionManager) {
// do not cache parents
return ((IExpressionManager)parent).getExpressions();
- } else if (parent instanceof IExpression) {
- children = getModelSpecificExpressionChildren((IExpression)parent);
+ } else if (parent instanceof IExpression) {
+ if (parent instanceof IWatchExpression) {
+ IWatchExpression watch= (IWatchExpression) parent;
+ if (watch.hasErrors()) {
+ children= watch.getErrorMessages();
+ }
+ }
+ if (children == null) {
+ children = getModelSpecificExpressionChildren((IExpression)parent);
+ }
} else if (parent instanceof IVariable) {
children = getModelSpecificVariableChildren((IVariable)parent);
}
@@ -81,6 +90,9 @@ public class ExpressionViewContentProvider extends VariablesViewContentProvider
if (element instanceof IExpressionManager) {
return ((IExpressionManager)element).hasExpressions();
} else if (element instanceof IExpression) {
+ if (element instanceof IWatchExpression && ((IWatchExpression) element).hasErrors()) {
+ return true;
+ }
IValue v = ((IExpression)element).getValue();
if (v == null) {
return false;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewEventHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewEventHandler.java
index 03f7ce51e..d11609ef6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewEventHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionViewEventHandler.java
@@ -13,9 +13,12 @@ package org.eclipse.debug.internal.ui.views.expression;
import java.util.List;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IExpressionsListener;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IVariable;
@@ -41,7 +44,13 @@ public class ExpressionViewEventHandler extends VariablesViewEventHandler implem
super.doHandleTerminateEvent(event);
if (event.getSource() instanceof IDebugTarget) {
IExpression[] expressions = DebugPlugin.getDefault().getExpressionManager().getExpressions();
- Object context = DebugUITools.getDebugContext();
+ IAdaptable object = DebugUITools.getDebugContext();
+ IDebugElement context= null;
+ if (object instanceof IDebugElement) {
+ context= (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context= ((ILaunch) object).getDebugTarget();
+ }
for (int i = 0; i < expressions.length; i++) {
IExpression expression = expressions[i];
if (expression instanceof IWatchExpression) {
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 19bea2122..7a5316a20 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
@@ -118,9 +118,9 @@ public class VariablesView extends AbstractDebugEventHandlerView implements ISel
* presentation and adds coloring to variables to
* reflect their changed state
*/
- class VariablesViewLabelProvider implements ILabelProvider, IColorProvider {
+ protected class VariablesViewLabelProvider implements ILabelProvider, IColorProvider {
- private IDebugModelPresentation presentation;
+ protected IDebugModelPresentation presentation;
public VariablesViewLabelProvider(IDebugModelPresentation presentation) {
this.presentation= presentation;
@@ -519,7 +519,7 @@ public class VariablesView extends AbstractDebugEventHandlerView implements ISel
// add tree viewer
final TreeViewer variablesViewer = new VariablesViewer(getSashForm(), SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
variablesViewer.setContentProvider(createContentProvider());
- variablesViewer.setLabelProvider(new VariablesViewLabelProvider(getModelPresentation()));
+ variablesViewer.setLabelProvider(createLabelProvider());
variablesViewer.setUseHashlookup(true);
variablesViewer.getControl().addFocusListener(new FocusAdapter() {
/**
@@ -545,6 +545,15 @@ public class VariablesView extends AbstractDebugEventHandlerView implements ISel
}
/**
+ * Creates and returns a label provider for this view.
+ *
+ * @return a label provider for this view.
+ */
+ protected IBaseLabelProvider createLabelProvider() {
+ return new VariablesViewLabelProvider(getModelPresentation());
+ }
+
+ /**
* Create the widgetry for the details viewer.
*/
protected void createDetailsViewer() {

Back to the top