private void performAction(Project... projects) { projectMediator.saveAllFiles(); for (final Project project : projects) { final TmcProjectInfo projectInfo = projectMediator.wrapProject(project); eventBus.post(new InvokedEvent(projectInfo)); BgTask.start( "Compiling project", startCompilingProject(projectInfo), new BgTaskListener<Integer>() { @Override public void bgTaskReady(Integer result) { if (result == 0) { startRunningTests(projectInfo); } else { dialogDisplayer.displayError("The code did not compile."); } } @Override public void bgTaskFailed(Throwable ex) { dialogDisplayer.displayError("Failed to compile the code."); } @Override public void bgTaskCancelled() {} }); } }
public RunTestsLocallyAction() { this.settings = TmcSettings.getDefault(); this.courseDb = CourseDb.getInstance(); this.projectMediator = ProjectMediator.getInstance(); this.resultDisplayer = TestResultDisplayer.getInstance(); this.dialogDisplayer = ConvenientDialogDisplayer.getDefault(); this.submitAction = new SubmitExerciseAction(); this.eventBus = TmcEventBus.getDefault(); putValue("noIconInMenu", Boolean.TRUE); }