Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [xtext-dev] Importing EMF model inside subpackages

Hi Kasper,

using subpackages in EMF is strongly discouraged, not only with Xtext (even Ed Merks himself considers them evil).
So the best solution is to split up your nested Ecore model into multiple flat ones.

Best regards
Jan
 

--
Dr. Jan Köhnlein
jan.koehnlein@xxxxxxxxxx

TypeFox GmbH
Am Germaniahafen 1
24143 Kiel

Phone: +49 151 17396687
Skype: jankoehnlein
Twitter: jankoehnlein

Sitz: Kiel, Registergericht: Amtsgericht Kiel, HRB 17385
Geschäftsführer: Sven Efftinge, Moritz Eysholdt, Dr. Jan Köhnlein

> On 11 Jul 2016, at 21:42, kaspergam <kaspergam@xxxxxxxxxxxxx> wrote:
> 
> Hi all,
> 
> I am trying to use an existing EMF model as a base for a parser written in XText. However, I am having trouble getting the grammar to build with an ecore model that is in a series of sub-packages- The referenced EObjects are in org/eclipse/january/geometry (org is the top EPackage), where the last nsURI is "http://www.eclipse.org/january/geometry";. There are no errors with the workflow or the grammar, but when generating the Xtext artifacts, there is an error stating that the package "http:/www.eclipse.org/january/geometry" cannot be resolved. I made sure the xtext nature is added to the project, as well as registered the package in the StandaloneSetup class. I should also mention that for dependency reasons, I have the xtext and EMF model code all in the same plugin project. 
> 
> In my grammar (.xtext file), I simply import the package:
> 
> import "http://www.eclipse.org/january/geometry";
> 
> And in the mwe2:
> 
> referencedResource = "platform:/resource/org.eclipse.january.geometry.model/model/geometry.genmodel
> 
> And the first error line when generating the artifacts is something like this:
> 
> 672  [main] ERROR xt.generator.XtextGeneratorLanguage  - [XtextLinkingDiagnostic: null:3 Couldn't resolve reference to EPackage 'http://www.eclipse.org/january/geometry'., XtextLinkingDiagnostic: null:6 Couldn't resolve reference to EClassifier 'Geometry'., XtextLinkingDiagnostic: null:7 Couldn't resolve reference to EClassifier 'Geometry'., XtextLinkingDiagnostic: null:14 Couldn't resolve reference to EClassifier 'Shape'., XtextLinkingDiagnostic: null:15 Couldn't resolve reference to EClassifier 'Shape'., XtextLinkingDiagnostic: null:19 Couldn't resolve reference to EClassifier 'Triangle'., XtextLinkingDiagnostic: null:20 Couldn't resolve reference to EClassifier 'Triangle'., XtextLinkingDiagnostic: null:28 Couldn't resolve reference to EClassifier 'Vertex'., XtextLinkingDiagnostic: null:29 Couldn't resolve reference to EClassifier 'Vertex'.]
> 674  [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems running workflow org.eclipse.january.model.xtext.GenerateSTL: Problem parsing 'file:/home/k7e/Documents/ICE/dev/eavp/org.eclipse.january.geometry.model/../org.eclipse.january.geometry.model/src/xtext/STL.xtext':
> 
> 
> Is this because the package I want is a subpackge, and Is it possible to use objects from EMF subpackges? Or should I resturcture the EMF model to not have any subpackges? 
> 
> Thanks, I appreciate any help on this!
> 
> Kasper Gammeltoft
> Oak Ridge National Laboratory
> Computer Science Research Group
> _______________________________________________
> xtext-dev mailing list
> xtext-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/xtext-dev



Back to the top