Exemplo n.º 1
0
  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() {}
          });
    }
  }
Exemplo n.º 2
0
 private Integer getMemoryLimit(Project project) {
   Exercise ex =
       projectMediator.tryGetExerciseForProject(projectMediator.wrapProject(project), courseDb);
   if (ex != null) {
     return ex.getMemoryLimit();
   } else {
     return null;
   }
 }
Exemplo n.º 3
0
  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);
  }