Preference (@NotNull final PsiElement position) { if (INSIDE_REFERENCE_LIST.accepts(position)) { PsiReferenceList list = (PsiReferenceList)position.getParent().getParent(); PsiReferenceList.Role role = list.getRole(); if (shouldContainInterfaces(list, role)) { return Preference.Interfaces; } if (role == PsiReferenceList.Role.EXTENDS_LIST) { return Preference.Classes; } if (role == PsiReferenceList.Role.THROWS_LIST) { return Preference.Exceptions; } } return null; }