Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Declaration Generation(Tweak some Code)
icon7.gif  Declaration Generation [message #1681882] Tue, 17 March 2015 13:57
Frank W. is currently offline Frank W.Friend
Messages: 10
Registered: March 2015
Junior Member
Hi,

I want to generate simple declarations with Acceleo in one of these two ways:

1.
[for (property :Property | c.eContents(Property))]
[PropertyDeclarations(property)/]
[/for]

[template public PropertyDeclarations(property:Property)]
[property.type.getStereotypeValue('Ecore::EDataType', 'instanceClassName')/] [property.name/] = [property.defaultValue/];
[/template]


2.
[c.attribute.type.getStereotypeValue('Ecore::EDataType', 'instanceClassName')/][c.attribute.name/];


Output
1. Yields this as the output
double in = ;
double out = ;
double v0_ = org.eclipse.uml2.uml.internal.impl.LiteralRealImpl@7b87d668 (name: <unset>, visibility: <unset>) (value: 0.0);
double v1_ = org.eclipse.uml2.uml.internal.impl.LiteralRealImpl@d18c0be (name: <unset>, visibility: <unset>) (value: 1.0);


So here I only want to consider the properties which are not ports: meaning 'in' and 'out'
And I want to access the values 0.0 and 1.0 respectively, but it does not work with [property.defaultValue/].....

2. If I try it another way with the code in 2. I get the following:
doubledoubledoubledouble   inoutv0_v1_;


So basically I am wanting to know how I can change the code to get just the Parameters without the ports (I used the Parameter Property under Contraints and Comments) and in the right order, like this:

double v0_;
double v1_;


Thank you,
Frank
Previous Topic:[ACCELEO] Generate Declarations
Next Topic:Acceleo Debugger doesn't work
Goto Forum:
  


Current Time: Tue Apr 24 10:29:26 GMT 2018

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

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