Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Deletion of elements and OpenDiagramEditPolicy
Deletion of elements and OpenDiagramEditPolicy [message #231242] Mon, 25 May 2009 16:42 Go to next message
Javier is currently offline JavierFriend
Messages: 57
Registered: July 2009
Member
Hello.

I have an application in which my Canvas is of the type Task. In the
model, I have a top element Domain, which contain Tasks. In my model, a
Task can contain some Methods, these methods can contain Boxes and in
these boxes I can also add Tasks, but conainment is false, it just can
reference a task. For editing these Tasks, I added an
OpenDiagramEditPolicy to the TaskEditPart, so that if I double-click on
a Task I get an editor in which I can add methods and boxes for that
Task. Now, let's say I delete one task (TASK_1) contained in one box,
and previously I had opened a editor and added methods and boxes to that
task (for example, BOX_2 and TASK_2, TASK_2 is actually contained in the
Domain). The deletion process go to a DestroyElementCommand... I
debugged the code and this command destroys the element and all
incoming/outgoing references. After deleting that Task, everything seems
allright. But my problem comes when I try to save the diagram: it
triggers a Dialog saying that some of the Box element (the one showing a
task in the other diagram) has no associated resource and the diagram
can't be saved. It happens when a Box has a Task... if it doesn't have a
Task, then it works properly. If I look at my Domain element, in the
Task list I still can see TASK_2, but Methods of Task_1 are gone... it
seems like it deleted some things but not all of them.

Does anyone could give me a hint on how to get into this process of
deletion? Because it seems different to the typical implemented on a
ItemSemanticEditPolicy, when it adds the deletion of childNodes (looking
for them in the EditPartRegistry... but now, as the new editor is
closed, its EditPartRegistry just doesn't exist at the moment).

Thanks!
Re: Deletion of elements and OpenDiagramEditPolicy [message #231347 is a reply to message #231242] Tue, 26 May 2009 10:57 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Javier,

> Task, everything seems allright. But my problem comes when I try to
> save the diagram: it triggers a Dialog saying that some of the Box
> element (the one showing a task in the other diagram) has no
> associated resource and the diagram can't be saved. It happens when a
Looks like you have to manually modify *ItemSemanticEditPolicy to delete
a reference to this box from all the other diagrams (just like we do with
shortcuts).
The problem (AFAIU) is: you've deleted element but some of it's children
are still references by another diagram.

-----------------
Alex Shatalin
Previous Topic:Labels broken?
Next Topic:Filling Palette with elements from an Ecore Model.
Goto Forum:
  


Current Time: Fri Apr 19 18:38:10 GMT 2024

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

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

Back to the top