Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext 2.11] Xcore(How to setup new MWE to use Xcore as imported model)
[Xtext 2.11] Xcore [message #1756322] Wed, 15 March 2017 11:29 Go to next message
Marc Schlegel is currently offline Marc SchlegelFriend
Messages: 69
Registered: July 2009
Member
Hello everyone

I've setup a Xtext project with an imported Ecore model. After experimenting with Xcore I've decided that I can edit my Ecore model much quicker using Xcore so I would like to tell my MWE to load my Xcore definition rather than the manually generated Ecore/Genmodel-files.

There is a Blog from Lorenzo Bettini which switches to Xcore but unfortunately his Blog uses the old MWE setup (pre Xtext 2.9).

Right this, this is what I have
Workflow {
	
	bean = StandaloneSetup {
		scanClassPath = true
        platformUri = "${runtimeProject}/.."
            
        registerEcoreFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.ecore"
        registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
        registerEcoreFile = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore"
        registerGenModelFile = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
    	// switch to xcore    
//        loadedResource = "platform:/resource/org.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore"
//        loadedResource = "platform:/resource/${projectName}/model/Helloxcore.xcore"
        
        // remove when xcore
        registerGenModelFile = "platform:/resource/${runtimeProject}/model/edos.genmodel"
        registerEcoreFile = "platform:/resource/${runtimeProject}/model/edos.ecore"
	}

...standard stuff...


loadedResource is not available anymore in the StandaloneSetup, so I've tried using the referencedResource within StandardLanguage


		language = StandardLanguage {
			name = "removedForForum"
			fileExtensions = "${file.extension}"
			
			referencedResource = "platform:/resource/org.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore"
			referencedResource = "platform:/resource/${runtimeProject}/model/edos.xcore"


This doesnt work with
Caused by: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/org.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore; systemId: platform:/resource/org.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore; lineNumber: 1; columnNumber: 1; Content ist nicht zulässig in Prolog.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1437)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)


So the question is: how can I register the Xcore-artifacts and my Xcore-definition with the new MWE configuration for Xtext 2.11?


[Updated on: Wed, 15 March 2017 11:31]

Report message to a moderator

Re: [Xtext 2.11] Xcore [message #1756323 is a reply to message #1756322] Wed, 15 March 2017 11:33 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

I have written a blog about this https://blogs.itemis.com/en/using-xtext-with-xcore-and-gradle
Re: [Xtext 2.11] Xcore [message #1756325 is a reply to message #1756322] Wed, 15 March 2017 11:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
did you add org.eclipse.emf.ecore.xcore to the deps of yourdsl?

i assume you can leave out referencedResource = "platform:/resource/org.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore"



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: [Xtext 2.11] Xcore [message #1756344 is a reply to message #1756325] Wed, 15 March 2017 15:55 Go to previous message
Marc Schlegel is currently offline Marc SchlegelFriend
Messages: 69
Registered: July 2009
Member
To both of you: many thanks Smile

Christians answer solved my problem with the xcore-reference. I only had the xcore.lib as dependency.
I am not yet done with Karstens blog but its very impressive...exactly what I need.
Previous Topic:ID and a more relaxed version living together
Next Topic:Content assist and unordered groups
Goto Forum:
  


Current Time: Wed Nov 06 12:23:53 GMT 2024

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

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

Back to the top