How to create own BranchActionGroupPopup?
Hi, This one is a little bit hard to explain and maybe much harder to solve. I have created my own GitBranchPopup-Menu which extends from MyDvcsBranchPopup. Why do i need this?: I need a branch-selector, but in my case i dont need multiple actions (Checkout, New branch from selected, ... Push, Rename, ect)

i need a flat menu instead. i was able to create this. but unfortunately if you collapse the list tho only show favs
it is not longer possible to search over the collapsed items (with visible items it works):

If you show all items in the list it works with all list items again:


I think the Problem is
HideableActionGroup
which needs to be implemented as a *group* action. i cannot use this as is, because i pass my own
myBranchAction
which is not compatible, so i need to write my own (this whole thing ended with 7 classes :-) https://bitbucket.org/comodmw/git-scope/src/TargetBranchPopup/src/main/java/implementation/targetBranchWidget/ )
who can help me to finish this method?
private HideableActionGroup(@NotNull MyBranchAction myBranchAction, @NotNull MoreAction moreAction) {
super(new ActionGroup() {
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
// return new AnAction[]{myBranchAction};
if (!moreAction.isExpanded()) {
// myBranchAction
// return new AnAction[]{myBranchAction};
// return new AnAction[]{new EmptyAction(myBranchAction)};
// @todo Searchable Actions
return new AnAction[]{new EmptyAction()};
} else {
return new AnAction[]{myBranchAction};
}
}
});
myMoreAction = moreAction;
}
Thanks!
Please sign in to leave a comment.

If you need to dramatically change this popup, it is easier not to extend it.
You can use `JBPopupFactory.getInstance().createActionGroupPopup()` and have full control over actions in it.
See also `GitRepositoryManager` and `GitRepository.getBranches`.
Everything fits, including the favorite and show / hide feature - that would be the only thing left :-) - but I'll take a closer look
Problem solved: https://bitbucket.org/comodmw/git-scope/commits/800036dae98a93c74122c89310c9b7c30a5b0114
For the record, you're doing it at your own risk.
These internals are not an API and might be changed without any notice.