Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Accessing attributes in generated code for editor
Accessing attributes in generated code for editor [message #431203] Thu, 02 July 2009 13:30 Go to next message
Arnaud Dieumegard is currently offline Arnaud DieumegardFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

I'm working on a project using an ecore model.
With this ecore model I have generated a genmodel file and an
editorconfigurator and diagramconfigurator.
All works fine !!

But,
In my ecore model (Channel.ecore) I have a class (Configuration)
containing an attribute (name) and a reference to an other class
(Assignments). Assignments contains a reference to an other class
(Method), method contains attributes.
When I create my diagram, I fill the name of the configuration and I
create the assignments. In the assignments I create the Method. I would
like to set automatically the method attributes with the value
i_[Configuration.name].

I have found in the generated java code the Method constructor. I have
overrided it to create an other one taking a string as parameter to pass
the Configuration.name value.
Here is my problem: I can't get the Configuration.name value !!

I have tried to use the getters (ChannelPackage.getConfiguration()) but
all the objects I get contains the attribute but not the value of the
attribute.

A solution ?
Thanks
Arnaud
Re: Accessing attributes in generated code for editor [message #431204 is a reply to message #431203] Thu, 02 July 2009 13:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Arnaud,

Comments below.


Arnaud Dieumegard wrote:
> Hi,
>
> I'm working on a project using an ecore model.
> With this ecore model I have generated a genmodel file and an
> editorconfigurator and diagramconfigurator.
> All works fine !!
>
> But,
> In my ecore model (Channel.ecore) I have a class (Configuration)
> containing an attribute (name) and a reference to an other class
> (Assignments). Assignments contains a reference to an other class
> (Method), method contains attributes.
> When I create my diagram, I fill the name of the configuration and I
> create the assignments. In the assignments I create the Method. I
> would like to set automatically the method attributes with the value
> i_[Configuration.name].
>
> I have found in the generated java code the Method constructor. I have
> overrided it to create an other one taking a string as parameter to
> pass the Configuration.name value.
> Here is my problem: I can't get the Configuration.name value !!
You should not be doing this in your model I don't think. You should
specialize the behavior of the editor. Is this a plain old EMF editor
or a GMF editor? In the former case, it sounds like you could
specialize code for collectNewChildDescriptors.
>
> I have tried to use the getters (ChannelPackage.getConfiguration())
> but all the objects I get contains the attribute but not the value of
> the attribute.
>
> A solution ?
> Thanks
> Arnaud
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Accessing attributes in generated code for editor [message #431213 is a reply to message #431204] Thu, 02 July 2009 15:02 Go to previous messageGo to next message
Arnaud Dieumegard is currently offline Arnaud DieumegardFriend
Messages: 3
Registered: July 2009
Junior Member
Ed,

Yes it's not a plain EMF because I have generated a graphical editor so if
i'm not mistaking it's more GMF, but what I want to do can be done with a
plain EMf model I think.
But I don't know what you mean with collectNewChildDescriptor, I need to
use the itemProvider to get my objects ?

Arnaud
Re: Accessing attributes in generated code for editor [message #431215 is a reply to message #431213] Thu, 02 July 2009 15:10 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Arnaud,

GMF uses different stuff for creating new objects in a model. I'm not
familiar with the details, but it seems to me that's what you should
specialized, not the model code itself. Of course you can figure out
where this is happening setting a breakpoint in the constructor and
seeing how it's being created by GMF...


Arnaud Dieumegard wrote:
> Ed,
>
> Yes it's not a plain EMF because I have generated a graphical editor
> so if i'm not mistaking it's more GMF, but what I want to do can be
> done with a plain EMf model I think.
> But I don't know what you mean with collectNewChildDescriptor, I need
> to use the itemProvider to get my objects ?
>
> Arnaud
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[sdo serialization] want to use reference instead of id
Next Topic:saving properties
Goto Forum:
  


Current Time: Fri Apr 26 00:42:01 GMT 2024

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

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

Back to the top