From c612072a38842ab0201fc3bde23f06e95cc4bde2 Mon Sep 17 00:00:00 2001 From: yurickyh Date: Wed, 5 Jun 2019 19:15:43 -0300 Subject: [PATCH 1/5] Change TreeMap for LinkedHashMap on create function. The reason for changing the type of the object is because TreeMap automatically orders by the key. Signed-off-by: kaiquekk Signed-off-by: yurickyh --- .../java/org/jabref/gui/entryeditor/EntryEditorTabList.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java index f35f8c94ad6..e59854ede62 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java @@ -3,7 +3,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.TreeMap; +import java.util.LinkedHashMap; import org.jabref.preferences.JabRefPreferences; @@ -17,7 +17,7 @@ private EntryEditorTabList() { } public static Map> create(JabRefPreferences preferences) { - Map> tabs = new TreeMap<>(); + Map> tabs = new LinkedHashMap<>(); int i = 0; String name; if (preferences.hasKey(JabRefPreferences.CUSTOM_TAB_NAME + 0)) { From d78997c0eefcf316402ef9537dcf126cf74852e2 Mon Sep 17 00:00:00 2001 From: yurickyh Date: Wed, 5 Jun 2019 19:20:53 -0300 Subject: [PATCH 2/5] Remove the character '-' on KEY_ILLEGAL_CHARACTERS and KEY_UNWANTED_CHARACTERS constants. The character '-' was removed because it was not able to use it when defining a new field. Signed-off-by: kaiquekk Signed-off-by: yurickyh --- .../org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java b/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java index 02a2fce80ac..4c24ef286c1 100644 --- a/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java +++ b/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java @@ -26,8 +26,8 @@ public class BibtexKeyGenerator extends BracketedPattern { */ public static final String APPENDIX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz"; private static final Logger LOGGER = LoggerFactory.getLogger(BibtexKeyGenerator.class); - private static final String KEY_ILLEGAL_CHARACTERS = "{}(),\\\"-#~^:'`ʹ"; - private static final String KEY_UNWANTED_CHARACTERS = "{}(),\\\"-"; + private static final String KEY_ILLEGAL_CHARACTERS = "{}(),\\\"#~^:'`ʹ"; + private static final String KEY_UNWANTED_CHARACTERS = "{}(),\\\""; private final AbstractBibtexKeyPattern citeKeyPattern; private final BibDatabase database; private final BibtexKeyPatternPreferences bibtexKeyPatternPreferences; From ad6e549f329395999216ad1e7341d453d8a141c8 Mon Sep 17 00:00:00 2001 From: kaiquekk Date: Wed, 5 Jun 2019 19:54:40 -0300 Subject: [PATCH 3/5] Add changes in CHANGELOG. Signed-off-by: kaiquekk --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc0063bb095..8280cf8ec43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We added an option on the Linked File Viewer to rename the attached file of an entry directly on the JabRef. [#4844](https://github.com/JabRef/jabref/issues/4844) - We added an option in the preference dialog box that allows user to enable helpful tooltips.[#3599](https://github.com/JabRef/jabref/issues/3599) - We moved the dropdown menu for selecting the push-application from the toolbar into the external application preferences. [#674](https://github.com/JabRef/jabref/issues/674) +- We added the option to set up a general field with a name containing "-" and removed the alphabetical ordering of the tabs. [#5019](https://github.com/JabRef/jabref/issues/5019) ### Fixed From c527f710cf943789aef0016ee1e05024108ba146 Mon Sep 17 00:00:00 2001 From: kaiquekk Date: Wed, 5 Jun 2019 20:02:54 -0300 Subject: [PATCH 4/5] Fix checkstyle error. Signed-off-by: kaiquekk --- .../java/org/jabref/gui/entryeditor/EntryEditorTabList.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java index e59854ede62..49a337788a9 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java @@ -1,9 +1,9 @@ package org.jabref.gui.entryeditor; import java.util.Arrays; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.LinkedHashMap; import org.jabref.preferences.JabRefPreferences; From 57782e47f0878168c94ed2e9a609c921c8e2cd1c Mon Sep 17 00:00:00 2001 From: kaiquekk Date: Wed, 5 Jun 2019 20:31:21 -0300 Subject: [PATCH 5/5] Remove option to name a field with hyphen. Remove the option to name a custom general field containing a hyphen and update the error message to be more clear about it. Signed-off-by: kaiquekk --- CHANGELOG.md | 2 +- .../CustomizeGeneralFieldsDialogViewModel.java | 2 +- .../org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8280cf8ec43..468e99f68d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,7 +66,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We added an option on the Linked File Viewer to rename the attached file of an entry directly on the JabRef. [#4844](https://github.com/JabRef/jabref/issues/4844) - We added an option in the preference dialog box that allows user to enable helpful tooltips.[#3599](https://github.com/JabRef/jabref/issues/3599) - We moved the dropdown menu for selecting the push-application from the toolbar into the external application preferences. [#674](https://github.com/JabRef/jabref/issues/674) -- We added the option to set up a general field with a name containing "-" and removed the alphabetical ordering of the tabs. [#5019](https://github.com/JabRef/jabref/issues/5019) +- We removed the alphabetical ordering of the custom tabs and updated the error message when trying to create a general field with a name containing an illegal character. [#5019](https://github.com/JabRef/jabref/issues/5019) ### Fixed diff --git a/src/main/java/org/jabref/gui/customizefields/CustomizeGeneralFieldsDialogViewModel.java b/src/main/java/org/jabref/gui/customizefields/CustomizeGeneralFieldsDialogViewModel.java index 1d388df6555..638ffc9014f 100644 --- a/src/main/java/org/jabref/gui/customizefields/CustomizeGeneralFieldsDialogViewModel.java +++ b/src/main/java/org/jabref/gui/customizefields/CustomizeGeneralFieldsDialogViewModel.java @@ -60,7 +60,7 @@ public void saveFields() { String title = Localization.lang("Error"); String content = Localization.lang("Field names are not allowed to contain white space or the following " + "characters") - + ": # { } ~ , ^ &"; + + ": # { } ( ) ~ , ^ & - \" ' ` ʹ \\"; dialogService.showInformationDialogAndWait(title, content); return; } diff --git a/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java b/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java index 4c24ef286c1..02a2fce80ac 100644 --- a/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java +++ b/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java @@ -26,8 +26,8 @@ public class BibtexKeyGenerator extends BracketedPattern { */ public static final String APPENDIX_CHARACTERS = "abcdefghijklmnopqrstuvwxyz"; private static final Logger LOGGER = LoggerFactory.getLogger(BibtexKeyGenerator.class); - private static final String KEY_ILLEGAL_CHARACTERS = "{}(),\\\"#~^:'`ʹ"; - private static final String KEY_UNWANTED_CHARACTERS = "{}(),\\\""; + private static final String KEY_ILLEGAL_CHARACTERS = "{}(),\\\"-#~^:'`ʹ"; + private static final String KEY_UNWANTED_CHARACTERS = "{}(),\\\"-"; private final AbstractBibtexKeyPattern citeKeyPattern; private final BibDatabase database; private final BibtexKeyPatternPreferences bibtexKeyPatternPreferences;