@SuppressWarnings({"rawtypes", "unchecked"})
  public static void setupRootChooser(final @NotNull Project project,
                                      final @NotNull List<? extends VirtualFile> roots,
                                      final @Nullable VirtualFile defaultRoot,
                                      final @NotNull JComboBox gitRootChooser,
                                      final @Nullable JLabel currentBranchLabel) {
    for (VirtualFile root : roots) {
      gitRootChooser.addItem(root);
    }
    gitRootChooser.setRenderer(SimpleListCellRenderer.create(GitBundle.message("combobox.item.file.invalid"),
                                                             VirtualFile::getPresentableUrl));
    gitRootChooser.setSelectedItem(defaultRoot != null ? defaultRoot : roots.get(0));
    if (currentBranchLabel != null) {
      final ActionListener listener = new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
          VirtualFile root = (VirtualFile)gitRootChooser.getSelectedItem();
          assert root != null : "The root must not be null";
          GitRepository repo = GitUtil.getRepositoryManager(project).getRepositoryForRootQuick(root);
          assert repo != null : "The repository must not be null";
          GitBranch current = repo.getCurrentBranch();
          if (current == null) {
            currentBranchLabel.setText(getNoCurrentBranch());
          }
          else {
            currentBranchLabel.setText(current.getName());
          }
        }
      };
      listener.actionPerformed(null);
      gitRootChooser.addActionListener(listener);
    }
  }
@SuppressWarnings({"rawtypes", "unchecked"})
  public static void setupRootChooser(final @NotNull Project project,
                                      final @NotNull List<? extends VirtualFile> roots,
                                      final @Nullable VirtualFile defaultRoot,
                                      final @NotNull JComboBox gitRootChooser,
                                      final @Nullable JLabel currentBranchLabel)