|
58 | 58 | import org.jabref.gui.maintable.MainTableDataModel;
|
59 | 59 | import org.jabref.gui.mergeentries.MergeEntriesAction;
|
60 | 60 | import org.jabref.gui.mergeentries.MergeWithFetchedEntryAction;
|
| 61 | +import org.jabref.gui.preview.CitationStyleToClipboardWorker; |
| 62 | +import org.jabref.gui.preview.PreviewPanel; |
61 | 63 | import org.jabref.gui.specialfields.SpecialFieldDatabaseChangeListener;
|
62 | 64 | import org.jabref.gui.specialfields.SpecialFieldValueViewModel;
|
63 | 65 | import org.jabref.gui.specialfields.SpecialFieldViewModel;
|
|
67 | 69 | import org.jabref.gui.undo.UndoableInsertEntry;
|
68 | 70 | import org.jabref.gui.undo.UndoableRemoveEntry;
|
69 | 71 | import org.jabref.gui.util.DefaultTaskExecutor;
|
70 |
| -import org.jabref.gui.worker.CitationStyleToClipboardWorker; |
71 | 72 | import org.jabref.gui.worker.SendAsEMailAction;
|
72 | 73 | import org.jabref.logic.citationstyle.CitationStyleCache;
|
73 | 74 | import org.jabref.logic.citationstyle.CitationStyleOutputFormat;
|
@@ -130,30 +131,25 @@ public class BasePanel extends StackPane {
|
130 | 131 | private final ExternalFileTypes externalFileTypes;
|
131 | 132 |
|
132 | 133 | private final EntryEditor entryEditor;
|
| 134 | + private final DialogService dialogService; |
133 | 135 | private MainTable mainTable;
|
134 | 136 | // To contain instantiated entry editors. This is to save time
|
135 | 137 | // As most enums, this must not be null
|
136 | 138 | private BasePanelMode mode = BasePanelMode.SHOWING_NOTHING;
|
137 | 139 | private SplitPane splitPane;
|
138 | 140 | private DatabaseChangePane changePane;
|
139 | 141 | private boolean saving;
|
140 |
| - |
141 | 142 | // AutoCompleter used in the search bar
|
142 | 143 | private PersonNameSuggestionProvider searchAutoCompleter;
|
143 | 144 | private boolean baseChanged;
|
144 | 145 | private boolean nonUndoableChange;
|
145 | 146 | // Used to track whether the base has changed since last save.
|
146 | 147 | private BibEntry showing;
|
147 |
| - |
148 | 148 | private SuggestionProviders suggestionProviders;
|
149 |
| - |
150 | 149 | @SuppressWarnings({"FieldCanBeLocal", "unused"}) private Subscription dividerPositionSubscription;
|
151 |
| - |
152 | 150 | // the query the user searches when this BasePanel is active
|
153 | 151 | private Optional<SearchQuery> currentSearchQuery = Optional.empty();
|
154 |
| - |
155 | 152 | private Optional<DatabaseChangeMonitor> changeMonitor = Optional.empty();
|
156 |
| - private final DialogService dialogService; |
157 | 153 |
|
158 | 154 | public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabaseContext bibDatabaseContext, ExternalFileTypes externalFileTypes) {
|
159 | 155 | this.preferences = Objects.requireNonNull(preferences);
|
@@ -188,7 +184,8 @@ public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabas
|
188 | 184 |
|
189 | 185 | this.entryEditor = new EntryEditor(this, preferences.getEntryEditorPreferences(), Globals.getFileUpdateMonitor(), dialogService, externalFileTypes, Globals.TASK_EXECUTOR);
|
190 | 186 |
|
191 |
| - this.preview = new PreviewPanel(this, getBibDatabaseContext(), preferences.getKeyBindings(), preferences.getPreviewPreferences(), dialogService, externalFileTypes); |
| 187 | + this.preview = new PreviewPanel(getBibDatabaseContext(), this, dialogService, externalFileTypes, Globals.getKeyPrefs(), preferences.getPreviewPreferences()); |
| 188 | + frame().getGlobalSearchBar().getSearchQueryHighlightObservable().addSearchListener(preview); |
192 | 189 | }
|
193 | 190 |
|
194 | 191 | @Subscribe
|
@@ -953,7 +950,7 @@ public void entryEditorClosing(EntryEditor editor) {
|
953 | 950 | */
|
954 | 951 | public void ensureNotShowingBottomPanel(BibEntry entry) {
|
955 | 952 | if (((mode == BasePanelMode.SHOWING_EDITOR) && (entryEditor.getEntry() == entry))
|
956 |
| - || ((mode == BasePanelMode.SHOWING_PREVIEW) && (preview.getEntry() == entry))) { |
| 953 | + || ((mode == BasePanelMode.SHOWING_PREVIEW))) { |
957 | 954 | closeBottomPane();
|
958 | 955 | }
|
959 | 956 | }
|
@@ -1139,10 +1136,6 @@ public CitationStyleCache getCitationStyleCache() {
|
1139 | 1136 | return citationStyleCache;
|
1140 | 1137 | }
|
1141 | 1138 |
|
1142 |
| - public PreviewPanel getPreviewPanel() { |
1143 |
| - return preview; |
1144 |
| - } |
1145 |
| - |
1146 | 1139 | public FileAnnotationCache getAnnotationCache() {
|
1147 | 1140 | return annotationCache;
|
1148 | 1141 | }
|
@@ -1172,6 +1165,11 @@ public void cut() {
|
1172 | 1165 | mainTable.cut();
|
1173 | 1166 | }
|
1174 | 1167 |
|
| 1168 | + @Subscribe |
| 1169 | + public void listen(EntryChangedEvent entryChangedEvent) { |
| 1170 | + this.markBaseChanged(); |
| 1171 | + } |
| 1172 | + |
1175 | 1173 | private static class SearchAndOpenFile {
|
1176 | 1174 |
|
1177 | 1175 | private final BibEntry entry;
|
@@ -1280,11 +1278,6 @@ public void listen(EntryRemovedEvent removedEntryEvent) {
|
1280 | 1278 | }
|
1281 | 1279 | }
|
1282 | 1280 |
|
1283 |
| - @Subscribe |
1284 |
| - public void listen(EntryChangedEvent entryChangedEvent) { |
1285 |
| - this.markBaseChanged(); |
1286 |
| - } |
1287 |
| - |
1288 | 1281 | private class UndoAction implements BaseAction {
|
1289 | 1282 |
|
1290 | 1283 | @Override
|
|
0 commit comments