[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Changing between different Figures

Hello!

In my project I have (amongst others) 3 Classes: "Location", "Station" and "Depot". As you can see, these are all synonyms for some kind of place, but they look very different and have (a bit) different attributes. There is also some kind of connection to connect the places.

Nomally there are 3 Tools, one for each of them, and I can draw all 3 of them.
What I want to do now is this: I want do change between the different places. I imagine it like this: When I draw for example a Depot, there is a DropDown on its Properties-View where I have "depot", "location" and "station" to choose. And when I choose for example "station" then the appearence will change and from now on this object is a Station.
The changing is important, because when I just delete the Depot and create a Station, then all connections to other places are lost.


For this type-dropDown in the Properties-View I created already an Enumeration-Class. The dropDown is working. I even managed it, that the right type is set, when I create a new place.

So far I tried 2 different approaches:
1. I have 3 classes, one class for each place, and when the type is changed I tried to delete the old Object and create a new one. My Problems on this approach:
- I couldn`t find an appropriate place to store the code. The only place where I found that the call is passing is in the method "setType" in the class itself. But there I'm IN the class I want to delete. I don`t think, this will work.
- And I didn`t find the methods which I need to call for deletion and creation.


2. I have just 1 class, called "Place". But I have 3 Nodes in the gmfgraph, 3 Tools in the Tooling Definition and of course 3 Mappings. (I tried to copy the idea from this Tutorial: http://wiki.eclipse.org/GMF_Tutorial_Part_2#Feature_Initializers) This approach led to a totally broken Project where I couldn`t draw any nodes...

Which approach do you favor? Any ideas for one of the approaches to work? Any idea for a totally other approach (perhaps I just have a plank of wood in front of my head/I can`t think straight at the moment and the solution is very easy)?

Best whishes and thanks in advance
Julia