Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Update the properties of a link when he is created
Update the properties of a link when he is created [message #486509] Thu, 17 September 2009 21:35 Go to next message
marco  is currently offline marco Friend
Messages: 82
Registered: September 2009
Member
hi

I also have a problem with the class the following link:

@gmf.link(source="from",target="to")
abstract class Link extends PropertyHolderElement, TypedElement {
attr LinkNavigability navigability;
ref ConnectableElement[1] from;
ref ConnectableElement[1] to;
ref Component fromContext;
ref Component toContext;
}


I wish that I automatically are assigned the values of the 4 elements
from, to, fromContext, toContext.

for example if I create a component A with a connectable element B and
another element component C with a connectable element D.

If I create a link between A and C I want to have in the properties links
the following values:
from = b
to = c
fromContext = A
toContext = B

I adds a another source and target of the link?
Is there a way to solve this problem?

thank you very much

marco
Re: Update the properties of a link when he is created [message #486590 is a reply to message #486509] Fri, 18 September 2009 10:40 Go to previous messageGo to next message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello marco,

Try using feature sequence initializers for corresponding link mapping in
..gmfmap model. This should help you to initialize from/to references (it's
possible to properly configure link mapping to sed fromContext/toContext).
Then you can try solving a problems with link rerouting.

In case you canot implement corresponding functionality using ocl in feature
sequence initializer then you can modify generated code.

-----------------
Alex Shatalin
Re: Update the properties of a link when he is created [message #486664 is a reply to message #486590] Fri, 18 September 2009 14:36 Go to previous messageGo to next message
marco  is currently offline marco Friend
Messages: 82
Registered: September 2009
Member
I have already set up the link to / from

I wish I could add in the property value is also in the fields fromContext
and toContext just creates the link

Where can I see an example of the use of OCL?

thanks

marco
Re: Update the properties of a link when he is created [message #486897 is a reply to message #486664] Sun, 20 September 2009 20:13 Go to previous messageGo to next message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello marco,

you need to create feature sequence initializer initializing fromContext
reference in a way like: self.from.context

where "context" is a reference from "from" element to "fromContext" one...

-----------------
Alex Shatalin
Re: Update the properties of a link when he is created [message #488347 is a reply to message #486897] Mon, 28 September 2009 11:09 Go to previous messageGo to next message
marco  is currently offline marco Friend
Messages: 82
Registered: September 2009
Member

alex you please give me an example of what I create?

are not very experienced and I have not understood what I wanted to tell me.

I create a new file? if so, where?

Where can I study these things?

if you send my metamodel can indicate the changes that I should do?

thanks marco
Re: Update the properties of a link when he is created [message #488368 is a reply to message #488347] Mon, 28 September 2009 13:00 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 31
Registered: September 2009
Member
Hi,

Quote:

Please give me an example of what I create?



In general you open your "???.gmfmap" file. Select the node (mapping) you want to initialize. Right click and insert an feature sequence initializer.

Examples can be found at http://wiki.eclipse.org/GMF_Tutorial_Part_2#Feature_Initiali zers

For more informations about OCL and some example code see http://wiki.eclipse.org/MDT-OCL#Examples.


Regards,

sas
Re: Update the properties of a link when he is created [message #489171 is a reply to message #488368] Thu, 01 October 2009 17:08 Go to previous messageGo to next message
marco  is currently offline marco Friend
Messages: 82
Registered: September 2009
Member

hi

i have create the feature sequence initializer....

feature sequence initializer<SAbinding(fromContext,toContext)>
reference new element spec <fromContenxt:= new Compoennt[1]>
feature sequence initializer<new SAcomponent(name)>
reference new element spec <name:= new EString[0]>

reference new element spec <toContenxt:= new Compoennt[1]>
feature sequence initializer<new SAcomponent(name)>
reference new element spec <name:= new EString[0]>

I got this:
fromContext: SAcomponent
toContext: SAcomponent

there was no element name but only the type of item.

for example having a SAcomponent A and B SAcomponent I should get
fromContext: SAcomponent A
toContext: SAcomponent B


i send you two image of my implementation?

I tried to attach pictures here but I failed.

you leave your email?

thanks marco
Re: Update the properties of a link when he is created [message #489556 is a reply to message #489171] Sun, 04 October 2009 21:21 Go to previous message
marco  is currently offline marco Friend
Messages: 82
Registered: September 2009
Member
marco wrote on Thu, 01 October 2009 13:08

hi

i have create the feature sequence initializer....

feature sequence initializer<SAbinding(fromContext,toContext)>
reference new element spec <fromContenxt:= new Compoennt[1]>
feature sequence initializer<new SAcomponent(name)>
reference new element spec <name:= new EString[0]>

reference new element spec <toContenxt:= new Compoennt[1]>
feature sequence initializer<new SAcomponent(name)>
reference new element spec <name:= new EString[0]>

I got this:
fromContext: SAcomponent
toContext: SAcomponent

there was no element name but only the type of item.

for example having a SAcomponent A and B SAcomponent I should get
fromContext: SAcomponent A
toContext: SAcomponent B


i send you two image of my implementation?

I tried to attach pictures here but I failed.

you leave your email?

thanks marco

Previous Topic:Connection between compartments
Next Topic:Problem wiht abstract class in the diagram
Goto Forum:
  


Current Time: Mon Sep 23 09:41:28 GMT 2024

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

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

Back to the top