Search in sources :

Example 1 with RepositoryRemovedEvent

use of org.guvnor.structure.repositories.RepositoryRemovedEvent in project kie-wb-common by kiegroup.

the class KieMultipleDocumentEditorTest method testOnRepositoryRemoved.

@Test
public void testOnRepositoryRemoved() {
    final Repository repository = mock(Repository.class);
    when(workbenchContext.getActiveWorkspaceProject()).thenReturn(Optional.of(new WorkspaceProject(mock(OrganizationalUnit.class), repository, mock(Branch.class), mock(Module.class))));
    editor.setupMenuBar();
    editor.onRepositoryRemoved(new RepositoryRemovedEvent(repository));
    verify(editor, times(1)).enableMenus(eq(false));
    verify(editor, times(4)).enableMenuItem(eq(false), any(MenuItems.class));
    verify(saveMenuItem, times(1)).setEnabled(eq(false));
    verify(versionManagerMenuItem, times(1)).setEnabled(eq(false));
}
Also used : Repository(org.guvnor.structure.repositories.Repository) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Branch(org.guvnor.structure.repositories.Branch) MenuItems(org.uberfire.ext.editor.commons.client.menu.MenuItems) Module(org.guvnor.common.services.project.model.Module) RepositoryRemovedEvent(org.guvnor.structure.repositories.RepositoryRemovedEvent) Test(org.junit.Test)

Example 2 with RepositoryRemovedEvent

use of org.guvnor.structure.repositories.RepositoryRemovedEvent in project kie-wb-common by kiegroup.

the class LibraryPlaces method onProjectDeleted.

