diff options
7 files changed, 144 insertions, 3 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties index 3db3f828c..0e589bff7 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties +++ b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties @@ -19,6 +19,7 @@ DebuggerActionSet.label = TCF Debugger Signals.label = Signals... MemoryMap.label = Symbol Files... ViewMemory.label = View Memory +WatchInExpressions.label = Watch In Expressions Refresh.label = Refresh CastToType.label=Cast To Type... diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml index fc8d552b8..b064e589f 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml +++ b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml @@ -223,6 +223,12 @@ icon="icons/signals.gif" label="%Signals.label" menubarPath="additions"> + <enablement> + <pluginState + value="activated" + id="org.eclipse.tm.tcf.debug.ui"> + </pluginState> + </enablement> </action> <action id="org.eclipse.tm.tcf.debug.ui.actions.MemoryMap" @@ -230,12 +236,24 @@ icon="icons/memory-map.gif" label="%MemoryMap.label" menubarPath="additions"> + <enablement> + <pluginState + value="activated" + id="org.eclipse.tm.tcf.debug.ui"> + </pluginState> + </enablement> </action> <action id="org.eclipse.tm.tcf.debug.ui.actions.Refresh" class="org.eclipse.tm.internal.tcf.debug.ui.commands.RefreshCommand" label="%Refresh.label" menubarPath="additions"> + <enablement> + <pluginState + value="activated" + id="org.eclipse.tm.tcf.debug.ui"> + </pluginState> + </enablement> </action> </objectContribution> @@ -248,6 +266,12 @@ class="org.eclipse.tm.internal.tcf.debug.ui.commands.ViewMemoryCommand" label="%ViewMemory.label" menubarPath="variableGroup"> + <enablement> + <pluginState + value="activated" + id="org.eclipse.tm.tcf.debug.ui"> + </pluginState> + </enablement> </action> </objectContribution> @@ -303,6 +327,24 @@ </enablement> </action> </objectContribution> + + <!-- IWatchInExpressions --> + <objectContribution + id="org.eclipse.tm.tcf.debug.ui.WatchInExpressions" + objectClass="org.eclipse.tm.internal.tcf.debug.ui.model.IWatchInExpressions"> + <action + id="org.eclipse.tm.tcf.debug.ui.actions.WatchInExpressions" + class="org.eclipse.tm.internal.tcf.debug.ui.commands.WatchInExpressionsCommand" + label="%WatchInExpressions.label" + menubarPath="additions"> + <enablement> + <pluginState + value="activated" + id="org.eclipse.tm.tcf.debug.ui"> + </pluginState> + </enablement> + </action> + </objectContribution> </extension> <extension 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()); |