I have a new problem which belongs to the "changing between
EditParts"-issue.
In my project I have one Object called "Location" which has 6 different
graphical representations (=6 EditParts). Which EditPart the user can
see depends on the data: A Location can contain Vehicles, Stations
and/or Depots. That means, when for example the first Vehicle is added
to a Location, it changes its appearance, and when the last Vehicle is
deleted at the Location it changes its appearance back again.
Normal adding and deleting of vehicles, stations and depots works
(nearly) fine. (-> see "Changing between different figures")
But when I do something that leads to an EditPart-Change (like adding
the first vehicle to a location or removing the last vehicle from a
location) and then click Edit -> Undo, a red box appears on the screen
with the text "invalid view - remove from diagram".
Adding the second or third vehicle to the location and undo this
operation works. That means it must have something to do with the
EditPart-Change.
I already debugged it:
When I click Undo XXXEditPartFactory.createEditPart() gets an additional
call for a Node (additional to what is normally called, when I undo a
vehicle-creation). This Node has no VisualID (the VisualID is null) and
its element is a ShapesDiagramImpl. For that Node
createUnrecognizedEditPart() is called (because of VisualID=null) and
this makes the red box.
The call for this node is completely unnecessary. But I don`t know where
it comes from/what triggers it and how I can prevent it.
Does anyone have an idea what to do?