/**
   * Processing the input command line arguments
   *
   * @param args a list of pride db accessions
   */
  private void processCmdArgs(String[] args) {
    try {
      // parse command line input
      CommandLine cmd = cmdParser.parse(cmdOptions, args);

      // get accessions
      java.util.List<Comparable> accs = null;
      if (cmd.hasOption(ACCESSION_CMD)) {
        String accStr = cmd.getOptionValue(ACCESSION_CMD);
        accs = new ArrayList<Comparable>(AccessionUtils.expand(accStr));
      }

      // get user name
      String username = null;
      if (cmd.hasOption(USER_NAME_CMD)) {
        username = cmd.getOptionValue(USER_NAME_CMD);
      }

      // get password
      String password = null;
      if (cmd.hasOption(PASSWORD_CMD)) {
        password = cmd.getOptionValue(PASSWORD_CMD);
      }

      if (accs != null || username != null) {
        OpenValidPrideExperimentTask task =
            new OpenValidPrideExperimentTask(accs, username, password);
        task.setGUIBlocker(new DefaultGUIBlocker(task, GUIBlocker.Scope.NONE, null));
        getDesktopContext().addTask(task);
      }
    } catch (ParseException e) {
      System.err.println("Parsing command line option failed. Reason: " + e.getMessage());
    }
  }
Beispiel #2
0
 public void cancelUpdate(String window_name) {
   try {
     saveUpdateSettings();
     if (!cmd.getQuiet()) {
       if (window_name == null) {
         window = new MainWindow();
       } else {
         window = (AbstractWindow) newInstance(window_name);
       }
       addWindow(window);
       window.setVisible(window.getWindowSettings().getVisible());
       window.postLoad();
     }
   } catch (Exception ex) {
     ex.printStackTrace();
     logger.severe("Could not start application: " + ex.getMessage());
   }
 }
Beispiel #3
0
  public Main(
      String args[],
      String cmd_name,
      OSSpecific os_name,
      String settings_name,
      final String window_name,
      String logger_name,
      String about_name,
      String pref_name) {
    if (cmd == null) {
      cmd = new CommandLine(args);
    }

    if (!cmd.getHelp()) {
      if (os_name == null) {
        os = OSSpecific.getInstance();
      } else {
        os = (OSSpecific) newInstance(cmd_name);
      }
      if (settings_name == null) {
        settings = new Settings();
      } else {
        settings = (Settings) newInstance(settings_name);
      }
      settings.loadSettings();
      if (logger_name == null) {
        logger = initLogger();
      } else {
        logger = (Logger) newInstance(logger_name);
      }
      Logger().info("Custom logger now in use.");

      aboutclass = about_name;
      prefclass = pref_name;

      ActionListener update =
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              saveUpdateSettings();
            }
          };
      ActionListener cancel =
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              cancelUpdate(window_name);
            }
          };
      WindowListener closewindow =
          new WindowListener() {
            public void windowClosing(WindowEvent e) {
              cancelUpdate(window_name);
            }

            public void windowClosed(WindowEvent e) {}

            public void windowOpened(WindowEvent e) {}

            public void windowIconified(WindowEvent e) {}

            public void windowDeiconified(WindowEvent e) {}

            public void windowActivated(WindowEvent e) {}

            public void windowDeactivated(WindowEvent e) {}

            public void windowGainedFocus(WindowEvent e) {}

            public void windowLostFocus(WindowEvent e) {}

            public void windowStateChanged(WindowEvent e) {}
          };
      autoupdate = new AutoUpdate();
      autoupdate.checkForUpdates(
          settings.getTitle(),
          settings.getUpdateUrl(),
          settings.getVersion(),
          settings.getBuild(),
          settings.getAllowMinor(),
          settings.getAllowExperimental(),
          settings.getAllowAutoUpdate(),
          settings.getMinor(),
          settings.getExperimental(),
          settings.getAutoUpdate(),
          update,
          cancel,
          closewindow);
    }
  }