Replies: 2 comments
-
Hi @csamarchi, - this.modelState.root= GGraph.builder().id(module.id).addChildren(inputNodes).build();
+ this.modelState.updateRoot( GGraph.builder().id(module.id).addChildren(inputNodes).build()); If you are looking for an example please have a look at the official documentation. @injectable()
export class MyModelFactory implements GModelFactory {
@inject(MyModelState)
protected modelState: MyModelState;
createModel(): void {
const entities = this.modelState.getModel().getEntities();
const entityNodes = entities.map((entity) =>
new GNodeBuilder(GNode)
.id("node:entity")
.layout("vbox")
.add(new GLabelBuilder(GLabel).text(entity.name).build())
.build()
);
const newModel = new GGraphBuilder(GGraph)
.id("entity-graph")
.addChildren(...entityNodes)
.build();
this.modelState.updateRoot(newModel);
}
}```
|
Beta Was this translation helpful? Give feedback.
-
Thank you! That fixed it. On the same subject of getting my Source Model to work, I am running into one more issue in my I am getting the error On this section of code: I have tried to specify all of the required properties on the object and tried marking the properties as optional with a '?' after the property. Both routes don't work. Do you have a solution? Any help is appreciated. Thanks |
Beta Was this translation helpful? Give feedback.
-
I am following the Source Model structure for a Node server GLSP vscode extension. I have included all these files verbatim. I am getting the following error at this point in my code when building:
Property 'root' is protected and only accessible within class 'DefaultModelState' and its subclasses.
I have tried replacing
protected
withpublic
and still nothing.I understand private/protected properties are only allowed within their class or subclass, but I am injecting the
ModuleModelState
part class within this file. I'm not sure how to move forward. Also unsure where "root" comes from exactly.Any help is much appreciated. Thanks
Beta Was this translation helpful? Give feedback.
All reactions