Generating the concept menue of the tree editor depending on the state of the current emf model #173
-
Hi, I was wondering if it's possible to create the context menue options on runtime. In theory I could use the modelserver api to fetch the needed values, but since the values are exported via code I can't run my fetch request before the module is getting loaded. There is a sync-fetch package on npm which I could use in theory but when I tested it the modelserver wasn't ready and gave me an empty model. constructed example: ecore model:
machine.xmi / machine.coffee:
Contextmenue on Machine:
Contextmenue on Control Unit:
Idealley these entries were already created dynamicly on startup --- Adding BrewingUnit to the list activatedComponents --- machine.xmi / machine.coffee:
Contextmenue on Control Unit:
I could life with defining a complete schema (with BrewingUnit included) at compile time and only dynamicly create the context menue entries. Thank you and Best Regards Edit: Better formulation |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @Deel96, To create children for a selected node via the I suppose you could override the HTH, BR Nina |
Beta Was this translation helpful? Give feedback.
Hi @Deel96,
To create children for a selected node via the
+
button (I am not aware of any context menu so far),the tree editor fetches the information from the
coffee-model-service#getChildrenMapping
.This is currently hard-coded, the children mapping is defined in the
coffee-model.ts
.I suppose you could override the
getChildrenMapping
method in the coffee-model-service by calculating your custom mapping.Perhaps you will also have to update the method in
coffee-node-factory#hasCreatableChildren
as this also uses the static childrenMapping.HTH, BR Nina