- Fix spacing in summary bar

- Add start() in UpdateTask so things happen in the right order
- Add toString() in UpdateTask for better debugging
- Fix getID() for plugin UpdateTasks
This commit is contained in:
zzz
2012-10-22 20:25:01 +00:00
parent 1538e6ec4e
commit bd9ad9982b
12 changed files with 35 additions and 13 deletions

View File

@ -184,6 +184,7 @@ public class ConsoleUpdateManager implements UpdateManager {
if (_log.shouldLog(Log.INFO))
_log.info("Starting " + r);
_activeCheckers.add(t);
t.start();
}
}
if (t != null) {
@ -226,6 +227,7 @@ public class ConsoleUpdateManager implements UpdateManager {
if (_log.shouldLog(Log.INFO))
_log.info("Starting " + r);
_activeCheckers.add(t);
t.start();
break;
}
}
@ -517,6 +519,7 @@ public class ConsoleUpdateManager implements UpdateManager {
if (_log.shouldLog(Log.INFO))
_log.info("Starting " + r);
_downloaders.put(t, toTry);
t.start();
return t;
} else {
if (_log.shouldLog(Log.WARN))

View File

@ -46,7 +46,6 @@ class NewsHandler extends UpdateHandler implements Checker {
updateSources.add(new URI(BACKUP_NEWS_URL));
} catch (URISyntaxException use) {}
UpdateRunner update = new NewsFetcher(_context, _mgr, updateSources);
update.start();
return update;
}
}

View File

@ -46,6 +46,9 @@ class PluginUpdateChecker extends UpdateRunner {
@Override
public UpdateType getType() { return UpdateType.PLUGIN; }
@Override
public String getID() { return _appName; }
@Override
public void run() {

View File

@ -57,7 +57,6 @@ class PluginUpdateHandler implements Checker, Updater {
}
UpdateRunner update = new PluginUpdateChecker(_context, _mgr, updateSources, appName, oldVersion);
update.start();
return update;
}
@ -78,7 +77,6 @@ class PluginUpdateHandler implements Checker, Updater {
UpdateRunner update = new PluginUpdateRunner(_context, _mgr, updateSources, appName, oldVersion);
// set status before thread to ensure UI feedback
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
update.start();
return update;
}
}

View File

@ -74,6 +74,9 @@ class PluginUpdateRunner extends UpdateRunner {
@Override
public URI getURI() { return _uri; }
@Override
public String getID() { return _appName; }
@Override
protected void update() {

View File

@ -71,7 +71,6 @@ class UnsignedUpdateHandler implements Checker, Updater {
}
UpdateRunner update = new UnsignedUpdateChecker(_context, _mgr, updateSources, ms);
update.start();
return update;
}
@ -91,7 +90,6 @@ class UnsignedUpdateHandler implements Checker, Updater {
UpdateRunner update = new UnsignedUpdateRunner(_context, _mgr, updateSources);
// set status before thread to ensure UI feedback
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
update.start();
return update;
}
}

View File

@ -44,7 +44,6 @@ class UpdateHandler implements Updater {
UpdateRunner update = new UpdateRunner(_context, _mgr, updateSources);
// set status before thread to ensure UI feedback
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
update.start();
return update;
}
}

View File

@ -236,4 +236,9 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
protected String _(String s, Object o) {
return _mgr._(s, o);
}
@Override
public String toString() {
return getClass().getName() + ' ' + getType() + ' ' + getID() + ' ' + getMethod() + ' ' + getURI();
}
}

View File

@ -652,8 +652,10 @@ public class SummaryHelper extends HelperBase {
StringBuilder buf = new StringBuilder(512);
// display all the time so we display the final failure message, and plugin update messages too
String status = NewsHelper.getUpdateStatus();
boolean needSpace = false;
if (status.length() > 0) {
buf.append("<h4>").append(status).append("</h4>\n");
needSpace = true;
}
String dver = NewsHelper.updateVersionDownloaded();
if (dver == null)
@ -661,6 +663,10 @@ public class SummaryHelper extends HelperBase {
if (dver != null &&
!NewsHelper.isUpdateInProgress() &&
!_context.router().gracefulShutdownInProgress()) {
if (needSpace)
buf.append("<hr>");
else
needSpace = true;
buf.append("<h4><b>").append(_("Update downloaded")).append("<br>");
if (_context.hasWrapper())
buf.append(_("Click Restart to install"));
@ -675,6 +681,8 @@ public class SummaryHelper extends HelperBase {
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) > 0 && // assume using proxy for now
getAction() == null &&
getUpdateNonce() == null) {
if (needSpace)
buf.append("<hr>");
long nonce = _context.random().nextLong();
String prev = System.getProperty("net.i2p.router.web.UpdateHandler.nonce");
if (prev != null)