Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Problems using our own Meta-Model
Problems using our own Meta-Model [message #1041661] Mon, 15 April 2013 07:39 Go to next message
Alexander Kipp is currently offline Alexander Kipp
Messages: 1
Registered: April 2013
Junior Member
Hello everybody,
we have the following problem:
We want to add an eObject to our own Meta-Model with the following method:
laresModel.getBehDefs().add(newBehaviorDefinition);

This is working so far, but when we link it to the graphical representation in the Addfeature with the link method:
link(containerShape, addedDomainObject);

Then this additional line in the CreateFeature is necessary:
getDiagram().eResource().getContents().add(newBehaviorDefinition);

Otherwise the graphical representation is linked with null.
But this additional line causes our eObject (newBehaviorDefinition) to be removed from the laresModel.getBehDefs(), which is a part of our own Meta-Model.
Is there any way to keep the eObject in our own model and to link it to the graphical representation?
With best regards,
Alexander, Mario and Dominik
Re: Problems using our own Meta-Model [message #1042327 is a reply to message #1041661] Tue, 16 April 2013 05:29 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas Graf
Messages: 149
Registered: July 2009
Senior Member
Hi,

are both models' resources in the same ResourceSet?

Andreas
Re: Problems using our own Meta-Model [message #1042520 is a reply to message #1041661] Tue, 16 April 2013 10:25 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1531
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Alexander,

did you see this older forum entry?
http://www.eclipse.org/forums/index.php?t=msg&th=172247&start=0&S=acb08c1bf425f0ccb0106fb3a46a4bad

It deals with separating diagram and domain data into different resources.
Both resources would be loaded into the same reosurce set/editing doamin
inside your editor.

Michael
Re: Problems using our own Meta-Model [message #1043372 is a reply to message #1042327] Wed, 17 April 2013 12:12 Go to previous messageGo to next message
Mario Dally is currently offline Mario Dally
Messages: 3
Registered: April 2013
Junior Member
Hi,

@Andreas: Never thought of that we┬┤re having two models in use...
Can I replace the model of the tutorial with ours anyhow? Or is
it necessary to use both?

Thanks,
Mario
Re: Problems using our own Meta-Model [message #1043929 is a reply to message #1043372] Thu, 18 April 2013 05:26 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas Graf
Messages: 149
Registered: July 2009
Senior Member
In which resource is "laresModel"?
Re: Problems using our own Meta-Model [message #1043961 is a reply to message #1043929] Thu, 18 April 2013 06:13 Go to previous messageGo to next message
Mario Dally is currently offline Mario Dally
Messages: 3
Registered: April 2013
Junior Member
We used the following to create an instance of our model (laresModel is the very top):

public void setRoot(LaresModel laresModel) {
	ResourceSet resSet = new ResourceSetImpl();
	Resource resource = resSet.createResource(URI.createURI("bla.xmi"));
	resource.getContents().add(laresModel);
	this.laresModel = laresModel;
}

This method is defined in an independent Singleton-Class in the project.
Re: Problems using our own Meta-Model [message #1044021 is a reply to message #1043961] Thu, 18 April 2013 07:58 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas Graf
Messages: 149
Registered: July 2009
Senior Member
At a quick glance, you are creating a dedicated ResourceSet for your laresModel. For cross-referencing to work, your resource should be created in the resourceSet of the Grpahiti Diagram. EMF only can cross ref models in the same resource set.
Re: Problems using our own Meta-Model [message #1044387 is a reply to message #1044021] Thu, 18 April 2013 17:18 Go to previous message
Mario Dally is currently offline Mario Dally
Messages: 3
Registered: April 2013
Junior Member
Added laresModel to the e-resource of the diagram. Now the link-method is working fine with "newBehaviorDefinition" in laresModel!
Now I have to check out if this works with more than one diagram - using the drilldown-feature - as well.

Thanks a lot!!!

Mario
Previous Topic:How to add a search bar on top of IPaletteCompartmentEntries
Next Topic:Diagram disappears after saving when one tries to edit
Goto Forum:
  


Current Time: Wed Apr 23 17:50:31 EDT 2014

Powered by FUDForum. Page generated in 0.03668 seconds