Show notifications to user as feedback if something fails modifying the model. #1105
-
Hi again! How could be possible to show a notification to the user after a general action (e.g create a node X) cannot be executed (e.g., only a Node X is allowed per diagram). I have a particular node "EntryConcept" that act as root or entry point for my diagram, so I only want to allow create only node of that type. Since it a validation at the model level not a particular element of my diagram I can't use for an example GIssueMarkerView. However I noticed that if there is problem loading the model I get some notifications (see image below). I have a basically have a custom |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Looking at the source code of the Inject an action dispatcher to your handler class implementation (e.g., CreateNodeOperationHandler)
For actions notifications like '1' (the message is shown when hovering over the INFO icon) use:
For messages notifications like '2' use:
|
Beta Was this translation helpful? Give feedback.
Looking at the source code of the
@eclipse-glsp/server-node
I found the solution for both notifications. Here I share my findings in case they can help othersInject an action dispatcher to your handler class implementation (e.g., CreateNodeOperationHandler)
For actions notifications like '1' (the message is shown when hovering over the INFO icon) use:
this.actionDispatcher.dispatch( ServerStatusAction.create('Your Message', { severity: 'INFO', timeout: 5000 }));
For messages notifications like '2' use:
this.actionDispatcher.dispatch(ServerMessageAction.create('Your Message', { severity: 'INFO', timeout: 5000 }));
He…