PsiElement (final PsiClass aClass) { PsiField[] fields = aClass.getFields(); for (int i = fields.length-1;i>=0; i--) { PsiField field = fields[i]; if (field instanceof PsiEnumConstant) { PsiElement anchor = firstNonWhiteElement(field.getNextSibling(), true); if (!(PsiUtil.isJavaToken(anchor, JavaTokenType.SEMICOLON))) { anchor = field; myEnumToInsertSemicolonAfter = (PsiEnumConstant)field; } return anchor; } } // no enum constants at all ? return aClass.getLBrace(); }