itemisCREATE / statecharts

YAKINDU Statechart Tools (http://www.statecharts.org)
Eclipse Public License 1.0
176 stars 86 forks source link

apply code formatter on generated code #662

Open yuecelm opened 8 years ago

yuecelm commented 8 years ago

I wrote some code in order to apply the code formatter from my default project "SW core dev" on the generated code. Ideally it should take instead of the hardcoded project the targetProject value from sgen file. Maybe it would be an interesting feature for other users too...

yuecelm commented 8 years ago

Here are the patches for the cpp generator: StatemachineHeader.patch.txt StatemachineImplementation.patch.txt

yuecelm commented 8 years ago

dont forget to add org.eclipse.cdt.core in Require-Bundle in MANIFEST.MF

andreasmuelder commented 8 years ago

@yuecelm Thanks you very much for your contribution, applying the CDT formatter to the generated code is a nice idea!

The problem is, that we don't have a dependency to Eclipse CDT right now in the code generators. Currently, it is possible to generate code without CDT installed, what is really useful if you run in a headless environment for example.

A solution could be to introduce an optional dependency and the formatter is only applied when available. We will schedule this issue for the next release.