@Test public void goToProjectDifferentBranch() { final WorkspaceProject project = new WorkspaceProject(activeOrganizationalUnit, activeRepository, activeBranch, mock(Module.class)); final Branch otherBranch = new Branch("other-branch", mock(Path.class)); doReturn(activeProject).when(projectService).resolveProject(activeSpace, otherBranch); libraryPlaces.goToProject(project, otherBranch); verify(libraryPlaces).goToProject(activeProject); }
public void goToProject(final WorkspaceProject project) { if (projectContext.getActiveWorkspaceProject() .map(activeProject -> !activeProject.equals(project)) .orElse(true)) { final String lastBranch = cookie.get(getProjectLastBranchCookie(project.getName())); cookie.set(getLastProjectCookie(), project.getName()); closeAllPlacesOrNothing(() -> { projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(project, project.getMainModule())); if (!lastBranch.equals("")) { goToProject(project.getSpace().getName(), project.getName(), lastBranch); } else { goToProject(project, project.getBranch()); } }); } else { goToProject(); } }
LibraryPlaces implements WorkspaceProjectContextChangeHandler { public void goToProject(final WorkspaceProject project) { if (projectContext.getActiveWorkspaceProject() .map(activeProject -> !activeProject.equals(project)) .orElse(true)) { final String lastBranch = cookie.get(getProjectLastBranchCookie(project.getName())); cookie.set(getLastProjectCookie(), project.getName()); closeAllPlacesOrNothing(() -> { projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(project, project.getMainModule())); if (!lastBranch.equals("")) { goToProject(project.getSpace().getName(), project.getName(), lastBranch); } else { goToProject(project, project.getBranch()); } }); } else { goToProject(); } } }
LibraryPlaces implements WorkspaceProjectContextChangeHandler { public void goToProject(final WorkspaceProject project) { if (projectContext.getActiveWorkspaceProject() .map(activeProject -> !activeProject.equals(project)) .orElse(true)) { final String lastBranch = cookie.get(getProjectLastBranchCookie(project.getName())); cookie.set(getLastProjectCookie(), project.getName()); closeAllPlacesOrNothing(() -> { projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(project, project.getMainModule())); if (!lastBranch.equals("")) { goToProject(project.getSpace().getName(), project.getName(), lastBranch); } else { goToProject(project, project.getBranch()); } }); } else { goToProject(); } } LibraryPlaces(); @Inject  LibraryPlaces(final UberfireBreadcrumbs breadcrumbs,
                         final TranslationService ts,
                         final Event<AssetDetailEvent> assetDetailEvent,
                         final Caller<LibraryService> libraryService,
                         final Caller<WorkspaceProjectService> projectService,
                         final Caller<KieModuleService> moduleService,
                         final PlaceManager placeManager,
                         final WorkspaceProjectContext projectContext,
                         final Event<WorkspaceProjectContextChangeEvent> projectContextChangeEvent,
                         final Event<NotificationEvent> notificationEvent,
                         final TranslationUtils translationUtils,
                         final Caller<VFSService> vfsService,
                         final ManagedInstance<ImportRepositoryPopUpPresenter> importRepositoryPopUpPresenters,
                         final @Routed Event<ProjectAssetListUpdated> assetListUpdatedEvent,
                         final CloseUnsavedProjectAssetsPopUpPresenter closeUnsavedProjectAssetsPopUpPresenter,
                         final @Source(Source.Kind.EXTERNAL) Event<ImportProjectsSetupEvent> importProjectsSetupEvent,
                         final LibraryBreadcrumbs libraryBreadcrumbs,
                         final SessionInfo sessionInfo,
                         final Caller<RepositoryService> repositoryService,
                         final Promises promises,
                         final OrganizationalUnitController organizationalUnitController,
                         final Caller<OrganizationalUnitService> organizationalUnitService,
                         final Logger logger,
                         final Cookie cookie); }
