(final Consumer<Boolean> canCloseCallback)
| 1003 | ); |
| 1004 | |
| 1005 | @Override |
| 1006 | public void onClose(final Consumer<Boolean> canCloseCallback) { |
| 1007 | if (getDeckController().isSaved() || !allowSave() || canCloseCallback == null) { |
| 1008 | super.onClose(canCloseCallback); //can skip prompt if draft saved |
| 1009 | return; |
| 1010 | } |
| 1011 | FOptionPane.showOptionDialog(Forge.getLocalizer().getMessage("lblSaveChangesCurrentDeck"), "", |
| 1012 | FOptionPane.QUESTION_ICON, onCloseOptions, result -> { |
| 1013 | if (result == 0) { |
| 1014 | save(canCloseCallback); |
| 1015 | } else if (result == 1) { |
| 1016 | getDeckController().exitWithoutSaving(); //reload if not saving changes |
| 1017 | canCloseCallback.accept(true); |
| 1018 | } else { |
| 1019 | canCloseCallback.accept(false); |
| 1020 | } |
| 1021 | }); |
| 1022 | } |
| 1023 | |
| 1024 | @Override |
| 1025 | public boolean keyDown(int keyCode) { |
nothing calls this directly
no test coverage detected