org.eclipse.xtext.formatting2.internal.CommentReplacer Java Examples
The following examples show how to use
org.eclipse.xtext.formatting2.internal.CommentReplacer.
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: SARLFormatter.java From sarl with Apache License 2.0 | 6 votes |
@Override public ITextReplacer createCommentReplacer(IComment comment) { final EObject grammarElement = comment.getGrammarElement(); if (grammarElement instanceof AbstractRule) { final String ruleName = ((AbstractRule) grammarElement).getName(); CommentReplacer replacer = null; if (ruleName.startsWith("ML")) { //$NON-NLS-1$ replacer = new SARLMultilineCommentReplacer(comment); } else if (ruleName.startsWith("SL")) { //$NON-NLS-1$ replacer = new SARLSinglelineCommentReplacer(comment); } if (replacer != null) { this.injector.injectMembers(replacer); return replacer; } } final String elementName = new GrammarElementTitleSwitch().showQualified().showRule().doSwitch(grammarElement); throw new IllegalStateException( MessageFormat.format(Messages.SARLFormatter_0, ITextReplacer.class.getSimpleName(), elementName)); }