Search in sources :

Example 76 with DefaultActionGroup

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

the class ChooseLibrariesDialogBase method createNorthPanel.

@Override
protected JComponent createNorthPanel() {
    final DefaultActionGroup group = new DefaultActionGroup();
    final TreeExpander expander = new DefaultTreeExpander(myTree);
    final CommonActionsManager actionsManager = CommonActionsManager.getInstance();
    group.add(actionsManager.createExpandAllAction(expander, myTree));
    group.add(actionsManager.createCollapseAllAction(expander, myTree));
    final JComponent component = ActionManager.getInstance().createActionToolbar(ActionPlaces.PROJECT_VIEW_TOOLBAR, group, true).getComponent();
    component.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.darkGray), component.getBorder()));
    return component;
}
Also used : DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) TreeExpander(com.intellij.ide.TreeExpander) CommonActionsManager(com.intellij.ide.CommonActionsManager) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 77 with DefaultActionGroup

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

the class DebuggerUtilsEx method addThreadDump.

public static void addThreadDump(Project project, List<ThreadState> threads, final RunnerLayoutUi ui, DebuggerSession session) {
    final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
    consoleBuilder.filters(ExceptionFilters.getFilters(session.getSearchScope()));
    final ConsoleView consoleView = consoleBuilder.getConsole();
    final DefaultActionGroup toolbarActions = new DefaultActionGroup();
    consoleView.allowHeavyFilters();
    final ThreadDumpPanel panel = new ThreadDumpPanel(project, consoleView, toolbarActions, threads);
    final String id = THREAD_DUMP_CONTENT_PREFIX + " #" + myCurrentThreadDumpId;
    final Content content = ui.createContent(id, panel, id, null, null);
    content.putUserData(RunnerContentUi.LIGHTWEIGHT_CONTENT_MARKER, Boolean.TRUE);
    content.setCloseable(true);
    content.setDescription("Thread Dump");
    ui.addContent(content);
    ui.selectAndFocus(content, true, true);
    myThreadDumpsCount++;
    myCurrentThreadDumpId++;
    Disposer.register(content, new Disposable() {

        @Override
        public void dispose() {
            myThreadDumpsCount--;
            if (myThreadDumpsCount == 0) {
                myCurrentThreadDumpId = 1;
            }
        }
    });
    Disposer.register(content, consoleView);
    ui.selectAndFocus(content, true, false);
    if (threads.size() > 0) {
        panel.selectStackFrame(0);
    }
}
Also used : Disposable(com.intellij.openapi.Disposable) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) ConsoleView(com.intellij.execution.ui.ConsoleView) Content(com.intellij.ui.content.Content) ThreadDumpPanel(com.intellij.unscramble.ThreadDumpPanel) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 78 with DefaultActionGroup

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

the class DvcsBranchPopup method createActions.

@NotNull
private ActionGroup createActions() {
    DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
    AbstractRepositoryManager<Repo> repositoryManager = myRepositoryManager;
    if (repositoryManager.moreThanOneRoot()) {
        if (userWantsSyncControl()) {
            fillWithCommonRepositoryActions(popupGroup, repositoryManager);
        } else {
            fillPopupWithCurrentRepositoryActions(popupGroup, createRepositoriesActions());
        }
    } else {
        fillPopupWithCurrentRepositoryActions(popupGroup, null);
    }
    popupGroup.addSeparator();
    return popupGroup;
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) NotNull(org.jetbrains.annotations.NotNull)

Example 79 with DefaultActionGroup

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

the class BeforeRunStepsPanel method doAddAction.

