Search in sources :

Example 1 with DumbAwareActionButton

use of com.intellij.ui.DumbAwareActionButton in project intellij-community by JetBrains.

the class CvsConfigurationsListEditor method createListPanel.

private JComponent createListPanel() {
    final AnActionButton duplicateButton = new DumbAwareActionButton(CvsBundle.message("action.name.copy"), PlatformIcons.COPY_ICON) {

        @Override
        public void updateButton(AnActionEvent e) {
            e.getPresentation().setEnabled(getSelectedConfiguration() != null);
        }

        @Override
        public void actionPerformed(AnActionEvent e) {
            copySelectedConfiguration();
        }
    };
    duplicateButton.setShortcut(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_D, SystemInfo.isMac ? KeyEvent.META_MASK : KeyEvent.CTRL_MASK)));
    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myList).setAddAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton anActionButton) {
            createNewConfiguration();
        }
    }).addExtraAction(duplicateButton);
    return decorator.createPanel();
}
Also used : DumbAwareActionButton(com.intellij.ui.DumbAwareActionButton) CustomShortcutSet(com.intellij.openapi.actionSystem.CustomShortcutSet) AnActionButtonRunnable(com.intellij.ui.AnActionButtonRunnable) ToolbarDecorator(com.intellij.ui.ToolbarDecorator) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnActionButton(com.intellij.ui.AnActionButton)

Aggregations

AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 CustomShortcutSet (com.intellij.openapi.actionSystem.CustomShortcutSet)1 AnActionButton (com.intellij.ui.AnActionButton)1 AnActionButtonRunnable (com.intellij.ui.AnActionButtonRunnable)1 DumbAwareActionButton (com.intellij.ui.DumbAwareActionButton)1 ToolbarDecorator (com.intellij.ui.ToolbarDecorator)1