[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2t] [Acceleo] Code Beautifying

Hey,

just started yesterday my first steps with Acceleo. I've some general questions concerning the beautification of the generated code.

1. Is there a common rule for indentation? When i write my templates with normal indentation, like this

[file (testContext.name.concat('.ttcn3'), false)]
	module [testContext.name/]{
	[for (dPool : DataPool | testContext.allDataPool)]
		[for (dp:DataPartition|dPool.ownedPartition)]
			[genTypes(dp)/]
		[/for]
	[/for]
	}
[/file]

the outcoming is very ugly aligned, since the whole [genTypes/] part is too much indented.

2. How to use the seperator(',') construct correctly in a for-loop. Currentlty, the , will be inserted in the next line, not after the generated line

		boolean confirmationExpected
,		integer data optional

The loop looks like

	[for (p:Property | c.oclAsType(Classifier).attribute) separator(',')]
	[if (p.type.oclIsTypeOf(PrimitiveType))][iterateBasicType(p)/]
	[else]
	Complex
	[/if]
	[/for]

3. Is it possible to pass a Set as a template parameter?

4. I've tried to pass a parameter like c.oclAsKindOf(Class), where c is a Classifier, but Acceleo told me, that such an template doesn't exist. Well, the template is there.

[template public class2type(c:Class)]

Is it possible to downcast an object during the invocation of a template?

Thanks a lot

/Timothy