Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Customizing generated code
Customizing generated code [message #224559] Mon, 06 April 2009 18:47 Go to next message
Eclipse UserFriend
Originally posted by: simonpe.kth.se

Hi there,

I'm making an application similar to the logic example provided with
gmf. I did the emf modeling and have a working, very basic editor.
Now the development process has come to the code customization but I
have a hard time grasping the code structure.
My problem is that, for example, every AndGate in my diagram should be
created with two InputTerminals and one OutputTerminal.
Where is code like this usually put and what are the key concepts
involved in this particular scenario?
I apprechiate any resources describing the code base generated in a
short and concise manner aswell as any hints regarding the problem described
above.
--
Re: Customizing generated code [message #224694 is a reply to message #224559] Tue, 07 April 2009 13:28 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Simon,

Are you looking for domainInitializer subelement of NodeMapping? It is possible
to create predefined domain model structure below just created diagram element
using this feature (all code will be generated).

-----------------
Alex Shatalin
Re: Customizing generated code [message #224789 is a reply to message #224694] Tue, 07 April 2009 18:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: simonpe.kth.se

Hi Alex,

I have looked at Feature Seq Initializer but I do not know how it works
and I cannot find any documentation suggesting how to use this feature.

I tried to google domainInitializer but I didn't find any relevant
information regarding this. Can you please elaborate what you mean?

Simon Pettersson

Alex Shatalin wrote:
> Hello Simon,
>
> Are you looking for domainInitializer subelement of NodeMapping? It is
> possible to create predefined domain model structure below just created
> diagram element using this feature (all code will be generated).
>
> -----------------
> Alex Shatalin
>
>
Re: Customizing generated code [message #224907 is a reply to message #224789] Wed, 08 April 2009 12:12 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Simon,

With Feature Seq Initializer you can create structures like this:

- Feature Seq Initializer (appropriate element class will be associated with
it by .gmfmap editor)
- Reference New Element Specification (specify containment feature for
new child element in domain model here)
- Feature Seq Initializer (specify actual class of child element wich
should be created on this place)
- Feature Value Spec (specify feature of this element to initialize
with the value below)
- Value Expression (write an expression either on OCL or on java
to get proper value for the attribute above)
....

With the constructions like this you can define wich child/child/child....
elements should be created together with new domain model element + where
they should be stored (containment feature) + initialize some particular
properties of new elements.

Just try playing with this structute and you'll se it's very easy all you
have to know is:
- Feature Seq Initializer (except root one) can specify an element to create
- Reference New Element Specification - containment feature to store newly
created element
- Feature Value Spec - feature to initialize with an references or value
- Value Expression - expression to get references or value


-----------------
Alex Shatalin
Re: Customizing generated code [message #224977 is a reply to message #224907] Wed, 08 April 2009 14:31 Go to previous message
Eclipse UserFriend
Originally posted by: simonpe.kth.se

Hi Alex,

thank you very much for your support. This little response did in five
minutes what me and my friend have been working on for several days
without success.

Simon

Alex Shatalin skrev:
> Hello Simon,
>
> With Feature Seq Initializer you can create structures like this:
>
> - Feature Seq Initializer (appropriate element class will be associated
> with it by .gmfmap editor)
> - Reference New Element Specification (specify containment feature for
> new child element in domain model here)
> - Feature Seq Initializer (specify actual class of child element
> wich should be created on this place)
> - Feature Value Spec (specify feature of this element to
> initialize with the value below)
> - Value Expression (write an expression either on OCL or on
> java to get proper value for the attribute above)
> ...
>
> With the constructions like this you can define wich
> child/child/child.... elements should be created together with new
> domain model element + where they should be stored (containment feature)
> + initialize some particular properties of new elements.
>
> Just try playing with this structute and you'll se it's very easy all
> you have to know is:
> - Feature Seq Initializer (except root one) can specify an element to
> create
> - Reference New Element Specification - containment feature to store
> newly created element
> - Feature Value Spec - feature to initialize with an references or value
> - Value Expression - expression to get references or value
>
>
> -----------------
> Alex Shatalin
>
>
>
Previous Topic:How to restrict the position of arrow start/end points?
Next Topic:how to get list of editparts
Goto Forum:
  


Current Time: Wed Apr 24 22:17:15 GMT 2024

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

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

Back to the top