From f86ce7c33880ffa73f46e037be8ea10fa59c9c7e Mon Sep 17 00:00:00 2001 From: dpolishc Date: Sat, 18 May 2019 20:52:07 +0200 Subject: [PATCH 01/19] Duplicate check on import should be run in background Task #4963 --- .../gui/importer/ImportEntriesDialog.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index ae5352deade..0beb12ad8c6 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -1,6 +1,7 @@ package org.jabref.gui.importer; import java.util.List; +import java.util.concurrent.Callable; import javax.inject.Inject; import javax.swing.undo.UndoManager; @@ -20,6 +21,7 @@ import javafx.scene.layout.VBox; import javafx.scene.text.Text; +import org.jabref.Globals; import org.jabref.gui.DialogService; import org.jabref.gui.StateManager; import org.jabref.gui.icon.IconTheme; @@ -108,12 +110,15 @@ private void initialize() { container.getStyleClass().add("entry-container"); BindingsHelper.includePseudoClassWhen(container, entrySelected, addToggle.selectedProperty()); - if (viewModel.hasDuplicate(entry)) { - Button duplicateButton = IconTheme.JabRefIcons.DUPLICATE.asButton(); - duplicateButton.setTooltip(new Tooltip(Localization.lang("Possible duplicate of existing entry. Click to resolve."))); - duplicateButton.setOnAction(event -> viewModel.resolveDuplicate(entry)); - container.getChildren().add(1, duplicateButton); - } + Callable hasDuplicateEntryTask = () -> viewModel.hasDuplicate(entry); + BackgroundTask.wrap(hasDuplicateEntryTask).onSuccess(e -> { + if (e) { + Button duplicateButton = IconTheme.JabRefIcons.DUPLICATE.asButton(); + duplicateButton.setTooltip(new Tooltip(Localization.lang("Possible duplicate of existing entry. Click to resolve."))); + duplicateButton.setOnAction(event -> viewModel.resolveDuplicate(entry)); + container.getChildren().add(1, duplicateButton); + } + }).executeWith(Globals.TASK_EXECUTOR); return container; }) From ebefc8581a7c900bbb2c96a335af17f6fcbe280f Mon Sep 17 00:00:00 2001 From: dpolishc Date: Mon, 20 May 2019 07:26:07 +0200 Subject: [PATCH 02/19] fixup! fixup! Too big error message #4963 (updating controlsfx, setting maxWidth and reverting off the temporary fix) --- .../gui/importer/ImportEntriesDialog.java | 3 +- .../gui/importer/ImportEntriesViewModel.java | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index 0beb12ad8c6..0aaeb427217 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -110,8 +110,7 @@ private void initialize() { container.getStyleClass().add("entry-container"); BindingsHelper.includePseudoClassWhen(container, entrySelected, addToggle.selectedProperty()); - Callable hasDuplicateEntryTask = () -> viewModel.hasDuplicate(entry); - BackgroundTask.wrap(hasDuplicateEntryTask).onSuccess(e -> { + BackgroundTask.wrap(() -> viewModel.hasDuplicate(entry)).onSuccess(e -> { if (e) { Button duplicateButton = IconTheme.JabRefIcons.DUPLICATE.asButton(); duplicateButton.setTooltip(new Tooltip(Localization.lang("Possible duplicate of existing entry. Click to resolve."))); diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index 6f0b2fad4ad..218038a349d 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -9,7 +9,7 @@ import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; - +import org.jabref.Globals; import org.jabref.gui.AbstractViewModel; import org.jabref.gui.DialogService; import org.jabref.gui.StateManager; @@ -25,6 +25,10 @@ import org.jabref.model.util.FileUpdateMonitor; import org.jabref.preferences.PreferencesService; +import javax.swing.undo.UndoManager; +import java.util.List; +import java.util.Optional; + public class ImportEntriesViewModel extends AbstractViewModel { private final BackgroundTask> task; @@ -75,22 +79,21 @@ public void importEntries(List entriesToImport) { // Check if we are supposed to warn about duplicates. // If so, then see if there are duplicates, and warn if yes. if (preferences.shouldWarnAboutDuplicatesForImport()) { - boolean containsDuplicate = entriesToImport.stream() - .anyMatch(this::hasDuplicate); - - if (containsDuplicate) { - boolean continueImport = dialogService.showConfirmationDialogWithOptOutAndWait(Localization.lang("Duplicates found"), - Localization.lang("There are possible duplicates (marked with an icon) that haven't been resolved. Continue?"), - Localization.lang("Continue with import"), - Localization.lang("Cancel import"), - Localization.lang("Disable this confirmation dialog"), - optOut -> preferences.setShouldWarnAboutDuplicatesForImport(!optOut)); - - if (!continueImport) { - dialogService.notify(Localization.lang("Import canceled")); - return; + BackgroundTask.wrap(() -> entriesToImport.stream() + .anyMatch(this::hasDuplicate)).onSuccess(e -> { + if (e) { + boolean continueImport = dialogService.showConfirmationDialogWithOptOutAndWait(Localization.lang("Duplicates found"), + Localization.lang("There are possible duplicates (marked with an icon) that haven't been resolved. Continue?"), + Localization.lang("Continue with import"), + Localization.lang("Cancel import"), + Localization.lang("Disable this confirmation dialog"), + optOut -> preferences.setShouldWarnAboutDuplicatesForImport(!optOut)); + + if (!continueImport) { + dialogService.notify(Localization.lang("Import canceled")); + } } - } + }).executeWith(Globals.TASK_EXECUTOR); } ImportHandler importHandler = new ImportHandler( From 6ec9ee8ed83080d71639426b8fe7da8783e6425f Mon Sep 17 00:00:00 2001 From: dpolishc Date: Mon, 20 May 2019 07:56:43 +0200 Subject: [PATCH 03/19] Duplicate check on import should be run in background Task #4963 (adding background task for view model) --- .../java/org/jabref/gui/importer/ImportEntriesDialog.java | 1 - .../org/jabref/gui/importer/ImportEntriesViewModel.java | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index 0aaeb427217..af0264f0229 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -1,7 +1,6 @@ package org.jabref.gui.importer; import java.util.List; -import java.util.concurrent.Callable; import javax.inject.Inject; import javax.swing.undo.UndoManager; diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index 218038a349d..df85f6bdc48 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -1,14 +1,10 @@ package org.jabref.gui.importer; -import java.util.List; -import java.util.Optional; - -import javax.swing.undo.UndoManager; - import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; + import org.jabref.Globals; import org.jabref.gui.AbstractViewModel; import org.jabref.gui.DialogService; @@ -54,7 +50,7 @@ public ImportEntriesViewModel(BackgroundTask> task, TaskExecutor this.message.bind(task.messageProperty()); task.onSuccess(entriesToImport -> entries.addAll(entriesToImport)) - .executeWith(taskExecutor); + .executeWith(taskExecutor); } public String getMessage() { From c27f6e637d677c4b8a428d38fed3d434f714711c Mon Sep 17 00:00:00 2001 From: dpolishc Date: Mon, 20 May 2019 08:03:00 +0200 Subject: [PATCH 04/19] Duplicate check on import should be run in background Task #4963 (checkstyle fix) --- .../org/jabref/gui/importer/ImportEntriesViewModel.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index df85f6bdc48..dc8d533338d 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -1,5 +1,10 @@ package org.jabref.gui.importer; +import java.util.List; +import java.util.Optional; + +import javax.swing.undo.UndoManager; + import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; @@ -21,10 +26,6 @@ import org.jabref.model.util.FileUpdateMonitor; import org.jabref.preferences.PreferencesService; -import javax.swing.undo.UndoManager; -import java.util.List; -import java.util.Optional; - public class ImportEntriesViewModel extends AbstractViewModel { private final BackgroundTask> task; From bb5b2a92ccf1c77f11258edd9b23e461ac4b9c64 Mon Sep 17 00:00:00 2001 From: dpolishc Date: Tue, 21 May 2019 21:28:22 +0200 Subject: [PATCH 05/19] Duplicate check on import should be run in background Task #4963 --- .../gui/importer/ImportEntriesViewModel.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index dc8d533338d..b4372d4cba5 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -88,24 +88,24 @@ public void importEntries(List entriesToImport) { if (!continueImport) { dialogService.notify(Localization.lang("Import canceled")); + } else { + ImportHandler importHandler = new ImportHandler( + dialogService, + database, + ExternalFileTypes.getInstance(), + preferences.getFilePreferences(), + preferences.getImportFormatPreferences(), + preferences.getUpdateFieldPreferences(), + fileUpdateMonitor, + undoManager, + stateManager); + importHandler.importEntries(entriesToImport); + dialogService.notify(Localization.lang("Number of entries successfully imported") + ": " + entriesToImport.size()); } } }).executeWith(Globals.TASK_EXECUTOR); } - ImportHandler importHandler = new ImportHandler( - dialogService, - database, - ExternalFileTypes.getInstance(), - preferences.getFilePreferences(), - preferences.getImportFormatPreferences(), - preferences.getUpdateFieldPreferences(), - fileUpdateMonitor, - undoManager, - stateManager); - importHandler.importEntries(entriesToImport); - - dialogService.notify(Localization.lang("Number of entries successfully imported") + ": " + entriesToImport.size()); } /** From f7c0551d47d1278a3e1d04c9ec92aab39904dffa Mon Sep 17 00:00:00 2001 From: dpolishc Date: Sun, 26 May 2019 21:40:55 +0200 Subject: [PATCH 06/19] Duplicate check on import should be run in background Task #4963 --- .../gui/importer/ImportEntriesViewModel.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index b4372d4cba5..40706fdc070 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -89,25 +89,33 @@ public void importEntries(List entriesToImport) { if (!continueImport) { dialogService.notify(Localization.lang("Import canceled")); } else { - ImportHandler importHandler = new ImportHandler( - dialogService, - database, - ExternalFileTypes.getInstance(), - preferences.getFilePreferences(), - preferences.getImportFormatPreferences(), - preferences.getUpdateFieldPreferences(), - fileUpdateMonitor, - undoManager, - stateManager); - importHandler.importEntries(entriesToImport); + buildImportHandlerThenImportEntries(entriesToImport); dialogService.notify(Localization.lang("Number of entries successfully imported") + ": " + entriesToImport.size()); } + } else { + buildImportHandlerThenImportEntries(entriesToImport); } }).executeWith(Globals.TASK_EXECUTOR); + } else { + buildImportHandlerThenImportEntries(entriesToImport); } } + private void buildImportHandlerThenImportEntries(List entriesToImport) { + ImportHandler importHandler = new ImportHandler( + dialogService, + database, + ExternalFileTypes.getInstance(), + preferences.getFilePreferences(), + preferences.getImportFormatPreferences(), + preferences.getUpdateFieldPreferences(), + fileUpdateMonitor, + undoManager, + stateManager); + importHandler.importEntries(entriesToImport); + } + /** * Checks if there are duplicates to the given entry in the list of entries to be imported. * From 300eae70c935ee5a2ca26ec096e8af725a8d93c3 Mon Sep 17 00:00:00 2001 From: dpolishc Date: Mon, 27 May 2019 19:14:10 +0200 Subject: [PATCH 07/19] Duplicate check on import should be run in background Task (changing var name) --- .../java/org/jabref/gui/importer/ImportEntriesViewModel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index 40706fdc070..5f94d08c85a 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -77,8 +77,8 @@ public void importEntries(List entriesToImport) { // If so, then see if there are duplicates, and warn if yes. if (preferences.shouldWarnAboutDuplicatesForImport()) { BackgroundTask.wrap(() -> entriesToImport.stream() - .anyMatch(this::hasDuplicate)).onSuccess(e -> { - if (e) { + .anyMatch(this::hasDuplicate)).onSuccess(duplicateFound -> { + if (duplicateFound) { boolean continueImport = dialogService.showConfirmationDialogWithOptOutAndWait(Localization.lang("Duplicates found"), Localization.lang("There are possible duplicates (marked with an icon) that haven't been resolved. Continue?"), Localization.lang("Continue with import"), From 006a443776ec58cac174d7d6aac98d61dfe4b87f Mon Sep 17 00:00:00 2001 From: dpolishc Date: Sun, 2 Jun 2019 16:00:00 +0200 Subject: [PATCH 08/19] Duplicate check on import should be run in background Task #4963 --- .../java/org/jabref/gui/importer/ImportEntriesViewModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index 5f94d08c85a..b7fec8440c9 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -90,7 +90,6 @@ public void importEntries(List entriesToImport) { dialogService.notify(Localization.lang("Import canceled")); } else { buildImportHandlerThenImportEntries(entriesToImport); - dialogService.notify(Localization.lang("Number of entries successfully imported") + ": " + entriesToImport.size()); } } else { buildImportHandlerThenImportEntries(entriesToImport); @@ -114,6 +113,7 @@ private void buildImportHandlerThenImportEntries(List entriesToImport) undoManager, stateManager); importHandler.importEntries(entriesToImport); + dialogService.notify(Localization.lang("Number of entries successfully imported") + ": " + entriesToImport.size()); } /** From a6fc6f3d90f0b497357c3610f64de73cef4ef81d Mon Sep 17 00:00:00 2001 From: dpolishc Date: Sun, 2 Jun 2019 22:06:08 +0200 Subject: [PATCH 09/19] Duplicate check on import should be run in background #4963 --- .../java/org/jabref/gui/importer/ImportEntriesDialog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index af0264f0229..40ad459433b 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -109,8 +109,8 @@ private void initialize() { container.getStyleClass().add("entry-container"); BindingsHelper.includePseudoClassWhen(container, entrySelected, addToggle.selectedProperty()); - BackgroundTask.wrap(() -> viewModel.hasDuplicate(entry)).onSuccess(e -> { - if (e) { + BackgroundTask.wrap(() -> viewModel.hasDuplicate(entry)).onSuccess(duplicateFound -> { + if (duplicateFound) { Button duplicateButton = IconTheme.JabRefIcons.DUPLICATE.asButton(); duplicateButton.setTooltip(new Tooltip(Localization.lang("Possible duplicate of existing entry. Click to resolve."))); duplicateButton.setOnAction(event -> viewModel.resolveDuplicate(entry)); From c612072a38842ab0201fc3bde23f06e95cc4bde2 Mon Sep 17 00:00:00 2001 From: yurickyh Date: Wed, 5 Jun 2019 19:15:43 -0300 Subject: [PATCH 10/19] 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 11/19] 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 12/19] 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 13/19] 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 14/19] 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; From b3993fd272cd230e792f332d75b0c4f6ef283943 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Fri, 7 Jun 2019 11:11:49 +0200 Subject: [PATCH 15/19] Bump bcprov-jdk15on from 1.61 to 1.62 (#5039) Bumps [bcprov-jdk15on](https://github.com/bcgit/bc-java) from 1.61 to 1.62. - [Release notes](https://github.com/bcgit/bc-java/releases) - [Changelog](https://github.com/bcgit/bc-java/blob/master/docs/releasenotes.html) - [Commits](https://github.com/bcgit/bc-java/commits) Signed-off-by: dependabot-preview[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 15217878163..9b39cf11101 100644 --- a/build.gradle +++ b/build.gradle @@ -97,7 +97,7 @@ dependencies { compile group: 'org.apache.tika', name: 'tika-core', version: '1.21' // required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635 - compile 'org.bouncycastle:bcprov-jdk15on:1.61' + compile 'org.bouncycastle:bcprov-jdk15on:1.62' compile 'commons-cli:commons-cli:1.4' From 65a7cd34c04d6005b5884399ab85caf947438ab8 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 7 Jun 2019 11:16:36 +0200 Subject: [PATCH 16/19] Remove "automatic bug report" title (#5040) Right now users often forget to change the title to something reasonable. --- .../jabref/gui/errorconsole/ErrorConsoleViewModel.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jabref/gui/errorconsole/ErrorConsoleViewModel.java b/src/main/java/org/jabref/gui/errorconsole/ErrorConsoleViewModel.java index d5b25ae7aea..a47ba6f02be 100644 --- a/src/main/java/org/jabref/gui/errorconsole/ErrorConsoleViewModel.java +++ b/src/main/java/org/jabref/gui/errorconsole/ErrorConsoleViewModel.java @@ -91,17 +91,16 @@ public void clearLog() { */ public void reportIssue() { try { - String issueTitle = "Automatic Bug Report - " + dateFormat.format(date); - // system info + // System info String systemInfo = String.format("JabRef %s%n%s %s %s %nJava %s", buildInfo.getVersion(), BuildInfo.OS, BuildInfo.OS_VERSION, BuildInfo.OS_ARCH, BuildInfo.JAVA_VERSION); - // steps to reproduce + // Steps to reproduce String howToReproduce = "Steps to reproduce:\n\n1. ...\n2. ...\n3. ..."; - // log messages + // Log messages String issueDetails = "
\n" + "" + "Detail information:" + "\n\n```\n" + getLogMessagesAsString(allMessagesData) + "\n```\n\n
"; clipBoardManager.setContent(issueDetails); - // bug report body + // Bug report body String issueBody = systemInfo + "\n\n" + howToReproduce + "\n\n" + "Paste your log details here."; dialogService.notify(Localization.lang("Issue on GitHub successfully reported.")); @@ -114,7 +113,6 @@ public void reportIssue() { URIBuilder uriBuilder = new URIBuilder() .setScheme("https").setHost("github.com") .setPath("/JabRef/jabref/issues/new") - .setParameter("title", issueTitle) .setParameter("body", issueBody); JabRefDesktop.openBrowser(uriBuilder.build().toString()); } catch (IOException | URISyntaxException e) { From 8044a22b191a74b20d4685f50563a2dd2f73266d Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Sat, 8 Jun 2019 19:20:35 +0200 Subject: [PATCH 17/19] Convert merge shared entries to javafx Remove old dialog Use the defined dialog --- .../gui/shared/MergeSharedEntryDialog.java | 116 ------------------ .../gui/shared/SharedDatabaseUIManager.java | 40 +++++- 2 files changed, 37 insertions(+), 119 deletions(-) delete mode 100644 src/main/java/org/jabref/gui/shared/MergeSharedEntryDialog.java diff --git a/src/main/java/org/jabref/gui/shared/MergeSharedEntryDialog.java b/src/main/java/org/jabref/gui/shared/MergeSharedEntryDialog.java deleted file mode 100644 index 44a26afd33b..00000000000 --- a/src/main/java/org/jabref/gui/shared/MergeSharedEntryDialog.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.jabref.gui.shared; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.WindowConstants; -import javax.swing.border.EmptyBorder; - -import javafx.scene.Scene; - -import org.jabref.gui.JabRefFrame; -import org.jabref.gui.customjfx.CustomJFXPanel; -import org.jabref.gui.mergeentries.MergeEntries; -import org.jabref.logic.l10n.Localization; -import org.jabref.model.database.BibDatabaseMode; -import org.jabref.model.database.shared.DatabaseSynchronizer; -import org.jabref.model.entry.BibEntry; - -public class MergeSharedEntryDialog { - - private final JabRefFrame jabRefFrame; - private final DatabaseSynchronizer dbmsSynchronizer; - private final BibEntry localBibEntry; - private final BibEntry sharedBibEntry; - private final JDialog mergeDialog; - private final MergeEntries mergeEntries; - - - public MergeSharedEntryDialog(JabRefFrame jabRefFrame, DatabaseSynchronizer dbmsSynchronizer, BibEntry localBibEntry, - BibEntry sharedBibEntry, BibDatabaseMode bibDatabaseMode) { - this.jabRefFrame = jabRefFrame; - this.dbmsSynchronizer = dbmsSynchronizer; - this.localBibEntry = localBibEntry; - this.sharedBibEntry = sharedBibEntry; - this.mergeDialog = new JDialog((JFrame) null, Localization.lang("Update refused"), true); - this.mergeEntries = new MergeEntries(sharedBibEntry, localBibEntry, Localization.lang("Shared entry"), - Localization.lang("Local entry"), bibDatabaseMode); - } - - public void showMergeDialog() { - - mergeDialog.setMinimumSize(new Dimension(600, 600)); - - StringBuilder message = new StringBuilder(); - message.append(""); - message.append(""); - message.append(Localization.lang("Update could not be performed due to existing change conflicts.")); - message.append(""); - message.append("

