Search in sources :

Example 41 with DumbAwareAction

use of com.intellij.openapi.project.DumbAwareAction in project intellij-plugins by JetBrains.

the class FlexBuildConfigurationsExtension method createAddActions.

public Collection<AnAction> createAddActions(final NullableComputable<MasterDetailsComponent.MyNode> selectedNodeRetriever, final Runnable treeNodeNameUpdater, final Project project, final MasterDetailsComponent.MyNode root) {
    final Collection<AnAction> actions = new ArrayList<>(2);
    actions.add(new DumbAwareAction(FlexBundle.message("create.bc.action.text"), FlexBundle.message("create.bc.action.description"), FlexIcons.Flash_run_config) {

        public void update(final AnActionEvent e) {
            e.getPresentation().setVisible(getFlexModuleForNode(selectedNodeRetriever.compute()) != null);
        }

        public void actionPerformed(final AnActionEvent e) {
            final Module module = getFlexModuleForNode(selectedNodeRetriever.compute());
            myConfigurator.addConfiguration(module, treeNodeNameUpdater);
        }
    });
    return actions;
}
Also used : ArrayList(java.util.ArrayList) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Module(com.intellij.openapi.module.Module) AnAction(com.intellij.openapi.actionSystem.AnAction) DumbAwareAction(com.intellij.openapi.project.DumbAwareAction)

Aggregations

DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)41 NotNull (org.jetbrains.annotations.NotNull)19 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)18 AnAction (com.intellij.openapi.actionSystem.AnAction)8 Nullable (org.jetbrains.annotations.Nullable)8 List (java.util.List)6 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)4 FileChooser (com.intellij.openapi.fileChooser.FileChooser)4 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)4 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)4 Project (com.intellij.openapi.project.Project)4 Messages (com.intellij.openapi.ui.Messages)4 JBPopup (com.intellij.openapi.ui.popup.JBPopup)4 RelativePoint (com.intellij.ui.awt.RelativePoint)4 JBTable (com.intellij.ui.table.JBTable)4 MouseEvent (java.awt.event.MouseEvent)4 StdFileTypes (com.intellij.openapi.fileTypes.StdFileTypes)3 ConfigurationException (com.intellij.openapi.options.ConfigurationException)3 JBPopupFactory (com.intellij.openapi.ui.popup.JBPopupFactory)3 StringUtil (com.intellij.openapi.util.text.StringUtil)3