Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [MWE2] Problem loading models
[MWE2] Problem loading models [message #1221385] Tue, 17 December 2013 15:21 Go to next message
Juan Cadavid is currently offline Juan CadavidFriend
Messages: 59
Registered: July 2009
Location: Paris, France
Member

Hello,

I'm trying to use MWE2 to run a transformation workflow which is simple enough: load a .gmfgen model and generate code from an Xtend template.

For the first step, I'm using the provided "Reader" component:

Workflow {
	component = org.eclipse.emf.mwe.utils.Reader {
		uri = "/org.eclipse.papyrus/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen"
		modelSlot = "inputGmfgen"
	}
}


When running this simple wf, I get:
Quote:

Couldn't load resource under /org.eclipse.papyrus/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen : org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.eclipse.org/gmf/2009/GenModel' not found.


Fair enough. I then add a preceding custom-written component to load the GMFGen EPackage. Its implementation only does this:
public class LoadGmfgenComponent extends AbstractWorkflowComponent {
	protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
		EPackage.Registry.INSTANCE.put(GMFGenPackage.eNS_URI, GMFGenPackage.eINSTANCE);
	}
	...
}

The workflow now looks like this:

Workflow {
	//0. Load GMFGen
	component = org.eclipse.papyrus.test.framework.m2t.xtend.LoadGmfgenComponent {} 
	
	//1. Load GMFGen file 
	component = org.eclipse.emf.mwe.utils.Reader {
		uri = "/org.eclipse.papyrus/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen"
		modelSlot = "inputGmfgen"
	}
}


And now I get:
Quote:

Missing serialized package: /models/gmfgen.ecore
at org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl.loadPackage(GMFGenPackageImpl.java:7694)
at org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl.initGen(GMFGenPackageImpl.java:1238)
at org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl.init(GMFGenPackageImpl.java:1254)


...which is a first since calling GMFGenPackage.eINSTANCE from any platfom-running code would not throw this. I haved added the dependency containing this package (org.eclipse.gmf.codegen), and it doesn't change anything.
Thus, I can't load my input model to my MWE2 workflow. Any ideas?

Thanks a lot in advance for the help!

Juan
Re: [MWE2] Problem loading models [message #1221391 is a reply to message #1221385] Tue, 17 December 2013 15:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13661
Registered: July 2009
Senior Member
Hi have a look at the standalonesetup component. It is meant for
registering packages

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [MWE2] Problem loading models [message #1222025 is a reply to message #1221391] Thu, 19 December 2013 14:15 Go to previous message
Juan Cadavid is currently offline Juan CadavidFriend
Messages: 59
Registered: July 2009
Location: Paris, France
Member

Thanks, just what I need! Here's the link whoever needs it:
http://download.eclipse.org/modeling/emft/mwe/javadoc/2.5/org/eclipse/emf/mwe/utils/StandaloneSetup.html

and my example:

bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
		platformUri = '..'	
		scanClassPath = true
		uriMap = {
			from = 'platform:/plugin/org.omg.utp/model/utp_1-2.profile.uml'
			to = 'platform:/resource/org.omg.utp/model/utp_1-2.profile.uml'
		}
		registerGeneratedEPackage = 'org.eclipse.gmf.codegen.gmfgen.GMFGenPackage'
		registerGeneratedEPackage = 'org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage'
	}
Previous Topic:Possibly solved? EMF Compare - "resolution of uriFragment... failed"
Next Topic:2.5 incompatibility
Goto Forum:
  


Current Time: Thu Nov 26 10:31:32 GMT 2020

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

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

Back to the top