entryType = Globals.entryTypesManager.enrich(entry.getType(), databaseContext.getMode());
+ if (entryType.isPresent()) {
+ return entryType.get().getDeprecatedFields()
+ .stream()
+ .filter(entry::hasField)
+ .collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Field::getName))));
+ } else {
+ // Entry type unknown -> treat all fields as required
+ return Collections.emptySortedSet();
+ }
}
}
diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.css b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.css
index 5d7c406cb2f..799644a9839 100644
--- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.css
+++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.css
@@ -102,10 +102,23 @@
-fx-padding: 20 20 20 20;
}
+.recommendation-heading {
+ -fx-font-size: 14pt;
+ -fx-font-weight: bold;
+}
+
+.recommendation-description {
+ -fx-font-style: italic;
+}
+
+.recommendation-item {
+ -fx-padding: 0 0 0 20;
+}
+
#bibtexSourceCodeArea .search {
-fx-fill: red;
}
.bibtexSourceCodeArea .text {
-fx-fill: -fx-text-background-color;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
index 72fdf53f104..4409d08d47e 100644
--- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
+++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
@@ -7,8 +7,11 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+import java.util.Set;
import java.util.stream.Collectors;
+import javax.inject.Inject;
+
import javafx.fxml.FXML;
import javafx.geometry.Side;
import javafx.scene.control.Button;
@@ -22,7 +25,6 @@
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;
@@ -45,7 +47,9 @@
import org.jabref.logic.importer.WebFetchers;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
+import org.jabref.model.entry.field.Field;
import org.jabref.model.util.FileUpdateMonitor;
+import org.jabref.preferences.PreferencesService;
import com.airhacks.afterburner.views.ViewLoader;
import org.fxmisc.easybind.EasyBind;
@@ -54,63 +58,54 @@
import org.slf4j.LoggerFactory;
/**
- * GUI component that allows editing of the fields of a BibEntry (i.e. the
- * one that shows up, when you double click on an entry in the table)
+ * GUI component that allows editing of the fields of a BibEntry (i.e. the one that shows up, when you double click on
+ * an entry in the table)
*
* It hosts the tabs (required, general, optional) and the buttons to the left.
*
- * EntryEditor also registers itself to the event bus, receiving
- * events whenever a field of the entry changes, enabling the text fields to
- * update themselves if the change is made from somewhere else.
+ * EntryEditor also registers itself to the event bus, receiving events whenever a field of the entry changes, enabling
+ * the text fields to update themselves if the change is made from somewhere else.
*/
public class EntryEditor extends BorderPane {
private static final Logger LOGGER = LoggerFactory.getLogger(EntryEditor.class);
- private final BibDatabaseContext databaseContext;
- private final CountingUndoManager undoManager;
private final BasePanel panel;
- private Subscription typeSubscription;
+ private final BibDatabaseContext databaseContext;
+ private final EntryEditorPreferences entryEditorPreferences;
+ private final ExternalFilesEntryLinker fileLinker;
private final List tabs;
- private final FileUpdateMonitor fileMonitor;
- /**
- * A reference to the entry this editor works on.
- */
- private BibEntry entry;
+ private Subscription typeSubscription;
+ private BibEntry entry; // A reference to the entry this editor works on.
private SourceTab sourceTab;
-
@FXML private TabPane tabbed;
@FXML private Button typeChangeButton;
@FXML private Button fetcherButton;
@FXML private Label typeLabel;
-
- private final EntryEditorPreferences preferences;
- private final DialogService dialogService;
- private final ExternalFilesEntryLinker fileLinker;
- private final TaskExecutor taskExecutor;
- private final StateManager stateManager;
-
- public EntryEditor(BasePanel panel, EntryEditorPreferences preferences, FileUpdateMonitor fileMonitor, DialogService dialogService, ExternalFileTypes externalFileTypes, TaskExecutor taskExecutor, StateManager stateManager) {
+ @Inject private DialogService dialogService;
+ @Inject private TaskExecutor taskExecutor;
+ @Inject private PreferencesService preferencesService;
+ @Inject private StateManager stateManager;
+ @Inject private FileUpdateMonitor fileMonitor;
+ @Inject private CountingUndoManager undoManager;
+
+ public EntryEditor(BasePanel panel, ExternalFileTypes externalFileTypes) {
this.panel = panel;
this.databaseContext = panel.getBibDatabaseContext();
- this.undoManager = panel.getUndoManager();
- this.preferences = Objects.requireNonNull(preferences);
- this.fileMonitor = fileMonitor;
- this.dialogService = dialogService;
- this.taskExecutor = taskExecutor;
- this.stateManager = stateManager;
-
- fileLinker = new ExternalFilesEntryLinker(externalFileTypes, Globals.prefs.getFilePreferences(), databaseContext);
ViewLoader.view(this)
.root(this)
.load();
+ this.entryEditorPreferences = preferencesService.getEntryEditorPreferences();
+ this.fileLinker = new ExternalFilesEntryLinker(externalFileTypes, preferencesService.getFilePreferences(),
+ databaseContext);
+
if (GUIGlobals.currentFont != null) {
- setStyle(
- "text-area-background: " + ColorUtil.toHex(GUIGlobals.validFieldBackgroundColor) + ";"
- + "text-area-foreground: " + ColorUtil.toHex(GUIGlobals.editorTextColor) + ";"
- + "text-area-highlight: " + ColorUtil.toHex(GUIGlobals.activeBackgroundColor) + ";");
+ setStyle(String.format("text-area-background: %s;text-area-foreground: %s;text-area-highlight: %s;",
+ ColorUtil.toHex(GUIGlobals.validFieldBackgroundColor),
+ ColorUtil.toHex(GUIGlobals.editorTextColor),
+ ColorUtil.toHex(GUIGlobals.activeBackgroundColor)));
}
EasyBind.subscribe(tabbed.getSelectionModel().selectedItemProperty(), tab -> {
@@ -122,7 +117,7 @@ public EntryEditor(BasePanel panel, EntryEditorPreferences preferences, FileUpda
setupKeyBindings();
- tabs = createTabs();
+ this.tabs = createTabs();
this.setOnDragOver(event -> {
if (event.getDragboard().hasFiles()) {
@@ -134,60 +129,65 @@ public EntryEditor(BasePanel panel, EntryEditorPreferences preferences, FileUpda
this.setOnDragDropped(event -> {
BibEntry entry = this.getEntry();
boolean success = false;
+
if (event.getDragboard().hasContent(DataFormat.FILES)) {
List files = event.getDragboard().getFiles().stream().map(File::toPath).collect(Collectors.toList());
-
- FileDragDropPreferenceType dragDropPreferencesType = Globals.prefs.getEntryEditorFileLinkPreference();
+ FileDragDropPreferenceType dragDropPreferencesType = preferencesService.getEntryEditorFileLinkPreference();
if (dragDropPreferencesType == FileDragDropPreferenceType.MOVE) {
- if (event.getTransferMode() == TransferMode.LINK) //alt on win
- {
+ if (event.getTransferMode() == TransferMode.LINK) {
+ // Alt on Windows
LOGGER.debug("Mode LINK");
fileLinker.addFilesToEntry(entry, files);
- } else if (event.getTransferMode() == TransferMode.COPY) //ctrl on win, no modifier on Xubuntu
- {
+ } else if (event.getTransferMode() == TransferMode.COPY) {
+ // Ctrl on Windows, no modifier on Xubuntu
LOGGER.debug("Mode COPY");
fileLinker.copyFilesToFileDirAndAddToEntry(entry, files);
} else {
- LOGGER.debug("Mode MOVE"); //shift on win or no modifier
+ // Shift on Windows or no modifier
+ LOGGER.debug("Mode MOVE");
fileLinker.moveFilesToFileDirAndAddToEntry(entry, files);
}
+ success = true;
}
if (dragDropPreferencesType == FileDragDropPreferenceType.COPY) {
- if (event.getTransferMode() == TransferMode.COPY) //ctrl on win, no modifier on Xubuntu
- {
+ if (event.getTransferMode() == TransferMode.COPY) {
+ // Ctrl on Windows, no modifier on Xubuntu
LOGGER.debug("Mode MOVE");
fileLinker.moveFilesToFileDirAndAddToEntry(entry, files);
- } else if (event.getTransferMode() == TransferMode.LINK) //alt on win
- {
+ } else if (event.getTransferMode() == TransferMode.LINK) {
+ // Alt on Windows
LOGGER.debug("Mode LINK");
fileLinker.addFilesToEntry(entry, files);
} else {
- LOGGER.debug("Mode COPY"); //shift on win or no modifier
+ // Shift on Windows or no modifier
+ LOGGER.debug("Mode COPY");
fileLinker.copyFilesToFileDirAndAddToEntry(entry, files);
}
+ success = true;
}
if (dragDropPreferencesType == FileDragDropPreferenceType.LINK) {
- if (event.getTransferMode() == TransferMode.COPY) //ctrl on win, no modifier on Xubuntu
- {
+ if (event.getTransferMode() == TransferMode.COPY) {
+ // Ctrl on Windows, no modifier on Xubuntu
LOGGER.debug("Mode COPY");
fileLinker.copyFilesToFileDirAndAddToEntry(entry, files);
- } else if (event.getTransferMode() == TransferMode.LINK) //alt on win
- {
+ } else if (event.getTransferMode() == TransferMode.LINK) {
+ // Alt on Windows
LOGGER.debug("Mode MOVE");
fileLinker.moveFilesToFileDirAndAddToEntry(entry, files);
} else {
- LOGGER.debug("Mode LINK"); //shift on win or no modifier
+ // Shift on Windows or no modifier
+ LOGGER.debug("Mode LINK");
fileLinker.addFilesToEntry(entry, files);
}
+ success = true;
}
}
event.setDropCompleted(success);
event.consume();
-
});
}
@@ -196,7 +196,7 @@ public EntryEditor(BasePanel panel, EntryEditorPreferences preferences, FileUpda
*/
private void setupKeyBindings() {
this.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
- Optional keyBinding = preferences.getKeyBindings().mapToKeyBinding(event);
+ Optional keyBinding = entryEditorPreferences.getKeyBindings().mapToKeyBinding(event);
if (keyBinding.isPresent()) {
switch (keyBinding.get()) {
case ENTRY_EDITOR_NEXT_PANEL:
@@ -222,9 +222,6 @@ private void setupKeyBindings() {
event.consume();
break;
case CLOSE:
- close();
- event.consume();
- break;
case CLOSE_ENTRY:
close();
event.consume();
@@ -248,7 +245,8 @@ private void deleteEntry() {
@FXML
void generateCiteKeyButton() {
- GenerateBibtexKeySingleAction action = new GenerateBibtexKeySingleAction(getEntry(), databaseContext, dialogService, preferences, undoManager);
+ GenerateBibtexKeySingleAction action = new GenerateBibtexKeySingleAction(getEntry(), databaseContext,
+ dialogService, entryEditorPreferences, undoManager);
action.execute();
}
@@ -266,29 +264,36 @@ private List createTabs() {
List tabs = new LinkedList<>();
// Required fields
- tabs.add(new RequiredFieldsTab(panel.getBibDatabaseContext(), panel.getSuggestionProviders(), undoManager, dialogService));
+ tabs.add(new RequiredFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
// Optional fields
- tabs.add(new OptionalFieldsTab(panel.getBibDatabaseContext(), panel.getSuggestionProviders(), undoManager, dialogService));
- tabs.add(new OptionalFields2Tab(panel.getBibDatabaseContext(), panel.getSuggestionProviders(), undoManager, dialogService));
- tabs.add(new DeprecatedFieldsTab(panel.getBibDatabaseContext(), panel.getSuggestionProviders(), undoManager, dialogService));
+ tabs.add(new OptionalFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
+ tabs.add(new OptionalFields2Tab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
+ tabs.add(new DeprecatedFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
// Other fields
- tabs.add(new OtherFieldsTab(panel.getBibDatabaseContext(), panel.getSuggestionProviders(), undoManager, preferences.getCustomTabFieldNames(), dialogService));
+ tabs.add(new OtherFieldsTab(databaseContext, panel.getSuggestionProviders(), undoManager,
+ entryEditorPreferences.getCustomTabFieldNames(), dialogService));
// General fields from preferences
- for (Map.Entry> tab : preferences.getEntryEditorTabList().entrySet()) {
- tabs.add(new UserDefinedFieldsTab(tab.getKey(), tab.getValue(), panel.getBibDatabaseContext(), panel.getSuggestionProviders(), undoManager, dialogService));
+ for (Map.Entry> tab : entryEditorPreferences.getEntryEditorTabList().entrySet()) {
+ tabs.add(new UserDefinedFieldsTab(tab.getKey(), tab.getValue(), databaseContext, panel.getSuggestionProviders(), undoManager, dialogService));
}
// Special tabs
tabs.add(new MathSciNetTab());
tabs.add(new FileAnnotationTab(panel.getAnnotationCache()));
- tabs.add(new RelatedArticlesTab(preferences, dialogService));
+ tabs.add(new RelatedArticlesTab(this, entryEditorPreferences, dialogService));
// Source tab
- sourceTab = new SourceTab(databaseContext, undoManager, preferences.getLatexFieldFormatterPreferences(), preferences.getImportFormatPreferences(), fileMonitor, dialogService, stateManager);
+ sourceTab = new SourceTab(databaseContext, undoManager,
+ entryEditorPreferences.getLatexFieldFormatterPreferences(),
+ entryEditorPreferences.getImportFormatPreferences(), fileMonitor, dialogService, stateManager);
tabs.add(sourceTab);
+
+ // LaTeX citations tab
+ tabs.add(new LatexCitationsTab(databaseContext, preferencesService, taskExecutor, dialogService));
+
return tabs;
}
@@ -309,6 +314,7 @@ private void recalculateVisibleTabs() {
for (int i = 0; i < visibleTabs.size(); i++) {
Tab toBeAdded = visibleTabs.get(i);
Tab shown = null;
+
if (i < tabbed.getTabs().size()) {
shown = tabbed.getTabs().get(i);
}
@@ -340,7 +346,7 @@ public void setEntry(BibEntry entry) {
this.entry = entry;
recalculateVisibleTabs();
- if (preferences.showSourceTabByDefault()) {
+ if (entryEditorPreferences.showSourceTabByDefault()) {
tabbed.getSelectionModel().select(sourceTab);
}
@@ -370,9 +376,10 @@ private void setupToolBar() {
ContextMenu typeMenu = new ChangeEntryTypeMenu().getChangeEntryTypePopupMenu(entry, databaseContext, undoManager);
typeLabel.setOnMouseClicked(event -> typeMenu.show(typeLabel, Side.RIGHT, 0, 0));
typeChangeButton.setOnMouseClicked(event -> typeMenu.show(typeChangeButton, Side.RIGHT, 0, 0));
+
// Add menu for fetching bibliographic information
ContextMenu fetcherMenu = new ContextMenu();
- for (EntryBasedFetcher fetcher : WebFetchers.getEntryBasedFetchers(preferences.getImportFormatPreferences())) {
+ for (EntryBasedFetcher fetcher : WebFetchers.getEntryBasedFetchers(entryEditorPreferences.getImportFormatPreferences())) {
MenuItem fetcherMenuItem = new MenuItem(fetcher.getName());
fetcherMenuItem.setOnAction(event -> fetchAndMerge(fetcher));
fetcherMenu.getItems().add(fetcherMenuItem);
@@ -384,13 +391,13 @@ private void fetchAndMerge(EntryBasedFetcher fetcher) {
new FetchAndMergeEntry(panel, taskExecutor).fetchAndMerge(entry, fetcher);
}
- public void setFocusToField(String fieldName) {
+ public void setFocusToField(Field field) {
DefaultTaskExecutor.runInJavaFXThread(() -> {
for (Tab tab : tabbed.getTabs()) {
- if ((tab instanceof FieldsEditorTab) && ((FieldsEditorTab) tab).getShownFields().contains(fieldName)) {
+ if ((tab instanceof FieldsEditorTab) && ((FieldsEditorTab) tab).getShownFields().contains(field)) {
FieldsEditorTab fieldsEditorTab = (FieldsEditorTab) tab;
tabbed.getSelectionModel().select(tab);
- fieldsEditorTab.requestFocus(fieldName);
+ fieldsEditorTab.requestFocus(field);
}
}
});
diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditorPreferences.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditorPreferences.java
index ed059ab9f7f..b102e04d9ed 100644
--- a/src/main/java/org/jabref/gui/entryeditor/EntryEditorPreferences.java
+++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditorPreferences.java
@@ -2,26 +2,29 @@
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.logic.bibtex.LatexFieldFormatterPreferences;
import org.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences;
import org.jabref.logic.importer.ImportFormatPreferences;
+import org.jabref.model.entry.field.Field;
public class EntryEditorPreferences {
- private final Map> entryEditorTabList;
+ private final Map> entryEditorTabList;
private final LatexFieldFormatterPreferences latexFieldFormatterPreferences;
private final ImportFormatPreferences importFormatPreferences;
private final BibtexKeyPatternPreferences bibtexKeyPatternPreferences;
- private final List customTabFieldNames;
+ private final List customTabFieldNames;
private final boolean shouldShowRecommendationsTab;
private final boolean isMrdlibAccepted;
private boolean showSourceTabByDefault;
private final KeyBindingRepository keyBindings;
private boolean avoidOverwritingCiteKey;
+ private final boolean shouldShowLatexCitationsTab;
- public EntryEditorPreferences(Map> entryEditorTabList, LatexFieldFormatterPreferences latexFieldFormatterPreferences, ImportFormatPreferences importFormatPreferences, List customTabFieldNames, boolean shouldShowRecommendationsTab, boolean isMrdlibAccepted, boolean showSourceTabByDefault, BibtexKeyPatternPreferences bibtexKeyPatternPreferences, KeyBindingRepository keyBindings, boolean avoidOverwritingCiteKey) {
+ public EntryEditorPreferences(Map> entryEditorTabList, LatexFieldFormatterPreferences latexFieldFormatterPreferences, ImportFormatPreferences importFormatPreferences, List customTabFieldNames, boolean shouldShowRecommendationsTab, boolean isMrdlibAccepted, boolean shouldShowLatexCitationsTab, boolean showSourceTabByDefault, BibtexKeyPatternPreferences bibtexKeyPatternPreferences, KeyBindingRepository keyBindings, boolean avoidOverwritingCiteKey) {
this.entryEditorTabList = entryEditorTabList;
this.latexFieldFormatterPreferences = latexFieldFormatterPreferences;
this.importFormatPreferences = importFormatPreferences;
@@ -32,9 +35,10 @@ public EntryEditorPreferences(Map> entryEditorTabList, Late
this.bibtexKeyPatternPreferences = bibtexKeyPatternPreferences;
this.keyBindings = keyBindings;
this.avoidOverwritingCiteKey = avoidOverwritingCiteKey;
+ this.shouldShowLatexCitationsTab = shouldShowLatexCitationsTab;
}
- public Map> getEntryEditorTabList() {
+ public Map> getEntryEditorTabList() {
return entryEditorTabList;
}
@@ -46,7 +50,7 @@ public ImportFormatPreferences getImportFormatPreferences() {
return importFormatPreferences;
}
- public List getCustomTabFieldNames() {
+ public List getCustomTabFieldNames() {
return customTabFieldNames;
}
@@ -78,6 +82,10 @@ public void setShowSourceTabByDefault(boolean showSourceTabByDefault) {
this.showSourceTabByDefault = showSourceTabByDefault;
}
+ public boolean shouldShowLatexCitationsTab() {
+ return shouldShowLatexCitationsTab;
+ }
+
public boolean avoidOverwritingCiteKey() {
return avoidOverwritingCiteKey;
}
diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java
index edaa93a2b47..0b8acb1ea94 100644
--- a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java
+++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java
@@ -3,6 +3,7 @@
import javafx.scene.control.Tab;
import org.jabref.model.entry.BibEntry;
+import org.jabref.model.entry.EntryType;
public abstract class EntryEditorTab extends Tab {
@@ -11,7 +12,7 @@ public abstract class EntryEditorTab extends Tab {
/**
* Needed to track for which type of entry this tab was build and to rebuild it if the type changes
*/
- private String currentEntryType = "";
+ private EntryType currentEntryType;
/**
* Decide whether to show this tab for the given entry.
@@ -35,7 +36,7 @@ protected void handleFocus() {
* Notifies the tab that it got focus and should display the given entry.
*/
public void notifyAboutFocus(BibEntry entry) {
- if (!entry.equals(currentEntry) || !currentEntryType.equals(entry.getType())) {
+ if (!entry.equals(currentEntry) || !entry.getType().equals(currentEntryType)) {
currentEntry = entry;
currentEntryType = entry.getType();
bindToEntry(entry);
diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java
index 49a337788a9..d9caa0d9c28 100644
--- a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java
+++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTabList.java
@@ -1,10 +1,11 @@
package org.jabref.gui.entryeditor;
-import java.util.Arrays;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
+import java.util.Set;
+import org.jabref.model.entry.field.Field;
+import org.jabref.model.entry.field.FieldFactory;
import org.jabref.preferences.JabRefPreferences;
/**
@@ -16,16 +17,15 @@ private EntryEditorTabList() {
}
- public static Map> create(JabRefPreferences preferences) {
- Map> tabs = new LinkedHashMap<>();
+ public static Map> create(JabRefPreferences preferences) {
+ Map> tabs = new LinkedHashMap<>();
int i = 0;
String name;
if (preferences.hasKey(JabRefPreferences.CUSTOM_TAB_NAME + 0)) {
// The user has modified from the default values:
while (preferences.hasKey(JabRefPreferences.CUSTOM_TAB_NAME + i)) {
name = preferences.get(JabRefPreferences.CUSTOM_TAB_NAME + i);
- List entry = Arrays
- .asList(preferences.get(JabRefPreferences.CUSTOM_TAB_FIELDS + i).split(";"));
+ Set entry = FieldFactory.parseFieldList(preferences.get(JabRefPreferences.CUSTOM_TAB_FIELDS + i));
tabs.put(name, entry);
i++;
}
@@ -33,8 +33,7 @@ public static Map> create(JabRefPreferences preferences) {
// Nothing set, so we use the default values:
while (preferences.get(JabRefPreferences.CUSTOM_TAB_NAME + "_def" + i) != null) {
name = preferences.get(JabRefPreferences.CUSTOM_TAB_NAME + "_def" + i);
- List entry = Arrays
- .asList(preferences.get(JabRefPreferences.CUSTOM_TAB_FIELDS + "_def" + i).split(";"));
+ Set entry = FieldFactory.parseFieldList(preferences.get(JabRefPreferences.CUSTOM_TAB_FIELDS + "_def" + i));
tabs.put(name, entry);
i++;
}
diff --git a/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java b/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
index 26f22eb2b6f..9a2b7f35ead 100644
--- a/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
+++ b/src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
@@ -7,6 +7,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import java.util.SortedSet;
import java.util.stream.Stream;
import javax.swing.undo.UndoManager;
@@ -30,28 +31,25 @@
import org.jabref.gui.fieldeditors.FieldEditors;
import org.jabref.gui.fieldeditors.FieldNameLabel;
import org.jabref.logic.l10n.Localization;
-import org.jabref.model.EntryTypes;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
-import org.jabref.model.entry.EntryType;
-import org.jabref.model.entry.FieldName;
-import org.jabref.model.entry.FieldProperty;
-import org.jabref.model.entry.InternalBibtexFields;
+import org.jabref.model.entry.field.Field;
+import org.jabref.model.entry.field.FieldProperty;
+import org.jabref.model.entry.field.StandardField;
/**
* A single tab displayed in the EntryEditor holding several FieldEditors.
*/
abstract class FieldsEditorTab extends EntryEditorTab {
- private final Map editors = new LinkedHashMap<>();
+ protected final BibDatabaseContext databaseContext;
+ private final Map editors = new LinkedHashMap<>();
private final boolean isCompressed;
private final SuggestionProviders suggestionProviders;
-
+ private final DialogService dialogService;
private FieldEditorFX activeField;
- private final BibDatabaseContext databaseContext;
private UndoManager undoManager;
- private Collection fields = new ArrayList<>();
- private final DialogService dialogService;
+ private Collection fields = new ArrayList<>();
private GridPane gridPane;
public FieldsEditorTab(boolean compressed, BibDatabaseContext databaseContext, SuggestionProviders suggestionProviders, UndoManager undoManager, DialogService dialogService) {
@@ -82,24 +80,23 @@ private void setupPanel(BibEntry entry, boolean compressed, SuggestionProviders
gridPane.getColumnConstraints().clear();
gridPane.getRowConstraints().clear();
- EntryType entryType = EntryTypes.getTypeOrDefault(entry.getType(), databaseContext.getMode());
- fields = determineFieldsToShow(entry, entryType);
+ fields = determineFieldsToShow(entry);
List