PsiElement (PsiElement[] copyElements) { if (copyElements.length > 1) { return PsiTreeUtil.findCommonParent(copyElements); } else { PsiElement parent = copyElements[0].getUserData(ElementToWorkOn.PARENT); if (parent == null) { parent = copyElements[0].getParent(); } return PsiTreeUtil.getParentOfType(parent, PsiCodeBlock.class, false); } }