Search in sources :

Example 26 with ActionGroup

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

the class MethodHierarchyBrowser method createTrees.

@Override
protected void createTrees(@NotNull Map<String, JTree> trees) {
    final JTree tree = createTree(false);
    ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction(IdeActions.GROUP_METHOD_HIERARCHY_POPUP);
    PopupHandler.installPopupHandler(tree, group, ActionPlaces.METHOD_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
    final BaseOnThisMethodAction action = new BaseOnThisMethodAction();
    action.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_METHOD_HIERARCHY).getShortcutSet(), tree);
    trees.put(METHOD_TYPE, tree);
}
Also used : ActionGroup(com.intellij.openapi.actionSystem.ActionGroup)

Example 27 with ActionGroup

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

the class GitBranchPopup method createRepositoriesActions.

@NotNull
@Override
protected DefaultActionGroup createRepositoriesActions() {
    DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
    popupGroup.addSeparator("Repositories");
    List<ActionGroup> rootActions = DvcsUtil.sortRepositories(myRepositoryManager.getRepositories()).stream().map(repo -> new RootAction<>(repo, highlightCurrentRepo() ? myCurrentRepository : null, new GitBranchPopupActions(repo.getProject(), repo).createActions(), GitBranchUtil.getDisplayableBranchText(repo))).collect(toList());
    wrapWithMoreActionIfNeeded(myProject, popupGroup, rootActions, rootActions.size() > MAX_NUM ? DEFAULT_NUM : MAX_NUM, SHOW_ALL_REPOSITORIES);
    return popupGroup;
}
Also used : GitRepositoryManager(git4idea.repo.GitRepositoryManager) BranchActionGroupPopup.wrapWithMoreActionIfNeeded(com.intellij.dvcs.ui.BranchActionGroupPopup.wrapWithMoreActionIfNeeded) GitVcsSettings(git4idea.config.GitVcsSettings) ContainerUtil(com.intellij.util.containers.ContainerUtil) RootAction(com.intellij.dvcs.ui.RootAction) GitBranchUtil(git4idea.branch.GitBranchUtil) AbstractRepositoryManager(com.intellij.dvcs.repo.AbstractRepositoryManager) GitUtil(git4idea.GitUtil) DvcsUtil(com.intellij.dvcs.DvcsUtil) Project(com.intellij.openapi.project.Project) GitRepository(git4idea.repo.GitRepository) BranchActionGroup(com.intellij.dvcs.ui.BranchActionGroup) DvcsBranchPopup(com.intellij.dvcs.branch.DvcsBranchPopup) DEFAULT_NUM(com.intellij.dvcs.branch.DvcsBranchPopup.MyMoreIndex.DEFAULT_NUM) AnAction(com.intellij.openapi.actionSystem.AnAction) BranchActionUtil.getNumOfTopShownBranches(com.intellij.dvcs.ui.BranchActionUtil.getNumOfTopShownBranches) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Objects(java.util.Objects) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) MAX_NUM(com.intellij.dvcs.branch.DvcsBranchPopup.MyMoreIndex.MAX_NUM) ContainerUtil.map(com.intellij.util.containers.ContainerUtil.map) NotNull(org.jetbrains.annotations.NotNull) FAVORITE_BRANCH_COMPARATOR(com.intellij.dvcs.ui.BranchActionUtil.FAVORITE_BRANCH_COMPARATOR) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) RootAction(com.intellij.dvcs.ui.RootAction) BranchActionGroup(com.intellij.dvcs.ui.BranchActionGroup) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) NotNull(org.jetbrains.annotations.NotNull)

Example 28 with ActionGroup

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

the class ConsoleManager method createConsole.

private void createConsole(@NotNull final NetService netService) {
    TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(netService.getProject());
    netService.configureConsole(consoleBuilder);
    console = consoleBuilder.getConsole();
    ApplicationManager.getApplication().invokeLater(() -> {
        ActionGroup actionGroup = netService.getConsoleToolWindowActions();
        ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false);
        SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
        toolWindowPanel.setContent(console.getComponent());
        toolWindowPanel.setToolbar(toolbar.getComponent());
        ToolWindow toolWindow = ToolWindowManager.getInstance(netService.getProject()).registerToolWindow(netService.getConsoleToolWindowId(), false, ToolWindowAnchor.BOTTOM, netService.getProject(), true);
        toolWindow.setIcon(netService.getConsoleToolWindowIcon());
        Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, "", false);
        Disposer.register(content, console);
        toolWindow.getContentManager().addContent(content);
    }, netService.getProject().getDisposed());
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) Content(com.intellij.ui.content.Content) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel)

