2323import java .nio .file .Paths ;
2424import java .sql .SQLException ;
2525
26+ import javafx .scene .control .*;
2627import org .h2 .tools .RunScript ;
2728import org .h2 .tools .Script ;
2829import org .slf4j .Logger ;
4243import javafx .fxml .FXMLLoader ;
4344import javafx .scene .Parent ;
4445import javafx .scene .Scene ;
45- import javafx .scene .control .Alert ;
4646import javafx .scene .control .Alert .AlertType ;
47- import javafx .scene .control .Button ;
48- import javafx .scene .control .CheckBox ;
49- import javafx .scene .control .ColorPicker ;
50- import javafx .scene .control .Label ;
5147import javafx .scene .layout .AnchorPane ;
5248import javafx .scene .layout .Region ;
5349import javafx .scene .paint .Color ;
@@ -244,6 +240,16 @@ private void initImportButton(){
244240 importButton .setOnAction (event ->{
245241
246242 try {
243+ Alert confirmationAlert = new Alert (AlertType .CONFIRMATION , "" , ButtonType .YES , ButtonType .NO );
244+ confirmationAlert .setTitle ("Import" );
245+ confirmationAlert .setHeaderText ("Do you want to Override current Data ?" );
246+ confirmationAlert .showAndWait ();
247+
248+ if (confirmationAlert .getResult ()==ButtonType .NO ){
249+ LOG .info ("User canceled import" );
250+ return ;
251+ }
252+
247253 final FileChooser fileChooser = new FileChooser ();
248254 fileChooser .setTitle ("Open Exported SQl Script" );
249255 File file = fileChooser .showOpenDialog (thisStage );
@@ -258,6 +264,11 @@ private void initImportButton(){
258264 final String password = applicationProperties .getSpringDataSourcePassword ();
259265 RunScript .execute (url , username , password , file .toString (), Charset .defaultCharset (), true );
260266
267+ Alert informationDialog = new Alert (AlertType .INFORMATION );
268+ informationDialog .setTitle ("Import done" );
269+ informationDialog .setHeaderText ("The data was imported." );
270+ informationDialog .setContentText ("You have to RESTART KeepTime to see the changes" );
271+ informationDialog .showAndWait ();
261272
262273 } catch (SQLException e ) {
263274 LOG .error ("Could not import script file to db." , e );
0 commit comments