General questions about the EMFNotationSourceModelStorage #1334
-
Hi everyone,
I would be thankful for any kind of help. And please tell me if there are already wrong assumption in the questions, I am just new to the whole topic. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @MichaZoomZoom, Part 1: If your elements are uniquely identified by their names, you can use these names as For further reference, you might find this example useful: GLSP Examples - Java EMF Eclipse. Additionally, you could store notation-related properties directly in the semantic model. Part 2: From an older example of ours, I can share a snippet, where we created the empty models on the backend to ensure the user can create an project (consisting of an empty semantic and notation model). ...
protected Model createNewModel(final URI modelUri) {
Model newModel = MyModelFactory.eINSTANCE.createModel();
String modelName = modelUri.lastSegment().split("." + modelUri.fileExtension())[0];
newModel.setName(modelName);
return newModel;
}
protected Diagram createNewDiagram(final Model model) {
Diagram newDiagram = NotationFactory.eINSTANCE.createDiagram();
SemanticElementReference semanticElement = NotationFactory.eINSTANCE.createSemanticElementReference();
semanticElement.setUri(EcoreUtil.getURI(model).fragment());
newDiagram.setSemanticElement(semanticElement);
return newDiagram;
}
... I hope this helps! If you have any more questions or need further assistance, please don't hesitate to reach out. ✨ |
Beta Was this translation helpful? Give feedback.
Hi @MichaZoomZoom,
Thank you for your interest in GLSP 🎉 🙌
Part 1:
Overall, the notation model requires some identifier (i.e.,
elementId
) to be able to be linked to the semantic element.You can find the notation Ecore model here: GLSP Notation Ecore Model.
If your elements are uniquely identified by their names, you can use these names as
elementId
s. This approach should work as long as you ensure the uniqueness of the element names.For further reference, you might find this example useful: GLSP Examples - Java EMF Eclipse.
Additionally, you could store notation-related properties directly in the semantic model.
In many of our examples, we've moved away from a strict separation between …