Example 29 with ActionGroup

use of com.intellij.openapi.actionSystem.ActionGroup in project azure-tools-for-java by Microsoft.

the class AzureActionsComponent method initComponent.

public void initComponent() {
    if (!AzurePlugin.IS_ANDROID_STUDIO) {
        initAuthManage();
        ActionManager am = ActionManager.getInstance();
        DefaultActionGroup toolbarGroup = (DefaultActionGroup) am.getAction(IdeActions.GROUP_MAIN_TOOLBAR);
        toolbarGroup.addAll((DefaultActionGroup) am.getAction("AzureToolbarGroup"));
        DefaultActionGroup popupGroup = (DefaultActionGroup) am.getAction(IdeActions.GROUP_PROJECT_VIEW_POPUP);
        popupGroup.add(am.getAction("AzurePopupGroup"));
        if (PlatformUtils.isIdeaUltimate()) {
            ActionManager actionManager = ActionManager.getInstance();
            DefaultActionGroup actionGroup = (DefaultActionGroup) actionManager.getAction("PublishGroup");
            if (actionGroup != null)
                actionGroup.addAll((ActionGroup) actionManager.getAction("AzureWebDeployGroup"));
        }
    }
    try {
        PlatformDependent.isAndroid();
    } catch (Throwable ignored) {
        DefaultLoader.getUIHelper().showError("A problem with your Android Support plugin setup is preventing the Azure Toolkit from functioning correctly (Retrofit2 and RxJava failed to initialize).\n" + "To fix this issue, try disabling the Android Support plugin or installing the Android SDK", "Azure Toolkit for IntelliJ");
    //            DefaultLoader.getUIHelper().showException("Android Support Error: isAndroid() throws " + ignored.getMessage(), ignored, "Error Android", true, false);
    }
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 30 with ActionGroup

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

the class SplitEditorToolbar method createToolbarFromGroupId.

@NotNull
private static ActionToolbar createToolbarFromGroupId(@NotNull String groupId) {
    final ActionManager actionManager = ActionManager.getInstance();
    if (!actionManager.isGroup(groupId)) {
        throw new IllegalStateException(groupId + " should have been a group");
    }
    final ActionGroup group = ((ActionGroup) actionManager.getAction(groupId));
    final ActionToolbarImpl editorToolbar = ((ActionToolbarImpl) actionManager.createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true));
    editorToolbar.setOpaque(false);
    editorToolbar.setBorder(new JBEmptyBorder(0, 2, 0, 2));
    return editorToolbar;
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) JBEmptyBorder(com.intellij.util.ui.JBEmptyBorder) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) ActionToolbarImpl(com.intellij.openapi.actionSystem.impl.ActionToolbarImpl) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)30 AnAction (com.intellij.openapi.actionSystem.AnAction)8 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)8 NotNull (org.jetbrains.annotations.NotNull)6 ActionManager (com.intellij.openapi.actionSystem.ActionManager)4 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)4 GutterIconRenderer (com.intellij.openapi.editor.markup.GutterIconRenderer)3 List (java.util.List)3 Nullable (org.jetbrains.annotations.Nullable)3 Pass (com.intellij.codeHighlighting.Pass)2 LineMarkerInfo (com.intellij.codeInsight.daemon.LineMarkerInfo)2 BranchActionGroup (com.intellij.dvcs.ui.BranchActionGroup)2 BranchActionGroupPopup.wrapWithMoreActionIfNeeded (com.intellij.dvcs.ui.BranchActionGroupPopup.wrapWithMoreActionIfNeeded)2 FAVORITE_BRANCH_COMPARATOR (com.intellij.dvcs.ui.BranchActionUtil.FAVORITE_BRANCH_COMPARATOR)2 BranchActionUtil.getNumOfTopShownBranches (com.intellij.dvcs.ui.BranchActionUtil.getNumOfTopShownBranches)2 AllIcons (com.intellij.icons.AllIcons)2 Group (com.intellij.openapi.keymap.impl.ui.Group)2 Project (com.intellij.openapi.project.Project)2 PsiElement (com.intellij.psi.PsiElement)2 ArrayList (java.util.ArrayList)2