ProcessingItem[] (final @NotNull CompileContext context, final ProcessingItem @NotNull [] items) { final ArrayList<ProcessingItem> compiledItems = new ArrayList<>(); context.getProgressIndicator().setText(UIDesignerBundle.message("progress.compiling.ui.forms")); int formsProcessed = 0; final Project project = context.getProject(); final FormSourceCodeGenerator generator = new FormSourceCodeGenerator(project); final HashSet<Module> processedModules = new HashSet<>(); final List<File> filesToRefresh = new ArrayList<>(); for (ProcessingItem item1 : items) { context.getProgressIndicator().setFraction((double)(++formsProcessed) / ((double)items.length)); final MyInstrumentationItem item = (MyInstrumentationItem)item1; final VirtualFile formFile = item.getFormFile(); if (GuiDesignerConfiguration.getInstance(project).COPY_FORMS_RUNTIME_TO_OUTPUT) { ApplicationManager.getApplication().runReadAction(() -> { final Module module = ModuleUtilCore.findModuleForFile(formFile, project); if (module != null && !processedModules.contains(module)) { processedModules.add(module); final String moduleOutputPath = CompilerPaths.getModuleOutputPath(module, false); try { if (moduleOutputPath != null) { filesToRefresh.addAll(CopyResourcesUtil.copyFormsRuntime(moduleOutputPath, false)); } final String testsOutputPath = CompilerPaths.getModuleOutputPath(module, true); if (testsOutputPath != null && !testsOutputPath.equals(moduleOutputPath)) { filesToRefresh.addAll(CopyResourcesUtil.copyFormsRuntime(testsOutputPath, false)); } } catch (IOException e) { addError( context, new FormErrorInfo(null, UIDesignerBundle.message("error.cannot.copy.gui.designer.form.runtime", module.getName(), e.toString())), null ); } } }); } ApplicationManager.getApplication().invokeAndWait(() -> { CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> { PsiDocumentManager.getInstance(project).commitAllDocuments(); generator.generate(formFile); final ArrayList<FormErrorInfo> errors = generator.getErrors(); if (errors.size() == 0) { compiledItems.add(item); } else { for (final FormErrorInfo e : errors) { addError(context, e, formFile); } } }), "", null); FileDocumentManager.getInstance().saveAllDocuments(); }, ModalityState.nonModal()); } CompilerUtil.refreshIOFiles(filesToRefresh); return compiledItems.toArray(ProcessingItem.EMPTY_ARRAY); }