示例#1
0
 @Override
 public void run() {
   try {
     is.run();
     UserInterface.getInstance().setProgress(100);
   } catch (Exception e) {
     UserInterface.getInstance().clearUI();
     return;
   }
 }
  /**
   * Setups all necessary things for this application
   *
   * @author Grzegorz Polek <*****@*****.**>
   * @author Lukasz Pycia <*****@*****.**>
   */
  private void setup() {
    // Show help
    if (help) {
      jc.usage();
    }

    // Disable MediaLib. lol.
    System.setProperty("com.sun.media.jai.disableMediaLib", "true");

    // GUI enabled
    if (gui) {
      try {
        UserInterface ui = UserInterface.getInstance();
        ui.setVisible(true);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    if (threads == 0) {
      threads = 1;
    }

    // Set up the logger
    try {
      ISLogger.setup();
    } catch (IOException e) {
      e.printStackTrace();
      throw new RuntimeException("Problems with creating the log files!");
    }

    // Run if not gui and all arguments are set up
    if (img != null && dir != null) {
      if (!gui) {
        check();
        run();
      }
    }
  }