diff options
author | Eugene Tarassov | 2011-11-24 21:38:04 +0000 |
---|---|---|
committer | Eugene Tarassov | 2011-11-24 21:38:04 +0000 |
commit | 32ef6d7f15016a690e8c0dea6bef284c90abbd9b (patch) | |
tree | a43b776d9c36cff21774ea27563a3569817188b3 /plugins | |
parent | 1a0485cdbbf014f03d9466fd84fdd51514466a1f (diff) | |
download | org.eclipse.tcf-32ef6d7f15016a690e8c0dea6bef284c90abbd9b.tar.gz org.eclipse.tcf-32ef6d7f15016a690e8c0dea6bef284c90abbd9b.tar.xz org.eclipse.tcf-32ef6d7f15016a690e8c0dea6bef284c90abbd9b.zip |
TCF Debugger: added command to open debug console.
Diffstat (limited to 'plugins')
5 files changed, 104 insertions, 1 deletions
diff --git a/plugins/org.eclipse.tcf.debug.ui/icons/console.gif b/plugins/org.eclipse.tcf.debug.ui/icons/console.gif Binary files differnew file mode 100644 index 000000000..a598f6082 --- /dev/null +++ b/plugins/org.eclipse.tcf.debug.ui/icons/console.gif diff --git a/plugins/org.eclipse.tcf.debug.ui/plugin.properties b/plugins/org.eclipse.tcf.debug.ui/plugin.properties index 3a99dbb9b..ad653cc8b 100644 --- a/plugins/org.eclipse.tcf.debug.ui/plugin.properties +++ b/plugins/org.eclipse.tcf.debug.ui/plugin.properties @@ -27,6 +27,7 @@ MemoryMap.label = Symbol Files... ViewMemory.label = View Memory WatchInExpressions.label = Watch In Expressions Refresh.label = Refresh +Console.label = Open Debug Console UpdatePolicy.label = Update Policy CastToType.label=Cast To Type... @@ -52,4 +53,4 @@ BackResume.label=Run Backwards BackResume.tooltip=Run Backwards BackResume.description=Run backwards -propertyPage.name = Debug Element +propertyPage.name = Debug Element
\ No newline at end of file diff --git a/plugins/org.eclipse.tcf.debug.ui/plugin.xml b/plugins/org.eclipse.tcf.debug.ui/plugin.xml index 5d0454c1a..4c9ccd3da 100644 --- a/plugins/org.eclipse.tcf.debug.ui/plugin.xml +++ b/plugins/org.eclipse.tcf.debug.ui/plugin.xml @@ -282,6 +282,19 @@ </pluginState> </enablement> </action> + <action + id="org.eclipse.tcf.debug.ui.actions.Console" + class="org.eclipse.tcf.internal.debug.ui.commands.ConsoleCommand" + icon="icons/console.gif" + label="%Console.label" + menubarPath="additions"> + <enablement> + <pluginState + value="activated" + id="org.eclipse.tcf.debug.ui"> + </pluginState> + </enablement> + </action> </objectContribution> <!-- TCFNodeExpression popup menu contributions --> diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ConsoleCommand.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ConsoleCommand.java new file mode 100644 index 000000000..e21cd8aee --- /dev/null +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ConsoleCommand.java @@ -0,0 +1,21 @@ +package org.eclipse.tcf.internal.debug.ui.commands; + +import org.eclipse.tcf.internal.debug.ui.model.TCFNode; + +public class ConsoleCommand extends AbstractActionDelegate { + + @Override + protected void selectionChanged() { + getAction().setEnabled(getNode() != null); + } + + @Override + protected void run() { + // TODO Auto-generated method stub + + } + + private TCFNode getNode() { + return null; + } +} diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/cmdline/TCFCommandLine.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/cmdline/TCFCommandLine.java new file mode 100644 index 000000000..eb103f1b7 --- /dev/null +++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/cmdline/TCFCommandLine.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * 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.tcf.internal.debug.cmdline; + +import org.eclipse.tcf.util.TCFTask; + +public class TCFCommandLine { + + private static final class CommandInfo { + final String name; + final Class<?> cls; + + CommandInfo(String name, Class<?> cls) { + this.name = name; + this.cls = cls; + } + } + + private static final CommandInfo[] command_list = { + new CommandInfo("step", CommandStep.class), + }; + + private class CommandStep extends TCFTask<String> { + + public void run() { + done("OK"); + } + } + + public String command(String cmd) { + try { + int i = 0; + int l = cmd.length(); + StringBuffer bf = new StringBuffer(); + while (i < l) { + char ch = cmd.charAt(i); + if (ch == ' ' || ch == '#') break; + bf.append(ch); + } + if (bf.length() > 0) { + CommandInfo cmd_info = null; + String name = bf.toString(); + for (CommandInfo c : command_list) { + if (c.name.startsWith(name)) { + if (cmd_info != null) return "Ambiguous command"; + cmd_info = c; + } + } + if (cmd_info == null) return "Unknown command"; + @SuppressWarnings("unchecked") + TCFTask<String> task = (TCFTask<String>)cmd_info.cls.getConstructors()[0].newInstance(this); + return task.get(); + } + } + catch (Throwable x) { + return x.getMessage(); + } + return null; + } +} |