-
Hello, I have a project which is similar to this example project with the property view. I want to tell the server to update the model when I detected changes in the property view. The problem is, I can't seem to find a way to get access to an ActionDispatcher in files that were bound in the frontend module, like the widget provider and the property data service. To reproduce my problem, take the linked example project and add @inject(TYPES.IActionDispatcher)
protected actionDispatcher: GLSPActionDispatcher; to custom-widget-provider.ts or custom-data-service.ts, which just throws the error Injecting as a parameter in constructor() or a postConstruct() method does not work as well. How do I inject values in those files and why are they different from the selection-data-service.ts for example, where the injection works? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @Ginxss, The background of this problem is, that the property view is usually bound in the general frontend module and not diagram specific, as the action dispatcher is. An action dispatcher is available per diagram container, and can of course be unbound if no diagram was opened yet. ...
const widget = this.shell.activeWidget || this.shell.currentWidget;
if (widget instanceof GLSPDiagramWidget) {
return widget.actionDispatcher;
}
... I added another commit with a small working example to the previously used example branch, please see eclipse-glsp/glsp-examples@70fdb1a. HTH and best wishes, PS: In other projects we usually use the Model Server, an external source model management component, to fetch element property data. |
Beta Was this translation helpful? Give feedback.
Hi @Ginxss,
The background of this problem is, that the property view is usually bound in the general frontend module and not diagram specific, as the action dispatcher is. An action dispatcher is available per diagram container, and can of course be unbound if no diagram was opened yet.
To overcome this, you could retrieve the actionDispatcher from the currently opened/active GLSP diagram widget in the custom data service for example:
I added another commit with a small working example to the previously used example branch, please see e…