protected synchronized FormattingConfig getConfig() { if (config.config == null) { config.config = createFormattingConfig(); configureFormatting(config.config); } return config.config; }
@Override public ITokenStream createFormatterStream(String indent, ITokenStream out, boolean preserveWhitespaces) { return new FormattingConfigBasedStream(out, indent, getConfig(), createMatcher(), hiddenTokenHelper, preserveWhitespaces); }
@SuppressWarnings("deprecation") protected FormattingConfig createFormattingConfig() { FormattingConfig cfg = new FormattingConfig2(grammarAccess, hiddenTokenHelper, getIndentInfo(), getLineSeparatorInfo()); cfg.setWhitespaceRule(getWSRule()); return cfg; }
@Override public ITokenStream createFormatterStream(EObject context, String indent, ITokenStream out, boolean preserveWhitespaces) { // call super method to initial private field contextResourceURI super.createFormatterStream(context, indent, out, preserveWhitespaces); return createFormatterStream(indent, out, preserveWhitespaces); }
protected void saveDebugGraphvizDiagram(String filename) { try { File file = new File(filename).getCanonicalFile(); System.out.println("Saving Graphviz diagram to " + file); FileOutputStream fos = new FileOutputStream(file); PrintStream ps = new PrintStream(fos); new ElementMatcherToDot().draw(createMatcher(), ps); ps.flush(); fos.flush(); fos.close(); } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } }
protected IElementMatcher<ElementPattern> createMatcher() { return matcherProvider.createMatcher(getConfig().getLocatorsForSemanticTokens()); }
/** * @since 2.3 */ @Override public ITokenStream createFormatterStream(EObject context, String indent, ITokenStream out, boolean preserveWhitespaces) { if(context != null && context.eResource() != null && context.eResource().getURI() != null) { contextResourceURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(context).trimFragment(); } return new FormattingConfigBasedStream(out, indent, getConfig(), createMatcher(), hiddenTokenHelper, preserveWhitespaces); }