use of net.sourceforge.pmd.eclipse.ui.preferences.br.RuleVisitor in project pmd-eclipse-plugin by pmd.
the class RulePanelManager method buildLanguageVersionCombo.
private Combo buildLanguageVersionCombo(Composite parent, final boolean isMinVersion) {
int style = creatingNewRule() ? SWT.SINGLE | SWT.BORDER : SWT.READ_ONLY | SWT.BORDER;
final Combo combo = new Combo(parent, style);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (rules == null) {
return;
}
final int selIdx = combo.getSelectionIndex();
final LanguageVersion version = selIdx == 0 ? null : selectedLanguage().getVersions().get(selIdx - 1);
RuleVisitor visitor = new RuleVisitor() {
public boolean accept(Rule rule) {
if (isMinVersion) {
rule.setMinimumLanguageVersion(version);
} else {
rule.setMaximumLanguageVersion(version);
}
return true;
}
};
rules.rulesDo(visitor);
valueChanged(null, version == null ? "" : version.getName());
}
});
return combo;
}
Aggregations