private void parseProperties(PsiMethod method, JavaElementArrangementEntry entry) { if (!myGroupingRules.contains(StdArrangementTokens.Grouping.GETTERS_AND_SETTERS)) { return; } String propertyName = null; boolean getter = true; if (PropertyUtil.isSimplePropertyGetter(method)) { propertyName = PropertyUtil.getPropertyNameByGetter(method); } else if (PropertyUtil.isSimplePropertySetter(method)) { propertyName = PropertyUtil.getPropertyNameBySetter(method); getter = false; } if (propertyName == null) { return; } PsiClass containingClass = method.getContainingClass(); String className = null; if (containingClass != null) { className = containingClass.getQualifiedName(); } if (className == null) { className = NULL_CONTENT; } if (getter) { myInfo.registerGetter(propertyName, className, entry); } else { myInfo.registerSetter(propertyName, className, entry); } }
@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; } } }
@Override public void visitClass(PsiClass aClass) { ArrangementSettingsToken type = CLASS; if (aClass.isEnum()) { type = ENUM; } else if (aClass.isInterface()) { type = INTERFACE; } JavaElementArrangementEntry entry = createNewEntry(aClass, aClass.getTextRange(), type, aClass.getName(), true); processEntry(entry, aClass, aClass); }