Skip to content

Commit

Permalink
Remove close confirmation to make it quicker to use the GitWave
Browse files Browse the repository at this point in the history
  • Loading branch information
introfog committed Nov 3, 2024
1 parent d6d3bb2 commit a7ff891
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import javafx.concurrent.Task;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
Expand Down Expand Up @@ -72,13 +71,12 @@ public void initialize(FxmlStageHolder fxmlStageHolder) {
final Stage primaryStage = fxmlStageHolder.getStage();
primaryStage.setOnCloseRequest(event -> {
event.consume();
if (DialogFactory.createCloseConfirmationAlert() == ButtonType.OK) {
AppConfig.getInstance().closeApp();
for (ExecutionController executionController : StageFactory.getExecutingControllers()) {
executionController.getStage().close();
}
primaryStage.close();
};

AppConfig.getInstance().closeApp();
for (ExecutionController executionController : StageFactory.getExecutingControllers()) {
executionController.getStage().close();
}
primaryStage.close();
});

directoryTabController = new DirectoryTabController(fxmlStageHolder, directory);
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/com/github/introfog/gitwave/model/DialogFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
import javafx.scene.image.Image;
import javafx.stage.Stage;

Expand Down Expand Up @@ -56,18 +55,4 @@ public static void createInfoAlert(String header, String msg) {
alert.getDialogPane().setStyle(COMMON_STYLES);
alert.showAndWait();
}

public static ButtonType createCloseConfirmationAlert() {
Alert dialog = new Alert(AlertType.CONFIRMATION);
Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(StageFactory.class.getResourceAsStream(AppConstants.PATH_TO_LOGO_32)));
dialog.setTitle("Confirmation");
dialog.setHeaderText("Do you really want to close the application?");
dialog.getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL);

dialog.getDialogPane().setStyle(COMMON_STYLES);
ButtonType[] pressedButton = {null};
dialog.showAndWait().ifPresent(response -> pressedButton[0] = response);
return pressedButton[0];
}
}

0 comments on commit a7ff891

Please sign in to comment.