CodeOrchestraStreamHandler( SModelDescriptor modelDescriptor, IFile outputDir, CodeOrchestraGenerationFileProcessor processor) { myOriginalOutputDir = outputDir; CodeOrchestraGenerateManager codeOrchestraGenerateManager = processor.getProject().getComponent(CodeOrchestraGenerateManager.class); CodeOrchestraGenerationContext currentContext = codeOrchestraGenerateManager.getCurrentContext(); if (currentContext == null) { myOutputDir = outputDir; myCachesOutputDir = FileGenerationUtil.getCachesDir(outputDir); } else { ModuleReference rootModuleReference = currentContext.getRootModule(); // We override the output path for the AS & JS modules if (currentContext.isSingleOutputContext()) { IModule rootModule = MPSModuleRepository.getInstance().getModule(rootModuleReference); myOutputDir = FileSystem.getInstance().getFileByPath(rootModule.getOutputFor(modelDescriptor)); myCachesOutputDir = FileGenerationUtil.getCachesDir(myOutputDir); } else { myOutputDir = outputDir; myCachesOutputDir = FileGenerationUtil.getCachesDir(outputDir); } } myModelDescriptor = modelDescriptor; myProcessor = processor; }