Collection<Project> (@NotNull VirtualFile file) { ProjectManager projectManager = ProjectManager.getInstanceIfCreated(); if (projectManager == null) { return Collections.emptyList(); } List<Project> result = new SmartList<>(); ReadAction.run(()-> { for (Project project : projectManager.getOpenProjects()) { if (isUnder(project, file)) { result.add(project); } } }); return result; }