Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2011-06-20 16:47:44 -0400
committereutarass2011-06-20 16:47:44 -0400
commit2bd0d9a55879b68d59e4aecdb4b11d629562dbfd (patch)
treebe5441a2bf1a35d9d3ca681739cb79ab644eaa1e /plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse
parent14ebb9c053ceadf10d46cb98643d54423dc5257a (diff)
downloadorg.eclipse.tcf-2bd0d9a55879b68d59e4aecdb4b11d629562dbfd.tar.gz
org.eclipse.tcf-2bd0d9a55879b68d59e4aecdb4b11d629562dbfd.tar.xz
org.eclipse.tcf-2bd0d9a55879b68d59e4aecdb4b11d629562dbfd.zip
TCF Debugger: implemented "Watch In Expressions" menu command in Variables view.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java10
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java70
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java18
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java2
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java4
5 files changed, 101 insertions, 3 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java
index 4e781c5c8..87ddb0085 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
package org.eclipse.tm.internal.tcf.debug.ui.commands;
import org.eclipse.debug.ui.IDebugUIConstants;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java
new file mode 100644
index 000000000..a463a1acd
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.commands;
+
+import org.eclipse.debug.core.IExpressionManager;
+import org.eclipse.debug.core.model.IExpression;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.tm.internal.tcf.debug.ui.Activator;
+import org.eclipse.tm.internal.tcf.debug.ui.model.IWatchInExpressions;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
+import org.eclipse.tm.tcf.util.TCFDataCache;
+import org.eclipse.tm.tcf.util.TCFTask;
+import org.eclipse.ui.IWorkbenchPage;
+
+public class WatchInExpressionsCommand extends AbstractActionDelegate {
+
+ @Override
+ protected void selectionChanged() {
+ getAction().setEnabled(getNodes().length > 0);
+ }
+
+ @Override
+ protected void run() {
+ try {
+ IWorkbenchPage page = getWindow().getActivePage();
+ page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW, null, IWorkbenchPage.VIEW_ACTIVATE);
+ for (final TCFNode node : getSelectedNodes()) {
+ final IExpressionManager manager = node.getModel().getExpressionManager();
+ IExpression e = new TCFTask<IExpression>(node.getChannel()) {
+ public void run() {
+ try {
+ IExpression e = null;
+ if (node instanceof IWatchInExpressions) {
+ TCFDataCache<String> text_cache = ((IWatchInExpressions)node).getExpressionText();
+ if (!text_cache.validate(this)) return;
+ String text_data = text_cache.getData();
+ if (text_data != null) e = manager.newWatchExpression(text_data);
+ }
+ done(e);
+ }
+ catch (Exception x) {
+ error(x);
+ }
+ }
+ }.get();
+ if (e != null) manager.addExpression(e);
+ }
+ }
+ catch (Exception x) {
+ Activator.log("Cannot open expressions view", x);
+ }
+ }
+
+ private TCFNode[] getNodes() {
+ TCFNode[] arr = getSelectedNodes();
+ for (TCFNode n : arr) {
+ if (n instanceof IWatchInExpressions) continue;
+ return new TCFNode[0];
+ }
+ return arr;
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java
new file mode 100644
index 000000000..9fee2ceb9
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.model;
+
+import org.eclipse.tm.tcf.util.TCFDataCache;
+
+public interface IWatchInExpressions {
+
+ TCFDataCache<String> getExpressionText();
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
index 827347d04..a7b707f39 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
@@ -746,7 +746,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
for (TCFNode n : id2node.values()) n.flushAllCaches();
}
- IExpressionManager getExpressionManager() {
+ public IExpressionManager getExpressionManager() {
return expr_manager;
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
index 1e83da53b..666ae2aa1 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
@@ -44,7 +44,7 @@ import org.eclipse.tm.tcf.services.ISymbols;
import org.eclipse.tm.tcf.util.TCFDataCache;
import org.eclipse.tm.tcf.util.TCFTask;
-public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastToType {
+public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastToType, IWatchInExpressions {
// TODO: User commands: Add Global Variables, Remove Global Variables
// TODO: enable Change Value user command
@@ -434,7 +434,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
}
String parentName = "";
if (parent instanceof TCFNodeExpression) {
- TCFDataCache<String> parentText = ((TCFNodeExpression) parent).getExpressionText();
+ TCFDataCache<String> parentText = ((TCFNodeExpression)parent).getExpressionText();
if (!parentText.validate(this)) return false;
if (parentText.getData() != null) {
parentName = parenthesize(parentText.getData());

Back to the top