ToolbarDecorator () { ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTree) .setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { addTemplateOrGroup(button); } }) .setAddIcon(LayeredIcon.ADD_WITH_DROPDOWN) .setRemoveAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton anActionButton) { removeRows(); } }) .disableDownAction() .disableUpAction() .addExtraAction(new DumbAwareActionButton(CodeInsightBundle.messagePointer("action.AnActionButton.Template.list.text.duplicate"), AllIcons.Actions.Copy) { @Override public void actionPerformed(@NotNull AnActionEvent e) { copyRow(); } @Override public void updateButton(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(getTemplate(getSingleSelectedIndex()) != null); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } }).addExtraAction(new DumbAwareActionButton(CodeInsightBundle.messagePointer("action.AnActionButton.text.restore.deleted.defaults"), AllIcons.Actions.Rollback) { @Override public void actionPerformed(@NotNull AnActionEvent e) { TemplateSettings.getInstance().reset(); reset(); } @Override public boolean isEnabled() { return super.isEnabled() && !TemplateSettings.getInstance().getDeletedTemplates().isEmpty(); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } }); return decorator; }