org.eclipse.xtext.formatting.IFormatter Java Examples
The following examples show how to use
org.eclipse.xtext.formatting.IFormatter.
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: FormatFragment.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** {@inheritDoc} */ @Override public Set<Binding> getGuiceBindingsRt(final Grammar grammar) { final BindFactory bindFactory = new BindFactory(); bindFactory.addTypeToType(IFormatter.class.getName(), FormatGeneratorUtil.getFormatterName(grammar, "")); bindFactory.addTypeToType(INodeModelFormatter.class.getName(), RegionNodeModelFormatter.class.getName()); bindFactory.addTypeToType(INodeModelStreamer.class.getName(), DirectNodeModelStreamer.class.getName()); return bindFactory.getBindings(); }
Example #2
Source File: DotNodeModelStreamer.java From gef with Eclipse Public License 2.0 | 5 votes |
private void writeHTMLStringSemantic(AbstractRule rule, DotFormattingConfigBasedStream out, ICompositeNode node) throws IOException { Injector htmlLabelInjector = new DotHtmlLabelStandaloneSetup() .createInjectorAndDoEMFRegistration(); IFormatter dotHtmlLabelFormatter = htmlLabelInjector .getInstance(IFormatter.class); ITokenStream htmlLabelOut = new TokenStringBuffer(); // TODO: calculate initial indentation properly ITokenStream fmt = dotHtmlLabelFormatter.createFormatterStream("\t\t", htmlLabelOut, false); INodeModelStreamer dothtmlLabelNodeModelStreamer = htmlLabelInjector .getInstance(INodeModelStreamer.class); IParser dotHtmlLabelParser = htmlLabelInjector .getInstance(IParser.class); // cut off the leading and the trailing white spaces String trimmedNodeText = node.getText().trim(); String htmlLabelText = trimmedNodeText.substring(1, trimmedNodeText.length() - 1); IParseResult parseResult = dotHtmlLabelParser .parse(new StringReader(htmlLabelText)); ICompositeNode htmlLabelRootNode = parseResult.getRootNode(); dothtmlLabelNodeModelStreamer.feedTokenStream(fmt, htmlLabelRootNode, 0, htmlLabelText.length()); out.writeSemantic(null, "<"); out.addNewLine(); out.addLineEntry(node.getGrammarElement(), htmlLabelOut.toString(), false); out.addNewLine(); out.writeSemantic(null, ">"); }
Example #3
Source File: FormatterFragment.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public Set<Binding> getGuiceBindingsRt(Grammar grammar) { if(isGenerateStub()) return new BindFactory().addTypeToType(IFormatter.class.getName(), getFormatterName(grammar, getNaming())) .getBindings(); else return emptySet(); }
Example #4
Source File: DotArrowTypeRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotArrowTypeFormatter.class; }
Example #5
Source File: FormatterTestLanguageRuntimeModule.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
/** {@inheritDoc} */ @Override public Class<? extends IFormatter> bindIFormatter() { return FormatterTestConfig.class; }
Example #6
Source File: FormatterTestLanguageRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return FormatterTestConfig.class; }
Example #7
Source File: FormatterTestLanguage2RuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return FormatterTestConfig2.class; }
Example #8
Source File: XtextRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return XtextFormatter.class; }
Example #9
Source File: DefaultRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IFormatter> bindIFormatter() { return OneWhitespaceFormatter.class; }
Example #10
Source File: Serializer.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected IFormatter getFormatter() { return formatter; }
Example #11
Source File: Serializer.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Inject public Serializer(IParseTreeConstructor ptc, IFormatter fmt, IConcreteSyntaxValidator val) { this.parseTreeReconstructor = ptc; this.formatter = fmt; this.validator = val; }
Example #12
Source File: DotColorListRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotColorListFormatter.class; }
Example #13
Source File: DotHtmlLabelRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotHtmlLabelFormatter.class; }
Example #14
Source File: DotEscStringRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotEscStringFormatter.class; }
Example #15
Source File: DotSplineTypeRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotSplineTypeFormatter.class; }
Example #16
Source File: DotStyleRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotStyleFormatter.class; }
Example #17
Source File: DotPortPosRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotPortPosFormatter.class; }
Example #18
Source File: DotRectRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotRectFormatter.class; }
Example #19
Source File: DotFontNameRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotFontNameFormatter.class; }
Example #20
Source File: DotPointRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotPointFormatter.class; }
Example #21
Source File: DotRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotFormatter.class; }
Example #22
Source File: DotRecordLabelRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotRecordLabelFormatter.class; }
Example #23
Source File: DotColorRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotColorFormatter.class; }
Example #24
Source File: DotShapeRuntimeModule.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IFormatter> bindIFormatter() { return DotShapeFormatter.class; }