use of org.eclipse.sirius.components.collaborative.diagrams.dto.DeleteFromDiagramSuccessPayload in project sirius-components by eclipse-sirius.
the class DeleteFromDiagramEventHandler method sendResponse.
private void sendResponse(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, List<String> errors, boolean atLeastOneSuccess, IDiagramContext diagramContext, DeleteFromDiagramInput diagramInput) {
var changeDescription = new ChangeDescription(ChangeKind.SEMANTIC_CHANGE, diagramInput.getRepresentationId(), diagramInput);
IPayload payload = new DeleteFromDiagramSuccessPayload(diagramInput.getId(), diagramContext.getDiagram());
if (!errors.isEmpty()) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(this.messageService.deleteFailed());
for (String error : errors) {
stringBuilder.append(error);
}
changeDescription = new ChangeDescription(ChangeKind.NOTHING, diagramInput.getRepresentationId(), diagramInput);
if (atLeastOneSuccess) {
changeDescription = new ChangeDescription(ChangeKind.SEMANTIC_CHANGE, diagramInput.getRepresentationId(), diagramInput);
}
payload = new ErrorPayload(diagramInput.getId(), stringBuilder.toString());
}
payloadSink.tryEmitValue(payload);
changeDescriptionSink.tryEmitNext(changeDescription);
}
Aggregations