class BranchSelectorPopUpPresenter {

    public void setup(final ImportProject importProject,
                      final Consumer<List<String>> branchesSelectedCallback) {
        this.importProject = importProject;
        this.branchesSelectedCallback = branchesSelectedCallback;

        final List<String> allBranches = importProject.getAllBranches();
        allBranches.sort(String.CASE_INSENSITIVE_ORDER);
        view.init(this);

        this.branches = importProject.getSelectedBranches();
        this.branches.sort(String.CASE_INSENSITIVE_ORDER);
        if (!this.branches.contains("master")) {
            this.branches.add("master");
        }

        branchSelector.setup(view.getBranchSelectorContainer(),
                             allBranches.stream().map(branch -> new KieSelectOption(branch, branch)).collect(toList()),
                             this.branches,
                             this::setSelectedBranches);

        view.show();
    }

    @Inject public  BranchSelectorPopUpPresenter(final View view,
                                        final KieMultipleSelectElement branchSelector);

}