Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problems with referencing ecore's
Problems with referencing ecore's [message #884661] Mon, 11 June 2012 15:17 Go to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
Dear all,

I have succesfully created a grammar that is based on RMF's Reqif ecore.

Now I am trying to build a grammar that references ReqIF ecore.
My grammar statement is

Constraint:
'constraint' name=ID ref=[reqif10::SpecObjectType|ID]
query=XExpression
;

However, the workflow fails. It cannot generate an .ecore for my Xtext grammar.
I have tracked down the problem to GenModelImpl#getMissingPackagesHelper
The line

ePackages.add(eClassifier.getEPackage());

adds a null value to the list of ePackages, which causes a null pointer exception in the generator of Xtext.

The value of eClassifier, according to the debugger is

org.eclipse.emf.ecore.impl.EDataTypeImpl@6398523f (eProxyURI: platform:/plugin/org.eclipse.emf.ecore/model/XMLNamespace.ecore#//LangType)

I have tried adding basically everything to tge StandaloneSetup:
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
// The following two lines can be removed, if Xbase is not used.
registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"


registerGeneratedEPackage = "org.eclipse.rmf.reqif10.xhtml.XhtmlPackage"
registerGeneratedEPackage = "org.eclipse.rmf.reqif10.datatypes.DatatypesPackage"
registerGeneratedEPackage = "org.eclipse.rmf.reqif10.ReqIF10Package"
registerGeneratedEPackage = "org.eclipse.emf.ecore.EcorePackage"
registerGeneratedEPackage = "org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage"
registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.rmf.reqif10/model/reqif10.genmodel"
registerGenModelFile ="platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.emf.ecore/model/XMLNamespace.genmodel"
}

but no success. Any idea how I could solve the null pointer problem?

Thanks,

Andreas

EDIT: The nullpointer is thrown in EcoreGeneratorFragment#getGenPackagesForPackages in && gp.getEcorePackage().getNsURI().equals(pkg.getNsURI()))


[Updated on: Mon, 11 June 2012 15:19]

Report message to a moderator

Re: Problems with referencing ecore's [message #884733 is a reply to message #884661] Mon, 11 June 2012 17:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13628
Registered: July 2009
Senior Member
Hi,

could you give the following a try

    bean = StandaloneSetup {
        scanClassPath = true
        platformUri = "${runtimeProject}/.."
        uriMap = {
    		from = "platform:/plugin/org.eclipse.emf.ecore/model/XMLNamespace.genmodel"
    		to = "platform:/resource/org.eclipse.emf.ecore/model/XMLNamespace.genmodel"
    	}
    	uriMap = {
    		from = "platform:/plugin/org.eclipse.emf.ecore/model/XMLNamespace.ecore"
    		to = "platform:/resource/org.eclipse.emf.ecore/model/XMLNamespace.ecore"
    	}
        // The following two lines can be removed, if Xbase is not used.
    	registerGenModelFile = "platform:/plugin/org.eclipse.emf.ecore/model/XMLNamespace.genmodel"
        registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
        registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
    	registerGeneratedEPackage = "org.eclipse.rmf.reqif10.ReqIF10Package" 
    	registerGeneratedEPackage = "org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage"
    	registerGenModelFile = "platform:/resource/org.eclipse.rmf.reqif10/model/reqif10.genmodel"
    	
    	
    }


~Christian


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: Problems with referencing ecore's [message #884963 is a reply to message #884733] Tue, 12 June 2012 07:22 Go to previous message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
Thanks Christian,

I forgot about the recurring mapping of the URIs.

Thank you very much.
Previous Topic:Custom Types
Next Topic:Error: Duplicate VarDecl 'i' (scoping problem)
Goto Forum:
  


Current Time: Tue Oct 20 11:48:35 GMT 2020

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

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

Back to the top