Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create child element on parent creation ...
Create child element on parent creation ... [message #147305] Tue, 21 August 2007 15:38 Go to next message
Eclipse UserFriend
Originally posted by: snej_NO-SPAM_.esuark.de

Hi there,

i need some help with that. I want to create a child object (view and
model element) when the creation of my parent is completed.
In detail i want that a special attribute (in my case EjbAttribute) is
created when the user adds a class (in my case EjbClass).
EjbClass has a reference (named attribute) to infinit EjbAttribute's.

I tried to use the informations about ICommand and so on i found in the
news and wikis, but i'm stuck.
What's the intended way to do that what i want to do? I think i only
need a hint where i have to start ...

regards
jens
Re: Create child element on parent creation ... [message #147343 is a reply to message #147305] Tue, 21 August 2007 17:15 Go to previous messageGo to next message
Jacques LESCOT is currently offline Jacques LESCOTFriend
Messages: 247
Registered: July 2009
Senior Member
Jens,

You can achieve this in the ??ViewFactory class generated for your
EjbClass, in the decorateView() method.

Regards,
Jacques

Jens Krause a écrit :
> Hi there,
>
> i need some help with that. I want to create a child object (view and
> model element) when the creation of my parent is completed.
> In detail i want that a special attribute (in my case EjbAttribute) is
> created when the user adds a class (in my case EjbClass).
> EjbClass has a reference (named attribute) to infinit EjbAttribute's.
>
> I tried to use the informations about ICommand and so on i found in the
> news and wikis, but i'm stuck.
> What's the intended way to do that what i want to do? I think i only
> need a hint where i have to start ...
>
> regards
> jens
Re: Create child element on parent creation ... [message #147350 is a reply to message #147305] Tue, 21 August 2007 17:47 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Jens,

You may create the child model element by declaring a Feature Seq
Initializer in the mapping model for the node mapping that corresponds
to EjbClass. Inside this initializer, declare a Reference New Element
Spec. Note that you may further initialize the created new element with
other initializers.
If your diagram is synchronized, CanonicalEditPolicy will then create
the visual representation of your EjbAttribute for you automatically.

Best regards,
Boris

Jens Krause wrote:
> Hi there,
>
> i need some help with that. I want to create a child object (view and
> model element) when the creation of my parent is completed.
> In detail i want that a special attribute (in my case EjbAttribute) is
> created when the user adds a class (in my case EjbClass).
> EjbClass has a reference (named attribute) to infinit EjbAttribute's.
>
> I tried to use the informations about ICommand and so on i found in the
> news and wikis, but i'm stuck.
> What's the intended way to do that what i want to do? I think i only
> need a hint where i have to start ...
>
> regards
> jens
Re: Create child element on parent creation ... [message #148098 is a reply to message #147350] Tue, 28 August 2007 14:04 Go to previous message
Eclipse UserFriend
Originally posted by: snej_NO-SPAM_.esuark.de

Boris Blajer wrote:
> You may create the child model element by declaring a Feature Seq
> Initializer in the mapping model for the node mapping that corresponds
> to EjbClass. Inside this initializer, declare a Reference New Element
> Spec. Note that you may further initialize the created new element with
> other initializers.
> If your diagram is synchronized, CanonicalEditPolicy will then create
> the visual representation of your EjbAttribute for you automatically.

That was a good advice, thanks.
Now i need to create another element on parent creation, but this time i
have to position the inner elements to special positions. With the
feature initializer that isn't possible, so i have to create and
position the graphical elements programmatically.

Do you have hints for that too?


regards
jens
Previous Topic:How to create a figure from clipboard data
Next Topic:Creating A Bi-Directional Referenced Based Link
Goto Forum:
  


Current Time: Wed Jul 17 22:31:56 GMT 2024

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

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

Back to the top