Esempio n. 1
0
  public void systemChanged(final ProcessWrapper pProcess, final Command pCmd, final int pEvent) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              systemChanged(pProcess, pCmd, pEvent);
            }
          });
      return;
    }

    if (pProcess != selected) {
      return;
    }
    commands.fireTableDataChanged();

    if (pEvent == ControlListener.COMMAND_ADDED) {
      int last = commands.getRowCount() - 1;
      cmdTable.setRowSelectionInterval(last, last);
    } else if (pEvent == ControlListener.COMMAND_UPDATED) {
      // Prevent selection loss
      int selectedRow = commands.find(pCmd);
      cmdTable.setRowSelectionInterval(selectedRow, selectedRow);
    }
  }
Esempio n. 2
0
 public void batchMode(String[] args, PrintStream err) {
   String commandLine = StringUtils.join(Arrays.asList(args), " ");
   try {
     table.executeCommandLine(commandLine);
   } catch (IOException ioe) {
     err.println(ioe.getMessage());
     System.exit(1);
   }
 }
Esempio n. 3
0
 public void interactiveMode(InputStream in, PrintStream ps, PrintStream err) {
   Scanner scanner = new Scanner(in);
   ps.print("$ ");
   while (scanner.hasNext()) {
     try {
       table.executeCommandLine(scanner.nextLine());
     } catch (IOException ioe) {
       err.println(ioe.getMessage());
     }
     ps.print("$ ");
   }
 }