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 MissingMediaDialog showMissingMediaDialog(JFrame parent) {
   MissingMediaDialog dialog = new MissingMediaDialog(parent);
   dialog.setTitle("Missing Media");
   dialog.setModal(true);
   dialog.setSize(new Dimension(320, 240));
   UIUtil.centerOnFrame(dialog, parent);
   return dialog;
 }
 public EditingConflictDialog showEditingConflictDialog(JFrame parent) {
   EditingConflictDialog dialog = new EditingConflictDialog(parent);
   dialog.setTitle("Editing Conflict");
   dialog.setModal(true);
   dialog.setSize(new Dimension(320, 240));
   UIUtil.centerOnFrame(dialog, parent);
   return dialog;
 }
 public ProjectExplorer showProjectExplorer() {
   ProjectExplorer resourceExplorer = getProjectExplorer();
   resourceExplorer.pack();
   Dimension d = new Dimension(925, 600);
   resourceExplorer.setSize(d);
   UIUtil.constrainSizeToScreen(resourceExplorer);
   return resourceExplorer;
 }
 public void showAboutDialog() {
   final JDialog splashDialog = new JDialog(getProjectExplorer());
   splashDialog.setModal(true);
   splashDialog.setResizable(false);
   SplashPage page = new SplashPage();
   splashDialog.add(page);
   splashDialog.pack();
   UIUtil.centerOnFrame(splashDialog, getProjectExplorer());
   splashDialog.setVisible(true);
 }
 public void registerDeleted(final IResource resource) {
   UIUtil.runUITaskLater(
       new Runnable() {
         public void run() {
           for (ApplicationListener listener :
               eventListeners.getListeners(ApplicationListener.class))
             listener.onResourceDeleted(resource);
         }
       });
 }
 public DefaultTableWidgetPropertiesEditor(Collection<WidgetModel> widgets) {
   super(widgets);
   table.getColumn(Column.NAME).setCellRenderer(new NameRenderer());
   table.getColumn(Column.VALUE).setCellRenderer(this);
   UIUtil.runUITaskLater(
       new Runnable() {
         public void run() {
           configureTableModel((DefaultTableModel) table.getModel());
         }
       });
 }
示例#8
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)));
   }
 }