ToolbarDecorator.createDecorator(myRulesList)
.setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
updateCurrentRule();
myRulesModel.add(new LibraryBundlificationRule());
myRulesList.setSelectedIndex(myRulesModel.getSize() - 1);
updateFields();
}
})
.setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
myLastSelected = -1;
if (myRulesModel.getSize() == 1) {
myRulesModel.setElementAt(new LibraryBundlificationRule(), 0);
myRulesList.setSelectedIndex(0);
}
else {
int index = myRulesList.getSelectedIndex();
myRulesModel.remove(index);