Skip to content
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
### Changed

- We integrated the external file types dialog directly inside the preferences. [#8341](https://github.com/JabRef/jabref/pull/8341)
- We moved the search box in preview preferences closer to the available citation styles list. [#8370](https://github.com/JabRef/jabref/pull/8370)
- Changing the preference to show the preview panel as a separate tab now has effect without restarting JabRef. [#8370](https://github.com/JabRef/jabref/pull/8370)
- We enabled switching themes in JabRef without the need to restart JabRef. [#7335](https://github.com/JabRef/jabref/pull/7335)

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.COPY_CITE_KEY, new CopyMoreAction(StandardActions.COPY_CITE_KEY, dialogService, stateManager, Globals.getClipboardManager(), prefs)),
factory.createMenuItem(StandardActions.COPY_KEY_AND_TITLE, new CopyMoreAction(StandardActions.COPY_KEY_AND_TITLE, dialogService, stateManager, Globals.getClipboardManager(), prefs)),
factory.createMenuItem(StandardActions.COPY_KEY_AND_LINK, new CopyMoreAction(StandardActions.COPY_KEY_AND_LINK, dialogService, stateManager, Globals.getClipboardManager(), prefs)),
factory.createMenuItem(StandardActions.COPY_CITATION_PREVIEW, new CopyCitationAction(CitationStyleOutputFormat.HTML, dialogService, stateManager, Globals.getClipboardManager(), prefs.getPreviewPreferences())),
factory.createMenuItem(StandardActions.COPY_CITATION_PREVIEW, new CopyCitationAction(CitationStyleOutputFormat.HTML, dialogService, stateManager, Globals.getClipboardManager(), Globals.TASK_EXECUTOR, prefs.getPreviewPreferences())),
factory.createMenuItem(StandardActions.EXPORT_SELECTED_TO_CLIPBOARD, new ExportToClipboardAction(dialogService, Globals.exportFactory, stateManager, Globals.getClipboardManager(), Globals.TASK_EXECUTOR, prefs))),

factory.createMenuItem(StandardActions.PASTE, new EditAction(StandardActions.PASTE, this, stateManager)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void makeChange(BibDatabaseContext database, NamedCompound undoEdit) {
@Override
public Node description() {
PreviewViewer previewViewer = new PreviewViewer(new BibDatabaseContext(), dialogService, stateManager, themeManager);
previewViewer.setLayout(preferencesService.getPreviewPreferences().getCurrentPreviewStyle());
previewViewer.setLayout(preferencesService.getPreviewPreferences().getSelectedPreviewLayout());
previewViewer.setEntry(entry);
return previewViewer;
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/jabref/gui/edit/CopyMoreAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ public class CopyMoreAction extends SimpleCommand {
private final ClipBoardManager clipBoardManager;
private final PreferencesService preferencesService;

public CopyMoreAction(StandardActions action, DialogService dialogService, StateManager stateManager, ClipBoardManager clipBoardManager, PreferencesService preferencesService) {
public CopyMoreAction(StandardActions action,
DialogService dialogService,
StateManager stateManager,
ClipBoardManager clipBoardManager,
PreferencesService preferencesService) {
this.action = action;
this.dialogService = dialogService;
this.stateManager = stateManager;
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.jabref.logic.importer.fileformat.PdfMergeMetadataImporter;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.entry.field.Field;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;
Expand Down Expand Up @@ -104,6 +105,8 @@ public class EntryEditor extends BorderPane {
@Inject private ThemeManager themeManager;
@Inject private FileUpdateMonitor fileMonitor;
@Inject private CountingUndoManager undoManager;
@Inject private BibEntryTypesManager bibEntryTypesManager;

private final List<EntryEditorTab> entryEditorTabs = new LinkedList<>();

public EntryEditor(LibraryTab libraryTab, ExternalFileTypes externalFileTypes) {
Expand Down Expand Up @@ -238,19 +241,19 @@ private List<EntryEditorTab> createTabs() {
entryEditorTabs.add(new PreviewTab(databaseContext, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), ExternalFileTypes.getInstance()));

// Required fields
entryEditorTabs.add(new RequiredFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationRepository));
entryEditorTabs.add(new RequiredFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, ExternalFileTypes.getInstance(), taskExecutor, Globals.journalAbbreviationRepository));

// Optional fields
entryEditorTabs.add(new OptionalFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationRepository));
entryEditorTabs.add(new OptionalFields2Tab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationRepository));
entryEditorTabs.add(new DeprecatedFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationRepository));
entryEditorTabs.add(new OptionalFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, ExternalFileTypes.getInstance(), taskExecutor, Globals.journalAbbreviationRepository));
entryEditorTabs.add(new OptionalFields2Tab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, ExternalFileTypes.getInstance(), taskExecutor, Globals.journalAbbreviationRepository));
entryEditorTabs.add(new DeprecatedFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, ExternalFileTypes.getInstance(), taskExecutor, Globals.journalAbbreviationRepository));

// Other fields
entryEditorTabs.add(new OtherFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationRepository));
entryEditorTabs.add(new OtherFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, ExternalFileTypes.getInstance(), taskExecutor, Globals.journalAbbreviationRepository));

