From c9566c2a92d460c05282544cf12c9908163a2b93 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 31 May 2017 10:13:35 +0200 Subject: [PATCH] Fix entry editor (#2875) * Remove setEntry method from entry editors * Try to add scrollbar to entry editor * Fix #2843 and #2851: entry editor works again --- .../jabref/gui/entryeditor/EntryEditor.java | 14 -------------- .../gui/entryeditor/EntryEditorTab.java | 19 +++---------------- .../gui/fieldeditors/LinkedFilesEditor.fxml | 2 +- .../gui/fieldeditors/LinkedFilesEditor.java | 3 ++- 4 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 1248848e91a..fbe311ceab5 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -80,7 +80,6 @@ import org.jabref.gui.undo.UndoableFieldChange; import org.jabref.gui.undo.UndoableKeyChange; import org.jabref.gui.undo.UndoableRemoveEntry; -import org.jabref.gui.util.DefaultTaskExecutor; import org.jabref.gui.util.component.CheckBoxMessage; import org.jabref.gui.util.component.VerticalLabelUI; import org.jabref.logic.TypedBibEntry; @@ -239,8 +238,6 @@ public EntryEditor(JabRefFrame frame, BasePanel panel, BibEntry entry) { if (Globals.prefs.getBoolean(JabRefPreferences.DEFAULT_SHOW_SOURCE)) { tabbed.setSelectedIndex(sourceIndex); } - - DefaultTaskExecutor.runInJavaFXThread(() -> setEntry(entry)); } private static String getSourceString(BibEntry entry, BibDatabaseMode type) throws IOException { @@ -457,17 +454,6 @@ public BibEntry getEntry() { return entry; } - /** - * Sets all the text areas according to the shown entry. - */ - private void setEntry(BibEntry entry) { - for (Object tab : tabs) { - if (tab instanceof EntryEditorTab) { - ((EntryEditorTab) tab).setEntry(entry); - } - } - } - public BibDatabase getDatabase() { return panel.getDatabase(); } diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java index 108fd807219..41b0da274b7 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java @@ -55,7 +55,6 @@ class EntryEditorTab { private final BasePanel basePanel; private FieldEditorFX activeField; private BibEntry entry; - private boolean updating; public EntryEditorTab(JabRefFrame frame, BasePanel basePanel, List fields, EntryEditor parent, boolean addKeyField, boolean compressed, String tabTitle, BibEntry entry) { @@ -152,9 +151,9 @@ private Region setupPanel(JabRefFrame frame, BasePanel bPanel, boolean addKeyFie fieldEditor.setAutoCompleteListener(autoCompleteListener); */ - FieldEditorFX fieldEditor = FieldEditors.getForField(fieldName, Globals.taskExecutor, new FXDialogService(), - Globals.journalAbbreviationLoader, Globals.prefs.getJournalAbbreviationPreferences(), Globals.prefs, - bPanel.getBibDatabaseContext(), entry.getType()); + FieldEditorFX fieldEditor = FieldEditors.getForField(fieldName, Globals.taskExecutor, new FXDialogService(), Globals.journalAbbreviationLoader, Globals.prefs.getJournalAbbreviationPreferences(), Globals.prefs, bPanel.getBibDatabaseContext(), entry.getType()); + fieldEditor.bindToEntry(entry); + editors.put(fieldName, fieldEditor); /* // TODO: Reenable this @@ -252,18 +251,6 @@ private String getPrompt(String field) { return ""; } - public void setEntry(BibEntry entry) { - try { - updating = true; - for (FieldEditorFX editor : editors.values()) { - editor.bindToEntry(entry); - } - this.entry = entry; - } finally { - updating = false; - } - } - /** * Only sets the activeField variable but does not focus it. *

diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml index b401b307b4c..a7e1d840b2a 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml @@ -8,7 +8,7 @@ - +