"); - message.append(Localization.lang("You are not working on the newest version of BibEntry.")); - message.append("

"); - message.append(Localization.lang("Shared version: %0", String.valueOf(sharedBibEntry.getSharedBibEntryData().getVersion()))); - message.append("
"); - message.append(Localization.lang("Local version: %0", String.valueOf(localBibEntry.getSharedBibEntryData().getVersion()))); - message.append("

"); - message.append(Localization.lang("Please merge the shared entry with yours and press \"Merge entries\" to resolve this problem.")); - message.append("
"); - - JLabel mergeInnformation = new JLabel(message.toString()); - mergeInnformation.setBorder(new EmptyBorder(9, 9, 9, 9)); - - mergeDialog.add(mergeInnformation, BorderLayout.NORTH); - mergeDialog.add(CustomJFXPanel.wrap(new Scene(mergeEntries)), BorderLayout.CENTER); - - JButton mergeButton = new JButton(Localization.lang("Merge entries")); - mergeButton.addActionListener(e -> mergeEntries()); - - JButton cancelButton = new JButton(Localization.lang("Cancel")); - cancelButton.addActionListener(e -> showConfirmationDialog()); - - JPanel buttonPanel = new JPanel(); - buttonPanel.add(mergeButton, BorderLayout.WEST); - buttonPanel.add(cancelButton, BorderLayout.EAST); - - mergeDialog.add(buttonPanel, BorderLayout.SOUTH); - mergeDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - mergeDialog.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - showConfirmationDialog(); - } - }); - - mergeDialog.pack(); - mergeDialog.setVisible(true); - } - - private void showConfirmationDialog() { - int answer = JOptionPane.showConfirmDialog(mergeDialog, - Localization.lang("Canceling this operation will leave your changes unsynchronized. Cancel anyway?"), - Localization.lang("Warning"), JOptionPane.YES_NO_OPTION); - - if (answer == 0) { - mergeDialog.dispose(); - } - } - - private void mergeEntries() { - BibEntry mergedBibEntry = mergeEntries.getMergeEntry(); - mergedBibEntry.getSharedBibEntryData().setSharedID(sharedBibEntry.getSharedBibEntryData().getSharedID()); - mergedBibEntry.getSharedBibEntryData().setVersion(sharedBibEntry.getSharedBibEntryData().getVersion()); - - mergeDialog.dispose(); // dispose before synchronizing to avoid multiple merge windows in case of new conflict. - - dbmsSynchronizer.synchronizeSharedEntry(mergedBibEntry); - dbmsSynchronizer.synchronizeLocalDatabase(); - } -} diff --git a/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java b/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java index 1d9de038f98..63858b209a2 100644 --- a/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java +++ b/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java @@ -5,6 +5,7 @@ import java.util.Optional; import javafx.scene.control.Alert.AlertType; +import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; @@ -14,6 +15,7 @@ import org.jabref.gui.JabRefFrame; import org.jabref.gui.entryeditor.EntryEditor; import org.jabref.gui.exporter.SaveDatabaseAction; +import org.jabref.gui.mergeentries.MergeEntriesDialog; import org.jabref.gui.undo.UndoableRemoveEntry; import org.jabref.logic.importer.ParserResult; import org.jabref.logic.l10n.Localization; @@ -31,6 +33,7 @@ import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.database.shared.DatabaseNotSupportedException; import org.jabref.model.database.shared.DatabaseSynchronizer; +import org.jabref.model.entry.BibEntry; import com.google.common.eventbus.Subscribe; @@ -81,9 +84,40 @@ public void listen(UpdateRefusedEvent updateRefusedEvent) { jabRefFrame.getDialogService().notify(Localization.lang("Update refused.")); - new MergeSharedEntryDialog(jabRefFrame, dbmsSynchronizer, updateRefusedEvent.getLocalBibEntry(), - updateRefusedEvent.getSharedBibEntry(), - updateRefusedEvent.getBibDatabaseContext().getMode()).showMergeDialog(); + BibEntry localBibEntry = updateRefusedEvent.getLocalBibEntry(); + BibEntry sharedBibEntry = updateRefusedEvent.getSharedBibEntry(); + + StringBuilder message = new StringBuilder(); + message.append(Localization.lang("Update could not be performed due to existing change conflicts.")); + message.append("\r\n"); + message.append(Localization.lang("You are not working on the newest version of BibEntry.")); + message.append("\r\n"); + message.append(Localization.lang("Shared version: %0", String.valueOf(sharedBibEntry.getSharedBibEntryData().getVersion()))); + message.append("\r\n"); + message.append(Localization.lang("Local version: %0", String.valueOf(localBibEntry.getSharedBibEntryData().getVersion()))); + message.append("\r\n"); + message.append(Localization.lang("Please merge the shared entry with yours and press \"Merge entries\" to resolve this problem.")); + message.append("\r\n"); + message.append(Localization.lang("Canceling this operation will leave your changes unsynchronized.")); + + ButtonType merge = new ButtonType(Localization.lang("Merge entries"), ButtonBar.ButtonData.YES); + + Optional response = dialogService.showCustomButtonDialogAndWait(AlertType.CONFIRMATION, Localization.lang("Update refused"), message.toString(), ButtonType.CANCEL, merge); + + if (response.isPresent() && response.get().equals(merge)) { + MergeEntriesDialog dialog = new MergeEntriesDialog(localBibEntry, sharedBibEntry, updateRefusedEvent.getBibDatabaseContext().getMode()); + Optional mergedEntry = dialog.showAndWait(); + + mergedEntry.ifPresent(mergedBibEntry -> { + mergedBibEntry.getSharedBibEntryData().setSharedID(sharedBibEntry.getSharedBibEntryData().getSharedID()); + mergedBibEntry.getSharedBibEntryData().setVersion(sharedBibEntry.getSharedBibEntryData().getVersion()); + + dbmsSynchronizer.synchronizeSharedEntry(mergedBibEntry); + dbmsSynchronizer.synchronizeLocalDatabase(); + }); + + } + } @Subscribe From ea8f4b5c7933bc3fd00614995025084f0dee9e01 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Sat, 8 Jun 2019 19:27:12 +0200 Subject: [PATCH 18/19] Fix l10n --- src/main/resources/l10n/JabRef_en.properties | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 28e5ce1f177..05bf96191d1 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -1753,14 +1753,12 @@ Work\ offline=Work offline Working\ offline.=Working offline. Update\ refused.=Update refused. Update\ refused=Update refused -Local\ entry=Local entry -Shared\ entry=Shared entry Update\ could\ not\ be\ performed\ due\ to\ existing\ change\ conflicts.=Update could not be performed due to existing change conflicts. You\ are\ not\ working\ on\ the\ newest\ version\ of\ BibEntry.=You are not working on the newest version of BibEntry. Local\ version\:\ %0=Local version: %0 Shared\ version\:\ %0=Shared version: %0 Please\ merge\ the\ shared\ entry\ with\ yours\ and\ press\ "Merge\ entries"\ to\ resolve\ this\ problem.=Please merge the shared entry with yours and press "Merge entries" to resolve this problem. -Canceling\ this\ operation\ will\ leave\ your\ changes\ unsynchronized.\ Cancel\ anyway?=Canceling this operation will leave your changes unsynchronized. Cancel anyway? +Canceling\ this\ operation\ will\ leave\ your\ changes\ unsynchronized.=Canceling this operation will leave your changes unsynchronized. Shared\ entry\ is\ no\ longer\ present=Shared entry is no longer present The\ entry\ you\ currently\ work\ on\ has\ been\ deleted\ on\ the\ shared\ side.=The entry you currently work on has been deleted on the shared side. You\ can\ restore\ the\ entry\ using\ the\ "Undo"\ operation.=You can restore the entry using the "Undo" operation. From ff50e797e62a1022d881666a1d2fbe4716f53f58 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Sat, 8 Jun 2019 20:51:40 +0200 Subject: [PATCH 19/19] change wording --- .../java/org/jabref/gui/shared/SharedDatabaseUIManager.java | 2 +- src/main/resources/l10n/JabRef_en.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java b/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java index 63858b209a2..85d6683915e 100644 --- a/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java +++ b/src/main/java/org/jabref/gui/shared/SharedDatabaseUIManager.java @@ -96,7 +96,7 @@ public void listen(UpdateRefusedEvent updateRefusedEvent) { message.append("\r\n"); message.append(Localization.lang("Local version: %0", String.valueOf(localBibEntry.getSharedBibEntryData().getVersion()))); message.append("\r\n"); - message.append(Localization.lang("Please merge the shared entry with yours and press \"Merge entries\" to resolve this problem.")); + message.append(Localization.lang("Press \"Merge entries\" to merge the changes and resolve this problem.")); message.append("\r\n"); message.append(Localization.lang("Canceling this operation will leave your changes unsynchronized.")); diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 05bf96191d1..eb1ffbb0894 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -1757,7 +1757,7 @@ Update\ could\ not\ be\ performed\ due\ to\ existing\ change\ conflicts.=Update You\ are\ not\ working\ on\ the\ newest\ version\ of\ BibEntry.=You are not working on the newest version of BibEntry. Local\ version\:\ %0=Local version: %0 Shared\ version\:\ %0=Shared version: %0 -Please\ merge\ the\ shared\ entry\ with\ yours\ and\ press\ "Merge\ entries"\ to\ resolve\ this\ problem.=Please merge the shared entry with yours and press "Merge entries" to resolve this problem. +Press\ "Merge\ entries"\ to\ merge\ the\ changes\ and\ resolve\ this\ problem.=Press "Merge entries" to merge the changes and resolve this problem. Canceling\ this\ operation\ will\ leave\ your\ changes\ unsynchronized.=Canceling this operation will leave your changes unsynchronized. Shared\ entry\ is\ no\ longer\ present=Shared entry is no longer present The\ entry\ you\ currently\ work\ on\ has\ been\ deleted\ on\ the\ shared\ side.=The entry you currently work on has been deleted on the shared side.