void doAddAction(AnActionButton button) {
    if (isUnknown()) {
        return;
    }
    final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
    final BeforeRunTaskProvider<BeforeRunTask>[] providers = Extensions.getExtensions(BeforeRunTaskProvider.EXTENSION_POINT_NAME, myRunConfiguration.getProject());
    Set<Key> activeProviderKeys = getActiveProviderKeys();
    DefaultActionGroup actionGroup = new DefaultActionGroup(null, false);
    for (final BeforeRunTaskProvider<BeforeRunTask> provider : providers) {
        if (provider.createTask(myRunConfiguration) == null)
            continue;
        if (activeProviderKeys.contains(provider.getId()) && provider.isSingleton())
            continue;
        AnAction providerAction = new AnAction(provider.getName(), null, provider.getIcon()) {

            @Override
            public void actionPerformed(AnActionEvent e) {
                BeforeRunTask task = provider.createTask(myRunConfiguration);
                if (task != null) {
                    provider.configureTask(myRunConfiguration, task);
                    if (!provider.canExecuteTask(myRunConfiguration, task))
                        return;
                } else {
                    return;
                }
                task.setEnabled(true);
                Set<RunConfiguration> configurationSet = new HashSet<>();
                getAllRunBeforeRuns(task, configurationSet);
                if (configurationSet.contains(myRunConfiguration)) {
                    JOptionPane.showMessageDialog(BeforeRunStepsPanel.this, ExecutionBundle.message("before.launch.panel.cyclic_dependency_warning", myRunConfiguration.getName(), provider.getDescription(task)), ExecutionBundle.message("warning.common.title"), JOptionPane.WARNING_MESSAGE);
                    return;
                }
                addTask(task);
                myListener.fireStepsBeforeRunChanged();
            }
        };
        actionGroup.add(providerAction);
    }
    final ListPopup popup = popupFactory.createActionGroupPopup(ExecutionBundle.message("add.new.run.configuration.acrtion.name"), actionGroup, SimpleDataContext.getProjectContext(myRunConfiguration.getProject()), false, false, false, null, -1, Conditions.<AnAction>alwaysTrue());
    popup.show(button.getPreferredPopupPoint());
}
Also used : ListPopup(com.intellij.openapi.ui.popup.ListPopup) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction) BeforeRunTask(com.intellij.execution.BeforeRunTask) UnknownRunConfiguration(com.intellij.execution.configurations.UnknownRunConfiguration) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) JBPopupFactory(com.intellij.openapi.ui.popup.JBPopupFactory) BeforeRunTaskProvider(com.intellij.execution.BeforeRunTaskProvider) Key(com.intellij.openapi.util.Key) HashSet(com.intellij.util.containers.hash.HashSet)

Example 80 with DefaultActionGroup

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

the class IntentionSettingsTree method initTree.

private void initTree() {
    myTree = new CheckboxTree(new CheckboxTree.CheckboxTreeCellRenderer(true) {

        @Override
        public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            if (!(value instanceof CheckedTreeNode))
                return;
            CheckedTreeNode node = (CheckedTreeNode) value;
            SimpleTextAttributes attributes = node.getUserObject() instanceof IntentionActionMetaData ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
            final String text = getNodeText(node);
            final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
            UIUtil.changeBackGround(this, background);
            if (text != null) {
                SearchUtil.appendFragments(myFilter != null ? myFilter.getFilter() : null, text, attributes.getStyle(), attributes.getFgColor(), background, getTextRenderer());
            }
        }
    }, new CheckedTreeNode(null));
    myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            TreePath path = e.getPath();
            Object userObject = ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
            selectionChanged(userObject);
        }
    });
    myFilter = new MyFilterComponent();
    myComponent = new JPanel(new BorderLayout());
    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
    myNorthPanel = new JPanel(new BorderLayout());
    myNorthPanel.add(myFilter, BorderLayout.CENTER);
    final DefaultActionGroup group = new DefaultActionGroup();
    final CommonActionsManager actionManager = CommonActionsManager.getInstance();
    final DefaultTreeExpander treeExpander = new DefaultTreeExpander(myTree);
    group.add(actionManager.createExpandAllAction(treeExpander, myTree));
    group.add(actionManager.createCollapseAllAction(treeExpander, myTree));
    myNorthPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true).getComponent(), BorderLayout.WEST);
    myComponent.add(myNorthPanel, BorderLayout.NORTH);
    myComponent.add(scrollPane, BorderLayout.CENTER);
    myFilter.reset();
}
Also used : TreeSelectionListener(javax.swing.event.TreeSelectionListener) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) TreePath(javax.swing.tree.TreePath) CommonActionsManager(com.intellij.ide.CommonActionsManager) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent)

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