Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to extend DiagramImpl?
How to extend DiagramImpl? [message #207882] Mon, 06 October 2008 08:46 Go to next message
Eclipse UserFriend
Hi,

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?

Thanks a lot in advance.

Best regards,

Martin
Re: How to extend DiagramImpl? [message #207922 is a reply to message #207882] Tue, 07 October 2008 05:28 Go to previous messageGo to next message
Eclipse UserFriend
Hello Martin,

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.

-----------------
Alex Shatalin
Re: How to extend DiagramImpl? [message #208004 is a reply to message #207922] Wed, 08 October 2008 03:27 Go to previous message
Eclipse UserFriend
Hello Alex,

now it works :)

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 ;)

Thanks a lot.

Best Regards,

Martin
Previous Topic:Text Underline in .gmfgraph
Next Topic:Prohibit moving nodes into compartments
Goto Forum:
  


Current Time: Sat Jul 05 09:35:33 EDT 2025

Powered by FUDForum. Page generated in 0.04200 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top