I am pretty new to Ecore, and I would like to ask if it's possible to fill the method bodies with the generated code. I know one can use OCL to make preconditions and postconditions for the methods, but is it's possible to autogenerate method body code as well? I believe adding body code to the autogenerated method manually is very bad idea if I regenerate my model again.

Also I couldn't figure out what is a syntax for preconditions and postconditions in OCLInEcore. Usual OCL syntax:
context <classifier>::<operation> (<parameters>)
pre [<constraint name>]:
<Boolean OCL expression>
did not work for me.

Both approaches rely on automatically generating a "body" annotation on the EOperation, so you can also do that directly in Ecore itself with an EAnnotation with source http://www.eclipse.org/emf/2002/GenModel and a detail key "body" where the value of that detail is the Java code to be generated.

The Ecore editor for Photon makes it easy to create such annotations because the specialized properties view for defining GenModel annotations as well as specialized creation support for creating the GenModel annotation.

In OCLinEcore you can cause the "precondition" or "postcondition" keywords in the same way as the "invariant" keyword.

However pre/post-conditions are only syntax checked. When OCL was interpreted it was doubtful that anyone wanted the interpreted performance hit of pre/post-condition evaluation. Now that Java code generation is available, generating pre/post-condition code is on my to-do list, but quite a long way down. A further disincentive is that I do not know how to implement @pre since for the pathological general case it requires a total system copy on entry to an operation with an @pre postcondition!

If I had even as many as one user request for this per year I might be more inclined to try to tackle it.

The Ecore editor for Photon makes it easy to create such annotations because the specialized properties view for defining GenModel annotations as well as specialized creation support for creating the GenModel annotation.

Sorry, and maybe this question is stupid, but I recently switched to Photon, and have now some difficulties with the EMF editor. While adding the GenModel Annotation is now very easy, editing the "body" part is difficult, because it allows only one line of code. Previously, I could open a multi-line editor, but this is not longer possible. Am I missing a certain plugin, or is there a new way of doing it?