use of com.intellij.application.options.codeStyle.arrangement.match.tokens.ArrangementRuleAliasDialog in project intellij-community by JetBrains.
the class ArrangementSectionRulesControl method createRuleAliasEditDialog.
@NotNull
public ArrangementRuleAliasDialog createRuleAliasEditDialog() {
final Set<String> tokenIds = new THashSet<>();
final List<ArrangementSectionRule> sections = getSections();
for (ArrangementSectionRule section : sections) {
for (StdArrangementMatchRule rule : section.getMatchRules()) {
rule.getMatcher().getCondition().invite(new ArrangementMatchConditionVisitor() {
@Override
public void visit(@NotNull ArrangementAtomMatchCondition condition) {
if (ArrangementUtil.isAliasedCondition(condition)) {
tokenIds.add(condition.getType().getId());
}
}
@Override
public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
for (ArrangementMatchCondition operand : condition.getOperands()) {
operand.invite(this);
}
}
});
}
}
final Collection<StdArrangementRuleAliasToken> aliases = getRulesAliases();
assert aliases != null;
return new ArrangementRuleAliasDialog(null, mySettingsManager, myColorsProvider, aliases, tokenIds);
}
use of com.intellij.application.options.codeStyle.arrangement.match.tokens.ArrangementRuleAliasDialog in project intellij-community by JetBrains.
the class EditRuleAliasesDefinitionAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
ArrangementSectionRulesControl control = ArrangementSectionRulesControl.KEY.getData(e.getDataContext());
if (control == null || control.getRulesAliases() == null) {
return;
}
control.hideEditor();
final ArrangementRuleAliasDialog dialog = control.createRuleAliasEditDialog();
if (dialog.showAndGet() && dialog.isModified()) {
control.setRulesAliases(dialog.getRuleAliases());
}
}
Aggregations