LibraryPlaces implements WorkspaceProjectContextChangeHandler { public void goToProject(final WorkspaceProject project) { if (projectContext.getActiveWorkspaceProject() .map(activeProject -> !activeProject.equals(project)) .orElse(true)) { final String lastBranch = cookie.get(getProjectLastBranchCookie(project.getName())); cookie.set(getLastProjectCookie(), project.getName()); closeAllPlacesOrNothing(() -> { projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(project, project.getMainModule())); if (!lastBranch.equals("")) { goToProject(project.getSpace().getName(), project.getName(), lastBranch); } else { goToProject(project, project.getBranch()); } }); } else { goToProject(); } } LibraryPlaces(); @Inject  LibraryPlaces(final UberfireBreadcrumbs breadcrumbs,
                         final TranslationService ts,
                         final Event<AssetDetailEvent> assetDetailEvent,
                         final Caller<LibraryService> libraryService,
                         final Caller<WorkspaceProjectService> projectService,
                         final Caller<KieModuleService> moduleService,
                         final PlaceManager placeManager,
                         final WorkspaceProjectContext projectContext,
                         final Event<WorkspaceProjectContextChangeEvent> projectContextChangeEvent,
                         final Event<NotificationEvent> notificationEvent,
                         final TranslationUtils translationUtils,
                         final Caller<VFSService> vfsService,
                         final ManagedInstance<ImportRepositoryPopUpPresenter> importRepositoryPopUpPresenters,
                         final @Routed Event<ProjectAssetListUpdated> assetListUpdatedEvent,
                         final CloseUnsavedProjectAssetsPopUpPresenter closeUnsavedProjectAssetsPopUpPresenter,
                         final @Source(Source.Kind.EXTERNAL) Event<ImportProjectsSetupEvent> importProjectsSetupEvent,
                         final LibraryBreadcrumbs libraryBreadcrumbs,
                         final SessionInfo sessionInfo,
                         final Caller<RepositoryService> repositoryService,
                         final Promises promises,
                         final OrganizationalUnitController organizationalUnitController,
                         final Caller<OrganizationalUnitService> organizationalUnitService,
                         final Logger logger,
                         final Cookie cookie); @PostConstruct void setup(); static Object nativeGoToSpace(final String spaceName); native void expose(); static boolean nativeUserCanCreateOrganizationalUnit(); boolean userCanCreateOrganizationalUnit(); void onSelectPlaceEvent(@Observes final PlaceGainFocusEvent placeGainFocusEvent); void onAssetListUpdateEvent(@Observes @Remote final ProjectAssetListUpdated event); void onNewResourceCreated(@Observes final NewResourceSuccessEvent newResourceSuccessEvent); void onAssetRenamedAccepted(@Observes final ConcurrentRenameAcceptedEvent concurrentRenameAcceptedEvent); void onProjectDeleted(@Observes final RepositoryRemovedEvent repositoryRemovedEvent); void deleteProject(final WorkspaceProject project,
                              final HasBusyIndicator view); void onOrganizationalUnitRemoved(@Observes final RemoveOrganizationalUnitEvent removedOrganizationalUnitEvent); void onAssetSelected(@Observes final AssetDetailEvent assetDetails); void onPreferencesSave(@Observes PreferencesCentralSaveEvent event); void onPreferencesCancel(@Observes PreferencesCentralUndoChangesEvent event); void refresh(final Command callback); void goToOrganizationalUnits(); Promise<Void> goToLibrary(); void goToProject(final WorkspaceProject project); void goToProject(final WorkspaceProject project,
                            final Branch branch); void goToProject(final String spaceName, final String projectName, final String branchName); void goToAsset(final Path path); void goToAddAsset(); void goToSubmitChangeRequestScreen(); void goToChangeRequestReviewScreen(final long changeRequestId); void goToTrySamples(); void goToImportRepositoryPopUp(); void goToExternalImportPresenter(final Set<ImportProject> projects); void setupExternalImportBreadCrumbs(); void closeAllPlacesOrNothing(final Command successCallback); void closeChangeRequestReviewScreen(); void closePlace(final Command successCallback,
                           final PlaceRequest place); WorkspaceProjectContext getWorkbenchContext(); WorkspaceProject getActiveWorkspace(); OrganizationalUnit getActiveSpace(); boolean isThisUserAccessingThisRepository(final String userIdentifier,
                                                     final Repository repository); boolean isThisRepositoryBeingAccessed(final Repository repository); void init(final LibraryPerspective libraryPerspective); @Override void onChange(WorkspaceProjectContextChangeEvent previous,
                         WorkspaceProjectContextChangeEvent current); void onDeletedResource(@Observes final ResourceDeletedEvent deleteFileEvent); void onConcurrentDelete(@Observes final ConcurrentDeleteAcceptedEvent concurrentDeleteAcceptedEvent); }
