diff options
author | Simon Rettberg | 2015-08-17 22:24:32 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-08-17 22:24:32 +0200 |
commit | a1e78471cc14b5ded5be4901e54faad6298a9a9f (patch) | |
tree | 1cdd6c865b768f6582f99283e278b18e94a8e763 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java | |
parent | [server] Only retry on transport error (diff) | |
download | tutor-module-a1e78471cc14b5ded5be4901e54faad6298a9a9f.tar.gz tutor-module-a1e78471cc14b5ded5be4901e54faad6298a9a9f.tar.xz tutor-module-a1e78471cc14b5ded5be4901e54faad6298a9a9f.zip |
[*] Adapt to changed ErrorCallback setters in master-sync-shared
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java index bc3e4554..cacea2bb 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java @@ -64,7 +64,6 @@ public abstract class MainWindow { private static final List<ActivityPanel> activities = new ArrayList<>(); - private static final String THRIFT_CONNECTION_ERROR = "Lost connection to the masterserver. Do you want to retry?"; /** * Set the visible page of the main window. @@ -138,9 +137,10 @@ public abstract class MainWindow { }); // Set up thrift error message displaying - ThriftManager.setErrorCallback(new ErrorCallback() { + // TODO: Make this ECB a class with a parameter for the name to display, as this is the only thing that differs here + ThriftManager.setMasterErrorCallback(new ErrorCallback() { @Override - public boolean thriftError(int failCount, String method, final Throwable t) { + public boolean thriftError(int failCount, final String method, final Throwable t) { // if it's the first fail, retry immediately if (failCount == 1) return true; @@ -148,7 +148,29 @@ public abstract class MainWindow { return Gui.syncExec(new GuiCallable<Boolean>() { @Override public Boolean run() { - return Gui.showMessageBox(mainWindow, THRIFT_CONNECTION_ERROR, + return Gui.showMessageBox(mainWindow, "Die Kommunikation mit dem bwLehrpool-Zentralserver ist" + + " gestört. Der Aufruf der Funktion " + method + + " ist fehlgeschlagen.\n\n" + + "Möchten Sie den Aufruf wiederholen?", + MessageType.ERROR_RETRY, LOGGER, t); + } + }); + } + }); + ThriftManager.setMasterErrorCallback(new ErrorCallback() { + @Override + public boolean thriftError(int failCount, final String method, final Throwable t) { + // if it's the first fail, retry immediately + if (failCount == 1) + return true; + // Otherwise, ask user if we should retry + return Gui.syncExec(new GuiCallable<Boolean>() { + @Override + public Boolean run() { + return Gui.showMessageBox(mainWindow, "Die Kommunikation mit dem Satellitenserver ist" + + " gestört. Der Aufruf der Funktion " + method + + " ist fehlgeschlagen.\n\n" + + "Möchten Sie den Aufruf wiederholen?", MessageType.ERROR_RETRY, LOGGER, t); } }); |