Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [xcore] Error on referring imported xcore classes
[xcore] Error on referring imported xcore classes [message #1728500] Tue, 05 April 2016 03:16 Go to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I have two xcore files in one xtext project:

Greetings.xcore:
package org.xtext.example.mydsl

import org.xtext.example.mydsl.dir.Directory

class Model {
	contains Greeting[] greetings
}

class Greeting {
	String name
	String greeting
	contains Directory dir
}


Directory.xcore

package org.xtext.example.mydsl.dir

class Directory {
	String address
}


The content assist was able to see the Directory class when I referred to it in Greetings.xcore. But, I am getting the errors:
Description Resource Path Location Type
A generic type in this context must refer to a classifier or a type parameter Greetings.xcore /org.xtext.example.mydsl/model line: 12 /org.xtext.example.mydsl/model/Greetings.xcore Xcore Problem
Description Resource Path Location Type
Couldn't resolve reference to GenBase 'Directory'. Greetings.xcore /org.xtext.example.mydsl/model line: 12 /org.xtext.example.mydsl/model/Greetings.xcore Xcore Problem


Does xcore support reference to imported classes? What am i missing?

[Updated on: Tue, 05 April 2016 06:32]

Report message to a moderator

Re: [xcore] Error on referring imported xcore classes [message #1728511 is a reply to message #1728500] Tue, 05 April 2016 06:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Chris,

It works for me (if both files are in the same folder of the same Xcore
project). Perhaps you have your files in difference projects and the
project with Greeting doesn't have a bundle dependency on the project
with Directory.


On 05.04.2016 05:16, chris yo wrote:
> I have two xcore files:
>
> Greetings.xcore:
>
> package org.xtext.example.mydsl
>
> import org.xtext.example.mydsl.dir.Directory
>
> class Model {
> contains Greeting[] greetings
> }
>
> class Greeting {
> String name
> String greeting
> contains Directory dir
> }
>
>
> Directory.xcore
>
> package org.xtext.example.mydsl.dir
>
> class Directory {
> String address
> }
>
>
> The content assist was able to see the Directory class when I referred
> to it in Greetings.xcore. But, I am getting the errors:
> Description Resource Path Location Type
> A generic type in this context must refer to a classifier or a type
> parameter Greetings.xcore /org.xtext.example.mydsl/model line:
> 12 /org.xtext.example.mydsl/model/Greetings.xcore Xcore Problem
> Description Resource Path Location Type
> Couldn't resolve reference to GenBase 'Directory'. Greetings.xcore
> /org.xtext.example.mydsl/model line: 12
> /org.xtext.example.mydsl/model/Greetings.xcore Xcore Problem
>
>
> Does xcore support reference to imported classes? What am i missing?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [xcore] Error on referring imported xcore classes [message #1728513 is a reply to message #1728511] Tue, 05 April 2016 07:00 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
Hi,
My two xcore files are in the same directory and same project.
I am not sure if this matters but my MyDsl.xtext grammar only contains this (the Directory class was not referred to in my grammar):
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

import "org.xtext.example.mydsl"

Model:
	greetings+=Greeting*;
	
Greeting:
	'Hello' name=ID '!';



The both Directory.xcore and Greetings.xcore will generate the files in emf-gen. I have also added these in my GenerateMyDsl.mwe2.
    		loadedResource = "platform:/resource/${projectName}/model/Greetings.xcore"
    		loadedResource = "platform:/resource/${projectName}/model/Directory.xcore"


[Updated on: Tue, 05 April 2016 07:01]

Report message to a moderator

Re: [xcore] Error on referring imported xcore classes [message #1728520 is a reply to message #1728513] Tue, 05 April 2016 07:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Chris,

I can't reproduce the problem. If you create a new Xcore project
(there's a wizard for that) and copy and paste these two files into the
model folder of that new project, does the problem occur there? I.e., is
this purely an Xcore problem or does reproducing it involve more of the
Xtext DSL infrastructure of the project?


On 05.04.2016 09:00, chris yo wrote:
> Hi,
> My two xcore files are in the same directory. I am not sure if this
> matters but my MyDsl.xtext grammar only contains this (the Directory
> class was not referred to in my grammar):
>
> grammar org.xtext.example.mydsl.MyDsl with
> org.eclipse.xtext.common.Terminals
>
> import "org.xtext.example.mydsl"
>
> Model:
> greetings+=Greeting*;
>
> Greeting:
> 'Hello' name=ID '!';
>
>
>
> The both Directory.xcore and Greetings.xcore will generate the files
> in emf-gen. I have also added these in my GenerateMyDsl.mwe2.
>
> loadedResource =
> "platform:/resource/${projectName}/model/Greetings.xcore"
> loadedResource =
> "platform:/resource/${projectName}/model/Directory.xcore"
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [xcore] Error on referring imported xcore classes [message #1728534 is a reply to message #1728520] Tue, 05 April 2016 09:02 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I created a new Xcore project (File -> New -> Project -> Xcore -> Xcore project). And placed both files inside the model directory and the error is still the same. So, I would say that this might be purely an xcore problem.

I am using this version of xcore:
EMF Xcore
Version: 1.3.0.v20150527-0312
Build id: S201505270312

I have attached a screenshot of my workspace.
  • Attachment: Capture.JPG
    (Size: 124.10KB, Downloaded 95 times)

[Updated on: Tue, 05 April 2016 09:05]

Report message to a moderator

Re: [xcore] Error on referring imported xcore classes [message #1728537 is a reply to message #1728534] Tue, 05 April 2016 09:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Chris,

Given I can't reproduce it using this same approach, you're probably
best to install the latest Mars.2 released version and hope that this
fixes the problem.


On 05.04.2016 11:02, chris yo wrote:
> I created a new Xcore project (File -> New -> Project -> Xcore ->
> Xcore project). And placed both files inside the model directory and
> the error is still the same. So, I would say that this might be purely
> an xcore problem.
>
> I am using this version of xcore:
> EMF Xcore
> Version: 1.3.0.v20150527-0312
> Build id: S201505270312


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF code generation impacted due to huge XCORE models
Next Topic:Coupled evolution problem
Goto Forum:
  


Current Time: Fri Apr 26 06:24:51 GMT 2024

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

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

Back to the top