From 2b602582cad9eb7451da9f0a080a53507cdb0e70 Mon Sep 17 00:00:00 2001 From: Simone Date: Sun, 23 Oct 2022 23:06:02 +1100 Subject: [PATCH 01/12] Removed BibTeX file type and included HTML and TXT types --- CHANGELOG.md | 1 + .../UnlinkedFilesDialogViewModel.java | 54 +++++++------------ 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ed74a68e2c..04d57d975e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where a message about changed metadata would occur on saving although nothing changed. [#9159](https://github.com/JabRef/jabref/issues/9159) - When adding or editing a subgroup it is placed w.r.t. to alphabetical ordering rather than at the end. [koppor#577](https://github.com/koppor/jabref/issues/577) - We modified the Directory of Open Access Books (DOAB) fetcher so that it will now also fetch the ISBN when possible. [#8708](https://github.com/JabRef/jabref/issues/8708) +- We modified the dropdown options in Find Unlinked Files by removing BibTex and including HTML and TXT file types. [koppor#547](https://github.com/koppor/jabref/issues/547) ### Fixed diff --git a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java index 2129e473c4a..7216d53e1ca 100644 --- a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java +++ b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java @@ -1,53 +1,38 @@ package org.jabref.gui.externalfiles; -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.DirectoryStream.Filter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.List; -import java.util.Optional; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import javax.swing.undo.UndoManager; - -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.SimpleBooleanProperty; -import javafx.beans.property.SimpleDoubleProperty; -import javafx.beans.property.SimpleListProperty; -import javafx.beans.property.SimpleObjectProperty; -import javafx.beans.property.SimpleStringProperty; -import javafx.beans.property.StringProperty; +import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; +import de.saxsys.mvvmfx.utils.validation.ValidationMessage; +import de.saxsys.mvvmfx.utils.validation.ValidationStatus; +import javafx.beans.property.*; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.control.ProgressIndicator; import javafx.scene.control.TreeItem; - import org.jabref.gui.DialogService; import org.jabref.gui.StateManager; -import org.jabref.gui.util.BackgroundTask; -import org.jabref.gui.util.DirectoryDialogConfiguration; -import org.jabref.gui.util.FileDialogConfiguration; -import org.jabref.gui.util.FileNodeViewModel; -import org.jabref.gui.util.TaskExecutor; +import org.jabref.gui.util.*; import org.jabref.logic.importer.ImportFormatReader; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.StandardFileType; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.util.FileUpdateMonitor; import org.jabref.preferences.PreferencesService; - -import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; -import de.saxsys.mvvmfx.utils.validation.ValidationMessage; -import de.saxsys.mvvmfx.utils.validation.ValidationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.swing.undo.UndoManager; +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.DirectoryStream.Filter; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; +import java.util.List; +import java.util.Optional; +import java.util.function.Predicate; +import java.util.stream.Collectors; + public class UnlinkedFilesDialogViewModel { private static final Logger LOGGER = LoggerFactory.getLogger(UnlinkedFilesDialogViewModel.class); @@ -102,7 +87,8 @@ public UnlinkedFilesDialogViewModel(DialogService dialogService, this.fileFilterList = FXCollections.observableArrayList( new FileExtensionViewModel(StandardFileType.ANY_FILE, preferences.getFilePreferences()), - new FileExtensionViewModel(StandardFileType.BIBTEX_DB, preferences.getFilePreferences()), + new FileExtensionViewModel(StandardFileType.HTML, preferences.getFilePreferences()), + new FileExtensionViewModel(StandardFileType.TXT, preferences.getFilePreferences()), new FileExtensionViewModel(StandardFileType.PDF, preferences.getFilePreferences())); this.dateFilterList = FXCollections.observableArrayList(DateRange.values()); From b2c0a2aa2338f760e9d5d1addfba580de037d7dc Mon Sep 17 00:00:00 2001 From: Simone Date: Wed, 26 Oct 2022 18:38:50 +1100 Subject: [PATCH 02/12] reverted changes to imports in UnlinkedFilesDialogViewModel --- .../jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java index 7216d53e1ca..f18d32cce9d 100644 --- a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java +++ b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java @@ -19,7 +19,6 @@ import org.jabref.preferences.PreferencesService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import javax.swing.undo.UndoManager; import java.io.BufferedWriter; import java.io.IOException; From 394287070b9a16ea83d4d914180423d7649827b7 Mon Sep 17 00:00:00 2001 From: Simone Date: Wed, 26 Oct 2022 18:41:27 +1100 Subject: [PATCH 03/12] removed TXT option from the fileFilterList --- .../jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java index f18d32cce9d..6eeae8a6dff 100644 --- a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java +++ b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java @@ -87,7 +87,6 @@ public UnlinkedFilesDialogViewModel(DialogService dialogService, this.fileFilterList = FXCollections.observableArrayList( new FileExtensionViewModel(StandardFileType.ANY_FILE, preferences.getFilePreferences()), new FileExtensionViewModel(StandardFileType.HTML, preferences.getFilePreferences()), - new FileExtensionViewModel(StandardFileType.TXT, preferences.getFilePreferences()), new FileExtensionViewModel(StandardFileType.PDF, preferences.getFilePreferences())); this.dateFilterList = FXCollections.observableArrayList(DateRange.values()); From 55436c10ef27ad56abc09af3bc0a56610e017cba Mon Sep 17 00:00:00 2001 From: Simone Date: Wed, 26 Oct 2022 20:11:46 +1100 Subject: [PATCH 04/12] Added method to check whether a file is a html file and corrected code comments --- .../org/jabref/logic/util/io/FileUtil.java | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/jabref/logic/util/io/FileUtil.java b/src/main/java/org/jabref/logic/util/io/FileUtil.java index 7d63235c647..c067e2a9425 100644 --- a/src/main/java/org/jabref/logic/util/io/FileUtil.java +++ b/src/main/java/org/jabref/logic/util/io/FileUtil.java @@ -1,36 +1,21 @@ package org.jabref.logic.util.io; -import java.io.File; -import java.io.IOException; -import java.io.UncheckedIOException; -import java.nio.file.CopyOption; -import java.nio.file.FileSystems; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Objects; -import java.util.Optional; -import java.util.Stack; -import java.util.Vector; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - import org.jabref.logic.citationkeypattern.BracketedPattern; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.util.FileHelper; import org.jabref.model.util.OptionalUtil; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.*; +import java.util.*; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * The idea of this class is to add general functionality that could possibly even in the @@ -380,15 +365,26 @@ public static boolean isBibFile(Path file) { } /** - * Test if the file is a bib file by simply checking the extension to be ".bib" + * Test if the file is a pdf file by simply checking the extension to be ".pdf" * * @param file The file to check - * @return True if file extension is ".bib", false otherwise + * @return True if file extension is ".pdf", false otherwise */ public static boolean isPDFFile(Path file) { return getFileExtension(file).filter("pdf"::equals).isPresent(); } + /** + * Test if the file is a html file by simply checking the extension to be ".html" + * + * @param file The file to check + * @return True if file extension is ".html", false otherwise + */ + public static boolean isHTMLFile(Path file) { + return getFileExtension(file).filter("html"::equals).isPresent(); + } + + /** * @return Path of current panel database directory or the standard working directory in case the database was not saved yet */ From 104ebc007316bff88e16f807826c13daaceed9cf Mon Sep 17 00:00:00 2001 From: Simone Date: Fri, 28 Oct 2022 15:55:45 +1100 Subject: [PATCH 05/12] Added Markdown as a filter option --- CHANGELOG.md | 2 +- .../gui/externalfiles/UnlinkedFilesDialogViewModel.java | 1 + src/main/java/org/jabref/logic/util/StandardFileType.java | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04d57d975e1..8ef4a594ace 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where a message about changed metadata would occur on saving although nothing changed. [#9159](https://github.com/JabRef/jabref/issues/9159) - When adding or editing a subgroup it is placed w.r.t. to alphabetical ordering rather than at the end. [koppor#577](https://github.com/koppor/jabref/issues/577) - We modified the Directory of Open Access Books (DOAB) fetcher so that it will now also fetch the ISBN when possible. [#8708](https://github.com/JabRef/jabref/issues/8708) -- We modified the dropdown options in Find Unlinked Files by removing BibTex and including HTML and TXT file types. [koppor#547](https://github.com/koppor/jabref/issues/547) +- We added HTML, TXT and Markdown files to Find Unlinked Files and removed BibTex. Markdown was added as a StandardFileType [koppor#547](https://github.com/koppor/jabref/issues/547) ### Fixed diff --git a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java index 6eeae8a6dff..94dd7f77aba 100644 --- a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java +++ b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java @@ -87,6 +87,7 @@ public UnlinkedFilesDialogViewModel(DialogService dialogService, this.fileFilterList = FXCollections.observableArrayList( new FileExtensionViewModel(StandardFileType.ANY_FILE, preferences.getFilePreferences()), new FileExtensionViewModel(StandardFileType.HTML, preferences.getFilePreferences()), + new FileExtensionViewModel(StandardFileType.MARKDOWN, preferences.getFilePreferences()), new FileExtensionViewModel(StandardFileType.PDF, preferences.getFilePreferences())); this.dateFilterList = FXCollections.observableArrayList(DateRange.values()); diff --git a/src/main/java/org/jabref/logic/util/StandardFileType.java b/src/main/java/org/jabref/logic/util/StandardFileType.java index aadae024051..152b0023c37 100644 --- a/src/main/java/org/jabref/logic/util/StandardFileType.java +++ b/src/main/java/org/jabref/logic/util/StandardFileType.java @@ -1,10 +1,9 @@ package org.jabref.logic.util; +import org.jabref.model.util.OptionalUtil; import java.util.Arrays; import java.util.List; -import org.jabref.model.util.OptionalUtil; - /** * @implNote Enter the extensions in lowercase without a dot! The dot is added implicitly. */ @@ -45,7 +44,9 @@ public enum StandardFileType implements FileType { CFF("CFF", "cff"), ANY_FILE("Any", "*"), CER("SSL Certificate", "cer"), - CITAVI("Citavi", "ctv6bak", "ctv5bak"); + CITAVI("Citavi", "ctv6bak", "ctv5bak"), + MARKDOWN("Markdown", "md"); + ; From 77c920fd725d378866efda5aa277caaed1c40c62 Mon Sep 17 00:00:00 2001 From: Simone Date: Fri, 28 Oct 2022 16:45:27 +1100 Subject: [PATCH 06/12] resolved changelog conflicts --- CHANGELOG.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ef4a594ace..ab496ea6ada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,9 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where a message about changed metadata would occur on saving although nothing changed. [#9159](https://github.com/JabRef/jabref/issues/9159) - When adding or editing a subgroup it is placed w.r.t. to alphabetical ordering rather than at the end. [koppor#577](https://github.com/koppor/jabref/issues/577) - We modified the Directory of Open Access Books (DOAB) fetcher so that it will now also fetch the ISBN when possible. [#8708](https://github.com/JabRef/jabref/issues/8708) -- We added HTML, TXT and Markdown files to Find Unlinked Files and removed BibTex. Markdown was added as a StandardFileType [koppor#547](https://github.com/koppor/jabref/issues/547) +- We modified the "Delete file" dialog and add the full file path to the dialog text. The file path in the title was changed to file name only. [koppor#534](https://github.com/koppor/jabref/issues/534) +- Download from URL now automatically fills with URL from clipboard. [koppor#535](https://github.com/koppor/jabref/issues/535) +- We added HTML and Markdown files to Find Unlinked Files and removed BibTex. Markdown was added as a StandardFileType [koppor#547](https://github.com/koppor/jabref/issues/547) ### Fixed @@ -769,10 +771,10 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where some importers used the field `pubstatus` instead of the standard BibTeX field `pubstate`. - We changed the latex command removal for docbook exporter. [#3838](https://github.com/JabRef/jabref/issues/3838) - We changed the location of some fields in the entry editor (you might need to reset your preferences for these changes to come into effect) - - Journal/Year/Month in biblatex mode -> Deprecated (if filled) - - DOI/URL: General -> Optional - - Internal fields like ranking, read status and priority: Other -> General - - Moreover, empty deprecated fields are no longer shown + - Journal/Year/Month in biblatex mode -> Deprecated (if filled) + - DOI/URL: General -> Optional + - Internal fields like ranking, read status and priority: Other -> General + - Moreover, empty deprecated fields are no longer shown - Added server timezone parameter when connecting to a shared database. - We updated the dialog for setting up general fields. - URL field formatting is updated. All whitespace chars, located at the beginning/ending of the URL, are trimmed automatically @@ -904,12 +906,12 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We removed the coloring of cells in the main table according to whether the field is optional/required. - We removed the feature to find and resolve duplicate BibTeX keys (as this use case is already covered by the integrity check). - We removed a few commands from the right-click menu that are not needed often and thus don't need to be placed that prominently: - - Print entry preview: available through entry preview - - All commands related to marking: marking is not yet reimplemented - - Set/clear/append/rename fields: available through Edit menu - - Manage keywords: available through the Edit menu - - Copy linked files to folder: available through File menu - - Add/move/remove from group: removed completely (functionality still available through group interface) + - Print entry preview: available through entry preview + - All commands related to marking: marking is not yet reimplemented + - Set/clear/append/rename fields: available through Edit menu + - Manage keywords: available through the Edit menu + - Copy linked files to folder: available through File menu + - Add/move/remove from group: removed completely (functionality still available through group interface) - We removed the option to change the column widths in the preferences dialog. [#4546](https://github.com/JabRef/jabref/issues/4546) ## Older versions From 61d34aff4d421eed615eb1d61ea57da581582f00 Mon Sep 17 00:00:00 2001 From: Simone Date: Fri, 28 Oct 2022 19:58:13 +1100 Subject: [PATCH 07/12] Added icon to Markdown option --- CHANGELOG.md | 2 +- .../jabref/gui/externalfiletype/StandardExternalFileType.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab496ea6ada..718f609d02f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,7 +47,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We modified the Directory of Open Access Books (DOAB) fetcher so that it will now also fetch the ISBN when possible. [#8708](https://github.com/JabRef/jabref/issues/8708) - We modified the "Delete file" dialog and add the full file path to the dialog text. The file path in the title was changed to file name only. [koppor#534](https://github.com/koppor/jabref/issues/534) - Download from URL now automatically fills with URL from clipboard. [koppor#535](https://github.com/koppor/jabref/issues/535) -- We added HTML and Markdown files to Find Unlinked Files and removed BibTex. Markdown was added as a StandardFileType [koppor#547](https://github.com/koppor/jabref/issues/547) +- We added HTML and Markdown files to Find Unlinked Files and removed BibTex. Markdown was added as a StandardFileType and StandardExternalFileType [koppor#547](https://github.com/koppor/jabref/issues/547) ### Fixed diff --git a/src/main/java/org/jabref/gui/externalfiletype/StandardExternalFileType.java b/src/main/java/org/jabref/gui/externalfiletype/StandardExternalFileType.java index 92718e09a7a..fb3235d0498 100644 --- a/src/main/java/org/jabref/gui/externalfiletype/StandardExternalFileType.java +++ b/src/main/java/org/jabref/gui/externalfiletype/StandardExternalFileType.java @@ -28,8 +28,8 @@ public enum StandardExternalFileType implements ExternalFileType { TIFF(Localization.lang("%0 image", "TIFF"), "tiff", "image/tiff", "gimp", "picture", IconTheme.JabRefIcons.PICTURE), URL("URL", "html", "text/html", "firefox", "www", IconTheme.JabRefIcons.WWW), MHT("MHT", "mht", "multipart/related", "firefox", "www", IconTheme.JabRefIcons.WWW), - ePUB("ePUB", "epub", "application/epub+zip", "firefox", "www", IconTheme.JabRefIcons.WWW); - + ePUB("ePUB", "epub", "application/epub+zip", "firefox", "www", IconTheme.JabRefIcons.WWW), + MARKDOWN("Markdown", "md", "application/x-latex", "emacs", "emacs", IconTheme.JabRefIcons.FILE_TEXT); private final String name; private final String extension; private final String mimeType; From 180d39f5492ecd94f5f0f5574b62db9c8c4c6920 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 28 Oct 2022 17:55:29 +0200 Subject: [PATCH 08/12] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 718f609d02f..00231c6436f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,7 +47,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We modified the Directory of Open Access Books (DOAB) fetcher so that it will now also fetch the ISBN when possible. [#8708](https://github.com/JabRef/jabref/issues/8708) - We modified the "Delete file" dialog and add the full file path to the dialog text. The file path in the title was changed to file name only. [koppor#534](https://github.com/koppor/jabref/issues/534) - Download from URL now automatically fills with URL from clipboard. [koppor#535](https://github.com/koppor/jabref/issues/535) -- We added HTML and Markdown files to Find Unlinked Files and removed BibTex. Markdown was added as a StandardFileType and StandardExternalFileType [koppor#547](https://github.com/koppor/jabref/issues/547) +- We added HTML and Markdown files to Find Unlinked Files and removed BibTex. [koppor#547](https://github.com/koppor/jabref/issues/547) ### Fixed From 081bd956422d46b8ab57ccae9fa3d30a90832ea7 Mon Sep 17 00:00:00 2001 From: Simone Date: Sat, 29 Oct 2022 13:36:55 +1100 Subject: [PATCH 09/12] Added markdown to ExternalFileTypesTest and fixed checkstyle --- .../UnlinkedFilesDialogViewModel.java | 50 ++++++++++++------- .../jabref/logic/util/StandardFileType.java | 5 +- .../org/jabref/logic/util/io/FileUtil.java | 42 +++++++++------- .../ExternalFileTypesTest.java | 1 + 4 files changed, 60 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java index 94dd7f77aba..92fc8904b5e 100644 --- a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java +++ b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogViewModel.java @@ -1,36 +1,52 @@ package org.jabref.gui.externalfiles; -import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; -import de.saxsys.mvvmfx.utils.validation.ValidationMessage; -import de.saxsys.mvvmfx.utils.validation.ValidationStatus; -import javafx.beans.property.*; +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.DirectoryStream.Filter; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; +import java.util.List; +import java.util.Optional; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import javax.swing.undo.UndoManager; + +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleBooleanProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.property.SimpleListProperty; +import javafx.beans.property.SimpleObjectProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.control.ProgressIndicator; import javafx.scene.control.TreeItem; + import org.jabref.gui.DialogService; import org.jabref.gui.StateManager; -import org.jabref.gui.util.*; +import org.jabref.gui.util.BackgroundTask; +import org.jabref.gui.util.DirectoryDialogConfiguration; +import org.jabref.gui.util.FileDialogConfiguration; +import org.jabref.gui.util.FileNodeViewModel; +import org.jabref.gui.util.TaskExecutor; import org.jabref.logic.importer.ImportFormatReader; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.StandardFileType; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.util.FileUpdateMonitor; import org.jabref.preferences.PreferencesService; + +import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; +import de.saxsys.mvvmfx.utils.validation.ValidationMessage; +import de.saxsys.mvvmfx.utils.validation.ValidationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.swing.undo.UndoManager; -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.DirectoryStream.Filter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.List; -import java.util.Optional; -import java.util.function.Predicate; -import java.util.stream.Collectors; public class UnlinkedFilesDialogViewModel { diff --git a/src/main/java/org/jabref/logic/util/StandardFileType.java b/src/main/java/org/jabref/logic/util/StandardFileType.java index 152b0023c37..0b7f73e5a09 100644 --- a/src/main/java/org/jabref/logic/util/StandardFileType.java +++ b/src/main/java/org/jabref/logic/util/StandardFileType.java @@ -1,9 +1,10 @@ package org.jabref.logic.util; -import org.jabref.model.util.OptionalUtil; import java.util.Arrays; import java.util.List; +import org.jabref.model.util.OptionalUtil; + /** * @implNote Enter the extensions in lowercase without a dot! The dot is added implicitly. */ @@ -46,7 +47,7 @@ public enum StandardFileType implements FileType { CER("SSL Certificate", "cer"), CITAVI("Citavi", "ctv6bak", "ctv5bak"), MARKDOWN("Markdown", "md"); - ; + diff --git a/src/main/java/org/jabref/logic/util/io/FileUtil.java b/src/main/java/org/jabref/logic/util/io/FileUtil.java index c067e2a9425..2b02869a59d 100644 --- a/src/main/java/org/jabref/logic/util/io/FileUtil.java +++ b/src/main/java/org/jabref/logic/util/io/FileUtil.java @@ -1,21 +1,36 @@ package org.jabref.logic.util.io; +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.CopyOption; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.nio.file.StandardOpenOption; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Objects; +import java.util.Optional; +import java.util.Stack; +import java.util.Vector; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import org.jabref.logic.citationkeypattern.BracketedPattern; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.util.FileHelper; import org.jabref.model.util.OptionalUtil; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.IOException; -import java.io.UncheckedIOException; -import java.nio.file.*; -import java.util.*; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; /** * The idea of this class is to add general functionality that could possibly even in the @@ -374,17 +389,6 @@ public static boolean isPDFFile(Path file) { return getFileExtension(file).filter("pdf"::equals).isPresent(); } - /** - * Test if the file is a html file by simply checking the extension to be ".html" - * - * @param file The file to check - * @return True if file extension is ".html", false otherwise - */ - public static boolean isHTMLFile(Path file) { - return getFileExtension(file).filter("html"::equals).isPresent(); - } - - /** * @return Path of current panel database directory or the standard working directory in case the database was not saved yet */ diff --git a/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java b/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java index dadcba319fc..8ca169a8fe4 100644 --- a/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java +++ b/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java @@ -22,6 +22,7 @@ class ExternalFileTypesTest { private static final Set TEST_LIST = Set.of( + StandardExternalFileType.MARKDOWN, StandardExternalFileType.PDF, StandardExternalFileType.URL, StandardExternalFileType.JPG, From e54f7cdca3b8c1e9ee852f39da291f20838b1b29 Mon Sep 17 00:00:00 2001 From: Simone Date: Sun, 30 Oct 2022 00:09:34 +1100 Subject: [PATCH 10/12] changed Markdown mime to text/markdown --- .../jabref/gui/externalfiletype/StandardExternalFileType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/externalfiletype/StandardExternalFileType.java b/src/main/java/org/jabref/gui/externalfiletype/StandardExternalFileType.java index fb3235d0498..fc12e9670e8 100644 --- a/src/main/java/org/jabref/gui/externalfiletype/StandardExternalFileType.java +++ b/src/main/java/org/jabref/gui/externalfiletype/StandardExternalFileType.java @@ -29,7 +29,7 @@ public enum StandardExternalFileType implements ExternalFileType { URL("URL", "html", "text/html", "firefox", "www", IconTheme.JabRefIcons.WWW), MHT("MHT", "mht", "multipart/related", "firefox", "www", IconTheme.JabRefIcons.WWW), ePUB("ePUB", "epub", "application/epub+zip", "firefox", "www", IconTheme.JabRefIcons.WWW), - MARKDOWN("Markdown", "md", "application/x-latex", "emacs", "emacs", IconTheme.JabRefIcons.FILE_TEXT); + MARKDOWN("Markdown", "md", "text/markdown", "emacs", "emacs", IconTheme.JabRefIcons.FILE_TEXT); private final String name; private final String extension; private final String mimeType; From 86d559f97b6e7a8dbbfdc3abba45f2522b071510 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Sun, 30 Oct 2022 15:02:35 +0100 Subject: [PATCH 11/12] Update CHANGELOG.md --- CHANGELOG.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b48883b144..945312ae828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -771,10 +771,10 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where some importers used the field `pubstatus` instead of the standard BibTeX field `pubstate`. - We changed the latex command removal for docbook exporter. [#3838](https://github.com/JabRef/jabref/issues/3838) - We changed the location of some fields in the entry editor (you might need to reset your preferences for these changes to come into effect) - - Journal/Year/Month in biblatex mode -> Deprecated (if filled) - - DOI/URL: General -> Optional - - Internal fields like ranking, read status and priority: Other -> General - - Moreover, empty deprecated fields are no longer shown +- Journal/Year/Month in biblatex mode -> Deprecated (if filled) +- DOI/URL: General -> Optional +- Internal fields like ranking, read status and priority: Other -> General +- Moreover, empty deprecated fields are no longer shown - Added server timezone parameter when connecting to a shared database. - We updated the dialog for setting up general fields. - URL field formatting is updated. All whitespace chars, located at the beginning/ending of the URL, are trimmed automatically @@ -906,12 +906,12 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We removed the coloring of cells in the main table according to whether the field is optional/required. - We removed the feature to find and resolve duplicate BibTeX keys (as this use case is already covered by the integrity check). - We removed a few commands from the right-click menu that are not needed often and thus don't need to be placed that prominently: - - Print entry preview: available through entry preview - - All commands related to marking: marking is not yet reimplemented - - Set/clear/append/rename fields: available through Edit menu - - Manage keywords: available through the Edit menu - - Copy linked files to folder: available through File menu - - Add/move/remove from group: removed completely (functionality still available through group interface) +- Print entry preview: available through entry preview +- All commands related to marking: marking is not yet reimplemented +- Set/clear/append/rename fields: available through Edit menu +- Manage keywords: available through the Edit menu +- Copy linked files to folder: available through File menu +- Add/move/remove from group: removed completely (functionality still available through group interface) - We removed the option to change the column widths in the preferences dialog. [#4546](https://github.com/JabRef/jabref/issues/4546) ## Older versions From 8e9fba652c301bfd1831d92b13aff4de0247070a Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Sun, 30 Oct 2022 15:04:41 +0100 Subject: [PATCH 12/12] Update CHANGELOG.md --- CHANGELOG.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 945312ae828..16d3901349c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -771,10 +771,10 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where some importers used the field `pubstatus` instead of the standard BibTeX field `pubstate`. - We changed the latex command removal for docbook exporter. [#3838](https://github.com/JabRef/jabref/issues/3838) - We changed the location of some fields in the entry editor (you might need to reset your preferences for these changes to come into effect) -- Journal/Year/Month in biblatex mode -> Deprecated (if filled) -- DOI/URL: General -> Optional -- Internal fields like ranking, read status and priority: Other -> General -- Moreover, empty deprecated fields are no longer shown + - Journal/Year/Month in biblatex mode -> Deprecated (if filled) + - DOI/URL: General -> Optional + - Internal fields like ranking, read status and priority: Other -> General + - Moreover, empty deprecated fields are no longer shown - Added server timezone parameter when connecting to a shared database. - We updated the dialog for setting up general fields. - URL field formatting is updated. All whitespace chars, located at the beginning/ending of the URL, are trimmed automatically @@ -906,12 +906,12 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We removed the coloring of cells in the main table according to whether the field is optional/required. - We removed the feature to find and resolve duplicate BibTeX keys (as this use case is already covered by the integrity check). - We removed a few commands from the right-click menu that are not needed often and thus don't need to be placed that prominently: -- Print entry preview: available through entry preview -- All commands related to marking: marking is not yet reimplemented -- Set/clear/append/rename fields: available through Edit menu -- Manage keywords: available through the Edit menu -- Copy linked files to folder: available through File menu -- Add/move/remove from group: removed completely (functionality still available through group interface) + - Print entry preview: available through entry preview + - All commands related to marking: marking is not yet reimplemented + - Set/clear/append/rename fields: available through Edit menu + - Manage keywords: available through the Edit menu + - Copy linked files to folder: available through File menu + - Add/move/remove from group: removed completely (functionality still available through group interface) - We removed the option to change the column widths in the preferences dialog. [#4546](https://github.com/JabRef/jabref/issues/4546) ## Older versions