Java Code Examples for org.eclipse.jdt.core.formatter.CodeFormatter#K_COMPILATION_UNIT

The following examples show how to use org.eclipse.jdt.core.formatter.CodeFormatter#K_COMPILATION_UNIT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeLineBreakPreparator.java    From spring-javaformat with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(int kind, TokenManager tokenManager, ASTNode astRoot) {
	if ((kind & CodeFormatter.K_COMPILATION_UNIT) != 0) {
		ASTVisitor visitor = new Vistor(tokenManager);
		astRoot.accept(visitor);
	}
}
 
Example 2
Source File: FormatterHandler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private int getFormattingKind(ICompilationUnit cu, boolean includeComments) {
	int kind = includeComments ? CodeFormatter.F_INCLUDE_COMMENTS : 0;
	if (cu.getResource() != null && cu.getResource().getName().equals(IModule.MODULE_INFO_JAVA)) {
		kind |= CodeFormatter.K_MODULE_INFO;
	} else {
		kind |= CodeFormatter.K_COMPILATION_UNIT;
	}
	return kind;
}
 
Example 3
Source File: CodeFormatterFlags.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public static int getFlagsForCompilationUnitFormat() {
  return CodeFormatter.K_COMPILATION_UNIT | CodeFormatter.F_INCLUDE_COMMENTS;
}