From 5158e87d25429fdbdaac3a2fd91eedcd8a0fc6ec Mon Sep 17 00:00:00 2001 From: Gennadiy Stakhovskiy Date: Tue, 29 Sep 2020 12:07:29 +0300 Subject: [PATCH 1/8] Corrected shortcut --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/keyboard/KeyBinding.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ef2a053543..c0a11bf65ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where no longer a warning was displayed when inserting references into LibreOffice with an invalid "ReferenceParagraphFormat". [#6907](https://github.com/JabRef/jabref/pull/60907). - We fixed an issue where a selected field was not removed after the first click in the custom entry types dialog [#6934](https://github.com/JabRef/jabref/issues/6934) - We fixed an issue where a remove icon was shown for standard entry types in the custom entry types dialog [6906](https://github.com/JabRef/jabref/issues/6906) +- We fixed an issue, when pulling changes from shared database via shortcut caused creation a new new tech report [6867](https://github.com/JabRef/jabref/issues/6867) ### Removed diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index e6afb160540..9b00d591dca 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -61,7 +61,7 @@ public enum KeyBinding { OPEN_OPEN_OFFICE_LIBRE_OFFICE_CONNECTION("Open OpenOffice/LibreOffice connection", Localization.lang("Open OpenOffice/LibreOffice connection"), "alt+0", KeyBindingCategory.TOOLS), OPEN_URL_OR_DOI("Open URL or DOI", Localization.lang("Open URL or DOI"), "F3", KeyBindingCategory.TOOLS), PASTE("Paste", Localization.lang("Paste"), "ctrl+V", KeyBindingCategory.EDIT), - PULL_CHANGES_FROM_SHARED_DATABASE("Pull changes from shared database", Localization.lang("Pull changes from shared database"), "ctrl+shift+R", KeyBindingCategory.FILE), + PULL_CHANGES_FROM_SHARED_DATABASE("Pull changes from shared database", Localization.lang("Pull changes from shared database"), "alt+shift+R", KeyBindingCategory.FILE), PREAMBLE_EDITOR_STORE_CHANGES("Preamble editor, store changes", Localization.lang("Preamble editor, store changes"), "alt+S", KeyBindingCategory.FILE), PREVIOUS_PREVIEW_LAYOUT("Previous preview layout", Localization.lang("Previous preview layout"), "shift+F9", KeyBindingCategory.VIEW), PREVIOUS_LIBRARY("Previous library", Localization.lang("Previous library"), "ctrl+PAGE_UP", KeyBindingCategory.VIEW), From 62a4fa89a9fc9796c2bf14963300e98d0015111d Mon Sep 17 00:00:00 2001 From: Gennadiy Stakhovskiy Date: Tue, 13 Oct 2020 14:58:26 +0300 Subject: [PATCH 2/8] 6796 fixed --- .../java/org/jabref/gui/keyboard/KeyBinding.java | 15 ++++++++------- .../jabref/gui/keyboard/KeyBindingRepository.java | 6 ++++-- src/main/resources/l10n/JabRef_en.properties | 3 ++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index 9b00d591dca..c0340cb164e 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -46,12 +46,13 @@ 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_TECHREPORT("New technical report", Localization.lang("New technical report"), "ctrl+shift+R", KeyBindingCategory.BIBTEX), + NEW_INBOOK("New inbook", Localization.lang("New inbook"), "alt+shift+I", KeyBindingCategory.BIBTEX), + NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "alt+shift+M", KeyBindingCategory.BIBTEX), + NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "alt+shift+T", KeyBindingCategory.BIBTEX), + NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "alt+shift+P", KeyBindingCategory.BIBTEX), + NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "alt+shift+U", KeyBindingCategory.BIBTEX), + NEW_TECHREPORT("New technical report", Localization.lang("New technical report"), "alt+shift+R", KeyBindingCategory.BIBTEX), + NEW_INPROCEEDINGS("New inproceesings", Localization.lang("New inproceedings"), "alt+shift+C", 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), @@ -61,7 +62,7 @@ public enum KeyBinding { OPEN_OPEN_OFFICE_LIBRE_OFFICE_CONNECTION("Open OpenOffice/LibreOffice connection", Localization.lang("Open OpenOffice/LibreOffice connection"), "alt+0", KeyBindingCategory.TOOLS), OPEN_URL_OR_DOI("Open URL or DOI", Localization.lang("Open URL or DOI"), "F3", KeyBindingCategory.TOOLS), PASTE("Paste", Localization.lang("Paste"), "ctrl+V", KeyBindingCategory.EDIT), - PULL_CHANGES_FROM_SHARED_DATABASE("Pull changes from shared database", Localization.lang("Pull changes from shared database"), "alt+shift+R", KeyBindingCategory.FILE), + PULL_CHANGES_FROM_SHARED_DATABASE("Pull changes from shared database", Localization.lang("Pull changes from shared database"), "alt+shift+D", KeyBindingCategory.FILE), PREAMBLE_EDITOR_STORE_CHANGES("Preamble editor, store changes", Localization.lang("Preamble editor, store changes"), "alt+S", KeyBindingCategory.FILE), PREVIOUS_PREVIEW_LAYOUT("Previous preview layout", Localization.lang("Previous preview layout"), "shift+F9", KeyBindingCategory.VIEW), PREVIOUS_LIBRARY("Previous library", Localization.lang("Previous library"), "ctrl+PAGE_UP", KeyBindingCategory.VIEW), diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java index de219527ed5..06bd719809f 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java @@ -113,8 +113,10 @@ public int size() { public Optional mapToKeyBinding(KeyEvent keyEvent) { for (KeyBinding binding : KeyBinding.values()) { - if (checkKeyCombinationEquality(binding, keyEvent)) { - return Optional.of(binding); + if (!binding.getDefaultKeyBinding().isEmpty()){ + if (checkKeyCombinationEquality(binding, keyEvent)) { + return Optional.of(binding); + } } } return Optional.empty(); diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index df341a21cd6..0fa61de1903 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2257,6 +2257,7 @@ Previous\ preview\ style=Previous preview style (\ Note\:\ Press\ return\ to\ commit\ changes\ in\ the\ table\!\ )=( Note\: Press return to commit changes in the table\! ) Reset=Reset +New\ inproceedings=New inproceedings Reset\ entry\ types\ and\ fields\ to\ defaults=Reset entry types and fields to defaults This\ will\ reset\ all\ entry\ types\ to\ their\ default\ values\ and\ remove\ all\ custom\ entry\ types=This will reset all entry types to their default values and remove all custom entry types Replace\ tabs\ with\ space=Replace tabs with space @@ -2272,4 +2273,4 @@ This\ query\ uses\ unsupported\ syntax.=This query uses unsupported syntax. Check\ Proxy\ Setting=Check Proxy Setting Check\ connection=Check connection Connection\ failed\!=Connection failed\! -Connection\ successful\!=Connection successful\! +Connection\ successful\!=Connection successful! From 692b398f89070458935ff77899761e39215afeee Mon Sep 17 00:00:00 2001 From: Gennadiy Stakhovskiy Date: Wed, 14 Oct 2020 10:12:58 +0300 Subject: [PATCH 3/8] Added new entry in JabRef_en.properties file Corrected TypeEditorViewModel & KeyBinding --- src/main/java/org/jabref/gui/JabRefFrame.java | 3 +++ .../jabref/gui/fieldeditors/TypeEditorViewModel.java | 3 ++- src/main/java/org/jabref/gui/keyboard/KeyBinding.java | 10 +++++----- src/main/resources/l10n/JabRef_en.properties | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index e335117a6e2..929215c8911 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -275,6 +275,9 @@ private void initKeyBindings() { case NEW_UNPUBLISHED: new NewEntryAction(this, StandardEntryType.Unpublished, dialogService, prefs, stateManager).execute(); break; + case NEW_INPROCEEDINGS: + new NewEntryAction(this, StandardEntryType.InProceedings, dialogService, prefs, stateManager).execute(); + break; case PASTE: if (OS.OS_X) { // Workaround for a jdk issue that executes paste twice when using cmd+v in a TextField // Extra workaround for CodeArea, which does not inherit from TextInputControl diff --git a/src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java index c4f64880e55..79a6eff2265 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java @@ -10,7 +10,7 @@ public class TypeEditorViewModel extends MapBasedEditorViewModel { - private BiMap itemMap = HashBiMap.create(8); + private BiMap itemMap = HashBiMap.create(9); public TypeEditorViewModel(Field field, SuggestionProvider suggestionProvider, FieldCheckers fieldCheckers) { super(field, suggestionProvider, fieldCheckers); @@ -23,6 +23,7 @@ public TypeEditorViewModel(Field field, SuggestionProvider suggestionProvider itemMap.put("software", Localization.lang("Software")); itemMap.put("datacd", Localization.lang("Data CD")); itemMap.put("audiocd", Localization.lang("Audio CD")); + itemMap.put("inproceedings", Localization.lang("InProceedings")); } @Override diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index c0340cb164e..20ff5ccd4ec 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -46,11 +46,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"), "alt+shift+I", KeyBindingCategory.BIBTEX), - NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "alt+shift+M", KeyBindingCategory.BIBTEX), - NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "alt+shift+T", KeyBindingCategory.BIBTEX), - NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "alt+shift+P", KeyBindingCategory.BIBTEX), - NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "alt+shift+U", 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_TECHREPORT("New technical report", Localization.lang("New technical report"), "alt+shift+R", KeyBindingCategory.BIBTEX), NEW_INPROCEEDINGS("New inproceesings", Localization.lang("New inproceedings"), "alt+shift+C", KeyBindingCategory.BIBTEX), NEXT_PREVIEW_LAYOUT("Next preview layout", Localization.lang("Next preview layout"), "F9", KeyBindingCategory.VIEW), diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 0fa61de1903..90063ba8c8a 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2009,6 +2009,7 @@ Open\ files...=Open files... Affected\ fields\:=Affected fields: Show\ preview\ as\ a\ tab\ in\ entry\ editor=Show preview as a tab in entry editor Font=Font +InProceedings=An article in a conference proceedings Visual\ theme=Visual theme Light\ theme=Light theme Dark\ theme=Dark theme From bf6c0f7dc554eba9dae3ab5eba03078990890dc8 Mon Sep 17 00:00:00 2001 From: Gennadiy Stakhovskiy Date: Wed, 14 Oct 2020 15:12:26 +0300 Subject: [PATCH 4/8] Save before making changes --- CHANGELOG.md | 2 +- .../org/jabref/gui/fieldeditors/TypeEditorViewModel.java | 3 +-- src/main/java/org/jabref/gui/keyboard/KeyBinding.java | 6 +++--- .../java/org/jabref/gui/keyboard/KeyBindingRepository.java | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 633674954c0..0adf8dc06fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,7 +54,7 @@ inserting new citations in a OpenOffic/LibreOffice document. [#6957](https://git - We fixed an issue with the python script used by browser plugins that failed to locate JabRef if not installed in its default location. [#6963](https://github.com/JabRef/jabref/pull/6963/files) - We fixed an issue where identity column header had incorrect foreground color in the Dark theme. [#6796](https://github.com/JabRef/jabref/issues/6796) - We fixed an issue where clicking on Collapse All button in the Search for Unlinked Local Files expanded the directory structure erroneously [#6848](https://github.com/JabRef/jabref/issues/6848) - +- We fixed an issue, when pulling changes from shared database via shortcut caused creation a new new tech report [6867](https://github.com/JabRef/jabref/issues/6867) ### Removed ## [5.1] – 2020-08-30 diff --git a/src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java index 79a6eff2265..c4f64880e55 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java @@ -10,7 +10,7 @@ public class TypeEditorViewModel extends MapBasedEditorViewModel { - private BiMap itemMap = HashBiMap.create(9); + private BiMap itemMap = HashBiMap.create(8); public TypeEditorViewModel(Field field, SuggestionProvider suggestionProvider, FieldCheckers fieldCheckers) { super(field, suggestionProvider, fieldCheckers); @@ -23,7 +23,6 @@ public TypeEditorViewModel(Field field, SuggestionProvider suggestionProvider itemMap.put("software", Localization.lang("Software")); itemMap.put("datacd", Localization.lang("Data CD")); itemMap.put("audiocd", Localization.lang("Audio CD")); - itemMap.put("inproceedings", Localization.lang("InProceedings")); } @Override diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index 20ff5ccd4ec..06bac3e5c89 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -51,8 +51,8 @@ public enum KeyBinding { 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_TECHREPORT("New technical report", Localization.lang("New technical report"), "alt+shift+R", KeyBindingCategory.BIBTEX), - NEW_INPROCEEDINGS("New inproceesings", Localization.lang("New inproceedings"), "alt+shift+C", 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), @@ -62,7 +62,7 @@ public enum KeyBinding { OPEN_OPEN_OFFICE_LIBRE_OFFICE_CONNECTION("Open OpenOffice/LibreOffice connection", Localization.lang("Open OpenOffice/LibreOffice connection"), "alt+0", KeyBindingCategory.TOOLS), OPEN_URL_OR_DOI("Open URL or DOI", Localization.lang("Open URL or DOI"), "F3", KeyBindingCategory.TOOLS), PASTE("Paste", Localization.lang("Paste"), "ctrl+V", KeyBindingCategory.EDIT), - PULL_CHANGES_FROM_SHARED_DATABASE("Pull changes from shared database", Localization.lang("Pull changes from shared database"), "alt+shift+D", KeyBindingCategory.FILE), + PULL_CHANGES_FROM_SHARED_DATABASE("Pull changes from shared database", Localization.lang("Pull changes from shared database"), "ctrl+shift+R", KeyBindingCategory.FILE), PREAMBLE_EDITOR_STORE_CHANGES("Preamble editor, store changes", Localization.lang("Preamble editor, store changes"), "alt+S", KeyBindingCategory.FILE), PREVIOUS_PREVIEW_LAYOUT("Previous preview layout", Localization.lang("Previous preview layout"), "shift+F9", KeyBindingCategory.VIEW), PREVIOUS_LIBRARY("Previous library", Localization.lang("Previous library"), "ctrl+PAGE_UP", KeyBindingCategory.VIEW), diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java index 06bd719809f..0efb14b8388 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java @@ -112,7 +112,7 @@ public int size() { } public Optional mapToKeyBinding(KeyEvent keyEvent) { - for (KeyBinding binding : KeyBinding.values()) { + for (KeyBinding binding : KeyBinding.values()){ if (!binding.getDefaultKeyBinding().isEmpty()){ if (checkKeyCombinationEquality(binding, keyEvent)) { return Optional.of(binding); @@ -127,7 +127,6 @@ public KeyCombination getKeyCombination(KeyBinding bindName) { if (OS.OS_X) { binding = binding.replace("ctrl", "meta"); } - return KeyCombination.valueOf(binding); } From 3c3f91892f15c07a4990af1e7b03471b8e0f0992 Mon Sep 17 00:00:00 2001 From: Gennadiy Stakhovskiy Date: Thu, 15 Oct 2020 21:29:09 +0300 Subject: [PATCH 5/8] Changed "getKeyCombination" method of KeyBindingRepository and all it's dependencies. --- .../org/jabref/gui/actions/JabRefAction.java | 2 +- .../gui/keyboard/KeyBindingRepository.java | 20 +++++++++++-------- .../org/jabref/gui/preview/PreviewPanel.java | 6 +++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/jabref/gui/actions/JabRefAction.java b/src/main/java/org/jabref/gui/actions/JabRefAction.java index 5d1fbd10e28..b19c9ca110e 100644 --- a/src/main/java/org/jabref/gui/actions/JabRefAction.java +++ b/src/main/java/org/jabref/gui/actions/JabRefAction.java @@ -20,7 +20,7 @@ public JabRefAction(Action action, KeyBindingRepository keyBindingRepository) { action.getIcon() .ifPresent(icon -> setGraphic(icon.getGraphicNode())); action.getKeyBinding() - .ifPresent(keyBinding -> setAccelerator(keyBindingRepository.getKeyCombination(keyBinding))); + .ifPresent(keyBinding -> keyBindingRepository.getKeyCombination(keyBinding).ifPresent(combination -> setAccelerator(combination))); setLongText(action.getDescription()); } diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java index 0efb14b8388..6a9b63d89a4 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java @@ -113,21 +113,22 @@ public int size() { public Optional mapToKeyBinding(KeyEvent keyEvent) { for (KeyBinding binding : KeyBinding.values()){ - if (!binding.getDefaultKeyBinding().isEmpty()){ - if (checkKeyCombinationEquality(binding, keyEvent)) { - return Optional.of(binding); - } + if (checkKeyCombinationEquality(binding, keyEvent)) { + return Optional.of(binding); } } return Optional.empty(); } - public KeyCombination getKeyCombination(KeyBinding bindName) { + public Optional getKeyCombination(KeyBinding bindName) { String binding = get(bindName.getConstant()); + if (binding.isEmpty()){ + return Optional.empty(); + } if (OS.OS_X) { binding = binding.replace("ctrl", "meta"); } - return KeyCombination.valueOf(binding); + return Optional.of(KeyCombination.valueOf(binding)); } /** @@ -138,8 +139,11 @@ public KeyCombination getKeyCombination(KeyBinding bindName) { * @return true if matching, else false */ public boolean checkKeyCombinationEquality(KeyBinding binding, KeyEvent keyEvent) { - KeyCombination keyCombination = getKeyCombination(binding); - return checkKeyCombinationEquality(keyCombination, keyEvent); + Optional keyCombination = getKeyCombination(binding); + if (!keyCombination.isPresent()){ + return false; + } + return checkKeyCombinationEquality(keyCombination.get(), keyEvent); } public List getBindNames() { diff --git a/src/main/java/org/jabref/gui/preview/PreviewPanel.java b/src/main/java/org/jabref/gui/preview/PreviewPanel.java index 83a80ae422c..113e65fe0c0 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewPanel.java +++ b/src/main/java/org/jabref/gui/preview/PreviewPanel.java @@ -136,15 +136,15 @@ private void createKeyBindings() { private ContextMenu createPopupMenu() { MenuItem copyPreview = new MenuItem(Localization.lang("Copy preview"), IconTheme.JabRefIcons.COPY.getGraphicNode()); - copyPreview.setAccelerator(keyBindingRepository.getKeyCombination(KeyBinding.COPY_PREVIEW)); + keyBindingRepository.getKeyCombination(KeyBinding.COPY_PREVIEW).ifPresent(keyCombination -> copyPreview.setAccelerator(keyCombination)); copyPreview.setOnAction(event -> previewView.copyPreviewToClipBoard()); MenuItem printEntryPreview = new MenuItem(Localization.lang("Print entry preview"), IconTheme.JabRefIcons.PRINTED.getGraphicNode()); printEntryPreview.setOnAction(event -> previewView.print()); MenuItem previousPreviewLayout = new MenuItem(Localization.lang("Previous preview layout")); - previousPreviewLayout.setAccelerator(keyBindingRepository.getKeyCombination(KeyBinding.PREVIOUS_PREVIEW_LAYOUT)); + keyBindingRepository.getKeyCombination(KeyBinding.PREVIOUS_PREVIEW_LAYOUT).ifPresent(keyCombination -> previousPreviewLayout.setAccelerator(keyCombination)); previousPreviewLayout.setOnAction(event -> this.previousPreviewStyle()); MenuItem nextPreviewLayout = new MenuItem(Localization.lang("Next preview layout")); - nextPreviewLayout.setAccelerator(keyBindingRepository.getKeyCombination(KeyBinding.NEXT_PREVIEW_LAYOUT)); + keyBindingRepository.getKeyCombination(KeyBinding.NEXT_PREVIEW_LAYOUT).ifPresent(keyCombination -> nextPreviewLayout.setAccelerator(keyCombination)); nextPreviewLayout.setOnAction(event -> this.nextPreviewStyle()); ContextMenu menu = new ContextMenu(); From d480045bf1c0639b84ebc84a02d3186e18cc0ae7 Mon Sep 17 00:00:00 2001 From: Gennadiy Stakhovskiy Date: Sun, 18 Oct 2020 21:07:24 +0300 Subject: [PATCH 6/8] Corrected pull requests (comments from @calixtus) --- CHANGELOG.md | 4 +--- .../java/org/jabref/gui/keyboard/KeyBindingRepository.java | 2 +- src/main/resources/l10n/JabRef_en.properties | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0adf8dc06fd..bbb28891b27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,13 +45,11 @@ inserting new citations in a OpenOffic/LibreOffice document. [#6957](https://git - We fixed the failure to Copy citation key and link. [#5835](https://github.com/JabRef/jabref/issues/5835) - We fixed an issue where the sort order of the entry table was reset after a restart of JabRef. [#6898](https://github.com/JabRef/jabref/pull/6898) - We fixed an issue where no longer a warning was displayed when inserting references into LibreOffice with an invalid "ReferenceParagraphFormat". [#6907](https://github.com/JabRef/jabref/pull/60907). -- We fixed an issue where a selected field was not removed after the first click in the custom entry types dialog [#6934](https://github.com/JabRef/jabref/issues/6934) -- We fixed an issue where a remove icon was shown for standard entry types in the custom entry types dialog [6906](https://github.com/JabRef/jabref/issues/6906) -- We fixed an issue, when pulling changes from shared database via shortcut caused creation a new new tech report [6867](https://github.com/JabRef/jabref/issues/6867) - We fixed an issue where a selected field was not removed after the first click in the custom entry types dialog. [#6934](https://github.com/JabRef/jabref/issues/6934) - We fixed an issue where a remove icon was shown for standard entry types in the custom entry types dialog. [#6906](https://github.com/JabRef/jabref/issues/6906) - We fixed an issue where it was impossible to connect to OpenOffice/LibreOffice on Mac OSX. [#6970](https://github.com/JabRef/jabref/pull/6970) - We fixed an issue with the python script used by browser plugins that failed to locate JabRef if not installed in its default location. [#6963](https://github.com/JabRef/jabref/pull/6963/files) +- We fixed an issue where spaces and newlines in an isbn would generate an exception. [#6456](https://github.com/JabRef/jabref/issues/6456) - We fixed an issue where identity column header had incorrect foreground color in the Dark theme. [#6796](https://github.com/JabRef/jabref/issues/6796) - We fixed an issue where clicking on Collapse All button in the Search for Unlinked Local Files expanded the directory structure erroneously [#6848](https://github.com/JabRef/jabref/issues/6848) - We fixed an issue, when pulling changes from shared database via shortcut caused creation a new new tech report [6867](https://github.com/JabRef/jabref/issues/6867) diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java index 6a9b63d89a4..305a20c021c 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java @@ -112,7 +112,7 @@ public int size() { } public Optional mapToKeyBinding(KeyEvent keyEvent) { - for (KeyBinding binding : KeyBinding.values()){ + for (KeyBinding binding : KeyBinding.values()) { if (checkKeyCombinationEquality(binding, keyEvent)) { return Optional.of(binding); } diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 89abfa2418c..69be4d10c02 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2257,6 +2257,7 @@ Previous\ preview\ style=Previous preview style (\ Note\:\ Press\ return\ to\ commit\ changes\ in\ the\ table\!\ )=( Note\: Press return to commit changes in the table\! ) Reset=Reset +New\ inproceedings=New article in a conference proceedings Reset\ entry\ types\ and\ fields\ to\ defaults=Reset entry types and fields to defaults This\ will\ reset\ all\ entry\ types\ to\ their\ default\ values\ and\ remove\ all\ custom\ entry\ types=This will reset all entry types to their default values and remove all custom entry types Replace\ tabs\ with\ space=Replace tabs with space From 3d120ac933db87157d090c49216d023eadf8729d Mon Sep 17 00:00:00 2001 From: Gennadiy Stakhovskiy Date: Sun, 18 Oct 2020 21:39:42 +0300 Subject: [PATCH 7/8] Corrected pull requests (comments from @calixtus) --- CHANGELOG.md | 1 - src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java | 2 +- src/main/resources/l10n/JabRef_en.properties | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbb28891b27..770a6fea081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,6 @@ inserting new citations in a OpenOffic/LibreOffice document. [#6957](https://git - We fixed an issue where a remove icon was shown for standard entry types in the custom entry types dialog. [#6906](https://github.com/JabRef/jabref/issues/6906) - We fixed an issue where it was impossible to connect to OpenOffice/LibreOffice on Mac OSX. [#6970](https://github.com/JabRef/jabref/pull/6970) - We fixed an issue with the python script used by browser plugins that failed to locate JabRef if not installed in its default location. [#6963](https://github.com/JabRef/jabref/pull/6963/files) -- We fixed an issue where spaces and newlines in an isbn would generate an exception. [#6456](https://github.com/JabRef/jabref/issues/6456) - We fixed an issue where identity column header had incorrect foreground color in the Dark theme. [#6796](https://github.com/JabRef/jabref/issues/6796) - We fixed an issue where clicking on Collapse All button in the Search for Unlinked Local Files expanded the directory structure erroneously [#6848](https://github.com/JabRef/jabref/issues/6848) - We fixed an issue, when pulling changes from shared database via shortcut caused creation a new new tech report [6867](https://github.com/JabRef/jabref/issues/6867) diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java index 305a20c021c..fa07143df94 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java @@ -140,7 +140,7 @@ public Optional getKeyCombination(KeyBinding bindName) { */ public boolean checkKeyCombinationEquality(KeyBinding binding, KeyEvent keyEvent) { Optional keyCombination = getKeyCombination(binding); - if (!keyCombination.isPresent()){ + if (!keyCombination.isPresent()) { return false; } return checkKeyCombinationEquality(keyCombination.get(), keyEvent); diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 69be4d10c02..deeb93de63c 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2257,7 +2257,7 @@ Previous\ preview\ style=Previous preview style (\ Note\:\ Press\ return\ to\ commit\ changes\ in\ the\ table\!\ )=( Note\: Press return to commit changes in the table\! ) Reset=Reset -New\ inproceedings=New article in a conference proceedings +New\ inproceedings=New inproceedings Reset\ entry\ types\ and\ fields\ to\ defaults=Reset entry types and fields to defaults This\ will\ reset\ all\ entry\ types\ to\ their\ default\ values\ and\ remove\ all\ custom\ entry\ types=This will reset all entry types to their default values and remove all custom entry types Replace\ tabs\ with\ space=Replace tabs with space From 2abea9ec86cc1f71be67e0e79adb54b892cdadd4 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Sun, 18 Oct 2020 23:41:56 +0200 Subject: [PATCH 8/8] Add whitespace in KeyBindingRepository --- src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java index fa07143df94..1e2a4c23a8f 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java @@ -122,7 +122,7 @@ public Optional mapToKeyBinding(KeyEvent keyEvent) { public Optional getKeyCombination(KeyBinding bindName) { String binding = get(bindName.getConstant()); - if (binding.isEmpty()){ + if (binding.isEmpty()) { return Optional.empty(); } if (OS.OS_X) {