use of org.eclipse.sirius.components.core.api.IRepresentationInput in project sirius-components by eclipse-sirius.
the class EditingContextEventProcessor method doHandle.
/**
* Finds the proper event handler to perform the task matching the given input event.
*
* @param payloadSink
* The sink to publish payload
* @param inputEvent
* The input event
* @return The response computed by the event handler
*/
private void doHandle(One<IPayload> payloadSink, IInput input) {
// $NON-NLS-1$
this.logger.trace("Input received: {}", input);
if (input instanceof IRepresentationInput) {
IRepresentationInput representationInput = (IRepresentationInput) input;
this.handleRepresentationInput(payloadSink, representationInput);
} else {
this.handleInput(payloadSink, input);
}
}
use of org.eclipse.sirius.components.core.api.IRepresentationInput in project sirius-components by eclipse-sirius.
the class DiagramEventProcessor method handle.
@Override
public void handle(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, IRepresentationInput representationInput) {
IRepresentationInput effectiveInput = representationInput;
if (representationInput instanceof RenameRepresentationInput) {
RenameRepresentationInput renameRepresentationInput = (RenameRepresentationInput) representationInput;
effectiveInput = new RenameDiagramInput(renameRepresentationInput.getId(), renameRepresentationInput.getEditingContextId(), renameRepresentationInput.getRepresentationId(), renameRepresentationInput.getNewLabel());
}
if (effectiveInput instanceof IDiagramInput) {
IDiagramInput diagramInput = (IDiagramInput) effectiveInput;
Optional<IDiagramEventHandler> optionalDiagramEventHandler = this.diagramEventHandlers.stream().filter(handler -> handler.canHandle(diagramInput)).findFirst();
if (optionalDiagramEventHandler.isPresent()) {
IDiagramEventHandler diagramEventHandler = optionalDiagramEventHandler.get();
diagramEventHandler.handle(payloadSink, changeDescriptionSink, this.editingContext, this.diagramContext, diagramInput);
} else {
// $NON-NLS-1$
this.logger.warn("No handler found for event: {}", diagramInput);
}
}
}
use of org.eclipse.sirius.components.core.api.IRepresentationInput in project sirius-components by eclipse-sirius.
the class ValidationEventProcessor method handle.
@Override
public void handle(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, IRepresentationInput representationInput) {
if (representationInput instanceof IValidationInput) {
IValidationInput validationInput = (IValidationInput) representationInput;
// @formatter:off
Optional<IValidationEventHandler> optionalValidationEventHandler = this.validationEventHandlers.stream().filter(handler -> handler.canHandle(validationInput)).findFirst();
if (optionalValidationEventHandler.isPresent()) {
IValidationEventHandler validationEventHandler = optionalValidationEventHandler.get();
validationEventHandler.handle(payloadSink, changeDescriptionSink, this.validationContext.getValidation(), validationInput);
} else {
// $NON-NLS-1$
this.logger.warn("No handler found for event: {}", validationInput);
}
}
}
use of org.eclipse.sirius.components.core.api.IRepresentationInput in project sirius-components by eclipse-sirius.
the class TreeEventProcessor method handle.
@Override
public void handle(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, IRepresentationInput representationInput) {
if (representationInput instanceof ITreeInput) {
ITreeInput treeInput = (ITreeInput) representationInput;
Optional<ITreeEventHandler> optionalTreeEventHandler = this.treeEventHandlers.stream().filter(handler -> handler.canHandle(treeInput)).findFirst();
if (optionalTreeEventHandler.isPresent()) {
ITreeEventHandler treeEventHandler = optionalTreeEventHandler.get();
treeEventHandler.handle(payloadSink, changeDescriptionSink, this.editingContext, this.currentTree.get(), treeInput);
} else {
// $NON-NLS-1$
this.logger.warn("No handler found for event: {}", treeInput);
}
}
}
use of org.eclipse.sirius.components.core.api.IRepresentationInput in project sirius-components by eclipse-sirius.
the class FormEventProcessor method handle.
@Override
public void handle(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, IRepresentationInput representationInput) {
if (representationInput instanceof IFormInput) {
IFormInput formInput = (IFormInput) representationInput;
if (formInput instanceof UpdateWidgetFocusInput) {
UpdateWidgetFocusInput input = (UpdateWidgetFocusInput) formInput;
this.widgetSubscriptionManager.handle(input);
payloadSink.tryEmitValue(new UpdateWidgetFocusSuccessPayload(representationInput.getId(), input.getWidgetId()));
changeDescriptionSink.tryEmitNext(new ChangeDescription(ChangeKind.FOCUS_CHANGE, representationInput.getRepresentationId(), input));
} else {
Optional<IFormEventHandler> optionalFormEventHandler = this.formEventHandlers.stream().filter(handler -> handler.canHandle(formInput)).findFirst();
if (optionalFormEventHandler.isPresent()) {
IFormEventHandler formEventHandler = optionalFormEventHandler.get();
formEventHandler.handle(payloadSink, changeDescriptionSink, this.currentForm.get(), formInput);
} else {
// $NON-NLS-1$
this.logger.warn("No handler found for event: {}", formInput);
}
}
}
}
Aggregations