Beispiel #1
0
  public void updateTheUpdater() {
    final FilesCollection.Filter filter =
        new FilesCollection.Filter() {

          @Override
          public boolean matches(final FileObject file) {
            if (file.filename.equals("jars/ij-updater-core.jar")) {
              file.setAction(files, Action.UPDATE);
              return true;
            }
            return false;
          }
        };
    final FilesCollection justTheUpdater = files.clone(files.filter(filter));
    final Installer installer =
        new Installer(justTheUpdater, getProgress("Installing the updater..."));
    try {
      installer.start();
    } catch (final Canceled e) {
      // TODO: remove "update/" directory
      error("Canceled");
      installer.done();
    } catch (final IOException e) {
      // TODO: remove "update/" directory
      error("Installer failed: " + e);
      installer.done();
    }
  }
Beispiel #2
0
 public void install() {
   final Installer installer = new Installer(files, getProgress("Installing..."));
   try {
     installer.start();
     updateFilesTable();
     filesChanged();
     files.write();
     info("Updated successfully.  Please restart ImageJ!");
     dispose();
   } catch (final Canceled e) {
     // TODO: remove "update/" directory
     error("Canceled");
     installer.done();
   } catch (final Exception e) {
     Log.error(e);
     // TODO: remove "update/" directory
     error("Installer failed: " + e);
     installer.done();
   }
 }