コード例 #1
0
 @Override
 public void run() {
   try {
     checkUpdate();
   } catch (IOException e) {
     // we don't notify on IO errors because a common case is when you're using the software
     // without a connection or the site is
     // down or something, don't bug the user about it.
     // other errors like in the format of the XML are exception circumstance.
     Logger.getLogger(Updater.class).error(e);
   } catch (Exception e) {
     UIUtil.runUITaskNow(new ErrorAction(LanguageBundle.getString("updater.error.title"), e));
   }
   if (availableRelease > Build.getRelease()) {
     UIUtil.runUITaskNow(
         new AlertAction(
             LanguageBundle.getString("updater.newversion.title"),
             LanguageBundle.getString("updater.newversion.message", availableVersion, message)));
   }
 }
コード例 #2
0
  protected Application() throws Exception {
    UIUtil.runUITaskNow(
        new Runnable() {
          public void run() {
            Thread.currentThread()
                .setUncaughtExceptionHandler(
                    new UncaughtExceptionHandler() {
                      public void uncaughtException(Thread thread, Throwable exception) {
                        Application.getInstance()
                            .showUnhandledErrorDialog(
                                LanguageBundle.getString("general.errors.uncaughtexception.title"),
                                LanguageBundle.getString(
                                    "general.errors.uncaughtexception.message"),
                                exception);
                      }
                    });
          }
        });

    String applicationClassName = "";
    switch (Platform.getOS()) {
      case MAC:
        applicationClassName = Registry.getProperty("application_classname_osx");
        break;
      case WIN:
        applicationClassName = Registry.getProperty("application_classname_windows");
        break;
      case NIX:
        applicationClassName = Registry.getProperty("application_classname_linux");
        break;
    }
    platformApplication = (IApplication) Class.forName(applicationClassName).newInstance();

    UIUtil.setUpLAF();

    resourceEditActions.put(ResourceType.SNU, new EditSnuAction());
    resourceEditActions.put(ResourceType.VIDEO, new EditVideoAction());
    resourceEditActions.put(ResourceType.IMAGE, new EditImageAction());
    resourceEditActions.put(ResourceType.TEXT, new EditTextAction());
    resourceEditActions.put(ResourceType.SOUND, new EditSoundAction());
    resourceEditActions.put(ResourceType.INTERFACE, new EditInterfaceAction());
    resourceEditActions.put(ResourceType.PROJECT, new ProjectEditAction());

    undoManager = new UndoManager();
    undoManager.setLimit(999);

    UIManager.put("AbstractUndoableEdit.undoText", "");
    UIManager.put("AbstractUndoableEdit.redoText", "");
  }