本文整理汇总了Java中org.eclipse.jdt.core.formatter.CodeFormatter.K_SINGLE_LINE_COMMENT属性的典型用法代码示例。如果您正苦于以下问题:Java CodeFormatter.K_SINGLE_LINE_COMMENT属性的具体用法?Java CodeFormatter.K_SINGLE_LINE_COMMENT怎么用?Java CodeFormatter.K_SINGLE_LINE_COMMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.formatter.CodeFormatter
的用法示例。
在下文中一共展示了CodeFormatter.K_SINGLE_LINE_COMMENT属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Scribe
Scribe(CodeFormatterVisitor formatter, long sourceLevel, IRegion[] regions, CodeSnippetParsingUtil codeSnippetParsingUtil, boolean includeComments) {
initializeScanner(sourceLevel, formatter.preferences);
this.formatter = formatter;
this.pageWidth = formatter.preferences.page_width;
this.tabLength = formatter.preferences.tab_size;
this.indentationLevel= 0; // initialize properly
this.numberOfIndentations = 0;
this.useTabsOnlyForLeadingIndents = formatter.preferences.use_tabs_only_for_leading_indentations;
this.indentEmptyLines = formatter.preferences.indent_empty_lines;
this.tabChar = formatter.preferences.tab_char;
if (this.tabChar == DefaultCodeFormatterOptions.MIXED) {
this.indentationSize = formatter.preferences.indentation_size;
} else {
this.indentationSize = this.tabLength;
}
this.lineSeparator = formatter.preferences.line_separator;
this.lineSeparatorAndSpace = this.lineSeparator+' ';
this.firstLS = this.lineSeparator.charAt(0);
this.lsLength = this.lineSeparator.length();
this.indentationLevel = formatter.preferences.initial_indentation_level * this.indentationSize;
this.regions= regions;
if (codeSnippetParsingUtil != null) {
final RecordedParsingInformation information = codeSnippetParsingUtil.recordedParsingInformation;
if (information != null) {
this.lineEnds = information.lineEnds;
this.commentPositions = information.commentPositions;
}
}
if (formatter.preferences.comment_format_line_comment) this.formatComments |= CodeFormatter.K_SINGLE_LINE_COMMENT;
if (formatter.preferences.comment_format_block_comment) this.formatComments |= CodeFormatter.K_MULTI_LINE_COMMENT;
if (formatter.preferences.comment_format_javadoc_comment) this.formatComments |= CodeFormatter.K_JAVA_DOC;
if (includeComments) this.formatComments |= CodeFormatter.F_INCLUDE_COMMENTS;
reset();
}
示例2: printComment
void printComment(int kind, String source, int start, int end, int level) {
// Set scanner
resetScanner(source.toCharArray());
this.scanner.resetTo(start, end);
// Put back 3.4RC2 code => comment following line as it has an impact on Linux tests
// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=234336
// TODO (frederic) Need more investigations and a better fix in
// isAdaptableRegion(int) and adaptRegions()
// this.scannerEndPosition = end;
// Set indentation level
this.numberOfIndentations = level;
this.indentationLevel = level * this.indentationSize;
this.column = this.indentationLevel + 1;
// Print corresponding comment
switch (kind) {
case CodeFormatter.K_SINGLE_LINE_COMMENT:
printComment(kind, NO_TRAILING_COMMENT);
break;
case CodeFormatter.K_MULTI_LINE_COMMENT:
printComment(kind, NO_TRAILING_COMMENT);
break;
case CodeFormatter.K_JAVA_DOC:
printJavadocComment(start, end);
break;
}
}