Skip to content

Commit

Permalink
All buttons in custom dialogs react on enter (#4835)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-manner authored and tobiasdiez committed Apr 2, 2019
1 parent 05eaa64 commit 1c1a6a4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/org/jabref/gui/util/BaseDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.image.Image;
import javafx.scene.input.KeyCode;
import javafx.stage.Stage;

import org.jabref.Globals;
Expand All @@ -23,6 +24,14 @@ protected BaseDialog() {
} else if (keyBindingRepository.checkKeyCombinationEquality(KeyBinding.DEFAULT_DIALOG_ACTION, event)) {
getDefaultButton().ifPresent(Button::fire);
}

// all buttons in base dialogs react on enter
if (event.getCode() == KeyCode.ENTER) {
if (event.getTarget() instanceof Button) {
((Button) event.getTarget()).fire();
event.consume();
}
}
});

setDialogIcon(IconTheme.getJabRefImageFX());
Expand Down

0 comments on commit 1c1a6a4

Please sign in to comment.