Examples of insertString()


Examples of com.intellij.openapi.editor.Document.insertString()

    Document doc = editor.getDocument();
    if (element instanceof CompoundExpression && element.getTextOffset()+element.getTextLength() == editor.getCaretModel().getOffset()) {
      final PsiElement lastChild = element.getLastChild();
      if (!lastChild.getNode().getElementType().equals(SEMICOLON)) {
        final int offset = lastChild.getTextOffset() + lastChild.getTextLength();
        doc.insertString(offset, ";\n");
        editor.getCaretModel().moveToOffset(offset + 2);
      }
    }
  }
}
View Full Code Here

Examples of com.intellij.openapi.editor.Document.insertString()

        if (prevSibling != null) {
          final int textOffset = prevSibling.getTextOffset();
          if (prevSibling.getNode().getElementType() == COMMA) {
            doc.replaceString(textOffset, textOffset + 1, "]");
          } else {
            doc.insertString(textOffset + prevSibling.getTextLength(), "]");
          }
        }
        return;
      }
      PsiElement prevSibling = lastChild.getPrevSibling();
View Full Code Here

Examples of com.intellij.openapi.editor.Document.insertString()

      PsiElement prevSibling = lastChild.getPrevSibling();
      while (prevSibling != null && prevSibling instanceof PsiWhiteSpace) {
        prevSibling = prevSibling.getPrevSibling();
      }
      if (prevSibling != null && prevSibling.getNode().getElementType() == COMMA) {
        doc.insertString(prevSibling.getTextOffset() + 1, "\n\n");
        editor.getCaretModel().moveToOffset(prevSibling.getTextOffset() + 2);
        processor.commit(editor);
//          return;
      }
//      editor.getCaretModel().moveToOffset(lastChild.getTextOffset() + 1, true);
View Full Code Here

Examples of com.intellij.openapi.editor.Document.insertString()

    if (completionChar == Lookup.COMPLETE_STATEMENT_SELECT_CHAR) {
      SymbolInformationProvider.SymbolInformation symbol = SymbolInformationProvider.getSymbolNames().get(item.getLookupString());
      boolean insertBrackets = (symbol != null) && symbol.function;
      if (insertBrackets) {
        document.insertString(context.getTailOffset(), Character.toString(OPEN_BRACKET));
        editor.getCaretModel().moveToOffset(context.getTailOffset());
        document.insertString(context.getTailOffset(), Character.toString(CLOSING_BRACKET));
      } else {
        document.insertString(context.getTailOffset(), " ");
        editor.getCaretModel().moveToOffset(context.getTailOffset());
View Full Code Here

Examples of com.intellij.openapi.editor.Document.insertString()

      SymbolInformationProvider.SymbolInformation symbol = SymbolInformationProvider.getSymbolNames().get(item.getLookupString());
      boolean insertBrackets = (symbol != null) && symbol.function;
      if (insertBrackets) {
        document.insertString(context.getTailOffset(), Character.toString(OPEN_BRACKET));
        editor.getCaretModel().moveToOffset(context.getTailOffset());
        document.insertString(context.getTailOffset(), Character.toString(CLOSING_BRACKET));
      } else {
        document.insertString(context.getTailOffset(), " ");
        editor.getCaretModel().moveToOffset(context.getTailOffset());
      }
View Full Code Here

Examples of com.intellij.openapi.editor.Document.insertString()

      if (insertBrackets) {
        document.insertString(context.getTailOffset(), Character.toString(OPEN_BRACKET));
        editor.getCaretModel().moveToOffset(context.getTailOffset());
        document.insertString(context.getTailOffset(), Character.toString(CLOSING_BRACKET));
      } else {
        document.insertString(context.getTailOffset(), " ");
        editor.getCaretModel().moveToOffset(context.getTailOffset());
      }

    }
View Full Code Here

Examples of com.intellij.openapi.editor.Document.insertString()

        CaretModel caretModel = editor.getCaretModel();
        int startOffset = insertionContext.getStartOffset();
        char completionChar = insertionContext.getCompletionChar();

        int endOffset = startOffset + lookupElement.getLookupString().length();
        document.insertString(endOffset, "()");

        if (completionChar == ' ') {
            caretModel.moveCaretRelatively(3, 0, false, false, false);
        } else {
            caretModel.moveCaretRelatively(1, 0, false, false, false);
View Full Code Here

Examples of com.intellij.openapi.editor.ex.DocumentEx.insertString()

          });
          setLeftGreedy(leftGreedyMarker, false);
          setRightGreedy(emptyMarkers, true);

          // workaround for shifting empty ranges to the left
          document.insertString(lineOffset, " ");
          document.insertString(lineOffset, PRIVATE);
          document.deleteString(lineOffset + PRIVATE.length(), lineOffset + PRIVATE.length() + 1);
         
          setLeftGreedy(leftGreedyMarker, true);
          setRightGreedy(emptyMarkers, false);
View Full Code Here

Examples of com.sun.star.text.XSimpleText.insertString()

            xEx.setSourceDocument(xTextDoc);

            // text added to the document
            XSimpleText aText = xTextDoc.getText();
            XTextCursor curs = (XTextCursor) aText.createTextCursor();
            aText.insertString(curs, CONTENT, false);
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log) ;
            throw new StatusException("Can't create component.", e) ;
        }
View Full Code Here

Examples of com.sun.star.text.XText.insertString()

        XTextCursor oCursor = oText.createTextCursor();

        log.println( "inserting some lines" );
        try {
            for (int i=0; i<5; i++){
                oText.insertString( oCursor,"Paragraph Number: " + i, false);
                oText.insertControlCharacter(
                        oCursor, ControlCharacter.PARAGRAPH_BREAK, false );
            }
        } catch ( com.sun.star.lang.IllegalArgumentException e ){
            e.printStackTrace((PrintWriter)log);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.