@Override public void visitClassInitializer(PsiClassInitializer initializer) { JavaElementArrangementEntry entry = createNewEntry(initializer, initializer.getTextRange(), FIELD, null, true); if (entry == null) { return; } PsiElement classLBrace = null; PsiClass clazz = initializer.getContainingClass(); if (clazz != null) { classLBrace = clazz.getLBrace(); } for (PsiElement e = initializer.getPrevSibling(); e != null; e = e.getPrevSibling()) { JavaElementArrangementEntry prevEntry; if (e == classLBrace) { prevEntry = myEntries.get(clazz); } else { prevEntry = myEntries.get(e); } if (prevEntry != null) { entry.addDependency(prevEntry); } if (!(e instanceof PsiWhiteSpace)) { break; } } }
@SuppressWarnings("MagicConstant") private static void parseModifiers( @Nullable PsiModifierList modifierList, @NotNull JavaElementArrangementEntry entry) { if (modifierList == null) { return; } for (String modifier : PsiModifier.MODIFIERS) { if (modifierList.hasModifierProperty(modifier)) { ArrangementSettingsToken arrangementModifier = MODIFIERS.get(modifier); if (arrangementModifier != null) { entry.addModifier(arrangementModifier); } } } if (modifierList.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) { entry.addModifier(PACKAGE_PRIVATE); } }