Object (@NotNull DataProvider dataProvider) { Set<VirtualFile> result = null; FileSystemTree fileSystemTree = FileSystemTree.DATA_KEY.getData(dataProvider); if (fileSystemTree != null) { LOG.error("VirtualFileArrayRule must not be called when FileSystemTree.DATA_KEY data is present." + "FileSystemTree.DATA_KEY data provider must also provide FileSystemTree#getSelectedFiles() as VIRTUAL_FILE_ARRAY"); return null; } else { Project project = PlatformCoreDataKeys.PROJECT_CONTEXT.getData(dataProvider); if (project != null && !project.isDisposed()) { result = addFiles(null, ProjectRootManager.getInstance(project).getContentRoots()); } Module[] selectedModules = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataProvider); if (selectedModules != null) { for (Module selectedModule : selectedModules) { result = addFiles(result, ModuleRootManager.getInstance(selectedModule).getContentRoots()); } } Module selectedModule = LangDataKeys.MODULE_CONTEXT.getData(dataProvider); if (selectedModule != null && !selectedModule.isDisposed()) { result = addFiles(result, ModuleRootManager.getInstance(selectedModule).getContentRoots()); } } PsiElement[] psiElements = PlatformCoreDataKeys.PSI_ELEMENT_ARRAY.getData(dataProvider); if (psiElements != null) { for (PsiElement element : psiElements) { result = addFilesFromPsiElement(result, element); } } result = addFile(result, CommonDataKeys.VIRTUAL_FILE.getData(dataProvider)); PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataProvider); if (psiFile != null) { result = addFile(result, psiFile.getVirtualFile()); } if (result != null) { return VfsUtilCore.toVirtualFileArray(result); } PsiElement elem = CommonDataKeys.PSI_ELEMENT.getData(dataProvider); if (elem != null) { result = addFilesFromPsiElement(null, elem); } Usage[] usages = UsageView.USAGES_KEY.getData(dataProvider); UsageTarget[] usageTargets = UsageView.USAGE_TARGETS_KEY.getData(dataProvider); if (usages != null || usageTargets != null) { for (VirtualFile file : Objects.requireNonNull(UsageDataUtil.provideVirtualFileArray(usages, usageTargets))) { result = addFile(result, file); } } if (result == null) { Object[] objects = (Object[])dataProvider.getData(PlatformCoreDataKeys.SELECTED_ITEMS.getName()); if (objects != null && objects.length != 0) { Object[] unwrapped = ContainerUtil.map2Array(objects, o -> AbstractProjectViewPane.extractValueFromNode(o)); if (ContainerUtil.all(unwrapped, o -> o instanceof VirtualFile)) { return Arrays.copyOf(unwrapped, unwrapped.length, VirtualFile[].class); } } return null; } else { return VfsUtilCore.toVirtualFileArray(result); } }