The value of semanticAdapter [message #1017001] |
Fri, 08 March 2013 09:32  |
Eclipse User |
|
|
|
Hello.
When I create a new diagram with my GMF editor an instance of CreateDiagramViewOperation is created.
It has a property private final IAdaptable semanticAdapter;
Where is the value of semanticAdapter taken from? Can I change it somehow? What is this semanticAdapter?
Thanks
Best regards
Mary
|
|
|
Re: The value of semanticAdapter [message #1017040 is a reply to message #1017001] |
Fri, 08 March 2013 12:54   |
Eclipse User |
|
|
|
Hi Mary,
the semanticAdapter is an IAdaptable-Wrapper of your diagram's domain element (the root). The IAdaptable is built in order to be handled by the Eclipse Platform API.
If you check your generated
XXXDiagramEditorUtil.createDiagram(URI diagramURI, URI modelURI,IProgressMonitor progressMonitor)
you will find the declarations:
XXX model = createInitialModel();
and
Diagram diagram = ViewService.createDiagram(model,XXXEditPart.MODEL_ID,XXXDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
The first call creates your diagrams domain element, the "model"-element you are looking for.
Follow the second call and you will find where this model is wrapped as an EObjectAdapter (the semanticAdapter).
Yes, you can modify the model. But, make sure not to replace the model by a different interface, as it would break your element-hierarchy.
Regards
Thomas
|
|
|
|
Powered by
FUDForum. Page generated in 0.02968 seconds