private ComboBoxModel createRemoteBranchDropdownModel() { final SortedComboBoxModel<GitRemoteBranch> sortedRemoteBranches = new SortedComboBoxModel<GitRemoteBranch>(new BranchComparator()); final GitRepoInfo gitRepoInfo = this.getInfo(); assert gitRepoInfo != null; final GitRemoteBranch remoteTrackingBranch = this.getRemoteTrackingBranch(); // only show valid remote branches sortedRemoteBranches.addAll( Collections2.filter( gitRepoInfo.getRemoteBranches(), new Predicate<GitRemoteBranch>() { @Override public boolean apply(final GitRemoteBranch remoteBranch) { /* two conditions: * 1. remote must be a vso/tfs remote * 2. this isn't the remote tracking branch of current local branch */ return tfGitRemotes.contains(remoteBranch.getRemote()) && !remoteBranch.equals(remoteTrackingBranch); } })); sortedRemoteBranches.setSelectedItem(getDefaultBranch(sortedRemoteBranches.getItems())); return sortedRemoteBranches; }
@Nullable public Module getSelectedModule() { return myModel.getSelectedItem(); }
public void setSelectedModule(@Nullable Module module) { myModel.setSelectedItem(module); }
public void fillModules(@NotNull Project project) { myModel.clear(); for (Module module : ModuleManager.getInstance(project).getModules()) { myModel.add(module); } }