protected boolean isBreak() { if (!isBreakable()) return false; for (ElementLocator e : leadingLocators) { if (e instanceof LinewrapLocator) { if (((LinewrapLocator) e).getMinWrap() > 0) return true; if (countExistingLeadingNewlines() > 0) return true; } } return false; }
protected boolean isBreakable() { if (leadingLocators == null) return false; for (ElementLocator e : leadingLocators) { if (e instanceof LinewrapLocator && ((LinewrapLocator) e).getMaxWrap() == 0) return false; if (e instanceof SpaceLocator) return false; } return hiddenTokenHelper.getWhitespaceRuleFor(hiddenTokenDefinition, getLineSeparator()) != null; }
protected void configureFormatting(final FormattingConfig c) { LinewrapLocator _setLinewrap = c.setLinewrap(0, 1, 2); TerminalRule _sL_COMMENTRule = this._lilGrammarAccess.getSL_COMMENTRule(); _setLinewrap.before(_sL_COMMENTRule); LinewrapLocator _setLinewrap_1 = c.setLinewrap(0, 1, 2); TerminalRule _mL_COMMENTRule = this._lilGrammarAccess.getML_COMMENTRule(); _setLinewrap_1.before(_mL_COMMENTRule); LinewrapLocator _setLinewrap_2 = c.setLinewrap(0, 1, 1); TerminalRule _mL_COMMENTRule_1 = this._lilGrammarAccess.getML_COMMENTRule(); _setLinewrap_2.after(_mL_COMMENTRule_1); }
/** * Creates a conditional {@link LinewrapLocator} that is activated depending on given locator activator. * * @param config * a formatting config, which newly created locators should be added to * @param lines * size of linewrap in lines * @param locatorActivator * activator indicating when the conditional locator is active * @return new conditional linewrap locator */ public static LinewrapLocator createConditionalLinewrapLocator(final ExtendedFormattingConfig config, final int lines, final LocatorActivator<?> locatorActivator) { return new ConditionalLinewrapLocator(config, lines, locatorActivator); }
/** * Creates a conditional {@link LinewrapLocator} that is activated depending on given locator activator. * * @param config * a formatting config, which newly created locators should be added to * @param minWraps * minimal number of new lines * @param defaultWraps * default size of linewrap locator = number of new lines * @param maxWraps * maximal number of new lines * @param locatorActivator * activator indicating when the conditional locator is active * @return new conditional linewrap locator */ public static LinewrapLocator createConditionalLinewrapLocator(final ExtendedFormattingConfig config, final int minWraps, final int defaultWraps, final int maxWraps, final LocatorActivator<?> locatorActivator) { return new ConditionalLinewrapLocator(config, minWraps, defaultWraps, maxWraps, locatorActivator); }