Package org.eclipse.text.edits

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


      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


            ISelection selection= getSelection();
            int length= e.text.length();
            if (length == 0 && e.character == '\0') {
              // backspace in StyledText block selection mode...
              TextEdit edit= processor.backspace(selection);
              edit.apply(fDocument, TextEdit.UPDATE_REGIONS);
              ISelection empty= processor.makeEmpty(selection, true);
              setSelection(empty);
            } else {
              int lines= processor.getCoveredLines(selection);
              String delim= fDocument.getLegalLineDelimiters()[0];
View Full Code Here

    rewrite = ASTRewrite.create(cu.getAST());
    cu.accept(new XQASTVisitor());

    TextEdit edits = cu.rewrite(doc, null);
    try {
      edits.apply(doc);
    } catch (MalformedTreeException e) {
      e.printStackTrace();
    } catch (BadLocationException e) {
      e.printStackTrace();
    }
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

         @SuppressWarnings("rawtypes")
         Map options = JavaCore.getOptions();
         options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7);
         options.put(CompilerOptions.OPTION_Encoding, "UTF-8");
         TextEdit edit = unit.rewrite(document, options);
         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

    rewrite = ASTRewrite.create(cu.getAST());
    cu.accept(new XQASTVisitor());

    TextEdit edits = cu.rewrite(doc, null);
    try {
      edits.apply(doc);
    } catch (MalformedTreeException e) {
      e.printStackTrace();
    } catch (BadLocationException e) {
      e.printStackTrace();
    }
View Full Code Here

    TextEdit te = codeFormatter.format(CodeFormatter.K_COMPILATION_UNIT
        + CodeFormatter.F_INCLUDE_COMMENTS, compilationUnit, 0,
        compilationUnit.length(), 0, lineSeparator);
    IDocument doc = new Document(compilationUnit);
    try {
      te.apply(doc);
    } catch (MalformedTreeException e) {
      logger.log(Level.SEVERE, ExceptionUtils.getStackTrace(e));
    } catch (BadLocationException e) {
      logger.log(Level.SEVERE, ExceptionUtils.getStackTrace(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

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.