Package com.intellij.openapi.editor.impl

Examples of com.intellij.openapi.editor.impl.DocumentImpl


        return PSQLFileType.INSTANCE;
    }

    @NotNull
    public Document createDocument(@NotNull Project project, @NotNull String text, @Nullable XSourcePosition sourcePosition, @NotNull EvaluationMode evaluationMode) {
        return new DocumentImpl(text);
    }
View Full Code Here


        return new DocumentImpl(text);
    }

    @NotNull
    public Document createDocument(@NotNull Project project, @NotNull String text, @Nullable XSourcePosition sourcePosition) {
        return new DocumentImpl(text);
    }
View Full Code Here

   * @param fileName - name of the file.
   * @param fileText - data file text.
   * @throws IOException
   */
  protected static void configureFromFileText(@NonNls final String fileName, @NonNls String fileText) throws IOException {
    final Document fakeDocument = new DocumentImpl(fileText);

    int caretIndex = fileText.indexOf(CARET_MARKER);
    int selStartIndex = fileText.indexOf(SELECTION_START_MARKER);
    int selEndIndex = fileText.indexOf(SELECTION_END_MARKER);

    final RangeMarker caretMarker = caretIndex >= 0 ? fakeDocument.createRangeMarker(caretIndex, caretIndex) : null;
    final RangeMarker selStartMarker = selStartIndex >= 0 ? fakeDocument.createRangeMarker(selStartIndex, selStartIndex) : null;
    final RangeMarker selEndMarker = selEndIndex >= 0 ? fakeDocument.createRangeMarker(selEndIndex, selEndIndex) : null;

    if (caretMarker != null) {
      fakeDocument.deleteString(caretMarker.getStartOffset(), caretMarker.getStartOffset() + CARET_MARKER.length());
    }
    if (selStartMarker != null) {
      fakeDocument.deleteString(selStartMarker.getStartOffset(),
                                selStartMarker.getStartOffset() + SELECTION_START_MARKER.length());
    }
    if (selEndMarker != null) {
      fakeDocument.deleteString(selEndMarker.getStartOffset(),
                                selEndMarker.getStartOffset() + SELECTION_END_MARKER.length());
    }

    String newFileText = fakeDocument.getText();
    setupFileEditorAndDocument(fileName, newFileText);
    setupCaret(caretMarker, newFileText);
    setupSelection(selStartMarker, selEndMarker);
    setupEditorForInjectedLanguage();
  }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.editor.impl.DocumentImpl

Copyright © 2018 www.massapicom. 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.