public void customizeDocumentCommand()

in ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/text/RutaAutoEditStrategy.java [855:903]


  public void customizeDocumentCommand(IDocument d, DocumentCommand c) {
    if (c.doit == false)
      return;
    if (c.length == 0 && c.text != null && isLineDelimiter(d, c.text)) {
      if (!isSmartMode()) {
        super.customizeDocumentCommand(d, c);
        return;
      }
      try {
        String indent = calcLineIndent(d, d.getLineOfOffset(c.offset) + 1, true, c.offset);
        if (indent == null)
          super.customizeDocumentCommand(d, c);
        else {
          c.text = c.text + indent;
        }
      } catch (BadLocationException e) {
        super.customizeDocumentCommand(d, c);
      }
      return;
    } else {
      if (c.length <= 1 && c.text.length() == 1) {
        switch (c.text.charAt(0)) {
          case ':':
            reindent(d, c);
            break;
          case '\"':
          case '\'':
          case '(':
          case '{':
          case '[':
          case '}':
          case ']':
          case ')':
            autoClose(d, c);
            break;
          case '\t':
            boolean jumped = false;
            if (isSmartTab()) {
              jumped = smartIndentJump(d, c);
            }
            if (!jumped) {
              c.text = getIndent();
            }
            break;
        }
      } else if (c.text.length() >= 1 && isSmartPaste())
        smartPaste(d, c); // no smart backspace for paste
    }
  }