Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem Using Resource URIs to Import Existing EPackages
Problem Using Resource URIs to Import Existing EPackages [message #636470] Mon, 01 November 2010 13:54 Go to next message
Noorulhoda Samah is currently offline Noorulhoda SamahFriend
Messages: 6
Registered: October 2010
Junior Member
Hi
In my grammar, I import an ecore model to type elements of my rules. I have an import statement referring to the Ecore file I want to import in my Grammar like this:
import 'platform:/resource/org.example.dataModel/model/DataModel.ecore' as dmodel

I have configured the generator fragment in my MWE file
// generates Java API for the generated EPackages 
fragment = ecore.EcoreGeneratorFragment {
referencedGenModels = "platform:/resource/org.example.dataModel/model/DataModel.genmodel"}

When I generate I do not get any errors in the consol. However, when I create an editor file in the Eclipse run-time instance, I get the error below in the consol, which complains about the non-existance of an IResourceServiceProvider. I have looked into the documentation but it was too difficult for me to follow, as I have a limited Java skills (coming from database administeration background). Would it be possible to help me solve this problem or explain to me how to implement an IResourceServiceProvider?

Note: previousely, I was importing an ecore metamodel using a NsURI and it worked fine without any extra coding, but now I want to use an ecore model rather than the ecore metamodel, and according to documentation, for that purpose, I should use a resource URI instead of a NSURI

Thanks in advance

0    [Worker-1] WARN  org.eclipse.xtext.linking.lazy.LazyLinkingResource  - resolution of uriFragment 'xtextLink_::0.2.2.2::0::/0' failed.
java.lang.IllegalStateException: No IResourceServiceProvider found in registry for uri platform:/resource/final.test/EmpMgtSys.datamodel
	at org.eclipse.xtext.scoping.impl.LoadOnDemandResourceDescriptions.getResourceDescription(LoadOnDemandResourceDescriptions.java:57)
	at org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider.createLazyResourceScope(ImportUriGlobalScopeProvider.java:100)
	at org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider.getScope(ImportUriGlobalScopeProvider.java:70)
	at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:32)
	at org.eclipse.xtext.scoping.impl.SimpleLocalScopeProvider.getScope(SimpleLocalScopeProvider.java:61)
	at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegateGetScope(AbstractDeclarativeScopeProvider.java:72)
	at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.getScope(AbstractDeclarativeScopeProvider.java:102)
	at org.eclipse.xtext.linking.impl.DefaultLinkingService.getScope(DefaultLinkingService.java:49)
	at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:103)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:94)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:219)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:202)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:262)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eResolveProxy(BasicEObjectImpl.java:1475)
	at org.xtext.myOperations.impl.AddedClassImpl.getAddedClass(AddedClassImpl.java:77)
	at org.xtext.myOperations.impl.AddedClassImpl.eGet(AddedClassImpl.java:121)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1013)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1005)
	at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.hasNext(EContentsEList.java:409)
	at org.eclipse.xtext.EcoreUtil2.resolveCrossReferences(EcoreUtil2.java:489)
	at org.eclipse.xtext.EcoreUtil2.resolveAll(EcoreUtil2.java:473)
	at org.eclipse.xtext.validation.ResourceValidatorImpl.resolveProxies(ResourceValidatorImpl.java:122)
	at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:60)
	at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(ValidationJob.java:79)
	at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(ValidationJob.java:1)
	at org.eclipse.xtext.util.concurrent.IStateAccess$AbstractImpl.readOnly(IStateAccess.java:40)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:70)
	at org.eclipse.xtext.ui.editor.validation.ValidationJob.createIssues(ValidationJob.java:75)
	at org.eclipse.xtext.ui.editor.validation.ValidationJob.run(ValidationJob.java:64)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Re: Problem Using Resource URIs to Import Existing EPackages [message #636550 is a reply to message #636470] Mon, 01 November 2010 20:24 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi,

Xtext uses a IResourceServiceProvider to create ResourceDescriptions out of model files.

Xtext comes with an implementation for .ecore files and generates an implementation for each dsl.

if you use an own ecore based metamodel you have to provide an implementation too.

the easiest way to do is creating a copy & paste implementation starting with the one Xtext provides for ecore.

You find it in the plugins
- org.eclipse.xtext.ecore
- org.eclipse.xtext.ui.ecore

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 01 November 2010 20:24]

Report message to a moderator

Previous Topic:Referencing other models in other files
Next Topic:Cross reference feature & import question
Goto Forum:
  


Current Time: Sat Apr 27 02:02:48 GMT 2024

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

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

Back to the top