Skip to content

Commit

Permalink
Merge pull request zouzg#258 from slankka/master
Browse files Browse the repository at this point in the history
修复长时间没有操作连接断开后,OverSSH动画不能关闭的问题
  • Loading branch information
zouzg authored Apr 23, 2019
2 parents 6502e46 + e079770 commit 9c5fd43
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,15 @@ public void generateCode() {
bridge.setDatabaseConfig(selectedDatabaseConfig);
bridge.setIgnoredColumns(ignoredColumns);
bridge.setColumnOverrides(columnOverrides);
UIProgressCallback alert = new UIProgressCallback(Alert.AlertType.INFORMATION);
bridge.setProgressCallback(alert);
alert.show();
try {
UIProgressCallback alert = new UIProgressCallback(Alert.AlertType.INFORMATION);
bridge.setProgressCallback(alert);
alert.show();
PictureProcessStateController pictureProcessStateController = null;
try {
//Engage PortForwarding
Session sshSession = DbUtil.getSSHSession(selectedDatabaseConfig);
DbUtil.engagePortForwarding(sshSession, selectedDatabaseConfig);
PictureProcessStateController pictureProcessStateController = null;

if (sshSession != null) {
pictureProcessStateController = new PictureProcessStateController();
pictureProcessStateController.setDialogStage(getDialogStage());
Expand All @@ -312,11 +313,18 @@ protected Void call() throws Exception {
task.setOnSucceeded(event -> {
finalPictureProcessStateController.close();
});
task.setOnFailed(event -> {
finalPictureProcessStateController.close();
});
new Thread(task).start();
}
} catch (Exception e) {
e.printStackTrace();
e.printStackTrace();
AlertUtil.showErrorAlert(e.getMessage());
if (pictureProcessStateController != null) {
pictureProcessStateController.close();
pictureProcessStateController.playFailState(e.getMessage(), true);
}
}
}

Expand Down Expand Up @@ -354,6 +362,7 @@ public void saveGeneratorConfig() {
ConfigHelper.deleteGeneratorConfig(name);
ConfigHelper.saveGeneratorConfig(generatorConfig);
} catch (Exception e) {
_LOG.error("保存配置失败", e);
AlertUtil.showErrorAlert("保存配置失败");
}
}
Expand Down Expand Up @@ -415,7 +424,7 @@ public void setGeneratorConfigIntoUI(GeneratorConfig generatorConfig) {
useDAOExtendStyle.setSelected(generatorConfig.isUseDAOExtendStyle());
useSchemaPrefix.setSelected(generatorConfig.isUseSchemaPrefix());
jsr310Support.setSelected(generatorConfig.isJsr310Support());

}

@FXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ public void playFailState(String message, boolean showButton) {
if (showButton) {
showCloseButton();
}
if (!dialogStage.isShowing()) {
dialogStage.show();
}
}

private void showCloseButton() {
Expand Down

0 comments on commit 9c5fd43

Please sign in to comment.