From 2f11418847cf04e877a6a5272858d7f8fc4cd33d Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Wed, 5 May 2021 22:29:09 +0200 Subject: [PATCH 01/11] Added preset for new entry keybindings --- .../keybindings/KeyBindingsTabViewModel.java | 2 + .../presets/NewEntryBindingPreset.java | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java b/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java index e5cd3ab63a2..cf7332d5432 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java @@ -21,6 +21,7 @@ import org.jabref.gui.preferences.PreferenceTabViewModel; import org.jabref.gui.preferences.keybindings.presets.BashKeyBindingPreset; import org.jabref.gui.preferences.keybindings.presets.KeyBindingPreset; +import org.jabref.gui.preferences.keybindings.presets.NewEntryBindingPreset; import org.jabref.gui.util.OptionalObjectProperty; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.PreferencesService; @@ -45,6 +46,7 @@ public KeyBindingsTabViewModel(KeyBindingRepository keyBindingRepository, Dialog this.preferences = Objects.requireNonNull(preferences); keyBindingPresets.add(new BashKeyBindingPreset()); + keyBindingPresets.add(new NewEntryBindingPreset()); } /** diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java new file mode 100644 index 00000000000..7282a89bd39 --- /dev/null +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java @@ -0,0 +1,39 @@ +package org.jabref.gui.preferences.keybindings.presets; + +import java.util.HashMap; +import java.util.Map; + +import org.jabref.gui.keyboard.KeyBinding; + +public class NewEntryBindingPreset implements KeyBindingPreset { + + private static final Map KEY_BINDINGS = new HashMap<>(); + + static { + // Clear conflicting default presets + KEY_BINDINGS.put(KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE, ""); + + // Add new entry presets + KEY_BINDINGS.put(KeyBinding.NEW_ARTICLE,"Ctrl+shift+A"); + KEY_BINDINGS.put(KeyBinding.NEW_BOOK,"Ctrl+shift+B"); + KEY_BINDINGS.put(KeyBinding.NEW_ENTRY,"Ctrl+N"); + KEY_BINDINGS.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT,"Ctrl+shift+N"); + KEY_BINDINGS.put(KeyBinding.NEW_INBOOK,"Ctrl+shift+I"); + KEY_BINDINGS.put(KeyBinding.NEW_INPROCEEDINGS,"Ctrl+shift+C"); + KEY_BINDINGS.put(KeyBinding.NEW_MASTERSTHESIS,"Ctrl+shift+M"); + KEY_BINDINGS.put(KeyBinding.NEW_PHDTHESIS,"Ctrl+shift+T"); + KEY_BINDINGS.put(KeyBinding.NEW_PROCEEDINGS,"Ctrl+shift+P"); + KEY_BINDINGS.put(KeyBinding.NEW_TECHREPORT,"Ctrl+shift+R"); + KEY_BINDINGS.put(KeyBinding.NEW_UNPUBLISHED,"Ctrl+shift+U"); + } + + @Override + public String getName() { + return "New Entries"; + } + + @Override + public Map getKeyBindings() { + return KEY_BINDINGS; + } +} From e358264675f8de8538b7cb5f4c928ef4471c00c0 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Wed, 5 May 2021 22:41:52 +0200 Subject: [PATCH 02/11] Added defaults --- .../java/org/jabref/gui/keyboard/KeyBinding.java | 12 +++++++----- .../keybindings/presets/NewEntryBindingPreset.java | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index d6de24e3e62..2ffc7d4292b 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -61,17 +61,19 @@ public enum KeyBinding { IMPORT_INTO_CURRENT_DATABASE("Import into current library", Localization.lang("Import into current library"), "ctrl+I", KeyBindingCategory.FILE), IMPORT_INTO_NEW_DATABASE("Import into new library", Localization.lang("Import into new library"), "ctrl+alt+I", KeyBindingCategory.FILE), MERGE_ENTRIES("Merge entries", Localization.lang("Merge entries"), "ctrl+M", KeyBindingCategory.TOOLS), + NEW_ARTICLE("New article", Localization.lang("New article"), "ctrl+shift+A", KeyBindingCategory.BIBTEX), NEW_BOOK("New book", Localization.lang("New book"), "ctrl+shift+B", KeyBindingCategory.BIBTEX), NEW_ENTRY("New entry", Localization.lang("New entry"), "ctrl+N", KeyBindingCategory.BIBTEX), NEW_ENTRY_FROM_PLAIN_TEXT("New entry from plain text", Localization.lang("New entry from plain text"), "ctrl+shift+N", KeyBindingCategory.BIBTEX), - NEW_INBOOK("New inbook", Localization.lang("New inbook"), "", KeyBindingCategory.BIBTEX), - NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "", KeyBindingCategory.BIBTEX), - NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "", KeyBindingCategory.BIBTEX), - NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "", KeyBindingCategory.BIBTEX), - NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "", KeyBindingCategory.BIBTEX), + NEW_INBOOK("New inbook", Localization.lang("New inbook"), "Ctrl+shift+I", KeyBindingCategory.BIBTEX), + NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "Ctrl+shift+M", KeyBindingCategory.BIBTEX), + NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "Ctrl+shift+T", KeyBindingCategory.BIBTEX), + NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "Ctrl+shift+P", KeyBindingCategory.BIBTEX), + NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "Ctrl+shift+U", KeyBindingCategory.BIBTEX), NEW_TECHREPORT("New technical report", Localization.lang("New technical report"), "", KeyBindingCategory.BIBTEX), NEW_INPROCEEDINGS("New inproceesings", Localization.lang("New inproceedings"), "", KeyBindingCategory.BIBTEX), + NEXT_PREVIEW_LAYOUT("Next preview layout", Localization.lang("Next preview layout"), "F9", KeyBindingCategory.VIEW), NEXT_LIBRARY("Next library", Localization.lang("Next library"), "ctrl+PAGE_DOWN", KeyBindingCategory.VIEW), OPEN_CONSOLE("Open terminal here", Localization.lang("Open terminal here"), "ctrl+shift+L", KeyBindingCategory.TOOLS), diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java index 7282a89bd39..62b411c1688 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java @@ -12,6 +12,7 @@ public class NewEntryBindingPreset implements KeyBindingPreset { static { // Clear conflicting default presets KEY_BINDINGS.put(KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE, ""); + KEY_BINDINGS.put(KeyBinding.COPY_PREVIEW, ""); // Add new entry presets KEY_BINDINGS.put(KeyBinding.NEW_ARTICLE,"Ctrl+shift+A"); From a628236de4f278380da830dea3d160b00b042a4b Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Wed, 5 May 2021 22:44:00 +0200 Subject: [PATCH 03/11] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ff79e8072..98a49978a7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - Automatically found pdf files now have the linking button to the far left and uses a link icon with a plus instead of a briefcase. The file name also has lowered opacity(70%) until added. [#3607](https://github.com/JabRef/jabref/issues/3607) - We simplified the select entry type form by splitting it into two parts ("Recommended" and "Others") based on internal usage data. [#6730](https://github.com/JabRef/jabref/issues/6730) - The export to MS Office XML now uses the month name for the field `Month` instead of the two digit number [forum#2685](https://discourse.jabref.org/t/export-month-as-text-not-number/2685) +- We reintroduced messing default keybindings for new entries [#7705](https://github.com/JabRef/jabref/pull/7705) ### Fixed From 6ad98a9607520993d280854d7bd8371d3dfa269f Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Wed, 5 May 2021 22:55:11 +0200 Subject: [PATCH 04/11] Fixed inconsistency --- src/main/java/org/jabref/gui/entryeditor/EntryEditor.java | 2 +- src/main/java/org/jabref/gui/keyboard/KeyBinding.java | 3 +-- src/main/resources/l10n/JabRef_en.properties | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 026d4ba3a5d..7665da90056 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -189,7 +189,7 @@ private void setupKeyBindings() { event.consume(); break; case CLOSE: - case CLOSE_ENTRY: + case EDIT_ENTRY: close(); event.consume(); break; diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index 2ffc7d4292b..c1231716893 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -29,7 +29,6 @@ public enum KeyBinding { CHECK_INTEGRITY("Check integrity", Localization.lang("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_ENTRY("Close entry", Localization.lang("Close entry"), "ctrl+E", 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), @@ -44,7 +43,7 @@ public enum KeyBinding { DELETE_ENTRY("Delete entry", Localization.lang("Delete entry"), "DELETE", KeyBindingCategory.BIBTEX), DEFAULT_DIALOG_ACTION("Execute default action in dialog", Localization.lang("Execute default action in dialog"), "ctrl+ENTER", KeyBindingCategory.VIEW), DOWNLOAD_FULL_TEXT("Download full text documents", Localization.lang("Download full text documents"), "alt+F7", KeyBindingCategory.QUALITY), - EDIT_ENTRY("Edit entry", Localization.lang("Edit entry"), "ctrl+E", KeyBindingCategory.BIBTEX), + EDIT_ENTRY("Open / close entry editor", Localization.lang("Open / close entry editor"), "ctrl+E", KeyBindingCategory.VIEW), EXPORT("Export", Localization.lang("Export"), "ctrl+alt+e", KeyBindingCategory.FILE), EXPORT_SELECTED("Export Selected", Localization.lang("Export selected entries"), "ctrl+shift+e", KeyBindingCategory.FILE), EDIT_STRINGS("Edit strings", Localization.lang("Edit strings"), "ctrl+T", KeyBindingCategory.BIBTEX), diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 7bbc176507b..d6f7a5298f0 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -137,7 +137,7 @@ Clear=Clear Clear\ fields=Clear fields -Close\ entry=Close entry +Open\ /\ close\ entry\ editor=Open / close entry editor Close\ dialog=Close dialog @@ -269,7 +269,6 @@ Each\ line\ must\ be\ of\ the\ following\ form\:\ \'tab\:field1;field2;...;field Edit=Edit -Edit\ entry=Edit entry Edit\ file\ type=Edit file type Edit\ group=Edit group From 46a7c6fb53786a35818ea5bc8fdce0637a5868d5 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Wed, 5 May 2021 22:59:06 +0200 Subject: [PATCH 05/11] CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98a49978a7e..075678be41a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We added a feature that allows the user to copy highlighted text in the preview window. [#6962](https://github.com/JabRef/jabref/issues/6962) - We added a feature that allows you to create new BibEntry via paste arxivId [#2292](https://github.com/JabRef/jabref/issues/2292) - We added a feature that allows the user to choose whether to trust the target site when unable to find a valid certification path from the file download site. [#7616](https://github.com/JabRef/jabref/issues/7616) +- We added a keybinding preset for new entries. [#7705](https://github.com/JabRef/jabref/issues/7705) ### Changed @@ -36,7 +37,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - Automatically found pdf files now have the linking button to the far left and uses a link icon with a plus instead of a briefcase. The file name also has lowered opacity(70%) until added. [#3607](https://github.com/JabRef/jabref/issues/3607) - We simplified the select entry type form by splitting it into two parts ("Recommended" and "Others") based on internal usage data. [#6730](https://github.com/JabRef/jabref/issues/6730) - The export to MS Office XML now uses the month name for the field `Month` instead of the two digit number [forum#2685](https://discourse.jabref.org/t/export-month-as-text-not-number/2685) -- We reintroduced messing default keybindings for new entries [#7705](https://github.com/JabRef/jabref/pull/7705) +- We reintroduced missing default keybindings for new entries and added a preset for [#7346](https://github.com/JabRef/jabref/issues/7346) [#7439](https://github.com/JabRef/jabref/issues/7439) ### Fixed From bf001e11a947fe6f0e046a693c19cf3c5a854039 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Wed, 5 May 2021 23:00:03 +0200 Subject: [PATCH 06/11] CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 075678be41a..2a58a43b1e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - Automatically found pdf files now have the linking button to the far left and uses a link icon with a plus instead of a briefcase. The file name also has lowered opacity(70%) until added. [#3607](https://github.com/JabRef/jabref/issues/3607) - We simplified the select entry type form by splitting it into two parts ("Recommended" and "Others") based on internal usage data. [#6730](https://github.com/JabRef/jabref/issues/6730) - The export to MS Office XML now uses the month name for the field `Month` instead of the two digit number [forum#2685](https://discourse.jabref.org/t/export-month-as-text-not-number/2685) -- We reintroduced missing default keybindings for new entries and added a preset for [#7346](https://github.com/JabRef/jabref/issues/7346) [#7439](https://github.com/JabRef/jabref/issues/7439) +- We reintroduced missing default keybindings for new entries. [#7346](https://github.com/JabRef/jabref/issues/7346) [#7439](https://github.com/JabRef/jabref/issues/7439) ### Fixed From bb52b5472cb2bbc173100f29a1d05a50dfd0659d Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Wed, 5 May 2021 23:08:47 +0200 Subject: [PATCH 07/11] Checkstyle --- .../presets/NewEntryBindingPreset.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java index 62b411c1688..7dbb9a25c5d 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java @@ -15,17 +15,17 @@ public class NewEntryBindingPreset implements KeyBindingPreset { KEY_BINDINGS.put(KeyBinding.COPY_PREVIEW, ""); // Add new entry presets - KEY_BINDINGS.put(KeyBinding.NEW_ARTICLE,"Ctrl+shift+A"); - KEY_BINDINGS.put(KeyBinding.NEW_BOOK,"Ctrl+shift+B"); - KEY_BINDINGS.put(KeyBinding.NEW_ENTRY,"Ctrl+N"); - KEY_BINDINGS.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT,"Ctrl+shift+N"); - KEY_BINDINGS.put(KeyBinding.NEW_INBOOK,"Ctrl+shift+I"); - KEY_BINDINGS.put(KeyBinding.NEW_INPROCEEDINGS,"Ctrl+shift+C"); - KEY_BINDINGS.put(KeyBinding.NEW_MASTERSTHESIS,"Ctrl+shift+M"); - KEY_BINDINGS.put(KeyBinding.NEW_PHDTHESIS,"Ctrl+shift+T"); - KEY_BINDINGS.put(KeyBinding.NEW_PROCEEDINGS,"Ctrl+shift+P"); - KEY_BINDINGS.put(KeyBinding.NEW_TECHREPORT,"Ctrl+shift+R"); - KEY_BINDINGS.put(KeyBinding.NEW_UNPUBLISHED,"Ctrl+shift+U"); + KEY_BINDINGS.put(KeyBinding.NEW_ARTICLE, "Ctrl+shift+A"); + KEY_BINDINGS.put(KeyBinding.NEW_BOOK, "Ctrl+shift+B"); + KEY_BINDINGS.put(KeyBinding.NEW_ENTRY, "Ctrl+N"); + KEY_BINDINGS.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT, "Ctrl+shift+N"); + KEY_BINDINGS.put(KeyBinding.NEW_INBOOK, "Ctrl+shift+I"); + KEY_BINDINGS.put(KeyBinding.NEW_INPROCEEDINGS, "Ctrl+shift+C"); + KEY_BINDINGS.put(KeyBinding.NEW_MASTERSTHESIS, "Ctrl+shift+M"); + KEY_BINDINGS.put(KeyBinding.NEW_PHDTHESIS, "Ctrl+shift+T"); + KEY_BINDINGS.put(KeyBinding.NEW_PROCEEDINGS, "Ctrl+shift+P"); + KEY_BINDINGS.put(KeyBinding.NEW_TECHREPORT, "Ctrl+shift+R"); + KEY_BINDINGS.put(KeyBinding.NEW_UNPUBLISHED, "Ctrl+shift+U"); } @Override From 055da2070d780983fab4a539e3ca19a47db3570a Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 6 May 2021 08:26:25 +0200 Subject: [PATCH 08/11] lowercase ctrl --- src/main/java/org/jabref/gui/keyboard/KeyBinding.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index c1231716893..1aa41a08ae6 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -65,11 +65,11 @@ public enum KeyBinding { NEW_BOOK("New book", Localization.lang("New book"), "ctrl+shift+B", KeyBindingCategory.BIBTEX), NEW_ENTRY("New entry", Localization.lang("New entry"), "ctrl+N", KeyBindingCategory.BIBTEX), NEW_ENTRY_FROM_PLAIN_TEXT("New entry from plain text", Localization.lang("New entry from plain text"), "ctrl+shift+N", KeyBindingCategory.BIBTEX), - NEW_INBOOK("New inbook", Localization.lang("New inbook"), "Ctrl+shift+I", KeyBindingCategory.BIBTEX), - NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "Ctrl+shift+M", KeyBindingCategory.BIBTEX), - NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "Ctrl+shift+T", KeyBindingCategory.BIBTEX), - NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "Ctrl+shift+P", KeyBindingCategory.BIBTEX), - NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "Ctrl+shift+U", KeyBindingCategory.BIBTEX), + NEW_INBOOK("New inbook", Localization.lang("New inbook"), "ctrl+shift+I", KeyBindingCategory.BIBTEX), + NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "ctrl+shift+M", KeyBindingCategory.BIBTEX), + NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "ctrl+shift+T", KeyBindingCategory.BIBTEX), + NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "ctrl+shift+P", KeyBindingCategory.BIBTEX), + NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "ctrl+shift+U", KeyBindingCategory.BIBTEX), NEW_TECHREPORT("New technical report", Localization.lang("New technical report"), "", KeyBindingCategory.BIBTEX), NEW_INPROCEEDINGS("New inproceesings", Localization.lang("New inproceedings"), "", KeyBindingCategory.BIBTEX), From 0c1954c0b5a9987c2fa81c2906b657ae0b46eb9d Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Fri, 7 May 2021 00:40:56 +0200 Subject: [PATCH 09/11] Removed static variable --- .../presets/BashKeyBindingPreset.java | 46 +++++++++---------- .../presets/NewEntryBindingPreset.java | 42 ++++++++--------- 2 files changed, 42 insertions(+), 46 deletions(-) diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/BashKeyBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/BashKeyBindingPreset.java index eceaa0d577f..72265447c39 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/presets/BashKeyBindingPreset.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/BashKeyBindingPreset.java @@ -7,29 +7,6 @@ public class BashKeyBindingPreset implements KeyBindingPreset { - private static final Map KEY_BINDINGS = new HashMap<>(); - - static { - KEY_BINDINGS.put(KeyBinding.EDITOR_DELETE, "ctrl+D"); - // DELETE BACKWARDS = Rubout - KEY_BINDINGS.put(KeyBinding.EDITOR_BACKWARD, "ctrl+B"); - KEY_BINDINGS.put(KeyBinding.EDITOR_FORWARD, "ctrl+F"); - KEY_BINDINGS.put(KeyBinding.EDITOR_WORD_BACKWARD, "alt+B"); - KEY_BINDINGS.put(KeyBinding.EDITOR_WORD_FORWARD, "alt+F"); - KEY_BINDINGS.put(KeyBinding.EDITOR_BEGINNING, "ctrl+A"); - KEY_BINDINGS.put(KeyBinding.EDITOR_END, "ctrl+E"); - KEY_BINDINGS.put(KeyBinding.EDITOR_BEGINNING_DOC, "alt+LESS"); - KEY_BINDINGS.put(KeyBinding.EDITOR_END_DOC, "alt+shift+LESS"); - KEY_BINDINGS.put(KeyBinding.EDITOR_UP, "ctrl+P"); - KEY_BINDINGS.put(KeyBinding.EDITOR_DOWN, "ctrl+N"); - KEY_BINDINGS.put(KeyBinding.EDITOR_CAPITALIZE, "alt+C"); - KEY_BINDINGS.put(KeyBinding.EDITOR_LOWERCASE, "alt+L"); - KEY_BINDINGS.put(KeyBinding.EDITOR_UPPERCASE, "alt+U"); - KEY_BINDINGS.put(KeyBinding.EDITOR_KILL_LINE, "ctrl+K"); - KEY_BINDINGS.put(KeyBinding.EDITOR_KILL_WORD, "alt+D"); - KEY_BINDINGS.put(KeyBinding.EDITOR_KILL_WORD_BACKWARD, "alt+DELETE"); - } - @Override public String getName() { return "Bash"; @@ -37,6 +14,27 @@ public String getName() { @Override public Map getKeyBindings() { - return KEY_BINDINGS; + final Map keyBindings = new HashMap<>(); + + keyBindings.put(KeyBinding.EDITOR_DELETE, "ctrl+D"); + // DELETE BACKWARDS = Rubout + keyBindings.put(KeyBinding.EDITOR_BACKWARD, "ctrl+B"); + keyBindings.put(KeyBinding.EDITOR_FORWARD, "ctrl+F"); + keyBindings.put(KeyBinding.EDITOR_WORD_BACKWARD, "alt+B"); + keyBindings.put(KeyBinding.EDITOR_WORD_FORWARD, "alt+F"); + keyBindings.put(KeyBinding.EDITOR_BEGINNING, "ctrl+A"); + keyBindings.put(KeyBinding.EDITOR_END, "ctrl+E"); + keyBindings.put(KeyBinding.EDITOR_BEGINNING_DOC, "alt+LESS"); + keyBindings.put(KeyBinding.EDITOR_END_DOC, "alt+shift+LESS"); + keyBindings.put(KeyBinding.EDITOR_UP, "ctrl+P"); + keyBindings.put(KeyBinding.EDITOR_DOWN, "ctrl+N"); + keyBindings.put(KeyBinding.EDITOR_CAPITALIZE, "alt+C"); + keyBindings.put(KeyBinding.EDITOR_LOWERCASE, "alt+L"); + keyBindings.put(KeyBinding.EDITOR_UPPERCASE, "alt+U"); + keyBindings.put(KeyBinding.EDITOR_KILL_LINE, "ctrl+K"); + keyBindings.put(KeyBinding.EDITOR_KILL_WORD, "alt+D"); + keyBindings.put(KeyBinding.EDITOR_KILL_WORD_BACKWARD, "alt+DELETE"); + + return keyBindings; } } diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java index 7dbb9a25c5d..99b49b0eda2 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java @@ -7,27 +7,6 @@ public class NewEntryBindingPreset implements KeyBindingPreset { - private static final Map KEY_BINDINGS = new HashMap<>(); - - static { - // Clear conflicting default presets - KEY_BINDINGS.put(KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE, ""); - KEY_BINDINGS.put(KeyBinding.COPY_PREVIEW, ""); - - // Add new entry presets - KEY_BINDINGS.put(KeyBinding.NEW_ARTICLE, "Ctrl+shift+A"); - KEY_BINDINGS.put(KeyBinding.NEW_BOOK, "Ctrl+shift+B"); - KEY_BINDINGS.put(KeyBinding.NEW_ENTRY, "Ctrl+N"); - KEY_BINDINGS.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT, "Ctrl+shift+N"); - KEY_BINDINGS.put(KeyBinding.NEW_INBOOK, "Ctrl+shift+I"); - KEY_BINDINGS.put(KeyBinding.NEW_INPROCEEDINGS, "Ctrl+shift+C"); - KEY_BINDINGS.put(KeyBinding.NEW_MASTERSTHESIS, "Ctrl+shift+M"); - KEY_BINDINGS.put(KeyBinding.NEW_PHDTHESIS, "Ctrl+shift+T"); - KEY_BINDINGS.put(KeyBinding.NEW_PROCEEDINGS, "Ctrl+shift+P"); - KEY_BINDINGS.put(KeyBinding.NEW_TECHREPORT, "Ctrl+shift+R"); - KEY_BINDINGS.put(KeyBinding.NEW_UNPUBLISHED, "Ctrl+shift+U"); - } - @Override public String getName() { return "New Entries"; @@ -35,6 +14,25 @@ public String getName() { @Override public Map getKeyBindings() { - return KEY_BINDINGS; + final Map keyBindings = new HashMap<>(); + + // Clear conflicting default presets + keyBindings.put(KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE, ""); + keyBindings.put(KeyBinding.COPY_PREVIEW, ""); + + // Add new entry presets + keyBindings.put(KeyBinding.NEW_ARTICLE, "Ctrl+shift+A"); + keyBindings.put(KeyBinding.NEW_BOOK, "Ctrl+shift+B"); + keyBindings.put(KeyBinding.NEW_ENTRY, "Ctrl+N"); + keyBindings.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT, "Ctrl+shift+N"); + keyBindings.put(KeyBinding.NEW_INBOOK, "Ctrl+shift+I"); + keyBindings.put(KeyBinding.NEW_INPROCEEDINGS, "Ctrl+shift+C"); + keyBindings.put(KeyBinding.NEW_MASTERSTHESIS, "Ctrl+shift+M"); + keyBindings.put(KeyBinding.NEW_PHDTHESIS, "Ctrl+shift+T"); + keyBindings.put(KeyBinding.NEW_PROCEEDINGS, "Ctrl+shift+P"); + keyBindings.put(KeyBinding.NEW_TECHREPORT, "Ctrl+shift+R"); + keyBindings.put(KeyBinding.NEW_UNPUBLISHED, "Ctrl+shift+U"); + + return keyBindings; } } From 6920fadeed752dd53a97c219059b7ce9162a5a76 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Mon, 10 May 2021 22:11:12 +0200 Subject: [PATCH 10/11] Reworded and localized --- .../preferences/keybindings/presets/NewEntryBindingPreset.java | 3 ++- src/main/resources/l10n/JabRef_en.properties | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java index 99b49b0eda2..f63d74838c8 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java @@ -4,12 +4,13 @@ import java.util.Map; import org.jabref.gui.keyboard.KeyBinding; +import org.jabref.logic.l10n.Localization; public class NewEntryBindingPreset implements KeyBindingPreset { @Override public String getName() { - return "New Entries"; + return Localization.lang("New entry by type"); } @Override diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index d6f7a5298f0..bd8194bb584 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2299,3 +2299,4 @@ Download\ operation\ canceled.=Download operation canceled. Convert\ timestamp\ field\ to\ field\ 'creationdate'=Convert timestamp field to field 'creationdate' Convert\ timestamp\ field\ to\ field\ 'modificationdate'=Convert timestamp field to field 'modificationdate' +New\ entry\ by\ type=New entry by type From 8c6ab3cda5ec31817ef64bd12820a2cc756cedd4 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Mon, 10 May 2021 22:14:14 +0200 Subject: [PATCH 11/11] Lowercased Ctrl --- .../presets/NewEntryBindingPreset.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java index f63d74838c8..c86f0647cc0 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java @@ -22,17 +22,17 @@ public Map getKeyBindings() { keyBindings.put(KeyBinding.COPY_PREVIEW, ""); // Add new entry presets - keyBindings.put(KeyBinding.NEW_ARTICLE, "Ctrl+shift+A"); - keyBindings.put(KeyBinding.NEW_BOOK, "Ctrl+shift+B"); - keyBindings.put(KeyBinding.NEW_ENTRY, "Ctrl+N"); - keyBindings.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT, "Ctrl+shift+N"); - keyBindings.put(KeyBinding.NEW_INBOOK, "Ctrl+shift+I"); - keyBindings.put(KeyBinding.NEW_INPROCEEDINGS, "Ctrl+shift+C"); - keyBindings.put(KeyBinding.NEW_MASTERSTHESIS, "Ctrl+shift+M"); - keyBindings.put(KeyBinding.NEW_PHDTHESIS, "Ctrl+shift+T"); - keyBindings.put(KeyBinding.NEW_PROCEEDINGS, "Ctrl+shift+P"); - keyBindings.put(KeyBinding.NEW_TECHREPORT, "Ctrl+shift+R"); - keyBindings.put(KeyBinding.NEW_UNPUBLISHED, "Ctrl+shift+U"); + keyBindings.put(KeyBinding.NEW_ARTICLE, "ctrl+shift+A"); + keyBindings.put(KeyBinding.NEW_BOOK, "ctrl+shift+B"); + keyBindings.put(KeyBinding.NEW_ENTRY, "ctrl+N"); + keyBindings.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT, "ctrl+shift+N"); + keyBindings.put(KeyBinding.NEW_INBOOK, "ctrl+shift+I"); + keyBindings.put(KeyBinding.NEW_INPROCEEDINGS, "ctrl+shift+C"); + keyBindings.put(KeyBinding.NEW_MASTERSTHESIS, "ctrl+shift+M"); + keyBindings.put(KeyBinding.NEW_PHDTHESIS, "ctrl+shift+T"); + keyBindings.put(KeyBinding.NEW_PROCEEDINGS, "ctrl+shift+P"); + keyBindings.put(KeyBinding.NEW_TECHREPORT, "ctrl+shift+R"); + keyBindings.put(KeyBinding.NEW_UNPUBLISHED, "ctrl+shift+U"); return keyBindings; }