Search in sources :

Example 91 with DefaultActionGroup

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

the class ChangeListViewerDialog method createCenterPanel.

public JComponent createCenterPanel() {
    final JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    final Splitter splitter = new Splitter(true, 0.8f);
    myChangesBrowser = new RepositoryChangesBrowser(myProject, Collections.singletonList(myChangeList), new ArrayList<>(myChangeList.getChanges()), myChangeList, myToSelect) {

        @Override
        protected void buildToolBar(DefaultActionGroup toolBarGroup) {
            super.buildToolBar(toolBarGroup);
            toolBarGroup.add(ActionManager.getInstance().getAction(VcsActions.ACTION_COPY_REVISION_NUMBER));
        }
    };
    Disposer.register(getDisposable(), myChangesBrowser);
    myChangesBrowser.setUseCase(myInAir ? CommittedChangesBrowserUseCase.IN_AIR : null);
    splitter.setFirstComponent(myChangesBrowser);
    if (myCommitMessageArea != null) {
        JPanel commitPanel = new JPanel(new BorderLayout());
        JComponent separator = SeparatorFactory.createSeparator(VcsBundle.message("label.commit.comment"), myCommitMessageArea);
        commitPanel.add(separator, BorderLayout.NORTH);
        commitPanel.add(commitMessageScroll, BorderLayout.CENTER);
        splitter.setSecondComponent(commitPanel);
    }
    mainPanel.add(splitter, BorderLayout.CENTER);
    final String description = getDescription();
    if (description != null) {
        JPanel descPanel = new JPanel();
        descPanel.add(new JLabel(XmlStringUtil.wrapInHtml(description)));
        descPanel.setBorder(BorderFactory.createEtchedBorder());
        mainPanel.add(descPanel, BorderLayout.NORTH);
    }
    return mainPanel;
}
Also used : Splitter(com.intellij.openapi.ui.Splitter) RepositoryChangesBrowser(com.intellij.openapi.vcs.changes.committed.RepositoryChangesBrowser) ArrayList(java.util.ArrayList) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 92 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup 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 93 with DefaultActionGroup

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

the class TabLabel method handlePopup.

private void handlePopup(final MouseEvent e) {
    if (e.getClickCount() != 1 || !e.isPopupTrigger())
        return;
    if (e.getX() < 0 || e.getX() >= e.getComponent().getWidth() || e.getY() < 0 || e.getY() >= e.getComponent().getHeight())
        return;
    String place = myTabs.getPopupPlace();
    place = place != null ? place : ActionPlaces.UNKNOWN;
    myTabs.myPopupInfo = myInfo;
    final DefaultActionGroup toShow = new DefaultActionGroup();
    if (myTabs.getPopupGroup() != null) {
        toShow.addAll(myTabs.getPopupGroup());
        toShow.addSeparator();
    }
    JBTabsImpl tabs = JBTabsImpl.NAVIGATION_ACTIONS_KEY.getData(DataManager.getInstance().getDataContext(e.getComponent(), e.getX(), e.getY()));
    if (tabs == myTabs && myTabs.myAddNavigationGroup) {
        toShow.addAll(myTabs.myNavigationActions);
    }
    if (toShow.getChildrenCount() == 0)
        return;
    myTabs.myActivePopup = myTabs.myActionManager.createActionPopupMenu(place, toShow).getComponent();
    myTabs.myActivePopup.addPopupMenuListener(myTabs.myPopupListener);
    myTabs.myActivePopup.addPopupMenuListener(myTabs);
    myTabs.myActivePopup.show(e.getComponent(), e.getX(), e.getY());
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 94 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup 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 95 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup 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)

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