Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to access Xcore model from Xtext?
How to access Xcore model from Xtext? [message #910825] Mon, 10 September 2012 13:00 Go to next message
Jan Rosczak is currently offline Jan RosczakFriend
Messages: 53
Registered: July 2009
Location: Hamburg, Germany
Member
Hi,

I have two projects in my Eclipse Juno workspace:

1. a model project with an Xcore model in the default "model" directory
2. a xtext project with my dsl

What I would like to do is to import the EPackage defined in my Xcore model into my Xtext dsl.

I cannot find a way to do this. Is this possible somehow?

Thanks & Regards
Jan
Re: How to access Xcore model from Xtext? [message #910948 is a reply to message #910825] Mon, 10 September 2012 17:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30911
Registered: July 2009
Senior Member
Jan,

Xcore resources, like GenModel resources, are indexed, so the
information should be available. Probably you'll need to dig into the
Xcore source code to see how one Xcore resource is able to import
classifiers from other Xcore or GenModel resource.


On 10/09/2012 3:00 PM, Jan Rosczak wrote:
> Hi,
>
> I have two projects in my Eclipse Juno workspace:
>
> 1. a model project with an Xcore model in the default "model" directory
> 2. a xtext project with my dsl
>
> What I would like to do is to import the EPackage defined in my Xcore
> model into my Xtext dsl.
>
> I cannot find a way to do this. Is this possible somehow?
>
> Thanks & Regards
> Jan
Re: How to access Xcore model from Xtext? [message #910987 is a reply to message #910948] Mon, 10 September 2012 19:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
Hi,

i just gave this a try and it does not work.
the reason is that org.eclipse.xtext.xtext.XtextLinkingService.getResolvedEPackage(IEObjectDescription, EObject)
gives null for the eobjectdescription of the epackage.
looks like the xcoreresourcedescriptionstrategy creates invalid iEObjectDescriptions

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access Xcore model from Xtext? [message #910996 is a reply to message #910987] Mon, 10 September 2012 19:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30911
Registered: July 2009
Senior Member
Christian,

If the resource descriptions produced for Xcore were invalid, Xcore
wouldn't be able to make any cross resource references, so there must be
more to the story than that...

When you said you wanted to import the package in your Xtext DSL, did
you mean in the grammar for your DSL, or in the instances of the DSL
you're designing? I know Moritz was looking at how to support the
former and we had some discussions about whether the models should be on
the classpath or not; when they're in the model folder, they're not on
the classpath...


On 10/09/2012 9:03 PM, Christian Dietrich wrote:
> Hi,
>
> i just gave this a try and it does not work.
> the reason is that
> org.eclipse.xtext.xtext.XtextLinkingService.getResolvedEPackage(IEObjectDescription,
> EObject)
> gives null for the eobjectdescription of the epackage.
> looks like the xcoreresourcedescriptionstrategy creates invalid
> iEObjectDescriptions
>
> ~Christian
Re: How to access Xcore model from Xtext? [message #910998 is a reply to message #910996] Mon, 10 September 2012 19:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
HI,

i just tried to import a EPackage (and then eclasses)
e.g.

package sample


grammar ...
import "sample"


i set a breankpoint in org.eclipse.xtext.xtext.XtextLinkingService.findPackageInScope(EObject, QualifiedName)
and the epackage contributed by xcore cannot be resolved


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access Xcore model from Xtext? [message #911006 is a reply to message #910998] Mon, 10 September 2012 19:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
Just gave it some more debugging
platform:/resource/t.x.c/src/txc.xcore#EPackage-=-sample (org.eclipse.xtext.resource.EObjectDescription.getEObjectURI())
doesnt match
platform:/resource/t.x.c/src/txc.xcore#EPackage (XcoreResource)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access Xcore model from Xtext? [message #911148 is a reply to message #911006] Tue, 11 September 2012 04:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30911
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Christian,<br>
<br>
I would expect "platform:/resource/t.x.c/src/txc.xcore#/EPackage"
noting the "/" in front because of this logic in XcoreResource:<br>
<blockquote>  protected String getURIFragmentRootSegment(EObject
eObject)<br>
  {<br>
    if (eObject instanceof EPackage)<br>
    {<br>
      return "EPackage";<br>
    }<br>
    else<br>
    {<br>
      return super.getURIFragmentRootSegment(eObject);<br>
    }<br>
  }<br>
</blockquote>
where the slash comes from this in ResourceImpl:<br>
<blockquote>  public String getURIFragment(EObject eObject)<br>
  {<br>
    String id = EcoreUtil.getID(eObject);<br>
    if (id != null)<br>
    {<br>
      return id;<br>
    }<br>
    else<br>
    {<br>
      InternalEObject internalEObject = (InternalEObject)eObject;<br>
      if (internalEObject.eDirectResource() == this ||
unloadingContents != null &amp;&amp;
unloadingContents.contains(internalEObject))<br>
      {<br>
        return "/" + getURIFragmentRootSegment(eObject);<br>
</blockquote>
Maybe the difference is just a typo?<br>
<br>
In the past we did produce the form you showed in the first case,
but if you look in
org.eclipse.emf.ecore.xcore.scoping.LazyCreationProxyURIConverter.getProxyURI(URI,
EObject, QualifiedName) you'll see that EPackage is no longer a type
for which this syntax is created (and it shouldn't even be possible
to get such a value out because of the exception that's thrown for
unsupported types).<br>
<br>
Might it be the case that the index contains entries produced by
older versions of the tool?  Can you tell where the former is coming
from?  The index I suppose, but is the index "clean", i.e., produces
by the Juno version of Xcore?<br>
<br>
<br>
<div class="moz-cite-prefix">On 10/09/2012 9:55 PM, Christian
Dietrich wrote:<br>
</div>
<blockquote cite="mid:k2lgka$i7a$1@xxxxxxxxe.org" type="cite">Just
gave it some more debugging
<br>
platform:/resource/t.x.c/src/txc.xcore#EPackage-=-sample
(org.eclipse.xtext.resource.EObjectDescription.getEObjectURI())
<br>
doesnt match
<br>
platform:/resource/t.x.c/src/txc.xcore#EPackage (XcoreResource)
<br>
<br>
</blockquote>
<br>
</body>
</html>
Re: How to access Xcore model from Xtext? [message #911163 is a reply to message #911148] Tue, 11 September 2012 05:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
Hi Ed,

yes the missing / in the second case is in deed a typo.
never the less the the first case i still get the strange notation.
i use xtext 2.3.1 and Xcore 1.0.0
(Eclipse doesnt show me any updates)

since i use a fresh project everything was index with that version.

if i take a loot at the LazyCreationProxyURIConverter source code i see no exception for EPackage

public String encodeFragment(EClass eClass, QualifiedName name)
  {
    return (eClass.getEPackage() == TypesPackage.eINSTANCE ? "JvmType" : eClass.getName()) + DELIM + name.toString();
  }


~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access Xcore model from Xtext? [message #911172 is a reply to message #911163] Tue, 11 September 2012 06:00 Go to previous messageGo to next message
Jan Rosczak is currently offline Jan RosczakFriend
Messages: 53
Registered: July 2009
Location: Hamburg, Germany
Member
Hi Ed, Christian,

thank you for your replies. Today I discovered a way to do what I want:


1. Convert the Xcore model to a Genmodel and Ecore model
2. Use the package namespace URI in the import statement
3. Do not be confused by the fact that the content assist in the Xtext grammer editor does not list that package URI.


Still, it would be nice if the Xtext index could use the Xcore model directly.


~Jan

[Updated on: Tue, 11 September 2012 06:07]

Report message to a moderator

Re: How to access Xcore model from Xtext? [message #911280 is a reply to message #911163] Tue, 11 September 2012 09:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30911
Registered: July 2009
Senior Member
Christian,

Yes, but it's called from two places
org.eclipse.emf.ecore.xcore.resource.XcoreResource.getURIFragment(EObject)

public String getURIFragment(EObject object)
{
EClass eClass = object.eClass();
if (eClass == TypesPackage.Literals.JVM_ENUMERATION_TYPE || eClass
== GenModelPackage.Literals.GEN_CLASS
|| eClass == GenModelPackage.Literals.GEN_DATA_TYPE || eClass ==
GenModelPackage.Literals.GEN_ENUM
|| eClass == TypesPackage.Literals.JVM_GENERIC_TYPE)
{
QualifiedName qualifiedName =
nameProvider.getFullyQualifiedName(object);
if (qualifiedName != null)
{
return proxyConverter.encodeFragment(eClass, qualifiedName);
}
}
return super.getURIFragment(object);

and
org.eclipse.emf.ecore.xcore.scoping.LazyCreationProxyURIConverter.getProxyURI(URI,
EObject, QualifiedName)

public URI getProxyURI(URI resourceURI, EObject eObject,
QualifiedName name)
{
if (!isSupported(eObject))
{
throw new IllegalArgumentException("eObjects of type " +
eObject.eClass().getName() + " are not supported.");
}
return resourceURI.appendFragment(encodeFragment(eObject.eClass(),
name));
}

So it shouldn't get there. Can you set a breakpoint to see why it gets
there? I never hit that for an EPackage...


On 11/09/2012 7:35 AM, Christian Dietrich wrote:
> Hi Ed,
>
> yes the missing / in the second case is in deed a typo.
> never the less the the first case i still get the strange notation.
> i use xtext 2.3.1 and Xcore 1.0.0
> (Eclipse doesnt show me any updates)
>
> since i use a fresh project everything was index with that version.
>
> if i take a loot at the LazyCreationProxyURIConverter source code i
> see no exception for EPackage
>
>
> public String encodeFragment(EClass eClass, QualifiedName name)
> {
> return (eClass.getEPackage() == TypesPackage.eINSTANCE ? "JvmType"
> : eClass.getName()) + DELIM + name.toString();
> }
>
>
> ~Christian
Re: How to access Xcore model from Xtext? [message #911293 is a reply to message #911280] Tue, 11 September 2012 09:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
Hi,

the proxy converter is NOT called from XcoreResource.
it calls super since Epackage is not in the if list

buts in the if list (map) of LazyCreationProxyURIConverter


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access Xcore model from Xtext? [message #911313 is a reply to message #911293] Tue, 11 September 2012 10:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30911
Registered: July 2009
Senior Member
Christian,

Comments below.

On 11/09/2012 11:56 AM, Christian Dietrich wrote:
> Hi,
>
> the proxy converter is NOT called from XcoreResource.
> it calls super since Epackage is not in the if list
I know, so how does that result in the funky encoding. Like I said, I
set a breakpoint in the method that does this encoding and it's never
called for an EPackage. If it is for you, maybe you can set a
breakpoint and show the call stack and see how it gets there.
>
> buts in the if list (map) of LazyCreationProxyURIConverter
Re: How to access Xcore model from Xtext? [message #911317 is a reply to message #911313] Tue, 11 September 2012 10:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
Hi,

i edit the xcore file with breakpoint in XcoreResource then i get the following stacktrace

Thread [Worker-4] (Suspended (breakpoint at line 218 in XcoreResource))
XcoreResource.getURIFragment(EObject) line: 218
EcoreUtil.getURI(EObject) line: 2984
XcoreReferableElementsUnloader.unloadRoot(EObject) line: 34
XcoreModelAssociator.discardDerivedState(DerivedStateAwareResource) line: 162
XcoreResource(DerivedStateAwareResource).discardDerivedState() line: 111
XcoreResource(DerivedStateAwareResource).updateInternalState(IParseResult, IParseResult) line: 59
XcoreResource(XtextResource).update(int, int, String) line: 218
XtextReconcilerUnitOfWork.process(XtextResource) line: 55
XtextReconcilerUnitOfWork.process(Object) line: 1
XtextReconcilerUnitOfWork(IUnitOfWork$Void<T>).exec(T) line: 36
XtextDocument$XtextDocumentLocker(AbstractReadWriteAcces<P>).modify(IUnitOfWork<T,P>) line: 49
XtextDocument$XtextDocumentLocker.modify(IUnitOfWork<T,XtextResource>) line: 181
XtextDocument.internalModify(IUnitOfWork<T,XtextResource>) line: 90
XtextDocumentReconcileStrategy.reconcile(IRegion) line: 44
XtextReconciler.run(IProgressMonitor) line: 254
Worker.run() line: 54

Thread [Worker-3] (Suspended (breakpoint at line 218 in XcoreResource))
owns: XcoreResource (id=12691)
owns: GrammarResource (id=12692)
owns: ClusteringBuilderState (id=11449)
XcoreResource.getURIFragment(EObject) line: 218
XcoreResource$FragmentCache.buildEntry(EObject) line: 88
XcoreResource$FragmentCache.get(String) line: 78
XcoreResource.getEObject(String) line: 156
XtextResourceSet(ResourceSetImpl).getEObject(URI, boolean) line: 223
EcoreUtil.resolve(EObject, ResourceSet) line: 197
EcoreUtil.resolve(EObject, EObject) line: 257
XGenericTypeImpl(BasicEObjectImpl).eResolveProxy(InternalEObject) line: 1473
XGenericTypeImpl.getType() line: 232
XcoreEcoreBuilder$3.run() line: 552
XcoreEcoreBuilder.link() line: 120
XcoreModelAssociator.installDerivedState(DerivedStateAwareResource, boolean) line: 81
XcoreResource(DerivedStateAwareResource).installDerivedState(boolean) line: 125
XcoreResource(DerivedStateAwareResource).getContents() line: 48
XcoreResource$FragmentCache.get(String) line: 67
XcoreResource.getEObject(String) line: 156
XtextResourceSet(ResourceSetImpl).getEObject(URI, boolean) line: 223
EcoreUtil.resolve(EObject, ResourceSet) line: 197
EcoreUtil.resolve(EObject, EObject) line: 257
XtextLinkingService.getResolvedEPackage(IEObjectDescription, EObject) line: 183
XtextLinkingService.findPackageInScope(EObject, QualifiedName) line: 177
XtextLinkingService.getPackage(ReferencedMetamodel, ILeafNode) line: 157
XtextLinkingService.getLinkedObjects(EObject, EReference, INode) line: 95
XtextLinker(Linker).getLinkedObject(EObject, EReference, INode) line: 211
XtextLinker(Linker).ensureIsLinked(EObject, INode, CrossReference, Set<EReference>, IDiagnosticProducer) line: 120
XtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer, ICompositeNode, Set<EReference>) line: 69
XtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer) line: 56
XtextLinker(Linker).ensureModelLinked(EObject, IDiagnosticProducer) line: 236
XtextLinker(Linker).doLinkModel(EObject, IDiagnosticConsumer) line: 229
XtextLinker(AbstractCleaningLinker).linkModel(EObject, IDiagnosticConsumer) line: 38
XtextLinker.linkModel(EObject, IDiagnosticConsumer) line: 220
GrammarResource(XtextResource).doLinking() line: 279
GrammarResource(LazyLinkingResource).doLinking() line: 82
GrammarResource.superDoLinking() line: 42
GrammarResource$LinkingTrigger.installDerivedState(DerivedStateAwareResource, boolean) line: 75
GrammarResource(DerivedStateAwareResource).installDerivedState(boolean) line: 125
GrammarResource(DerivedStateAwareResource).getContents() line: 48
EcoreUtil.getAllContents(Resource, boolean) line: 1121
GrammarResource(LazyLinkingResource).resolveLazyCrossReferences(CancelIndicator) line: 97
EcoreUtil2.resolveLazyCrossReferences(Resource, CancelIndicator) line: 497
ClusteringBuilderState.doUpdate(BuildData, ResourceDescriptionsData, IProgressMonitor) line: 204
ClusteringBuilderState(AbstractBuilderState).update(BuildData, IProgressMonitor) line: 105
XtextBuilder.doBuild(ToBeBuilt, IProgressMonitor, IXtextBuilderParticipant$BuildType) line: 159
XtextBuilder.fullBuild(IProgressMonitor, boolean) line: 188
XtextBuilder.build(int, Map, IProgressMonitor) line: 85
BuildManager$2.run() line: 728
SafeRunner.run(ISafeRunnable) line: 42
BuildManager.basicBuild(int, IncrementalProjectBuilder, Map<String,String>, MultiStatus, IProgressMonitor) line: 199
BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, ICommand[], MultiStatus, IProgressMonitor) line: 239
BuildManager$1.run() line: 292
SafeRunner.run(ISafeRunnable) line: 42
BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, MultiStatus, IProgressMonitor) line: 295
BuildManager.basicBuildLoop(IBuildConfiguration[], IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 351
BuildManager.build(IBuildConfiguration[], IBuildConfiguration[], int, IProgressMonitor) line: 374
AutoBuildJob.doBuild(IProgressMonitor) line: 143
AutoBuildJob.run(IProgressMonitor) line: 241
Worker.run() line: 54

the actual problem happens in EObjectDescription.getEObjectURI() - when editing the xtext file
it returns the fragment EPackage-=-sample

but this leads to a filtering in org.eclipse.xtext.xtext.XtextLinkingService.findPackageInScope(EObject, QualifiedName)
since it cannot be resolved against this fragment




Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access Xcore model from Xtext? [message #911327 is a reply to message #911317] Tue, 11 September 2012 11:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30911
Registered: July 2009
Senior Member
Christian,

Comments below.

On 11/09/2012 12:47 PM, Christian Dietrich wrote:
> Hi,
>
> i edit the xcore file with breakpoint in XcoreResource then i get the
> following stacktrace
>
> Thread [Worker-4] (Suspended (breakpoint at line 218 in XcoreResource))
> XcoreResource.getURIFragment(EObject) line: 218
Given it looks like this:

public String getURIFragment(EObject object)
{
EClass eClass = object.eClass();
if (eClass == TypesPackage.Literals.JVM_ENUMERATION_TYPE || eClass
== GenModelPackage.Literals.GEN_CLASS
|| eClass == GenModelPackage.Literals.GEN_DATA_TYPE || eClass ==
GenModelPackage.Literals.GEN_ENUM
|| eClass == TypesPackage.Literals.JVM_GENERIC_TYPE)
{
QualifiedName qualifiedName =
nameProvider.getFullyQualifiedName(object);
if (qualifiedName != null)
{
return proxyConverter.encodeFragment(eClass, qualifiedName);
}
}
return super.getURIFragment(object);
}

It must be calling super. This doesn't tell me how it gets to this
method though:

org.eclipse.emf.ecore.xcore.scoping.LazyCreationProxyURIConverter.encodeFragment(EClass,
QualifiedName)


> EcoreUtil.getURI(EObject) line: 2984
> XcoreReferableElementsUnloader.unloadRoot(EObject) line: 34
> XcoreModelAssociator.discardDerivedState(DerivedStateAwareResource) line:
> 162
> XcoreResource(DerivedStateAwareResource).discardDerivedState()
> line: 111
> XcoreResource(DerivedStateAwareResource).updateInternalState(IParseResult,
> IParseResult) line: 59
> XcoreResource(XtextResource).update(int, int, String) line: 218
> XtextReconcilerUnitOfWork.process(XtextResource) line: 55
> XtextReconcilerUnitOfWork.process(Object) line: 1
> XtextReconcilerUnitOfWork(IUnitOfWork$Void<T>).exec(T) line: 36
> XtextDocument$XtextDocumentLocker(AbstractReadWriteAcces<P>).modify(IUnitOfWork<T,P>)
> line: 49
> XtextDocument$XtextDocumentLocker.modify(IUnitOfWork<T,XtextResource>)
> line: 181
> XtextDocument.internalModify(IUnitOfWork<T,XtextResource>) line: 90
> XtextDocumentReconcileStrategy.reconcile(IRegion) line: 44
> XtextReconciler.run(IProgressMonitor) line: 254
> Worker.run() line: 54
>
> Thread [Worker-3] (Suspended (breakpoint at line 218 in XcoreResource))
> owns: XcoreResource (id=12691)
> owns: GrammarResource (id=12692)
> owns: ClusteringBuilderState (id=11449)
> XcoreResource.getURIFragment(EObject) line: 218
> XcoreResource$FragmentCache.buildEntry(EObject) line: 88
> XcoreResource$FragmentCache.get(String) line: 78
> XcoreResource.getEObject(String) line: 156
> XtextResourceSet(ResourceSetImpl).getEObject(URI, boolean) line: 223
> EcoreUtil.resolve(EObject, ResourceSet) line: 197
> EcoreUtil.resolve(EObject, EObject) line: 257
> XGenericTypeImpl(BasicEObjectImpl).eResolveProxy(InternalEObject)
> line: 1473
> XGenericTypeImpl.getType() line: 232
> XcoreEcoreBuilder$3.run() line: 552
> XcoreEcoreBuilder.link() line: 120
> XcoreModelAssociator.installDerivedState(DerivedStateAwareResource, boolean)
> line: 81
> XcoreResource(DerivedStateAwareResource).installDerivedState(boolean)
> line: 125
> XcoreResource(DerivedStateAwareResource).getContents() line: 48
> XcoreResource$FragmentCache.get(String) line: 67
> XcoreResource.getEObject(String) line: 156
> XtextResourceSet(ResourceSetImpl).getEObject(URI, boolean) line: 223
> EcoreUtil.resolve(EObject, ResourceSet) line: 197
> EcoreUtil.resolve(EObject, EObject) line: 257
> XtextLinkingService.getResolvedEPackage(IEObjectDescription,
> EObject) line: 183
> XtextLinkingService.findPackageInScope(EObject, QualifiedName)
> line: 177
> XtextLinkingService.getPackage(ReferencedMetamodel, ILeafNode)
> line: 157
> XtextLinkingService.getLinkedObjects(EObject, EReference, INode)
> line: 95
> XtextLinker(Linker).getLinkedObject(EObject, EReference, INode)
> line: 211
> XtextLinker(Linker).ensureIsLinked(EObject, INode, CrossReference,
> Set<EReference>, IDiagnosticProducer) line: 120
> XtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer,
> ICompositeNode, Set<EReference>) line: 69
> XtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer)
> line: 56
> XtextLinker(Linker).ensureModelLinked(EObject,
> IDiagnosticProducer) line: 236
> XtextLinker(Linker).doLinkModel(EObject, IDiagnosticConsumer)
> line: 229
> XtextLinker(AbstractCleaningLinker).linkModel(EObject,
> IDiagnosticConsumer) line: 38
> XtextLinker.linkModel(EObject, IDiagnosticConsumer) line: 220
> GrammarResource(XtextResource).doLinking() line: 279
> GrammarResource(LazyLinkingResource).doLinking() line: 82
> GrammarResource.superDoLinking() line: 42
> GrammarResource$LinkingTrigger.installDerivedState(DerivedStateAwareResource,
> boolean) line: 75
> GrammarResource(DerivedStateAwareResource).installDerivedState(boolean)
> line: 125
> GrammarResource(DerivedStateAwareResource).getContents() line: 48
> EcoreUtil.getAllContents(Resource, boolean) line: 1121
> GrammarResource(LazyLinkingResource).resolveLazyCrossReferences(CancelIndicator)
> line: 97
> EcoreUtil2.resolveLazyCrossReferences(Resource, CancelIndicator)
> line: 497
> ClusteringBuilderState.doUpdate(BuildData,
> ResourceDescriptionsData, IProgressMonitor) line: 204
> ClusteringBuilderState(AbstractBuilderState).update(BuildData,
> IProgressMonitor) line: 105
> XtextBuilder.doBuild(ToBeBuilt, IProgressMonitor,
> IXtextBuilderParticipant$BuildType) line: 159
> XtextBuilder.fullBuild(IProgressMonitor, boolean) line: 188
> XtextBuilder.build(int, Map, IProgressMonitor) line: 85
> BuildManager$2.run() line: 728
> SafeRunner.run(ISafeRunnable) line: 42
> BuildManager.basicBuild(int, IncrementalProjectBuilder,
> Map<String,String>, MultiStatus, IProgressMonitor) line: 199
> BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext,
> ICommand[], MultiStatus, IProgressMonitor) line: 239
> BuildManager$1.run() line: 292
> SafeRunner.run(ISafeRunnable) line: 42
> BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext,
> MultiStatus, IProgressMonitor) line: 295
> BuildManager.basicBuildLoop(IBuildConfiguration[],
> IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 351
> BuildManager.build(IBuildConfiguration[], IBuildConfiguration[],
> int, IProgressMonitor) line: 374
> AutoBuildJob.doBuild(IProgressMonitor) line: 143
> AutoBuildJob.run(IProgressMonitor) line: 241
> Worker.run() line: 54
>
> the actual problem happens in EObjectDescription.getEObjectURI() -
> when editing the xtext file
> it returns the fragment EPackage-=-sample
Why? It must have gotten to
org.eclipse.emf.ecore.xcore.scoping.LazyCreationProxyURIConverter.encodeFragment(EClass,
QualifiedName) but how? A call stack leading to that method for the
EPackage EClass is what I'm missing...
>
> but this leads to a filtering in
> org.eclipse.xtext.xtext.XtextLinkingService.findPackageInScope(EObject, QualifiedName)
>
> since it cannot be resolved against this fragment
>
>
>
Re: How to access Xcore model from Xtext? [message #911328 is a reply to message #911327] Tue, 11 September 2012 11:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
Hi Ed,

(EClass is EPackage and same is sample)

see

Thread [Worker-3] (Suspended (breakpoint at line 106 in
LazyCreationProxyURIConverter))
owns: XcoreResource (id=13155)
owns: GrammarResource (id=13156)
owns: ClusteringBuilderState (id=11449)
LazyCreationProxyURIConverter.encodeFragment(EClass, QualifiedName) line: 106
LazyCreationProxyURIConverter.getProxyURI(URI, EObject, QualifiedName)
line: 67
LazyCreationProxyURIConverter.installProxyURI(URI, EObject,
QualifiedName) line: 57
XcoreResourceDescriptionStrategy.createEObjectDescriptions(EObject,
IAcceptor<IEObjectDescription>) line: 135

XcoreResourceDescription(DefaultResourceDescription).computeExportedObjects()
line: 88
XcoreResourceDescription.getLookUp() line: 35
XcoreResourceDescription(AbstractResourceDescription).isEmpty() line: 28
SelectableBasedScope.createScope(IScope, ISelectable,
Predicate<IEObjectDescription>, EClass, boolean) line: 29
SelectableBasedScope.createScope(IScope, ISelectable, EClass, boolean)
line: 25

XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getResourceScope(IScope,
EObject, EReference) line: 113
XcoreImportedNamespaceAwareScopeProvider.getResourceScope(IScope,
EObject, EReference) line: 82

XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getResourceScope(Resource,
EReference) line: 101

XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getScope(EObject,
EReference) line: 89
XcoreImportedNamespaceAwareScopeProvider.getScope(EObject, EReference)
line: 178

XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getScope(EObject,
EReference) line: 87
XcoreImportedNamespaceAwareScopeProvider.getScope(EObject, EReference)
line: 178

XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getScope(EObject,
EReference) line: 87
XcoreImportedNamespaceAwareScopeProvider.getScope(EObject, EReference)
line: 178

XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getScope(EObject,
EReference) line: 87
XcoreImportedNamespaceAwareScopeProvider.getScope(EObject, EReference)
line: 178
XcoreScopeProvider(XtypeScopeProvider).getScope(EObject, EReference) line: 33
XcoreScopeProvider(XbaseScopeProvider).getScope(EObject, EReference)
line: 187
XcoreScopeProvider.getScope(EObject, EReference) line: 217
XbaseLinkingScopeProvider.getScope(EObject, EReference) line: 42
DefaultLinkingService.getScope(EObject, EReference) line: 59
DefaultLinkingService.getLinkedObjects(EObject, EReference, INode) line: 119
XcoreResource(LazyLinkingResource).getEObject(String) line: 179
XbaseResource.access$0(XbaseResource, String) line: 1
XbaseResource$2.exec(XbaseResource) line: 239
XbaseResource$2.exec(Object) line: 1
OnChangeEvictingCache.execWithoutCacheClear(Param,
IUnitOfWork<Result,Param>) line: 124
XcoreResource(XbaseResource).getEObject(String) line: 237
XcoreResource.getEObject(String) line: 170
XtextResourceSet(ResourceSetImpl).getEObject(URI, boolean) line: 223
EcoreUtil.resolve(EObject, ResourceSet) line: 197
EcoreUtil.resolve(EObject, EObject) line: 257
XGenericTypeImpl(BasicEObjectImpl).eResolveProxy(InternalEObject) line: 1473
XGenericTypeImpl.getType() line: 232
XcoreEcoreBuilder$3.run() line: 552
XcoreEcoreBuilder.link() line: 120
XcoreModelAssociator.installDerivedState(DerivedStateAwareResource,
boolean) line: 81
XcoreResource(DerivedStateAwareResource).installDerivedState(boolean)
line: 125
XcoreResource(DerivedStateAwareResource).getContents() line: 48
XcoreResource$FragmentCache.get(String) line: 67
XcoreResource.getEObject(String) line: 156
XtextResourceSet(ResourceSetImpl).getEObject(URI, boolean) line: 223
EcoreUtil.resolve(EObject, ResourceSet) line: 197
EcoreUtil.resolve(EObject, EObject) line: 257
XtextLinkingService.getResolvedEPackage(IEObjectDescription, EObject)
line: 183
XtextLinkingService.findPackageInScope(EObject, QualifiedName) line: 177
XtextLinkingService.getPackage(ReferencedMetamodel, ILeafNode) line: 157
XtextLinkingService.getLinkedObjects(EObject, EReference, INode) line: 95
XtextLinker(Linker).getLinkedObject(EObject, EReference, INode) line: 211
XtextLinker(Linker).ensureIsLinked(EObject, INode, CrossReference,
Set<EReference>, IDiagnosticProducer) line: 120
XtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer,
ICompositeNode, Set<EReference>) line: 69
XtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer) line: 56
XtextLinker(Linker).ensureModelLinked(EObject, IDiagnosticProducer) line: 236
XtextLinker(Linker).doLinkModel(EObject, IDiagnosticConsumer) line: 229
XtextLinker(AbstractCleaningLinker).linkModel(EObject,
IDiagnosticConsumer) line: 38
XtextLinker.linkModel(EObject, IDiagnosticConsumer) line: 220
GrammarResource(XtextResource).doLinking() line: 279
GrammarResource(LazyLinkingResource).doLinking() line: 82
GrammarResource.superDoLinking() line: 42

GrammarResource$LinkingTrigger.installDerivedState(DerivedStateAwareResource,
boolean) line: 75

GrammarResource(DerivedStateAwareResource).installDerivedState(boolean)
line: 125
GrammarResource(DerivedStateAwareResource).getContents() line: 48
EcoreUtil.getAllContents(Resource, boolean) line: 1121

GrammarResource(LazyLinkingResource).resolveLazyCrossReferences(CancelIndicator)
line: 97
EcoreUtil2.resolveLazyCrossReferences(Resource, CancelIndicator) line: 497
ClusteringBuilderState.doUpdate(BuildData, ResourceDescriptionsData,
IProgressMonitor) line: 204
ClusteringBuilderState(AbstractBuilderState).update(BuildData,
IProgressMonitor) line: 105
XtextBuilder.doBuild(ToBeBuilt, IProgressMonitor,
IXtextBuilderParticipant$BuildType) line: 159
XtextBuilder.incrementalBuild(IResourceDelta, IProgressMonitor) line: 141
XtextBuilder.build(int, Map, IProgressMonitor) line: 91
BuildManager$2.run() line: 728
SafeRunner.run(ISafeRunnable) line: 42
BuildManager.basicBuild(int, IncrementalProjectBuilder,
Map<String,String>, MultiStatus, IProgressMonitor) line: 199
BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext,
ICommand[], MultiStatus, IProgressMonitor) line: 239
BuildManager$1.run() line: 292
SafeRunner.run(ISafeRunnable) line: 42
BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext,
MultiStatus, IProgressMonitor) line: 295
BuildManager.basicBuildLoop(IBuildConfiguration[],
IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 351
BuildManager.build(IBuildConfiguration[], IBuildConfiguration[], int,
IProgressMonitor) line: 374
AutoBuildJob.doBuild(IProgressMonitor) line: 143
AutoBuildJob.run(IProgressMonitor) line: 241
Worker.run() line: 54


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access Xcore model from Xtext? [message #911329 is a reply to message #911328] Tue, 11 September 2012 11:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30911
Registered: July 2009
Senior Member
Christian,

Comments below.

On 11/09/2012 1:40 PM, Christian Dietrich wrote:
> Hi Ed,
>
> (EClass is EPackage and same is sample)
>
> see
>
> Thread [Worker-3] (Suspended (breakpoint at line 106 in
> LazyCreationProxyURIConverter))
> owns: XcoreResource (id=13155)
> owns: GrammarResource (id=13156)
> owns: ClusteringBuilderState (id=11449)
> LazyCreationProxyURIConverter.encodeFragment(EClass,
> QualifiedName) line: 106
> LazyCreationProxyURIConverter.getProxyURI(URI, EObject,
> QualifiedName) line: 67
> LazyCreationProxyURIConverter.installProxyURI(URI, EObject,
> QualifiedName) line: 57
> XcoreResourceDescriptionStrategy.createEObjectDescriptions(EObject, IAcceptor<IEObjectDescription>)
> line: 135
This method looks like this in the latest version, so the problem is
fixed in the maintenance stream. I.e., I'm reusing the same indexing
strategy as is used for Ecore resources. Sorry, I should have
considered that I've been fixing a lot of problems since the release!

public boolean createEObjectDescriptions(EObject eObject,
IAcceptor<IEObjectDescription> acceptor)
{
if (eObject.eClass().getEPackage() == EcorePackage.eINSTANCE)
{
return
ecoreResourceDescriptionStrategy.createEObjectDescriptions(eObject,
acceptor);
}
else
{
return super.createEObjectDescriptions(eObject, acceptor);
}
}


>
> XcoreResourceDescription(DefaultResourceDescription).computeExportedObjects()
> line: 88
> XcoreResourceDescription.getLookUp() line: 35
> XcoreResourceDescription(AbstractResourceDescription).isEmpty()
> line: 28
> SelectableBasedScope.createScope(IScope, ISelectable,
> Predicate<IEObjectDescription>, EClass, boolean) line: 29
> SelectableBasedScope.createScope(IScope, ISelectable, EClass,
> boolean) line: 25
>
> XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getResourceScope(IScope,
> EObject, EReference) line: 113
> XcoreImportedNamespaceAwareScopeProvider.getResourceScope(IScope,
> EObject, EReference) line: 82
>
> XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getResourceScope(Resource,
> EReference) line: 101
>
> XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getScope(EObject,
> EReference) line: 89
> XcoreImportedNamespaceAwareScopeProvider.getScope(EObject,
> EReference) line: 178
>
> XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getScope(EObject,
> EReference) line: 87
> XcoreImportedNamespaceAwareScopeProvider.getScope(EObject,
> EReference) line: 178
>
> XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getScope(EObject,
> EReference) line: 87
> XcoreImportedNamespaceAwareScopeProvider.getScope(EObject,
> EReference) line: 178
>
> XcoreImportedNamespaceAwareScopeProvider(ImportedNamespaceAwareLocalScopeProvider).getScope(EObject,
> EReference) line: 87
> XcoreImportedNamespaceAwareScopeProvider.getScope(EObject,
> EReference) line: 178
> XcoreScopeProvider(XtypeScopeProvider).getScope(EObject,
> EReference) line: 33
> XcoreScopeProvider(XbaseScopeProvider).getScope(EObject,
> EReference) line: 187
> XcoreScopeProvider.getScope(EObject, EReference) line: 217
> XbaseLinkingScopeProvider.getScope(EObject, EReference) line: 42
> DefaultLinkingService.getScope(EObject, EReference) line: 59
> DefaultLinkingService.getLinkedObjects(EObject, EReference, INode)
> line: 119
> XcoreResource(LazyLinkingResource).getEObject(String) line: 179
> XbaseResource.access$0(XbaseResource, String) line: 1
> XbaseResource$2.exec(XbaseResource) line: 239
> XbaseResource$2.exec(Object) line: 1
> OnChangeEvictingCache.execWithoutCacheClear(Param,
> IUnitOfWork<Result,Param>) line: 124
> XcoreResource(XbaseResource).getEObject(String) line: 237
> XcoreResource.getEObject(String) line: 170
> XtextResourceSet(ResourceSetImpl).getEObject(URI, boolean) line: 223
> EcoreUtil.resolve(EObject, ResourceSet) line: 197
> EcoreUtil.resolve(EObject, EObject) line: 257
> XGenericTypeImpl(BasicEObjectImpl).eResolveProxy(InternalEObject)
> line: 1473
> XGenericTypeImpl.getType() line: 232
> XcoreEcoreBuilder$3.run() line: 552
> XcoreEcoreBuilder.link() line: 120
> XcoreModelAssociator.installDerivedState(DerivedStateAwareResource, boolean)
> line: 81
> XcoreResource(DerivedStateAwareResource).installDerivedState(boolean)
> line: 125
> XcoreResource(DerivedStateAwareResource).getContents() line: 48
> XcoreResource$FragmentCache.get(String) line: 67
> XcoreResource.getEObject(String) line: 156
> XtextResourceSet(ResourceSetImpl).getEObject(URI, boolean) line: 223
> EcoreUtil.resolve(EObject, ResourceSet) line: 197
> EcoreUtil.resolve(EObject, EObject) line: 257
> XtextLinkingService.getResolvedEPackage(IEObjectDescription,
> EObject) line: 183
> XtextLinkingService.findPackageInScope(EObject, QualifiedName)
> line: 177
> XtextLinkingService.getPackage(ReferencedMetamodel, ILeafNode)
> line: 157
> XtextLinkingService.getLinkedObjects(EObject, EReference, INode)
> line: 95
> XtextLinker(Linker).getLinkedObject(EObject, EReference, INode)
> line: 211
> XtextLinker(Linker).ensureIsLinked(EObject, INode, CrossReference,
> Set<EReference>, IDiagnosticProducer) line: 120
> XtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer,
> ICompositeNode, Set<EReference>) line: 69
> XtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer)
> line: 56
> XtextLinker(Linker).ensureModelLinked(EObject,
> IDiagnosticProducer) line: 236
> XtextLinker(Linker).doLinkModel(EObject, IDiagnosticConsumer)
> line: 229
> XtextLinker(AbstractCleaningLinker).linkModel(EObject,
> IDiagnosticConsumer) line: 38
> XtextLinker.linkModel(EObject, IDiagnosticConsumer) line: 220
> GrammarResource(XtextResource).doLinking() line: 279
> GrammarResource(LazyLinkingResource).doLinking() line: 82
> GrammarResource.superDoLinking() line: 42
>
> GrammarResource$LinkingTrigger.installDerivedState(DerivedStateAwareResource,
> boolean) line: 75
>
> GrammarResource(DerivedStateAwareResource).installDerivedState(boolean) line:
> 125
> GrammarResource(DerivedStateAwareResource).getContents() line: 48
> EcoreUtil.getAllContents(Resource, boolean) line: 1121
>
> GrammarResource(LazyLinkingResource).resolveLazyCrossReferences(CancelIndicator)
> line: 97
> EcoreUtil2.resolveLazyCrossReferences(Resource, CancelIndicator)
> line: 497
> ClusteringBuilderState.doUpdate(BuildData,
> ResourceDescriptionsData, IProgressMonitor) line: 204
> ClusteringBuilderState(AbstractBuilderState).update(BuildData,
> IProgressMonitor) line: 105
> XtextBuilder.doBuild(ToBeBuilt, IProgressMonitor,
> IXtextBuilderParticipant$BuildType) line: 159
> XtextBuilder.incrementalBuild(IResourceDelta, IProgressMonitor)
> line: 141
> XtextBuilder.build(int, Map, IProgressMonitor) line: 91
> BuildManager$2.run() line: 728
> SafeRunner.run(ISafeRunnable) line: 42
> BuildManager.basicBuild(int, IncrementalProjectBuilder,
> Map<String,String>, MultiStatus, IProgressMonitor) line: 199
> BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext,
> ICommand[], MultiStatus, IProgressMonitor) line: 239
> BuildManager$1.run() line: 292
> SafeRunner.run(ISafeRunnable) line: 42
> BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext,
> MultiStatus, IProgressMonitor) line: 295
> BuildManager.basicBuildLoop(IBuildConfiguration[],
> IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 351
> BuildManager.build(IBuildConfiguration[], IBuildConfiguration[],
> int, IProgressMonitor) line: 374
> AutoBuildJob.doBuild(IProgressMonitor) line: 143
> AutoBuildJob.run(IProgressMonitor) line: 241
> Worker.run() line: 54
>
Re: How to access Xcore model from Xtext? [message #911333 is a reply to message #911329] Tue, 11 September 2012 12:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
hi ed,

which is the update site for the milestones / the maintainance release?

Thx
Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to access Xcore model from Xtext? [message #911391 is a reply to message #911333] Tue, 11 September 2012 13:58 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30911
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
You can get them from:<br>
<blockquote> <a class="moz-txt-link-freetext" href="http://download.eclipse.org/modeling/emf/emf/updates/2.8.x">http://download.eclipse.org/modeling/emf/emf/updates/2.8.x</a><br>
</blockquote>
There are still a few more fixes pending the next build...<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/09/2012 2:12 PM, Christian
Dietrich wrote:<br>
</div>
<blockquote cite="mid:k2n9ro$t7p$1@xxxxxxxxe.org" type="cite">hi
ed,
<br>
<br>
which is the update site for the milestones / the maintainance
release?
<br>
<br>
Thx
<br>
Christian
<br>
</blockquote>
<br>
</body>
</html>
Previous Topic:How to get Output Folder? - Compiler Preferences
Next Topic:Use of ITypeProvider in the JvmModelInferrer
Goto Forum:
  


Current Time: Wed Feb 26 20:58:34 GMT 2020

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

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

Back to the top