I am working on a plug-in, that should add code to existing code.
How can it be achieved that a method call is added to a Psielement, for example:
Adding the text ".myMethodCall()" to the PsiElement "MyClass", so it becomes : "Myclass.myMethodCall()" ?
I tried adding it as a PsiExpression with addAfter, but that puts it in a new line and deletes the dot-operator.
Ideally, i would like to do this for Groovy-Code, so i will use the Groovy equivalent like for instance GrExpression.