Search in sources :

Example 6 with ActionPopupMenu

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

the class StripeButton method showPopup.

private void showPopup(final Component component, final int x, final int y) {
    final ActionGroup group = myDecorator.createPopupGroup();
    final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
    popupMenu.getComponent().show(component, x, y);
}
Also used : ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) ActionPopupMenu(com.intellij.openapi.actionSystem.ActionPopupMenu)

Example 7 with ActionPopupMenu

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

the class TodoCheckinHandler method getBeforeCheckinConfigurationPanel.

@Override
public RefreshableOnComponent getBeforeCheckinConfigurationPanel() {
    JCheckBox checkBox = new JCheckBox(VcsBundle.message("before.checkin.new.todo.check", ""));
    return new RefreshableOnComponent() {

        @Override
        public JComponent getComponent() {
            JPanel panel = new JPanel(new BorderLayout(4, 0));
            panel.add(checkBox, BorderLayout.WEST);
            setFilterText(myConfiguration.myTodoPanelSettings.todoFilterName);
            if (myConfiguration.myTodoPanelSettings.todoFilterName != null) {
                myTodoFilter = TodoConfiguration.getInstance().getTodoFilter(myConfiguration.myTodoPanelSettings.todoFilterName);
            }
            Consumer<TodoFilter> consumer = todoFilter -> {
                myTodoFilter = todoFilter;
                String name = todoFilter == null ? null : todoFilter.getName();
                myConfiguration.myTodoPanelSettings.todoFilterName = name;
                setFilterText(name);
            };
            LinkLabel linkLabel = new LinkLabel("Configure", null);
            linkLabel.setListener(new LinkListener() {

                @Override
                public void linkSelected(LinkLabel aSource, Object aLinkData) {
                    DefaultActionGroup group = SetTodoFilterAction.createPopupActionGroup(myProject, myConfiguration.myTodoPanelSettings, consumer);
                    ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR, group);
                    popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight());
                }
            }, null);
            panel.add(linkLabel, BorderLayout.CENTER);
            CheckinHandlerUtil.disableWhenDumb(myProject, checkBox, "TODO check is impossible until indices are up-to-date");
            return panel;
        }

        private void setFilterText(String filterName) {
            if (filterName == null) {
                checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", IdeBundle.message("action.todo.show.all")));
            } else {
                checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", "Filter: " + filterName));
            }
        }

        @Override
        public void refresh() {
        }

        @Override
        public void saveState() {
            myConfiguration.CHECK_NEW_TODO = checkBox.isSelected();
        }

        @Override
        public void restoreState() {
            checkBox.setSelected(myConfiguration.CHECK_NEW_TODO);
        }
    };
}
Also used : ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) DateFormatUtil(com.intellij.util.text.DateFormatUtil) LinkListener(com.intellij.ui.components.labels.LinkListener) Change(com.intellij.openapi.vcs.changes.Change) UIUtil.getWarningIcon(com.intellij.util.ui.UIUtil.getWarningIcon) ModalityState(com.intellij.openapi.application.ModalityState) PairConsumer(com.intellij.util.PairConsumer) com.intellij.ide.todo(com.intellij.ide.todo) ActionManager(com.intellij.openapi.actionSystem.ActionManager) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) Task(com.intellij.openapi.progress.Task) ActionPopupMenu(com.intellij.openapi.actionSystem.ActionPopupMenu) ApplicationNamesInfo(com.intellij.openapi.application.ApplicationNamesInfo) Project(com.intellij.openapi.project.Project) LinkLabel(com.intellij.ui.components.labels.LinkLabel) Messages(com.intellij.openapi.ui.Messages) CommitExecutor(com.intellij.openapi.vcs.changes.CommitExecutor) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ProgressManager(com.intellij.openapi.progress.ProgressManager) DumbService(com.intellij.openapi.project.DumbService) CheckinProjectPanel(com.intellij.openapi.vcs.CheckinProjectPanel) ToolWindow(com.intellij.openapi.wm.ToolWindow) StringUtil(com.intellij.openapi.util.text.StringUtil) Collection(java.util.Collection) Content(com.intellij.ui.content.Content) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) RefreshableOnComponent(com.intellij.openapi.vcs.ui.RefreshableOnComponent) VcsBundle(com.intellij.openapi.vcs.VcsBundle) java.awt(java.awt) IdeBundle(com.intellij.ide.IdeBundle) Nullable(org.jetbrains.annotations.Nullable) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) ServiceManager(com.intellij.openapi.components.ServiceManager) ActionPlaces(com.intellij.openapi.actionSystem.ActionPlaces) ApplicationManager(com.intellij.openapi.application.ApplicationManager) ContentManager(com.intellij.ui.content.ContentManager) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) Consumer(com.intellij.util.Consumer) javax.swing(javax.swing) CommonBundle.getCancelButtonText(com.intellij.CommonBundle.getCancelButtonText) LinkListener(com.intellij.ui.components.labels.LinkListener) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) LinkLabel(com.intellij.ui.components.labels.LinkLabel) ActionPopupMenu(com.intellij.openapi.actionSystem.ActionPopupMenu) RefreshableOnComponent(com.intellij.openapi.vcs.ui.RefreshableOnComponent)

