int (@NotNull PsiElement element) { if (!(element instanceof PsiMember)) { return 0; } int indentSize = mySettings.getIndentSize(JavaFileType.INSTANCE); boolean doNotIndentTopLevelClassMembers = mySettings.getCommonSettings(JavaLanguage.INSTANCE).DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS; int indent = 0; PsiClass top = PsiUtil.getTopLevelClass(element); while (top != null && !element.isEquivalentTo(top)) { if (doNotIndentTopLevelClassMembers && element.getParent().isEquivalentTo(top)) { break; } element = element.getParent(); indent += indentSize; } return indent; }