Example usage for com.intellij.openapi.actionSystem DefaultActionGroup addSeparator

List of usage examples for com.intellij.openapi.actionSystem DefaultActionGroup addSeparator

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem DefaultActionGroup addSeparator.

Prototype

public void addSeparator(@Nullable String separatorText) 

Source Link

Usage

From source file:com.intellij.vcs.log.ui.filter.BranchFilterPopupComponent.java

License:Apache License

private static DefaultActionGroup getFilteredActionGroup(@NotNull Groups groups,
        @Nullable ActionGroup recentItems, @NotNull Function<String, AnAction> actionGetter) {
    DefaultActionGroup actionGroup = new DefaultActionGroup();
    for (String single : groups.singletonGroups) {
        actionGroup.add(actionGetter.fun(single));
    }//  www  . j a va  2 s .  com
    if (recentItems != null) {
        actionGroup.add(recentItems);
    }
    for (Map.Entry<String, TreeSet<String>> group : groups.expandedGroups.entrySet()) {
        actionGroup.addSeparator(group.getKey());
        for (String action : group.getValue()) {
            actionGroup.add(actionGetter.fun(action));
        }
    }
    actionGroup.addSeparator();
    for (Map.Entry<String, TreeSet<String>> group : groups.collapsedGroups.entrySet()) {
        DefaultActionGroup popupGroup = new DefaultActionGroup(group.getKey(), true);
        for (String action : group.getValue()) {
            popupGroup.add(actionGetter.fun(action));
        }
        actionGroup.add(popupGroup);
    }
    return actionGroup;
}

From source file:com.intellij.vcs.log.ui.filter.MultipleValueFilterPopupComponent.java

License:Apache License

@NotNull
protected ActionGroup createRecentItemsActionGroup() {
    DefaultActionGroup group = new DefaultActionGroup();
    List<List<String>> recentlyFilteredUsers = getRecentValuesFromSettings();
    if (!recentlyFilteredUsers.isEmpty()) {
        group.addSeparator("Recent");
        for (List<String> recentGroup : recentlyFilteredUsers) {
            group.add(new PredefinedValueAction(recentGroup));
        }//  w w  w  .j  a  v  a  2  s. com
        group.addSeparator();
    }
    return group;
}

From source file:org.zmlx.hg4idea.branch.HgBranchPopup.java

License:Apache License

@Override
protected void fillWithCommonRepositoryActions(@NotNull DefaultActionGroup popupGroup,
        @NotNull AbstractRepositoryManager<HgRepository> repositoryManager) {
    List<HgRepository> allRepositories = repositoryManager.getRepositories();
    popupGroup.add(new HgBranchPopupActions.HgNewBranchAction(myProject, allRepositories, myCurrentRepository));
    popupGroup.addAction(new HgBranchPopupActions.HgNewBookmarkAction(allRepositories, myCurrentRepository));
    popupGroup.addAction(new HgBranchPopupActions.HgCloseBranchAction(allRepositories, myCurrentRepository));
    popupGroup/*from  ww  w. j a  va2  s .  c  o m*/
            .addAction(new HgBranchPopupActions.HgShowUnnamedHeadsForCurrentBranchAction(myCurrentRepository));
    popupGroup.addAll(createRepositoriesActions());

    popupGroup.addSeparator("Common Branches");
    for (String branch : myMultiRootBranchConfig.getLocalBranchNames()) {
        List<HgRepository> repositories = filterRepositoriesNotOnThisBranch(branch, allRepositories);
        if (!repositories.isEmpty()) {
            popupGroup.add(new HgCommonBranchActions(myProject, repositories, branch));
        }
    }
    popupGroup.addSeparator("Common Bookmarks");
    for (String branch : ((HgMultiRootBranchConfig) myMultiRootBranchConfig).getBookmarkNames()) {
        List<HgRepository> repositories = filterRepositoriesNotOnThisBranch(branch, allRepositories);
        if (!repositories.isEmpty()) {
            popupGroup.add(new HgBranchPopupActions.BookmarkActions(myProject, repositories, branch));
        }
    }
}

From source file:org.zmlx.hg4idea.branch.HgBranchPopup.java

License:Apache License

@NotNull
protected DefaultActionGroup createRepositoriesActions() {
    DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
    popupGroup.addSeparator("Repositories");
    for (HgRepository repository : DvcsUtil.sortRepositories(myRepositoryManager.getRepositories())) {
        popupGroup.add(new RootAction<>(repository, highlightCurrentRepo() ? myCurrentRepository : null,
                new HgBranchPopupActions(repository.getProject(), repository).createActions(),
                HgUtil.getDisplayableBranchOrBookmarkText(repository)));
    }//from   w w  w . j  a va 2 s.  c  o m
    return popupGroup;
}

From source file:org.zmlx.hg4idea.branch.HgBranchPopupActions.java

License:Apache License

ActionGroup createActions(@Nullable DefaultActionGroup toInsert, @NotNull String repoInfo) {
    DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
    popupGroup/* ww w. j a v  a 2s.c  o m*/
            .addAction(new HgNewBranchAction(myProject, Collections.singletonList(myRepository), myRepository));
    popupGroup.addAction(new HgNewBookmarkAction(Collections.singletonList(myRepository), myRepository));
    popupGroup.addAction(new HgBranchPopupActions.HgCloseBranchAction(Collections.singletonList(myRepository),
            myRepository));
    popupGroup.addAction(new HgShowUnnamedHeadsForCurrentBranchAction(myRepository));
    if (toInsert != null) {
        popupGroup.addAll(toInsert);
    }

    popupGroup.addSeparator("Bookmarks" + repoInfo);
    List<String> bookmarkNames = getSortedNamesWithoutHashes(myRepository.getBookmarks());
    String currentBookmark = myRepository.getCurrentBookmark();
    for (String bookmark : bookmarkNames) {
        AnAction bookmarkAction = new BookmarkActions(myProject, Collections.singletonList(myRepository),
                bookmark);
        if (bookmark.equals(currentBookmark)) {
            bookmarkAction.getTemplatePresentation().setIcon(PlatformIcons.CHECK_ICON);
        }
        popupGroup.add(bookmarkAction);
    }

    popupGroup.addSeparator("Branches" + repoInfo);
    List<String> branchNamesList = new ArrayList<>(myRepository.getOpenedBranches());//only opened branches have to be shown
    Collections.sort(branchNamesList);
    for (String branch : branchNamesList) {
        if (!branch.equals(myRepository.getCurrentBranch())) { // don't show current branch in the list
            popupGroup
                    .add(new HgCommonBranchActions(myProject, Collections.singletonList(myRepository), branch));
        }
    }
    return popupGroup;
}