use of org.uberfire.mvp.impl.PathPlaceRequest in project kie-wb-common by kiegroup.
the class LibraryPlacesTest method goToAssetTest.
@Test
public void goToAssetTest() {
final ObservablePath path = mock(ObservablePath.class);
final PathPlaceRequest pathPlaceRequest = mock(PathPlaceRequest.class);
doReturn(path).when(pathPlaceRequest).getPath();
doReturn(pathPlaceRequest).when(libraryPlaces).createPathPlaceRequest(any(Path.class));
libraryPlaces.goToAsset(path);
verify(placeManager).goTo(pathPlaceRequest);
final ArgumentCaptor<WorkspaceProjectContextChangeEvent> eventArgumentCaptor = ArgumentCaptor.forClass(WorkspaceProjectContextChangeEvent.class);
verify(projectContextChangeEvent).fire(eventArgumentCaptor.capture());
final WorkspaceProjectContextChangeEvent value = eventArgumentCaptor.getValue();
assertEquals(activeProject, value.getWorkspaceProject());
assertEquals(activeModule, value.getModule());
assertNull(value.getPackage());
}
use of org.uberfire.mvp.impl.PathPlaceRequest in project kie-wb-common by kiegroup.
the class DataObjectBrowser method openDataObject.
private void openDataObject(final DataObject dataObject) {
final Path objectPath = getContext().getDataObjectPath(dataObject.getClassName());
if (objectPath != null) {
view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Loading());
modelerService.call(new RemoteCallback<Boolean>() {
@Override
public void callback(Boolean exists) {
view.hideBusyIndicator();
if (Boolean.TRUE.equals(exists)) {
placeManager.goTo(new PathPlaceRequest(objectPath));
} else {
view.showYesNoCancelPopup(CommonConstants.INSTANCE.Warning(), Constants.INSTANCE.objectBrowser_message_file_not_exists_or_renamed(objectPath.toURI()), new Command() {
@Override
public void execute() {
// do nothing.
}
}, CommonConstants.INSTANCE.Close(), ButtonType.WARNING, null, null, null, null, null, null);
}
}
}, new DataModelerErrorCallback(CommonConstants.INSTANCE.ExceptionNoSuchFile0(objectPath.toURI()))).exists(objectPath);
}
}
use of org.uberfire.mvp.impl.PathPlaceRequest in project kie-wb-common by kiegroup.
the class AbstractProjectDiagramEditor method initializeStunnerEditor.
void initializeStunnerEditor() {
stunnerEditor.setOnResetContentHashProcessor(h -> this.originalHash = h);
stunnerEditor.setParsingExceptionProcessor(e -> {
ProjectMetadata pm = (ProjectMetadata) e.getMetadata();
updateTitle(pm.getTitle());
resetEditorPagesOnLoadError(pm.getOverview());
menuSessionItems.setEnabled(false);
notification.fire(new NotificationEvent(translationService.getValue(StunnerWidgetsConstants.DiagramParsingError, Objects.toString(e.getMessage(), "")), NotificationEvent.NotificationType.ERROR));
});
stunnerEditor.setExceptionProcessor(e -> {
// close editor in case of error when opening the editor
placeManager.forceClosePlace(new PathPlaceRequest(versionRecordManager.getCurrentPath(), getEditorIdentifier()));
});
}
use of org.uberfire.mvp.impl.PathPlaceRequest in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorPresenter method onOpenDocumentsInEditor.
@Override
public void onOpenDocumentsInEditor(final List<Path> selectedDocumentPaths) {
if (selectedDocumentPaths == null || selectedDocumentPaths.isEmpty()) {
return;
}
view.showLoading();
loadGraphLatch = new LoadGraphLatch(selectedDocumentPaths.size(), getSelectDecisionTableCommand(selectedDocumentPaths.get(0)));
selectedDocumentPaths.stream().forEach((p) -> {
final PathPlaceRequest placeRequest = getPathPlaceRequest(p);
loadGraphLatch.loadDocument(placeRequest.getPath(), placeRequest);
});
}
use of org.uberfire.mvp.impl.PathPlaceRequest in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorPresenterTest method checkReload.
@Test
public void checkReload() {
final ObservablePath dtGraphPath = mock(ObservablePath.class);
final PathPlaceRequest dtGraphPlaceRequest = mock(PathPlaceRequest.class);
final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent();
final ObservablePath dtPath = mock(ObservablePath.class);
final PlaceRequest dtPlaceRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent(0);
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(dtPath, dtPath, dtPlaceRequest, dtContent);
final GuidedDecisionTableGraphEntry dtGraphEntry = new GuidedDecisionTableGraphEntry(dtPath, dtPath);
dtGraphContent.getModel().getEntries().add(dtGraphEntry);
when(dtPath.toURI()).thenReturn("dtPath");
when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
when(dtGraphPath.getFileName()).thenReturn("filename");
when(dtService.loadContent(eq(dtPath))).thenReturn(dtContent);
when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
when(modeller.addDecisionTable(any(ObservablePath.class), any(PlaceRequest.class), any(GuidedDecisionTableEditorContent.class), any(Boolean.class), any(), any())).thenReturn(dtPresenter);
when(modeller.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter);
}
});
presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
verify(presenter, times(1)).loadDocumentGraph(dtGraphPath);
presenter.reload();
verify(presenter, times(1)).deregisterDocument(eq(dtPresenter));
verify(presenter, times(2)).loadDocumentGraph(dtGraphPath);
verify(modeller, times(1)).releaseDecisionTables();
verify(modellerView, times(1)).clear();
}
Aggregations