Package org.eclipse.text.edits

Examples of org.eclipse.text.edits.TextEdit


        public String addStaticImport(String declaringTypeName, String simpleName, boolean isField) {
            return fImportsRewrite.addStaticImport(declaringTypeName, simpleName, isField);
        }

        /* package */void create(boolean needsSave, IProgressMonitor monitor) throws CoreException {
            TextEdit edit = fImportsRewrite.rewriteImports(monitor);
            JavaModelUtil.applyEdit(fImportsRewrite.getCompilationUnit(), edit, needsSave, null);
        }
View Full Code Here


    }
    this.preferences.initial_indentation_level = indentationLevel;

    this.newCodeFormatter = new CodeFormatterVisitor(this.preferences, this.options, regions, this.codeSnippetParsingUtil, includeComments);

    TextEdit textEdit = this.newCodeFormatter.format(source, expression);
    return textEdit;
  }
View Full Code Here

  final void doCopySourcePreVisit(CopySourceInfo[] infos, Stack nodeEndStack) {
    if (infos != null) {
      for (int i= 0; i < infos.length; i++) {
        CopySourceInfo curr= infos[i];
        TextEdit edit= getCopySourceEdit(curr);
        addEdit(edit);
        this.currentEdit= edit;
        nodeEndStack.push(curr.getNode());
      }
    }
View Full Code Here

    return internalRewriteAST(content, lineInfo, lineDelim, astRoot.getCommentList(), options, rootNode, (RecoveryScannerData)astRoot.getStatementsRecoveryData());
  }

  private TextEdit internalRewriteAST(char[] content, LineInformation lineInfo, String lineDelim, List commentNodes, Map options, ASTNode rootNode, RecoveryScannerData recoveryScannerData) {
    TextEdit result= new MultiTextEdit();
    //validateASTNotModified(rootNode);

    TargetSourceRangeComputer sourceRangeComputer= getExtendedSourceRangeComputer();
    this.eventStore.prepareMovedNodes(sourceRangeComputer);
View Full Code Here

   * @param options the given options
   * @throws IllegalArgumentException if the rewrite fails
   * @return Returns the edit describing the text changes.
   */
  public TextEdit rewriteAST(IDocument document, Map options) {
    TextEdit result = new MultiTextEdit();

    final CompilationUnit rootNode = getRootNode();
    if (rootNode != null) {
      TargetSourceRangeComputer xsrComputer = new TargetSourceRangeComputer() {
        /**
 
View Full Code Here

          String curr= (String) this.removedImports.get(i);
          computer.removeImport(curr.substring(1), STATIC_PREFIX == curr.charAt(0));
        }
      }

      TextEdit result= computer.getResultingEdits(new SubProgressMonitor(monitor, 1));
      this.createdImports= computer.getCreatedImports();
      this.createdStaticImports= computer.getCreatedStaticImports();
      return result;
    } finally {
      monitor.done();
View Full Code Here

    TargetSourceRangeComputer.SourceRange range= getExtendedRange(node);
    return range.getStartPosition() + range.getLength();
  }

  final TextEdit getCopySourceEdit(CopySourceInfo info) {
    TextEdit edit= (TextEdit) this.sourceCopyInfoToEdit.get(info);
    if (edit == null) {
      SourceRange range= getExtendedRange(info.getNode());
      int start= range.getStartPosition();
      int end= start + range.getLength();
      if (info.isMove) {
View Full Code Here

  final void doTextInsert(int offset, String insertString, TextEditGroup editGroup) {
    if (insertString.length() > 0) {
      // bug fix for 95839: problem with inserting at the end of a line comment
      if (this.lineCommentEndOffsets.isEndOfLineComment(offset, this.content)) {
        if (!insertString.startsWith(getLineDelimiter())) {
          TextEdit edit= new InsertEdit(offset, getLineDelimiter())// add a line delimiter
          addEdit(edit);
          if (editGroup != null) {
            addEditGroup(editGroup, edit);
          }
        }
        this.lineCommentEndOffsets.remove(offset); // only one line delimiter per line comment required
      }
      TextEdit edit= new InsertEdit(offset, insertString);
      addEdit(edit);
      if (editGroup != null) {
        addEditGroup(editGroup, edit);
      }
    }
View Full Code Here

  final TextEdit doTextRemove(int offset, int len, TextEditGroup editGroup) {
    if (len == 0) {
      return null;
    }
    TextEdit edit= new DeleteEdit(offset, len);
    addEdit(edit);
    if (editGroup != null) {
      addEditGroup(editGroup, edit);
    }
    return edit;
View Full Code Here

    }
    return edit;
  }

  final void doTextRemoveAndVisit(int offset, int len, ASTNode node, TextEditGroup editGroup) {
    TextEdit edit= doTextRemove(offset, len, editGroup);
    if (edit != null) {
      this.currentEdit= edit;
      voidVisit(node);
      this.currentEdit= edit.getParent();
    } else {
      voidVisit(node);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.text.edits.TextEdit

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.