Search in sources :

Example 96 with AnActionEvent

use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.

the class ImportTree method createExcludeAction.

public AnAction createExcludeAction() {
    return new AnAction(CvsBundle.message("import.wizard.exclude.from.import.action.name"), null, PlatformIcons.DELETE_ICON) {

        public void update(AnActionEvent e) {
            final VirtualFile[] selectedFiles = myFileSystemTree.getSelectedFiles();
            final Presentation presentation = e.getPresentation();
            presentation.setEnabled(isAtLeastOneFileIncluded(selectedFiles));
        }

        public void actionPerformed(AnActionEvent e) {
            final VirtualFile[] selectedFiles = myFileSystemTree.getSelectedFiles();
            for (VirtualFile selectedFile : selectedFiles) {
                exclude(selectedFile);
            }
            myWizard.updateStep();
            myFileSystemTree.getTree().repaint();
        }
    };
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Presentation(com.intellij.openapi.actionSystem.Presentation) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 97 with AnActionEvent

use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.

the class IdeMessagePanel method showErrorNotification.

private void showErrorNotification(@Nullable String notificationText, @NotNull Project project) {
    Notification notification = new Notification("", AllIcons.Ide.FatalError, notificationText == null ? ERROR_TITLE : "", null, notificationText == null ? "" : notificationText, NotificationType.ERROR, null);
    if (notificationText == null) {
        notification.addAction(new NotificationAction(ERROR_LINK) {

            @Override
            public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) {
                notification.expire();
                _openFatals(null);
            }
        });
    }
    BalloonLayout layout = myFrame.getBalloonLayout();
    assert layout != null;
    BalloonLayoutData layoutData = BalloonLayoutData.createEmpty();
    layoutData.fadeoutTime = 5000;
    layoutData.fillColor = new JBColor(0XF5E6E7, 0X593D41);
    layoutData.borderColor = new JBColor(0XE0A8A9, 0X73454B);
    assert myBalloon == null;
    myBalloon = NotificationsManagerImpl.createBalloon(myFrame, notification, false, false, new Ref<>(layoutData), project);
    Disposer.register(myBalloon, () -> myBalloon = null);
    layout.add(myBalloon);
}
Also used : Ref(com.intellij.openapi.util.Ref) BalloonLayout(com.intellij.ui.BalloonLayout) NotificationAction(com.intellij.notification.NotificationAction) BalloonLayoutData(com.intellij.ui.BalloonLayoutData) JBColor(com.intellij.ui.JBColor) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Notification(com.intellij.notification.Notification)

Example 98 with AnActionEvent

use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.

the class TabbedPaneImpl method installKeyboardNavigation.

@SuppressWarnings({ "NonStaticInitializer" })
private void installKeyboardNavigation(final PrevNextActionsDescriptor installKeyboardNavigation) {
    myNextTabAction = new AnAction() {

        {
            setEnabledInModalContext(true);
        }

        @Override
        public void actionPerformed(final AnActionEvent e) {
            int index = getSelectedIndex() + 1;
            if (index >= getTabCount()) {
                index = 0;
            }
            setSelectedIndex(index);
        }
    };
    final AnAction nextAction = ActionManager.getInstance().getAction(installKeyboardNavigation.getNextActionId());
    LOG.assertTrue(nextAction != null, "Cannot find action with specified id: " + installKeyboardNavigation.getNextActionId());
    myNextTabAction.registerCustomShortcutSet(nextAction.getShortcutSet(), this);
    myPreviousTabAction = new AnAction() {

        {
            setEnabledInModalContext(true);
        }

        @Override
        public void actionPerformed(final AnActionEvent e) {
            int index = getSelectedIndex() - 1;
            if (index < 0) {
                index = getTabCount() - 1;
            }
            setSelectedIndex(index);
        }
    };
    final AnAction prevAction = ActionManager.getInstance().getAction(installKeyboardNavigation.getPrevActionId());
    LOG.assertTrue(prevAction != null, "Cannot find action with specified id: " + installKeyboardNavigation.getPrevActionId());
    myPreviousTabAction.registerCustomShortcutSet(prevAction.getShortcutSet(), this);
}
Also used : AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 99 with AnActionEvent

use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.

the class AbstractLanguageInjectionSupport method createDefaultEditAction.

public static AnAction createDefaultEditAction(final Project project, final Factory<BaseInjection> producer) {
    return new AnAction() {

        @Override
        public void actionPerformed(AnActionEvent e) {
            final BaseInjection originalInjection = producer.create();
            final BaseInjection newInjection = showDefaultInjectionUI(project, originalInjection.copy());
            if (newInjection != null) {
                originalInjection.copyFrom(newInjection);
            }
        }
    };
}
Also used : AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnAction(com.intellij.openapi.actionSystem.AnAction) BaseInjection(org.intellij.plugins.intelliLang.inject.config.BaseInjection)

Example 100 with AnActionEvent

use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.

the class JavaLanguageInjectionSupport method createEditAction.

@Override
public AnAction createEditAction(final Project project, final Factory<BaseInjection> producer) {
    return new AnAction() {

        @Override
        public void actionPerformed(final AnActionEvent e) {
            final BaseInjection originalInjection = producer.create();
            final MethodParameterInjection injection = createFrom(project, originalInjection, null, false);
            if (injection != null) {
                final boolean mergeEnabled = !project.isInitialized() || JavaPsiFacade.getInstance(project).findClass(injection.getClassName(), GlobalSearchScope.allScope(project)) == null;
                final BaseInjection newInjection = showInjectionUI(project, injection);
                if (newInjection != null) {
                    newInjection.mergeOriginalPlacesFrom(originalInjection, mergeEnabled);
                    originalInjection.copyFrom(newInjection);
                }
            } else {
                createDefaultEditAction(project, producer).actionPerformed(null);
            }
        }
    };
}
Also used : MethodParameterInjection(org.intellij.plugins.intelliLang.inject.config.MethodParameterInjection) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnAction(com.intellij.openapi.actionSystem.AnAction) BaseInjection(org.intellij.plugins.intelliLang.inject.config.BaseInjection)

Aggregations

AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)129 AnAction (com.intellij.openapi.actionSystem.AnAction)67 Project (com.intellij.openapi.project.Project)27 NotNull (org.jetbrains.annotations.NotNull)25 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)22 VirtualFile (com.intellij.openapi.vfs.VirtualFile)21 Nullable (org.jetbrains.annotations.Nullable)20 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)15 List (java.util.List)14 CustomShortcutSet (com.intellij.openapi.actionSystem.CustomShortcutSet)13 ArrayList (java.util.ArrayList)11 Presentation (com.intellij.openapi.actionSystem.Presentation)10 StringUtil (com.intellij.openapi.util.text.StringUtil)9 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)8 JBTable (com.intellij.ui.table.JBTable)8 DataContext (com.intellij.openapi.actionSystem.DataContext)7 Pair (com.intellij.openapi.util.Pair)7 Logger (com.intellij.openapi.diagnostic.Logger)6 Ref (com.intellij.openapi.util.Ref)6 AnActionButton (com.intellij.ui.AnActionButton)6