LibraryPlaces implements WorkspaceProjectContextChangeHandler { public void goToProject(final WorkspaceProject project) { if (projectContext.getActiveWorkspaceProject() .map(activeProject -> !activeProject.equals(project)) .orElse(true)) { final String lastBranch = cookie.get(getProjectLastBranchCookie(project.getName())); cookie.set(getLastProjectCookie(), project.getName()); closeAllPlacesOrNothing(() -> { projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(project, project.getMainModule())); if (!lastBranch.equals("")) { goToProject(project.getSpace().getName(), project.getName(), lastBranch); } else { goToProject(project, project.getBranch()); } }); } else { goToProject(); } } LibraryPlaces(); @Inject  LibraryPlaces(final UberfireBreadcrumbs breadcrumbs,
                         final TranslationService ts,
                         final Event<AssetDetailEvent> assetDetailEvent,
                         final Caller<LibraryService> libraryService,
                         final Caller<WorkspaceProjectService> projectService,
                         final Caller<KieModuleService> moduleService,
                         final PlaceManager placeManager,
                         final WorkspaceProjectContext projectContext,
                         final Event<WorkspaceProjectContextChangeEvent> projectContextChangeEvent,
                         final Event<NotificationEvent> notificationEvent,
                         final TranslationUtils translationUtils,
                         final Caller<VFSService> vfsService,
                         final ManagedInstance<ImportRepositoryPopUpPresenter> importRepositoryPopUpPresenters,
                         final @Routed Event<ProjectAssetListUpdated> assetListUpdatedEvent,
                         final CloseUnsavedProjectAssetsPopUpPresenter closeUnsavedProjectAssetsPopUpPresenter,
                         final @Source(Source.Kind.EXTERNAL) Event<ImportProjectsSetupEvent> importProjectsSetupEvent,
                         final LibraryBreadcrumbs libraryBreadcrumbs,
                         final SessionInfo sessionInfo,
                         final Caller<RepositoryService> repositoryService,
                         final Promises promises,
                         final OrganizationalUnitController organizationalUnitController,
                         final Caller<OrganizationalUnitService> organizationalUnitService,
                         final Logger logger,
                         final Cookie cookie); @PostConstruct void setup(); static Object nativeGoToSpace(final String spaceName); native void expose(); static boolean nativeUserCanCreateOrganizationalUnit(); boolean userCanCreateOrganizationalUnit(); void onSelectPlaceEvent(@Observes final PlaceGainFocusEvent placeGainFocusEvent); void onAssetListUpdateEvent(@Observes @Remote final ProjectAssetListUpdated event); void onNewResourceCreated(@Observes final NewResourceSuccessEvent newResourceSuccessEvent); void onAssetRenamedAccepted(@Observes final ConcurrentRenameAcceptedEvent concurrentRenameAcceptedEvent); void onProjectDeleted(@Observes final RepositoryRemovedEvent repositoryRemovedEvent); void deleteProject(final WorkspaceProject project,
                              final HasBusyIndicator view); void onOrganizationalUnitRemoved(@Observes final RemoveOrganizationalUnitEvent removedOrganizationalUnitEvent); void onAssetSelected(@Observes final AssetDetailEvent assetDetails); void onPreferencesSave(@Observes PreferencesCentralSaveEvent event); void onPreferencesCancel(@Observes PreferencesCentralUndoChangesEvent event); void refresh(final Command callback); void goToOrganizationalUnits(); Promise<Void> goToLibrary(); void goToProject(final WorkspaceProject project); void goToProject(final WorkspaceProject project,
                            final Branch branch); void goToProject(final String spaceName, final String projectName, final String branchName); void goToAsset(final Path path); void goToAddAsset(); void goToSubmitChangeRequestScreen(); void goToChangeRequestReviewScreen(final long changeRequestId); void goToTrySamples(); void goToImportRepositoryPopUp(); void goToExternalImportPresenter(final Set<ImportProject> projects); void setupExternalImportBreadCrumbs(); void closeAllPlacesOrNothing(final Command successCallback); void closeChangeRequestReviewScreen(); void closePlace(final Command successCallback,
                           final PlaceRequest place); WorkspaceProjectContext getWorkbenchContext(); WorkspaceProject getActiveWorkspace(); OrganizationalUnit getActiveSpace(); boolean isThisUserAccessingThisRepository(final String userIdentifier,
                                                     final Repository repository); boolean isThisRepositoryBeingAccessed(final Repository repository); void init(final LibraryPerspective libraryPerspective); @Override void onChange(WorkspaceProjectContextChangeEvent previous,
                         WorkspaceProjectContextChangeEvent current); void onDeletedResource(@Observes final ResourceDeletedEvent deleteFileEvent); void onConcurrentDelete(@Observes final ConcurrentDeleteAcceptedEvent concurrentDeleteAcceptedEvent); static final String LIBRARY_PERSPECTIVE; static final String LIBRARY_SCREEN; static final String PROJECT_SCREEN; static final String IMPORT_PROJECTS_SCREEN; static final String IMPORT_SAMPLE_PROJECTS_SCREEN; static final String PROJECT_DETAIL_SCREEN; static final String ORG_UNITS_METRICS_SCREEN; static final String PROJECT_METRICS_SCREEN; static final String ORGANIZATIONAL_UNITS_SCREEN; static final String PROJECT_SETTINGS; static final String PROJECT_EXPLORER; static final String ALERTS; static final String REPOSITORY_STRUCTURE_SCREEN; static final String ADD_ASSET_SCREEN; static final String SUBMIT_CHANGE_REQUEST; static final String CHANGE_REQUEST_REVIEW; static final List<String> LIBRARY_PLACES; }