Object (@NotNull DataProvider dataProvider) { Object[] objects = PlatformCoreDataKeys.SELECTED_ITEMS.getData(dataProvider); if (objects == null) return null; Project project = CommonDataKeys.PROJECT.getData(dataProvider); PsiElement[] elements = new PsiElement[objects.length]; for (int i = 0, len = objects.length; i < len; i++) { Object o = AbstractProjectViewPane.extractValueFromNode(objects[i]); PsiElement element = o instanceof PsiElement ? (PsiElement)o : o instanceof PsiAwareObject && project != null ? ((PsiAwareObject)o).findElement(project) : o instanceof PsiElementNavigationItem ? ((PsiElementNavigationItem)o).getTargetElement() : o instanceof Pointer<?> ? PsiElementFromSelectionRule.getElement((Pointer<?>)o) : null; if (element == null || !element.isValid()) return null; elements[i] = element; } return elements; }