Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.DocumentRewriteSession


   */
  private void smartPaste(IDocument d, DocumentCommand c) {
    try {
      String content = d.get(0, c.offset) + c.text;
      Document temp = new Document(content);
      DocumentRewriteSession session = temp
              .startRewriteSession(DocumentRewriteSessionType.STRICTLY_SEQUENTIAL);
      installStuff(temp);
      int offset = c.offset;
      int line = temp.getLineOfOffset(offset);
      String lastIndent = getLineIndent(temp, line);
View Full Code Here


   */
  protected void processAction(ITextEditor textEditor,
      final IStructuredDocument document, ITextSelection textSelection) {
   
    IStructuredModel model = null;
    DocumentRewriteSession session = null;
    boolean changed = false;
   
    try {
      // get text selection lines info
      int selectionStartLine = textSelection.getStartLine();
View Full Code Here

        cursorPosition = selection.x;
        selectionLength = selection.y - selection.x;
        endRecording(cursorPosition, selectionLength);
        break;
      case FORMAT_DOCUMENT :
        DocumentRewriteSession rewriteSession = null;
        IDocument document = getDocument();
        try {
          /*
           * This command will actually format selection if text is
           * selected, otherwise format entire document
View Full Code Here

   */
  protected void processAction(ITextEditor textEditor, IStructuredDocument document, ITextSelection textSelection) {
   
    IStructuredModel model = null;
    boolean changed = false;
    DocumentRewriteSession session = null;
    try {
      model = StructuredModelManager.getModelManager().getModelForEdit(document);
     
      if(model != null) {
        //makes it so one undo will undo all the edits to the document
View Full Code Here

   *   org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.IDocument, org.eclipse.jface.text.ITextSelection)
   */
  protected void processAction(ITextEditor textEditor, IStructuredDocument document, ITextSelection textSelection) {
    IStructuredModel model = null;
    boolean changed = false;
    DocumentRewriteSession session = null;
   
    try {
      model = StructuredModelManager.getModelManager().getModelForEdit(document);
      if(model != null) {
        //makes it so one undo will undo all the edits to the document
View Full Code Here

        cursorPosition = selection.x;
        selectionLength = selection.y - selection.x;
        endRecording(cursorPosition, selectionLength);
        break;
      case FORMAT_DOCUMENT :
        DocumentRewriteSession rewriteSession = null;
        IDocument document = getDocument();
        try {
          /*
           * This command will actually format selection if text is
           * selected, otherwise format entire document
View Full Code Here

  public void formatModel(IStructuredModel structuredModel, int start, int length) {
    if(fProgressMonitor != null)
      fProgressMonitor.beginTask("", 2);
    IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
    DocumentRewriteSession activeRewriteSession = ((IDocumentExtension4) structuredDocument).getActiveRewriteSession();
    boolean startedRewriteSession = false;
    if (activeRewriteSession == null) {
      activeRewriteSession = ((IDocumentExtension4) structuredDocument).startRewriteSession(DocumentRewriteSessionType.UNRESTRICTED);
      startedRewriteSession = true;
    }
View Full Code Here

        {
          final Point selection= rememberSelection();
          final IRewriteTarget target= getRewriteTarget();
          final IDocument document= getDocument();
          IFormattingContext context= null;
          DocumentRewriteSession rewriteSession= null;

          if (document instanceof IDocumentExtension4) {
            IDocumentExtension4 extension= (IDocumentExtension4) document;
            DocumentRewriteSessionType type= selection.y == 0 || selection.y > 1000 ? DocumentRewriteSessionType.SEQUENTIAL : DocumentRewriteSessionType.UNRESTRICTED_SMALL;
            rewriteSession= extension.startRewriteSession(type);
View Full Code Here

import org.eclipse.text.edits.TextEdit;

public class WodDocumentUtils {
  public static void applyEdits(IDocument document, List<TextEdit> edits) throws MalformedTreeException, BadLocationException {
    IDocumentExtension4 doc4 = (IDocumentExtension4) document;
    DocumentRewriteSession rewriteSession = doc4.startRewriteSession(DocumentRewriteSessionType.UNRESTRICTED);
    try {
      MultiTextEdit multiEdit = new MultiTextEdit();
      for (TextEdit edit : edits) {
        multiEdit.addChild(edit);
      }
View Full Code Here

   */
  private void smartPaste(IDocument d, DocumentCommand c) {
    try {
      String content = d.get(0, c.offset) + c.text;
      Document temp = new Document(content);
      DocumentRewriteSession session = temp
              .startRewriteSession(DocumentRewriteSessionType.STRICTLY_SEQUENTIAL);
      installStuff(temp);
      int offset = c.offset;
      int line = temp.getLineOfOffset(offset);
      String lastIndent = getLineIndent(temp, line);
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.DocumentRewriteSession

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.