Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » how to use types defined in other Ecore files in my DSL
icon5.gif  how to use types defined in other Ecore files in my DSL [message #997592] Tue, 08 January 2013 14:04 Go to next message
Barbara Xiong is currently offline Barbara Xiong
Messages: 4
Registered: December 2012
Junior Member
Hi,

I want to use data types defined in a Ecore named ModelTypes in my DSL.

And I suppose it is the same theory as using Java types in one's own DSL. So I follow the steps in the document of Xtext about how to use Java type

here is my DSL:
import "platform:/resource/ModelTypes.ecore" as ModelTypes

Program:
       'var' modeltype=MTypes 
;

Mtypes:
       a=[ModelTypes::TypeA]|b=[ModelTypes::TypeB]
;


then I add the referencedGenModels and TypesGeneratorFragment in the workflow

However, in the editor, when i write:
var TypeA


there exists an error, which suggested that Couldn't resolve reference to ModelTypes 'TypeA'

What can i do to use data types defined in a Ecore in my DSL?
TIA!
Re: how to use types defined in other Ecore files in my DSL [message #997674 is a reply to message #997592] Tue, 08 January 2013 14:30 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2500
Registered: July 2009
Senior Member
Does your external types have an identifier feature called 'name' - this
is required for references to work out of the box.

- henrik

On 2013-08-01 15:04, Barbara Xiong wrote:
> Hi,
>
> I want to use data types defined in a Ecore named ModelTypes in my DSL.
> And I suppose it is the same theory as using Java types in one's own
> DSL. So I follow the steps in the document of Xtext about how to use
> Java type
> here is my DSL:
>
> import "platform:/resource/ModelTypes.ecore" as ModelTypes
>
> Program:
> 'var' modeltype=MTypes ;
>
> Mtypes:
> a=[ModelTypes::TypeA]|b=[ModelTypes::TypeB]
> ;
>
>
> then I add the referencedGenModels and TypesGeneratorFragment in the
> workflow
>
> However, in the editor, when i write:
> var TypeA
>
> there exists an error, which suggested that Couldn't resolve reference
> to ModelTypes 'TypeA'
>
> What can i do to use data types defined in a Ecore in my DSL?
> TIA!
Previous Topic:file updates and rebuilds.
Next Topic:Using toIterable.FindFirst in Generator
Goto Forum:
  


Current Time: Thu Oct 23 10:28:58 GMT 2014

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

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