use of git4idea.ui.GitRepositoryComboboxListCellRenderer in project intellij-community by JetBrains.
the class GitBranchIsNotFullyMergedDialog method createNorthPanel.
@Override
protected JComponent createNorthPanel() {
JBLabel descriptionLabel = new JBLabel(makeDescription(myInitialRepository));
JComboBox repositorySelector = new JComboBox(ArrayUtil.toObjectArray(myRepositories, GitRepository.class));
repositorySelector.setRenderer(new GitRepositoryComboboxListCellRenderer(repositorySelector));
repositorySelector.setSelectedItem(myInitialRepository);
repositorySelector.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
GitRepository selectedRepo = (GitRepository) repositorySelector.getSelectedItem();
descriptionLabel.setText(makeDescription(selectedRepo));
myCommitListWithDiffPanel.setCommits(myCommits.get(selectedRepo));
}
});
JPanel repoSelectorPanel = new JPanel(new BorderLayout());
JBLabel label = new JBLabel("Repository: ");
label.setLabelFor(repoSelectorPanel);
repoSelectorPanel.add(label, BorderLayout.WEST);
repoSelectorPanel.add(repositorySelector);
if (myRepositories.size() < 2) {
repoSelectorPanel.setVisible(false);
}
JPanel northPanel = new JPanel(new BorderLayout());
northPanel.add(descriptionLabel);
northPanel.add(repoSelectorPanel, BorderLayout.SOUTH);
return northPanel;
}
use of git4idea.ui.GitRepositoryComboboxListCellRenderer in project intellij-community by JetBrains.
the class GitCompareBranchesLogPanel method createNorthPanel.
private JComponent createNorthPanel() {
final JComboBox repoSelector = new JComboBox(ArrayUtil.toObjectArray(myCompareInfo.getRepositories(), GitRepository.class));
repoSelector.setRenderer(new GitRepositoryComboboxListCellRenderer(repoSelector));
repoSelector.setSelectedItem(myInitialRepo);
repoSelector.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
GitRepository selectedRepo = (GitRepository) repoSelector.getSelectedItem();
myHeadToBranchListPanel.setCommits(getHeadToBranchCommits(selectedRepo));
myBranchToHeadListPanel.setCommits(getBranchToHeadCommits(selectedRepo));
}
});
JPanel repoSelectorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
JBLabel label = new JBLabel("Repository: ");
label.setLabelFor(repoSelectorPanel);
label.setDisplayedMnemonic(KeyEvent.VK_R);
repoSelectorPanel.add(label);
repoSelectorPanel.add(repoSelector);
if (myCompareInfo.getRepositories().size() < 2) {
repoSelectorPanel.setVisible(false);
}
return repoSelectorPanel;
}
Aggregations