Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Set values to an object by changing references.
Set values to an object by changing references. [message #1376185] Fri, 23 May 2014 09:47
Aleksandar Toshovski is currently offline Aleksandar ToshovskiFriend
Messages: 78
Registered: December 2011
My model contains a decorator pattern.

(Field<>-->FieldType)It is a containment, not a reference

I want to reference the Field objects with FieldReference. I Also want to override the values of the field. My idea is by creating the object and selecting the field to set the same values of the field object in FieldReference and override them.

The DSL syntax is something like this:

     (type) (name)
field STRING name{
   description "customer name"

ref name[type=Text, name=itemName]

Here is the grammer:

Field returns schema::Field:
	erpType=ERPType & name=EString
		'description' description=EString

FieldReference returns schema::FieldReference:
	]('{'('description' description=EString)}')?

ERPType returns schema::ERPType:

STRING returns schema::CustomString:

TEXT returns schema::CustomTEXT:

By creating FieldReference and setting its Field, I want to be able to set the default values of the reference.

From this post I came to the idea to extend the AST Factory and to set the values, when the "reference" is set, so that I can set the other default attributes of FieldReference.

The problem is that I don't understand where the reference FieldReference-->Field is set in the ASTFactory.. It seems it is set somewhere else, because in the methods: add(), set() and create() it remains null, but in the dsl-editor is created.

I use an existing ecore model and I'm not able to change the constraints of the attributes.

Is ASTFactory the right place to do that? And what am I doing wrong?
Previous Topic:[SOLVED] How to deploy an Xtext plugin on a clean Eclipse ?
Next Topic:Passing config from maven to xtext generator
Goto Forum:

Current Time: Sun Jan 26 08:50:59 GMT 2020

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

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

Back to the top