@Override public ITextReplacerContext createReplacements(ITextReplacerContext context) { AbstractFormatter2 formatter = context.getFormatter(); List<IHiddenRegionPart> hiddens = region.getParts(); if (hiddens.isEmpty()) { return formatter.createWhitespaceReplacer(region, formatting).createReplacements(context); } else if ((hiddens.size() == 1 && hiddens.get(0) instanceof IWhitespace)) { return formatter.createWhitespaceReplacer(hiddens.get(0), formatting).createReplacements(context); } else { List<ITextReplacer> replacers = createReplacers(formatter); applyHiddenRegionFormatting(replacers); ITextReplacerContext current = context; current.setNextReplacerIsChild(); for (ITextReplacer replacer : replacers) current = replacer.createReplacements(current.withReplacer(replacer)); return current; } }
public String getStubSuperClassName() { final Grammar superGrammar = IInheriting.Util.getNonTerminalsSuperGrammar(this.grammar); if ((superGrammar != null)) { return this.service.createGenerator(superGrammar).getStubQualifiedName(); } else { return AbstractFormatter2.class.getName(); } }
@Override public Pair<IHiddenRegion, IHiddenRegion> set(IHiddenRegion first, IHiddenRegion second, Procedure1<? super IHiddenRegionFormatter> init) { if (first != null && second != null) { AbstractFormatter2 formatter = getFormatter(); IHiddenRegionFormatting f1 = formatter.createHiddenRegionFormatting(); IHiddenRegionFormatting f2 = formatter.createHiddenRegionFormatting(); init.apply(formatter.createHiddenRegionFormatter(f1, f2)); ITextReplacer replacer1 = formatter.createHiddenRegionReplacer(first, f1); ITextReplacer replacer2 = formatter.createHiddenRegionReplacer(second, f2); addReplacer(replacer1); addReplacer(replacer2); } return Pair.of(first, second); }
@Override public IHiddenRegion set(IHiddenRegion hiddenRegion, Procedure1<? super IHiddenRegionFormatter> init) { if (hiddenRegion != null) { AbstractFormatter2 formatter = getFormatter(); IHiddenRegionFormatting formatting = formatter.createHiddenRegionFormatting(); init.apply(formatter.createHiddenRegionFormatter(formatting)); ITextReplacer replacer = formatter.createHiddenRegionReplacer(hiddenRegion, formatting); addReplacer(replacer); } return hiddenRegion; }
protected TypeReference getStubSuperClass() { final Grammar superGrammar = GrammarUtil2.getNonTerminalsSuperGrammar(this.getLanguage().getGrammar()); if ((superGrammar != null)) { return this.getFormatter2Stub(superGrammar); } else { return TypeReference.typeRef(AbstractFormatter2.class); } }
public HiddenRegionFormattingMerger(AbstractFormatter2 formatter) { super(); this.formatter = formatter; }
public TextReplacerMerger(AbstractFormatter2 formatter) { super(); this.formatter = formatter; this.merger = formatter.createHiddenRegionFormattingMerger(); }
@Override public AbstractFormatter2 getFormatter() { return parent.getFormatter(); }
public HiddenRegionFormatting(AbstractFormatter2 formatter) { super(); this.formatter = formatter; }
public AbstractFormatter2 getFormatter() { return formatter; }
public RootDocument(AbstractFormatter2 formatter) { super(); this.formatter = formatter; }
@Override public AbstractFormatter2 getFormatter() { return formatter; }
@Override public AbstractFormatter2 getFormatter() { return document.getFormatter(); }
@Override public String getIndentationString(int indentationLevel) { AbstractFormatter2 formatter = document.getFormatter(); return Strings.repeat(formatter.getPreference(FormatterPreferenceKeys.indentation), indentationLevel); }