Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Deleting Transitions manually
Deleting Transitions manually [message #189905] Thu, 29 May 2008 07:30 Go to next message
Eclipse UserFriend
Originally posted by: carlos.munoz.justinmind.com

I everyone!

I've a problem. My application is using GMF. The problem is that when i've
a diagram created, i must delete a group of Transitions, when something
happends. But i don't know how to delete they.

I have created my command called DeleteTransitionsCommand extends
AbstractTransactionalCommand. The GMF generation create Commands to 'Add'
elements but no commands for 'Delete', so how can I do a 'Delete'???

I've the Diagram and get all the Content eAllContent() but now I've I to
delete some transitions and I don't know how to do it. In case of delete
Node's I tried to set the Container to NULL , and this, delete the Node
from the diagram correctly, but with transitions this don't have effect.

Thanks!
Re: Deleting Transitions manually [message #190018 is a reply to message #189905] Thu, 29 May 2008 11:36 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Carlos,

Try sending new EditCommandRequestWrapper(new DestroyElementRequest(getEditingDomain(),
false)) request to the corresponding EditPart and executing command returned
from it.
See DeleteFromModelAction as an example.

-----------------
Alex Shatalin
Re: Deleting Transitions manually [message #190626 is a reply to message #190018] Tue, 03 June 2008 10:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: carlos.munoz.justinmind.com

the problem is that i must execute this from a command, so I don't have
acces to the edit parts.

This command must be executed when something happends. And when this
commands is executed, it has got a TarnsitionImpl Object or N
transitionImpl Objects. So I want to Delete all of them. But I have the
model, not the EditPart. Thanks!
Re: Deleting Transitions manually [message #190633 is a reply to message #190626] Tue, 03 June 2008 10:49 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Carlos,

> This command must be executed when something happends. And when this
> commands is executed, it has got a TarnsitionImpl Object or N
> transitionImpl Objects. So I want to Delete all of them. But I have
> the model, not the EditPart. Thanks!
Can you access EditParts from the place where the command is executed? (current
selection at least) In this case it should be possible to collect all the
delete commands using the logic I sent you and execute then all of them.

Another option is to copy the logic from TransitionsItemSemanticEditpolicy.getDestroyElementCommand() .

-----------------
Alex Shatalin
Re: Deleting Transitions manually [message #190641 is a reply to message #190018] Tue, 03 June 2008 10:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: carlos.munoz.justinmind.com

i've been trying to understand the DeleteFromModelAction, but I don't know
how can I use it.

I have created a command that extends from DeleteCommand. The ejecute of
this command make a Deletelement Command and then call his parent. This
goes so good!

The problem comes because I must user View's objects to Create the
DeleteCommand.

Can I get the View Object fom the Model Object??

Thanks!
Re: Deleting Transitions manually [message #190648 is a reply to message #190641] Tue, 03 June 2008 11:17 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Carlos,

> Can I get the View Object fom the Model Object??
By using CrossReferencer to find incoming references. ;-(

-----------------
Alex Shatalin
Re: Deleting Transitions manually [message #191346 is a reply to message #190648] Fri, 06 June 2008 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: youchy.gmail.com

Hi, I've problems with this.

Can I get the View Object fom the Model Object??
By using CrossReferencer to find incoming references. ;-(

I have a Transition from an EObject called "Page" to another EObject
called "Decision"

if i want the eCrossReferences from the transitions, it returns the
EObject called Page.

What I need is the Object called View, in the case of Transitions, this
may be the EdgeImpl. I've been seeing policies, and always they do...
'(View) getHost().getModel()'

I can delete Transitions manually if I have this object. This Object is a
model in the middle of the EditPart and the real Model xxxxTransitionImpl.

I only have the name of the Transition. Then I obtain the TransitionImpl.
But now I need to go get the EdgeImpl or ViewObject.

Can you help me???

Thanks!!!
Re: Deleting Transitions manually [message #191378 is a reply to message #191346] Fri, 06 June 2008 08:41 Go to previous message
Eclipse UserFriend
Originally posted by: youchy.gmail.com

I will xplain you the real problem.

I need to do an UNDO of create elements. I know GMF provides UNDO's.

The problem is that GMF use undo by editor.

And I'm using GMF only on an unic editor, and here is where all the
Diagram are loaded, so when I load a Diagram on the editor, the UNDO STACK
of the other is lost.

what I'm doing is my commands, to can make create Node UNDO, cerate
Transition UNDO, delete Node UNDO and delete Transition UNDO.

The problem is...when you load an scenario, the model is regenerated, so
the Instances of the objects are not the same...and what i'm doing is
looking where is the instance with the same ID that the instance that is
in my Command. When I have it...now i need to delete it.

In the case of Node's, what I do is to put the 'ActivityScenario' (the
parent of nodes and transitions) to null, and that's all.

But in case of Transitions, I don't know how to do a delete. I've the
xxxxxxxTransitionImpl in the command.

I did the create Transition UNDO, but i need the View Object (EdgeImpl) of
this xxxxxxxTransitionImpl.

Please can you help me???

Thanks!

if something is wrong, or you can't understand, please answer me, my
ensglish is so bad, sorry!
Previous Topic:[Newbie] ID and IDRED in link mapping
Next Topic:dynamic figure
Goto Forum:
  


Current Time: Fri Apr 26 05:28:59 GMT 2024

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

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

Back to the top