Object (String dataId, JBIterable<Object> selection) { if (CommonDataKeys.PSI_ELEMENT.is(dataId)) { PsiElement element = getSelectedValues(selection).filter(PsiElement.class).single(); return element != null && element.isValid() ? element : null; } if (PlatformCoreDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) { return PsiUtilCore.toPsiElementArray(getSelectedValues(selection).filter(PsiElement.class).toList()); } if (CommonDataKeys.NAVIGATABLE.is(dataId)) { List<Object> list = selection.map(StructureViewComponent::unwrapNavigatable).toList(); Object[] selectedElements = list.isEmpty() ? null : ArrayUtil.toObjectArray(list); if (selectedElements == null || selectedElements.length == 0) return null; if (selectedElements[0] instanceof Navigatable) { return selectedElements[0]; } } if (CommonDataKeys.SYMBOLS.is(dataId)) { return getSelectedValues(selection) .filter(DelegatingPsiElementWithSymbolPointer.class) .filterMap(it -> it.getSymbolPointer().dereference()) .toList(); } return null; }