@Override public PsiElement getAppropriateParentFrom(PsiElement element) { if (element.getLanguage() == JAVA) { int hopes = 0; while (hopes++ < MAX_HOPES && element != null) { if (element instanceof PsiField || element instanceof PsiMethod || element instanceof ImportStatementElement || element instanceof PsiClass ) return element; element = element.getParent(); } } return null; }
@Override public PsiElement getAppropriateParentFrom(PsiElement element) { if (element.getLanguage() == JavaLanguage.INSTANCE) { int hopes = 0; while (hopes++ < MAX_HOPES && element != null) { if (element instanceof PsiField || element instanceof PsiMethod || element instanceof ImportStatementElement || element instanceof PsiClass ) return element; element = element.getParent(); } } return null; }