Пример #1
0
    @Override
    public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {

      if (!textArea.isEditable() || !textArea.isEnabled()) {
        UIManager.getLookAndFeel().provideErrorFeedback(textArea);
        return;
      }

      RSyntaxTextArea rsta = (RSyntaxTextArea) getTextComponent(e);
      RSyntaxDocument doc = (RSyntaxDocument) rsta.getDocument();

      int line = textArea.getCaretLineNumber();
      int type = doc.getLastTokenTypeOnLine(line);
      if (type < 0) {
        type = doc.getClosestStandardTokenTypeForInternalType(type);
      }

      // Only in MLC's should we try this
      if (type == Token.COMMENT_DOCUMENTATION || type == Token.COMMENT_MULTILINE) {
        insertBreakInMLC(e, rsta, line);
      } else {
        handleInsertBreak(rsta, true);
      }
    }