Esempio n. 1
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());
   }
 }
Esempio n. 2
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);
    }
  }