Skip to content

Commit

Permalink
Move FilePreferences to logic
Browse files Browse the repository at this point in the history
Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
  • Loading branch information
koppor and calixtus committed Sep 9, 2024
1 parent 5572342 commit 8823378
Show file tree
Hide file tree
Showing 114 changed files with 115 additions and 115 deletions.
4 changes: 2 additions & 2 deletions docs/code-howtos/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ JabRef stores files relative to one of [multiple possible directories](https://d
The convert the relative path to an absolute one, there is the `find` method in `FileUtil`:

```java
org.jabref.logic.util.io.FileUtil.find(org.jabref.model.database.BibDatabaseContext, java.lang.String, org.jabref.gui.FilePreferences)
org.jabref.logic.util.io.FileUtil.find(org.jabref.model.database.BibDatabaseContext, java.lang.String, org.jabref.logic.FilePreferences)
```

`String path` Can be the files name or a relative path to it. The Preferences should only be directly accessed in the GUI. For the usage in logic pass them as parameter
Expand All @@ -59,7 +59,7 @@ When adding a file to a library, the path should be stored relative to "the best
This is implemented in `FileUtil`:

```java
org.jabref.logic.util.io.FileUtil.relativize(java.nio.file.Path, org.jabref.model.database.BibDatabaseContext, org.jabref.gui.FilePreferences)
org.jabref.logic.util.io.FileUtil.relativize(java.nio.file.Path, org.jabref.model.database.BibDatabaseContext, org.jabref.logic.FilePreferences)
```

## Setting a Directory for a .bib File
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.Set;
import java.util.prefs.BackingStoreException;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiles.AutoSetFileLinksUtil;
import org.jabref.logic.JabRefException;
import org.jabref.logic.UiCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javafx.scene.Node;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.ai.components.util.EmbeddingModelGuardedComponent;
import org.jabref.logic.ai.AiPreferences;
import org.jabref.logic.ai.AiService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javafx.scene.Scene;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.util.BaseWindow;
import org.jabref.logic.ai.AiPreferences;
import org.jabref.logic.ai.AiService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javafx.scene.Node;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.ai.components.aichat.AiChatGuardedComponent;
import org.jabref.gui.util.DynamicallyChangeableNode;
import org.jabref.logic.ai.AiPreferences;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import javafx.scene.text.TextFlow;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.desktop.os.NativeDesktop;
import org.jabref.logic.ai.AiPreferences;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javafx.scene.Node;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.ai.components.privacynotice.AiPrivacyNoticeGuardedComponent;
import org.jabref.gui.ai.components.util.errorstate.ErrorStateComponent;
import org.jabref.logic.ai.AiPreferences;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javafx.scene.Node;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.ai.components.privacynotice.AiPrivacyNoticeGuardedComponent;
import org.jabref.gui.ai.components.util.errorstate.ErrorStateComponent;
import org.jabref.gui.util.UiTaskExecutor;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/cleanup/CleanupDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javafx.scene.control.ButtonType;
import javafx.scene.control.ScrollPane;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.util.BaseDialog;
import org.jabref.logic.cleanup.CleanupPreferences;
import org.jabref.logic.l10n.Localization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.commonfxcontrols.FieldFormatterCleanupsPanel;
import org.jabref.logic.cleanup.CleanupPreferences;
import org.jabref.logic.cleanup.FieldFormatterCleanups;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import javafx.beans.binding.Bindings;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.logic.l10n.Localization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.jabref.Launcher;
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.logic.util.Directories;

import org.slf4j.LoggerFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/desktop/os/Linux.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.jabref.Launcher;
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.util.StreamGobbler;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/desktop/os/NativeDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.ClipBoardManager;
import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.frame.ExternalApplicationsPreferences;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/desktop/os/OSX.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.jabref.Launcher;
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/desktop/os/Windows.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import org.jabref.Launcher;
import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.logic.util.Directories;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/edit/OpenBrowserAction.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jabref.gui.edit;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.desktop.os.NativeDesktop;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/entryeditor/AiChatTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import javafx.scene.control.Tooltip;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.ai.chatting.chathistory.ChatHistoryService;
import org.jabref.gui.ai.components.aichat.AiChatGuardedComponent;
import org.jabref.gui.ai.components.privacynotice.PrivacyNoticeComponent;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/entryeditor/AiSummaryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javafx.scene.control.Tooltip;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.ai.components.summary.SummaryComponent;
import org.jabref.logic.ai.AiPreferences;
import org.jabref.logic.ai.AiService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Optional;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.fieldeditors.WriteMetadataToSinglePdfAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;
import java.util.function.BiConsumer;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.externalfiletype.UnknownExternalFileType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Optional;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.externalfiletype.UnknownExternalFileType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.List;
import java.util.stream.Collectors;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.icon.JabRefIcon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import javax.swing.undo.UndoManager;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.StateManager;
import org.jabref.gui.duplicationFinder.DuplicateResolverDialog;
import org.jabref.gui.fieldeditors.LinkedFileViewModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.jabref.logic.util.BackgroundTask;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;

/**
* {@link FileFilter} implementation, that allows only files which are not linked in any of the {@link BibEntry}s of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Objects;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Optional;
import java.util.Set;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.logic.bibtex.FileFieldWriter;
import org.jabref.logic.util.io.FileUtil;
import org.jabref.model.entry.LinkedFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.jabref.gui.AbstractViewModel;
import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.desktop.os.NativeDesktop;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import javafx.collections.ObservableList;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.autocompleter.SuggestionProvider;
import org.jabref.gui.externalfiles.AutoSetFileLinksUtil;
import org.jabref.gui.externalfiletype.CustomExternalFileType;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/fieldeditors/URLUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Objects;
import java.util.Optional;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileTypes;

public class URLUtil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import javax.xml.transform.TransformerException;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.logic.bibtex.FieldPreferences;
import org.jabref.logic.exporter.EmbeddedBibFilePdfExporter;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/help/HelpAction.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jabref.gui.help;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.desktop.os.NativeDesktop;
import org.jabref.logic.help.HelpFile;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/help/NewVersionDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import javafx.scene.layout.VBox;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.desktop.os.NativeDesktop;
import org.jabref.gui.util.BaseDialog;
import org.jabref.logic.l10n.Localization;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/help/VersionWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.concurrent.TimeUnit;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.logic.InternalPreferences;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.BackgroundTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import javafx.collections.ObservableList;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.help.HelpAction;
import org.jabref.gui.libraryproperties.PropertiesTabViewModel;
import org.jabref.logic.bibtex.comparator.BibtexStringComparator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Optional;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.LibraryTab;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.ActionHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import javafx.scene.layout.VBox;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.desktop.os.NativeDesktop;
import org.jabref.gui.fieldeditors.LinkedFileViewModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import javafx.beans.property.SimpleDoubleProperty;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import org.jabref.gui.AbstractViewModel;
import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.externalfiletype.UnknownExternalFileType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Optional;

import org.jabref.gui.DialogService;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.logic.l10n.Localization;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.jabref.gui.ClipBoardManager;
import org.jabref.gui.DialogService;
import org.jabref.gui.DragAndDropDataFormats;
import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.LibraryTab;
import org.jabref.gui.LibraryTabContainer;
import org.jabref.gui.StateManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.io.IOException;
import java.net.URI;

import org.jabref.gui.FilePreferences;
import org.jabref.logic.FilePreferences;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.desktop.os.NativeDesktop;
import org.jabref.model.entry.identifier.DOI;
Expand Down
Loading

0 comments on commit 8823378

Please sign in to comment.