use of com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule in project intellij-community by JetBrains.
the class StdArrangementExtendableSettings method getRuleSequence.
@Nullable
private List<StdArrangementMatchRule> getRuleSequence(@NotNull final StdArrangementMatchRule rule, @NotNull final Map<String, StdArrangementRuleAliasToken> tokenIdToDefinition) {
final List<StdArrangementMatchRule> seqRule = ContainerUtil.newSmartList();
rule.getMatcher().getCondition().invite(new ArrangementMatchConditionVisitor() {
@Override
public void visit(@NotNull ArrangementAtomMatchCondition condition) {
final StdArrangementRuleAliasToken token = tokenIdToDefinition.get(condition.getType().getId());
if (token != null && !token.getDefinitionRules().isEmpty()) {
seqRule.addAll(token.getDefinitionRules());
}
}
@Override
public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
for (ArrangementMatchCondition operand : condition.getOperands()) {
if (!seqRule.isEmpty()) {
return;
}
operand.invite(this);
}
}
});
return seqRule;
}
use of com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule 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