Package org.eclipse.text.edits

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


      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


      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

          CodeFormatter.K_COMPILATION_UNIT
              | CodeFormatter.F_INCLUDE_COMMENTS, contents, 0,
          contents.length(), 0, null );
      if( edit != null )
      {
        edit.apply( doc );
      } else
      {
        System.err.println( Messages.bind( Messages.FormatProblem,
            file.getAbsolutePath() ) );
        return;
View Full Code Here

          CodeFormatter.K_COMPILATION_UNIT
              | CodeFormatter.F_INCLUDE_COMMENTS, contents, 0,
          contents.length(), 0, lineSeparator );
      if( edit != null )
      {
        edit.apply( doc );
      } else
      {
        throw new RuntimeException( Messages.bind(
            Messages.FormatProblem, file.getAbsolutePath() ) );
      }
View Full Code Here

          CodeFormatter.K_COMPILATION_UNIT
              | CodeFormatter.F_INCLUDE_COMMENTS, contents,
          startOffset, endOffset, 0, lineSeparator );
      if( edit != null )
      {
        edit.apply( doc );
      } else
      {
        throw new RuntimeException(
            "formatting failed, probably due to not compilable code or wrong config file" );
      }
View Full Code Here

            if (formatEdit != null) {

                body = restoreJsniJavaRefs(replacementResults);

                Document d = new Document(body);
                formatEdit.apply(d);

                formattedJs = d.get();

                if (!formattedJs.startsWith(lineDelimiter)) {
                    formattedJs = lineDelimiter + formattedJs;
View Full Code Here

        IDocument document = new org.eclipse.jface.text.Document(text);

        TextEdit formatEdit = format(document, range);


        formatEdit.apply(document);
        documentIJ.setText(document.get());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
View Full Code Here

      TextEdit formatEdit = jsCodeFormatterFacade.format(CodeFormatter.K_JAVA_DOC, jsniSource, 0, jsniSource.length(),
          methodIndentLevel, lineDelimiter);

      org.eclipse.jface.text.Document d = new org.eclipse.jface.text.Document(jsniSource);
      formatEdit.apply(d);

      formattedJs = d.get();

//      if (!formattedJs.startsWith(lineDelimiter)) {
//        formattedJs = indentLine+formattedJs  ;
View Full Code Here

       */
      TextEdit edit = getCodeFormatter().format(
          CodeFormatter.K_JAVASCRIPT_UNIT, text, startOffset,
          endOffset - startOffset, 0, Settings.LINE_SEPARATOR);
      if (edit != null) {
        edit.apply(doc);
      } else {
        throw new FormattingFailedException();
      }

      return doc.get();
View Full Code Here

       */
      TextEdit edit = getCodeFormatter().format(
          kJavascriptUnit, text, startOffset,
          endOffset - startOffset, 0, Settings.LINE_SEPARATOR);
      if (edit != null) {
        edit.apply(doc);
      } else {
        throw new FormattingFailedException();
      }

      return doc.get();
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.