Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to extend DiagramImpl?
How to extend DiagramImpl? [message #207882] Mon, 06 October 2008 12:46 Go to next message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
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 09:28 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
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 07:27 Go to previous message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
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: Thu Sep 26 05:43:38 GMT 2024

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

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

Back to the top