Package org.eclipse.text.edits

Examples of org.eclipse.text.edits.TextEdit.apply()


          + "is unmatched source/target/compliance version.");
      return;
    }

    IDocument doc = new Document(code);
    te.apply(doc);
    String formattedCode = doc.get();
    String formattedHash = md5hash(formattedCode);
    hashCache.setProperty(path, formattedHash);

    if (originalHash.equals(formattedHash)) {
View Full Code Here


      {
         TextEdit edit = codeFormatter.format(CodeFormatter.K_COMPILATION_UNIT,
                  contents, 0, contents.length(), 0, null);
         if (edit != null)
         {
            edit.apply(doc);
         }
         else
         {
            return contents;
         }
View Full Code Here

      Document document = new Document(this.document.get());

      try
      {
         TextEdit edit = unit.rewrite(document, null);
         edit.apply(document);
      }
      catch (Exception e)
      {
         throw new ParserException("Could not modify source: " + unit.toString(), e);
      }
View Full Code Here

   {
      Document document = new Document(this.document.get());

      try {
         TextEdit edit = unit.rewrite(document, null);
         edit.apply(document);
      }
      catch (Exception e) {
         throw new ParserException("Could not modify source: " + unit.toString(), e);
      }
View Full Code Here

   {
      Document document = new Document(this.document.get());

      try {
         TextEdit edit = unit.rewrite(document, null);
         edit.apply(document);
      }
      catch (Exception e) {
         throw new ParserException("Could not modify source: " + unit.toString(), e);
      }
     
View Full Code Here

      try
      {
         TextEdit edit = codeFormatter.format(CodeFormatter.K_COMPILATION_UNIT, contents, 0, contents.length(), 0, null);
         if (edit != null)
         {
            edit.apply(doc);
         }
         else
         {
            return contents;
         }
View Full Code Here

            // create delta
            TextEdit edit = codeFormatter.format(CodeFormatter.K_COMPILATION_UNIT, contents, 0, contents.length(), 0,
                    lineSeperator);

            // apply changes to content
            edit.apply(doc);

            BufferedWriter out = new BufferedWriter(new FileWriter(file));

            try {
                out.write(doc.get());
View Full Code Here

      // ask the textEditProvider for the change information
      TextEdit edit = textEditProvider.getTextEdit(document);

      // apply the changes to the document
      edit.apply(document);

      // write the changes from the buffer to the file
      textFileBuffer
          .commit(null /* ProgressMonitor */, false /* Overwrite */);

 
View Full Code Here

    }

    private void rewriteCompilationUnit(ASTRewrite rewrite, IDocument doc, ICompilationUnit originalUnit)
            throws JavaModelException, BadLocationException {
        TextEdit edits = rewrite.rewriteAST(doc, originalUnit.getJavaProject().getOptions(true));
        edits.apply(doc);

        originalUnit.getBuffer().setContents(doc.get());
        originalUnit.commitWorkingCopy(false, monitor);
    }
View Full Code Here

      // ask the textEditProvider for the change information
      TextEdit edit = textEditProvider.getTextEdit(document);

      // apply the changes to the document
      edit.apply(document);

    } catch (MalformedTreeException e) {
      e.printStackTrace();
    } catch (BadLocationException e) {
      e.printStackTrace();
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.