MavenProject (DataContext context) { MavenProject result; final MavenProjectsManager manager = getProjectsManager(context); if (manager == null) return null; final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(context); if (file != null) { result = manager.findProject(file); if (result != null) return result; } Module module = ExternalSystemActionUtil.getModule(context); if (module != null) { result = manager.findProject(module); if (result != null) return result; } return null; }