class ProjectScreen {

    @PostConstruct
    public void initialize() {
        this.workspaceProject = this.libraryPlaces.getActiveWorkspace();
        this.view.init(this);
        this.view.setTitle(libraryPlaces.getActiveWorkspace().getName());
        this.view.addMainAction(projectMainActions.getElement());
        this.resolveAssetsCount();
        this.showAssets();

        projectController.canUpdateProject(workspaceProject).then(userCanUpdateProject -> {
            this.view.setAddAssetVisible(userCanUpdateProject);
            this.view.setSubmitChangeRequestVisible(userCanUpdateProject);
            this.view.setImportAssetVisible(userCanUpdateProject);
            this.view.setReimportVisible(userCanUpdateProject);

            newFileUploader.acceptContext(new Callback<Boolean, Void>() {
                @Override
                public void onFailure(Void reason) {
                    view.setImportAssetVisible(false);
                }

                @Override
                public void onSuccess(Boolean result) {
                    view.setImportAssetVisible(result && userCanUpdateProject);
                }
            });

            return promises.resolve();
        });

        final boolean userCanCreateProjects = this.userCanCreateProjects();
        this.view.setDuplicateVisible(userCanCreateProjects);

        final boolean userCanDeleteProject = this.userCanDeleteProject();
        this.view.setDeleteProjectVisible(userCanDeleteProject);

        projectController.canDeleteBranch(workspaceProject).then(userCanDeleteBranch -> {
            this.view.setDeleteBranchVisible(userCanDeleteBranch);
            return promises.resolve();
        });

        projectController.canSubmitChangeRequest(workspaceProject).then(userCanSubmitChangeRequest -> {
            this.view.setSubmitChangeRequestVisible(userCanSubmitChangeRequest);
            return promises.resolve();
        });

        setupMainActions();

        final List<Promise<Boolean>> permissionPromises = Arrays.asList(projectController.canUpdateProject(workspaceProject),
                                                                        projectController.canDeleteBranch(workspaceProject),
                                                                        promises.resolve(userCanDeleteProject()),
                                                                        promises.resolve(userCanCreateProjects()));
        promises.reduce(promises.resolve(false), permissionPromises, (p1, p2) -> p1.then(resultP1 -> p2.then(resultP2 -> this.promises.resolve(resultP1 || resultP2)))).then(thereAreActionsToDisplay -> {
            this.view.setActionsVisible(thereAreActionsToDisplay);
            return promises.resolve();
        });

        this.setupChangeRequestList();

        contributorsListScreen.setup(projectContributorsListService,
                                     contributorCount -> this.view.setContributorsCount(contributorCount));
    }

    @Inject public  ProjectScreen(final View view,
                         final LibraryPlaces libraryPlaces,
                         final AssetsScreen assetsScreen,
                         final ChangeRequestListPresenter changeRequestsScreen,
                         final ContributorsListPresenter contributorsListScreen,
                         final ProjectMetricsScreen projectMetricsScreen,
                         final ProjectController projectController,
                         final SettingsPresenter settingsPresenter,
                         final NewFileUploader newFileUploader,
                         final NewResourcePresenter newResourcePresenter,
                         final ManagedInstance<DeleteProjectPopUpScreen> deleteProjectPopUpScreen,
                         final ManagedInstance<DeleteBranchPopUpScreen> deleteBranchPopUpScreen,
                         final ManagedInstance<RenameProjectPopUpScreen> renameProjectPopUpScreen,
                         final Caller<LibraryService> libraryService,
                         final Caller<ProjectScreenService> projectScreenService,
                         final CopyPopUpPresenter copyPopUpPresenter,
                         final ProjectNameValidator projectNameValidator,
                         final Promises promises,
                         final Event<NotificationEvent> notificationEvent,
                         final ProjectContributorsListServiceImpl projectContributorsListService,
                         final ProjectMainActions projectMainActions);

}