예제 #1
0
    public void keyPressed(KeyEvent keyEvent) {
      AppLogger.finest(
          "keyModifiers=" + keyEvent.getModifiers() + " keyCode=" + keyEvent.getKeyCode());

      int keyCode = keyEvent.getKeyCode();
      if (keyCode == KeyEvent.VK_SHIFT
          || keyCode == KeyEvent.VK_CONTROL
          || keyCode == KeyEvent.VK_ALT
          || keyCode == KeyEvent.VK_META) return;

      KeyStroke pressedKeyStroke = KeyStroke.getKeyStrokeForEvent(keyEvent);

      if (pressedKeyStroke.equals(lastKeyStroke)) {
        TableCellEditor activeCellEditor = getCellEditor();
        if (activeCellEditor != null) activeCellEditor.stopCellEditing();
      } else {
        String actionId;
        if ((actionId = data.contains(pressedKeyStroke)) != null) {
          String errorMessage =
              "The shortcut ["
                  + KeyStrokeUtils.getKeyStrokeDisplayableRepresentation(pressedKeyStroke)
                  + "] is already assigned to '"
                  + ActionProperties.getActionDescription(actionId)
                  + "'";
          tooltipBar.showErrorMessage(errorMessage);
          createCancelEditingStateThread(getCellEditor());
        } else {
          lastKeyStroke = pressedKeyStroke;
          setText(KeyStrokeUtils.getKeyStrokeDisplayableRepresentation(lastKeyStroke));
        }
      }

      keyEvent.consume();
    }
예제 #2
0
    @Override
    public void setValueAt(Object value, int row, int column) {
      // if no keystroke was pressed
      if (value == null) return;
      // if the user pressed a keystroke that is used to indicate a delete operation should be made
      else if (value == DELETE) value = null;

      KeyStroke typedKeyStroke = (KeyStroke) value;
      switch (column) {
        case ACCELERATOR_COLUMN_INDEX:
          tableData.setAccelerator(typedKeyStroke, row);
          break;
        case ALTERNATE_ACCELERATOR_COLUMN_INDEX:
          tableData.setAlternativeAccelerator(typedKeyStroke, row);
          break;
        default:
          AppLogger.fine("Unexpected column index: " + column);
      }

      fireTableCellUpdated(row, column);

      AppLogger.finest("Value: " + value + ", row: " + row + ", col: " + column);
    }
예제 #3
0
 /** Prints out the process output. */
 public void processOutput(String output) {
   AppLogger.finest(command + ": " + output);
 }
예제 #4
0
 /** Ignored. */
 public void processOutput(byte[] buffer, int offset, int length) {
   AppLogger.finest(command + ": " + new String(buffer, offset, length));
 }