Exemplo n.º 1
0
 private static void saveUpdateSettings() {
   settings.setAutoUpdate(autoupdate.getCheckForUpdates());
   settings.setExperimental(autoupdate.getIncludeExperiemental());
   settings.setMinor(autoupdate.getIncludeMinor());
   settings.saveSettings();
 }
Exemplo 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);
    }
  }