Object (@NotNull @NonNls String dataId, final TreePath @Nullable [] paths, @Nullable TreePath leadPath, @Nullable AntBuildFile currentBuildFile) { if (CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) { final List<VirtualFile> virtualFiles = collectAntFiles(buildFile -> { final VirtualFile virtualFile = buildFile.getVirtualFile(); if (virtualFile != null && virtualFile.isValid()) { return virtualFile; } return null; }, paths); return virtualFiles == null? null : virtualFiles.toArray(VirtualFile.EMPTY_ARRAY); } else if (PlatformCoreDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) { final List<PsiElement> elements = collectAntFiles(AntBuildFile::getAntFile, paths); return elements == null? null : elements.toArray(PsiElement.EMPTY_ARRAY); } else if (CommonDataKeys.NAVIGATABLE.is(dataId)) { if (leadPath != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)leadPath.getLastPathComponent(); if (node != null) { if (node.getUserObject() instanceof AntTargetNodeDescriptor targetNodeDescriptor) { final Navigatable navigatable = targetNodeDescriptor.getTarget().getOpenFileDescriptor(); if (navigatable != null && navigatable.canNavigate()) { return navigatable; } } } } if (currentBuildFile != null && !myProject.isDisposed()) { final VirtualFile file = currentBuildFile.getVirtualFile(); if (file != null && file.isValid()) { return new OpenFileDescriptor(myProject, file); } } } return null; }