use of org.eclipse.xtext.formatting2.internal.SinglelineDocCommentReplacer in project xtext-core by eclipse.
the class AbstractFormatter2 method createCommentReplacer.
public ITextReplacer createCommentReplacer(IComment comment) {
EObject grammarElement = comment.getGrammarElement();
if (grammarElement instanceof AbstractRule) {
String ruleName = ((AbstractRule) grammarElement).getName();
if (ruleName.startsWith("ML"))
return new MultilineCommentReplacer(comment, '*');
if (ruleName.startsWith("SL")) {
if (comment.getLineRegions().get(0).getIndentation().getLength() > 0)
return new SinglelineDocCommentReplacer(comment, "//");
else
return new SinglelineCodeCommentReplacer(comment, "//");
}
}
String elementName = new GrammarElementTitleSwitch().showQualified().showRule().doSwitch(grammarElement);
throw new IllegalStateException("No " + ITextReplacer.class.getSimpleName() + " configured for " + elementName);
}
Aggregations