Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » acceleo : stereotype value and generated files layout(how to get stereotype value and to remove white line in generated file)
acceleo : stereotype value and generated files layout [message #1436409] Thu, 02 October 2014 21:48 Go to next message
bernard granier is currently offline bernard granierFriend
Messages: 8
Registered: February 2014
Junior Member
Hi,

I start to use acceleo and I have to two questions :
To get a stereotype value which is an EnumerationLiteral, I have to create a Java service and in this service to call something like :
(EnumerationLiteral)umlObject.getValue(stereotype, propName)

is this the normal way ?

How to use in template file a such call :
[umlObject.getValue(aStereotype,'propName') /]
how to cast the returned object in an EnumerationLiteral ?

The second question is a classic one : how to manage white line in generated files ? Is there a "good" article on this subject ? What I saw on web pages seems to say that was not possible to manage white lines in generated files, is that true ?

Thanks in advance for any help
Re: acceleo : stereotype value and generated files layout [message #1436849 is a reply to message #1436409] Fri, 03 October 2014 13:51 Go to previous messageGo to next message
Johan Hardy is currently offline Johan HardyFriend
Messages: 47
Registered: December 2012
Member

A bit complex but it works for me:

[query public hasStereotype(elt : uml::Element, qualifiedName : String) : Boolean =
not(elt.getAppliedStereotype(qualifiedName).oclIsUndefined())/]

[query public getEnumLit(e : uml::EnumerationLiteral) : String = 
if e.hasStereotype('your_profile_name::TheStereotype_name') then e.getValue(e.getAppliedStereotype('your_profile_name::TheStereotype_name'), 'Property_name').oclAsType(uml::EnumerationLiteral).name
else ''
endif
/]


Regards;
Johan
Re: acceleo : stereotype value and generated files layout [message #1436943 is a reply to message #1436849] Fri, 03 October 2014 16:48 Go to previous message
bernard granier is currently offline bernard granierFriend
Messages: 8
Registered: February 2014
Junior Member
thanks I will try
Previous Topic:[Acceleo] Use Enterprise Architect models with Acceleo
Next Topic:Re: NullPointerException when editing an ecore model
Goto Forum:
  


Current Time: Sat Feb 24 07:31:07 GMT 2024

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

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

Back to the top