Add helper class for dialogs
This commit is contained in:
parent
878b25c55c
commit
5b936c779d
|
@ -1,5 +1,6 @@
|
|||
package ctbrec.ui;
|
||||
|
||||
import static ctbrec.ui.controls.Dialogs.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
@ -821,24 +822,4 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
|||
selectedThumbCells.get(0).setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void showError(String header, String text, Exception e) {
|
||||
Runnable r = () -> {
|
||||
Alert alert = new AutosizeAlert(Alert.AlertType.ERROR);
|
||||
alert.setTitle("Error");
|
||||
alert.setHeaderText(header);
|
||||
String content = text;
|
||||
if(e != null) {
|
||||
content += " " + e.getLocalizedMessage();
|
||||
}
|
||||
alert.setContentText(content);
|
||||
alert.showAndWait();
|
||||
};
|
||||
|
||||
if(Platform.isFxApplicationThread()) {
|
||||
r.run();
|
||||
} else {
|
||||
Platform.runLater(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package ctbrec.ui.controls;
|
||||
|
||||
import ctbrec.ui.AutosizeAlert;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.control.Alert;
|
||||
|
||||
public class Dialogs {
|
||||
public static void showError(String header, String text, Exception e) {
|
||||
Runnable r = () -> {
|
||||
Alert alert = new AutosizeAlert(Alert.AlertType.ERROR);
|
||||
alert.setTitle("Error");
|
||||
alert.setHeaderText(header);
|
||||
String content = text;
|
||||
if(e != null) {
|
||||
content += " " + e.getLocalizedMessage();
|
||||
}
|
||||
alert.setContentText(content);
|
||||
alert.showAndWait();
|
||||
};
|
||||
|
||||
if(Platform.isFxApplicationThread()) {
|
||||
r.run();
|
||||
} else {
|
||||
Platform.runLater(r);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue