abbreviationMap = abbreviations.stream()
.collect(Collectors.toMap(
Abbreviation::getName,
abbreviation -> abbreviation,
diff --git a/src/main/java/org/jabref/cli/Launcher.java b/src/main/java/org/jabref/cli/Launcher.java
index a49ea92e865..5ae86e8c636 100644
--- a/src/main/java/org/jabref/cli/Launcher.java
+++ b/src/main/java/org/jabref/cli/Launcher.java
@@ -1,14 +1,6 @@
package org.jabref.cli;
-import java.io.File;
-import java.io.IOException;
-import java.net.Authenticator;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Comparator;
-import java.util.Map;
-
+import org.apache.commons.cli.ParseException;
import org.jabref.gui.Globals;
import org.jabref.gui.MainApplication;
import org.jabref.logic.journals.JournalAbbreviationLoader;
@@ -27,13 +19,20 @@
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.JabRefPreferences;
import org.jabref.preferences.PreferencesService;
-
-import org.apache.commons.cli.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.tinylog.configuration.Configuration;
+import java.io.File;
+import java.io.IOException;
+import java.net.Authenticator;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Comparator;
+import java.util.Map;
+
/**
* The main entry point for the JabRef application.
*
@@ -100,7 +99,12 @@ public static void main(String[] args) {
System.exit(0);
}
- MainApplication.main(argumentProcessor.getParserResults(), argumentProcessor.isBlank(), preferences, fileUpdateMonitor, ARGUMENTS);
+ MainApplication.main(
+ argumentProcessor.getParserResults(),
+ argumentProcessor.isBlank(),
+ preferences,
+ fileUpdateMonitor,
+ ARGUMENTS);
} catch (ParseException e) {
LOGGER.error("Problem parsing arguments", e);
JabRefCLI.printUsage(preferences);
@@ -132,11 +136,16 @@ private static void addLogToDisk() {
// The "Shared File Writer" is explained at
// https://tinylog.org/v2/configuration/#shared-file-writer
Map configuration = Map.of(
- "writerFile", "shared file",
- "writerFile.level", isDebugEnabled ? "debug" : "info",
- "level", isDebugEnabled ? "debug" : "info",
- "writerFile.file", directory.resolve("log.txt").toString(),
- "writerFile.charset", "UTF-8");
+ "writerFile",
+ "shared file",
+ "writerFile.level",
+ isDebugEnabled ? "debug" : "info",
+ "level",
+ isDebugEnabled ? "debug" : "info",
+ "writerFile.file",
+ directory.resolve("log.txt").toString(),
+ "writerFile.charset",
+ "UTF-8");
configuration.entrySet().forEach(config -> Configuration.set(config.getKey(), config.getValue()));
initializeLogger();
@@ -167,8 +176,8 @@ private static boolean handleMultipleAppInstances(String[] args, RemotePreferenc
private static void initGlobals(PreferencesService preferences) {
// Read list(s) of journal names and abbreviations
- Globals.journalAbbreviationRepository = JournalAbbreviationLoader
- .loadRepository(preferences.getJournalAbbreviationPreferences());
+ Globals.journalAbbreviationRepository =
+ JournalAbbreviationLoader.loadRepository(preferences.getJournalAbbreviationPreferences());
Globals.entryTypesManager = preferences.getCustomEntryTypesRepository();
Globals.protectedTermsLoader = new ProtectedTermsLoader(preferences.getProtectedTermsPreferences());
@@ -197,7 +206,9 @@ private static void clearOldSearchIndices() {
try (DirectoryStream stream = Files.newDirectoryStream(appData)) {
for (Path path : stream) {
- if (Files.isDirectory(path) && !path.toString().endsWith("ssl") && path.toString().contains("lucene")
+ if (Files.isDirectory(path)
+ && !path.toString().endsWith("ssl")
+ && path.toString().contains("lucene")
&& !path.equals(currentIndexPath)) {
LOGGER.info("Deleting out-of-date fulltext search index at {}.", path);
Files.walk(path)
diff --git a/src/main/java/org/jabref/gui/BasePanelMode.java b/src/main/java/org/jabref/gui/BasePanelMode.java
index 9305439ad2b..63b478c5709 100644
--- a/src/main/java/org/jabref/gui/BasePanelMode.java
+++ b/src/main/java/org/jabref/gui/BasePanelMode.java
@@ -3,7 +3,6 @@
/**
* Defines the different modes that the BasePanel can operate in
*/
-
public enum BasePanelMode {
SHOWING_NOTHING,
SHOWING_EDITOR,
diff --git a/src/main/java/org/jabref/gui/ClipBoardManager.java b/src/main/java/org/jabref/gui/ClipBoardManager.java
index 8ff63a59374..273a45f7660 100644
--- a/src/main/java/org/jabref/gui/ClipBoardManager.java
+++ b/src/main/java/org/jabref/gui/ClipBoardManager.java
@@ -1,20 +1,11 @@
package org.jabref.gui;
-import java.awt.Toolkit;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-import java.util.List;
-
import javafx.application.Platform;
import javafx.scene.control.TextInputControl;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;
import javafx.scene.input.MouseButton;
-
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.logic.bibtex.BibEntryWriter;
import org.jabref.logic.bibtex.FieldWriter;
@@ -22,10 +13,17 @@
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.preferences.PreferencesService;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.util.List;
+
@AllowedToUseAwt("Requires ava.awt.datatransfer.Clipboard")
public class ClipBoardManager {
@@ -42,7 +40,8 @@ public ClipBoardManager(PreferencesService preferencesService) {
this(Clipboard.getSystemClipboard(), Toolkit.getDefaultToolkit().getSystemSelection(), preferencesService);
}
- public ClipBoardManager(Clipboard clipboard, java.awt.datatransfer.Clipboard primary, PreferencesService preferencesService) {
+ public ClipBoardManager(
+ Clipboard clipboard, java.awt.datatransfer.Clipboard primary, PreferencesService preferencesService) {
ClipBoardManager.clipboard = clipboard;
ClipBoardManager.primary = primary;
this.preferencesService = preferencesService;
@@ -59,14 +58,15 @@ public ClipBoardManager(Clipboard clipboard, java.awt.datatransfer.Clipboard pri
* text over clipboards
*/
public static void addX11Support(TextInputControl input) {
- input.selectedTextProperty().addListener(
- // using InvalidationListener because of https://bugs.openjdk.java.net/browse/JDK-8176270
- observable -> Platform.runLater(() -> {
- String newValue = input.getSelectedText();
- if (!newValue.isEmpty() && (primary != null)) {
- primary.setContents(new StringSelection(newValue), null);
- }
- }));
+ input.selectedTextProperty()
+ .addListener(
+ // using InvalidationListener because of https://bugs.openjdk.java.net/browse/JDK-8176270
+ observable -> Platform.runLater(() -> {
+ String newValue = input.getSelectedText();
+ if (!newValue.isEmpty() && (primary != null)) {
+ primary.setContents(new StringSelection(newValue), null);
+ }
+ }));
input.setOnMouseClicked(event -> {
if (event.getButton() == MouseButton.MIDDLE) {
input.insertText(input.getCaretPosition(), getContentsPrimary());
@@ -144,10 +144,12 @@ public void setContent(String string) {
public void setContent(List entries, BibEntryTypesManager entryTypesManager) throws IOException {
final ClipboardContent content = new ClipboardContent();
- BibEntryWriter writer = new BibEntryWriter(new FieldWriter(preferencesService.getFieldPreferences()), entryTypesManager);
+ BibEntryWriter writer =
+ new BibEntryWriter(new FieldWriter(preferencesService.getFieldPreferences()), entryTypesManager);
String serializedEntries = writer.serializeAll(entries, BibDatabaseMode.BIBTEX);
// BibEntry is not Java serializable. Thus, we need to do the serialization manually
- // At reading of the clipboard in JabRef, we parse the plain string in all cases, so we don't need to flag we put BibEntries here
+ // At reading of the clipboard in JabRef, we parse the plain string in all cases, so we don't need to flag we
+ // put BibEntries here
// Furthermore, storing a string also enables other applications to work with the data
content.putString(serializedEntries);
clipboard.setContent(content);
diff --git a/src/main/java/org/jabref/gui/DefaultInjector.java b/src/main/java/org/jabref/gui/DefaultInjector.java
index b74e0efb8ff..e741189c296 100644
--- a/src/main/java/org/jabref/gui/DefaultInjector.java
+++ b/src/main/java/org/jabref/gui/DefaultInjector.java
@@ -1,9 +1,7 @@
package org.jabref.gui;
-import java.util.function.Function;
-
-import javax.swing.undo.UndoManager;
-
+import com.airhacks.afterburner.injection.Injector;
+import com.airhacks.afterburner.injection.PresenterFactory;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.theme.ThemeManager;
import org.jabref.gui.util.TaskExecutor;
@@ -12,12 +10,12 @@
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;
-
-import com.airhacks.afterburner.injection.Injector;
-import com.airhacks.afterburner.injection.PresenterFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.swing.undo.UndoManager;
+import java.util.function.Function;
+
public class DefaultInjector implements PresenterFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultInjector.class);
diff --git a/src/main/java/org/jabref/gui/DialogService.java b/src/main/java/org/jabref/gui/DialogService.java
index c152bdcb343..aa7d8ca0ac4 100644
--- a/src/main/java/org/jabref/gui/DialogService.java
+++ b/src/main/java/org/jabref/gui/DialogService.java
@@ -1,27 +1,21 @@
package org.jabref.gui;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.List;
-import java.util.Optional;
-import java.util.function.Consumer;
-
import javafx.concurrent.Task;
import javafx.print.PrinterJob;
-import javafx.scene.control.Alert;
-import javafx.scene.control.ButtonType;
-import javafx.scene.control.ChoiceDialog;
-import javafx.scene.control.DialogPane;
-import javafx.scene.control.TextInputDialog;
-
+import javafx.scene.control.*;
+import org.controlsfx.control.textfield.CustomPasswordField;
+import org.controlsfx.dialog.ProgressDialog;
import org.jabref.gui.util.BaseDialog;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.logic.l10n.Localization;
-import org.controlsfx.control.textfield.CustomPasswordField;
-import org.controlsfx.dialog.ProgressDialog;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Consumer;
/**
* This interface provides methods to create dialogs and show them to the user.
@@ -33,12 +27,14 @@ public interface DialogService {
*
* @implNote The implementation should accept {@code null} for {@code defaultChoice}, but callers should use {@link #showChoiceDialogAndWait(String, String, String, Collection)}.
*/
- Optional showChoiceDialogAndWait(String title, String content, String okButtonLabel, T defaultChoice, Collection choices);
+ Optional showChoiceDialogAndWait(
+ String title, String content, String okButtonLabel, T defaultChoice, Collection choices);
/**
* This will create and display new {@link ChoiceDialog} of type T with a collection of possible choices
*/
- default Optional showChoiceDialogAndWait(String title, String content, String okButtonLabel, Collection choices) {
+ default Optional showChoiceDialogAndWait(
+ String title, String content, String okButtonLabel, Collection choices) {
return showChoiceDialogAndWait(title, content, okButtonLabel, null, choices);
}
@@ -146,8 +142,8 @@ default void showErrorDialogAndWait(Exception exception) {
*
* @return true if the use clicked "YES" otherwise false
*/
- boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
- String optOutMessage, Consumer optOutAction);
+ boolean showConfirmationDialogWithOptOutAndWait(
+ String title, String content, String optOutMessage, Consumer optOutAction);
/**
* Create and display a new confirmation dialog.
@@ -158,9 +154,13 @@ boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
*
* @return true if the use clicked "YES" otherwise false
*/
- boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
- String okButtonLabel, String cancelButtonLabel,
- String optOutMessage, Consumer optOutAction);
+ boolean showConfirmationDialogWithOptOutAndWait(
+ String title,
+ String content,
+ String okButtonLabel,
+ String cancelButtonLabel,
+ String optOutMessage,
+ Consumer optOutAction);
/**
* This will create and display new {@link CustomPasswordField} that doesn't show the text, and two buttons
@@ -184,8 +184,8 @@ boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
*
* @return Optional with the pressed Button as ButtonType
*/
- Optional showCustomButtonDialogAndWait(Alert.AlertType type, String title, String content,
- ButtonType... buttonTypes);
+ Optional showCustomButtonDialogAndWait(
+ Alert.AlertType type, String title, String content, ButtonType... buttonTypes);
/**
* This will create and display a new dialog showing a custom {@link DialogPane}
@@ -221,7 +221,8 @@ Optional showCustomButtonDialogAndWait(Alert.AlertType type, String
* @param content message to show below the list of background tasks
* @param stateManager The {@link StateManager} which contains the background tasks
*/
- Optional showBackgroundProgressDialogAndWait(String title, String content, StateManager stateManager);
+ Optional showBackgroundProgressDialogAndWait(
+ String title, String content, StateManager stateManager);
/**
* Notify the user in a non-blocking way (i.e., in form of toast in a snackbar).
diff --git a/src/main/java/org/jabref/gui/DragAndDropDataFormats.java b/src/main/java/org/jabref/gui/DragAndDropDataFormats.java
index 4ab27396efa..6ce01ab724e 100644
--- a/src/main/java/org/jabref/gui/DragAndDropDataFormats.java
+++ b/src/main/java/org/jabref/gui/DragAndDropDataFormats.java
@@ -1,11 +1,10 @@
package org.jabref.gui;
-import java.util.List;
-
import javafx.scene.input.DataFormat;
-
import org.jabref.logic.preview.PreviewLayout;
+import java.util.List;
+
/**
* Contains all the different {@link DataFormat}s that may occur in JabRef.
*/
@@ -16,5 +15,8 @@ public class DragAndDropDataFormats {
public static final DataFormat LINKED_FILE = new DataFormat("dnd/org.jabref.model.entry.LinkedFile");
public static final DataFormat ENTRIES = new DataFormat("dnd/org.jabref.model.entry.BibEntries");
public static final DataFormat PREVIEWLAYOUTS = new DataFormat("dnd/org.jabref.logic.citationstyle.PreviewLayouts");
- @SuppressWarnings("unchecked") public static final Class> PREVIEWLAYOUT_LIST_CLASS = (Class>) (Class>) List.class;
+
+ @SuppressWarnings("unchecked")
+ public static final Class> PREVIEWLAYOUT_LIST_CLASS =
+ (Class>) (Class>) List.class;
}
diff --git a/src/main/java/org/jabref/gui/DragAndDropHelper.java b/src/main/java/org/jabref/gui/DragAndDropHelper.java
index 92e229a5c7f..bbe19ab57fa 100644
--- a/src/main/java/org/jabref/gui/DragAndDropHelper.java
+++ b/src/main/java/org/jabref/gui/DragAndDropHelper.java
@@ -1,15 +1,14 @@
package org.jabref.gui;
+import javafx.scene.input.Dragboard;
+import org.jabref.logic.util.io.FileUtil;
+
import java.io.File;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
-import javafx.scene.input.Dragboard;
-
-import org.jabref.logic.util.io.FileUtil;
-
public class DragAndDropHelper {
public static boolean hasBibFiles(Dragboard dragboard) {
@@ -20,7 +19,10 @@ public static List getBibFiles(Dragboard dragboard) {
if (!dragboard.hasFiles()) {
return Collections.emptyList();
} else {
- return dragboard.getFiles().stream().map(File::toPath).filter(FileUtil::isBibFile).collect(Collectors.toList());
+ return dragboard.getFiles().stream()
+ .map(File::toPath)
+ .filter(FileUtil::isBibFile)
+ .collect(Collectors.toList());
}
}
diff --git a/src/main/java/org/jabref/gui/EntryType.fxml b/src/main/java/org/jabref/gui/EntryType.fxml
index ac4e7f922ec..1e3bd27c987 100644
--- a/src/main/java/org/jabref/gui/EntryType.fxml
+++ b/src/main/java/org/jabref/gui/EntryType.fxml
@@ -1,60 +1,109 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
-
+
+
-
+
-
-
+
+
diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java
index 238d80d7d17..bf9009c2dda 100644
--- a/src/main/java/org/jabref/gui/EntryTypeView.java
+++ b/src/main/java/org/jabref/gui/EntryTypeView.java
@@ -1,66 +1,71 @@
package org.jabref.gui;
-import java.util.Collection;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
+import com.airhacks.afterburner.views.ViewLoader;
+import com.tobiasdiez.easybind.EasyBind;
+import de.saxsys.mvvmfx.utils.validation.visualization.ControlsFxVisualizer;
+import jakarta.inject.Inject;
import javafx.application.Platform;
import javafx.event.Event;
import javafx.fxml.FXML;
-import javafx.scene.control.Button;
-import javafx.scene.control.ButtonType;
-import javafx.scene.control.ComboBox;
-import javafx.scene.control.TextField;
-import javafx.scene.control.TitledPane;
-import javafx.scene.control.Tooltip;
+import javafx.scene.control.*;
import javafx.scene.layout.FlowPane;
import javafx.stage.Screen;
-
-import org.jabref.gui.util.BaseDialog;
-import org.jabref.gui.util.ControlHelper;
-import org.jabref.gui.util.IconValidationDecorator;
-import org.jabref.gui.util.TaskExecutor;
-import org.jabref.gui.util.ViewModelListCellFactory;
+import org.jabref.gui.util.*;
import org.jabref.logic.importer.IdBasedFetcher;
import org.jabref.logic.importer.WebFetcher;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntryType;
-import org.jabref.model.entry.types.BiblatexAPAEntryTypeDefinitions;
-import org.jabref.model.entry.types.BiblatexEntryTypeDefinitions;
-import org.jabref.model.entry.types.BiblatexSoftwareEntryTypeDefinitions;
-import org.jabref.model.entry.types.BibtexEntryTypeDefinitions;
-import org.jabref.model.entry.types.EntryType;
-import org.jabref.model.entry.types.IEEETranEntryTypeDefinitions;
-import org.jabref.model.entry.types.StandardEntryType;
+import org.jabref.model.entry.types.*;
import org.jabref.model.strings.StringUtil;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;
-import com.airhacks.afterburner.views.ViewLoader;
-import com.tobiasdiez.easybind.EasyBind;
-import de.saxsys.mvvmfx.utils.validation.visualization.ControlsFxVisualizer;
-import jakarta.inject.Inject;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
/**
* Dialog that prompts the user to choose a type for an entry.
*/
public class EntryTypeView extends BaseDialog {
- @Inject private StateManager stateManager;
- @Inject private TaskExecutor taskExecutor;
- @Inject private FileUpdateMonitor fileUpdateMonitor;
+ @Inject
+ private StateManager stateManager;
+
+ @Inject
+ private TaskExecutor taskExecutor;
- @FXML private ButtonType generateButton;
- @FXML private TextField idTextField;
- @FXML private ComboBox idBasedFetchers;
- @FXML private FlowPane recommendedEntriesPane;
- @FXML private FlowPane otherEntriesPane;
- @FXML private FlowPane customPane;
- @FXML private TitledPane recommendedEntriesTitlePane;
- @FXML private TitledPane otherEntriesTitlePane;
- @FXML private TitledPane customTitlePane;
+ @Inject
+ private FileUpdateMonitor fileUpdateMonitor;
+
+ @FXML
+ private ButtonType generateButton;
+
+ @FXML
+ private TextField idTextField;
+
+ @FXML
+ private ComboBox idBasedFetchers;
+
+ @FXML
+ private FlowPane recommendedEntriesPane;
+
+ @FXML
+ private FlowPane otherEntriesPane;
+
+ @FXML
+ private FlowPane customPane;
+
+ @FXML
+ private TitledPane recommendedEntriesTitlePane;
+
+ @FXML
+ private TitledPane otherEntriesTitlePane;
+
+ @FXML
+ private TitledPane customTitlePane;
private final LibraryTab libraryTab;
private final DialogService dialogService;
@@ -76,9 +81,7 @@ public EntryTypeView(LibraryTab libraryTab, DialogService dialogService, Prefere
this.preferencesService = preferences;
this.setTitle(Localization.lang("Select entry type"));
- ViewLoader.view(this)
- .load()
- .setAsDialogPane(this);
+ ViewLoader.view(this).load().setAsDialogPane(this);
ControlHelper.setAction(generateButton, this.getDialogPane(), event -> viewModel.runFetcherWorker());
@@ -90,8 +93,14 @@ public EntryTypeView(LibraryTab libraryTab, DialogService dialogService, Prefere
Button btnGenerate = (Button) this.getDialogPane().lookupButton(generateButton);
btnGenerate.getStyleClass().add("customGenerateButton");
- btnGenerate.textProperty().bind(EasyBind.map(viewModel.searchingProperty(), searching -> searching ? Localization.lang("Searching...") : Localization.lang("Generate")));
- btnGenerate.disableProperty().bind(viewModel.idFieldValidationStatus().validProperty().not().or(viewModel.searchingProperty()));
+ btnGenerate
+ .textProperty()
+ .bind(EasyBind.map(
+ viewModel.searchingProperty(),
+ searching -> searching ? Localization.lang("Searching...") : Localization.lang("Generate")));
+ btnGenerate
+ .disableProperty()
+ .bind(viewModel.idFieldValidationStatus().validProperty().not().or(viewModel.searchingProperty()));
EasyBind.subscribe(viewModel.searchSuccesfulProperty(), isSuccessful -> {
if (isSuccessful) {
@@ -124,12 +133,7 @@ private void addEntriesToPane(FlowPane pane, Collection extends BibEntryType>
public void initialize() {
visualizer.setDecoration(new IconValidationDecorator());
viewModel = new EntryTypeViewModel(
- preferencesService,
- libraryTab,
- dialogService,
- stateManager,
- taskExecutor,
- fileUpdateMonitor);
+ preferencesService, libraryTab, dialogService, stateManager, taskExecutor, fileUpdateMonitor);
idBasedFetchers.itemsProperty().bind(viewModel.fetcherItemsProperty());
idTextField.textProperty().bindBidirectional(viewModel.idTextProperty());
@@ -142,9 +146,12 @@ public void initialize() {
}
});
- new ViewModelListCellFactory().withText(WebFetcher::getName).install(idBasedFetchers);
+ new ViewModelListCellFactory()
+ .withText(WebFetcher::getName)
+ .install(idBasedFetchers);
- // we set the managed property so that they will only be rendered when they are visble so that the Nodes only take the space when visible
+ // we set the managed property so that they will only be rendered when they are visble so that the Nodes only
+ // take the space when visible
// avoids removing and adding from the scence graph
recommendedEntriesTitlePane.managedProperty().bind(recommendedEntriesTitlePane.visibleProperty());
otherEntriesTitlePane.managedProperty().bind(otherEntriesTitlePane.visibleProperty());
@@ -163,18 +170,16 @@ public void initialize() {
List otherEntries;
if (isBiblatexMode) {
recommendedEntries = BiblatexEntryTypeDefinitions.RECOMMENDED;
- otherEntries = BiblatexEntryTypeDefinitions.ALL
- .stream()
- .filter(e -> !recommendedEntries.contains(e))
- .collect(Collectors.toList());
+ otherEntries = BiblatexEntryTypeDefinitions.ALL.stream()
+ .filter(e -> !recommendedEntries.contains(e))
+ .collect(Collectors.toList());
otherEntries.addAll(BiblatexSoftwareEntryTypeDefinitions.ALL);
otherEntries.addAll(BiblatexAPAEntryTypeDefinitions.ALL);
} else {
recommendedEntries = BibtexEntryTypeDefinitions.RECOMMENDED;
- otherEntries = BibtexEntryTypeDefinitions.ALL
- .stream()
- .filter(e -> !recommendedEntries.contains(e))
- .collect(Collectors.toList());
+ otherEntries = BibtexEntryTypeDefinitions.ALL.stream()
+ .filter(e -> !recommendedEntries.contains(e))
+ .collect(Collectors.toList());
otherEntries.addAll(IEEETranEntryTypeDefinitions.ALL);
}
addEntriesToPane(recommendedEntriesPane, recommendedEntries);
@@ -188,8 +193,10 @@ public void initialize() {
addEntriesToPane(customPane, customTypes);
}
- viewModel.idTextProperty().addListener((obs, oldValue, newValue) ->
- visualizer.initVisualization(viewModel.idFieldValidationStatus(), idTextField, true));
+ viewModel
+ .idTextProperty()
+ .addListener((obs, oldValue, newValue) ->
+ visualizer.initVisualization(viewModel.idFieldValidationStatus(), idTextField, true));
Platform.runLater(() -> idTextField.requestFocus());
}
@@ -223,16 +230,19 @@ public static String getDescription(EntryType selectedType) {
if (selectedType instanceof StandardEntryType entryType) {
switch (entryType) {
case Article -> {
- return Localization.lang("An article in a journal, magazine, newspaper, or other periodical which forms a self-contained unit with its own title.");
+ return Localization.lang(
+ "An article in a journal, magazine, newspaper, or other periodical which forms a self-contained unit with its own title.");
}
case Book -> {
- return Localization.lang("A single-volume book with one or more authors where the authors share credit for the work as a whole.");
+ return Localization.lang(
+ "A single-volume book with one or more authors where the authors share credit for the work as a whole.");
}
case Booklet -> {
return Localization.lang("A book-like work without a formal publisher or sponsoring institution.");
}
case Collection -> {
- return Localization.lang("A single-volume collection with multiple, self-contained contributions by distinct authors which have their own title. The work as a whole has no overall author but it will usually have an editor.");
+ return Localization.lang(
+ "A single-volume collection with multiple, self-contained contributions by distinct authors which have their own title. The work as a whole has no overall author but it will usually have an editor.");
}
case Conference -> {
return Localization.lang("A legacy alias for \"InProceedings\".");
@@ -241,7 +251,8 @@ public static String getDescription(EntryType selectedType) {
return Localization.lang("A part of a book which forms a self-contained unit with its own title.");
}
case InCollection -> {
- return Localization.lang("A contribution to a collection which forms a self-contained unit with a distinct author and title.");
+ return Localization.lang(
+ "A contribution to a collection which forms a self-contained unit with a distinct author and title.");
}
case InProceedings -> {
return Localization.lang("An article in a conference proceedings.");
@@ -250,28 +261,35 @@ public static String getDescription(EntryType selectedType) {
return Localization.lang("Technical or other documentation, not necessarily in printed form.");
}
case MastersThesis -> {
- return Localization.lang("Similar to \"Thesis\" except that the type field is optional and defaults to the localised term Master's thesis.");
+ return Localization.lang(
+ "Similar to \"Thesis\" except that the type field is optional and defaults to the localised term Master's thesis.");
}
case Misc -> {
return Localization.lang("A fallback type for entries which do not fit into any other category.");
}
case PhdThesis -> {
- return Localization.lang("Similar to \"Thesis\" except that the type field is optional and defaults to the localised term PhD thesis.");
+ return Localization.lang(
+ "Similar to \"Thesis\" except that the type field is optional and defaults to the localised term PhD thesis.");
}
case Proceedings -> {
- return Localization.lang("A single-volume conference proceedings. This type is very similar to \"Collection\".");
+ return Localization.lang(
+ "A single-volume conference proceedings. This type is very similar to \"Collection\".");
}
case TechReport -> {
- return Localization.lang("Similar to \"Report\" except that the type field is optional and defaults to the localised term technical report.");
+ return Localization.lang(
+ "Similar to \"Report\" except that the type field is optional and defaults to the localised term technical report.");
}
case Unpublished -> {
- return Localization.lang("A work with an author and a title which has not been formally published, such as a manuscript or the script of a talk.");
+ return Localization.lang(
+ "A work with an author and a title which has not been formally published, such as a manuscript or the script of a talk.");
}
case BookInBook -> {
- return Localization.lang("This type is similar to \"InBook\" but intended for works originally published as a stand-alone book.");
+ return Localization.lang(
+ "This type is similar to \"InBook\" but intended for works originally published as a stand-alone book.");
}
case InReference -> {
- return Localization.lang("An article in a work of reference. This is a more specific variant of the generic \"InCollection\" entry type.");
+ return Localization.lang(
+ "An article in a work of reference. This is a more specific variant of the generic \"InCollection\" entry type.");
}
case MvBook -> {
return Localization.lang("A multi-volume \"Book\".");
@@ -283,37 +301,46 @@ public static String getDescription(EntryType selectedType) {
return Localization.lang("A multi-volume \"Proceedings\" entry.");
}
case MvReference -> {
- return Localization.lang("A multi-volume \"Reference\" entry. The standard styles will treat this entry type as an alias for \"MvCollection\".");
+ return Localization.lang(
+ "A multi-volume \"Reference\" entry. The standard styles will treat this entry type as an alias for \"MvCollection\".");
}
case Online -> {
- return Localization.lang("This entry type is intended for sources such as web sites which are intrinsically online resources.");
+ return Localization.lang(
+ "This entry type is intended for sources such as web sites which are intrinsically online resources.");
}
case Reference -> {
- return Localization.lang("A single-volume work of reference such as an encyclopedia or a dictionary.");
+ return Localization.lang(
+ "A single-volume work of reference such as an encyclopedia or a dictionary.");
}
case Report -> {
- return Localization.lang("A technical report, research report, or white paper published by a university or some other institution.");
+ return Localization.lang(
+ "A technical report, research report, or white paper published by a university or some other institution.");
}
case Set -> {
- return Localization.lang("An entry set is a group of entries which are cited as a single reference and listed as a single item in the bibliography.");
+ return Localization.lang(
+ "An entry set is a group of entries which are cited as a single reference and listed as a single item in the bibliography.");
}
case SuppBook -> {
- return Localization.lang("Supplemental material in a \"Book\". This type is provided for elements such as prefaces, introductions, forewords, afterwords, etc. which often have a generic title only.");
+ return Localization.lang(
+ "Supplemental material in a \"Book\". This type is provided for elements such as prefaces, introductions, forewords, afterwords, etc. which often have a generic title only.");
}
case SuppCollection -> {
return Localization.lang("Supplemental material in a \"Collection\".");
}
case SuppPeriodical -> {
- return Localization.lang("Supplemental material in a \"Periodical\". This type may be useful when referring to items such as regular columns, obituaries, letters to the editor, etc. which only have a generic title.");
+ return Localization.lang(
+ "Supplemental material in a \"Periodical\". This type may be useful when referring to items such as regular columns, obituaries, letters to the editor, etc. which only have a generic title.");
}
case Thesis -> {
- return Localization.lang("A thesis written for an educational institution to satisfy the requirements for a degree.");
+ return Localization.lang(
+ "A thesis written for an educational institution to satisfy the requirements for a degree.");
}
case WWW -> {
return Localization.lang("An alias for \"Online\", provided for jurabib compatibility.");
}
case Software -> {
- return Localization.lang("Computer software. The standard styles will treat this entry type as an alias for \"Misc\".");
+ return Localization.lang(
+ "Computer software. The standard styles will treat this entry type as an alias for \"Misc\".");
}
case Dataset -> {
return Localization.lang("A data set or a similar collection of (mostly) raw data.");
diff --git a/src/main/java/org/jabref/gui/EntryTypeViewModel.java b/src/main/java/org/jabref/gui/EntryTypeViewModel.java
index a197348997a..7bafba798af 100644
--- a/src/main/java/org/jabref/gui/EntryTypeViewModel.java
+++ b/src/main/java/org/jabref/gui/EntryTypeViewModel.java
@@ -1,27 +1,17 @@
package org.jabref.gui;
-import java.util.Optional;
-
-import javafx.beans.property.BooleanProperty;
-import javafx.beans.property.ListProperty;
-import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.SimpleBooleanProperty;
-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 de.saxsys.mvvmfx.utils.validation.Validator;
+import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.concurrent.Task;
import javafx.concurrent.Worker;
-
import org.jabref.gui.externalfiles.ImportHandler;
import org.jabref.gui.importer.NewEntryAction;
import org.jabref.gui.util.TaskExecutor;
-import org.jabref.logic.importer.FetcherClientException;
-import org.jabref.logic.importer.FetcherException;
-import org.jabref.logic.importer.FetcherServerException;
-import org.jabref.logic.importer.IdBasedFetcher;
-import org.jabref.logic.importer.WebFetchers;
+import org.jabref.logic.importer.*;
import org.jabref.logic.importer.fetcher.DoiFetcher;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.entry.BibEntry;
@@ -29,14 +19,11 @@
import org.jabref.model.strings.StringUtil;
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 de.saxsys.mvvmfx.utils.validation.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Optional;
+
public class EntryTypeViewModel {
private static final Logger LOGGER = LoggerFactory.getLogger(EntryTypeViewModel.class);
@@ -56,12 +43,13 @@ public class EntryTypeViewModel {
private final TaskExecutor taskExecutor;
private final FileUpdateMonitor fileUpdateMonitor;
- public EntryTypeViewModel(PreferencesService preferences,
- LibraryTab libraryTab,
- DialogService dialogService,
- StateManager stateManager,
- TaskExecutor taskExecutor,
- FileUpdateMonitor fileUpdateMonitor) {
+ public EntryTypeViewModel(
+ PreferencesService preferences,
+ LibraryTab libraryTab,
+ DialogService dialogService,
+ StateManager stateManager,
+ TaskExecutor taskExecutor,
+ FileUpdateMonitor fileUpdateMonitor) {
this.libraryTab = libraryTab;
this.preferencesService = preferences;
this.dialogService = dialogService;
@@ -70,8 +58,7 @@ public EntryTypeViewModel(PreferencesService preferences,
this.fileUpdateMonitor = fileUpdateMonitor;
fetchers.addAll(WebFetchers.getIdBasedFetchers(
- preferences.getImportFormatPreferences(),
- preferences.getImporterPreferences()));
+ preferences.getImportFormatPreferences(), preferences.getImporterPreferences()));
selectedItemProperty.setValue(getLastSelectedFetcher());
idFieldValidator = new FunctionBasedValidator<>(
idText,
@@ -104,15 +91,17 @@ public BooleanProperty getFocusAndSelectAllProperty() {
}
public void storeSelectedFetcher() {
- preferencesService.getGuiPreferences().setLastSelectedIdBasedFetcher(selectedItemProperty.getValue().getName());
+ preferencesService
+ .getGuiPreferences()
+ .setLastSelectedIdBasedFetcher(selectedItemProperty.getValue().getName());
}
private IdBasedFetcher getLastSelectedFetcher() {
- return fetchers.stream().filter(fetcher -> fetcher.getName()
- .equals(preferencesService.getGuiPreferences()
- .getLastSelectedIdBasedFetcher()))
- .findFirst()
- .orElse(new DoiFetcher(preferencesService.getImportFormatPreferences()));
+ return fetchers.stream()
+ .filter(fetcher -> fetcher.getName()
+ .equals(preferencesService.getGuiPreferences().getLastSelectedIdBasedFetcher()))
+ .findFirst()
+ .orElse(new DoiFetcher(preferencesService.getImportFormatPreferences()));
}
public ListProperty fetcherItemsProperty() {
@@ -152,14 +141,28 @@ public void runFetcherWorker() {
String searchId = idText.getValue();
if (exception instanceof FetcherClientException) {
- dialogService.showInformationDialogAndWait(Localization.lang("Failed to import by ID"), Localization.lang("Bibliographic data not found. Cause is likely the client side. Please check connection and identifier for correctness.") + "\n" + fetcherExceptionMessage);
+ dialogService.showInformationDialogAndWait(
+ Localization.lang("Failed to import by ID"),
+ Localization.lang(
+ "Bibliographic data not found. Cause is likely the client side. Please check connection and identifier for correctness.")
+ + "\n" + fetcherExceptionMessage);
} else if (exception instanceof FetcherServerException) {
- dialogService.showInformationDialogAndWait(Localization.lang("Failed to import by ID"), Localization.lang("Bibliographic data not found. Cause is likely the server side. Please try again later.") + "\n" + fetcherExceptionMessage);
+ dialogService.showInformationDialogAndWait(
+ Localization.lang("Failed to import by ID"),
+ Localization.lang(
+ "Bibliographic data not found. Cause is likely the server side. Please try again later.")
+ + "\n" + fetcherExceptionMessage);
} else {
- dialogService.showInformationDialogAndWait(Localization.lang("Failed to import by ID"), Localization.lang("Error message %0", fetcherExceptionMessage));
+ dialogService.showInformationDialogAndWait(
+ Localization.lang("Failed to import by ID"),
+ Localization.lang("Error message %0", fetcherExceptionMessage));
}
- LOGGER.error("Exception during fetching when using fetcher '{}' with entry id '{}'.", fetcher, searchId, exception);
+ LOGGER.error(
+ "Exception during fetching when using fetcher '{}' with entry id '{}'.",
+ fetcher,
+ searchId,
+ exception);
searchingProperty.set(false);
fetcherWorker = new FetcherWorker();
@@ -182,7 +185,8 @@ public void runFetcherWorker() {
searchSuccesfulProperty.set(true);
} else if (StringUtil.isBlank(idText.getValue())) {
- dialogService.showWarningDialogAndWait(Localization.lang("Empty search ID"), Localization.lang("The given search ID was empty."));
+ dialogService.showWarningDialogAndWait(
+ Localization.lang("Empty search ID"), Localization.lang("The given search ID was empty."));
} else {
// result is empty
@@ -190,17 +194,19 @@ public void runFetcherWorker() {
String searchId = idText.getValue();
// When DOI ID is not found, allow the user to either return to the dialog or add entry manually
- boolean addEntryFlag = dialogService.showConfirmationDialogAndWait(Localization.lang("Identifier not found"),
+ boolean addEntryFlag = dialogService.showConfirmationDialogAndWait(
+ Localization.lang("Identifier not found"),
Localization.lang("Fetcher '%0' did not find an entry for id '%1'.", fetcher, searchId),
Localization.lang("Add entry manually"),
Localization.lang("Return to dialog"));
if (addEntryFlag) {
new NewEntryAction(
- libraryTab.frame(),
- StandardEntryType.Article,
- dialogService,
- preferencesService,
- stateManager).execute();
+ libraryTab.frame(),
+ StandardEntryType.Article,
+ dialogService,
+ preferencesService,
+ stateManager)
+ .execute();
searchSuccesfulProperty.set(true);
}
}
diff --git a/src/main/java/org/jabref/gui/FXDialog.java b/src/main/java/org/jabref/gui/FXDialog.java
index 7b485c24876..d00540ef47f 100644
--- a/src/main/java/org/jabref/gui/FXDialog.java
+++ b/src/main/java/org/jabref/gui/FXDialog.java
@@ -7,7 +7,6 @@
import javafx.scene.image.Image;
import javafx.stage.Modality;
import javafx.stage.Stage;
-
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.keyboard.KeyBindingRepository;
diff --git a/src/main/java/org/jabref/gui/FallbackExceptionHandler.java b/src/main/java/org/jabref/gui/FallbackExceptionHandler.java
index 73eaa39e849..52b44df2e8e 100644
--- a/src/main/java/org/jabref/gui/FallbackExceptionHandler.java
+++ b/src/main/java/org/jabref/gui/FallbackExceptionHandler.java
@@ -1,8 +1,7 @@
package org.jabref.gui;
-import org.jabref.gui.util.DefaultTaskExecutor;
-
import com.airhacks.afterburner.injection.Injector;
+import org.jabref.gui.util.DefaultTaskExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -21,8 +20,8 @@ public static void installExceptionHandler() {
public void uncaughtException(Thread thread, Throwable exception) {
LOGGER.error("Uncaught exception occurred in " + thread, exception);
DefaultTaskExecutor.runInJavaFXThread(() -> {
- DialogService dialogService = Injector.instantiateModelOrService(DialogService.class);
- dialogService.showErrorDialogAndWait("Uncaught exception occurred in " + thread, exception);
+ DialogService dialogService = Injector.instantiateModelOrService(DialogService.class);
+ dialogService.showErrorDialogAndWait("Uncaught exception occurred in " + thread, exception);
});
}
}
diff --git a/src/main/java/org/jabref/gui/Globals.java b/src/main/java/org/jabref/gui/Globals.java
index 04ead50bf63..ca5600469db 100644
--- a/src/main/java/org/jabref/gui/Globals.java
+++ b/src/main/java/org/jabref/gui/Globals.java
@@ -1,5 +1,6 @@
package org.jabref.gui;
+import kong.unirest.Unirest;
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.remote.CLIMessageHandler;
@@ -17,8 +18,6 @@
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;
-import kong.unirest.Unirest;
-
/**
* @deprecated try to use {@link StateManager} and {@link org.jabref.preferences.PreferencesService}
*/
@@ -68,8 +67,7 @@ public class Globals {
private static DefaultFileUpdateMonitor fileUpdateMonitor;
- private Globals() {
- }
+ private Globals() {}
// Key binding preferences
public static synchronized KeyBindingRepository getKeyPrefs() {
@@ -88,10 +86,7 @@ public static synchronized ClipBoardManager getClipboardManager() {
public static synchronized ThemeManager getThemeManager() {
if (themeManager == null) {
- themeManager = new ThemeManager(
- prefs.getWorkspacePreferences(),
- getFileUpdateMonitor(),
- Runnable::run);
+ themeManager = new ThemeManager(prefs.getWorkspacePreferences(), getFileUpdateMonitor(), Runnable::run);
}
return themeManager;
}
@@ -107,12 +102,13 @@ public static synchronized FileUpdateMonitor getFileUpdateMonitor() {
// Background tasks
public static void startBackgroundTasks() {
// TODO Currently deactivated due to incompatibilities in XML
- /* if (Globals.prefs.getTelemetryPreferences().shouldCollectTelemetry() && !GraphicsEnvironment.isHeadless()) {
+ /* if (Globals.prefs.getTelemetryPreferences().shouldCollectTelemetry() && !GraphicsEnvironment.isHeadless()) {
Telemetry.start(prefs.getTelemetryPreferences());
} */
RemotePreferences remotePreferences = prefs.getRemotePreferences();
if (remotePreferences.useRemoteServer()) {
- Globals.REMOTE_LISTENER.openAndStart(new CLIMessageHandler(prefs, fileUpdateMonitor, entryTypesManager), remotePreferences.getPort());
+ Globals.REMOTE_LISTENER.openAndStart(
+ new CLIMessageHandler(prefs, fileUpdateMonitor, entryTypesManager), remotePreferences.getPort());
}
}
diff --git a/src/main/java/org/jabref/gui/JabRefDialogService.java b/src/main/java/org/jabref/gui/JabRefDialogService.java
index 6f3c333db13..43c9035467e 100644
--- a/src/main/java/org/jabref/gui/JabRefDialogService.java
+++ b/src/main/java/org/jabref/gui/JabRefDialogService.java
@@ -1,31 +1,13 @@
package org.jabref.gui;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.FileSystem;
-import java.nio.file.FileSystems;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-
+import com.tobiasdiez.easybind.EasyBind;
import javafx.concurrent.Task;
import javafx.geometry.Pos;
import javafx.print.PrinterJob;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.control.Alert.AlertType;
-import javafx.scene.control.Button;
-import javafx.scene.control.ButtonBar;
-import javafx.scene.control.ButtonType;
-import javafx.scene.control.CheckBox;
-import javafx.scene.control.ChoiceDialog;
-import javafx.scene.control.DialogPane;
-import javafx.scene.control.Label;
-import javafx.scene.control.TextInputDialog;
+import javafx.scene.control.*;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
@@ -34,26 +16,30 @@
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;
-
-import org.jabref.gui.help.ErrorConsoleAction;
-import org.jabref.gui.icon.IconTheme;
-import org.jabref.gui.util.BackgroundTask;
-import org.jabref.gui.util.BaseDialog;
-import org.jabref.gui.util.DefaultTaskExecutor;
-import org.jabref.gui.util.DirectoryDialogConfiguration;
-import org.jabref.gui.util.FileDialogConfiguration;
-import org.jabref.gui.util.ZipFileChooser;
-import org.jabref.logic.l10n.Localization;
-
-import com.tobiasdiez.easybind.EasyBind;
import org.controlsfx.control.Notifications;
import org.controlsfx.control.TaskProgressView;
import org.controlsfx.control.textfield.CustomPasswordField;
import org.controlsfx.dialog.ExceptionDialog;
import org.controlsfx.dialog.ProgressDialog;
+import org.jabref.gui.help.ErrorConsoleAction;
+import org.jabref.gui.icon.IconTheme;
+import org.jabref.gui.util.*;
+import org.jabref.logic.l10n.Localization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+
/**
* This class provides methods to create default
* JavaFX dialogs which will also work on top of Swing
@@ -85,10 +71,11 @@ private FXDialog createDialog(AlertType type, String title, String content) {
return alert;
}
- private FXDialog createDialogWithOptOut(AlertType type, String title, String content,
- String optOutMessage, Consumer optOutAction) {
+ private FXDialog createDialogWithOptOut(
+ AlertType type, String title, String content, String optOutMessage, Consumer optOutAction) {
FXDialog alert = new FXDialog(type, title, true);
- // Need to force the alert to layout in order to grab the graphic as we are replacing the dialog pane with a custom pane
+ // Need to force the alert to layout in order to grab the graphic as we are replacing the dialog pane with a
+ // custom pane
alert.getDialogPane().applyCss();
Node graphic = alert.getDialogPane().getGraphic();
@@ -104,7 +91,8 @@ protected Node createDetailsButton() {
}
});
- // Fool the dialog into thinking there is some expandable content; a group won't take up any space if it has no children
+ // Fool the dialog into thinking there is some expandable content; a group won't take up any space if it has no
+ // children
alert.getDialogPane().setExpandableContent(new Group());
alert.getDialogPane().setExpanded(true);
@@ -121,11 +109,14 @@ public static String shortenDialogMessage(String dialogMessage) {
if (dialogMessage.length() < JabRefDialogService.DIALOG_SIZE_LIMIT) {
return dialogMessage.trim();
}
- return (dialogMessage.substring(0, Math.min(dialogMessage.length(), JabRefDialogService.DIALOG_SIZE_LIMIT)) + "...").trim();
+ return (dialogMessage.substring(0, Math.min(dialogMessage.length(), JabRefDialogService.DIALOG_SIZE_LIMIT))
+ + "...")
+ .trim();
}
@Override
- public Optional showChoiceDialogAndWait(String title, String content, String okButtonLabel, T defaultChoice, Collection choices) {
+ public Optional showChoiceDialogAndWait(
+ String title, String content, String okButtonLabel, T defaultChoice, Collection choices) {
ChoiceDialog choiceDialog = new ChoiceDialog<>(defaultChoice, choices);
((Stage) choiceDialog.getDialogPane().getScene().getWindow()).getIcons().add(IconTheme.getJabRefImage());
ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.OK_DONE);
@@ -200,7 +191,9 @@ public void showErrorDialogAndWait(String message) {
@Override
public boolean showConfirmationDialogAndWait(String title, String content) {
FXDialog alert = createDialog(AlertType.CONFIRMATION, title, content);
- return alert.showAndWait().filter(buttonType -> buttonType == ButtonType.OK).isPresent();
+ return alert.showAndWait()
+ .filter(buttonType -> buttonType == ButtonType.OK)
+ .isPresent();
}
@Override
@@ -208,49 +201,61 @@ public boolean showConfirmationDialogAndWait(String title, String content, Strin
FXDialog alert = createDialog(AlertType.CONFIRMATION, title, content);
ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.OK_DONE);
alert.getButtonTypes().setAll(ButtonType.CANCEL, okButtonType);
- return alert.showAndWait().filter(buttonType -> buttonType == okButtonType).isPresent();
+ return alert.showAndWait()
+ .filter(buttonType -> buttonType == okButtonType)
+ .isPresent();
}
@Override
- public boolean showConfirmationDialogAndWait(String title, String content,
- String okButtonLabel, String cancelButtonLabel) {
+ public boolean showConfirmationDialogAndWait(
+ String title, String content, String okButtonLabel, String cancelButtonLabel) {
FXDialog alert = createDialog(AlertType.CONFIRMATION, title, content);
ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.OK_DONE);
ButtonType cancelButtonType = new ButtonType(cancelButtonLabel, ButtonBar.ButtonData.NO);
alert.getButtonTypes().setAll(okButtonType, cancelButtonType);
- return alert.showAndWait().filter(buttonType -> buttonType == okButtonType).isPresent();
+ return alert.showAndWait()
+ .filter(buttonType -> buttonType == okButtonType)
+ .isPresent();
}
@Override
- public boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
- String optOutMessage, Consumer optOutAction) {
+ public boolean showConfirmationDialogWithOptOutAndWait(
+ String title, String content, String optOutMessage, Consumer optOutAction) {
FXDialog alert = createDialogWithOptOut(AlertType.CONFIRMATION, title, content, optOutMessage, optOutAction);
alert.getButtonTypes().setAll(ButtonType.YES, ButtonType.NO);
- return alert.showAndWait().filter(buttonType -> buttonType == ButtonType.YES).isPresent();
+ return alert.showAndWait()
+ .filter(buttonType -> buttonType == ButtonType.YES)
+ .isPresent();
}
@Override
- public boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
- String okButtonLabel, String cancelButtonLabel,
- String optOutMessage, Consumer optOutAction) {
+ public boolean showConfirmationDialogWithOptOutAndWait(
+ String title,
+ String content,
+ String okButtonLabel,
+ String cancelButtonLabel,
+ String optOutMessage,
+ Consumer optOutAction) {
FXDialog alert = createDialogWithOptOut(AlertType.CONFIRMATION, title, content, optOutMessage, optOutAction);
ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.YES);
ButtonType cancelButtonType = new ButtonType(cancelButtonLabel, ButtonBar.ButtonData.NO);
alert.getButtonTypes().setAll(okButtonType, cancelButtonType);
- return alert.showAndWait().filter(buttonType -> buttonType == okButtonType).isPresent();
+ return alert.showAndWait()
+ .filter(buttonType -> buttonType == okButtonType)
+ .isPresent();
}
@Override
- public Optional showCustomButtonDialogAndWait(AlertType type, String title, String content,
- ButtonType... buttonTypes) {
+ public Optional showCustomButtonDialogAndWait(
+ AlertType type, String title, String content, ButtonType... buttonTypes) {
FXDialog alert = createDialog(type, title, content);
alert.getButtonTypes().setAll(buttonTypes);
return alert.showAndWait();
}
@Override
- public Optional showCustomDialogAndWait(String title, DialogPane contentPane,
- ButtonType... buttonTypes) {
+ public Optional showCustomDialogAndWait(
+ String title, DialogPane contentPane, ButtonType... buttonTypes) {
FXDialog alert = new FXDialog(AlertType.NONE, title);
alert.setDialogPane(contentPane);
alert.getButtonTypes().setAll(buttonTypes);
@@ -299,7 +304,9 @@ public void showProgressDialog(String title, String content, Task task) {
progressDialog.setTitle(title);
progressDialog.setContentText(content);
progressDialog.setGraphic(null);
- ((Stage) progressDialog.getDialogPane().getScene().getWindow()).getIcons().add(IconTheme.getJabRefImage());
+ ((Stage) progressDialog.getDialogPane().getScene().getWindow())
+ .getIcons()
+ .add(IconTheme.getJabRefImage());
progressDialog.setOnCloseRequest(evt -> task.cancel());
DialogPane dialogPane = progressDialog.getDialogPane();
dialogPane.getButtonTypes().add(ButtonType.CANCEL);
@@ -313,7 +320,8 @@ public void showProgressDialog(String title, String content, Task task) {
}
@Override
- public Optional showBackgroundProgressDialogAndWait(String title, String content, StateManager stateManager) {
+ public Optional showBackgroundProgressDialogAndWait(
+ String title, String content, StateManager stateManager) {
TaskProgressView> taskProgressView = new TaskProgressView<>();
EasyBind.bindContent(taskProgressView.getTasks(), stateManager.getBackgroundTasks());
taskProgressView.setRetainTasks(false);
@@ -349,23 +357,24 @@ public void notify(String message) {
DefaultTaskExecutor.runInJavaFXThread(() -> {
Notifications.create()
- .text(message)
- .position(Pos.BOTTOM_CENTER)
- .hideAfter(TOAST_MESSAGE_DISPLAY_TIME)
- .owner(mainWindow)
- .threshold(5,
- Notifications.create()
- .title(Localization.lang("Last notification"))
- // TODO: Change to a notification overview instead of event log when that is available. The event log is not that user friendly (different purpose).
- .text(
- "(" + Localization.lang("Check the event log to see all notifications") + ")"
- + "\n\n" + message)
- .onAction(e -> {
- ErrorConsoleAction ec = new ErrorConsoleAction();
- ec.execute();
- }))
- .hideCloseButton()
- .show();
+ .text(message)
+ .position(Pos.BOTTOM_CENTER)
+ .hideAfter(TOAST_MESSAGE_DISPLAY_TIME)
+ .owner(mainWindow)
+ .threshold(
+ 5,
+ Notifications.create()
+ .title(Localization.lang("Last notification"))
+ // TODO: Change to a notification overview instead of event log when that is
+ // available. The event log is not that user friendly (different purpose).
+ .text("(" + Localization.lang("Check the event log to see all notifications") + ")"
+ + "\n\n" + message)
+ .onAction(e -> {
+ ErrorConsoleAction ec = new ErrorConsoleAction();
+ ec.execute();
+ }))
+ .hideCloseButton()
+ .show();
});
}
@@ -373,7 +382,8 @@ public void notify(String message) {
public Optional showFileSaveDialog(FileDialogConfiguration fileDialogConfiguration) {
FileChooser chooser = getConfiguredFileChooser(fileDialogConfiguration);
File file = chooser.showSaveDialog(mainWindow);
- Optional.ofNullable(chooser.getSelectedExtensionFilter()).ifPresent(fileDialogConfiguration::setSelectedExtensionFilter);
+ Optional.ofNullable(chooser.getSelectedExtensionFilter())
+ .ifPresent(fileDialogConfiguration::setSelectedExtensionFilter);
return Optional.ofNullable(file).map(File::toPath);
}
@@ -381,7 +391,8 @@ public Optional showFileSaveDialog(FileDialogConfiguration fileDialogConfi
public Optional showFileOpenDialog(FileDialogConfiguration fileDialogConfiguration) {
FileChooser chooser = getConfiguredFileChooser(fileDialogConfiguration);
File file = chooser.showOpenDialog(mainWindow);
- Optional.ofNullable(chooser.getSelectedExtensionFilter()).ifPresent(fileDialogConfiguration::setSelectedExtensionFilter);
+ Optional.ofNullable(chooser.getSelectedExtensionFilter())
+ .ifPresent(fileDialogConfiguration::setSelectedExtensionFilter);
return Optional.ofNullable(file).map(File::toPath);
}
diff --git a/src/main/java/org/jabref/gui/JabRefExecutorService.java b/src/main/java/org/jabref/gui/JabRefExecutorService.java
index b23beeb8d2c..f73b41c8933 100644
--- a/src/main/java/org/jabref/gui/JabRefExecutorService.java
+++ b/src/main/java/org/jabref/gui/JabRefExecutorService.java
@@ -1,21 +1,11 @@
package org.jabref.gui;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.*;
+import java.util.concurrent.*;
+
/**
* Responsible for managing of all threads (except GUI threads) in JabRef
*/
@@ -43,8 +33,7 @@ public class JabRefExecutorService {
private Thread remoteThread;
- private JabRefExecutorService() {
- }
+ private JabRefExecutorService() {}
public void execute(Runnable command) {
Objects.requireNonNull(command);
@@ -181,7 +170,9 @@ public static void gracefullyShutdown(ExecutorService executorService) {
// This is non-blocking. See https://stackoverflow.com/a/57383461/873282.
executorService.shutdown();
if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
- LOGGER.debug("One minute passed, {} still not completed. Trying forced shutdown.", executorService.toString());
+ LOGGER.debug(
+ "One minute passed, {} still not completed. Trying forced shutdown.",
+ executorService.toString());
// those threads will be interrupted in their current task
executorService.shutdownNow();
if (executorService.awaitTermination(60, TimeUnit.SECONDS)) {
diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java
index 8a829134b96..65625fec6d0 100644
--- a/src/main/java/org/jabref/gui/JabRefFrame.java
+++ b/src/main/java/org/jabref/gui/JabRefFrame.java
@@ -1,30 +1,16 @@
package org.jabref.gui;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.TimerTask;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-
+import com.google.common.eventbus.Subscribe;
+import com.tobiasdiez.easybind.EasyBind;
+import com.tobiasdiez.easybind.EasyObservableList;
+import com.tobiasdiez.easybind.Subscription;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.StringBinding;
import javafx.collections.transformation.FilteredList;
-import javafx.scene.control.Alert;
-import javafx.scene.control.ButtonBar;
-import javafx.scene.control.ButtonType;
-import javafx.scene.control.ContextMenu;
-import javafx.scene.control.SeparatorMenuItem;
-import javafx.scene.control.SplitPane;
-import javafx.scene.control.Tab;
-import javafx.scene.control.TabPane;
+import javafx.scene.control.*;
import javafx.scene.control.skin.TabPaneSkin;
import javafx.scene.input.Dragboard;
import javafx.scene.input.KeyEvent;
@@ -32,7 +18,7 @@
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
-
+import org.fxmisc.richtext.CodeArea;
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.ActionHelper;
import org.jabref.gui.actions.SimpleCommand;
@@ -75,15 +61,15 @@
import org.jabref.preferences.GuiPreferences;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.TelemetryPreferences;
-
-import com.google.common.eventbus.Subscribe;
-import com.tobiasdiez.easybind.EasyBind;
-import com.tobiasdiez.easybind.EasyObservableList;
-import com.tobiasdiez.easybind.Subscription;
-import org.fxmisc.richtext.CodeArea;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.*;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
/**
* The main window of the application.
*/
@@ -99,7 +85,8 @@ public class JabRefFrame extends BorderPane implements LibraryTabContainer {
private final FileHistoryMenu fileHistory;
- @SuppressWarnings({"FieldCanBeLocal"}) private EasyObservableList openDatabaseList;
+ @SuppressWarnings({"FieldCanBeLocal"})
+ private EasyObservableList openDatabaseList;
private final Stage mainStage;
private final StateManager stateManager;
@@ -125,7 +112,8 @@ public JabRefFrame(Stage mainStage) {
this.globalSearchBar = new GlobalSearchBar(this, stateManager, prefs, undoManager, dialogService);
this.taskExecutor = Globals.TASK_EXECUTOR;
this.pushToApplicationCommand = new PushToApplicationCommand(stateManager, dialogService, prefs, taskExecutor);
- this.fileHistory = new FileHistoryMenu(prefs.getGuiPreferences().getFileHistory(), dialogService, getOpenDatabaseAction());
+ this.fileHistory =
+ new FileHistoryMenu(prefs.getGuiPreferences().getFileHistory(), dialogService, getOpenDatabaseAction());
this.setOnKeyTyped(key -> {
if (this.fileHistory.isShowing()) {
if (this.fileHistory.openFileByKey(key)) {
@@ -166,7 +154,8 @@ private void initDragAndDrop() {
// drag'n'drop on tabs covered dnd on tabbedPane, so dnd on tabs should contain all dnds on tabbedPane
tabbedPane.lookupAll(".tab").forEach(destinationTabNode -> {
destinationTabNode.setOnDragOver(tabDragEvent -> {
- if (DragAndDropHelper.hasBibFiles(tabDragEvent.getDragboard()) || DragAndDropHelper.hasGroups(tabDragEvent.getDragboard())) {
+ if (DragAndDropHelper.hasBibFiles(tabDragEvent.getDragboard())
+ || DragAndDropHelper.hasGroups(tabDragEvent.getDragboard())) {
tabDragEvent.acceptTransferModes(TransferMode.ANY);
if (!tabbedPane.getTabs().contains(dndIndicator)) {
tabbedPane.getTabs().add(dndIndicator);
@@ -181,9 +170,9 @@ private void initDragAndDrop() {
tabDragEvent.consume();
}
});
- destinationTabNode.setOnDragExited(event1 -> tabbedPane.getTabs().remove(dndIndicator));
+ destinationTabNode.setOnDragExited(
+ event1 -> tabbedPane.getTabs().remove(dndIndicator));
destinationTabNode.setOnDragDropped(tabDragEvent -> {
-
Dragboard dragboard = tabDragEvent.getDragboard();
if (DragAndDropHelper.hasBibFiles(dragboard)) {
@@ -195,8 +184,11 @@ private void initDragAndDrop() {
tabDragEvent.consume();
} else {
for (Tab libraryTab : tabbedPane.getTabs()) {
- if (libraryTab.getId().equals(destinationTabNode.getId()) &&
- !tabbedPane.getSelectionModel().getSelectedItem().equals(libraryTab)) {
+ if (libraryTab.getId().equals(destinationTabNode.getId())
+ && !tabbedPane
+ .getSelectionModel()
+ .getSelectedItem()
+ .equals(libraryTab)) {
LibraryTab destinationLibraryTab = (LibraryTab) libraryTab;
if (DragAndDropHelper.hasGroups(dragboard)) {
List groupPathToSources = DragAndDropHelper.getGroups(dragboard);
@@ -206,7 +198,8 @@ private void initDragAndDrop() {
GroupTreeNode destinationLibraryGroupRoot = destinationLibraryTab
.getBibDatabaseContext()
.getMetaData()
- .getGroups().get();
+ .getGroups()
+ .get();
for (String pathToSource : groupPathToSources) {
GroupTreeNode groupTreeNodeToCopy = getCurrentLibraryTab()
@@ -216,11 +209,15 @@ private void initDragAndDrop() {
.get()
.getChildByPath(pathToSource)
.get();
- copyGroupTreeNode((LibraryTab) libraryTab, destinationLibraryGroupRoot, groupTreeNodeToCopy);
+ copyGroupTreeNode(
+ (LibraryTab) libraryTab,
+ destinationLibraryGroupRoot,
+ groupTreeNodeToCopy);
}
return;
}
- destinationLibraryTab.dropEntry(stateManager.getLocalDragboard().getBibEntries());
+ destinationLibraryTab.dropEntry(
+ stateManager.getLocalDragboard().getBibEntries());
}
}
tabDragEvent.consume();
@@ -254,7 +251,7 @@ private void initKeyBindings() {
case FOCUS_GROUP_LIST:
sidePane.getSidePaneComponent(SidePaneType.GROUPS).requestFocus();
event.consume();
- break;
+ break;
case NEXT_LIBRARY:
tabbedPane.getSelectionModel().selectNext();
event.consume();
@@ -267,36 +264,46 @@ private void initKeyBindings() {
getGlobalSearchBar().focus();
break;
case NEW_ARTICLE:
- new NewEntryAction(this, StandardEntryType.Article, dialogService, prefs, stateManager).execute();
+ new NewEntryAction(this, StandardEntryType.Article, dialogService, prefs, stateManager)
+ .execute();
break;
case NEW_BOOK:
new NewEntryAction(this, StandardEntryType.Book, dialogService, prefs, stateManager).execute();
break;
case NEW_INBOOK:
- new NewEntryAction(this, StandardEntryType.InBook, dialogService, prefs, stateManager).execute();
+ new NewEntryAction(this, StandardEntryType.InBook, dialogService, prefs, stateManager)
+ .execute();
break;
case NEW_MASTERSTHESIS:
- new NewEntryAction(this, StandardEntryType.MastersThesis, dialogService, prefs, stateManager).execute();
+ new NewEntryAction(this, StandardEntryType.MastersThesis, dialogService, prefs, stateManager)
+ .execute();
break;
case NEW_PHDTHESIS:
- new NewEntryAction(this, StandardEntryType.PhdThesis, dialogService, prefs, stateManager).execute();
+ new NewEntryAction(this, StandardEntryType.PhdThesis, dialogService, prefs, stateManager)
+ .execute();
break;
case NEW_PROCEEDINGS:
- new NewEntryAction(this, StandardEntryType.Proceedings, dialogService, prefs, stateManager).execute();
+ new NewEntryAction(this, StandardEntryType.Proceedings, dialogService, prefs, stateManager)
+ .execute();
break;
case NEW_TECHREPORT:
- new NewEntryAction(this, StandardEntryType.TechReport, dialogService, prefs, stateManager).execute();
+ new NewEntryAction(this, StandardEntryType.TechReport, dialogService, prefs, stateManager)
+ .execute();
break;
case NEW_UNPUBLISHED:
- new NewEntryAction(this, StandardEntryType.Unpublished, dialogService, prefs, stateManager).execute();
+ new NewEntryAction(this, StandardEntryType.Unpublished, dialogService, prefs, stateManager)
+ .execute();
break;
case NEW_INPROCEEDINGS:
- new NewEntryAction(this, StandardEntryType.InProceedings, dialogService, prefs, stateManager).execute();
+ new NewEntryAction(this, StandardEntryType.InProceedings, dialogService, prefs, stateManager)
+ .execute();
break;
case PASTE:
- if (OS.OS_X) { // Workaround for a jdk issue that executes paste twice when using cmd+v in a TextField
+ if (OS.OS_X) { // Workaround for a jdk issue that executes paste twice when using cmd+v in a
+ // TextField
// Extra workaround for CodeArea, which does not inherit from TextInputControl
- if (!(stateManager.getFocusOwner().isPresent() && (stateManager.getFocusOwner().get() instanceof CodeArea))) {
+ if (!(stateManager.getFocusOwner().isPresent()
+ && (stateManager.getFocusOwner().get() instanceof CodeArea))) {
event.consume();
break;
}
@@ -311,12 +318,14 @@ private void initKeyBindings() {
private void initShowTrackingNotification() {
if (prefs.getTelemetryPreferences().shouldAskToCollectTelemetry()) {
- JabRefExecutorService.INSTANCE.submit(new TimerTask() {
- @Override
- public void run() {
- DefaultTaskExecutor.runInJavaFXThread(JabRefFrame.this::showTrackingNotification);
- }
- }, 60000); // run in one minute
+ JabRefExecutorService.INSTANCE.submit(
+ new TimerTask() {
+ @Override
+ public void run() {
+ DefaultTaskExecutor.runInJavaFXThread(JabRefFrame.this::showTrackingNotification);
+ }
+ },
+ 60000); // run in one minute
}
}
@@ -327,7 +336,8 @@ private void showTrackingNotification() {
if (!telemetryPreferences.shouldCollectTelemetry()) {
shouldCollect = dialogService.showConfirmationDialogAndWait(
Localization.lang("Telemetry: Help make JabRef better"),
- Localization.lang("To improve the user experience, we would like to collect anonymous statistics on the features you use. We will only record what features you access and how often you do it. We will neither collect any personal data nor the content of bibliographic items. If you choose to allow data collection, you can later disable it via File -> Preferences -> General."),
+ Localization.lang(
+ "To improve the user experience, we would like to collect anonymous statistics on the features you use. We will only record what features you access and how often you do it. We will neither collect any personal data nor the content of bibliographic items. If you choose to allow data collection, you can later disable it via File -> Preferences -> General."),
Localization.lang("Share anonymous statistics"),
Localization.lang("Don't share"));
}
@@ -366,9 +376,10 @@ private void tearDownJabRef(List filenames) {
if (filenames.isEmpty()) {
prefs.getGuiPreferences().getLastFilesOpened().clear();
} else {
- Path focusedDatabase = getCurrentLibraryTab().getBibDatabaseContext()
- .getDatabasePath()
- .orElse(null);
+ Path focusedDatabase = getCurrentLibraryTab()
+ .getBibDatabaseContext()
+ .getDatabasePath()
+ .orElse(null);
prefs.getGuiPreferences().setLastFilesOpened(filenames);
prefs.getGuiPreferences().setLastFocusedFile(focusedDatabase);
}
@@ -420,14 +431,21 @@ public boolean quit() {
context.clearDBMSSynchronizer();
}
AutosaveManager.shutdown(context);
- BackupManager.shutdown(context, prefs.getFilePreferences().getBackupDirectory(), prefs.getFilePreferences().shouldCreateBackup());
- context.getDatabasePath().map(Path::toAbsolutePath).map(Path::toString).ifPresent(filenames::add);
+ BackupManager.shutdown(
+ context,
+ prefs.getFilePreferences().getBackupDirectory(),
+ prefs.getFilePreferences().shouldCreateBackup());
+ context.getDatabasePath()
+ .map(Path::toAbsolutePath)
+ .map(Path::toString)
+ .ifPresent(filenames::add);
}
WaitForSaveFinishedDialog waitForSaveFinishedDialog = new WaitForSaveFinishedDialog(dialogService);
waitForSaveFinishedDialog.showAndWait(getLibraryTabs());
- // We call saveWindow state here again because under Mac the windowClose listener on the stage isn't triggered when using cmd + q
+ // We call saveWindow state here again because under Mac the windowClose listener on the stage isn't triggered
+ // when using cmd + q
saveWindowState();
// Good bye!
tearDownJabRef(filenames);
@@ -453,12 +471,12 @@ public void saveWindowState() {
*/
private void debugLogWindowState(Stage mainStage) {
if (LOGGER.isDebugEnabled()) {
- String debugLogString = "SCREEN DATA:" +
- "mainStage.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n" +
- "mainStage.POS_X: " + mainStage.getX() + "\n" +
- "mainStage.POS_Y: " + mainStage.getY() + "\n" +
- "mainStage.SIZE_X: " + mainStage.getWidth() + "\n" +
- "mainStages.SIZE_Y: " + mainStage.getHeight() + "\n";
+ String debugLogString = "SCREEN DATA:" + "mainStage.WINDOW_MAXIMISED: "
+ + mainStage.isMaximized() + "\n" + "mainStage.POS_X: "
+ + mainStage.getX() + "\n" + "mainStage.POS_Y: "
+ + mainStage.getY() + "\n" + "mainStage.SIZE_X: "
+ + mainStage.getWidth() + "\n" + "mainStages.SIZE_Y: "
+ + mainStage.getHeight() + "\n";
LOGGER.debug(debugLogString);
}
}
@@ -535,7 +553,8 @@ private void updateSidePane() {
private void setDividerPosition() {
if (mainStage.isShowing() && !sidePane.getChildren().isEmpty()) {
splitPane.setDividerPositions(prefs.getGuiPreferences().getSidePaneWidth() / splitPane.getWidth());
- dividerSubscription = EasyBind.subscribe(sidePane.widthProperty(), width -> prefs.getGuiPreferences().setSidePaneWidth(width.doubleValue()));
+ dividerSubscription = EasyBind.subscribe(
+ sidePane.widthProperty(), width -> prefs.getGuiPreferences().setSidePaneWidth(width.doubleValue()));
}
}
@@ -553,9 +572,9 @@ public LibraryTab getLibraryTabAt(int i) {
*/
public List getLibraryTabs() {
return tabbedPane.getTabs().stream()
- .filter(LibraryTab.class::isInstance)
- .map(LibraryTab.class::cast)
- .collect(Collectors.toList());
+ .filter(LibraryTab.class::isInstance)
+ .map(LibraryTab.class::cast)
+ .collect(Collectors.toList());
}
public void showLibraryTabAt(int i) {
@@ -592,25 +611,26 @@ public void init() {
openDatabaseList = EasyBind.map(filteredTabs, tab -> ((LibraryTab) tab).getBibDatabaseContext());
EasyBind.bindContent(stateManager.getOpenDatabases(), openDatabaseList);
- // the binding for stateManager.activeDatabaseProperty() is at org.jabref.gui.LibraryTab.onDatabaseLoadingSucceed
+ // the binding for stateManager.activeDatabaseProperty() is at
+ // org.jabref.gui.LibraryTab.onDatabaseLoadingSucceed
// Subscribe to the search
- EasyBind.subscribe(stateManager.activeSearchQueryProperty(),
- query -> {
- if (prefs.getSearchPreferences().shouldKeepSearchString()) {
- for (LibraryTab tab : getLibraryTabs()) {
- tab.setCurrentSearchQuery(query);
- }
- } else {
- if (getCurrentLibraryTab() != null) {
- getCurrentLibraryTab().setCurrentSearchQuery(query);
- }
- }
- });
+ EasyBind.subscribe(stateManager.activeSearchQueryProperty(), query -> {
+ if (prefs.getSearchPreferences().shouldKeepSearchString()) {
+ for (LibraryTab tab : getLibraryTabs()) {
+ tab.setCurrentSearchQuery(query);
+ }
+ } else {
+ if (getCurrentLibraryTab() != null) {
+ getCurrentLibraryTab().setCurrentSearchQuery(query);
+ }
+ }
+ });
// Wait for the scene to be created, otherwise focusOwnerProperty is not provided
- Platform.runLater(() -> stateManager.focusOwnerProperty().bind(
- EasyBind.map(mainStage.getScene().focusOwnerProperty(), Optional::ofNullable)));
+ Platform.runLater(() -> stateManager
+ .focusOwnerProperty()
+ .bind(EasyBind.map(mainStage.getScene().focusOwnerProperty(), Optional::ofNullable)));
EasyBind.subscribe(tabbedPane.getSelectionModel().selectedItemProperty(), selectedTab -> {
if (selectedTab instanceof LibraryTab libraryTab) {
@@ -638,9 +658,12 @@ public void init() {
stateManager.setSelectedEntries(libraryTab.getSelectedEntries());
// Update active search query when switching between databases
- if (prefs.getSearchPreferences().shouldKeepSearchString() && libraryTab.getCurrentSearchQuery().isEmpty() && stateManager.activeSearchQueryProperty().get().isPresent()) {
+ if (prefs.getSearchPreferences().shouldKeepSearchString()
+ && libraryTab.getCurrentSearchQuery().isEmpty()
+ && stateManager.activeSearchQueryProperty().get().isPresent()) {
// apply search query also when opening a new library and keep search string is activated
- libraryTab.setCurrentSearchQuery(stateManager.activeSearchQueryProperty().get());
+ libraryTab.setCurrentSearchQuery(
+ stateManager.activeSearchQueryProperty().get());
} else {
stateManager.activeSearchQueryProperty().set(libraryTab.getCurrentSearchQuery());
}
@@ -653,8 +676,7 @@ public void init() {
// Set window title - copy tab title
StringBinding windowTitle = Bindings.createStringBinding(
- () -> libraryTab.textProperty().getValue() + " \u2013 " + FRAME_TITLE,
- libraryTab.textProperty());
+ () -> libraryTab.textProperty().getValue() + " \u2013 " + FRAME_TITLE, libraryTab.textProperty());
mainStage.titleProperty().bind(windowTitle);
});
initShowTrackingNotification();
@@ -702,14 +724,23 @@ private ContextMenu createTabContextMenuFor(LibraryTab tab, KeyBindingRepository
ContextMenu contextMenu = new ContextMenu();
ActionFactory factory = new ActionFactory(keyBindingRepository);
- contextMenu.getItems().addAll(
- factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(tab::getBibDatabaseContext, stateManager)),
- factory.createMenuItem(StandardActions.OPEN_DATABASE_FOLDER, new OpenDatabaseFolder(tab::getBibDatabaseContext)),
- factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(tab::getBibDatabaseContext, stateManager, prefs, dialogService)),
- new SeparatorMenuItem(),
- factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction(this, tab)),
- factory.createMenuItem(StandardActions.CLOSE_OTHER_LIBRARIES, new CloseOthersDatabaseAction(tab)),
- factory.createMenuItem(StandardActions.CLOSE_ALL_LIBRARIES, new CloseAllDatabaseAction()));
+ contextMenu
+ .getItems()
+ .addAll(
+ factory.createMenuItem(
+ StandardActions.LIBRARY_PROPERTIES,
+ new LibraryPropertiesAction(tab::getBibDatabaseContext, stateManager)),
+ factory.createMenuItem(
+ StandardActions.OPEN_DATABASE_FOLDER,
+ new OpenDatabaseFolder(tab::getBibDatabaseContext)),
+ factory.createMenuItem(
+ StandardActions.OPEN_CONSOLE,
+ new OpenConsoleAction(tab::getBibDatabaseContext, stateManager, prefs, dialogService)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction(this, tab)),
+ factory.createMenuItem(
+ StandardActions.CLOSE_OTHER_LIBRARIES, new CloseOthersDatabaseAction(tab)),
+ factory.createMenuItem(StandardActions.CLOSE_ALL_LIBRARIES, new CloseAllDatabaseAction()));
return contextMenu;
}
@@ -771,10 +802,8 @@ public void addTab(ParserResult parserResult, boolean raisePanel) {
} else {
// only add tab if library is not already open
Optional libraryTab = getLibraryTabs().stream()
- .filter(p -> p.getBibDatabaseContext()
- .getDatabasePath()
- .equals(parserResult.getPath()))
- .findFirst();
+ .filter(p -> p.getBibDatabaseContext().getDatabasePath().equals(parserResult.getPath()))
+ .findFirst();
if (libraryTab.isPresent()) {
tabbedPane.getSelectionModel().select(libraryTab.get());
@@ -792,7 +821,8 @@ public void addTab(ParserResult parserResult, boolean raisePanel) {
*/
private void addImportedEntries(final LibraryTab panel, final ParserResult parserResult) {
BackgroundTask task = BackgroundTask.wrap(() -> parserResult);
- ImportCleanup cleanup = ImportCleanup.targeting(panel.getBibDatabaseContext().getMode());
+ ImportCleanup cleanup =
+ ImportCleanup.targeting(panel.getBibDatabaseContext().getMode());
cleanup.doPostCleanup(parserResult.getDatabase().getEntries());
ImportEntriesDialog dialog = new ImportEntriesDialog(panel.getBibDatabaseContext(), task);
dialog.setTitle(Localization.lang("Import"));
@@ -810,20 +840,25 @@ public FileHistoryMenu getFileHistory() {
* @return true if the user choose to close the database
*/
private boolean confirmClose(LibraryTab libraryTab) {
- String filename = libraryTab.getBibDatabaseContext()
- .getDatabasePath()
- .map(Path::toAbsolutePath)
- .map(Path::toString)
- .orElse(Localization.lang("untitled"));
+ String filename = libraryTab
+ .getBibDatabaseContext()
+ .getDatabasePath()
+ .map(Path::toAbsolutePath)
+ .map(Path::toString)
+ .orElse(Localization.lang("untitled"));
ButtonType saveChanges = new ButtonType(Localization.lang("Save changes"), ButtonBar.ButtonData.YES);
ButtonType discardChanges = new ButtonType(Localization.lang("Discard changes"), ButtonBar.ButtonData.NO);
- ButtonType returnToLibrary = new ButtonType(Localization.lang("Return to library"), ButtonBar.ButtonData.CANCEL_CLOSE);
+ ButtonType returnToLibrary =
+ new ButtonType(Localization.lang("Return to library"), ButtonBar.ButtonData.CANCEL_CLOSE);
- Optional response = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.CONFIRMATION,
+ Optional response = dialogService.showCustomButtonDialogAndWait(
+ Alert.AlertType.CONFIRMATION,
Localization.lang("Save before closing"),
Localization.lang("Library '%0' has changed.", filename),
- saveChanges, discardChanges, returnToLibrary);
+ saveChanges,
+ discardChanges,
+ returnToLibrary);
if (response.isEmpty()) {
return true;
@@ -837,7 +872,8 @@ private boolean confirmClose(LibraryTab libraryTab) {
if (buttonType.equals(saveChanges)) {
try {
- SaveDatabaseAction saveAction = new SaveDatabaseAction(libraryTab, dialogService, prefs, Globals.entryTypesManager);
+ SaveDatabaseAction saveAction =
+ new SaveDatabaseAction(libraryTab, dialogService, prefs, Globals.entryTypesManager);
if (saveAction.save()) {
return true;
}
@@ -845,14 +881,17 @@ private boolean confirmClose(LibraryTab libraryTab) {
dialogService.notify(Localization.lang("Unable to save library"));
} catch (Throwable ex) {
LOGGER.error("A problem occurred when trying to save the file", ex);
- dialogService.showErrorDialogAndWait(Localization.lang("Save library"), Localization.lang("Could not save file."), ex);
+ dialogService.showErrorDialogAndWait(
+ Localization.lang("Save library"), Localization.lang("Could not save file."), ex);
}
// Save was cancelled or an error occurred.
return false;
}
if (buttonType.equals(discardChanges)) {
- BackupManager.discardBackup(libraryTab.getBibDatabaseContext(), prefs.getFilePreferences().getBackupDirectory());
+ BackupManager.discardBackup(
+ libraryTab.getBibDatabaseContext(),
+ prefs.getFilePreferences().getBackupDirectory());
return true;
}
@@ -882,7 +921,10 @@ public void closeTab(LibraryTab libraryTab) {
removeTab(libraryTab);
}
AutosaveManager.shutdown(context);
- BackupManager.shutdown(context, prefs.getFilePreferences().getBackupDirectory(), prefs.getFilePreferences().shouldCreateBackup());
+ BackupManager.shutdown(
+ context,
+ prefs.getFilePreferences().getBackupDirectory(),
+ prefs.getFilePreferences().shouldCreateBackup());
}
private void removeTab(LibraryTab libraryTab) {
@@ -920,12 +962,13 @@ public DialogService getDialogService() {
return dialogService;
}
- private void copyGroupTreeNode(LibraryTab destinationLibraryTab, GroupTreeNode parent, GroupTreeNode groupTreeNodeToCopy) {
- List allEntries = getCurrentLibraryTab()
- .getBibDatabaseContext()
- .getEntries();
+ private void copyGroupTreeNode(
+ LibraryTab destinationLibraryTab, GroupTreeNode parent, GroupTreeNode groupTreeNodeToCopy) {
+ List allEntries =
+ getCurrentLibraryTab().getBibDatabaseContext().getEntries();
// add groupTreeNodeToCopy to the parent-- in the first run that will the source/main GroupTreeNode
- GroupTreeNode copiedNode = parent.addSubgroup(groupTreeNodeToCopy.copyNode().getGroup());
+ GroupTreeNode copiedNode =
+ parent.addSubgroup(groupTreeNodeToCopy.copyNode().getGroup());
// add all entries of a groupTreeNode to the new library.
destinationLibraryTab.dropEntry(groupTreeNodeToCopy.getEntriesInGroup(allEntries));
// List of all children of groupTreeNodeToCopy
@@ -940,20 +983,23 @@ private void copyGroupTreeNode(LibraryTab destinationLibraryTab, GroupTreeNode p
}
private void copyRootNode(LibraryTab destinationLibraryTab) {
- if (!destinationLibraryTab.getBibDatabaseContext().getMetaData().getGroups().isEmpty()) {
+ if (!destinationLibraryTab
+ .getBibDatabaseContext()
+ .getMetaData()
+ .getGroups()
+ .isEmpty()) {
return;
}
// a root (all entries) GroupTreeNode
- GroupTreeNode currentLibraryGroupRoot = getCurrentLibraryTab().getBibDatabaseContext()
- .getMetaData()
- .getGroups()
- .get()
- .copyNode();
+ GroupTreeNode currentLibraryGroupRoot = getCurrentLibraryTab()
+ .getBibDatabaseContext()
+ .getMetaData()
+ .getGroups()
+ .get()
+ .copyNode();
// add currentLibraryGroupRoot to the Library if it does not have a root.
- destinationLibraryTab.getBibDatabaseContext()
- .getMetaData()
- .setGroups(currentLibraryGroupRoot);
+ destinationLibraryTab.getBibDatabaseContext().getMetaData().setGroups(currentLibraryGroupRoot);
}
public Stage getMainStage() {
@@ -963,7 +1009,7 @@ public Stage getMainStage() {
/**
* The action concerned with closing the window.
*/
- static protected class CloseAction extends SimpleCommand {
+ protected static class CloseAction extends SimpleCommand {
private final JabRefFrame frame;
@@ -977,7 +1023,7 @@ public void execute() {
}
}
- static protected class CloseDatabaseAction extends SimpleCommand {
+ protected static class CloseDatabaseAction extends SimpleCommand {
private final LibraryTabContainer tabContainer;
private final LibraryTab libraryTab;
@@ -1041,13 +1087,16 @@ public OpenDatabaseFolder(Supplier databaseContext) {
@Override
public void execute() {
- Optional.of(databaseContext.get()).flatMap(BibDatabaseContext::getDatabasePath).ifPresent(path -> {
- try {
- JabRefDesktop.openFolderAndSelectFile(path, prefs.getExternalApplicationsPreferences(), dialogService);
- } catch (IOException e) {
- LOGGER.info("Could not open folder", e);
- }
- });
+ Optional.of(databaseContext.get())
+ .flatMap(BibDatabaseContext::getDatabasePath)
+ .ifPresent(path -> {
+ try {
+ JabRefDesktop.openFolderAndSelectFile(
+ path, prefs.getExternalApplicationsPreferences(), dialogService);
+ } catch (IOException e) {
+ LOGGER.info("Could not open folder", e);
+ }
+ });
}
}
diff --git a/src/main/java/org/jabref/gui/JabRefGUI.java b/src/main/java/org/jabref/gui/JabRefGUI.java
index 9a402703619..bc3c5bd0dc0 100644
--- a/src/main/java/org/jabref/gui/JabRefGUI.java
+++ b/src/main/java/org/jabref/gui/JabRefGUI.java
@@ -1,18 +1,13 @@
package org.jabref.gui;
-import java.nio.file.Path;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
+import com.airhacks.afterburner.injection.Injector;
+import com.tobiasdiez.easybind.EasyBind;
+import impl.org.controlsfx.skin.DecorationPane;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.input.KeyEvent;
import javafx.stage.Screen;
import javafx.stage.Stage;
-
import org.jabref.gui.help.VersionWorker;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.importer.ParserResultWarningDialog;
@@ -29,13 +24,16 @@
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.GuiPreferences;
import org.jabref.preferences.PreferencesService;
-
-import com.airhacks.afterburner.injection.Injector;
-import com.tobiasdiez.easybind.EasyBind;
-import impl.org.controlsfx.skin.DecorationPane;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.nio.file.Path;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
public class JabRefGUI {
private static final Logger LOGGER = LoggerFactory.getLogger(JabRefGUI.class);
@@ -50,11 +48,12 @@ public class JabRefGUI {
private final List failed = new ArrayList<>();
private final List toOpenTab = new ArrayList<>();
- public JabRefGUI(Stage mainStage,
- List databases,
- boolean isBlank,
- PreferencesService preferencesService,
- FileUpdateMonitor fileUpdateMonitor) {
+ public JabRefGUI(
+ Stage mainStage,
+ List databases,
+ boolean isBlank,
+ PreferencesService preferencesService,
+ FileUpdateMonitor fileUpdateMonitor) {
this.parserResults = databases;
this.isBlank = isBlank;
this.preferencesService = preferencesService;
@@ -69,10 +68,11 @@ public JabRefGUI(Stage mainStage,
EasyBind.subscribe(preferencesService.getInternalPreferences().versionCheckEnabledProperty(), enabled -> {
if (enabled) {
- new VersionWorker(Globals.BUILD_INFO.version,
- mainFrame.getDialogService(),
- Globals.TASK_EXECUTOR,
- preferencesService)
+ new VersionWorker(
+ Globals.BUILD_INFO.version,
+ mainFrame.getDialogService(),
+ Globals.TASK_EXECUTOR,
+ preferencesService)
.checkForNewVersionDelayed();
}
});
@@ -87,7 +87,8 @@ private void setupProxy() {
}
if (preferencesService.getProxyPreferences().shouldPersistPassword()
- && StringUtil.isNotBlank(preferencesService.getProxyPreferences().getPassword())) {
+ && StringUtil.isNotBlank(
+ preferencesService.getProxyPreferences().getPassword())) {
ProxyRegisterer.register(preferencesService.getProxyPreferences());
return;
}
@@ -169,10 +170,11 @@ private void openWindow(Stage mainStage) {
Platform.runLater(this::openDatabases);
if (!(fileUpdateMonitor.isActive())) {
- getMainFrame().getDialogService()
- .showErrorDialogAndWait(Localization.lang("Unable to monitor file changes. Please close files " +
- "and processes and restart. You may encounter errors if you continue " +
- "with this session."));
+ getMainFrame()
+ .getDialogService()
+ .showErrorDialogAndWait(Localization.lang("Unable to monitor file changes. Please close files "
+ + "and processes and restart. You may encounter errors if you continue "
+ + "with this session."));
}
}
@@ -188,25 +190,26 @@ private void openDatabases() {
// From here on, the libraries provided by command line arguments are treated
// Remove invalid databases
- List invalidDatabases = parserResults.stream()
- .filter(ParserResult::isInvalid)
- .toList();
+ List invalidDatabases =
+ parserResults.stream().filter(ParserResult::isInvalid).toList();
failed.addAll(invalidDatabases);
parserResults.removeAll(invalidDatabases);
// passed file (we take the first one) should be focused
Path focusedFile = parserResults.stream()
- .findFirst()
- .flatMap(ParserResult::getPath)
- .orElse(preferencesService.getGuiPreferences()
- .getLastFocusedFile())
- .toAbsolutePath();
+ .findFirst()
+ .flatMap(ParserResult::getPath)
+ .orElse(preferencesService.getGuiPreferences().getLastFocusedFile())
+ .toAbsolutePath();
// Add all bibDatabases databases to the frame:
boolean first = false;
for (ParserResult parserResult : parserResults) {
// Define focused tab
- if (parserResult.getPath().filter(path -> path.toAbsolutePath().equals(focusedFile)).isPresent()) {
+ if (parserResult
+ .getPath()
+ .filter(path -> path.toAbsolutePath().equals(focusedFile))
+ .isPresent()) {
first = true;
}
@@ -222,16 +225,18 @@ private void openDatabases() {
fileUpdateMonitor,
mainFrame.getUndoManager(),
Globals.TASK_EXECUTOR);
- } catch (SQLException |
- DatabaseNotSupportedException |
- InvalidDBMSConnectionPropertiesException |
- NotASharedDatabaseException e) {
+ } catch (SQLException
+ | DatabaseNotSupportedException
+ | InvalidDBMSConnectionPropertiesException
+ | NotASharedDatabaseException e) {
LOGGER.error("Connection error", e);
- mainFrame.getDialogService().showErrorDialogAndWait(
- Localization.lang("Connection error"),
- Localization.lang("A local copy will be opened."),
- e);
+ mainFrame
+ .getDialogService()
+ .showErrorDialogAndWait(
+ Localization.lang("Connection error"),
+ Localization.lang("A local copy will be opened."),
+ e);
toOpenTab.add(parserResult);
}
} else if (parserResult.toOpenTab()) {
@@ -251,9 +256,10 @@ private void openDatabases() {
}
for (ParserResult pr : failed) {
- String message = Localization.lang("Error opening file '%0'",
- pr.getPath().map(Path::toString).orElse("(File name unknown)")) + "\n" +
- pr.getErrorMessage();
+ String message = Localization.lang(
+ "Error opening file '%0'",
+ pr.getPath().map(Path::toString).orElse("(File name unknown)"))
+ + "\n" + pr.getErrorMessage();
mainFrame.getDialogService().showErrorDialogAndWait(Localization.lang("Error opening file"), message);
}
@@ -301,12 +307,12 @@ private void saveWindowState(Stage mainStage) {
*/
private void debugLogWindowState(Stage mainStage) {
if (LOGGER.isDebugEnabled()) {
- String debugLogString = "SCREEN DATA:" +
- "mainStage.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n" +
- "mainStage.POS_X: " + mainStage.getX() + "\n" +
- "mainStage.POS_Y: " + mainStage.getY() + "\n" +
- "mainStage.SIZE_X: " + mainStage.getWidth() + "\n" +
- "mainStages.SIZE_Y: " + mainStage.getHeight() + "\n";
+ String debugLogString = "SCREEN DATA:" + "mainStage.WINDOW_MAXIMISED: "
+ + mainStage.isMaximized() + "\n" + "mainStage.POS_X: "
+ + mainStage.getX() + "\n" + "mainStage.POS_Y: "
+ + mainStage.getY() + "\n" + "mainStage.SIZE_X: "
+ + mainStage.getWidth() + "\n" + "mainStages.SIZE_Y: "
+ + mainStage.getHeight() + "\n";
LOGGER.debug(debugLogString);
}
}
@@ -317,9 +323,11 @@ private void debugLogWindowState(Stage mainStage) {
* @return outbounds
*/
private boolean isWindowPositionOutOfBounds() {
- return !Screen.getPrimary().getBounds().contains(
- preferencesService.getGuiPreferences().getPositionX(),
- preferencesService.getGuiPreferences().getPositionY());
+ return !Screen.getPrimary()
+ .getBounds()
+ .contains(
+ preferencesService.getGuiPreferences().getPositionX(),
+ preferencesService.getGuiPreferences().getPositionY());
}
private void openLastEditedDatabases() {
diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java
index 137a9548678..5cd6d24ca10 100644
--- a/src/main/java/org/jabref/gui/LibraryTab.java
+++ b/src/main/java/org/jabref/gui/LibraryTab.java
@@ -1,16 +1,8 @@
package org.jabref.gui;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Random;
-
-import javax.swing.undo.UndoManager;
-
+import com.google.common.eventbus.Subscribe;
+import com.tobiasdiez.easybind.EasyBind;
+import com.tobiasdiez.easybind.Subscription;
import javafx.animation.PauseTransition;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
@@ -24,7 +16,8 @@
import javafx.scene.control.Tooltip;
import javafx.scene.layout.BorderPane;
import javafx.util.Duration;
-
+import org.controlsfx.control.NotificationPane;
+import org.controlsfx.control.action.Action;
import org.jabref.gui.autocompleter.AutoCompletePreferences;
import org.jabref.gui.autocompleter.PersonNameSuggestionProvider;
import org.jabref.gui.autocompleter.SuggestionProviders;
@@ -37,11 +30,7 @@
import org.jabref.gui.maintable.BibEntryTableViewModel;
import org.jabref.gui.maintable.MainTable;
import org.jabref.gui.maintable.MainTableDataModel;
-import org.jabref.gui.undo.CountingUndoManager;
-import org.jabref.gui.undo.NamedCompound;
-import org.jabref.gui.undo.UndoableFieldChange;
-import org.jabref.gui.undo.UndoableInsertEntries;
-import org.jabref.gui.undo.UndoableRemoveEntries;
+import org.jabref.gui.undo.*;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.DefaultTaskExecutor;
import org.jabref.gui.util.TaskExecutor;
@@ -72,15 +61,14 @@
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;
-
-import com.google.common.eventbus.Subscribe;
-import com.tobiasdiez.easybind.EasyBind;
-import com.tobiasdiez.easybind.Subscription;
-import org.controlsfx.control.NotificationPane;
-import org.controlsfx.control.action.Action;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.swing.undo.UndoManager;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.*;
+
public class LibraryTab extends Tab {
private static final Logger LOGGER = LoggerFactory.getLogger(LibraryTab.class);
@@ -124,15 +112,16 @@ public class LibraryTab extends Tab {
private final IndexingTaskManager indexingTaskManager;
private final TaskExecutor taskExecutor;
- public LibraryTab(BibDatabaseContext bibDatabaseContext,
- JabRefFrame frame,
- DialogService dialogService,
- PreferencesService preferencesService,
- StateManager stateManager,
- FileUpdateMonitor fileUpdateMonitor,
- BibEntryTypesManager entryTypesManager,
- CountingUndoManager undoManager,
- TaskExecutor taskExecutor) {
+ public LibraryTab(
+ BibDatabaseContext bibDatabaseContext,
+ JabRefFrame frame,
+ DialogService dialogService,
+ PreferencesService preferencesService,
+ StateManager stateManager,
+ FileUpdateMonitor fileUpdateMonitor,
+ BibEntryTypesManager entryTypesManager,
+ CountingUndoManager undoManager,
+ TaskExecutor taskExecutor) {
this.frame = Objects.requireNonNull(frame);
this.bibDatabaseContext = Objects.requireNonNull(bibDatabaseContext);
this.undoManager = undoManager;
@@ -173,8 +162,8 @@ public LibraryTab(BibDatabaseContext bibDatabaseContext,
Platform.runLater(() -> {
EasyBind.subscribe(changedProperty, this::updateTabTitle);
- stateManager.getOpenDatabases().addListener((ListChangeListener) c ->
- updateTabTitle(changedProperty.getValue()));
+ stateManager.getOpenDatabases().addListener((ListChangeListener)
+ c -> updateTabTitle(changedProperty.getValue()));
});
}
@@ -231,7 +220,8 @@ public void onDatabaseLoadingSucceed(ParserResult result) {
if (preferencesService.getFilePreferences().shouldFulltextIndexLinkedFiles()) {
try {
- indexingTaskManager.updateIndex(PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()), bibDatabaseContext);
+ indexingTaskManager.updateIndex(
+ PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()), bibDatabaseContext);
} catch (IOException e) {
LOGGER.error("Cannot access lucene index", e);
}
@@ -251,15 +241,20 @@ public void feedData(BibDatabaseContext bibDatabaseContextFromParserResult) {
if (this.getTabPane().getSelectionModel().selectedItemProperty().get().equals(this)) {
// If you open an existing library, a library tab with a loading animation is added immediately.
// At that point, the library tab is given a temporary bibDatabaseContext with no entries.
- // This line is necessary because, while there is already a binding that updates the active database when a new tab is added,
+ // This line is necessary because, while there is already a binding that updates the active database when a
+ // new tab is added,
// it doesn't handle the case when a library is loaded asynchronously.
// See org.jabref.gui.LibraryTab.createLibraryTab for the asynchronous loading.
stateManager.setActiveDatabase(bibDatabaseContextFromParserResult);
}
- // Remove existing dummy BibDatabaseContext and add correct BibDatabaseContext from ParserResult to trigger changes in the openDatabases list in the stateManager
- Optional foundExistingBibDatabase = stateManager.getOpenDatabases().stream().filter(databaseContext -> databaseContext.equals(this.bibDatabaseContext)).findFirst();
- foundExistingBibDatabase.ifPresent(databaseContext -> stateManager.getOpenDatabases().remove(databaseContext));
+ // Remove existing dummy BibDatabaseContext and add correct BibDatabaseContext from ParserResult to trigger
+ // changes in the openDatabases list in the stateManager
+ Optional foundExistingBibDatabase = stateManager.getOpenDatabases().stream()
+ .filter(databaseContext -> databaseContext.equals(this.bibDatabaseContext))
+ .findFirst();
+ foundExistingBibDatabase.ifPresent(
+ databaseContext -> stateManager.getOpenDatabases().remove(databaseContext));
this.bibDatabaseContext = Objects.requireNonNull(bibDatabaseContextFromParserResult);
@@ -270,7 +265,8 @@ public void feedData(BibDatabaseContext bibDatabaseContextFromParserResult) {
this.tableModel = new MainTableDataModel(getBibDatabaseContext(), preferencesService, stateManager);
citationStyleCache = new CitationStyleCache(bibDatabaseContextFromParserResult);
- annotationCache = new FileAnnotationCache(bibDatabaseContextFromParserResult, preferencesService.getFilePreferences());
+ annotationCache =
+ new FileAnnotationCache(bibDatabaseContextFromParserResult, preferencesService.getFilePreferences());
setupMainPanel();
setupAutoCompletion();
@@ -288,8 +284,8 @@ public void feedData(BibDatabaseContext bibDatabaseContextFromParserResult) {
Platform.runLater(() -> {
EasyBind.subscribe(changedProperty, this::updateTabTitle);
- stateManager.getOpenDatabases().addListener((ListChangeListener) c ->
- updateTabTitle(changedProperty.getValue()));
+ stateManager.getOpenDatabases().addListener((ListChangeListener)
+ c -> updateTabTitle(changedProperty.getValue()));
});
installAutosaveManagerAndBackupManager();
@@ -298,22 +294,25 @@ public void feedData(BibDatabaseContext bibDatabaseContextFromParserResult) {
public void installAutosaveManagerAndBackupManager() {
if (isDatabaseReadyForAutoSave(bibDatabaseContext)) {
AutosaveManager autosaveManager = AutosaveManager.start(bibDatabaseContext);
- autosaveManager.registerListener(new AutosaveUiManager(this, dialogService, preferencesService, entryTypesManager));
+ autosaveManager.registerListener(
+ new AutosaveUiManager(this, dialogService, preferencesService, entryTypesManager));
}
- if (isDatabaseReadyForBackup(bibDatabaseContext) && preferencesService.getFilePreferences().shouldCreateBackup()) {
+ if (isDatabaseReadyForBackup(bibDatabaseContext)
+ && preferencesService.getFilePreferences().shouldCreateBackup()) {
BackupManager.start(this, bibDatabaseContext, Globals.entryTypesManager, preferencesService);
}
}
private boolean isDatabaseReadyForAutoSave(BibDatabaseContext context) {
return ((context.getLocation() == DatabaseLocation.SHARED)
- || ((context.getLocation() == DatabaseLocation.LOCAL)
- && preferencesService.getLibraryPreferences().shouldAutoSave()))
+ || ((context.getLocation() == DatabaseLocation.LOCAL)
+ && preferencesService.getLibraryPreferences().shouldAutoSave()))
&& context.getDatabasePath().isPresent();
}
private boolean isDatabaseReadyForBackup(BibDatabaseContext context) {
- return (context.getLocation() == DatabaseLocation.LOCAL) && context.getDatabasePath().isPresent();
+ return (context.getLocation() == DatabaseLocation.LOCAL)
+ && context.getDatabasePath().isPresent();
}
/**
@@ -360,7 +359,8 @@ public void updateTabTitle(boolean isChanged) {
}
// Unique path fragment
- Optional uniquePathPart = FileUtil.getUniquePathDirectory(stateManager.collectAllDatabasePaths(), databasePath);
+ Optional uniquePathPart =
+ FileUtil.getUniquePathDirectory(stateManager.collectAllDatabasePaths(), databasePath);
uniquePathPart.ifPresent(part -> tabTitle.append(" \u2013 ").append(part));
} else {
if (databaseLocation == DatabaseLocation.LOCAL) {
@@ -376,7 +376,8 @@ public void updateTabTitle(boolean isChanged) {
addSharedDbInformation(toolTipText, bibDatabaseContext);
}
addModeInfo(toolTipText, bibDatabaseContext);
- if ((databaseLocation == DatabaseLocation.LOCAL) && bibDatabaseContext.getDatabase().hasEntries()) {
+ if ((databaseLocation == DatabaseLocation.LOCAL)
+ && bibDatabaseContext.getDatabase().hasEntries()) {
addChangedInformation(toolTipText, Localization.lang("untitled"));
}
}
@@ -442,7 +443,8 @@ private void delete(boolean cut, List entries) {
ensureNotShowingBottomPanel(entries);
this.changedProperty.setValue(true);
- dialogService.notify(formatOutputMessage(cut ? Localization.lang("Cut") : Localization.lang("Deleted"), entries.size()));
+ dialogService.notify(
+ formatOutputMessage(cut ? Localization.lang("Cut") : Localization.lang("Deleted"), entries.size()));
// prevent the main table from loosing focus
mainTable.requestFocus();
@@ -474,15 +476,13 @@ public void insertEntry(final BibEntry bibEntry) {
*
* @param entries The new entries.
*/
-
public void insertEntries(final List entries) {
if (!entries.isEmpty()) {
bibDatabaseContext.getDatabase().insertEntries(entries);
// Set owner and timestamp
- UpdateField.setAutomaticFields(entries,
- preferencesService.getOwnerPreferences(),
- preferencesService.getTimestampPreferences());
+ UpdateField.setAutomaticFields(
+ entries, preferencesService.getOwnerPreferences(), preferencesService.getTimestampPreferences());
// Create an UndoableInsertEntries object.
getUndoManager().addEdit(new UndoableInsertEntries(bibDatabaseContext.getDatabase(), entries));
@@ -504,7 +504,8 @@ public void editEntryAndFocusField(BibEntry entry, Field field) {
}
private void createMainTable() {
- mainTable = new MainTable(tableModel,
+ mainTable = new MainTable(
+ tableModel,
this,
bibDatabaseContext,
preferencesService,
@@ -515,10 +516,14 @@ private void createMainTable() {
entryTypesManager,
taskExecutor,
fileUpdateMonitor);
- // Add the listener that binds selection to state manager (TODO: should be replaced by proper JavaFX binding as soon as table is implemented in JavaFX)
- // content binding between StateManager#getselectedEntries and mainTable#getSelectedEntries does not work here as it does not trigger the ActionHelper#needsEntriesSelected checker for the menubar
+ // Add the listener that binds selection to state manager (TODO: should be replaced by proper JavaFX binding as
+ // soon as table is implemented in JavaFX)
+ // content binding between StateManager#getselectedEntries and mainTable#getSelectedEntries does not work here
+ // as it does not trigger the ActionHelper#needsEntriesSelected checker for the menubar
mainTable.addSelectionListener(event -> {
- List entries = event.getList().stream().map(BibEntryTableViewModel::getEntry).toList();
+ List entries = event.getList().stream()
+ .map(BibEntryTableViewModel::getEntry)
+ .toList();
stateManager.setSelectedEntries(entries);
if (!entries.isEmpty()) {
// Update entry editor and preview according to selected entries
@@ -540,8 +545,8 @@ public void setupMainPanel() {
// Saves the divider position as soon as it changes
// We need to keep a reference to the subscription, otherwise the binding gets garbage collected
dividerPositionSubscription = EasyBind.valueAt(splitPane.getDividers(), 0)
- .mapObservable(SplitPane.Divider::positionProperty)
- .subscribeToValues(this::saveDividerLocation);
+ .mapObservable(SplitPane.Divider::positionProperty)
+ .subscribeToValues(this::saveDividerLocation);
// Add changePane in case a file is present - otherwise just add the splitPane to the panel
Optional file = bibDatabaseContext.getDatabasePath();
@@ -563,7 +568,8 @@ public void setupMainPanel() {
private void setupAutoCompletion() {
AutoCompletePreferences autoCompletePreferences = preferencesService.getAutoCompletePreferences();
if (autoCompletePreferences.shouldAutoComplete()) {
- suggestionProviders = new SuggestionProviders(getDatabase(), Globals.journalAbbreviationRepository, autoCompletePreferences);
+ suggestionProviders = new SuggestionProviders(
+ getDatabase(), Globals.journalAbbreviationRepository, autoCompletePreferences);
} else {
// Create empty suggestion providers if auto completion is deactivated
suggestionProviders = new SuggestionProviders();
@@ -608,7 +614,8 @@ private void showBottomPane(BasePanelMode newMode) {
}
mode = newMode;
- splitPane.setDividerPositions(preferencesService.getEntryEditorPreferences().getDividerPosition());
+ splitPane.setDividerPositions(
+ preferencesService.getEntryEditorPreferences().getDividerPosition());
}
/**
@@ -627,11 +634,15 @@ public void clearAndSelect(final BibEntry bibEntry) {
}
public void selectPreviousEntry() {
- mainTable.getSelectionModel().clearAndSelect(mainTable.getSelectionModel().getSelectedIndex() - 1);
+ mainTable
+ .getSelectionModel()
+ .clearAndSelect(mainTable.getSelectionModel().getSelectedIndex() - 1);
}
public void selectNextEntry() {
- mainTable.getSelectionModel().clearAndSelect(mainTable.getSelectionModel().getSelectedIndex() + 1);
+ mainTable
+ .getSelectionModel()
+ .clearAndSelect(mainTable.getSelectionModel().getSelectedIndex() + 1);
}
/**
@@ -663,7 +674,6 @@ public void updateEntryEditorIfShowing() {
/**
* Put an asterisk behind the filename to indicate the database has changed.
*/
-
public synchronized void markChangedOrUnChanged() {
if (undoManager.hasChanged()) {
this.changedProperty.setValue(true);
@@ -684,12 +694,14 @@ private boolean showDeleteConfirmationDialog(int numberOfEntries) {
String cancelButton = Localization.lang("Keep entry");
if (numberOfEntries > 1) {
title = Localization.lang("Delete multiple entries");
- message = Localization.lang("Really delete the %0 selected entries?", Integer.toString(numberOfEntries));
+ message =
+ Localization.lang("Really delete the %0 selected entries?", Integer.toString(numberOfEntries));
okButton = Localization.lang("Delete entries");
cancelButton = Localization.lang("Keep entries");
}
- return dialogService.showConfirmationDialogWithOptOutAndWait(title,
+ return dialogService.showConfirmationDialogWithOptOutAndWait(
+ title,
message,
okButton,
cancelButton,
@@ -715,7 +727,10 @@ private void saveDividerLocation(Number position) {
public void cleanUp() {
changeMonitor.ifPresent(DatabaseChangeMonitor::unregister);
AutosaveManager.shutdown(bibDatabaseContext);
- BackupManager.shutdown(bibDatabaseContext, preferencesService.getFilePreferences().getBackupDirectory(), preferencesService.getFilePreferences().shouldCreateBackup());
+ BackupManager.shutdown(
+ bibDatabaseContext,
+ preferencesService.getFilePreferences().getBackupDirectory(),
+ preferencesService.getFilePreferences().shouldCreateBackup());
}
/**
@@ -744,7 +759,8 @@ private BibEntry getShowing() {
}
public String formatOutputMessage(String start, int count) {
- return String.format("%s %d %s.", start, count, (count > 1 ? Localization.lang("entries") : Localization.lang("entry")));
+ return String.format(
+ "%s %d %s.", start, count, (count > 1 ? Localization.lang("entries") : Localization.lang("entry")));
}
public CountingUndoManager getUndoManager() {
@@ -776,7 +792,8 @@ public FileAnnotationCache getAnnotationCache() {
public void resetChangeMonitor() {
changeMonitor.ifPresent(DatabaseChangeMonitor::unregister);
- changeMonitor = Optional.of(new DatabaseChangeMonitor(bibDatabaseContext,
+ changeMonitor = Optional.of(new DatabaseChangeMonitor(
+ bibDatabaseContext,
fileUpdateMonitor,
taskExecutor,
dialogService,
@@ -832,16 +849,17 @@ public void resetChangedProperties() {
* @param dataLoadingTask The task to execute to load the data asynchronously.
* @param file the path to the file (loaded by the dataLoadingTask)
*/
- public static LibraryTab createLibraryTab(BackgroundTask dataLoadingTask,
- Path file,
- DialogService dialogService,
- PreferencesService preferencesService,
- StateManager stateManager,
- JabRefFrame frame,
- FileUpdateMonitor fileUpdateMonitor,
- BibEntryTypesManager entryTypesManager,
- CountingUndoManager undoManager,
- TaskExecutor taskExecutor) {
+ public static LibraryTab createLibraryTab(
+ BackgroundTask dataLoadingTask,
+ Path file,
+ DialogService dialogService,
+ PreferencesService preferencesService,
+ StateManager stateManager,
+ JabRefFrame frame,
+ FileUpdateMonitor fileUpdateMonitor,
+ BibEntryTypesManager entryTypesManager,
+ CountingUndoManager undoManager,
+ TaskExecutor taskExecutor) {
BibDatabaseContext context = new BibDatabaseContext();
context.setDatabasePath(file);
@@ -857,23 +875,25 @@ public static LibraryTab createLibraryTab(BackgroundTask dataLoadi
taskExecutor);
newTab.setDataLoadingTask(dataLoadingTask);
- dataLoadingTask.onRunning(newTab::onDatabaseLoadingStarted)
- .onSuccess(newTab::onDatabaseLoadingSucceed)
- .onFailure(newTab::onDatabaseLoadingFailed)
- .executeWith(taskExecutor);
+ dataLoadingTask
+ .onRunning(newTab::onDatabaseLoadingStarted)
+ .onSuccess(newTab::onDatabaseLoadingSucceed)
+ .onFailure(newTab::onDatabaseLoadingFailed)
+ .executeWith(taskExecutor);
return newTab;
}
- public static LibraryTab createLibraryTab(BibDatabaseContext databaseContext,
- JabRefFrame frame,
- DialogService dialogService,
- PreferencesService preferencesService,
- StateManager stateManager,
- FileUpdateMonitor fileUpdateMonitor,
- BibEntryTypesManager entryTypesManager,
- UndoManager undoManager,
- TaskExecutor taskExecutor) {
+ public static LibraryTab createLibraryTab(
+ BibDatabaseContext databaseContext,
+ JabRefFrame frame,
+ DialogService dialogService,
+ PreferencesService preferencesService,
+ StateManager stateManager,
+ FileUpdateMonitor fileUpdateMonitor,
+ BibEntryTypesManager entryTypesManager,
+ UndoManager undoManager,
+ TaskExecutor taskExecutor) {
Objects.requireNonNull(databaseContext);
LibraryTab libraryTab = new LibraryTab(
@@ -901,8 +921,9 @@ public void listen(EntriesAddedEvent addedEntriesEvent) {
// Automatically add new entries to the selected group (or set of groups)
if (preferencesService.getGroupsPreferences().shouldAutoAssignGroup()) {
- stateManager.getSelectedGroup(bibDatabaseContext).forEach(
- selectedGroup -> selectedGroup.addEntriesToGroup(addedEntriesEvent.getBibEntries()));
+ stateManager
+ .getSelectedGroup(bibDatabaseContext)
+ .forEach(selectedGroup -> selectedGroup.addEntriesToGroup(addedEntriesEvent.getBibEntries()));
}
}
}
@@ -958,8 +979,15 @@ public void listen(FieldChangedEvent fieldChangedEvent) {
removedFiles.remove(newFileList);
try {
- indexingTaskManager.addToIndex(PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()), fieldChangedEvent.getBibEntry(), addedFiles, bibDatabaseContext);
- indexingTaskManager.removeFromIndex(PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()), fieldChangedEvent.getBibEntry(), removedFiles);
+ indexingTaskManager.addToIndex(
+ PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()),
+ fieldChangedEvent.getBibEntry(),
+ addedFiles,
+ bibDatabaseContext);
+ indexingTaskManager.removeFromIndex(
+ PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()),
+ fieldChangedEvent.getBibEntry(),
+ removedFiles);
} catch (IOException e) {
LOGGER.warn("I/O error when writing lucene index", e);
}
diff --git a/src/main/java/org/jabref/gui/LibraryTabContainer.java b/src/main/java/org/jabref/gui/LibraryTabContainer.java
index 4d3c504d503..c9445df3e9c 100644
--- a/src/main/java/org/jabref/gui/LibraryTabContainer.java
+++ b/src/main/java/org/jabref/gui/LibraryTabContainer.java
@@ -1,9 +1,9 @@
package org.jabref.gui;
-import java.util.List;
-
import org.jabref.model.database.BibDatabaseContext;
+import java.util.List;
+
public interface LibraryTabContainer {
LibraryTab getLibraryTabAt(int i);
diff --git a/src/main/java/org/jabref/gui/MainApplication.java b/src/main/java/org/jabref/gui/MainApplication.java
index a187843977d..e28413c0903 100644
--- a/src/main/java/org/jabref/gui/MainApplication.java
+++ b/src/main/java/org/jabref/gui/MainApplication.java
@@ -1,15 +1,14 @@
package org.jabref.gui;
-import java.util.List;
-
import javafx.application.Application;
import javafx.stage.Stage;
-
import org.jabref.gui.openoffice.OOBibBaseConnect;
import org.jabref.logic.importer.ParserResult;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.JabRefPreferences;
+import java.util.List;
+
/**
* JabRef's main class to process command line options and to start the UI
*/
@@ -19,11 +18,12 @@ public class MainApplication extends Application {
private static JabRefPreferences preferences;
private static FileUpdateMonitor fileUpdateMonitor;
- public static void main(List parserResults,
- boolean blank,
- JabRefPreferences preferences,
- FileUpdateMonitor fileUpdateMonitor,
- String[] args) {
+ public static void main(
+ List parserResults,
+ boolean blank,
+ JabRefPreferences preferences,
+ FileUpdateMonitor fileUpdateMonitor,
+ String[] args) {
MainApplication.parserResults = parserResults;
MainApplication.isBlank = blank;
MainApplication.preferences = preferences;
diff --git a/src/main/java/org/jabref/gui/MainMenu.java b/src/main/java/org/jabref/gui/MainMenu.java
index 28a08a31a0d..2348c3d41b4 100644
--- a/src/main/java/org/jabref/gui/MainMenu.java
+++ b/src/main/java/org/jabref/gui/MainMenu.java
@@ -1,13 +1,10 @@
package org.jabref.gui;
-import javax.swing.undo.UndoManager;
-
import javafx.event.ActionEvent;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
-
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.StandardActions;
import org.jabref.gui.auximport.NewSubLibraryAction;
@@ -17,19 +14,11 @@
import org.jabref.gui.copyfiles.CopyFilesAction;
import org.jabref.gui.documentviewer.ShowDocumentViewerAction;
import org.jabref.gui.duplicationFinder.DuplicateSearch;
-import org.jabref.gui.edit.CopyMoreAction;
-import org.jabref.gui.edit.EditAction;
-import org.jabref.gui.edit.ManageKeywordsAction;
-import org.jabref.gui.edit.OpenBrowserAction;
-import org.jabref.gui.edit.ReplaceStringAction;
+import org.jabref.gui.edit.*;
import org.jabref.gui.edit.automaticfiededitor.AutomaticFieldEditorAction;
import org.jabref.gui.entryeditor.OpenEntryEditorAction;
import org.jabref.gui.entryeditor.PreviewSwitchAction;
-import org.jabref.gui.exporter.ExportCommand;
-import org.jabref.gui.exporter.ExportToClipboardAction;
-import org.jabref.gui.exporter.SaveAction;
-import org.jabref.gui.exporter.SaveAllAction;
-import org.jabref.gui.exporter.WriteMetadataToLinkedPdfsAction;
+import org.jabref.gui.exporter.*;
import org.jabref.gui.externalfiles.AutoLinkFilesAction;
import org.jabref.gui.externalfiles.DownloadFullTextAction;
import org.jabref.gui.externalfiles.FindUnlinkedFilesAction;
@@ -72,6 +61,8 @@
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;
+import javax.swing.undo.UndoManager;
+
public class MainMenu extends MenuBar {
private final JabRefFrame frame;
private final SidePane sidePane;
@@ -86,18 +77,19 @@ public class MainMenu extends MenuBar {
private final UndoManager undoManager;
private final ClipBoardManager clipBoardManager;
- public MainMenu(JabRefFrame frame,
- SidePane sidePane,
- PushToApplicationCommand pushToApplicationCommand,
- PreferencesService preferencesService,
- StateManager stateManager,
- FileUpdateMonitor fileUpdateMonitor,
- TaskExecutor taskExecutor,
- DialogService dialogService,
- JournalAbbreviationRepository abbreviationRepository,
- BibEntryTypesManager entryTypesManager,
- UndoManager undoManager,
- ClipBoardManager clipBoardManager) {
+ public MainMenu(
+ JabRefFrame frame,
+ SidePane sidePane,
+ PushToApplicationCommand pushToApplicationCommand,
+ PreferencesService preferencesService,
+ StateManager stateManager,
+ FileUpdateMonitor fileUpdateMonitor,
+ TaskExecutor taskExecutor,
+ DialogService dialogService,
+ JournalAbbreviationRepository abbreviationRepository,
+ BibEntryTypesManager entryTypesManager,
+ UndoManager undoManager,
+ ClipBoardManager clipBoardManager) {
this.frame = frame;
this.sidePane = sidePane;
this.pushToApplicationCommand = pushToApplicationCommand;
@@ -125,85 +117,254 @@ private void createMenu() {
Menu tools = new Menu(Localization.lang("Tools"));
Menu help = new Menu(Localization.lang("Help"));
- file.getItems().addAll(
- factory.createMenuItem(StandardActions.NEW_LIBRARY, new NewDatabaseAction(frame, preferencesService)),
- factory.createMenuItem(StandardActions.OPEN_LIBRARY, frame.getOpenDatabaseAction()),
- frame.getFileHistory(),
- factory.createMenuItem(StandardActions.SAVE_LIBRARY, new SaveAction(SaveAction.SaveMethod.SAVE, frame, dialogService, preferencesService, stateManager)),
- factory.createMenuItem(StandardActions.SAVE_LIBRARY_AS, new SaveAction(SaveAction.SaveMethod.SAVE_AS, frame, dialogService, preferencesService, stateManager)),
- factory.createMenuItem(StandardActions.SAVE_ALL, new SaveAllAction(frame, preferencesService)),
- factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new JabRefFrame.CloseDatabaseAction(frame)),
-
- new SeparatorMenuItem(),
-
- factory.createSubMenu(StandardActions.IMPORT,
- factory.createMenuItem(StandardActions.IMPORT_INTO_CURRENT_LIBRARY, new ImportCommand(frame, ImportCommand.ImportMethod.TO_EXISTING, preferencesService, stateManager, fileUpdateMonitor, taskExecutor, dialogService)),
- factory.createMenuItem(StandardActions.IMPORT_INTO_NEW_LIBRARY, new ImportCommand(frame, ImportCommand.ImportMethod.AS_NEW, preferencesService, stateManager, fileUpdateMonitor, taskExecutor, dialogService))),
-
- factory.createSubMenu(StandardActions.EXPORT,
- factory.createMenuItem(StandardActions.EXPORT_ALL, new ExportCommand(ExportCommand.ExportMethod.EXPORT_ALL, frame, stateManager, dialogService, preferencesService, entryTypesManager, abbreviationRepository, taskExecutor)),
- factory.createMenuItem(StandardActions.EXPORT_SELECTED, new ExportCommand(ExportCommand.ExportMethod.EXPORT_SELECTED, frame, stateManager, dialogService, preferencesService, entryTypesManager, abbreviationRepository, taskExecutor)),
- factory.createMenuItem(StandardActions.SAVE_SELECTED_AS_PLAIN_BIBTEX, new SaveAction(SaveAction.SaveMethod.SAVE_SELECTED, frame, dialogService, preferencesService, stateManager))),
-
- new SeparatorMenuItem(),
-
- factory.createSubMenu(StandardActions.REMOTE_DB,
- factory.createMenuItem(StandardActions.CONNECT_TO_SHARED_DB, new ConnectToSharedDatabaseCommand(frame)),
- factory.createMenuItem(StandardActions.PULL_CHANGES_FROM_SHARED_DB, new PullChangesFromSharedAction(stateManager))),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(frame, taskExecutor)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.QUIT, new JabRefFrame.CloseAction(frame))
- );
-
- edit.getItems().addAll(
- factory.createMenuItem(StandardActions.UNDO, new UndoRedoAction(StandardActions.UNDO, frame, dialogService, stateManager)),
- factory.createMenuItem(StandardActions.REDO, new UndoRedoAction(StandardActions.REDO, frame, dialogService, stateManager)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.CUT, new EditAction(StandardActions.CUT, frame, stateManager)),
-
- factory.createMenuItem(StandardActions.COPY, new EditAction(StandardActions.COPY, frame, stateManager)),
- factory.createSubMenu(StandardActions.COPY_MORE,
- factory.createMenuItem(StandardActions.COPY_TITLE, new CopyMoreAction(StandardActions.COPY_TITLE, dialogService, stateManager, clipBoardManager, preferencesService, abbreviationRepository)),
- factory.createMenuItem(StandardActions.COPY_KEY, new CopyMoreAction(StandardActions.COPY_KEY, dialogService, stateManager, clipBoardManager, preferencesService, abbreviationRepository)),
- factory.createMenuItem(StandardActions.COPY_CITE_KEY, new CopyMoreAction(StandardActions.COPY_CITE_KEY, dialogService, stateManager, clipBoardManager, preferencesService, abbreviationRepository)),
- factory.createMenuItem(StandardActions.COPY_KEY_AND_TITLE, new CopyMoreAction(StandardActions.COPY_KEY_AND_TITLE, dialogService, stateManager, clipBoardManager, preferencesService, abbreviationRepository)),
- factory.createMenuItem(StandardActions.COPY_KEY_AND_LINK, new CopyMoreAction(StandardActions.COPY_KEY_AND_LINK, dialogService, stateManager, clipBoardManager, preferencesService, abbreviationRepository)),
- factory.createMenuItem(StandardActions.COPY_CITATION_PREVIEW, new CopyCitationAction(CitationStyleOutputFormat.HTML, dialogService, stateManager, clipBoardManager, taskExecutor, preferencesService, abbreviationRepository)),
- factory.createMenuItem(StandardActions.EXPORT_SELECTED_TO_CLIPBOARD, new ExportToClipboardAction(dialogService, stateManager, clipBoardManager, taskExecutor, preferencesService))),
-
- factory.createMenuItem(StandardActions.PASTE, new EditAction(StandardActions.PASTE, frame, stateManager)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.REPLACE_ALL, new ReplaceStringAction(frame, stateManager)),
- factory.createMenuItem(StandardActions.GENERATE_CITE_KEYS, new GenerateCitationKeyAction(frame, dialogService, stateManager, taskExecutor, preferencesService)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.MANAGE_KEYWORDS, new ManageKeywordsAction(stateManager)),
- factory.createMenuItem(StandardActions.AUTOMATIC_FIELD_EDITOR, new AutomaticFieldEditorAction(stateManager, dialogService)));
+ file.getItems()
+ .addAll(
+ factory.createMenuItem(
+ StandardActions.NEW_LIBRARY, new NewDatabaseAction(frame, preferencesService)),
+ factory.createMenuItem(StandardActions.OPEN_LIBRARY, frame.getOpenDatabaseAction()),
+ frame.getFileHistory(),
+ factory.createMenuItem(
+ StandardActions.SAVE_LIBRARY,
+ new SaveAction(
+ SaveAction.SaveMethod.SAVE,
+ frame,
+ dialogService,
+ preferencesService,
+ stateManager)),
+ factory.createMenuItem(
+ StandardActions.SAVE_LIBRARY_AS,
+ new SaveAction(
+ SaveAction.SaveMethod.SAVE_AS,
+ frame,
+ dialogService,
+ preferencesService,
+ stateManager)),
+ factory.createMenuItem(StandardActions.SAVE_ALL, new SaveAllAction(frame, preferencesService)),
+ factory.createMenuItem(
+ StandardActions.CLOSE_LIBRARY, new JabRefFrame.CloseDatabaseAction(frame)),
+ new SeparatorMenuItem(),
+ factory.createSubMenu(
+ StandardActions.IMPORT,
+ factory.createMenuItem(
+ StandardActions.IMPORT_INTO_CURRENT_LIBRARY,
+ new ImportCommand(
+ frame,
+ ImportCommand.ImportMethod.TO_EXISTING,
+ preferencesService,
+ stateManager,
+ fileUpdateMonitor,
+ taskExecutor,
+ dialogService)),
+ factory.createMenuItem(
+ StandardActions.IMPORT_INTO_NEW_LIBRARY,
+ new ImportCommand(
+ frame,
+ ImportCommand.ImportMethod.AS_NEW,
+ preferencesService,
+ stateManager,
+ fileUpdateMonitor,
+ taskExecutor,
+ dialogService))),
+ factory.createSubMenu(
+ StandardActions.EXPORT,
+ factory.createMenuItem(
+ StandardActions.EXPORT_ALL,
+ new ExportCommand(
+ ExportCommand.ExportMethod.EXPORT_ALL,
+ frame,
+ stateManager,
+ dialogService,
+ preferencesService,
+ entryTypesManager,
+ abbreviationRepository,
+ taskExecutor)),
+ factory.createMenuItem(
+ StandardActions.EXPORT_SELECTED,
+ new ExportCommand(
+ ExportCommand.ExportMethod.EXPORT_SELECTED,
+ frame,
+ stateManager,
+ dialogService,
+ preferencesService,
+ entryTypesManager,
+ abbreviationRepository,
+ taskExecutor)),
+ factory.createMenuItem(
+ StandardActions.SAVE_SELECTED_AS_PLAIN_BIBTEX,
+ new SaveAction(
+ SaveAction.SaveMethod.SAVE_SELECTED,
+ frame,
+ dialogService,
+ preferencesService,
+ stateManager))),
+ new SeparatorMenuItem(),
+ factory.createSubMenu(
+ StandardActions.REMOTE_DB,
+ factory.createMenuItem(
+ StandardActions.CONNECT_TO_SHARED_DB,
+ new ConnectToSharedDatabaseCommand(frame)),
+ factory.createMenuItem(
+ StandardActions.PULL_CHANGES_FROM_SHARED_DB,
+ new PullChangesFromSharedAction(stateManager))),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.SHOW_PREFS, new ShowPreferencesAction(frame, taskExecutor)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(StandardActions.QUIT, new JabRefFrame.CloseAction(frame)));
+
+ edit.getItems()
+ .addAll(
+ factory.createMenuItem(
+ StandardActions.UNDO,
+ new UndoRedoAction(StandardActions.UNDO, frame, dialogService, stateManager)),
+ factory.createMenuItem(
+ StandardActions.REDO,
+ new UndoRedoAction(StandardActions.REDO, frame, dialogService, stateManager)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.CUT, new EditAction(StandardActions.CUT, frame, stateManager)),
+ factory.createMenuItem(
+ StandardActions.COPY, new EditAction(StandardActions.COPY, frame, stateManager)),
+ factory.createSubMenu(
+ StandardActions.COPY_MORE,
+ factory.createMenuItem(
+ StandardActions.COPY_TITLE,
+ new CopyMoreAction(
+ StandardActions.COPY_TITLE,
+ dialogService,
+ stateManager,
+ clipBoardManager,
+ preferencesService,
+ abbreviationRepository)),
+ factory.createMenuItem(
+ StandardActions.COPY_KEY,
+ new CopyMoreAction(
+ StandardActions.COPY_KEY,
+ dialogService,
+ stateManager,
+ clipBoardManager,
+ preferencesService,
+ abbreviationRepository)),
+ factory.createMenuItem(
+ StandardActions.COPY_CITE_KEY,
+ new CopyMoreAction(
+ StandardActions.COPY_CITE_KEY,
+ dialogService,
+ stateManager,
+ clipBoardManager,
+ preferencesService,
+ abbreviationRepository)),
+ factory.createMenuItem(
+ StandardActions.COPY_KEY_AND_TITLE,
+ new CopyMoreAction(
+ StandardActions.COPY_KEY_AND_TITLE,
+ dialogService,
+ stateManager,
+ clipBoardManager,
+ preferencesService,
+ abbreviationRepository)),
+ factory.createMenuItem(
+ StandardActions.COPY_KEY_AND_LINK,
+ new CopyMoreAction(
+ StandardActions.COPY_KEY_AND_LINK,
+ dialogService,
+ stateManager,
+ clipBoardManager,
+ preferencesService,
+ abbreviationRepository)),
+ factory.createMenuItem(
+ StandardActions.COPY_CITATION_PREVIEW,
+ new CopyCitationAction(
+ CitationStyleOutputFormat.HTML,
+ dialogService,
+ stateManager,
+ clipBoardManager,
+ taskExecutor,
+ preferencesService,
+ abbreviationRepository)),
+ factory.createMenuItem(
+ StandardActions.EXPORT_SELECTED_TO_CLIPBOARD,
+ new ExportToClipboardAction(
+ dialogService,
+ stateManager,
+ clipBoardManager,
+ taskExecutor,
+ preferencesService))),
+ factory.createMenuItem(
+ StandardActions.PASTE, new EditAction(StandardActions.PASTE, frame, stateManager)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.REPLACE_ALL, new ReplaceStringAction(frame, stateManager)),
+ factory.createMenuItem(
+ StandardActions.GENERATE_CITE_KEYS,
+ new GenerateCitationKeyAction(
+ frame, dialogService, stateManager, taskExecutor, preferencesService)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(StandardActions.MANAGE_KEYWORDS, new ManageKeywordsAction(stateManager)),
+ factory.createMenuItem(
+ StandardActions.AUTOMATIC_FIELD_EDITOR,
+ new AutomaticFieldEditorAction(stateManager, dialogService)));
SeparatorMenuItem specialFieldsSeparator = new SeparatorMenuItem();
- specialFieldsSeparator.visibleProperty().bind(preferencesService.getSpecialFieldsPreferences().specialFieldsEnabledProperty());
-
- edit.getItems().addAll(
- specialFieldsSeparator,
- // ToDo: SpecialField needs the active BasePanel to mark it as changed.
- // Refactor BasePanel, should mark the BibDatabaseContext or the UndoManager as dirty instead!
- SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.RANKING, factory, frame, dialogService, preferencesService, undoManager, stateManager),
- SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.RELEVANCE, factory, frame, dialogService, preferencesService, undoManager, stateManager),
- SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.QUALITY, factory, frame, dialogService, preferencesService, undoManager, stateManager),
- SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.PRINTED, factory, frame, dialogService, preferencesService, undoManager, stateManager),
- SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.PRIORITY, factory, frame, dialogService, preferencesService, undoManager, stateManager),
- SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.READ_STATUS, factory, frame, dialogService, preferencesService, undoManager, stateManager));
+ specialFieldsSeparator
+ .visibleProperty()
+ .bind(preferencesService.getSpecialFieldsPreferences().specialFieldsEnabledProperty());
+
+ edit.getItems()
+ .addAll(
+ specialFieldsSeparator,
+ // ToDo: SpecialField needs the active BasePanel to mark it as changed.
+ // Refactor BasePanel, should mark the BibDatabaseContext or the UndoManager as dirty instead!
+ SpecialFieldMenuItemFactory.createSpecialFieldMenu(
+ SpecialField.RANKING,
+ factory,
+ frame,
+ dialogService,
+ preferencesService,
+ undoManager,
+ stateManager),
+ SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(
+ SpecialField.RELEVANCE,
+ factory,
+ frame,
+ dialogService,
+ preferencesService,
+ undoManager,
+ stateManager),
+ SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(
+ SpecialField.QUALITY,
+ factory,
+ frame,
+ dialogService,
+ preferencesService,
+ undoManager,
+ stateManager),
+ SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(
+ SpecialField.PRINTED,
+ factory,
+ frame,
+ dialogService,
+ preferencesService,
+ undoManager,
+ stateManager),
+ SpecialFieldMenuItemFactory.createSpecialFieldMenu(
+ SpecialField.PRIORITY,
+ factory,
+ frame,
+ dialogService,
+ preferencesService,
+ undoManager,
+ stateManager),
+ SpecialFieldMenuItemFactory.createSpecialFieldMenu(
+ SpecialField.READ_STATUS,
+ factory,
+ frame,
+ dialogService,
+ preferencesService,
+ undoManager,
+ stateManager));
edit.addEventHandler(ActionEvent.ACTION, event -> {
- // Work around for mac only issue, where cmd+v on a dialogue triggers the paste action of menu item, resulting in addition of the pasted content in the MainTable.
+ // Work around for mac only issue, where cmd+v on a dialogue triggers the paste action of menu item,
+ // resulting in addition of the pasted content in the MainTable.
// If the mainscreen is not focused, the actions captured by menu are consumed.
if (OS.OS_X && !frame.getMainStage().focusedProperty().get()) {
event.consume();
@@ -211,150 +372,304 @@ private void createMenu() {
});
// @formatter:off
- library.getItems().addAll(
- factory.createMenuItem(StandardActions.NEW_ENTRY, new NewEntryAction(frame, dialogService, preferencesService, stateManager)),
- factory.createMenuItem(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new ExtractBibtexAction(dialogService, preferencesService, stateManager)),
- factory.createMenuItem(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, frame, stateManager)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(stateManager))
- );
-
- quality.getItems().addAll(
- factory.createMenuItem(StandardActions.FIND_DUPLICATES, new DuplicateSearch(frame, dialogService, stateManager, preferencesService, entryTypesManager, taskExecutor)),
- factory.createMenuItem(StandardActions.MERGE_ENTRIES, new MergeEntriesAction(dialogService, stateManager, preferencesService)),
- factory.createMenuItem(StandardActions.CHECK_INTEGRITY, new IntegrityCheckAction(frame, preferencesService, dialogService, stateManager, taskExecutor, abbreviationRepository)),
- factory.createMenuItem(StandardActions.CLEANUP_ENTRIES, new CleanupAction(frame, preferencesService, dialogService, stateManager, taskExecutor)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.SET_FILE_LINKS, new AutoLinkFilesAction(dialogService, preferencesService, stateManager, undoManager, taskExecutor)),
-
- new SeparatorMenuItem(),
-
- factory.createSubMenu(StandardActions.ABBREVIATE,
- factory.createMenuItem(StandardActions.ABBREVIATE_DEFAULT, new AbbreviateAction(StandardActions.ABBREVIATE_DEFAULT, frame, dialogService, stateManager, preferencesService.getJournalAbbreviationPreferences(), abbreviationRepository, taskExecutor)),
- factory.createMenuItem(StandardActions.ABBREVIATE_DOTLESS, new AbbreviateAction(StandardActions.ABBREVIATE_DOTLESS, frame, dialogService, stateManager, preferencesService.getJournalAbbreviationPreferences(), abbreviationRepository, taskExecutor)),
- factory.createMenuItem(StandardActions.ABBREVIATE_SHORTEST_UNIQUE, new AbbreviateAction(StandardActions.ABBREVIATE_SHORTEST_UNIQUE, frame, dialogService, stateManager, preferencesService.getJournalAbbreviationPreferences(), abbreviationRepository, taskExecutor))),
-
- factory.createMenuItem(StandardActions.UNABBREVIATE, new AbbreviateAction(StandardActions.UNABBREVIATE, frame, dialogService, stateManager, preferencesService.getJournalAbbreviationPreferences(), abbreviationRepository, taskExecutor))
- );
+ library.getItems()
+ .addAll(
+ factory.createMenuItem(
+ StandardActions.NEW_ENTRY,
+ new NewEntryAction(frame, dialogService, preferencesService, stateManager)),
+ factory.createMenuItem(
+ StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT,
+ new ExtractBibtexAction(dialogService, preferencesService, stateManager)),
+ factory.createMenuItem(
+ StandardActions.DELETE_ENTRY,
+ new EditAction(StandardActions.DELETE_ENTRY, frame, stateManager)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(stateManager)));
+
+ quality.getItems()
+ .addAll(
+ factory.createMenuItem(
+ StandardActions.FIND_DUPLICATES,
+ new DuplicateSearch(
+ frame,
+ dialogService,
+ stateManager,
+ preferencesService,
+ entryTypesManager,
+ taskExecutor)),
+ factory.createMenuItem(
+ StandardActions.MERGE_ENTRIES,
+ new MergeEntriesAction(dialogService, stateManager, preferencesService)),
+ factory.createMenuItem(
+ StandardActions.CHECK_INTEGRITY,
+ new IntegrityCheckAction(
+ frame,
+ preferencesService,
+ dialogService,
+ stateManager,
+ taskExecutor,
+ abbreviationRepository)),
+ factory.createMenuItem(
+ StandardActions.CLEANUP_ENTRIES,
+ new CleanupAction(
+ frame, preferencesService, dialogService, stateManager, taskExecutor)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.SET_FILE_LINKS,
+ new AutoLinkFilesAction(
+ dialogService, preferencesService, stateManager, undoManager, taskExecutor)),
+ new SeparatorMenuItem(),
+ factory.createSubMenu(
+ StandardActions.ABBREVIATE,
+ factory.createMenuItem(
+ StandardActions.ABBREVIATE_DEFAULT,
+ new AbbreviateAction(
+ StandardActions.ABBREVIATE_DEFAULT,
+ frame,
+ dialogService,
+ stateManager,
+ preferencesService.getJournalAbbreviationPreferences(),
+ abbreviationRepository,
+ taskExecutor)),
+ factory.createMenuItem(
+ StandardActions.ABBREVIATE_DOTLESS,
+ new AbbreviateAction(
+ StandardActions.ABBREVIATE_DOTLESS,
+ frame,
+ dialogService,
+ stateManager,
+ preferencesService.getJournalAbbreviationPreferences(),
+ abbreviationRepository,
+ taskExecutor)),
+ factory.createMenuItem(
+ StandardActions.ABBREVIATE_SHORTEST_UNIQUE,
+ new AbbreviateAction(
+ StandardActions.ABBREVIATE_SHORTEST_UNIQUE,
+ frame,
+ dialogService,
+ stateManager,
+ preferencesService.getJournalAbbreviationPreferences(),
+ abbreviationRepository,
+ taskExecutor))),
+ factory.createMenuItem(
+ StandardActions.UNABBREVIATE,
+ new AbbreviateAction(
+ StandardActions.UNABBREVIATE,
+ frame,
+ dialogService,
+ stateManager,
+ preferencesService.getJournalAbbreviationPreferences(),
+ abbreviationRepository,
+ taskExecutor)));
Menu lookupIdentifiers = factory.createSubMenu(StandardActions.LOOKUP_DOC_IDENTIFIER);
for (IdFetcher> fetcher : WebFetchers.getIdFetchers(preferencesService.getImportFormatPreferences())) {
- LookupIdentifierAction> identifierAction = new LookupIdentifierAction<>(frame, fetcher, stateManager, undoManager, taskExecutor);
+ LookupIdentifierAction> identifierAction =
+ new LookupIdentifierAction<>(frame, fetcher, stateManager, undoManager, taskExecutor);
lookupIdentifiers.getItems().add(factory.createMenuItem(identifierAction.getAction(), identifierAction));
}
- lookup.getItems().addAll(
- lookupIdentifiers,
- factory.createMenuItem(StandardActions.DOWNLOAD_FULL_TEXT, new DownloadFullTextAction(dialogService, stateManager, preferencesService, taskExecutor)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.FIND_UNLINKED_FILES, new FindUnlinkedFilesAction(dialogService, stateManager))
- );
+ lookup.getItems()
+ .addAll(
+ lookupIdentifiers,
+ factory.createMenuItem(
+ StandardActions.DOWNLOAD_FULL_TEXT,
+ new DownloadFullTextAction(
+ dialogService, stateManager, preferencesService, taskExecutor)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.FIND_UNLINKED_FILES,
+ new FindUnlinkedFilesAction(dialogService, stateManager)));
- final MenuItem pushToApplicationMenuItem = factory.createMenuItem(pushToApplicationCommand.getAction(), pushToApplicationCommand);
+ final MenuItem pushToApplicationMenuItem =
+ factory.createMenuItem(pushToApplicationCommand.getAction(), pushToApplicationCommand);
pushToApplicationCommand.registerReconfigurable(pushToApplicationMenuItem);
- tools.getItems().addAll(
- factory.createMenuItem(StandardActions.PARSE_LATEX, new ParseLatexAction(stateManager)),
- factory.createMenuItem(StandardActions.NEW_SUB_LIBRARY_FROM_AUX, new NewSubLibraryAction(frame, stateManager)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.WRITE_METADATA_TO_PDF,
- new WriteMetadataToLinkedPdfsAction(dialogService, preferencesService.getFieldPreferences(), preferencesService.getFilePreferences(), preferencesService.getXmpPreferences(), entryTypesManager, abbreviationRepository, taskExecutor, stateManager)),
- factory.createMenuItem(StandardActions.COPY_LINKED_FILES, new CopyFilesAction(dialogService, preferencesService, stateManager, taskExecutor)),
-
- new SeparatorMenuItem(),
-
- createSendSubMenu(factory, dialogService, stateManager, preferencesService),
- pushToApplicationMenuItem,
-
- new SeparatorMenuItem(),
-
- // Systematic Literature Review (SLR)
- factory.createMenuItem(StandardActions.START_NEW_STUDY, new StartNewStudyAction(frame, fileUpdateMonitor, taskExecutor, preferencesService, stateManager)),
- factory.createMenuItem(StandardActions.EDIT_EXISTING_STUDY, new EditExistingStudyAction(dialogService, stateManager)),
- factory.createMenuItem(StandardActions.UPDATE_SEARCH_RESULTS_OF_STUDY, new ExistingStudySearchAction(frame, frame.getOpenDatabaseAction(), dialogService, fileUpdateMonitor, taskExecutor, preferencesService, stateManager)),
-
- new SeparatorMenuItem(),
+ tools.getItems()
+ .addAll(
+ factory.createMenuItem(StandardActions.PARSE_LATEX, new ParseLatexAction(stateManager)),
+ factory.createMenuItem(
+ StandardActions.NEW_SUB_LIBRARY_FROM_AUX, new NewSubLibraryAction(frame, stateManager)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.WRITE_METADATA_TO_PDF,
+ new WriteMetadataToLinkedPdfsAction(
+ dialogService,
+ preferencesService.getFieldPreferences(),
+ preferencesService.getFilePreferences(),
+ preferencesService.getXmpPreferences(),
+ entryTypesManager,
+ abbreviationRepository,
+ taskExecutor,
+ stateManager)),
+ factory.createMenuItem(
+ StandardActions.COPY_LINKED_FILES,
+ new CopyFilesAction(dialogService, preferencesService, stateManager, taskExecutor)),
+ new SeparatorMenuItem(),
+ createSendSubMenu(factory, dialogService, stateManager, preferencesService),
+ pushToApplicationMenuItem,
+ new SeparatorMenuItem(),
- factory.createMenuItem(StandardActions.REBUILD_FULLTEXT_SEARCH_INDEX, new RebuildFulltextSearchIndexAction(stateManager, frame::getCurrentLibraryTab, dialogService, preferencesService.getFilePreferences(), taskExecutor))
- );
+ // Systematic Literature Review (SLR)
+ factory.createMenuItem(
+ StandardActions.START_NEW_STUDY,
+ new StartNewStudyAction(
+ frame, fileUpdateMonitor, taskExecutor, preferencesService, stateManager)),
+ factory.createMenuItem(
+ StandardActions.EDIT_EXISTING_STUDY,
+ new EditExistingStudyAction(dialogService, stateManager)),
+ factory.createMenuItem(
+ StandardActions.UPDATE_SEARCH_RESULTS_OF_STUDY,
+ new ExistingStudySearchAction(
+ frame,
+ frame.getOpenDatabaseAction(),
+ dialogService,
+ fileUpdateMonitor,
+ taskExecutor,
+ preferencesService,
+ stateManager)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.REBUILD_FULLTEXT_SEARCH_INDEX,
+ new RebuildFulltextSearchIndexAction(
+ stateManager,
+ frame::getCurrentLibraryTab,
+ dialogService,
+ preferencesService.getFilePreferences(),
+ taskExecutor)));
SidePaneType webSearchPane = SidePaneType.WEB_SEARCH;
SidePaneType groupsPane = SidePaneType.GROUPS;
SidePaneType openOfficePane = SidePaneType.OPEN_OFFICE;
- view.getItems().addAll(
- factory.createCheckMenuItem(webSearchPane.getToggleAction(), sidePane.getToggleCommandFor(webSearchPane), sidePane.paneVisibleBinding(webSearchPane)),
- factory.createCheckMenuItem(groupsPane.getToggleAction(), sidePane.getToggleCommandFor(groupsPane), sidePane.paneVisibleBinding(groupsPane)),
- factory.createCheckMenuItem(openOfficePane.getToggleAction(), sidePane.getToggleCommandFor(openOfficePane), sidePane.paneVisibleBinding(openOfficePane)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.NEXT_PREVIEW_STYLE, new PreviewSwitchAction(PreviewSwitchAction.Direction.NEXT, frame, stateManager)),
- factory.createMenuItem(StandardActions.PREVIOUS_PREVIEW_STYLE, new PreviewSwitchAction(PreviewSwitchAction.Direction.PREVIOUS, frame, stateManager)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.SHOW_PDF_VIEWER, new ShowDocumentViewerAction(stateManager, preferencesService)),
- factory.createMenuItem(StandardActions.EDIT_ENTRY, new OpenEntryEditorAction(frame, stateManager)),
- factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(stateManager, preferencesService, dialogService))
- );
-
- help.getItems().addAll(
- factory.createMenuItem(StandardActions.HELP, new HelpAction(HelpFile.CONTENTS, dialogService, preferencesService.getFilePreferences())),
- factory.createMenuItem(StandardActions.OPEN_FORUM, new OpenBrowserAction("http://discourse.jabref.org/", dialogService, preferencesService.getFilePreferences())),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.ERROR_CONSOLE, new ErrorConsoleAction()),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.DONATE, new OpenBrowserAction("https://donations.jabref.org", dialogService, preferencesService.getFilePreferences())),
- factory.createMenuItem(StandardActions.SEARCH_FOR_UPDATES, new SearchForUpdateAction(Globals.BUILD_INFO, preferencesService, dialogService, taskExecutor)),
- factory.createSubMenu(StandardActions.WEB_MENU,
- factory.createMenuItem(StandardActions.OPEN_WEBPAGE, new OpenBrowserAction("https://jabref.org/", dialogService, preferencesService.getFilePreferences())),
- factory.createMenuItem(StandardActions.OPEN_BLOG, new OpenBrowserAction("https://blog.jabref.org/", dialogService, preferencesService.getFilePreferences())),
- factory.createMenuItem(StandardActions.OPEN_FACEBOOK, new OpenBrowserAction("https://www.facebook.com/JabRef/", dialogService, preferencesService.getFilePreferences())),
- factory.createMenuItem(StandardActions.OPEN_TWITTER, new OpenBrowserAction("https://twitter.com/jabref_org", dialogService, preferencesService.getFilePreferences())),
- factory.createMenuItem(StandardActions.OPEN_GITHUB, new OpenBrowserAction("https://github.com/JabRef/jabref", dialogService, preferencesService.getFilePreferences())),
-
+ view.getItems()
+ .addAll(
+ factory.createCheckMenuItem(
+ webSearchPane.getToggleAction(),
+ sidePane.getToggleCommandFor(webSearchPane),
+ sidePane.paneVisibleBinding(webSearchPane)),
+ factory.createCheckMenuItem(
+ groupsPane.getToggleAction(),
+ sidePane.getToggleCommandFor(groupsPane),
+ sidePane.paneVisibleBinding(groupsPane)),
+ factory.createCheckMenuItem(
+ openOfficePane.getToggleAction(),
+ sidePane.getToggleCommandFor(openOfficePane),
+ sidePane.paneVisibleBinding(openOfficePane)),
new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.OPEN_DEV_VERSION_LINK, new OpenBrowserAction("https://builds.jabref.org/master/", dialogService, preferencesService.getFilePreferences())),
- factory.createMenuItem(StandardActions.OPEN_CHANGELOG, new OpenBrowserAction("https://github.com/JabRef/jabref/blob/main/CHANGELOG.md", dialogService, preferencesService.getFilePreferences()))
- ),
- factory.createMenuItem(StandardActions.ABOUT, new AboutAction())
- );
+ factory.createMenuItem(
+ StandardActions.NEXT_PREVIEW_STYLE,
+ new PreviewSwitchAction(PreviewSwitchAction.Direction.NEXT, frame, stateManager)),
+ factory.createMenuItem(
+ StandardActions.PREVIOUS_PREVIEW_STYLE,
+ new PreviewSwitchAction(PreviewSwitchAction.Direction.PREVIOUS, frame, stateManager)),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.SHOW_PDF_VIEWER,
+ new ShowDocumentViewerAction(stateManager, preferencesService)),
+ factory.createMenuItem(
+ StandardActions.EDIT_ENTRY, new OpenEntryEditorAction(frame, stateManager)),
+ factory.createMenuItem(
+ StandardActions.OPEN_CONSOLE,
+ new OpenConsoleAction(stateManager, preferencesService, dialogService)));
+
+ help.getItems()
+ .addAll(
+ factory.createMenuItem(
+ StandardActions.HELP,
+ new HelpAction(
+ HelpFile.CONTENTS, dialogService, preferencesService.getFilePreferences())),
+ factory.createMenuItem(
+ StandardActions.OPEN_FORUM,
+ new OpenBrowserAction(
+ "http://discourse.jabref.org/",
+ dialogService,
+ preferencesService.getFilePreferences())),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(StandardActions.ERROR_CONSOLE, new ErrorConsoleAction()),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.DONATE,
+ new OpenBrowserAction(
+ "https://donations.jabref.org",
+ dialogService,
+ preferencesService.getFilePreferences())),
+ factory.createMenuItem(
+ StandardActions.SEARCH_FOR_UPDATES,
+ new SearchForUpdateAction(
+ Globals.BUILD_INFO, preferencesService, dialogService, taskExecutor)),
+ factory.createSubMenu(
+ StandardActions.WEB_MENU,
+ factory.createMenuItem(
+ StandardActions.OPEN_WEBPAGE,
+ new OpenBrowserAction(
+ "https://jabref.org/",
+ dialogService,
+ preferencesService.getFilePreferences())),
+ factory.createMenuItem(
+ StandardActions.OPEN_BLOG,
+ new OpenBrowserAction(
+ "https://blog.jabref.org/",
+ dialogService,
+ preferencesService.getFilePreferences())),
+ factory.createMenuItem(
+ StandardActions.OPEN_FACEBOOK,
+ new OpenBrowserAction(
+ "https://www.facebook.com/JabRef/",
+ dialogService,
+ preferencesService.getFilePreferences())),
+ factory.createMenuItem(
+ StandardActions.OPEN_TWITTER,
+ new OpenBrowserAction(
+ "https://twitter.com/jabref_org",
+ dialogService,
+ preferencesService.getFilePreferences())),
+ factory.createMenuItem(
+ StandardActions.OPEN_GITHUB,
+ new OpenBrowserAction(
+ "https://github.com/JabRef/jabref",
+ dialogService,
+ preferencesService.getFilePreferences())),
+ new SeparatorMenuItem(),
+ factory.createMenuItem(
+ StandardActions.OPEN_DEV_VERSION_LINK,
+ new OpenBrowserAction(
+ "https://builds.jabref.org/master/",
+ dialogService,
+ preferencesService.getFilePreferences())),
+ factory.createMenuItem(
+ StandardActions.OPEN_CHANGELOG,
+ new OpenBrowserAction(
+ "https://github.com/JabRef/jabref/blob/main/CHANGELOG.md",
+ dialogService,
+ preferencesService.getFilePreferences()))),
+ factory.createMenuItem(StandardActions.ABOUT, new AboutAction()));
// @formatter:on
getStyleClass().add("mainMenu");
- getMenus().addAll(
- file,
- edit,
- library,
- quality,
- lookup,
- tools,
- view,
- help);
+ getMenus().addAll(file, edit, library, quality, lookup, tools, view, help);
setUseSystemMenuBar(true);
}
- private Menu createSendSubMenu(ActionFactory factory,
- DialogService dialogService,
- StateManager stateManager,
- PreferencesService preferencesService) {
+ private Menu createSendSubMenu(
+ ActionFactory factory,
+ DialogService dialogService,
+ StateManager stateManager,
+ PreferencesService preferencesService) {
Menu sendMenu = factory.createMenu(StandardActions.SEND);
- sendMenu.getItems().addAll(
- factory.createMenuItem(StandardActions.SEND_AS_EMAIL, new SendAsStandardEmailAction(dialogService, preferencesService, stateManager, entryTypesManager, taskExecutor)),
- factory.createMenuItem(StandardActions.SEND_TO_KINDLE, new SendAsKindleEmailAction(dialogService, preferencesService, stateManager, taskExecutor))
- );
+ sendMenu.getItems()
+ .addAll(
+ factory.createMenuItem(
+ StandardActions.SEND_AS_EMAIL,
+ new SendAsStandardEmailAction(
+ dialogService,
+ preferencesService,
+ stateManager,
+ entryTypesManager,
+ taskExecutor)),
+ factory.createMenuItem(
+ StandardActions.SEND_TO_KINDLE,
+ new SendAsKindleEmailAction(
+ dialogService, preferencesService, stateManager, taskExecutor)));
return sendMenu;
}
diff --git a/src/main/java/org/jabref/gui/MainToolBar.java b/src/main/java/org/jabref/gui/MainToolBar.java
index 1e89db1b724..1eaa5198736 100644
--- a/src/main/java/org/jabref/gui/MainToolBar.java
+++ b/src/main/java/org/jabref/gui/MainToolBar.java
@@ -1,18 +1,16 @@
package org.jabref.gui;
+import com.tobiasdiez.easybind.EasyBind;
import javafx.concurrent.Task;
import javafx.geometry.Orientation;
import javafx.scene.Group;
-import javafx.scene.control.Button;
-import javafx.scene.control.ProgressIndicator;
-import javafx.scene.control.Separator;
-import javafx.scene.control.ToolBar;
-import javafx.scene.control.Tooltip;
+import javafx.scene.control.*;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.shape.Rectangle;
-
+import org.controlsfx.control.PopOver;
+import org.controlsfx.control.TaskProgressView;
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.ActionHelper;
import org.jabref.gui.actions.StandardActions;
@@ -39,10 +37,6 @@
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;
-import com.tobiasdiez.easybind.EasyBind;
-import org.controlsfx.control.PopOver;
-import org.controlsfx.control.TaskProgressView;
-
public class MainToolBar extends ToolBar {
private final JabRefFrame frame;
private final PushToApplicationCommand pushToApplicationCommand;
@@ -58,16 +52,17 @@ public class MainToolBar extends ToolBar {
private PopOver entryFromIdPopOver;
private PopOver progressViewPopOver;
- public MainToolBar(JabRefFrame frame,
- PushToApplicationCommand pushToApplicationCommand,
- GlobalSearchBar globalSearchBar,
- DialogService dialogService,
- StateManager stateManager,
- PreferencesService preferencesService,
- FileUpdateMonitor fileUpdateMonitor,
- TaskExecutor taskExecutor,
- BibEntryTypesManager entryTypesManager,
- CountingUndoManager undoManager) {
+ public MainToolBar(
+ JabRefFrame frame,
+ PushToApplicationCommand pushToApplicationCommand,
+ GlobalSearchBar globalSearchBar,
+ DialogService dialogService,
+ StateManager stateManager,
+ PreferencesService preferencesService,
+ FileUpdateMonitor fileUpdateMonitor,
+ TaskExecutor taskExecutor,
+ BibEntryTypesManager entryTypesManager,
+ CountingUndoManager undoManager) {
this.frame = frame;
this.pushToApplicationCommand = pushToApplicationCommand;
this.globalSearchBar = globalSearchBar;
@@ -88,55 +83,94 @@ private void createToolBar() {
final Region leftSpacer = new Region();
final Region rightSpacer = new Region();
- final Button pushToApplicationButton = factory.createIconButton(pushToApplicationCommand.getAction(), pushToApplicationCommand);
+ final Button pushToApplicationButton =
+ factory.createIconButton(pushToApplicationCommand.getAction(), pushToApplicationCommand);
pushToApplicationCommand.registerReconfigurable(pushToApplicationButton);
// Setup Toolbar
- getItems().addAll(
- new HBox(
- factory.createIconButton(StandardActions.NEW_LIBRARY, new NewDatabaseAction(frame, preferencesService)),
- factory.createIconButton(StandardActions.OPEN_LIBRARY, new OpenDatabaseAction(frame, preferencesService, dialogService, stateManager, fileUpdateMonitor, entryTypesManager, undoManager, taskExecutor)),
- factory.createIconButton(StandardActions.SAVE_LIBRARY, new SaveAction(SaveAction.SaveMethod.SAVE, frame, dialogService, preferencesService, stateManager))),
-
- leftSpacer,
-
- globalSearchBar,
-
- rightSpacer,
-
- new HBox(
- factory.createIconButton(StandardActions.NEW_ARTICLE, new NewEntryAction(frame, StandardEntryType.Article, dialogService, preferencesService, stateManager)),
- factory.createIconButton(StandardActions.NEW_ENTRY, new NewEntryAction(frame, dialogService, preferencesService, stateManager)),
- createNewEntryFromIdButton(),
- factory.createIconButton(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new ExtractBibtexAction(dialogService, preferencesService, stateManager)),
- factory.createIconButton(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, frame, stateManager))),
-
- new Separator(Orientation.VERTICAL),
-
- new HBox(
- factory.createIconButton(StandardActions.UNDO, new UndoRedoAction(StandardActions.UNDO, frame, dialogService, stateManager)),
- factory.createIconButton(StandardActions.REDO, new UndoRedoAction(StandardActions.REDO, frame, dialogService, stateManager)),
- factory.createIconButton(StandardActions.CUT, new EditAction(StandardActions.CUT, frame, stateManager)),
- factory.createIconButton(StandardActions.COPY, new EditAction(StandardActions.COPY, frame, stateManager)),
- factory.createIconButton(StandardActions.PASTE, new EditAction(StandardActions.PASTE, frame, stateManager))),
-
- new Separator(Orientation.VERTICAL),
-
- new HBox(
- pushToApplicationButton,
- factory.createIconButton(StandardActions.GENERATE_CITE_KEYS, new GenerateCitationKeyAction(frame, dialogService, stateManager, taskExecutor, preferencesService)),
- factory.createIconButton(StandardActions.CLEANUP_ENTRIES, new CleanupAction(frame, preferencesService, dialogService, stateManager, taskExecutor))),
-
- new Separator(Orientation.VERTICAL),
-
- new HBox(
- createTaskIndicator()),
-
- new Separator(Orientation.VERTICAL),
-
- new HBox(
- factory.createIconButton(StandardActions.OPEN_GITHUB, new OpenBrowserAction("https://github.com/JabRef/jabref", dialogService, preferencesService.getFilePreferences()))));
+ getItems()
+ .addAll(
+ new HBox(
+ factory.createIconButton(
+ StandardActions.NEW_LIBRARY, new NewDatabaseAction(frame, preferencesService)),
+ factory.createIconButton(
+ StandardActions.OPEN_LIBRARY,
+ new OpenDatabaseAction(
+ frame,
+ preferencesService,
+ dialogService,
+ stateManager,
+ fileUpdateMonitor,
+ entryTypesManager,
+ undoManager,
+ taskExecutor)),
+ factory.createIconButton(
+ StandardActions.SAVE_LIBRARY,
+ new SaveAction(
+ SaveAction.SaveMethod.SAVE,
+ frame,
+ dialogService,
+ preferencesService,
+ stateManager))),
+ leftSpacer,
+ globalSearchBar,
+ rightSpacer,
+ new HBox(
+ factory.createIconButton(
+ StandardActions.NEW_ARTICLE,
+ new NewEntryAction(
+ frame,
+ StandardEntryType.Article,
+ dialogService,
+ preferencesService,
+ stateManager)),
+ factory.createIconButton(
+ StandardActions.NEW_ENTRY,
+ new NewEntryAction(frame, dialogService, preferencesService, stateManager)),
+ createNewEntryFromIdButton(),
+ factory.createIconButton(
+ StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT,
+ new ExtractBibtexAction(dialogService, preferencesService, stateManager)),
+ factory.createIconButton(
+ StandardActions.DELETE_ENTRY,
+ new EditAction(StandardActions.DELETE_ENTRY, frame, stateManager))),
+ new Separator(Orientation.VERTICAL),
+ new HBox(
+ factory.createIconButton(
+ StandardActions.UNDO,
+ new UndoRedoAction(StandardActions.UNDO, frame, dialogService, stateManager)),
+ factory.createIconButton(
+ StandardActions.REDO,
+ new UndoRedoAction(StandardActions.REDO, frame, dialogService, stateManager)),
+ factory.createIconButton(
+ StandardActions.CUT, new EditAction(StandardActions.CUT, frame, stateManager)),
+ factory.createIconButton(
+ StandardActions.COPY,
+ new EditAction(StandardActions.COPY, frame, stateManager)),
+ factory.createIconButton(
+ StandardActions.PASTE,
+ new EditAction(StandardActions.PASTE, frame, stateManager))),
+ new Separator(Orientation.VERTICAL),
+ new HBox(
+ pushToApplicationButton,
+ factory.createIconButton(
+ StandardActions.GENERATE_CITE_KEYS,
+ new GenerateCitationKeyAction(
+ frame, dialogService, stateManager, taskExecutor, preferencesService)),
+ factory.createIconButton(
+ StandardActions.CLEANUP_ENTRIES,
+ new CleanupAction(
+ frame, preferencesService, dialogService, stateManager, taskExecutor))),
+ new Separator(Orientation.VERTICAL),
+ new HBox(createTaskIndicator()),
+ new Separator(Orientation.VERTICAL),
+ new HBox(factory.createIconButton(
+ StandardActions.OPEN_GITHUB,
+ new OpenBrowserAction(
+ "https://github.com/JabRef/jabref",
+ dialogService,
+ preferencesService.getFilePreferences()))));
leftSpacer.setPrefWidth(50);
leftSpacer.setMinWidth(Region.USE_PREF_SIZE);
@@ -153,9 +187,12 @@ Button createNewEntryFromIdButton() {
newEntryFromIdButton.setGraphic(IconTheme.JabRefIcons.IMPORT.getGraphicNode());
newEntryFromIdButton.getStyleClass().setAll("icon-button");
newEntryFromIdButton.setFocusTraversable(false);
- newEntryFromIdButton.disableProperty().bind(ActionHelper.needsDatabase(stateManager).not());
+ newEntryFromIdButton
+ .disableProperty()
+ .bind(ActionHelper.needsDatabase(stateManager).not());
newEntryFromIdButton.setOnMouseClicked(event -> {
- GenerateEntryFromIdDialog entryFromId = new GenerateEntryFromIdDialog(frame.getCurrentLibraryTab(), dialogService, preferencesService, taskExecutor, stateManager);
+ GenerateEntryFromIdDialog entryFromId = new GenerateEntryFromIdDialog(
+ frame.getCurrentLibraryTab(), dialogService, preferencesService, taskExecutor, stateManager);
if (entryFromIdPopOver == null) {
entryFromIdPopOver = new PopOver(entryFromId.getDialogPane());
diff --git a/src/main/java/org/jabref/gui/OpenConsoleAction.java b/src/main/java/org/jabref/gui/OpenConsoleAction.java
index acada1d5629..82c58e56e91 100644
--- a/src/main/java/org/jabref/gui/OpenConsoleAction.java
+++ b/src/main/java/org/jabref/gui/OpenConsoleAction.java
@@ -1,18 +1,17 @@
package org.jabref.gui;
-import java.io.IOException;
-import java.util.Optional;
-import java.util.function.Supplier;
-
import org.jabref.gui.actions.ActionHelper;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.desktop.JabRefDesktop;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.preferences.PreferencesService;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.util.Optional;
+import java.util.function.Supplier;
+
public class OpenConsoleAction extends SimpleCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(OpenConsoleAction.class);
@@ -27,7 +26,11 @@ public class OpenConsoleAction extends SimpleCommand {
* {@link #OpenConsoleAction(StateManager, PreferencesService)} if not supplying
* another database.
*/
- public OpenConsoleAction(Supplier databaseContext, StateManager stateManager, PreferencesService preferencesService, DialogService dialogService) {
+ public OpenConsoleAction(
+ Supplier databaseContext,
+ StateManager stateManager,
+ PreferencesService preferencesService,
+ DialogService dialogService) {
this.databaseContext = databaseContext;
this.stateManager = stateManager;
this.preferencesService = preferencesService;
@@ -39,18 +42,22 @@ public OpenConsoleAction(Supplier databaseContext, StateMana
/**
* Using this constructor will result in executing the command on the active database.
*/
- public OpenConsoleAction(StateManager stateManager, PreferencesService preferencesService, DialogService dialogService) {
+ public OpenConsoleAction(
+ StateManager stateManager, PreferencesService preferencesService, DialogService dialogService) {
this(() -> null, stateManager, preferencesService, dialogService);
}
@Override
public void execute() {
- Optional.ofNullable(databaseContext.get()).or(stateManager::getActiveDatabase).flatMap(BibDatabaseContext::getDatabasePath).ifPresent(path -> {
- try {
- JabRefDesktop.openConsole(path, preferencesService, dialogService);
- } catch (IOException e) {
- LOGGER.info("Could not open console", e);
- }
- });
+ Optional.ofNullable(databaseContext.get())
+ .or(stateManager::getActiveDatabase)
+ .flatMap(BibDatabaseContext::getDatabasePath)
+ .ifPresent(path -> {
+ try {
+ JabRefDesktop.openConsole(path, preferencesService, dialogService);
+ } catch (IOException e) {
+ LOGGER.info("Could not open console", e);
+ }
+ });
}
}
diff --git a/src/main/java/org/jabref/gui/SendAsEMailAction.java b/src/main/java/org/jabref/gui/SendAsEMailAction.java
index fad6fe8aa7c..57ee0d0d61e 100644
--- a/src/main/java/org/jabref/gui/SendAsEMailAction.java
+++ b/src/main/java/org/jabref/gui/SendAsEMailAction.java
@@ -1,13 +1,5 @@
package org.jabref.gui;
-import java.awt.Desktop;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.desktop.JabRefDesktop;
@@ -18,10 +10,17 @@
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.preferences.PreferencesService;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.awt.*;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Sends the selected entry as email
*
@@ -41,10 +40,11 @@ public abstract class SendAsEMailAction extends SimpleCommand {
private final StateManager stateManager;
private final TaskExecutor taskExecutor;
- public SendAsEMailAction(DialogService dialogService,
- PreferencesService preferencesService,
- StateManager stateManager,
- TaskExecutor taskExecutor) {
+ public SendAsEMailAction(
+ DialogService dialogService,
+ PreferencesService preferencesService,
+ StateManager stateManager,
+ TaskExecutor taskExecutor) {
this.dialogService = dialogService;
this.preferencesService = preferencesService;
this.stateManager = stateManager;
@@ -54,13 +54,13 @@ public SendAsEMailAction(DialogService dialogService,
@Override
public void execute() {
BackgroundTask.wrap(this::sendEmail)
- .onSuccess(dialogService::notify)
- .onFailure(e -> {
- String message = Localization.lang("Error creating email");
- LOGGER.warn(message, e);
- dialogService.notify(message);
- })
- .executeWith(taskExecutor);
+ .onSuccess(dialogService::notify)
+ .onFailure(e -> {
+ String message = Localization.lang("Error creating email");
+ LOGGER.warn(message, e);
+ dialogService.notify(message);
+ })
+ .executeWith(taskExecutor);
}
private String sendEmail() throws Exception {
@@ -100,17 +100,22 @@ private URI getUriMailTo(List entries) throws URISyntaxException {
private List getAttachments(List entries) {
// open folders is needed to indirectly support email programs, which cannot handle
// the unofficial "mailto:attachment" property
- boolean openFolders = preferencesService.getExternalApplicationsPreferences().shouldAutoOpenEmailAttachmentsFolder();
+ boolean openFolders =
+ preferencesService.getExternalApplicationsPreferences().shouldAutoOpenEmailAttachmentsFolder();
BibDatabaseContext databaseContext = stateManager.getActiveDatabase().get();
- List fileList = FileUtil.getListOfLinkedFiles(entries, databaseContext.getFileDirectories(preferencesService.getFilePreferences()));
+ List fileList = FileUtil.getListOfLinkedFiles(
+ entries, databaseContext.getFileDirectories(preferencesService.getFilePreferences()));
List attachments = new ArrayList<>();
for (Path path : fileList) {
attachments.add(path.toAbsolutePath().toString());
if (openFolders) {
try {
- JabRefDesktop.openFolderAndSelectFile(path.toAbsolutePath(), preferencesService.getExternalApplicationsPreferences(), dialogService);
+ JabRefDesktop.openFolderAndSelectFile(
+ path.toAbsolutePath(),
+ preferencesService.getExternalApplicationsPreferences(),
+ dialogService);
} catch (IOException e) {
LOGGER.debug("Cannot open file", e);
}
diff --git a/src/main/java/org/jabref/gui/SendAsKindleEmailAction.java b/src/main/java/org/jabref/gui/SendAsKindleEmailAction.java
index f96944a4fa2..f16931c2c0d 100644
--- a/src/main/java/org/jabref/gui/SendAsKindleEmailAction.java
+++ b/src/main/java/org/jabref/gui/SendAsKindleEmailAction.java
@@ -12,10 +12,15 @@
public class SendAsKindleEmailAction extends SendAsEMailAction {
private final PreferencesService preferencesService;
- public SendAsKindleEmailAction(DialogService dialogService, PreferencesService preferencesService, StateManager stateManager, TaskExecutor taskExecutor) {
+ public SendAsKindleEmailAction(
+ DialogService dialogService,
+ PreferencesService preferencesService,
+ StateManager stateManager,
+ TaskExecutor taskExecutor) {
super(dialogService, preferencesService, stateManager, taskExecutor);
this.preferencesService = preferencesService;
- this.executable.bind(ActionHelper.needsEntriesSelected(stateManager).and(ActionHelper.hasLinkedFileForSelectedEntries(stateManager)));
+ this.executable.bind(ActionHelper.needsEntriesSelected(stateManager)
+ .and(ActionHelper.hasLinkedFileForSelectedEntries(stateManager)));
}
@Override
diff --git a/src/main/java/org/jabref/gui/SendAsStandardEmailAction.java b/src/main/java/org/jabref/gui/SendAsStandardEmailAction.java
index a60fb256820..4a676a6062e 100644
--- a/src/main/java/org/jabref/gui/SendAsStandardEmailAction.java
+++ b/src/main/java/org/jabref/gui/SendAsStandardEmailAction.java
@@ -1,9 +1,5 @@
package org.jabref.gui;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.List;
-
import org.jabref.gui.actions.ActionHelper;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.logic.bibtex.BibEntryWriter;
@@ -14,10 +10,13 @@
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.preferences.PreferencesService;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.List;
+
/**
* Sends the selected entries to any specifiable email
* by populating the email body
@@ -28,11 +27,12 @@ public class SendAsStandardEmailAction extends SendAsEMailAction {
private final StateManager stateManager;
private final BibEntryTypesManager entryTypesManager;
- public SendAsStandardEmailAction(DialogService dialogService,
- PreferencesService preferencesService,
- StateManager stateManager,
- BibEntryTypesManager entryTypesManager,
- TaskExecutor taskExecutor) {
+ public SendAsStandardEmailAction(
+ DialogService dialogService,
+ PreferencesService preferencesService,
+ StateManager stateManager,
+ BibEntryTypesManager entryTypesManager,
+ TaskExecutor taskExecutor) {
super(dialogService, preferencesService, stateManager, taskExecutor);
this.preferencesService = preferencesService;
this.stateManager = stateManager;
@@ -57,7 +57,8 @@ protected String getBody() {
StringWriter rawEntries = new StringWriter();
BibWriter bibWriter = new BibWriter(rawEntries, OS.NEWLINE);
- BibEntryWriter bibtexEntryWriter = new BibEntryWriter(new FieldWriter(preferencesService.getFieldPreferences()), entryTypesManager);
+ BibEntryWriter bibtexEntryWriter =
+ new BibEntryWriter(new FieldWriter(preferencesService.getFieldPreferences()), entryTypesManager);
for (BibEntry entry : entries) {
try {
diff --git a/src/main/java/org/jabref/gui/StateManager.java b/src/main/java/org/jabref/gui/StateManager.java
index f1ff42c5785..4a152b285b4 100644
--- a/src/main/java/org/jabref/gui/StateManager.java
+++ b/src/main/java/org/jabref/gui/StateManager.java
@@ -1,26 +1,16 @@
package org.jabref.gui;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
+import com.tobiasdiez.easybind.EasyBind;
+import com.tobiasdiez.easybind.EasyBinding;
import javafx.beans.Observable;
import javafx.beans.binding.Bindings;
-import javafx.beans.property.IntegerProperty;
-import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.ReadOnlyListProperty;
-import javafx.beans.property.ReadOnlyListWrapper;
-import javafx.beans.property.SimpleIntegerProperty;
-import javafx.beans.property.SimpleObjectProperty;
+import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;
import javafx.concurrent.Task;
import javafx.scene.Node;
import javafx.util.Pair;
-
import org.jabref.gui.edit.automaticfiededitor.LastAutomaticFieldEditorEdit;
import org.jabref.gui.sidepane.SidePaneType;
import org.jabref.gui.util.BackgroundTask;
@@ -32,12 +22,15 @@
import org.jabref.model.entry.BibEntry;
import org.jabref.model.groups.GroupTreeNode;
import org.jabref.model.util.OptionalUtil;
-
-import com.tobiasdiez.easybind.EasyBind;
-import com.tobiasdiez.easybind.EasyBinding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
/**
* This class manages the GUI-state of JabRef, including:
*
@@ -56,20 +49,36 @@ public class StateManager {
private final CustomLocalDragboard localDragboard = new CustomLocalDragboard();
private final ObservableList openDatabases = FXCollections.observableArrayList();
private final OptionalObjectProperty activeDatabase = OptionalObjectProperty.empty();
- private final ReadOnlyListWrapper activeGroups = new ReadOnlyListWrapper<>(FXCollections.observableArrayList());
+ private final ReadOnlyListWrapper activeGroups =
+ new ReadOnlyListWrapper<>(FXCollections.observableArrayList());
private final ObservableList selectedEntries = FXCollections.observableArrayList();
- private final ObservableMap> selectedGroups = FXCollections.observableHashMap();
+ private final ObservableMap> selectedGroups =
+ FXCollections.observableHashMap();
private final OptionalObjectProperty activeSearchQuery = OptionalObjectProperty.empty();
- private final ObservableMap searchResultMap = FXCollections.observableHashMap();
+ private final ObservableMap searchResultMap =
+ FXCollections.observableHashMap();
private final OptionalObjectProperty focusOwner = OptionalObjectProperty.empty();
- private final ObservableList, Task>>> backgroundTasks = FXCollections.observableArrayList(task -> new Observable[]{task.getValue().progressProperty(), task.getValue().runningProperty()});
- private final EasyBinding anyTaskRunning = EasyBind.reduce(backgroundTasks, tasks -> tasks.map(Pair::getValue).anyMatch(Task::isRunning));
- private final EasyBinding anyTasksThatWillNotBeRecoveredRunning = EasyBind.reduce(backgroundTasks, tasks -> tasks.anyMatch(task -> !task.getKey().willBeRecoveredAutomatically() && task.getValue().isRunning()));
- private final EasyBinding tasksProgress = EasyBind.reduce(backgroundTasks, tasks -> tasks.map(Pair::getValue).filter(Task::isRunning).mapToDouble(Task::getProgress).average().orElse(1));
+ private final ObservableList, Task>>> backgroundTasks =
+ FXCollections.observableArrayList(task -> new Observable[] {
+ task.getValue().progressProperty(), task.getValue().runningProperty()
+ });
+ private final EasyBinding anyTaskRunning =
+ EasyBind.reduce(backgroundTasks, tasks -> tasks.map(Pair::getValue).anyMatch(Task::isRunning));
+ private final EasyBinding anyTasksThatWillNotBeRecoveredRunning = EasyBind.reduce(
+ backgroundTasks,
+ tasks -> tasks.anyMatch(task -> !task.getKey().willBeRecoveredAutomatically()
+ && task.getValue().isRunning()));
+ private final EasyBinding tasksProgress =
+ EasyBind.reduce(backgroundTasks, tasks -> tasks.map(Pair::getValue)
+ .filter(Task::isRunning)
+ .mapToDouble(Task::getProgress)
+ .average()
+ .orElse(1));
private final ObservableMap dialogWindowStates = FXCollections.observableHashMap();
private final ObservableList visibleSidePanes = FXCollections.observableArrayList();
- private final ObjectProperty lastAutomaticFieldEditorEdit = new SimpleObjectProperty<>();
+ private final ObjectProperty lastAutomaticFieldEditorEdit =
+ new SimpleObjectProperty<>();
private final ObservableList searchHistory = FXCollections.observableArrayList();
@@ -102,7 +111,8 @@ public void setActiveSearchResultSize(BibDatabaseContext database, IntegerProper
}
public IntegerProperty getSearchResultSize() {
- return searchResultMap.getOrDefault(activeDatabase.getValue().orElse(new BibDatabaseContext()), new SimpleIntegerProperty(0));
+ return searchResultMap.getOrDefault(
+ activeDatabase.getValue().orElse(new BibDatabaseContext()), new SimpleIntegerProperty(0));
}
public ReadOnlyListProperty activeGroupProperty() {
@@ -146,7 +156,7 @@ public void setActiveDatabase(BibDatabaseContext database) {
public List getEntriesInCurrentDatabase() {
return OptionalUtil.flatMap(activeDatabase.get(), BibDatabaseContext::getEntries)
- .collect(Collectors.toList());
+ .collect(Collectors.toList());
}
public void clearSearchQuery() {
@@ -208,10 +218,9 @@ public void setLastAutomaticFieldEditorEdit(LastAutomaticFieldEditorEdit automat
public List collectAllDatabasePaths() {
List list = new ArrayList<>();
getOpenDatabases().stream()
- .map(BibDatabaseContext::getDatabasePath)
- .forEachOrdered(pathOptional -> pathOptional.ifPresentOrElse(
- path -> list.add(path.toAbsolutePath().toString()),
- () -> list.add("")));
+ .map(BibDatabaseContext::getDatabasePath)
+ .forEachOrdered(pathOptional -> pathOptional.ifPresentOrElse(
+ path -> list.add(path.toAbsolutePath().toString()), () -> list.add("")));
return list;
}
diff --git a/src/main/java/org/jabref/gui/Telemetry.java b/src/main/java/org/jabref/gui/Telemetry.java
index 6bb0a10195b..827f408d125 100644
--- a/src/main/java/org/jabref/gui/Telemetry.java
+++ b/src/main/java/org/jabref/gui/Telemetry.java
@@ -1,23 +1,20 @@
package org.jabref.gui;
-import java.util.Optional;
-
import org.jabref.logic.util.BuildInfo;
import org.jabref.preferences.TelemetryPreferences;
+import java.util.Optional;
+
public class Telemetry {
- private Telemetry() {
- }
+ private Telemetry() {}
public static Optional getTelemetryClient() {
return Optional.empty();
}
- private static void start(TelemetryPreferences telemetryPreferences, BuildInfo buildInfo) {
- }
+ private static void start(TelemetryPreferences telemetryPreferences, BuildInfo buildInfo) {}
public static void shutdown() {
- getTelemetryClient().ifPresent(client -> {
- });
+ getTelemetryClient().ifPresent(client -> {});
}
}
diff --git a/src/main/java/org/jabref/gui/TelemetryClient.java b/src/main/java/org/jabref/gui/TelemetryClient.java
index 077010f5ef6..7a9457a190f 100644
--- a/src/main/java/org/jabref/gui/TelemetryClient.java
+++ b/src/main/java/org/jabref/gui/TelemetryClient.java
@@ -3,9 +3,7 @@
import java.util.Map;
public class TelemetryClient {
- public void trackEvent(String actionName) {
- }
+ public void trackEvent(String actionName) {}
- public void trackEvent(String actionName, Map source, Map of) {
- }
+ public void trackEvent(String actionName, Map source, Map of) {}
}
diff --git a/src/main/java/org/jabref/gui/UpdateTimestampListener.java b/src/main/java/org/jabref/gui/UpdateTimestampListener.java
index 2ccc4a72d3c..23b60f91aad 100644
--- a/src/main/java/org/jabref/gui/UpdateTimestampListener.java
+++ b/src/main/java/org/jabref/gui/UpdateTimestampListener.java
@@ -1,12 +1,11 @@
package org.jabref.gui;
+import com.google.common.eventbus.Subscribe;
import org.jabref.model.entry.event.EntriesEventSource;
import org.jabref.model.entry.event.EntryChangedEvent;
import org.jabref.model.entry.field.StandardField;
import org.jabref.preferences.PreferencesService;
-import com.google.common.eventbus.Subscribe;
-
/**
* Updates the timestamp of changed entries if the feature is enabled
*/
@@ -19,11 +18,15 @@ class UpdateTimestampListener {
@Subscribe
public void listen(EntryChangedEvent event) {
- // The event source needs to be checked, since the timestamp is always updated on every change. The cleanup formatter is an exception to that behaviour,
+ // The event source needs to be checked, since the timestamp is always updated on every change. The cleanup
+ // formatter is an exception to that behaviour,
// since it just should move the contents from the timestamp field to modificationdate or creationdate.
- if (preferencesService.getTimestampPreferences().shouldAddModificationDate() && event.getEntriesEventSource() != EntriesEventSource.CLEANUP_TIMESTAMP) {
- event.getBibEntry().setField(StandardField.MODIFICATIONDATE,
- preferencesService.getTimestampPreferences().now());
+ if (preferencesService.getTimestampPreferences().shouldAddModificationDate()
+ && event.getEntriesEventSource() != EntriesEventSource.CLEANUP_TIMESTAMP) {
+ event.getBibEntry()
+ .setField(
+ StandardField.MODIFICATIONDATE,
+ preferencesService.getTimestampPreferences().now());
}
}
}
diff --git a/src/main/java/org/jabref/gui/WaitForSaveFinishedDialog.java b/src/main/java/org/jabref/gui/WaitForSaveFinishedDialog.java
index 43f784669de..feb156e2775 100644
--- a/src/main/java/org/jabref/gui/WaitForSaveFinishedDialog.java
+++ b/src/main/java/org/jabref/gui/WaitForSaveFinishedDialog.java
@@ -1,11 +1,10 @@
package org.jabref.gui;
-import java.util.List;
-
import javafx.concurrent.Task;
-
import org.jabref.logic.l10n.Localization;
+import java.util.List;
+
/**
* Dialog shown when closing of application needs to wait for a save operation to finish.
*/
@@ -36,8 +35,7 @@ protected Void call() throws Exception {
dialogService.showProgressDialog(
Localization.lang("Please wait..."),
Localization.lang("Waiting for save operation to finish") + "...",
- waitForSaveFinished
- );
+ waitForSaveFinished);
}
}
}
diff --git a/src/main/java/org/jabref/gui/actions/Action.java b/src/main/java/org/jabref/gui/actions/Action.java
index e6ccfe487b2..d6ee0ebf967 100644
--- a/src/main/java/org/jabref/gui/actions/Action.java
+++ b/src/main/java/org/jabref/gui/actions/Action.java
@@ -1,10 +1,10 @@
package org.jabref.gui.actions;
-import java.util.Optional;
-
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.keyboard.KeyBinding;
+import java.util.Optional;
+
public interface Action {
default Optional getIcon() {
return Optional.empty();
diff --git a/src/main/java/org/jabref/gui/actions/ActionFactory.java b/src/main/java/org/jabref/gui/actions/ActionFactory.java
index 3deb6d068ef..8c718227f3c 100644
--- a/src/main/java/org/jabref/gui/actions/ActionFactory.java
+++ b/src/main/java/org/jabref/gui/actions/ActionFactory.java
@@ -1,29 +1,21 @@
package org.jabref.gui.actions;
-import java.lang.reflect.InaccessibleObjectException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Objects;
-
-import javafx.beans.binding.BooleanExpression;
-import javafx.scene.control.Button;
-import javafx.scene.control.ButtonBase;
-import javafx.scene.control.CheckMenuItem;
-import javafx.scene.control.Label;
-import javafx.scene.control.Menu;
-import javafx.scene.control.MenuItem;
-import javafx.scene.control.Tooltip;
-
-import org.jabref.gui.keyboard.KeyBindingRepository;
-import org.jabref.model.strings.StringUtil;
-
import com.sun.javafx.scene.control.ContextMenuContent;
import com.tobiasdiez.easybind.EasyBind;
import de.saxsys.mvvmfx.utils.commands.Command;
+import javafx.beans.binding.BooleanExpression;
+import javafx.scene.control.*;
import org.controlsfx.control.action.ActionUtils;
+import org.jabref.gui.keyboard.KeyBindingRepository;
+import org.jabref.model.strings.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.lang.reflect.InaccessibleObjectException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Objects;
+
/**
* Helper class to create and style controls according to an {@link Action}.
*/
@@ -58,7 +50,8 @@ private static void setGraphic(MenuItem node, Action action) {
* should not be used since it's marked as deprecated.
*/
private static Label getAssociatedNode(MenuItem menuItem) {
- ContextMenuContent.MenuItemContainer container = (ContextMenuContent.MenuItemContainer) menuItem.getStyleableNode();
+ ContextMenuContent.MenuItemContainer container =
+ (ContextMenuContent.MenuItemContainer) menuItem.getStyleableNode();
if (container == null) {
return null;
@@ -68,7 +61,10 @@ private static Label getAssociatedNode(MenuItem menuItem) {
Method getLabel = ContextMenuContent.MenuItemContainer.class.getDeclaredMethod("getLabel");
getLabel.setAccessible(true);
return (Label) getLabel.invoke(container);
- } catch (InaccessibleObjectException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+ } catch (InaccessibleObjectException
+ | IllegalAccessException
+ | InvocationTargetException
+ | NoSuchMethodException e) {
LOGGER.warn("Could not get label of menu item", e);
}
}
@@ -76,25 +72,23 @@ private static Label getAssociatedNode(MenuItem menuItem) {
}
public MenuItem configureMenuItem(Action action, Command command, MenuItem menuItem) {
- ActionUtils.configureMenuItem(new JabRefAction(action, command, keyBindingRepository, Sources.FromMenu), menuItem);
+ ActionUtils.configureMenuItem(
+ new JabRefAction(action, command, keyBindingRepository, Sources.FromMenu), menuItem);
setGraphic(menuItem, action);
// Show tooltips
if (command instanceof SimpleCommand simpleCommand) {
- EasyBind.subscribe(
- simpleCommand.statusMessageProperty(),
- message -> {
- Label label = getAssociatedNode(menuItem);
- if (label != null) {
- label.setMouseTransparent(false);
- if (StringUtil.isBlank(message)) {
- label.setTooltip(null);
- } else {
- label.setTooltip(new Tooltip(message));
- }
- }
+ EasyBind.subscribe(simpleCommand.statusMessageProperty(), message -> {
+ Label label = getAssociatedNode(menuItem);
+ if (label != null) {
+ label.setMouseTransparent(false);
+ if (StringUtil.isBlank(message)) {
+ label.setTooltip(null);
+ } else {
+ label.setTooltip(new Tooltip(message));
}
- );
+ }
+ });
}
return menuItem;
@@ -107,7 +101,8 @@ public MenuItem createMenuItem(Action action, Command command) {
}
public CheckMenuItem createCheckMenuItem(Action action, Command command, boolean selected) {
- CheckMenuItem checkMenuItem = ActionUtils.createCheckMenuItem(new JabRefAction(action, command, keyBindingRepository, Sources.FromMenu));
+ CheckMenuItem checkMenuItem = ActionUtils.createCheckMenuItem(
+ new JabRefAction(action, command, keyBindingRepository, Sources.FromMenu));
checkMenuItem.setSelected(selected);
setGraphic(checkMenuItem, action);
@@ -115,7 +110,8 @@ public CheckMenuItem createCheckMenuItem(Action action, Command command, boolean
}
public CheckMenuItem createCheckMenuItem(Action action, Command command, BooleanExpression selectedBinding) {
- CheckMenuItem checkMenuItem = ActionUtils.createCheckMenuItem(new JabRefAction(action, command, keyBindingRepository, Sources.FromMenu));
+ CheckMenuItem checkMenuItem = ActionUtils.createCheckMenuItem(
+ new JabRefAction(action, command, keyBindingRepository, Sources.FromMenu));
EasyBind.subscribe(selectedBinding, checkMenuItem::setSelected);
setGraphic(checkMenuItem, action);
@@ -137,7 +133,9 @@ public Menu createSubMenu(Action action, MenuItem... children) {
}
public Button createIconButton(Action action, Command command) {
- Button button = ActionUtils.createButton(new JabRefAction(action, command, keyBindingRepository, Sources.FromButton), ActionUtils.ActionTextBehavior.HIDE);
+ Button button = ActionUtils.createButton(
+ new JabRefAction(action, command, keyBindingRepository, Sources.FromButton),
+ ActionUtils.ActionTextBehavior.HIDE);
button.getStyleClass().setAll("icon-button");
diff --git a/src/main/java/org/jabref/gui/actions/ActionHelper.java b/src/main/java/org/jabref/gui/actions/ActionHelper.java
index e82784a4782..cc49d9a8a95 100644
--- a/src/main/java/org/jabref/gui/actions/ActionHelper.java
+++ b/src/main/java/org/jabref/gui/actions/ActionHelper.java
@@ -1,16 +1,12 @@
package org.jabref.gui.actions;
-import java.nio.file.Path;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
+import com.tobiasdiez.easybind.EasyBind;
+import com.tobiasdiez.easybind.EasyBinding;
import javafx.beans.binding.Binding;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanExpression;
import javafx.collections.ObservableList;
import javafx.scene.control.TabPane;
-
import org.jabref.gui.StateManager;
import org.jabref.logic.shared.DatabaseLocation;
import org.jabref.logic.util.io.FileUtil;
@@ -20,8 +16,10 @@
import org.jabref.model.entry.field.Field;
import org.jabref.preferences.PreferencesService;
-import com.tobiasdiez.easybind.EasyBind;
-import com.tobiasdiez.easybind.EasyBinding;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
public class ActionHelper {
@@ -30,12 +28,16 @@ public static BooleanExpression needsDatabase(StateManager stateManager) {
}
public static BooleanExpression needsSharedDatabase(StateManager stateManager) {
- EasyBinding binding = EasyBind.map(stateManager.activeDatabaseProperty(), context -> context.filter(c -> c.getLocation() == DatabaseLocation.SHARED).isPresent());
+ EasyBinding binding = EasyBind.map(stateManager.activeDatabaseProperty(), context -> context.filter(
+ c -> c.getLocation() == DatabaseLocation.SHARED)
+ .isPresent());
return BooleanExpression.booleanExpression(binding);
}
public static BooleanExpression needsStudyDatabase(StateManager stateManager) {
- EasyBinding binding = EasyBind.map(stateManager.activeDatabaseProperty(), context -> context.filter(BibDatabaseContext::isStudy).isPresent());
+ EasyBinding binding = EasyBind.map(
+ stateManager.activeDatabaseProperty(),
+ context -> context.filter(BibDatabaseContext::isStudy).isPresent());
return BooleanExpression.booleanExpression(binding);
}
@@ -44,8 +46,8 @@ public static BooleanExpression needsEntriesSelected(StateManager stateManager)
}
public static BooleanExpression needsEntriesSelected(int numberOfEntries, StateManager stateManager) {
- return Bindings.createBooleanBinding(() -> stateManager.getSelectedEntries().size() == numberOfEntries,
- stateManager.getSelectedEntries());
+ return Bindings.createBooleanBinding(
+ () -> stateManager.getSelectedEntries().size() == numberOfEntries, stateManager.getSelectedEntries());
}
public static BooleanExpression isFieldSetForSelectedEntry(Field field, StateManager stateManager) {
@@ -55,32 +57,38 @@ public static BooleanExpression isFieldSetForSelectedEntry(Field field, StateMan
public static BooleanExpression isAnyFieldSetForSelectedEntry(List fields, StateManager stateManager) {
ObservableList selectedEntries = stateManager.getSelectedEntries();
Binding fieldsAreSet = EasyBind.valueAt(selectedEntries, 0)
- .mapObservable(entry -> Bindings.createBooleanBinding(() -> {
- return entry.getFields().stream().anyMatch(fields::contains);
- }, entry.getFieldsObservable()))
- .orElseOpt(false);
+ .mapObservable(entry -> Bindings.createBooleanBinding(
+ () -> {
+ return entry.getFields().stream().anyMatch(fields::contains);
+ },
+ entry.getFieldsObservable()))
+ .orElseOpt(false);
return BooleanExpression.booleanExpression(fieldsAreSet);
}
- public static BooleanExpression isFilePresentForSelectedEntry(StateManager stateManager, PreferencesService preferencesService) {
+ public static BooleanExpression isFilePresentForSelectedEntry(
+ StateManager stateManager, PreferencesService preferencesService) {
ObservableList selectedEntries = stateManager.getSelectedEntries();
- Binding fileIsPresent = EasyBind.valueAt(selectedEntries, 0).mapOpt(entry -> {
- List files = entry.getFiles();
-
- if ((!entry.getFiles().isEmpty()) && stateManager.getActiveDatabase().isPresent()) {
- if (files.get(0).isOnlineLink()) {
- return true;
- }
-
- Optional filename = FileUtil.find(
- stateManager.getActiveDatabase().get(),
- files.get(0).getLink(),
- preferencesService.getFilePreferences());
- return filename.isPresent();
- } else {
- return false;
- }
- }).orElseOpt(false);
+ Binding fileIsPresent = EasyBind.valueAt(selectedEntries, 0)
+ .mapOpt(entry -> {
+ List files = entry.getFiles();
+
+ if ((!entry.getFiles().isEmpty())
+ && stateManager.getActiveDatabase().isPresent()) {
+ if (files.get(0).isOnlineLink()) {
+ return true;
+ }
+
+ Optional filename = FileUtil.find(
+ stateManager.getActiveDatabase().get(),
+ files.get(0).getLink(),
+ preferencesService.getFilePreferences());
+ return filename.isPresent();
+ } else {
+ return false;
+ }
+ })
+ .orElseOpt(false);
return BooleanExpression.booleanExpression(fileIsPresent);
}
@@ -94,7 +102,8 @@ public static BooleanExpression isFilePresentForSelectedEntry(StateManager state
* @return a boolean binding
*/
public static BooleanExpression hasLinkedFileForSelectedEntries(StateManager stateManager) {
- return BooleanExpression.booleanExpression(EasyBind.reduce(stateManager.getSelectedEntries(),
+ return BooleanExpression.booleanExpression(EasyBind.reduce(
+ stateManager.getSelectedEntries(),
entries -> entries.anyMatch(entry -> !entry.getFiles().isEmpty())));
}
diff --git a/src/main/java/org/jabref/gui/actions/JabRefAction.java b/src/main/java/org/jabref/gui/actions/JabRefAction.java
index e20b7650d90..79fd04c5827 100644
--- a/src/main/java/org/jabref/gui/actions/JabRefAction.java
+++ b/src/main/java/org/jabref/gui/actions/JabRefAction.java
@@ -1,13 +1,11 @@
package org.jabref.gui.actions;
-import java.util.Map;
-
+import de.saxsys.mvvmfx.utils.commands.Command;
import javafx.beans.binding.Bindings;
-
import org.jabref.gui.Telemetry;
import org.jabref.gui.keyboard.KeyBindingRepository;
-import de.saxsys.mvvmfx.utils.commands.Command;
+import java.util.Map;
/**
* Wrapper around one of our actions from {@link Action} to convert them to controlsfx {@link org.controlsfx.control.action.Action}.
@@ -16,10 +14,10 @@ class JabRefAction extends org.controlsfx.control.action.Action {
public JabRefAction(Action action, KeyBindingRepository keyBindingRepository) {
super(action.getText());
- action.getIcon()
- .ifPresent(icon -> setGraphic(icon.getGraphicNode()));
- action.getKeyBinding()
- .ifPresent(keyBinding -> keyBindingRepository.getKeyCombination(keyBinding).ifPresent(combination -> setAccelerator(combination)));
+ action.getIcon().ifPresent(icon -> setGraphic(icon.getGraphicNode()));
+ action.getKeyBinding().ifPresent(keyBinding -> keyBindingRepository
+ .getKeyCombination(keyBinding)
+ .ifPresent(combination -> setAccelerator(combination)));
setLongText(action.getDescription());
}
@@ -70,14 +68,12 @@ private String getActionName(Action action, Command command) {
}
private void trackExecute(String actionName) {
- Telemetry.getTelemetryClient()
- .ifPresent(telemetryClient -> telemetryClient.trackEvent(actionName));
+ Telemetry.getTelemetryClient().ifPresent(telemetryClient -> telemetryClient.trackEvent(actionName));
}
private void trackUserActionSource(String actionName, Sources source) {
- Telemetry.getTelemetryClient().ifPresent(telemetryClient -> telemetryClient.trackEvent(
- actionName,
- Map.of("Source", source.toString()),
- Map.of()));
+ Telemetry.getTelemetryClient()
+ .ifPresent(telemetryClient ->
+ telemetryClient.trackEvent(actionName, Map.of("Source", source.toString()), Map.of()));
}
}
diff --git a/src/main/java/org/jabref/gui/actions/SimpleCommand.java b/src/main/java/org/jabref/gui/actions/SimpleCommand.java
index 39e3b7ae1ad..4385291edb3 100644
--- a/src/main/java/org/jabref/gui/actions/SimpleCommand.java
+++ b/src/main/java/org/jabref/gui/actions/SimpleCommand.java
@@ -1,13 +1,11 @@
package org.jabref.gui.actions;
+import de.saxsys.mvvmfx.utils.commands.CommandBase;
import javafx.beans.property.ReadOnlyDoubleProperty;
import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.ReadOnlyStringWrapper;
-
import org.jabref.gui.util.BindingsHelper;
-import de.saxsys.mvvmfx.utils.commands.CommandBase;
-
/**
* A simple command that does not track progress of the action.
*/
diff --git a/src/main/java/org/jabref/gui/actions/StandardActions.java b/src/main/java/org/jabref/gui/actions/StandardActions.java
index 4053cdc7ea1..914d0615bfd 100644
--- a/src/main/java/org/jabref/gui/actions/StandardActions.java
+++ b/src/main/java/org/jabref/gui/actions/StandardActions.java
@@ -1,14 +1,13 @@
package org.jabref.gui.actions;
-import java.util.Optional;
-
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.logic.l10n.Localization;
-public enum StandardActions implements Action {
+import java.util.Optional;
+public enum StandardActions implements Action {
COPY_MORE(Localization.lang("Copy") + "..."),
COPY_TITLE(Localization.lang("Copy title"), KeyBinding.COPY_TITLE),
COPY_KEY(Localization.lang("Copy citation key"), KeyBinding.COPY_CITATION_KEY),
@@ -19,7 +18,8 @@ public enum StandardActions implements Action {
COPY_CITATION_TEXT(Localization.lang("Copy citation (text)")),
COPY_CITATION_PREVIEW(Localization.lang("Copy preview"), KeyBinding.COPY_PREVIEW),
EXPORT_TO_CLIPBOARD(Localization.lang("Export to clipboard"), IconTheme.JabRefIcons.EXPORT_TO_CLIPBOARD),
- EXPORT_SELECTED_TO_CLIPBOARD(Localization.lang("Export selected entries to clipboard"), IconTheme.JabRefIcons.EXPORT_TO_CLIPBOARD),
+ EXPORT_SELECTED_TO_CLIPBOARD(
+ Localization.lang("Export selected entries to clipboard"), IconTheme.JabRefIcons.EXPORT_TO_CLIPBOARD),
COPY(Localization.lang("Copy"), IconTheme.JabRefIcons.COPY, KeyBinding.COPY),
PASTE(Localization.lang("Paste"), IconTheme.JabRefIcons.PASTE, KeyBinding.PASTE),
CUT(Localization.lang("Cut"), IconTheme.JabRefIcons.CUT, KeyBinding.CUT),
@@ -54,7 +54,10 @@ public enum StandardActions implements Action {
READ_STATUS(Localization.lang("Read status"), IconTheme.JabRefIcons.READ_STATUS),
CLEAR_READ_STATUS(Localization.lang("Clear read status"), KeyBinding.CLEAR_READ_STATUS),
READ(Localization.lang("Set read status to read"), IconTheme.JabRefIcons.READ_STATUS_READ, KeyBinding.READ),
- SKIMMED(Localization.lang("Set read status to skimmed"), IconTheme.JabRefIcons.READ_STATUS_SKIMMED, KeyBinding.SKIMMED),
+ SKIMMED(
+ Localization.lang("Set read status to skimmed"),
+ IconTheme.JabRefIcons.READ_STATUS_SKIMMED,
+ KeyBinding.SKIMMED),
RELEVANCE(Localization.lang("Relevance"), IconTheme.JabRefIcons.RELEVANCE),
RELEVANT(Localization.lang("Toggle relevance"), IconTheme.JabRefIcons.RELEVANCE),
NEW_LIBRARY(Localization.lang("New library"), IconTheme.JabRefIcons.NEW),
@@ -64,18 +67,34 @@ public enum StandardActions implements Action {
SAVE_LIBRARY(Localization.lang("Save library"), IconTheme.JabRefIcons.SAVE, KeyBinding.SAVE_DATABASE),
SAVE_LIBRARY_AS(Localization.lang("Save library as..."), KeyBinding.SAVE_DATABASE_AS),
SAVE_SELECTED_AS_PLAIN_BIBTEX(Localization.lang("Save selected as plain BibTeX...")),
- SAVE_ALL(Localization.lang("Save all"), Localization.lang("Save all open libraries"), IconTheme.JabRefIcons.SAVE_ALL, KeyBinding.SAVE_ALL),
+ SAVE_ALL(
+ Localization.lang("Save all"),
+ Localization.lang("Save all open libraries"),
+ IconTheme.JabRefIcons.SAVE_ALL,
+ KeyBinding.SAVE_ALL),
IMPORT_INTO_NEW_LIBRARY(Localization.lang("Import into new library"), KeyBinding.IMPORT_INTO_NEW_DATABASE),
- IMPORT_INTO_CURRENT_LIBRARY(Localization.lang("Import into current library"), KeyBinding.IMPORT_INTO_CURRENT_DATABASE),
+ IMPORT_INTO_CURRENT_LIBRARY(
+ Localization.lang("Import into current library"), KeyBinding.IMPORT_INTO_CURRENT_DATABASE),
EXPORT_ALL(Localization.lang("Export all entries")),
REMOTE_DB(Localization.lang("Shared database"), IconTheme.JabRefIcons.REMOTE_DATABASE),
EXPORT_SELECTED(Localization.lang("Export selected entries"), KeyBinding.EXPORT_SELECTED),
CONNECT_TO_SHARED_DB(Localization.lang("Connect to shared database"), IconTheme.JabRefIcons.CONNECT_DB),
- PULL_CHANGES_FROM_SHARED_DB(Localization.lang("Pull changes from shared database"), KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE),
- CLOSE_LIBRARY(Localization.lang("Close library"), Localization.lang("Close the current library"), IconTheme.JabRefIcons.CLOSE, KeyBinding.CLOSE_DATABASE),
- CLOSE_OTHER_LIBRARIES(Localization.lang("Close others"), Localization.lang("Close other libraries"), IconTheme.JabRefIcons.CLOSE),
- CLOSE_ALL_LIBRARIES(Localization.lang("Close all"), Localization.lang("Close all libraries"), IconTheme.JabRefIcons.CLOSE),
- QUIT(Localization.lang("Quit"), Localization.lang("Quit JabRef"), IconTheme.JabRefIcons.CLOSE_JABREF, KeyBinding.QUIT_JABREF),
+ PULL_CHANGES_FROM_SHARED_DB(
+ Localization.lang("Pull changes from shared database"), KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE),
+ CLOSE_LIBRARY(
+ Localization.lang("Close library"),
+ Localization.lang("Close the current library"),
+ IconTheme.JabRefIcons.CLOSE,
+ KeyBinding.CLOSE_DATABASE),
+ CLOSE_OTHER_LIBRARIES(
+ Localization.lang("Close others"), Localization.lang("Close other libraries"), IconTheme.JabRefIcons.CLOSE),
+ CLOSE_ALL_LIBRARIES(
+ Localization.lang("Close all"), Localization.lang("Close all libraries"), IconTheme.JabRefIcons.CLOSE),
+ QUIT(
+ Localization.lang("Quit"),
+ Localization.lang("Quit JabRef"),
+ IconTheme.JabRefIcons.CLOSE_JABREF,
+ KeyBinding.QUIT_JABREF),
UNDO(Localization.lang("Undo"), IconTheme.JabRefIcons.UNDO, KeyBinding.UNDO),
REDO(Localization.lang("Redo"), IconTheme.JabRefIcons.REDO, KeyBinding.REDO),
REPLACE_ALL(Localization.lang("Find and replace"), KeyBinding.REPLACE_STRING),
@@ -84,29 +103,66 @@ public enum StandardActions implements Action {
AUTOMATIC_FIELD_EDITOR(Localization.lang("Automatic field editor")),
TOGGLE_GROUPS(Localization.lang("Groups"), IconTheme.JabRefIcons.TOGGLE_GROUPS, KeyBinding.TOGGLE_GROUPS_INTERFACE),
- TOOGLE_OO(Localization.lang("OpenOffice/LibreOffice"), IconTheme.JabRefIcons.FILE_OPENOFFICE, KeyBinding.OPEN_OPEN_OFFICE_LIBRE_OFFICE_CONNECTION),
- TOGGLE_WEB_SEARCH(Localization.lang("Web search"), Localization.lang("Toggle web search interface"), IconTheme.JabRefIcons.WWW, KeyBinding.WEB_SEARCH),
+ TOOGLE_OO(
+ Localization.lang("OpenOffice/LibreOffice"),
+ IconTheme.JabRefIcons.FILE_OPENOFFICE,
+ KeyBinding.OPEN_OPEN_OFFICE_LIBRE_OFFICE_CONNECTION),
+ TOGGLE_WEB_SEARCH(
+ Localization.lang("Web search"),
+ Localization.lang("Toggle web search interface"),
+ IconTheme.JabRefIcons.WWW,
+ KeyBinding.WEB_SEARCH),
PARSE_LATEX(Localization.lang("Search for citations in LaTeX files..."), IconTheme.JabRefIcons.LATEX_CITATIONS),
- NEW_SUB_LIBRARY_FROM_AUX(Localization.lang("New sublibrary based on AUX file") + "...", Localization.lang("New BibTeX sublibrary") + Localization.lang("This feature generates a new library based on which entries are needed in an existing LaTeX document."), IconTheme.JabRefIcons.NEW),
- WRITE_METADATA_TO_PDF(Localization.lang("Write metadata to PDF files"), Localization.lang("Will write metadata to the PDFs linked from selected entries."), KeyBinding.WRITE_METADATA_TO_PDF),
+ NEW_SUB_LIBRARY_FROM_AUX(
+ Localization.lang("New sublibrary based on AUX file") + "...",
+ Localization.lang("New BibTeX sublibrary")
+ + Localization.lang(
+ "This feature generates a new library based on which entries are needed in an existing LaTeX document."),
+ IconTheme.JabRefIcons.NEW),
+ WRITE_METADATA_TO_PDF(
+ Localization.lang("Write metadata to PDF files"),
+ Localization.lang("Will write metadata to the PDFs linked from selected entries."),
+ KeyBinding.WRITE_METADATA_TO_PDF),
START_NEW_STUDY(Localization.lang("Start new systematic literature review")),
UPDATE_SEARCH_RESULTS_OF_STUDY(Localization.lang("Update study search results")),
EDIT_EXISTING_STUDY(Localization.lang("Manage study definition")),
OPEN_DATABASE_FOLDER(Localization.lang("Reveal in file explorer")),
- OPEN_FOLDER(Localization.lang("Open folder"), Localization.lang("Open folder"), IconTheme.JabRefIcons.FOLDER, KeyBinding.OPEN_FOLDER),
- OPEN_FILE(Localization.lang("Open file"), Localization.lang("Open file"), IconTheme.JabRefIcons.FILE, KeyBinding.OPEN_FILE),
- OPEN_CONSOLE(Localization.lang("Open terminal here"), Localization.lang("Open terminal here"), IconTheme.JabRefIcons.CONSOLE, KeyBinding.OPEN_CONSOLE),
+ OPEN_FOLDER(
+ Localization.lang("Open folder"),
+ Localization.lang("Open folder"),
+ IconTheme.JabRefIcons.FOLDER,
+ KeyBinding.OPEN_FOLDER),
+ OPEN_FILE(
+ Localization.lang("Open file"),
+ Localization.lang("Open file"),
+ IconTheme.JabRefIcons.FILE,
+ KeyBinding.OPEN_FILE),
+ OPEN_CONSOLE(
+ Localization.lang("Open terminal here"),
+ Localization.lang("Open terminal here"),
+ IconTheme.JabRefIcons.CONSOLE,
+ KeyBinding.OPEN_CONSOLE),
COPY_LINKED_FILES(Localization.lang("Copy linked files to folder...")),
COPY_DOI(Localization.lang("Copy DOI")),
COPY_DOI_URL(Localization.lang("Copy DOI url")),
ABBREVIATE(Localization.lang("Abbreviate journal names")),
- ABBREVIATE_DEFAULT(Localization.lang("default"), Localization.lang("Abbreviate journal names of the selected entries (DEFAULT abbreviation)"), KeyBinding.ABBREVIATE),
- ABBREVIATE_DOTLESS(Localization.lang("dotless"), Localization.lang("Abbreviate journal names of the selected entries (DOTLESS abbreviation)")),
- ABBREVIATE_SHORTEST_UNIQUE(Localization.lang("shortest unique"), Localization.lang("Abbreviate journal names of the selected entries (SHORTEST UNIQUE abbreviation)")),
- UNABBREVIATE(Localization.lang("Unabbreviate journal names"), Localization.lang("Unabbreviate journal names of the selected entries"), KeyBinding.UNABBREVIATE),
+ ABBREVIATE_DEFAULT(
+ Localization.lang("default"),
+ Localization.lang("Abbreviate journal names of the selected entries (DEFAULT abbreviation)"),
+ KeyBinding.ABBREVIATE),
+ ABBREVIATE_DOTLESS(
+ Localization.lang("dotless"),
+ Localization.lang("Abbreviate journal names of the selected entries (DOTLESS abbreviation)")),
+ ABBREVIATE_SHORTEST_UNIQUE(
+ Localization.lang("shortest unique"),
+ Localization.lang("Abbreviate journal names of the selected entries (SHORTEST UNIQUE abbreviation)")),
+ UNABBREVIATE(
+ Localization.lang("Unabbreviate journal names"),
+ Localization.lang("Unabbreviate journal names of the selected entries"),
+ KeyBinding.UNABBREVIATE),
MANAGE_CUSTOM_EXPORTS(Localization.lang("Manage custom exports")),
MANAGE_CUSTOM_IMPORTS(Localization.lang("Manage custom imports")),
@@ -130,48 +186,86 @@ public enum StandardActions implements Action {
NEW_ENTRY(Localization.lang("New entry"), IconTheme.JabRefIcons.ADD_ENTRY, KeyBinding.NEW_ENTRY),
NEW_ARTICLE(Localization.lang("New article"), IconTheme.JabRefIcons.ADD_ARTICLE),
- NEW_ENTRY_FROM_PLAIN_TEXT(Localization.lang("New entry from plain text"), IconTheme.JabRefIcons.NEW_ENTRY_FROM_PLAIN_TEXT, KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT),
+ NEW_ENTRY_FROM_PLAIN_TEXT(
+ Localization.lang("New entry from plain text"),
+ IconTheme.JabRefIcons.NEW_ENTRY_FROM_PLAIN_TEXT,
+ KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT),
LIBRARY_PROPERTIES(Localization.lang("Library properties")),
FIND_DUPLICATES(Localization.lang("Find duplicates"), IconTheme.JabRefIcons.FIND_DUPLICATES),
MERGE_ENTRIES(Localization.lang("Merge entries"), IconTheme.JabRefIcons.MERGE_ENTRIES, KeyBinding.MERGE_ENTRIES),
- RESOLVE_DUPLICATE_KEYS(Localization.lang("Resolve duplicate citation keys"), Localization.lang("Find and remove duplicate citation keys"), KeyBinding.RESOLVE_DUPLICATE_CITATION_KEYS),
+ RESOLVE_DUPLICATE_KEYS(
+ Localization.lang("Resolve duplicate citation keys"),
+ Localization.lang("Find and remove duplicate citation keys"),
+ KeyBinding.RESOLVE_DUPLICATE_CITATION_KEYS),
CHECK_INTEGRITY(Localization.lang("Check integrity"), KeyBinding.CHECK_INTEGRITY),
- FIND_UNLINKED_FILES(Localization.lang("Search for unlinked local files"), IconTheme.JabRefIcons.SEARCH, KeyBinding.FIND_UNLINKED_FILES),
- AUTO_LINK_FILES(Localization.lang("Automatically set file links"), IconTheme.JabRefIcons.AUTO_FILE_LINK, KeyBinding.AUTOMATICALLY_LINK_FILES),
+ FIND_UNLINKED_FILES(
+ Localization.lang("Search for unlinked local files"),
+ IconTheme.JabRefIcons.SEARCH,
+ KeyBinding.FIND_UNLINKED_FILES),
+ AUTO_LINK_FILES(
+ Localization.lang("Automatically set file links"),
+ IconTheme.JabRefIcons.AUTO_FILE_LINK,
+ KeyBinding.AUTOMATICALLY_LINK_FILES),
LOOKUP_DOC_IDENTIFIER(Localization.lang("Search document identifier online")),
- LOOKUP_FULLTEXT(Localization.lang("Search full text documents online"), IconTheme.JabRefIcons.FILE_SEARCH, KeyBinding.DOWNLOAD_FULL_TEXT),
- GENERATE_CITE_KEY(Localization.lang("Generate citation key"), IconTheme.JabRefIcons.MAKE_KEY, KeyBinding.AUTOGENERATE_CITATION_KEYS),
- GENERATE_CITE_KEYS(Localization.lang("Generate citation keys"), IconTheme.JabRefIcons.MAKE_KEY, KeyBinding.AUTOGENERATE_CITATION_KEYS),
- DOWNLOAD_FULL_TEXT(Localization.lang("Search full text documents online"), IconTheme.JabRefIcons.FILE_SEARCH, KeyBinding.DOWNLOAD_FULL_TEXT),
+ LOOKUP_FULLTEXT(
+ Localization.lang("Search full text documents online"),
+ IconTheme.JabRefIcons.FILE_SEARCH,
+ KeyBinding.DOWNLOAD_FULL_TEXT),
+ GENERATE_CITE_KEY(
+ Localization.lang("Generate citation key"),
+ IconTheme.JabRefIcons.MAKE_KEY,
+ KeyBinding.AUTOGENERATE_CITATION_KEYS),
+ GENERATE_CITE_KEYS(
+ Localization.lang("Generate citation keys"),
+ IconTheme.JabRefIcons.MAKE_KEY,
+ KeyBinding.AUTOGENERATE_CITATION_KEYS),
+ DOWNLOAD_FULL_TEXT(
+ Localization.lang("Search full text documents online"),
+ IconTheme.JabRefIcons.FILE_SEARCH,
+ KeyBinding.DOWNLOAD_FULL_TEXT),
CLEANUP_ENTRIES(Localization.lang("Cleanup entries"), IconTheme.JabRefIcons.CLEANUP_ENTRIES, KeyBinding.CLEANUP),
SET_FILE_LINKS(Localization.lang("Automatically set file links"), KeyBinding.AUTOMATICALLY_LINK_FILES),
EDIT_FILE_LINK(Localization.lang("Edit"), IconTheme.JabRefIcons.EDIT, KeyBinding.EDIT_ENTRY),
DOWNLOAD_FILE(Localization.lang("Download file"), IconTheme.JabRefIcons.DOWNLOAD_FILE),
RENAME_FILE_TO_PATTERN(Localization.lang("Rename file to defined pattern"), IconTheme.JabRefIcons.AUTO_RENAME),
- RENAME_FILE_TO_NAME(Localization.lang("Rename file to a given name"), IconTheme.JabRefIcons.RENAME, KeyBinding.REPLACE_STRING),
+ RENAME_FILE_TO_NAME(
+ Localization.lang("Rename file to a given name"), IconTheme.JabRefIcons.RENAME, KeyBinding.REPLACE_STRING),
MOVE_FILE_TO_FOLDER(Localization.lang("Move file to file directory"), IconTheme.JabRefIcons.MOVE_TO_FOLDER),
MOVE_FILE_TO_FOLDER_AND_RENAME(Localization.lang("Move file to file directory and rename file")),
- COPY_FILE_TO_FOLDER(Localization.lang("Copy linked file to folder..."), IconTheme.JabRefIcons.COPY_TO_FOLDER, KeyBinding.COPY),
+ COPY_FILE_TO_FOLDER(
+ Localization.lang("Copy linked file to folder..."), IconTheme.JabRefIcons.COPY_TO_FOLDER, KeyBinding.COPY),
REMOVE_LINK(Localization.lang("Remove link"), IconTheme.JabRefIcons.REMOVE_LINK),
- DELETE_FILE(Localization.lang("Permanently delete local file"), IconTheme.JabRefIcons.DELETE_FILE, KeyBinding.DELETE_ENTRY),
+ DELETE_FILE(
+ Localization.lang("Permanently delete local file"),
+ IconTheme.JabRefIcons.DELETE_FILE,
+ KeyBinding.DELETE_ENTRY),
HELP(Localization.lang("Online help"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
HELP_KEY_PATTERNS(Localization.lang("Help on key patterns"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
- HELP_REGEX_SEARCH(Localization.lang("Help on regular expression search"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
+ HELP_REGEX_SEARCH(
+ Localization.lang("Help on regular expression search"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
HELP_NAME_FORMATTER(Localization.lang("Help on Name Formatting"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
HELP_SPECIAL_FIELDS(Localization.lang("Help on special fields"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
- HELP_PUSH_TO_APPLICATION(Localization.lang("Help on external applications"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
+ HELP_PUSH_TO_APPLICATION(
+ Localization.lang("Help on external applications"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
WEB_MENU(Localization.lang("JabRef resources")),
OPEN_WEBPAGE(Localization.lang("Website"), Localization.lang("Opens JabRef's website"), IconTheme.JabRefIcons.HOME),
OPEN_FACEBOOK("Facebook", Localization.lang("Opens JabRef's Facebook page"), IconTheme.JabRefIcons.FACEBOOK),
OPEN_TWITTER("Twitter", Localization.lang("Opens JabRef's Twitter page"), IconTheme.JabRefIcons.TWITTER),
OPEN_BLOG(Localization.lang("Blog"), Localization.lang("Opens JabRef's blog"), IconTheme.JabRefIcons.BLOG),
- OPEN_DEV_VERSION_LINK(Localization.lang("Development version"), Localization.lang("Opens a link where the current development version can be downloaded")),
- OPEN_CHANGELOG(Localization.lang("View change log"), Localization.lang("See what has been changed in the JabRef versions")),
+ OPEN_DEV_VERSION_LINK(
+ Localization.lang("Development version"),
+ Localization.lang("Opens a link where the current development version can be downloaded")),
+ OPEN_CHANGELOG(
+ Localization.lang("View change log"),
+ Localization.lang("See what has been changed in the JabRef versions")),
OPEN_GITHUB("GitHub", Localization.lang("Opens JabRef's GitHub page"), IconTheme.JabRefIcons.GITHUB),
DONATE(Localization.lang("Donate to JabRef"), Localization.lang("Donate to JabRef"), IconTheme.JabRefIcons.DONATE),
- OPEN_FORUM(Localization.lang("Online help forum"), Localization.lang("Online help forum"), IconTheme.JabRefIcons.FORUM),
+ OPEN_FORUM(
+ Localization.lang("Online help forum"),
+ Localization.lang("Online help forum"),
+ IconTheme.JabRefIcons.FORUM),
ERROR_CONSOLE(Localization.lang("View event log"), Localization.lang("Display all error messages")),
SEARCH_FOR_UPDATES(Localization.lang("Check for updates")),
ABOUT(Localization.lang("About JabRef"), Localization.lang("About JabRef")),
diff --git a/src/main/java/org/jabref/gui/autocompleter/AutoCompletePreferences.java b/src/main/java/org/jabref/gui/autocompleter/AutoCompletePreferences.java
index 160abb9ecb3..b6080c2b648 100644
--- a/src/main/java/org/jabref/gui/autocompleter/AutoCompletePreferences.java
+++ b/src/main/java/org/jabref/gui/autocompleter/AutoCompletePreferences.java
@@ -1,21 +1,22 @@
package org.jabref.gui.autocompleter;
-import java.util.Set;
-
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableSet;
-
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
+import java.util.Set;
+
public class AutoCompletePreferences {
public enum NameFormat {
- LAST_FIRST, FIRST_LAST, BOTH
+ LAST_FIRST,
+ FIRST_LAST,
+ BOTH
}
private final BooleanProperty shouldAutoComplete;
@@ -23,10 +24,11 @@ public enum NameFormat {
private final ObjectProperty nameFormat;
private final ObservableSet completeFields;
- public AutoCompletePreferences(boolean shouldAutoComplete,
- AutoCompleteFirstNameMode firstNameMode,
- NameFormat nameFormat,
- Set completeFields) {
+ public AutoCompletePreferences(
+ boolean shouldAutoComplete,
+ AutoCompleteFirstNameMode firstNameMode,
+ NameFormat nameFormat,
+ Set completeFields) {
this.shouldAutoComplete = new SimpleBooleanProperty(shouldAutoComplete);
this.firstNameMode = new SimpleObjectProperty<>(firstNameMode);
this.nameFormat = new SimpleObjectProperty<>(nameFormat);
diff --git a/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java b/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java
index 0bb48bb7275..544c81f2b0b 100644
--- a/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java
+++ b/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java
@@ -26,16 +26,14 @@
*/
package org.jabref.gui.autocompleter;
-import java.util.Collection;
-
import javafx.beans.value.ChangeListener;
import javafx.scene.control.TextInputControl;
import javafx.util.Callback;
import javafx.util.StringConverter;
-
+import org.controlsfx.control.textfield.AutoCompletionBinding;
import org.jabref.gui.util.DefaultTaskExecutor;
-import org.controlsfx.control.textfield.AutoCompletionBinding;
+import java.util.Collection;
/**
* Represents a binding between a text input control and an auto-completion popup
@@ -48,6 +46,7 @@ public class AutoCompletionTextInputBinding extends AutoCompletionBinding
* String converter to be used to convert suggestions to strings.
*/
private StringConverter converter;
+
private AutoCompletionStrategy inputAnalyzer;
private final ChangeListener textChangeListener = (obs, oldText, newText) -> {
if (getCompletionTarget().isFocused()) {
@@ -69,25 +68,28 @@ public class AutoCompletionTextInputBinding extends AutoCompletionBinding
* Creates a new auto-completion binding between the given textInputControl
* and the given suggestion provider.
*/
- private AutoCompletionTextInputBinding(final TextInputControl textInputControl,
- Callback> suggestionProvider) {
+ private AutoCompletionTextInputBinding(
+ final TextInputControl textInputControl, Callback> suggestionProvider) {
- this(textInputControl,
+ this(
+ textInputControl,
suggestionProvider,
AutoCompletionTextInputBinding.defaultStringConverter(),
new ReplaceStrategy());
}
- private AutoCompletionTextInputBinding(final TextInputControl textInputControl,
- final Callback> suggestionProvider,
- final StringConverter converter) {
+ private AutoCompletionTextInputBinding(
+ final TextInputControl textInputControl,
+ final Callback> suggestionProvider,
+ final StringConverter converter) {
this(textInputControl, suggestionProvider, converter, new ReplaceStrategy());
}
- private AutoCompletionTextInputBinding(final TextInputControl textInputControl,
- final Callback> suggestionProvider,
- final StringConverter converter,
- final AutoCompletionStrategy inputAnalyzer) {
+ private AutoCompletionTextInputBinding(
+ final TextInputControl textInputControl,
+ final Callback> suggestionProvider,
+ final StringConverter converter,
+ final AutoCompletionStrategy inputAnalyzer) {
super(textInputControl, suggestionProvider, converter);
this.converter = converter;
@@ -112,20 +114,32 @@ public T fromString(String string) {
};
}
- public static void autoComplete(TextInputControl textArea, Callback> suggestionProvider) {
+ public static void autoComplete(
+ TextInputControl textArea, Callback> suggestionProvider) {
new AutoCompletionTextInputBinding<>(textArea, suggestionProvider);
}
- public static void autoComplete(TextInputControl textArea, Callback> suggestionProvider, StringConverter converter) {
+ public static void autoComplete(
+ TextInputControl textArea,
+ Callback> suggestionProvider,
+ StringConverter converter) {
new AutoCompletionTextInputBinding<>(textArea, suggestionProvider, converter);
}
- public static AutoCompletionTextInputBinding autoComplete(TextInputControl textArea, Callback> suggestionProvider, StringConverter converter, AutoCompletionStrategy inputAnalyzer) {
+ public static AutoCompletionTextInputBinding autoComplete(
+ TextInputControl textArea,
+ Callback> suggestionProvider,
+ StringConverter converter,
+ AutoCompletionStrategy inputAnalyzer) {
return new AutoCompletionTextInputBinding<>(textArea, suggestionProvider, converter, inputAnalyzer);
}
- public static AutoCompletionTextInputBinding autoComplete(TextInputControl textArea, Callback> suggestionProvider, AutoCompletionStrategy inputAnalyzer) {
- return autoComplete(textArea, suggestionProvider, AutoCompletionTextInputBinding.defaultStringConverter(), inputAnalyzer);
+ public static AutoCompletionTextInputBinding autoComplete(
+ TextInputControl textArea,
+ Callback> suggestionProvider,
+ AutoCompletionStrategy inputAnalyzer) {
+ return autoComplete(
+ textArea, suggestionProvider, AutoCompletionTextInputBinding.defaultStringConverter(), inputAnalyzer);
}
private void setUserInputText(String newText) {
diff --git a/src/main/java/org/jabref/gui/autocompleter/BibEntrySuggestionProvider.java b/src/main/java/org/jabref/gui/autocompleter/BibEntrySuggestionProvider.java
index a69b8a3b1c1..1a2a55e9448 100644
--- a/src/main/java/org/jabref/gui/autocompleter/BibEntrySuggestionProvider.java
+++ b/src/main/java/org/jabref/gui/autocompleter/BibEntrySuggestionProvider.java
@@ -1,16 +1,15 @@
package org.jabref.gui.autocompleter;
-import java.util.Comparator;
-import java.util.stream.Stream;
-
+import com.google.common.base.Equivalence;
+import org.controlsfx.control.textfield.AutoCompletionBinding;
import org.jabref.logic.bibtex.comparator.EntryComparator;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.field.InternalField;
import org.jabref.model.strings.StringUtil;
-import com.google.common.base.Equivalence;
-import org.controlsfx.control.textfield.AutoCompletionBinding;
+import java.util.Comparator;
+import java.util.stream.Stream;
/**
* Delivers possible completions as a list of {@link BibEntry} based on their citation key.
@@ -37,8 +36,8 @@ protected Comparator