class ImportRepositoryPopUpPresenter {

    public void importRepository() {
        final String repositoryUrl = view.getRepositoryURL();
        if (isEmpty(repositoryUrl)) {
            view.showError(view.getEmptyRepositoryURLValidationMessage());
            return;
        }

        final String fixedRepositoryUrl = repositoryUrl.trim();

        view.showBusyIndicator(view.getLoadingMessage());
        importService.call((Set<ImportProject> projects) -> {
                               view.hideBusyIndicator();
                               if (projects.isEmpty()) {
                                   view.showError(view.getNoProjectsToImportMessage());
                               } else {
                                   view.hide();
                                   libraryPlaces.goToExternalImportPresenter(projects);
                               }
                           },
                           (Message message, Throwable throwable) -> {
                               if (throwable instanceof EmptyRemoteRepositoryException) {
                                   final String repositoryAlias =
                                           ((EmptyRemoteRepositoryException) throwable).getRepositoryAlias();
                                   createProjectFromEmptyRemoteRepository(fixedRepositoryUrl,
                                                                          repositoryAlias);
                               } else {
                                   view.hideBusyIndicator();
                                   view.showError(view.getNoProjectsToImportMessage());
                               }

                               return false;
                           }).getProjects(this.libraryPlaces.getActiveSpace(),
                                          new ExampleRepository(fixedRepositoryUrl,
                                                                new Credentials(
                                                                        view.getUserName(),
                                                                        view.getPassword())));
    }

    @Inject public  ImportRepositoryPopUpPresenter(final View view,
                                          final LibraryPlaces libraryPlaces,
                                          final Caller<ProjectImportService> importService,
                                          final Caller<LibraryService> libraryService,
                                          final WorkspaceProjectContext projectContext,
                                          final Event<NotificationEvent> notificationEvent,
                                          final TranslationService ts);

}