Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Fixed

- We fixed an issue where an exception could occur when saving the preferences [#7614](https://github.com/JabRef/jabref/issues/7614)

### Removed


Expand Down
51 changes: 21 additions & 30 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public void about() {
* FIXME: Currently some threads remain and therefore hinder JabRef to be closed properly
*
* @param filenames the filenames of all currently opened files - used for storing them if prefs openLastEdited is
* set to true
* set to true
*/
private void tearDownJabRef(List<String> filenames) {
if (prefs.getGuiPreferences().shouldOpenLastEdited()) {
Expand Down Expand Up @@ -389,8 +389,7 @@ public boolean quit() {
Optional<ButtonType> shouldClose = dialogService.showBackgroundProgressDialogAndWait(
Localization.lang("Please wait..."),
Localization.lang("Waiting for background tasks to finish. Quit anyway?"),
stateManager
);
stateManager);
if (!(shouldClose.isPresent() && (shouldClose.get() == ButtonType.YES))) {
return false;
}
Expand Down Expand Up @@ -447,6 +446,7 @@ private void initLayout() {

// We need to wait with setting the divider since it gets reset a few times during the initial set-up
mainStage.showingProperty().addListener(new InvalidationListener() {

@Override
public void invalidated(Observable observable) {
if (mainStage.isShowing()) {
Expand Down Expand Up @@ -511,8 +511,7 @@ private Node createToolbar() {
factory.createIconButton(StandardActions.NEW_ENTRY, new NewEntryAction(this, dialogService, prefs, stateManager)),
createNewEntryFromIdButton(),
factory.createIconButton(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new ExtractBibtexAction(dialogService, prefs, stateManager)),
factory.createIconButton(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, this, stateManager))
),
factory.createIconButton(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, this, stateManager))),

new Separator(Orientation.VERTICAL),

Expand All @@ -521,31 +520,26 @@ private Node createToolbar() {
factory.createIconButton(StandardActions.REDO, new UndoRedoAction(StandardActions.REDO, this, dialogService, stateManager)),
factory.createIconButton(StandardActions.CUT, new EditAction(StandardActions.CUT, this, stateManager)),
factory.createIconButton(StandardActions.COPY, new EditAction(StandardActions.COPY, this, stateManager)),
factory.createIconButton(StandardActions.PASTE, new EditAction(StandardActions.PASTE, this, stateManager))
),
factory.createIconButton(StandardActions.PASTE, new EditAction(StandardActions.PASTE, this, stateManager))),

new Separator(Orientation.VERTICAL),

new HBox(
pushToApplicationButton,
factory.createIconButton(StandardActions.GENERATE_CITE_KEYS, new GenerateCitationKeyAction(this, dialogService, stateManager, taskExecutor, prefs)),
factory.createIconButton(StandardActions.CLEANUP_ENTRIES, new CleanupAction(this, prefs, dialogService, stateManager))
),
factory.createIconButton(StandardActions.CLEANUP_ENTRIES, new CleanupAction(this, prefs, dialogService, stateManager))),

new Separator(Orientation.VERTICAL),

new HBox(
factory.createIconButton(StandardActions.OPEN_GITHUB, new OpenBrowserAction("https://github.com/JabRef/jabref")),
factory.createIconButton(StandardActions.OPEN_FACEBOOK, new OpenBrowserAction("https://www.facebook.com/JabRef/")),
factory.createIconButton(StandardActions.OPEN_TWITTER, new OpenBrowserAction("https://twitter.com/jabref_org"))
),
factory.createIconButton(StandardActions.OPEN_TWITTER, new OpenBrowserAction("https://twitter.com/jabref_org"))),

new Separator(Orientation.VERTICAL),

new HBox(
createTaskIndicator()
)
);
createTaskIndicator()));

leftSpacer.setPrefWidth(50);
leftSpacer.setMinWidth(Region.USE_PREF_SIZE);
Expand Down Expand Up @@ -644,7 +638,7 @@ public void init() {
// Update active search query when switching between databases
if (prefs.getSearchPreferences().shouldKeepSearchString() && libraryTab.getCurrentSearchQuery().isEmpty() && stateManager.activeSearchQueryProperty().get().isPresent()) {
// apply search query also when opening a new library and keep search string is activated
libraryTab.setCurrentSearchQuery(stateManager.activeSearchQueryProperty().get());
libraryTab.setCurrentSearchQuery(stateManager.activeSearchQueryProperty().get());
} else {
stateManager.activeSearchQueryProperty().set(libraryTab.getCurrentSearchQuery());
}
Expand Down Expand Up @@ -724,14 +718,12 @@ private MenuBar createMenu() {

factory.createSubMenu(StandardActions.REMOTE_DB,
factory.createMenuItem(StandardActions.CONNECT_TO_SHARED_DB, new ConnectToSharedDatabaseCommand(this)),
factory.createMenuItem(StandardActions.PULL_CHANGES_FROM_SHARED_DB, new PullChangesFromSharedAction(stateManager))
),
factory.createMenuItem(StandardActions.PULL_CHANGES_FROM_SHARED_DB, new PullChangesFromSharedAction(stateManager))),

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction()),
factory.createMenuItem(StandardActions.QUIT, new CloseAction())
);
factory.createMenuItem(StandardActions.QUIT, new CloseAction()));

