Examples of CodeFormatter


Examples of org.apache.cocoon.components.language.programming.CodeFormatter

        }

        String encoding = markupLanguage.getEncoding();

        // Format source code if applicable
        CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
        if (codeFormatter != null) {
            code = codeFormatter.format(code, encoding);
        }

        // Store generated code
        final File sourceFile = new File(this.workDir, normalizedName + "." + programmingLanguage.getSourceExtension());
        final File sourceDir = sourceFile.getParentFile();
View Full Code Here

Examples of org.apache.cocoon.components.language.programming.CodeFormatter

        }

        String encoding = markupLanguage.getEncoding();

        // Format source code if applicable
        CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
        if (codeFormatter != null) {
            code = codeFormatter.format(code, encoding);
        }

        // Store generated code
        final File sourceFile = new File(this.workDir, normalizedName + "." + programmingLanguage.getSourceExtension());
        final File sourceDir = sourceFile.getParentFile();
View Full Code Here

Examples of org.apache.cocoon.components.language.programming.CodeFormatter

        }

        String encoding = markupLanguage.getEncoding();

        // Format source code if applicable
        CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
        if (codeFormatter != null) {
            code = codeFormatter.format(code, encoding);
        }

        // Store generated code
        final File sourceFile = new File(this.workDir, normalizedName + "." + programmingLanguage.getSourceExtension());
        final File sourceDir = sourceFile.getParentFile();
View Full Code Here

Examples of org.apache.cocoon.components.language.programming.CodeFormatter

        }

        String encoding = markupLanguage.getEncoding();

        // Format source code if applicable
        CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
        if (codeFormatter != null) {
            code = codeFormatter.format(code, encoding);
        }

        // Store generated code
        final File sourceFile = new File(this.workDir, normalizedName + "." + programmingLanguage.getSourceExtension());
        final File sourceDir = sourceFile.getParentFile();
View Full Code Here

Examples of org.apache.cocoon.components.language.programming.CodeFormatter

        }

        String encoding = markupLanguage.getEncoding();

        // Format source code if applicable
        CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
        if (codeFormatter != null) {
            code = codeFormatter.format(code, encoding);
        }

        // Store generated code
        final File sourceFile = new File(this.workDir, normalizedName + "." + programmingLanguage.getSourceExtension());
        final File sourceDir = sourceFile.getParentFile();
View Full Code Here

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

      final ICProject project = tu.getCProject();
      final Map<String, Object> options = new HashMap<String, Object>(project.getOptions(true));
      options.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu);
      // Allow all comments to be indented.
      options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN, DefaultCodeFormatterConstants.FALSE);
      final CodeFormatter formatter = ToolFactory.createCodeFormatter(options);
      code = document.get();
      TextEdit[] formatEdits = formatter.format(CodeFormatter.K_TRANSLATION_UNIT, code, regions, TextUtilities.getDefaultLineDelimiter(document));

      TextEdit combinedFormatEdit = new MultiTextEdit();
      for (final TextEdit formatEdit : formatEdits) {
        combinedFormatEdit = TextEditUtil.merge(combinedFormatEdit, formatEdit);
      }
View Full Code Here

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

            DefaultCodeFormatterConstants.INDENT_BY_ONE));
        options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
        options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
        options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
        Document doc = new Document(m_compilationUnit.toString());
        CodeFormatter fmtr = ToolFactory.createCodeFormatter(options);
        String text = doc.get();
        TextEdit edits = fmtr.format(CodeFormatter.K_COMPILATION_UNIT, text, 0, text.length(), 0, null);
        File gendir = m_package.getGenerateDirectory();
        if (gendir != null) {
            try {
                File file = new File(gendir, m_name + ".java");
                FileWriter fwrit = new FileWriter(file);
View Full Code Here

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

    options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_6);
    options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_6);
    options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6);
    options.put(DefaultCodeFormatterConstants.FORMATTER_JOIN_WRAPPED_LINES, DefaultCodeFormatterConstants.FALSE);

    CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(options);
    TextEdit format = codeFormatter.format(CodeFormatter.K_COMPILATION_UNIT, text, 0, text.length(), 0, null);
    IDocument document = new Document(text);
    format.apply(document);
    return document.get();
  }
View Full Code Here

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

    //DefaultCodeFormatter.USE_NEW_FORMATTER = true;
    HashMap hashMap = new HashMap();
    hashMap.put( JavaCore.COMPILER_SOURCE, "1.5");
    hashMap.put( JavaCore.COMPILER_COMPLIANCE, "1.5");
    hashMap.put( JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, "1.5");
    final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(hashMap);
   
    //new JavaFormatter().formatFile(new File("c:/temp/SomeJava.java"), codeFormatter);

  }
View Full Code Here

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

    options.put(
        DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT,
        DefaultCodeFormatterConstants.TRUE);

    // instantiate the default code formatter with the given options
    final CodeFormatter codeFormatter = ToolFactory
        .createCodeFormatter(options);
    final TextEdit editCode = codeFormatter.format(
        CodeFormatter.K_COMPILATION_UNIT
            | CodeFormatter.F_INCLUDE_COMMENTS, source, 0,
        source.length(), 0, System.getProperty("line.separator"));

    IDocument document = new Document(source);
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.