/plugins/GdbPlugin/tags/release-0-5/gdb/output/MIShell.java

# · Java · 70 lines · 40 code · 12 blank · 18 comment · 3 complexity · e17a6bdb0845cc346228a849e144757c MD5 · raw file

  1. /*
  2. Copyright (C) 2007 Shlomy Reinstein
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. */
  15. package gdb.output;
  16. import gdb.core.CommandManager;
  17. import javax.swing.JOptionPane;
  18. import org.gjt.sp.jedit.jEdit;
  19. import console.Console;
  20. import console.Output;
  21. import debugger.jedit.Plugin;
  22. public class MIShell extends BaseShell {
  23. static final String PREFIX = Plugin.OPTION_PREFIX;
  24. static final String MI_SHELL_INFO_MSG_PROP = PREFIX + "mi_shell_info_msg";
  25. public static final String NAME = "GDB/MI";
  26. public MIShell() {
  27. super(NAME);
  28. }
  29. public MIShell(String arg0) {
  30. super(arg0);
  31. }
  32. public void printInfoMessage (Output output) {
  33. output.print(getConsole().getPlainColor(),
  34. jEdit.getProperty(MI_SHELL_INFO_MSG_PROP));
  35. }
  36. public void printPrompt(Console console, Output output)
  37. {
  38. // No prompt - prompt given by gdb/mi itself
  39. }
  40. public void append(String s) {
  41. if (s.endsWith("\n"))
  42. s = s.substring(0, s.length() - 1);
  43. print(s);
  44. }
  45. @Override
  46. public void execute(Console console, String input,
  47. Output output, Output error, String command) {
  48. CommandManager cmdMgr = getCommandManager();
  49. if (cmdMgr != null)
  50. cmdMgr.add(command);
  51. else
  52. JOptionPane.showMessageDialog(jEdit.getActiveView(),
  53. jEdit.getProperty(DEBUGGER_NOT_STARTED));
  54. }
  55. }