I am generating a new field for a PsiClass using PsiElement.addAfter() which works fine.
However, the new field's declaration is inserted on the same line than the PsiElement passed in addAfter() e.g.:
public static final String myExistingField = "myExistingField";public static final String myNewField = "myNewField";
I did browse this forum and the OpenAPI JavaDoc to find how to insert new line and tabulation before my field.
I tried psiElementFactory.createExpressionFromText("\n", myPsiClass) or psiElementFactory.createWhiteSpaceFromText("\n", myPsiClass) with no success.
Any help appreciated.