Example #1
0
  private void initUI() throws InitializationException {
    // Settings Dialog
    try {
      EventQueue.invokeAndWait(
          new Runnable() {
            @Override
            public void run() {
              settingsDialog = new SettingsDialog();

              for (Profile p : config.getProfiles().list()) {
                settingsDialog.addProfileToTree(p, false);
              }
            }
          });
    } catch (InterruptedException ex) {
      logger.log(Level.SEVERE, "Unable to init SettingsDialog.", ex);
      throw new InitializationException(ex);
    } catch (InvocationTargetException ex) {
      logger.log(Level.SEVERE, "Unable to init SettingsDialog.", ex);
      throw new InitializationException(ex);
    }

    // Tray
    tray.init("Everything is up to date.");
    tray.addTrayEventListener(new TrayEventListenerImpl());
    tray.updateUI();

    // Desktop integration
    if (config.isServiceEnabled()) {
      desktop.start(); // must be started before indexer!
    }
  }
Example #2
0
  private void doShutdown() {
    logger.info("Shutting down ...");

    tray.destroy();
    indexer.stop();
    localWatcher.stop();
    periodic.stop();

    System.exit(0);
  }
Example #3
0
  private void initDependencies() {
    logger.info("Instantiating dependencies ...");

    config = Config.getInstance();
    desktop = Desktop.getInstance();
    indexer = Indexer.getInstance();
    localWatcher = LocalWatcher.getInstance();
    tray = Tray.getInstance();
    periodic = new PTreeSearch();
  }
Example #4
0
  public void initFirstTimeWizard() {
    Profile profile = WizardDialog.showWizard();

    // Ok clicked
    if (profile != null) {
      config.getProfiles().add(profile);
      settingsDialog.addProfileToTree(profile, false);
      tray.updateUI();

      try {
        config.save();
      } catch (ConfigException ex) {
        logger.log(Level.SEVERE, "Could not save profile from first-start wizard. EXITING.", ex);
        throw new RuntimeException("Could not save profile from first-start wizard. EXITING.", ex);
      }

      profile.setActive(true);
    }
  }