boolean (final PsiElement element) { boolean isExtracted = false; for(PsiElement psiElement: myElements) { if (PsiTreeUtil.isAncestor(psiElement, element, false)) { isExtracted = true; break; } } return isExtracted; }