Fix update manager not displaying self-update errors
This commit is contained in:
parent
8dfb0490e3
commit
60030695b3
|
@ -105,7 +105,7 @@ public final class Launcher {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updateManager.checkForUpdate();
|
updateManager.checkForUpdate(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -401,8 +401,11 @@ public final class Launcher {
|
||||||
/**
|
/**
|
||||||
* Show the launcher.
|
* Show the launcher.
|
||||||
*/
|
*/
|
||||||
public void showLauncherWindow() {
|
public Window showLauncherWindow() {
|
||||||
mainWindowSupplier.get().setVisible(true);
|
Window window = mainWindowSupplier.get();
|
||||||
|
window.setVisible(true);
|
||||||
|
|
||||||
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class LauncherFrame extends JFrame {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
loadInstances();
|
loadInstances();
|
||||||
launcher.getUpdateManager().checkForUpdate();
|
launcher.getUpdateManager().checkForUpdate(LauncherFrame.this);
|
||||||
webView.browse(launcher.getNewsURL(), false);
|
webView.browse(launcher.getNewsURL(), false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -394,8 +394,8 @@ public class LauncherFrame extends JFrame {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void gameClosed() {
|
public void gameClosed() {
|
||||||
launcher.showLauncherWindow();
|
Window newLauncherWindow = launcher.showLauncherWindow();
|
||||||
launcher.getUpdateManager().checkForUpdate();
|
launcher.getUpdateManager().checkForUpdate(newLauncherWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class UpdateManager {
|
||||||
return pendingUpdate != null;
|
return pendingUpdate != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkForUpdate() {
|
public void checkForUpdate(final Window window) {
|
||||||
ListenableFuture<LatestVersionInfo> future = launcher.getExecutor().submit(new UpdateChecker(launcher));
|
ListenableFuture<LatestVersionInfo> future = launcher.getExecutor().submit(new UpdateChecker(launcher));
|
||||||
|
|
||||||
Futures.addCallback(future, new FutureCallback<LatestVersionInfo>() {
|
Futures.addCallback(future, new FutureCallback<LatestVersionInfo>() {
|
||||||
|
@ -63,9 +63,11 @@ public class UpdateManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable t) {
|
public void onFailure(Throwable t) {
|
||||||
|
// Error handler attached below.
|
||||||
}
|
}
|
||||||
}, SwingExecutor.INSTANCE);
|
}, SwingExecutor.INSTANCE);
|
||||||
|
|
||||||
|
SwingHelper.addErrorDialogCallback(window, future);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performUpdate(final Window window) {
|
public void performUpdate(final Window window) {
|
||||||
|
|
Loading…
Reference in New Issue