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", "");
  }
 public void run() {
   if (Application.getInstance().showOKCancelDialog(title, message)) {
     try {
       ShellExec.openUrl(Registry.getProperty("downloadpage"));
     } catch (Exception e) {
       Application.getInstance()
           .showUnhandledErrorDialog(
               LanguageBundle.getString("general.errors.uncaughtexception.title"), e);
     }
   }
 }
  private void checkUpdate()
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException {
    String url;
    try {
      url = Registry.getProperty("updater.url");
    } catch (Exception e) {
      throw new IOException(e.getMessage()); // i hate leaking "exception"
    }
    HttpClient client = new HttpClient();

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("version", Build.getVersion());
    params.put("release", "" + Build.getRelease());
    if (PreferencesManager.getVersionIndependentPreferences()
        .getBoolean("updater.include.usageData", true)) {
      params.put("uuid", Application.getUUID());
      params.put("platform.arch", Platform.getArch());
      params.put("platform.os", Platform.getOS().getCanonicalName());
      params.put("platform.os.version", Platform.getOS().getVersion());
      params.put("locale.country", LanguageBundle.getCurrentLocale().getCountry());
      params.put("locale.language", LanguageBundle.getCurrentLocale().getLanguage());
    }

    List<NameValuePair> nvp = new ArrayList<NameValuePair>();
    for (String key : params.keySet()) nvp.add(new NameValuePair(key, "" + params.get(key)));

    GetMethod request = new GetMethod(url);
    request.setQueryString(nvp.toArray(new NameValuePair[nvp.size()]));
    LogFactory.getLog(getClass()).info(String.format("Checking for updates: %s", request.getURI()));
    client.executeMethod(request);
    String response = request.getResponseBodyAsString();
    Document doc = DomUtil.parseXMLString(response);
    availableRelease = XPathHelper.xpathAsDouble(doc, "/korsakow/release");
    availableVersion = XPathHelper.xpathAsString(doc, "/korsakow/version");
    message = XPathHelper.xpathAsString(doc, "/korsakow/message");
  }