// General fields from preferences
for (Map.Entry<String, Set<Field>> tab : entryEditorPreferences.getEntryEditorTabList().entrySet()) {
entryEditorTabs.add(new UserDefinedFieldsTab(tab.getKey(), tab.getValue(), databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), Globals.entryTypesManager, ExternalFileTypes.getInstance(), Globals.TASK_EXECUTOR, Globals.journalAbbreviationRepository));
entryEditorTabs.add(new UserDefinedFieldsTab(tab.getKey(), tab.getValue(), databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, ExternalFileTypes.getInstance(), taskExecutor, Globals.journalAbbreviationRepository));
}

// Special tabs
Expand Down Expand Up @@ -327,6 +330,9 @@ public void setEntry(BibEntry entry) {
this.entry = entry;

recalculateVisibleTabs();
EasyBind.listen(preferencesService.getPreviewPreferences().showPreviewAsExtraTabProperty(),
(obs, oldValue, newValue) -> recalculateVisibleTabs());

if (entryEditorPreferences.showSourceTabByDefault()) {
tabbed.getSelectionModel().select(sourceTab);
}
Expand Down
29 changes: 21 additions & 8 deletions src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import org.jabref.model.entry.field.Field;
import org.jabref.preferences.PreferencesService;

import com.tobiasdiez.easybind.EasyBind;

/**
* A single tab displayed in the EntryEditor holding several FieldEditors.
*/
Expand Down Expand Up @@ -71,7 +73,8 @@ public FieldsEditorTab(boolean compressed,
ThemeManager themeManager,
ExternalFileTypes externalFileTypes,
TaskExecutor taskExecutor,
JournalAbbreviationRepository journalAbbreviationRepository, IndexingTaskManager indexingTaskManager) {
JournalAbbreviationRepository journalAbbreviationRepository,
IndexingTaskManager indexingTaskManager) {
this.isCompressed = compressed;
this.databaseContext = Objects.requireNonNull(databaseContext);
this.suggestionProviders = Objects.requireNonNull(suggestionProviders);
Expand Down Expand Up @@ -110,9 +113,16 @@ private void setupPanel(BibEntry entry, boolean compressed) {

List<Label> labels = new ArrayList<>();
for (Field field : fields) {
FieldEditorFX fieldEditor = FieldEditors.getForField(field, taskExecutor, dialogService,
FieldEditorFX fieldEditor = FieldEditors.getForField(
field,
taskExecutor,
dialogService,
journalAbbreviationRepository,
preferences, databaseContext, entry.getType(), suggestionProviders, undoManager);
preferences,
databaseContext,
entry.getType(),
suggestionProviders,
undoManager);
fieldEditor.bindToEntry(entry);

editors.put(field, fieldEditor);
Expand Down Expand Up @@ -236,11 +246,14 @@ private void initPanel() {
scrollPane.setFitToHeight(true);

SplitPane container = new SplitPane(scrollPane);
if (!preferences.getPreviewPreferences().showPreviewAsExtraTab()) {
previewPanel = new PreviewPanel(databaseContext, dialogService, externalFileTypes, preferences.getKeyBindingRepository(), preferences, stateManager, themeManager, indexingTaskManager);
container.getItems().add(previewPanel);
}

previewPanel = new PreviewPanel(databaseContext, dialogService, externalFileTypes, preferences.getKeyBindingRepository(), preferences, stateManager, themeManager, indexingTaskManager);
EasyBind.subscribe(preferences.getPreviewPreferences().showPreviewAsExtraTabProperty(), show -> {
if (show) {
container.getItems().remove(previewPanel);
} else {
container.getItems().add(1, previewPanel);
}
});
setContent(container);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/entryeditor/PreviewTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected void previousPreviewStyle() {

@Override
public boolean shouldShow(BibEntry entry) {
return preferences.getPreviewPreferences().showPreviewAsExtraTab();
return preferences.getPreviewPreferences().shouldShowPreviewAsExtraTab();
}

@Override
Expand Down
18 changes: 8 additions & 10 deletions src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.database.event.EntriesAddedEvent;
import org.jabref.model.entry.BibEntry;
import org.jabref.preferences.FilePreferences;
import org.jabref.preferences.PreferencesService;

import com.google.common.eventbus.Subscribe;
Expand All @@ -61,6 +60,7 @@ public class MainTable extends TableView<BibEntryTableViewModel> {

private final LibraryTab libraryTab;
private final DialogService dialogService;
private final StateManager stateManager;
private final BibDatabaseContext database;
private final MainTableDataModel model;

Expand All @@ -70,8 +70,6 @@ public class MainTable extends TableView<BibEntryTableViewModel> {
private long lastKeyPressTime;
private String columnSearchTerm;

private final FilePreferences filePreferences;

public MainTable(MainTableDataModel model,
LibraryTab libraryTab,
BibDatabaseContext database,
Expand All @@ -84,6 +82,7 @@ public MainTable(MainTableDataModel model,

this.libraryTab = libraryTab;
this.dialogService = dialogService;
this.stateManager = stateManager;
this.database = Objects.requireNonNull(database);
this.model = model;
UndoManager undoManager = libraryTab.getUndoManager();
Expand Down Expand Up @@ -126,7 +125,8 @@ public MainTable(MainTableDataModel model,
stateManager,
preferencesService,
undoManager,
Globals.getClipboardManager()))
Globals.getClipboardManager(),
Globals.TASK_EXECUTOR))
.setOnDragDetected(this::handleOnDragDetected)
.setOnDragDropped(this::handleOnDragDropped)
.setOnDragOver(this::handleOnDragOver)
Expand Down Expand Up @@ -181,8 +181,6 @@ public MainTable(MainTableDataModel model,
this.jumpToSearchKey(getSortOrder().get(0), key);
});

filePreferences = preferencesService.getFilePreferences();

database.getDatabase().registerListener(this);
}

Expand Down Expand Up @@ -273,20 +271,20 @@ private void setupKeyBindings(KeyBindingRepository keyBindings) {
break;
case PASTE:
if (!OS.OS_X) {
new EditAction(StandardActions.PASTE, libraryTab.frame(), Globals.stateManager).execute();
new EditAction(StandardActions.PASTE, libraryTab.frame(), stateManager).execute();
}
event.consume();
break;
case COPY:
new EditAction(StandardActions.COPY, libraryTab.frame(), Globals.stateManager).execute();
new EditAction(StandardActions.COPY, libraryTab.frame(), stateManager).execute();
event.consume();
break;
case CUT:
new EditAction(StandardActions.CUT, libraryTab.frame(), Globals.stateManager).execute();
new EditAction(StandardActions.CUT, libraryTab.frame(), stateManager).execute();
event.consume();
break;
case DELETE_ENTRY:
new EditAction(StandardActions.DELETE_ENTRY, libraryTab.frame(), Globals.stateManager).execute();
new EditAction(StandardActions.DELETE_ENTRY, libraryTab.frame(), stateManager).execute();
event.consume();
break;
default:
Expand Down
Loading