class AddProjectPopUpPresenter {

    void finishLoadTemplates(final ArchetypePreferences preferences) {
        final List<String> templates = preferences.getArchetypeSelectionMap()
                .entrySet()
                .stream()
                .filter(Map.Entry::getValue)
                .map(Map.Entry::getKey)
                .sorted()
                .collect(Collectors.toList());

        final boolean templatesAvailable = !templates.isEmpty();

        if (templatesAvailable) {
            final String defaultSelection = preferences.getDefaultSelection();
            final int selectedTemplateIdx = IntStream.range(0, templates.size())
                    .filter(i -> templates.get(i).equals(defaultSelection))
                    .findFirst()
                    .orElse(0);

            view.setTemplates(templates, selectedTemplateIdx);
        } else {
            view.setTemplates(Collections.singletonList(
                    translationService.getTranslation(LibraryConstants.NoTemplatesAvailable)),
                              0);
        }

        view.enableBasedOnTemplatesCheckbox(templatesAvailable);

        view.show();
    }

    @Inject public  AddProjectPopUpPresenter(final Caller<LibraryService> libraryService,
                                    final BusyIndicatorView busyIndicatorView,
                                    final Event<NotificationEvent> notificationEvent,
                                    final LibraryPlaces libraryPlaces,
                                    final WorkspaceProjectContext projectContext,
                                    final View view,
                                    final SessionInfo sessionInfo,
                                    final Event<NewProjectEvent> newProjectEvent,
                                    final LibraryPreferences libraryPreferences,
                                    final ConflictingRepositoriesPopup conflictingRepositoriesPopup,
                                    final Caller<ValidationService> validationService,
                                    final ErrorPopup errorPopup,
                                    final TranslationService translationService,
                                    final Caller<WorkspaceProjectService> projectService,
                                    final Logger logger,
                                    final ArchetypePreferences archetypePreferences,
                                    final SpaceScopedResolutionStrategySupplier spaceScopedResolutionStrategySupplier);

}