//final PsiElement parent = anchor.getParent();
//return parent.addBefore(declaration, anchor);
HaxeClass haxeClass = PsiTreeUtil.getParentOfType(expression, HaxeClass.class, false);
if (haxeClass != null) {
//haxeClass.getVarDeclarations().get(0)
HaxeClassBody classBody = PsiTreeUtil.getChildOfType(haxeClass, HaxeClassBody.class);
if (classBody != null) {
PsiElement child = classBody.getFirstChild();
if (child != null) {
return classBody.addBefore(declaration, child);
}
else {
classBody.add(declaration);
}
}
}
return null;