Skip to content

Commit

Permalink
Adds Update Site URL status check to Updater procedure
Browse files Browse the repository at this point in the history
* during update all URLs from the available update site list are checked
for updates
* if the update site is disabled, the URL is updated automatically
* if the update site is enabled, the user is asked for confirmation of
URL change
* depends on imagej/imagej-updater#71
* touches imagej/imagej-updater#66
  • Loading branch information
frauzufall committed Feb 26, 2019
1 parent fdaf9e6 commit 8f771e6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/net/imagej/ui/swing/updater/ImageJUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@
import java.util.List;

import net.imagej.ui.swing.updater.ViewOptions.Option;
import net.imagej.updater.*;
import net.imagej.updater.Conflicts.Conflict;
import net.imagej.updater.FileObject;
import net.imagej.updater.FilesCollection;
import net.imagej.updater.Installer;
import net.imagej.updater.UpdaterUI;
import net.imagej.updater.UploaderService;
import net.imagej.updater.util.AvailableSites;
import net.imagej.updater.util.Progress;
import net.imagej.updater.util.UpdateCanceledException;
Expand All @@ -67,6 +63,8 @@
import org.scijava.plugin.Plugin;
import org.scijava.util.AppUtils;

import javax.swing.*;

/**
* The Updater. As a command.
* <p>
Expand Down Expand Up @@ -109,7 +107,6 @@ public void run() {
final File imagejRoot = imagejDirProperty != null ? new File(imagejDirProperty) :
AppUtils.getBaseDirectory("ij.dir", FilesCollection.class, "updater");
final FilesCollection files = new FilesCollection(log, imagejRoot);
AvailableSites.initializeAndAddSites(files, log);

UpdaterUserInterface.set(new SwingUserInterface(log, statusService));

Expand Down Expand Up @@ -142,7 +139,13 @@ public void run() {
Progress progress = main.getProgress("Starting up...");

try {
String warnings = files.downloadIndexAndChecksum(progress);
files.readLocalSettingsIfPresent();
AvailableSites.initializeAndAddSites(files, log);
if(ReviewSiteURLsDialog.shouldBeDisplayed(files)) {
SwingUtilities.invokeAndWait(() -> new ReviewSiteURLsDialog(main, files).setVisible(true));
}
AvailableSites.applySitesURLUpdates(files);
String warnings = files.reloadCollectionAndChecksum(progress);
main.checkWritable();
main.addCustomViewOptions();
if (!warnings.equals("")) main.warn(warnings);
Expand Down

0 comments on commit 8f771e6

Please sign in to comment.