edit.getItems().addAll(
factory.createMenuItem(StandardActions.UNDO, new UndoRedoAction(StandardActions.UNDO, this, dialogService, stateManager)),
Expand Down Expand Up @@ -761,8 +753,7 @@ private MenuBar createMenu() {
new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.MANAGE_KEYWORDS, new ManageKeywordsAction(stateManager)),
factory.createMenuItem(StandardActions.MASS_SET_FIELDS, new MassSetFieldsAction(stateManager, dialogService, undoManager))
);
factory.createMenuItem(StandardActions.MASS_SET_FIELDS, new MassSetFieldsAction(stateManager, dialogService, undoManager)));

SeparatorMenuItem specialFieldsSeparator = new SeparatorMenuItem();
specialFieldsSeparator.visibleProperty().bind(prefs.getSpecialFieldsPreferences().specialFieldsEnabledProperty());
Expand All @@ -776,8 +767,7 @@ private MenuBar createMenu() {
SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.QUALITY, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.getSpecialFieldSingleItem(SpecialField.PRINTED, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.PRIORITY, factory, this, dialogService, prefs, undoManager, stateManager),
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.READ_STATUS, factory, this, dialogService, prefs, undoManager, stateManager)
);
SpecialFieldMenuItemFactory.createSpecialFieldMenu(SpecialField.READ_STATUS, factory, this, dialogService, prefs, undoManager, stateManager));

// @formatter:off
library.getItems().addAll(
Expand Down Expand Up @@ -1039,13 +1029,12 @@ public void addParserResult(ParserResult parserResult, boolean focusPanel) {

/**
* This method causes all open LibraryTabs to set up their tables anew. When called from PreferencesDialogViewModel,
* this updates to the new settings.
* We need to notify all tabs about the changes to avoid problems when changing the column set.
* this updates to the new settings. We need to notify all tabs about the changes to avoid problems when changing
* the column set.
*/
public void setupAllTables() {
tabbedPane.getTabs().forEach(tab -> {
LibraryTab libraryTab = (LibraryTab) tab;
if (libraryTab.getDatabase() != null) {
if (tab instanceof LibraryTab libraryTab && (libraryTab.getDatabase() != null)) {
DefaultTaskExecutor.runInJavaFXThread(libraryTab::setupMainPanel);
}
});
Expand All @@ -1062,8 +1051,7 @@ private ContextMenu createTabContextMenuFor(LibraryTab tab, KeyBindingRepository
new SeparatorMenuItem(),
factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction(tab)),
factory.createMenuItem(StandardActions.CLOSE_OTHER_LIBRARIES, new CloseOthersDatabaseAction(tab)),
factory.createMenuItem(StandardActions.CLOSE_ALL_LIBRARIES, new CloseAllDatabaseAction())
);
factory.createMenuItem(StandardActions.CLOSE_ALL_LIBRARIES, new CloseAllDatabaseAction()));

return contextMenu;
}
Expand Down Expand Up @@ -1122,7 +1110,7 @@ private boolean readyForAutosave(BibDatabaseContext context) {
/**
* Opens the import inspection dialog to let the user decide which of the given entries to import.
*
* @param panel The BasePanel to add to.
* @param panel The BasePanel to add to.
* @param parserResult The entries to add.
*/
private void addImportedEntries(final LibraryTab panel, final ParserResult parserResult) {
Expand Down Expand Up @@ -1294,6 +1282,7 @@ public void execute() {
}

private class CloseDatabaseAction extends SimpleCommand {

private final LibraryTab libraryTab;

public CloseDatabaseAction(LibraryTab libraryTab) {
Expand All @@ -1314,6 +1303,7 @@ public void execute() {
}

private class CloseOthersDatabaseAction extends SimpleCommand {

private final LibraryTab libraryTab;

public CloseOthersDatabaseAction(LibraryTab libraryTab) {
Expand Down Expand Up @@ -1344,6 +1334,7 @@ public void execute() {
}

private class OpenDatabaseFolder extends SimpleCommand {

private final Supplier<BibDatabaseContext> databaseContext;

public OpenDatabaseFolder(Supplier<BibDatabaseContext> databaseContext) {
Expand Down