예제 #1
0
 @Override
 public void executed(Exercise exo) {
   if (Game.getInstance().studentWork.getPassed(exo.getId(), exo.lastResult.language)) {
     write(username + " solved " + exo.getName() + " in " + exo.lastResult.language + "!");
   } else {
     write(username + " failed " + exo.getName() + " in " + exo.lastResult.language + "!");
   }
 }
예제 #2
0
  public String getJLMPropertiesDir() {
    String jlmPropertiesDir = null;

    String value = Game.getProperty("jlm.configuration.file.path");
    if (value != null) {
      String paths[] = value.split(",");

      for (String localPath : paths) {
        localPath = localPath.replace("$HOME$", System.getProperty("user.home"));
        File localPropertiesFileParentDirectory = new File(localPath);
        File localPropertiesFileDirectory =
            new File(localPath, Game.getLocalPropertiesSubdirectory());

        if (!localPropertiesFileParentDirectory.exists()) {
          continue;
        } else if (localPropertiesFileDirectory.exists() || localPropertiesFileDirectory.mkdir()) {
          jlmPropertiesDir = localPropertiesFileParentDirectory.getPath();
          break;
        } else {
          Logger.log(
              "Game:storeProperties",
              "cannot create local properties store directory ("
                  + localPropertiesFileDirectory
                  + ")");
        }
      }
    } else {
      JOptionPane.showConfirmDialog(
          null,
          "No path provided in the property file (or property file not found)\n"
              + "You may want to export your session with the menu 'Session/Export session'\n"
              + "to save your work manually.\n\n"
              + "Quit without saving?",
          "Cannot save your changes. Quit without saving?",
          JOptionPane.YES_NO_OPTION,
          JOptionPane.ERROR_MESSAGE);
      return null;
    }
    return jlmPropertiesDir;
  }
예제 #3
0
 public RefreshCourse(
     Game game, String text, ImageIcon icon, TeacherConsoleDialog parentComponent) {
   super(game, text, icon);
   course = game.getCurrentCourse();
   this.parentComponent = parentComponent;
 }