use of com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher in project intellij-community by JetBrains.
the class ArrangementSettingsSerializationTest method testDefaultFilter.
@Test
public void testDefaultFilter() {
final StdArrangementSettings settings = new StdArrangementSettings();
settings.addGrouping(new ArrangementGroupingRule(OVERRIDDEN_METHODS, BY_NAME));
final ArrangementAtomMatchCondition condition = new ArrangementAtomMatchCondition(FIELD);
settings.addRule(new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), BY_NAME));
final Element holder = doSerializationTest(settings, settings);
assertTrue(holder.getChildren().isEmpty());
}
use of com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher in project intellij-community by JetBrains.
the class ArrangementMatchingRuleEditor method apply.
private void apply() {
final Pair<ArrangementMatchCondition, ArrangementSettingsToken> pair = buildCondition();
final Object modelValue;
if (pair == null) {
modelValue = new EmptyArrangementRuleComponent(myControl.getRowHeight(myRow));
} else {
modelValue = new StdArrangementMatchRule(new StdArrangementEntryMatcher(pair.first), pair.second);
}
myControl.getModel().set(myRow, modelValue);
myControl.repaintRows(myRow, myRow, true);
}
use of com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher in project intellij-community by JetBrains.
the class ArrangementSectionRuleManager method createDefaultSectionRule.
@NotNull
public StdArrangementMatchRule createDefaultSectionRule() {
final ArrangementAtomMatchCondition type = new ArrangementAtomMatchCondition(START_SECTION);
final ArrangementAtomMatchCondition text = new ArrangementAtomMatchCondition(TEXT, createDefaultSectionText());
final ArrangementMatchCondition condition = ArrangementUtil.combine(type, text);
return new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition));
}
use of com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher in project intellij-community by JetBrains.
the class AbstractRearrangerTest method nameRule.
@NotNull
protected static StdArrangementMatchRule nameRule(@NotNull String nameFilter, @NotNull ArrangementSettingsToken... tokens) {
if (tokens.length == 0) {
return new StdArrangementMatchRule(new StdArrangementEntryMatcher(atom(nameFilter)));
} else {
ArrangementAtomMatchCondition[] conditions = new ArrangementAtomMatchCondition[tokens.length + 1];
conditions[0] = atom(nameFilter);
for (int i = 0; i < tokens.length; i++) conditions[i + 1] = atom(tokens[i]);
ArrangementMatchCondition compositeCondition = ArrangementUtil.combine(conditions);
return new StdArrangementMatchRule(new StdArrangementEntryMatcher(compositeCondition));
}
}
use of com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher in project CSSReorder by anton-rudeshko.
the class CssRearranger method addRule.
private static void addRule(String propertyName) {
ArrangementAtomMatchCondition condition = new ArrangementAtomMatchCondition(StdArrangementTokens.Regexp.NAME, propertyName);
StdArrangementEntryMatcher matcher = new StdArrangementEntryMatcher(condition);
StdArrangementMatchRule matchRule = new StdArrangementMatchRule(matcher, StdArrangementTokens.Order.BY_NAME);
DEFAULT_MATCH_RULES.add(ArrangementSectionRule.create(matchRule));
}
Aggregations