Examples of CodeFormatter


Examples of org.eclipse.jdt.core.formatter.CodeFormatter

   public static String format(String source)
   {
       // TODO locate user's eclipse project settings, use those if we can.
       Properties options = readConfig("org.eclipse.jdt.core.prefs");

       final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(options);
       return ensureCorrectNewLines(formatFile(source, codeFormatter));
   }
View Full Code Here

Examples of org.eclipse.wst.jsdt.core.formatter.CodeFormatter

            // JSNI Java references mess up the JS formatter, so replace them
            // with place holder values
            JsniJavaRefReplacementResult replacementResults = replaceJsniJavaRefs(body);
            body = replacementResults.getJsni();
            CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(javaScriptFormattingPrefs);

            TextEdit formatEdit = codeFormatter.format(CodeFormatter.K_STATEMENTS, body, 0, body.length(),
                    methodIndentLevel + 1, lineDelimiter);

            if (formatEdit != null) {

                body = restoreJsniJavaRefs(replacementResults);
View Full Code Here

Examples of org.eclipse.wst.jsdt.core.formatter.CodeFormatter

    }
    return convertResult(sourceString, textEdit);
  }

  private TextEdit jsdtFormat(String sourceString) {
    CodeFormatter jsdtFormatter = ToolFactory.createCodeFormatter(
        JavaScriptCore.getDefaultOptions());

    TextEdit textEdit = jsdtFormatter.format(CodeFormatter.K_JAVASCRIPT_UNIT,
        sourceString, 0, sourceString.length(), 0, LINE_END_STRING);
    return textEdit;
  }
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.