Object (@NotNull DataProvider dataProvider) { VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataProvider); if (files != null) { return JBIterable.of(files); } VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataProvider); if (file != null) { return JBIterable.of(file); } IdeView view = LangDataKeys.IDE_VIEW.getData(dataProvider); PsiDirectory[] directories = view == null ? PsiDirectory.EMPTY_ARRAY : view.getDirectories(); if (directories.length > 0) { return JBIterable.of(directories).filterMap(o -> o.getVirtualFile()).collect(); } return null; }