diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index fe106584d86..160dc1798d0 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -40,7 +40,6 @@ import org.jabref.gui.Globals; import org.jabref.gui.autocompleter.AutoCompleteFirstNameMode; import org.jabref.gui.autocompleter.AutoCompletePreferences; -import org.jabref.gui.desktop.JabRefDesktop; import org.jabref.gui.duplicationFinder.DuplicateResolverDialog; import org.jabref.gui.entryeditor.EntryEditorPreferences; import org.jabref.gui.externalfiletype.ExternalFileType; @@ -710,7 +709,6 @@ private JabRefPreferences() { defaults.put(WARN_BEFORE_OVERWRITING_KEY, Boolean.TRUE); defaults.put(CONFIRM_DELETE, Boolean.TRUE); defaults.put(CONFIRM_LINKED_FILE_DELETE, Boolean.TRUE); - defaults.put(TRASH_INSTEAD_OF_DELETE, JabRefDesktop.moveToTrashSupported()); defaults.put(DEFAULT_CITATION_KEY_PATTERN, "[auth][year]"); defaults.put(UNWANTED_CITATION_KEY_CHARACTERS, "-`สน:!;?^+"); defaults.put(RESOLVE_STRINGS_FOR_FIELDS, "author;booktitle;editor;editora;editorb;editorc;institution;issuetitle;journal;journalsubtitle;journaltitle;mainsubtitle;month;publisher;shortauthor;shorteditor;subtitle;titleaddon"); @@ -2204,7 +2202,8 @@ public FilePreferences getFilePreferences() { // We choose the data directory, because a ".bak" file should survive cache cleanups getPath(BACKUP_DIRECTORY, OS.getNativeDesktop().getBackupDirectory()), getBoolean(CONFIRM_LINKED_FILE_DELETE), - getBoolean(TRASH_INSTEAD_OF_DELETE)); + // We make use of the fallback, because we need AWT being initialized, which is not the case at the constructor JabRefPreferences() + getBoolean(TRASH_INSTEAD_OF_DELETE, OS.getNativeDesktop().moveToTrashSupported())); EasyBind.listen(getInternalPreferences().getUserAndHostProperty(), (obs, oldValue, newValue) -> filePreferences.getUserAndHostProperty().setValue(newValue)); EasyBind.listen(filePreferences.mainFileDirectoryProperty(), (obs, oldValue, newValue) -> put(MAIN_FILE_DIRECTORY, newValue));