Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » delete functionality
delete functionality [message #184814] Wed, 30 April 2008 07:51 Go to next message
Eclipse UserFriend
Originally posted by: lishan.cs.york.ac.uk

Hi,

I am developing a design tool for statecharts in gmf. At the moment states
can be created and connections (representing transitions) drawn between
them. When a state is deleted it removes all connections that either start
or terminate at the state. I do not know how to prevent this from
happening. I want the state to be removed but everything else to remain.
Similarly states can be nested and when a state is deleted all nested
states are deleted as well. I would like to prevent this from happening
but I do not know how to do this ?

Thanks

Lishan
Re: delete functionality [message #184837 is a reply to message #184814] Wed, 30 April 2008 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Hello lishan,

You can modify ???ItemSemanticEditPolicy.getDestroyElementCommand to customize
element deletion.

> else to remain. Similarly states can be nested and when a state is
> deleted all nested states are deleted as well. I would like to prevent
Where these nested states should be stored then the state containing them
was removed from model?

-----------------
Alex Shatalin
Re: delete functionality [message #184849 is a reply to message #184837] Wed, 30 April 2008 08:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lishan.cs.york.ac.uk

My emf code is:

@namespace(uri="SML", prefix="SML")
package SML;

class NamedElement {
attr String name;
}

class StateMachine extends NamedElement{
!ordered val State[*] #statemachine states;
}
class State extends NamedElement {
!ordered ref State[1] #substates parent;
!ordered ref StateMachine[1] #states statemachine;
!ordered val State[0..*] #parent substates;
}

When I run my modelling tool and nest states within states, then delete a
parent state all substates are also removed. I want to change this
functionality so that the nested states remain.

I wondered if I changed this line :
!ordered val State[0..*] #parent substates;
to : !ordered ref State[0..*] #parent substates;

so that substates are not actually created from within states this would
make any difference to what delete removes. I tried the same thing with
transitions, I changed the val statement to a ref in the state class and
created a new val statement for transitions in the statemachine class and
deletion of a state still removed all transitions connected to it.

thanks

Lishan
Re: delete functionality [message #184863 is a reply to message #184849] Wed, 30 April 2008 08:47 Go to previous messageGo to next message
Eclipse UserFriend
Hello lishan,

> I wondered if I changed this line :
> !ordered val State[0..*] #parent substates;
> to : !ordered ref State[0..*] #parent substates;
Well, in this case the straightforward diagramming solution will be to have
all the states represented as top-level diagram elements and connect them
with the links representing parent-child relationship.

-----------------
Alex Shatalin
Re: delete functionality [message #184900 is a reply to message #184863] Wed, 30 April 2008 10:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lishan.cs.york.ac.uk

"and connect them with the links representing parent-child relationship."
I think i've tried this already but I had a problem

In gmfmap I had the top node reference properties to be:

Child Node Mapping <State/State>
Children Feature
Containment Feature states : State


and a child reference with the properties

Child Node Mapping <State/State>
Children Feature
Compartment
Containment Feature
Referenced Child Node Mapping <State/State>

but I couldn't set the containment feature to states : State
Re: delete functionality [message #184931 is a reply to message #184900] Wed, 30 April 2008 10:47 Go to previous message
Eclipse UserFriend
Hello lishan,

In the case Im talking about you should not create ChildNodeMapping at all
- all the states will be visualized as a top-level nodes (contained in the
diagram element itself.

-----------------
Alex Shatalin
Previous Topic:How to programatically "Initialize diagram file" ?
Next Topic:Re-indexing nodes in a diagram
Goto Forum:
  


Current Time: Wed Apr 23 22:59:09 EDT 2025

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

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

Back to the top