DataContext (CompileContext context) { Project project = context.getProject(); CompileScope scope = context.getCompileScope(); Module[] modules = ReadAction.compute(() -> scope.getAffectedModules()); return SimpleDataContext.builder() .add(CommonDataKeys.PROJECT, project) .add(PlatformCoreDataKeys.MODULE, modules.length == 1? modules[0] : null) .add(LangDataKeys.MODULE_CONTEXT_ARRAY, modules) .add(COMPILER_CONTEXT_MAKE_KEY, context.isMake()) .build(); }