diff --git a/.idea/runConfigurations/JabRef_Main.xml b/.idea/runConfigurations/JabRef_Main.xml
index 7099a883e17..048f2dd8126 100644
--- a/.idea/runConfigurations/JabRef_Main.xml
+++ b/.idea/runConfigurations/JabRef_Main.xml
@@ -1,7 +1,5 @@
-
-
@@ -11,4 +9,4 @@
-
\ No newline at end of file
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4436b5ab901..7979b1a365d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We added a short DOI field formatter which shortens DOI to more human-readable form. [koppor#343](https://github.com/koppor/jabref/issues/343)
- We improved the display of group memberships by adding multiple colored bars if the entry belongs to more than one group. [#4574](https://github.com/JabRef/jabref/issues/4574)
+- We added an option to show the preview as an extra tab in the entry editor (instead of in a split view). [#5244](https://github.com/JabRef/jabref/issues/5244)
### Fixed
diff --git a/src/main/java/org/jabref/gui/BasePanel.java b/src/main/java/org/jabref/gui/BasePanel.java
index 4f4f6b2417c..fc5c9ed8d59 100644
--- a/src/main/java/org/jabref/gui/BasePanel.java
+++ b/src/main/java/org/jabref/gui/BasePanel.java
@@ -676,7 +676,7 @@ private void createMainTable() {
String clearSearch = "clearSearch";
mainTable.getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.CLEAR_SEARCH), clearSearch);
mainTable.getActionMap().put(clearSearch, new AbstractAction() {
-
+
@Override
public void actionPerformed(ActionEvent e) {
// need to close these here, b/c this action overshadows the responsible actions when the main table is selected
@@ -697,9 +697,9 @@ public void actionPerformed(ActionEvent e) {
}
}
});
-
+
mainTable.getActionMap().put(Actions.CUT, new AbstractAction() {
-
+
@Override
public void actionPerformed(ActionEvent e) {
try {
@@ -710,7 +710,7 @@ public void actionPerformed(ActionEvent e) {
}
});
mainTable.getActionMap().put(Actions.COPY, new AbstractAction() {
-
+
@Override
public void actionPerformed(ActionEvent e) {
try {
@@ -721,7 +721,7 @@ public void actionPerformed(ActionEvent e) {
}
});
mainTable.getActionMap().put(Actions.PASTE, new AbstractAction() {
-
+
@Override
public void actionPerformed(ActionEvent e) {
try {
@@ -749,10 +749,8 @@ public void setupMainPanel() {
splitPane.getItems().add(pane);
// Set up name autocompleter for search:
- executorService.execute(() -> {
- instantiateSearchAutoCompleter();
- setupAutoCompletion();
- });
+ setupAutoCompletion();
+ executorService.execute(this::instantiateSearchAutoCompleter);
this.getDatabase().registerListener(new SearchAutoCompleteListener());
// Saves the divider position as soon as it changes
diff --git a/src/main/java/org/jabref/gui/entryeditor/DeprecatedFieldsTab.java b/src/main/java/org/jabref/gui/entryeditor/DeprecatedFieldsTab.java
index a6be86e5b8d..c3b7b224a40 100644
--- a/src/main/java/org/jabref/gui/entryeditor/DeprecatedFieldsTab.java
+++ b/src/main/java/org/jabref/gui/entryeditor/DeprecatedFieldsTab.java
@@ -11,19 +11,27 @@
import javafx.scene.control.Tooltip;
-import org.jabref.Globals;
import org.jabref.gui.DialogService;
import org.jabref.gui.autocompleter.SuggestionProviders;
+import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.icon.IconTheme;
+import org.jabref.gui.util.TaskExecutor;
+import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.BibEntryType;
+import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.entry.field.Field;
+import org.jabref.preferences.JabRefPreferences;
public class DeprecatedFieldsTab extends FieldsEditorTab {
- public DeprecatedFieldsTab(BibDatabaseContext databaseContext, SuggestionProviders suggestionProviders, UndoManager undoManager, DialogService dialogService) {
- super(false, databaseContext, suggestionProviders, undoManager, dialogService);
+
+ private final BibEntryTypesManager entryTypesManager;
+
+ public DeprecatedFieldsTab(BibDatabaseContext databaseContext, SuggestionProviders suggestionProviders, UndoManager undoManager, DialogService dialogService, JabRefPreferences preferences, BibEntryTypesManager entryTypesManager, ExternalFileTypes externalFileTypes, TaskExecutor taskExecutor, JournalAbbreviationLoader journalAbbreviationLoader) {
+ super(false, databaseContext, suggestionProviders, undoManager, dialogService, preferences, externalFileTypes, taskExecutor, journalAbbreviationLoader);
+ this.entryTypesManager = entryTypesManager;
setText(Localization.lang("Deprecated fields"));
setTooltip(new Tooltip(Localization.lang("Show deprecated BibTeX fields")));
@@ -32,7 +40,7 @@ public DeprecatedFieldsTab(BibDatabaseContext databaseContext, SuggestionProvide
@Override
protected SortedSet determineFieldsToShow(BibEntry entry) {
- Optional entryType = Globals.entryTypesManager.enrich(entry.getType(), databaseContext.getMode());
+ Optional entryType = entryTypesManager.enrich(entry.getType(), databaseContext.getMode());
if (entryType.isPresent()) {
return entryType.get().getDeprecatedFields()
.stream()
diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
index 9bd2a2a9c4c..02efa83d935 100644
--- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
+++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
@@ -25,6 +25,7 @@
import javafx.scene.input.TransferMode;
import javafx.scene.layout.BorderPane;
+import org.jabref.Globals;
import org.jabref.gui.BasePanel;
import org.jabref.gui.DialogService;
import org.jabref.gui.GUIGlobals;
@@ -262,22 +263,23 @@ private void navigateToNextEntry() {
}
private List createTabs() {
+ // Preview tab
+ entryEditorTabs.add(new PreviewTab(databaseContext, dialogService, Globals.prefs, ExternalFileTypes.getInstance()));
// Required fields
- entryEditorTabs.add(new RequiredFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
+ entryEditorTabs.add(new RequiredFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService, Globals.prefs, Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationLoader));
// Optional fields
- entryEditorTabs.add(new OptionalFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
- entryEditorTabs.add(new OptionalFields2Tab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
- entryEditorTabs.add(new DeprecatedFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
+ entryEditorTabs.add(new OptionalFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService, Globals.prefs, Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationLoader));
+ entryEditorTabs.add(new OptionalFields2Tab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService, Globals.prefs, Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationLoader));
+ entryEditorTabs.add(new DeprecatedFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService, Globals.prefs, Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationLoader));
// Other fields
- entryEditorTabs.add(new OtherFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager,
- entryEditorPreferences.getCustomTabFieldNames(), dialogService));
+ entryEditorTabs.add(new OtherFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, entryEditorPreferences.getCustomTabFieldNames(), dialogService, Globals.prefs, Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationLoader));
// General fields from preferences
for (Map.Entry> tab : entryEditorPreferences.getEntryEditorTabList().entrySet()) {
- entryEditorTabs.add(new UserDefinedFieldsTab(tab.getKey(), tab.getValue(), databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
+ entryEditorTabs.add(new UserDefinedFieldsTab(tab.getKey(), tab.getValue(), databaseContext, panel.getSuggestionProviders(), undoManager, dialogService, Globals.prefs, Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationLoader));
}
// Special tabs
diff --git a/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java b/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
index ec62128dbc2..603450b39ce 100644
--- a/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
+++ b/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
@@ -5,6 +5,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.SortedSet;
import java.util.stream.Stream;
@@ -22,7 +23,6 @@
import javafx.scene.layout.Region;
import javafx.scene.layout.RowConstraints;
-import org.jabref.Globals;
import org.jabref.gui.DialogService;
import org.jabref.gui.autocompleter.SuggestionProviders;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
@@ -30,9 +30,12 @@
import org.jabref.gui.fieldeditors.FieldEditors;
import org.jabref.gui.fieldeditors.FieldNameLabel;
import org.jabref.gui.preview.PreviewPanel;
+import org.jabref.gui.util.TaskExecutor;
+import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.field.Field;
+import org.jabref.preferences.JabRefPreferences;
/**
* A single tab displayed in the EntryEditor holding several FieldEditors.
@@ -43,17 +46,25 @@ abstract class FieldsEditorTab extends EntryEditorTab {
private final boolean isCompressed;
private final SuggestionProviders suggestionProviders;
private final DialogService dialogService;
+ private final JabRefPreferences preferences;
+ private final ExternalFileTypes externalFileTypes;
+ private final TaskExecutor taskExecutor;
+ private final JournalAbbreviationLoader journalAbbreviationLoader;
private PreviewPanel previewPanel;
private UndoManager undoManager;
private Collection fields = new ArrayList<>();
private GridPane gridPane;
- public FieldsEditorTab(boolean compressed, BibDatabaseContext databaseContext, SuggestionProviders suggestionProviders, UndoManager undoManager, DialogService dialogService) {
+ public FieldsEditorTab(boolean compressed, BibDatabaseContext databaseContext, SuggestionProviders suggestionProviders, UndoManager undoManager, DialogService dialogService, JabRefPreferences preferences, ExternalFileTypes externalFileTypes, TaskExecutor taskExecutor, JournalAbbreviationLoader journalAbbreviationLoader) {
this.isCompressed = compressed;
- this.databaseContext = databaseContext;
- this.suggestionProviders = suggestionProviders;
- this.undoManager = undoManager;
- this.dialogService = dialogService;
+ this.databaseContext = Objects.requireNonNull(databaseContext);
+ this.suggestionProviders = Objects.requireNonNull(suggestionProviders);
+ this.undoManager = Objects.requireNonNull(undoManager);
+ this.dialogService = Objects.requireNonNull(dialogService);
+ this.preferences = Objects.requireNonNull(preferences);
+ this.externalFileTypes = Objects.requireNonNull(externalFileTypes);
+ this.taskExecutor = Objects.requireNonNull(taskExecutor);
+ this.journalAbbreviationLoader = Objects.requireNonNull(journalAbbreviationLoader);
}
private static void addColumn(GridPane gridPane, int columnIndex, List