I am quite new to Eclipse-Development. And I have a problem with
View-implementations.
I need for my program a serializable Diagram (and also other Views). So
it must implement the interface Serializable. To achieve this I extended
DiagramImpl with MyDiagramImpl which only implements the interface.
Than I extended the ViewProvider und the ViewFactory overwrote the
Method createDiagram() to return MyDiagramImpl.
This work until I load the data from the resource. The resource only
loads MyDiagram and not MyDiagramImpl. I guess that is because the
resource get’s the information from the NotationPackage.
So the question is: How can I extend ViewImpls and use the extended
classes instead of the original ones?
Try to extend Diagram using EMF. This means, create MyDiagram EClass extending
Diagram, generate code for it and patch generated classes to implement Serializable
interface. Then modify ViewFactory to return newly generated interface. As
a result saved diagram should ne loaded correctly next time.
As you suggested I extend Diagram in my EMF model and generated the code
for it. Then I used the MyFactory to generate an instance of MyDiagram
and returned this in createDiagram() in the generated ViewFactoy.
Now the resource saves and loads my Diagram-version and I can serialize
the diagram. This was the solution I was searching for ;)