Example 8 with ActionPopupMenu

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

the class CopyOptionsDialog method createUI.

private void createUI() {
    myMainPanel = new JPanel(new BorderLayout());
    myBrowser = new RepositoryBrowserComponent(SvnVcs.getInstance(myProject));
    final DefaultActionGroup group = new DefaultActionGroup();
    group.add(new RepositoryBrowserDialog.MkDirAction(myBrowser) {

        @Override
        public void update(AnActionEvent e) {
            super.update(e);
            e.getPresentation().setText("New Remote Folder...");
        }
    });
    group.add(new RepositoryBrowserDialog.DeleteAction(myBrowser));
    group.add(new RepositoryBrowserDialog.RefreshAction(myBrowser));
    final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu("", group);
    final JPopupMenu component = popupMenu.getComponent();
    myBrowser.getRepositoryTree().addMouseListener(new PopupHandler() {

        @Override
        public void invokePopup(Component comp, int x, int y) {
            component.show(comp, x, y);
        }
    });
    final Splitter splitter = new Splitter(true);
    splitter.setProportion(0.7f);
    final JPanel wrapper = createBrowserPartWrapper();
    splitter.setFirstComponent(wrapper);
    final JPanel commitMessageWrapper = createCommitMessageWrapper();
    splitter.setSecondComponent(commitMessageWrapper);
    myMainPanel.add(splitter, BorderLayout.CENTER);
    final JPanel recentMessagesWrapper = new JPanel(new BorderLayout());
    recentMessagesWrapper.add(new JLabel("Recent Messages:"), BorderLayout.NORTH);
    myMessagesBox = new JComboBox();
    recentMessagesWrapper.add(myMessagesBox, BorderLayout.SOUTH);
    recentMessagesWrapper.setBorder(JBUI.Borders.emptyTop(4));
    myMainPanel.add(recentMessagesWrapper, BorderLayout.SOUTH);
}
Also used : PopupHandler(com.intellij.ui.PopupHandler) Splitter(com.intellij.openapi.ui.Splitter) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) RepositoryBrowserDialog(org.jetbrains.idea.svn.dialogs.RepositoryBrowserDialog) ActionPopupMenu(com.intellij.openapi.actionSystem.ActionPopupMenu) RepositoryBrowserComponent(org.jetbrains.idea.svn.dialogs.RepositoryBrowserComponent) RepositoryBrowserComponent(org.jetbrains.idea.svn.dialogs.RepositoryBrowserComponent)

Example 9 with ActionPopupMenu

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

the class SelectCreateExternalTargetDialog method createPopup.

protected JPopupMenu createPopup(boolean toolWindow) {
    DefaultActionGroup group = new DefaultActionGroup();
    DefaultActionGroup newGroup = new DefaultActionGroup("_New", true);
    final RepositoryBrowserComponent browser = getRepositoryBrowser();
    newGroup.add(new AddLocationAction(browser));
    newGroup.add(new MkDirAction(browser));
    group.add(newGroup);
    group.addSeparator();
    group.add(new RefreshAction(browser));
    group.add(new DiscardLocationAction(browser));
    ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu("", group);
    return menu.getComponent();
}
Also used : ActionPopupMenu(com.intellij.openapi.actionSystem.ActionPopupMenu) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 10 with ActionPopupMenu

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

the class SelectionTool method handlePopup.

@Override
protected void handlePopup() {
    ActionManager actionManager = ActionManager.getInstance();
    ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(myArea.getPopupPlace(), myArea.getPopupActions());
    MouseEvent event = (MouseEvent) myInputEvent;
    popupMenu.getComponent().show(myArea.getNativeComponent(), event.getX(), event.getY());
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) MouseEvent(java.awt.event.MouseEvent) ActionPopupMenu(com.intellij.openapi.actionSystem.ActionPopupMenu)

Aggregations

ActionPopupMenu (com.intellij.openapi.actionSystem.ActionPopupMenu)10 ActionManager (com.intellij.openapi.actionSystem.ActionManager)3 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)3 MouseEvent (java.awt.event.MouseEvent)3 MouseAdapter (java.awt.event.MouseAdapter)2 CommonBundle.getCancelButtonText (com.intellij.CommonBundle.getCancelButtonText)1 IdeBundle (com.intellij.ide.IdeBundle)1 com.intellij.ide.todo (com.intellij.ide.todo)1 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)1 ActionPlaces (com.intellij.openapi.actionSystem.ActionPlaces)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 ApplicationNamesInfo (com.intellij.openapi.application.ApplicationNamesInfo)1 ModalityState (com.intellij.openapi.application.ModalityState)1 ServiceManager (com.intellij.openapi.components.ServiceManager)1 EditorMouseEvent (com.intellij.openapi.editor.event.EditorMouseEvent)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 Task (com.intellij.openapi.progress.Task)1 DumbService (com.intellij.openapi.project.DumbService)1