myLabel.setText("All");
}
@Override
protected void createActions(Consumer<AnAction> actionConsumer) {
actionConsumer.consume(new DumbAwareAction("All") {
@Override
public void actionPerformed(AnActionEvent e) {
value = Optional.absent();
myLabel.setText("All");
setChanged();
notifyObservers(project);
}
});
Iterable<GitRepository> repositories = gerritGitUtil.getRepositories(project);
for (final GitRepository repository : repositories) {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new Separator(getNameForRepository(repository)));
List<GitRemoteBranch> branches = Lists.newArrayList(repository.getBranches().getRemoteBranches());
Ordering<GitRemoteBranch> ordering = Ordering.natural().onResultOf(new Function<GitRemoteBranch, String>() {
@Override
public String apply(GitRemoteBranch branch) {
return branch.getNameForRemoteOperations();
}
});
Collections.sort(branches, ordering);
for (final GitRemoteBranch branch : branches) {
if (!branch.getNameForRemoteOperations().equals("HEAD")) {
group.add(new DumbAwareAction(branch.getNameForRemoteOperations()) {
@Override
public void actionPerformed(AnActionEvent e) {
value = Optional.of(new BranchDescriptor(repository, branch));
myLabel.setText(branch.getNameForRemoteOperations());
setChanged();