예제 #1
0
 public static void closeActiveWindow() {
   for (int i = 0; i < windows.size(); i++) {
     try {
       AbstractWindow window = (AbstractWindow) windows.get(i);
       if (window != null && window.isActive()) {
         closeWindow(window);
       }
     } catch (Exception e) {
       logger.warning("Cannot close window: " + e.getMessage());
     }
   }
 }
예제 #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());
   }
 }
예제 #3
0
  public static Logger initLogger() {
    Logger initlogger = Logger.getLogger(settings.getMainClass());
    initlogger.setLevel(settings.getLogLevel());
    boolean addconsole = false;
    if (settings.getLogToFile()) {
      try {
        Handler handler = new FileHandler(settings.getLogFile(), true);
        handler.setFormatter(new SimpleFormatter());
        initlogger.addHandler(handler);
      } catch (Exception e) {
        Logger().warning("Could not set logfile " + settings.getLogFile() + ": " + e.getMessage());
        addconsole = true;
      }
    }
    addconsole = settings.getLogToConsole() || addconsole;
    if (addconsole) {
      initlogger.addHandler(new ConsoleHandler());
    }
    // restore original log state
    logger.setLevel(templevel);
    templevel = null;

    return initlogger;
  }
예제 #4
0
 static {
   // Use anonymous logger (System.err), until settings read, set initial level to WARNING
   logger = Logger.getAnonymousLogger();
   templevel = logger.getLevel();
   logger.setLevel(Level.WARNING);
 }