|The value of semanticAdapter [message #1017001]
||Fri, 08 March 2013 09:32
| Mary P.
Registered: November 2012
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?
|Re: The value of semanticAdapter [message #1017040 is a reply to message #1017001]
||Fri, 08 March 2013 12:54
| Thomas Beyer
Registered: February 2013
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();
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.
Powered by FUDForum
. Page generated in 0.06788 seconds