public void onProjectDeleted(@Observes final RepositoryRemovedEvent repositoryRemovedEvent) {
    if (isLibraryPerspectiveOpen() && isRepoForActiveProject(repositoryRemovedEvent)) {
        closeAllPlaces();
        WorkspaceProjectContextChangeEvent contextChangeEvent = projectContext.getActiveOrganizationalUnit().map(ou -> new WorkspaceProjectContextChangeEvent(ou)).orElseGet(() -> new WorkspaceProjectContextChangeEvent());
        projectContextChangeEvent.fire(contextChangeEvent);
        goToLibrary();
        notificationEvent.fire(new NotificationEvent(ts.getTranslation(LibraryConstants.ProjectDeleted), NotificationEvent.NotificationType.DEFAULT));
    }
}
Also used : Remote(org.kie.workbench.common.screens.library.api.Remote) WorkbenchProjectMetricsEvent(org.kie.workbench.common.screens.library.client.events.WorkbenchProjectMetricsEvent) AssetDetailEvent(org.kie.workbench.common.screens.library.client.events.AssetDetailEvent) ManagedInstance(org.jboss.errai.ioc.client.api.ManagedInstance) PreferenceScopeResolutionStrategyInfo(org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo) ProjectScopedResolutionStrategySupplier(org.guvnor.common.services.project.client.preferences.ProjectScopedResolutionStrategySupplier) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) ConcurrentRenameAcceptedEvent(org.uberfire.ext.editor.commons.client.event.ConcurrentRenameAcceptedEvent) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) Map(java.util.Map) Observes(javax.enterprise.event.Observes) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent) PreferencesCentralSaveEvent(org.uberfire.ext.preferences.client.event.PreferencesCentralSaveEvent) PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) MessageConsoleScreen(org.guvnor.messageconsole.client.console.MessageConsoleScreen) Repository(org.guvnor.structure.repositories.Repository) LibraryToolbarPresenter(org.kie.workbench.common.screens.library.client.widgets.library.LibraryToolbarPresenter) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) LibraryService(org.kie.workbench.common.screens.library.api.LibraryService) WorkspaceProjectContext(org.guvnor.common.services.project.client.context.WorkspaceProjectContext) PlaceRequest(org.uberfire.mvp.PlaceRequest) Routed(org.kie.workbench.common.screens.library.api.Routed) NewResourceSuccessEvent(org.kie.workbench.common.widgets.client.handlers.NewResourceSuccessEvent) ExtendedTypes(org.ext.uberfire.social.activities.model.ExtendedTypes) SocialFileSelectedEvent(org.ext.uberfire.social.activities.model.SocialFileSelectedEvent) List(java.util.List) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Caller(org.jboss.errai.common.client.api.Caller) PostConstruct(javax.annotation.PostConstruct) ApplicationScoped(javax.enterprise.context.ApplicationScoped) WorkspaceProjectContextChangeHandler(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeHandler) PreferencesRootScreen(org.uberfire.ext.preferences.client.central.screen.PreferencesRootScreen) PlaceStatus(org.uberfire.client.mvp.PlaceStatus) RenameModuleEvent(org.guvnor.common.services.project.events.RenameModuleEvent) RemoveOrganizationalUnitEvent(org.guvnor.structure.organizationalunit.RemoveOrganizationalUnitEvent) HashMap(java.util.HashMap) PlaceManager(org.uberfire.client.mvp.PlaceManager) ProjectAssetListUpdated(org.kie.workbench.common.screens.library.api.ProjectAssetListUpdated) PreferencesCentralUndoChangesEvent(org.uberfire.ext.preferences.client.event.PreferencesCentralUndoChangesEvent) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ImportRepositoryPopUpPresenter(org.kie.workbench.common.screens.library.client.screens.importrepository.ImportRepositoryPopUpPresenter) PortablePreconditions(org.kie.soup.commons.validation.PortablePreconditions) Path(org.uberfire.backend.vfs.Path) Command(org.uberfire.mvp.Command) Event(javax.enterprise.event.Event) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) LibraryConstants(org.kie.workbench.common.screens.library.client.resources.i18n.LibraryConstants) UberfireBreadcrumbs(org.uberfire.ext.widgets.common.client.breadcrumbs.UberfireBreadcrumbs) PartDefinitionImpl(org.uberfire.workbench.model.impl.PartDefinitionImpl) ModuleEventType(org.guvnor.common.services.project.social.ModuleEventType) TranslationService(org.jboss.errai.ui.client.local.spi.TranslationService) PreferencesCentralInitializationEvent(org.uberfire.ext.preferences.client.event.PreferencesCentralInitializationEvent) WorkspaceProjectService(org.guvnor.common.services.project.service.WorkspaceProjectService) VFSService(org.uberfire.backend.vfs.VFSService) RepositoryRemovedEvent(org.guvnor.structure.repositories.RepositoryRemovedEvent) AuthoringWorkbenchDocks(org.kie.workbench.common.workbench.client.docks.AuthoringWorkbenchDocks) Collections(java.util.Collections) LibraryPerspective(org.kie.workbench.common.screens.library.client.perspective.LibraryPerspective) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent)

Aggregations

WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)2 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)2 Repository (org.guvnor.structure.repositories.Repository)2 RepositoryRemovedEvent (org.guvnor.structure.repositories.RepositoryRemovedEvent)2 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 PostConstruct (javax.annotation.PostConstruct)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Event (javax.enterprise.event.Event)1 Observes (javax.enterprise.event.Observes)1 Inject (javax.inject.Inject)1 ExtendedTypes (org.ext.uberfire.social.activities.model.ExtendedTypes)1 SocialFileSelectedEvent (org.ext.uberfire.social.activities.model.SocialFileSelectedEvent)1 WorkspaceProjectContext (org.guvnor.common.services.project.client.context.WorkspaceProjectContext)1 ProjectScopedResolutionStrategySupplier (org.guvnor.common.services.project.client.preferences.ProjectScopedResolutionStrategySupplier)1 WorkspaceProjectContextChangeEvent (org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent)1 WorkspaceProjectContextChangeHandler (org.guvnor.common.services.project.context.WorkspaceProjectContextChangeHandler)1