use of com.intellij.application.options.codeStyle.arrangement.component.ArrangementAndMatchConditionComponent in project intellij-community by JetBrains.
the class ArrangementMatchNodeComponentFactory method getComponent.
/**
* Allows to build UI component for the given model.
*
* @param rendererTarget target model element for which UI component should be built
* @param rule rule which contains given 'renderer target' condition and serves as
* a data entry for the target list model
* @param allowModification flag which indicates whether given model can be changed at future
* @return renderer for the given model
*/
@NotNull
public ArrangementUiComponent getComponent(@NotNull final ArrangementMatchCondition rendererTarget, @NotNull final StdArrangementMatchRule rule, final boolean allowModification) {
final Ref<ArrangementUiComponent> ref = new Ref<>();
rendererTarget.invite(new ArrangementMatchConditionVisitor() {
@Override
public void visit(@NotNull ArrangementAtomMatchCondition condition) {
RemoveAtomConditionCallback callback = allowModification ? new RemoveAtomConditionCallback(rule) : null;
ArrangementUiComponent component = new ArrangementAtomMatchConditionComponent(mySettingsManager, myColorsProvider, condition, callback);
ref.set(component);
}
@Override
public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
ref.set(new ArrangementAndMatchConditionComponent(rule, condition, ArrangementMatchNodeComponentFactory.this, mySettingsManager, allowModification));
}
});
return ref.get();
}
Aggregations