use of org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent in project kie-wb-common by kiegroup.
the class ActiveContextItems method getResolvePackageRemoteCallback.
private RemoteCallback<Package> getResolvePackageRemoteCallback() {
return new RemoteCallback<Package>() {
@Override
public void callback(final Package pkg) {
if (Utils.hasPackageChanged(pkg, activePackage)) {
activePackage = pkg;
contextChangedEvent.fire(new WorkspaceProjectContextChangeEvent(activeProject, activeModule, activePackage));
}
}
};
}
use of org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method importProjectFromExampleTest.
@Test
public void importProjectFromExampleTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
final ExampleProject exampleProject = mock(ExampleProject.class);
final WorkspaceProject project = mock(WorkspaceProject.class);
final Module module = mock(Module.class);
doReturn(module).when(project).getMainModule();
final WorkspaceProjectContextChangeEvent projectContextChangeEvent = mock(WorkspaceProjectContextChangeEvent.class);
doReturn(project).when(projectContextChangeEvent).getWorkspaceProject();
doReturn(projectContextChangeEvent).when(examplesService).setupExamples(any(ExampleOrganizationalUnit.class), anyList());
final WorkspaceProject importedProject = libraryService.importProject(organizationalUnit, exampleProject);
assertEquals(module, importedProject.getMainModule());
}
use of org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent in project kie-wb-common by kiegroup.
the class LibraryPlaces method goToProject.
public void goToProject(final WorkspaceProject project) {
if (projectContext.getActiveWorkspaceProject().map(activeProject -> !activeProject.equals(project)).orElse(true)) {
if (closeAllPlacesOrNothing()) {
projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(project, project.getMainModule()));
goToProject();
}
} else {
goToProject();
}
}
use of org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent in project kie-wb-common by kiegroup.
the class LibraryPlacesTest method goToOrganizationalUnitsTest.
@Test
public void goToOrganizationalUnitsTest() {
final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.ORGANIZATIONAL_UNITS_SCREEN);
final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
part.setSelectable(false);
libraryPlaces.goToOrganizationalUnits();
verify(projectContextChangeEvent).fire(projectContextChangeEventArgumentCaptor.capture());
assertNull(projectContextChangeEventArgumentCaptor.getValue().getOrganizationalUnit());
final ArgumentCaptor<WorkspaceProjectContextChangeEvent> eventArgumentCaptor = ArgumentCaptor.forClass(WorkspaceProjectContextChangeEvent.class);
verify(projectContextChangeEvent).fire(eventArgumentCaptor.capture());
final WorkspaceProjectContextChangeEvent event = eventArgumentCaptor.getValue();
assertNull(event.getOrganizationalUnit());
assertNull(event.getWorkspaceProject());
verify(placeManager).closeAllPlacesOrNothing();
verify(placeManager).goTo(eq(part), any(PanelDefinition.class));
verify(libraryPlaces).setupLibraryBreadCrumbs();
}
Aggregations