Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Creating metamodel object instances without graphical view
Creating metamodel object instances without graphical view [message #1066764] Thu, 04 July 2013 05:22 Go to next message
Luca Salemio is currently offline Luca Salemio
Messages: 14
Registered: May 2013
Junior Member
Hi everybody,
during my work on a GMF application I encountered a problem that I would like to resolve. What I need to do is:

Assume I have 2 node categories
- block
- box
and 1 connection that I can add between blocks:
- connection
that i can draw on the editor, taking them from a palette.

What i would like to achieve is when I click on a connection an instance of another object (let's say called Book) already defined to be part of a block into the ecore metamodel, is added into the block definition of the semantic domain model.

Since this Book is not part of the palette, it doesn't have EditPart and even any EditPolicies, its class is only part of the Model Code package.

Please anyone can help me ??
any suggestion is really welcome.

Thanks,
Luca.
Re: Creating metamodel object instances without graphical view [message #1067284 is a reply to message #1066764] Mon, 08 July 2013 04:10 Go to previous messageGo to next message
Luca Salemio is currently offline Luca Salemio
Messages: 14
Registered: May 2013
Junior Member
Hello everyone,
please any suggestion on this topic ??

If I have to modify semantic model without drawing objects, can I use directly myFactory.eINSTANCE to create my element or i should use some other ways like:

EditParts -> EditPolicy -> EditElementCommand.doExecuteWithResult() ???


Please help me.

Thanks,
Luca.

Re: Creating metamodel object instances without graphical view [message #1067550 is a reply to message #1067284] Tue, 09 July 2013 06:04 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

if you want to render the model element which you want to add you should define it in mapping and graphical gmf model. You do not need to define it in the tooling model. To create model element you can then use createunspecifiedtyperequest (http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r0m0/index.jsp?topic=/org.eclipse.gmf.doc/reference/api/runtime/org/eclipse/gmf/runtime/diagram/ui/requests/CreateUnspecifiedTypeRequest.html).

Ralph
Re: Creating metamodel object instances without graphical view [message #1071215 is a reply to message #1067550] Fri, 19 July 2013 11:21 Go to previous messageGo to next message
Luca Salemio is currently offline Luca Salemio
Messages: 14
Registered: May 2013
Junior Member
Thank you very much Ralph,
I tried to understand more about unspecifiedtyperequest you suggest me, but i still don't get this way.

To be more clear: what i have is an object defined in my ecore metamodel and so it has its own EObject and EObjectImpl into my project directory.

I don't want that it has graphical description, so i didn't add it in the graphical and tooling gmf model then it has not EditPart and EditPolicies.

At the moment of instantiation of other objects i would like to also add this object to the underling editor metamodel but i don't know how to do that.

can you give me some advises ?

thank you very much again,
Luca.
Re: Creating metamodel object instances without graphical view [message #1072155 is a reply to message #1071215] Mon, 22 July 2013 03:43 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

did you you try to use the Feature Sequenze Initializer and Reference New Element Spec of gmfmap? This allows you to create or setup model elements on model element creation. The easiest way I could imagine is to add both to the model elements that trigger the creation process when being instantiated. This prevents you from writing any code.

Ralph
Previous Topic:initial palette width
Next Topic:Invisible Phantom Nodes
Goto Forum:
  


Current Time: Sat Aug 30 20:34:30 EDT 2014

Powered by FUDForum. Page generated in 0.01710 seconds