Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reenable closing of entry preview by pressing Esc #3883

Merged
merged 1 commit into from
Mar 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/EntryTypeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private JPanel createCancelButtonBarPanel() {
cancel.addActionListener(this);

// Make ESC close dialog, equivalent to clicking Cancel.
cancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
cancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
cancel.getActionMap().put("close", cancelAction);

JPanel buttons = new JPanel();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/FXDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public FXDialog(AlertType type, boolean isModal) {

dialogWindow.getScene().setOnKeyPressed(event -> {
KeyBindingRepository keyBindingRepository = Globals.getKeyPrefs();
if (keyBindingRepository.checkKeyCombinationEquality(KeyBinding.CLOSE_DIALOG, event)) {
if (keyBindingRepository.checkKeyCombinationEquality(KeyBinding.CLOSE, event)) {
dialogWindow.close();
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/GenFieldsCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void jbInit() {
// Key bindings:
ActionMap am = buttons.getActionMap();
InputMap im = buttons.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", new AbstractAction() {

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/MergeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void jbInit() {
// Key bindings:
ActionMap am = jPanel1.getActionMap();
InputMap im = jPanel1.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", new AbstractAction() {

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/PreviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void createKeyBindings() {
copyPreviewToClipBoard();
event.consume();
break;
case CLOSE_DIALOG:
case CLOSE:
close();
event.consume();
break;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/ReplaceStringDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void actionPerformed(ActionEvent e) {
JPanel settings = new JPanel();
ActionMap am = settings.getActionMap();
InputMap im = settings.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelAction);

// Layout starts here.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/StringDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected boolean accept(Component c) {
am.put("remove", removeStringAction);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.SAVE_DATABASE), "save");
am.put("save", saveAction);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", closeAction);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.HELP), "help");
am.put("help", helpAction);
Expand Down Expand Up @@ -217,7 +217,7 @@ public StringTable(StringTableModel stm) {
TableColumnModel cm = getColumnModel();
cm.getColumn(0).setPreferredWidth(800);
cm.getColumn(1).setPreferredWidth(2000);
getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
getActionMap().put("close", closeAction);
getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.HELP), "help");
getActionMap().put("help", helpAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void keyPressed(KeyEvent e) {
// Key bindings:
ActionMap am = builder.getPanel().getActionMap();
InputMap im = builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelAction);

diag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void actionPerformed(ActionEvent e) {
// Key bindings:
ActionMap am = builder.getPanel().getActionMap();
InputMap im = builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelAction);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/auximport/FromAuxDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void jbInit() {
// Key bindings:
ActionMap am = statusPanel.getActionMap();
InputMap im = statusPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", new AbstractAction() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void actionPerformed(ActionEvent e) {

ActionMap am = b.getPanel().getActionMap();
InputMap im = b.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", closeAction);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void actionPerformed(ActionEvent e) {
};
ActionMap am = main.getActionMap();
InputMap im = main.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", closeAction);

//con.fill = GridBagConstraints.BOTH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void actionPerformed(ActionEvent e) {
};
ActionMap am = builder.getPanel().getActionMap();
InputMap im = builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", closeAction);

ok.addActionListener(e -> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void setupKeyBindings() {
HelpAction.openHelpPage(HelpFile.ENTRY_EDITOR);
event.consume();
break;
case CLOSE_ENTRY_EDITOR:
case CLOSE:
close();
event.consume();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void actionPerformed(ActionEvent e) {
JPanel main = new JPanel();
ActionMap am = main.getActionMap();
InputMap im = main.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelAction);

// Layout starts here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void actionPerformed(ActionEvent e) {
JPanel main = new JPanel();
ActionMap am = main.getActionMap();
InputMap im = main.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", closeAction);
main.setLayout(new BorderLayout());
main.add(sp, BorderLayout.CENTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public void actionPerformed(ActionEvent e) {

InputMap im = cancelButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap am = cancelButton.getActionMap();
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancel);

progressArea = new JTextArea(15, 60);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ public void actionPerformed(ActionEvent e) {
// Key bindings:
ActionMap am = upper.getActionMap();
InputMap im = upper.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelAction);
am = bb.getPanel().getActionMap();
im = bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelAction);

if (frame == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void actionPerformed(ActionEvent e) {
// Key bindings:
ActionMap am = builder.getPanel().getActionMap();
InputMap im = builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelAction);

link.getDocument().addDocumentListener(new DocumentListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void action() throws Exception {
// Key bindings:
ActionMap am = sp.getActionMap();
InputMap im = sp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", new AbstractAction() {

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/groups/GroupDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public void actionPerformed(ActionEvent e) {
};
mCancel.addActionListener(cancelAction);
builderAll.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
builderAll.getPanel().getActionMap().put("close", cancelAction);

okButton.addActionListener(e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void actionPerformed(ActionEvent e) {
};
ActionMap am = centerPan.getActionMap();
InputMap im = centerPan.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", closeAction);

pack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void actionPerformed(ActionEvent e) {
JPanel mainPanel = new JPanel();
ActionMap am = mainPanel.getActionMap();
InputMap im = mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", closeAction);
mainPanel.setLayout(new BorderLayout());
mainPanel.add(sp, BorderLayout.CENTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public void actionPerformed(ActionEvent e) {
};
ActionMap am = contentPane.getActionMap();
InputMap im = contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", closeAction);

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/keyboard/KeyBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private KeyBinder() {
public static void bindCloseDialogKeyToCancelAction(JRootPane rootPane, Action cancelAction) {
InputMap im = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap am = rootPane.getActionMap();
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelAction);
}

Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/jabref/gui/keyboard/KeyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public enum KeyBinding {
CHECK_INTEGRITY("Check integrity", Localization.menuTitle("Check integrity"), "ctrl+F8", KeyBindingCategory.QUALITY),
CLEANUP("Cleanup", Localization.lang("Cleanup entries"), "alt+F8", KeyBindingCategory.QUALITY),
CLOSE_DATABASE("Close library", Localization.lang("Close library"), "ctrl+W", KeyBindingCategory.FILE),
CLOSE_DIALOG("Close dialog", Localization.lang("Close dialog"), "ESCAPE", KeyBindingCategory.FILE),
CLOSE_ENTRY_EDITOR("Close entry editor", Localization.lang("Close entry editor"), "Esc", KeyBindingCategory.VIEW),
CLOSE("Close dialog", Localization.lang("Close dialog"), "Esc", KeyBindingCategory.VIEW),
COPY("Copy", Localization.lang("Copy"), "ctrl+C", KeyBindingCategory.EDIT),
COPY_TITLE("Copy title", Localization.lang("Copy title"), "ctrl+shift+alt+T", KeyBindingCategory.EDIT),
COPY_CITE_BIBTEX_KEY("Copy \\cite{BibTeX key}", Localization.lang("Copy \\cite{BibTeX key}"), "ctrl+K", KeyBindingCategory.EDIT),
Expand Down Expand Up @@ -87,8 +86,7 @@ public enum KeyBinding {
UNABBREVIATE("Unabbreviate", Localization.lang("Unabbreviate"), "ctrl+alt+shift+A", KeyBindingCategory.TOOLS),
UNDO("Undo", Localization.lang("Undo"), "ctrl+Z", KeyBindingCategory.EDIT),
WEB_SEARCH("Web search", Localization.lang("Web search"), "alt+4", KeyBindingCategory.SEARCH),
WRITE_XMP("Write XMP", Localization.lang("Write XMP"), "F6", KeyBindingCategory.TOOLS),
CLEAR_SEARCH("Clear search", Localization.lang("Clear search"), "ESC", KeyBindingCategory.SEARCH);
WRITE_XMP("Write XMP", Localization.lang("Write XMP"), "F6", KeyBindingCategory.TOOLS);

private final String constant;
private final String localization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void actionPerformed(ActionEvent actionEvent) {
};
cancel.addActionListener(cancelAction);
builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
builder.getPanel().getActionMap().put("close", cancelAction);

}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/openoffice/CitationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void actionPerformed(ActionEvent actionEvent) {
cancel.addActionListener(cancelAction);

bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put
(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
bb.getPanel().getActionMap().put("close", cancelAction);

table.getColumnModel().getColumn(0).setPreferredWidth(580);
Expand Down Expand Up @@ -225,7 +225,7 @@ public void actionPerformed(ActionEvent actionEvent) {
cancelButton.addActionListener(cancelAction);

builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put
(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
builder.getPanel().getActionMap().put("close", cancelAction);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void actionPerformed(ActionEvent event) {

ActionMap am = bb.getPanel().getActionMap();
InputMap im = bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelListener);
im.put(KeyStroke.getKeyStroke("ENTER"), "enterOk");
am.put("enterOk", okListener);
Expand Down Expand Up @@ -517,8 +517,8 @@ public void actionPerformed(ActionEvent e) {

// Key bindings:
bb.getPanel()
.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
bb.getPanel().getActionMap().put("close", cancelAction);
pack();
setLocationRelativeTo(diag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private void jbInit() {
// Key bindings:
ActionMap am = buttons.getActionMap();
InputMap im = buttons.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", new AbstractAction() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void actionPerformed(ActionEvent e) {

// Key bindings:
bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
bb.getPanel().getActionMap().put("close", cancelAction);
pack();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void actionPerformed(ActionEvent event) {

ActionMap am = bb.getPanel().getActionMap();
InputMap im = bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", cancelListener);
im.put(KeyStroke.getKeyStroke("ENTER"), "enterOk");
am.put("enterOk", okListener);
Expand Down Expand Up @@ -477,7 +477,7 @@ public void actionPerformed(ActionEvent e) {

// Key bindings:
bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
bb.getPanel().getActionMap().put("close", cancelAction);
pack();
setLocationRelativeTo(diag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void showSettingsDialog(JFrame parent, PushToApplication toApp, JP
// Key bindings:
ActionMap am = bb.getPanel().getActionMap();
InputMap im = bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
am.put("close", new AbstractAction() {

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void actionPerformed(ActionEvent e) {
updateOpenCurrentResultsTooltip(globalSearch.isSelected());
focus();
event.consume();
} else if (keyBinding.get().equals(KeyBinding.CLEAR_SEARCH)) {
} else if (keyBinding.get().equals(KeyBinding.CLOSE)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer a switch case here like in the other dialogs to have it consistent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, but I'm too lazy right now to change it 😄

// Clear search and select first entry, if available
clearSearch();
frame.getCurrentBasePanel().getMainTable().getSelectionModel().selectFirst();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/search/SearchResultFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void actionPerformed(ActionEvent e) {

ActionMap actionMap = contentPane.getActionMap();
InputMap inputMap = contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close");
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DATABASE), "close");
actionMap.put("close", closeAction);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/util/BaseDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class BaseDialog<T> extends Dialog<T> {
protected BaseDialog() {
getDialogPane().getScene().setOnKeyPressed(event -> {
KeyBindingRepository keyBindingRepository = Globals.getKeyPrefs();
if (keyBindingRepository.checkKeyCombinationEquality(KeyBinding.CLOSE_DIALOG, event)) {
if (keyBindingRepository.checkKeyCombinationEquality(KeyBinding.CLOSE, event)) {
close();
}
});
Expand Down
Loading