Search in sources :

Example 81 with DefaultActionGroup

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

the class ChangeSchemaCombo method createPopupActionGroup.

@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
    DefaultActionGroup group = new DefaultActionGroup(new ChangeSchemaAction(FileTemplatesScheme.DEFAULT));
    FileTemplatesScheme scheme = myConfigurable.getManager().getProjectScheme();
    if (scheme != null) {
        group.add(new ChangeSchemaAction(scheme));
    }
    return group;
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) FileTemplatesScheme(com.intellij.ide.fileTemplates.FileTemplatesScheme) NotNull(org.jetbrains.annotations.NotNull)

Example 82 with DefaultActionGroup

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

the class ArtifactsStructureConfigurable method createAddArtifactAction.

private AnAction createAddArtifactAction(@NotNull final ArtifactType type) {
    final List<? extends ArtifactTemplate> templates = type.getNewArtifactTemplates(myPackagingEditorContext);
    final ArtifactTemplate emptyTemplate = new ArtifactTemplate() {

        @Override
        public String getPresentableName() {
            return "Empty";
        }

        @Override
        public NewArtifactConfiguration createArtifact() {
            final String name = "unnamed";
            return new NewArtifactConfiguration(type.createRootElement(name), name, type);
        }
    };
    if (templates.isEmpty()) {
        return new AddArtifactAction(type, emptyTemplate, type.getPresentableName(), type.getIcon());
    }
    final DefaultActionGroup group = new DefaultActionGroup(type.getPresentableName(), true);
    group.getTemplatePresentation().setIcon(type.getIcon());
    group.add(new AddArtifactAction(type, emptyTemplate, emptyTemplate.getPresentableName(), null));
    group.addSeparator();
    for (ArtifactTemplate template : templates) {
        group.add(new AddArtifactAction(type, template, template.getPresentableName(), null));
    }
    return group;
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 83 with DefaultActionGroup

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

the class ProjectJdksConfigurable method createActions.

@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
    if (myProjectJdksModel == null) {
        return null;
    }
    final ArrayList<AnAction> actions = new ArrayList<>();
    DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
    group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
    myProjectJdksModel.createAddActions(group, myTree, projectJdk -> {
        addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl) projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
        selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    });
    actions.add(new MyActionGroupWrapper(group));
    actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
    return actions;
}
Also used : ProjectJdkImpl(com.intellij.openapi.projectRoots.impl.ProjectJdkImpl) JdkConfigurable(com.intellij.openapi.roots.ui.configuration.projectRoot.JdkConfigurable) AnAction(com.intellij.openapi.actionSystem.AnAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Nullable(org.jetbrains.annotations.Nullable)

Example 84 with DefaultActionGroup

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

the class GroovyDocGenerationPanel method getActionGroup.

private ActionGroup getActionGroup() {
    if (myActionGroup == null) {
        initActions();
        myActionGroup = new DefaultActionGroup();
        myActionGroup.add(myAddPackageAction);
        myActionGroup.add(myReducePackageAction);
    }
    return myActionGroup;
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 85 with DefaultActionGroup

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

the class GradleRunnerUtil method attachTaskExecutionView.

public static DuplexConsoleView attachTaskExecutionView(@NotNull final Project project, @NotNull final ConsoleView consoleView, final boolean isTaskConsoleEnabledByDefault, @Nullable final String stateStorageKey, @NotNull final ProcessHandler processHandler, @NotNull final ExternalSystemTaskId taskId) {
    final String tripleStateStorageKey = stateStorageKey != null ? stateStorageKey + "_str" : null;
    if (stateStorageKey != null && isTaskConsoleEnabledByDefault && !PropertiesComponent.getInstance().isValueSet(tripleStateStorageKey)) {
        PropertiesComponent.getInstance().setValue(tripleStateStorageKey, Boolean.TRUE.toString());
        PropertiesComponent.getInstance().setValue(stateStorageKey, Boolean.TRUE);
    }
    final TaskExecutionView gradleExecutionConsole = new TaskExecutionView(project);
    final Ref<DuplexConsoleView> duplexConsoleViewRef = Ref.create();
    final DuplexConsoleView duplexConsoleView = new DuplexConsoleView<ConsoleView, ConsoleView>(gradleExecutionConsole, consoleView, stateStorageKey) {

        @Override
        public void enableConsole(boolean primary) {
            super.enableConsole(primary);
            if (stateStorageKey != null) {
                PropertiesComponent.getInstance().setValue(tripleStateStorageKey, Boolean.toString(primary));
            }
        }

        @NotNull
        @Override
        public AnAction[] createConsoleActions() {
            final DefaultActionGroup textActionGroup = new DefaultActionGroup() {

                @Override
                public void update(AnActionEvent e) {
                    super.update(e);
                    if (duplexConsoleViewRef.get() != null) {
                        e.getPresentation().setVisible(!duplexConsoleViewRef.get().isPrimaryConsoleEnabled());
                    }
                }
            };
            final AnAction[] consoleActions = consoleView.createConsoleActions();
            for (AnAction anAction : consoleActions) {
                textActionGroup.add(anAction);
            }
            final List<AnAction> anActions = ContainerUtil.newArrayList(super.createConsoleActions());
            anActions.add(textActionGroup);
            return ArrayUtil.toObjectArray(anActions, AnAction.class);
        }
    };
    duplexConsoleViewRef.set(duplexConsoleView);
    duplexConsoleView.setDisableSwitchConsoleActionOnProcessEnd(false);
    duplexConsoleView.getSwitchConsoleActionPresentation().setIcon(AllIcons.Actions.ChangeView);
    duplexConsoleView.getSwitchConsoleActionPresentation().setText(GradleBundle.message("gradle.runner.toggle.tree.text.action.name"));
    final ExternalSystemProgressNotificationManager progressManager = ServiceManager.getService(ExternalSystemProgressNotificationManager.class);
    final ExternalSystemTaskNotificationListenerAdapter taskListener = new ExternalSystemTaskNotificationListenerAdapter() {

        @Override
        public void onStatusChange(@NotNull final ExternalSystemTaskNotificationEvent event) {
            if (event instanceof ExternalSystemTaskExecutionEvent) {
                UIUtil.invokeLaterIfNeeded(() -> {
                    if (((ExternalSystemTaskExecutionEvent) event).getProgressEvent() instanceof ExternalSystemProgressEventUnsupported) {
                        duplexConsoleView.enableConsole(false);
                    }
                    gradleExecutionConsole.onStatusChange((ExternalSystemTaskExecutionEvent) event);
                });
            }
        }

        @Override
        public void onQueued(@NotNull ExternalSystemTaskId id, final String workingDir) {
            UIUtil.invokeLaterIfNeeded(() -> gradleExecutionConsole.setWorkingDir(workingDir));
        }

        @Override
        public void onFailure(@NotNull ExternalSystemTaskId id, @NotNull final Exception e) {
            UIUtil.invokeLaterIfNeeded(() -> gradleExecutionConsole.onFailure(e));
        }

        @Override
        public void onEnd(@NotNull ExternalSystemTaskId id) {
            progressManager.removeNotificationListener(this);
        }
    };
    progressManager.addNotificationListener(taskId, taskListener);
    return duplexConsoleView;
}
Also used : ExternalSystemTaskId(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnAction(com.intellij.openapi.actionSystem.AnAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) ExternalSystemTaskNotificationListenerAdapter(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListenerAdapter) NotNull(org.jetbrains.annotations.NotNull) ExternalSystemProgressNotificationManager(com.intellij.openapi.externalSystem.service.notification.ExternalSystemProgressNotificationManager) ExternalSystemTaskNotificationEvent(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationEvent) DuplexConsoleView(com.intellij.execution.console.DuplexConsoleView)

Aggregations

DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)109 NotNull (org.jetbrains.annotations.NotNull)38 AnAction (com.intellij.openapi.actionSystem.AnAction)22 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)16 Nullable (org.jetbrains.annotations.Nullable)11 ActionManager (com.intellij.openapi.actionSystem.ActionManager)8 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)7 Separator (com.intellij.openapi.actionSystem.Separator)7 ListPopup (com.intellij.openapi.ui.popup.ListPopup)7 Content (com.intellij.ui.content.Content)6 BrowserHelpAction (com.android.tools.idea.actions.BrowserHelpAction)5 Project (com.intellij.openapi.project.Project)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 List (java.util.List)5 RecordingAction (com.android.tools.idea.monitor.actions.RecordingAction)4 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)4 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)4 javax.swing (javax.swing)4 FolderConfiguration (com.android.ide.common.resources.configuration.FolderConfiguration)3 CommonActionsManager (com.intellij.ide.CommonActionsManager)3