PsiFile (@NonNls String dataId, @NotNull Object selection) { if (CommonDataKeys.NAVIGATABLE.is(dataId)) { String fqn; if (selection instanceof ViewerNodeDescriptor descriptor) { Object elementObject = descriptor.getElement(); PsiElement element = elementObject instanceof PsiElement ? (PsiElement)elementObject : elementObject instanceof ASTNode ? ((ASTNode)elementObject).getPsi() : null; fqn = element != null ? element.getClass().getName() : null; } else if (selection instanceof String str) { fqn = str; } else { fqn = null; } return fqn == null ? null : getContainingFileForClass(fqn); } return null; }