Package org.eclipse.wst.jsdt.core.formatter

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


    }
    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

Related Classes of org.eclipse.wst.jsdt.core.formatter.CodeFormatter

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.