Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into detectCharset
Browse files Browse the repository at this point in the history
* upstream/main:
  Bump checkstyle from 10.1 to 10.3.1 (#8950)
  Bump mariadb-java-client from 2.7.5 to 2.7.6 (#8953)
  Add notification when adding previous entries to new group configuration (#8919)
  Remember Sidepane width after restart (#8936)
  move "Warn about duplicates on import" preferences option (#8937)
  Fix theme switching exception (#8939)
  • Loading branch information
Siedlerchr committed Jul 4, 2022
2 parents ded49cd + e6d9109 commit 00dee77
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 68 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We improved group expansion arrow that prevent it from activating group when expanding or collapsing. [#7982](https://github.com/JabRef/jabref/issues/7982), [#3176](https://github.com/JabRef/jabref/issues/3176)
- When configured SSL certificates changed, JabRef warns the user to restart to apply the configuration.
- We improved the appearances and logic of the "Manage field names & content" dialog, and renamed it to "Automatic field editor". [#6536](https://github.com/JabRef/jabref/issues/6536)
- We fixed an issue that caused JabRef to sometimes open multiple instances when "Remote Operation" is enabled. [#8653](https://github.com/JabRef/jabref/issues/8653)
- We improved the message explaining the options when modifying an automatic keyword group [#8911](https://github.com/JabRef/jabref/issues/8911)
- We moved the preferences option "Warn about duplicates on import" option from the tab "File" to the tab "Import and Export". [kopper#570](https://github.com/koppor/jabref/issues/570)

### Fixed

- We fixed an issue that caused JabRef to sometimes open multiple instances when "Remote Operation" is enabled. [#8653](https://github.com/JabRef/jabref/issues/8653)
- We fixed an issue where linked files with the filetype "application/pdf" in an entry were not shown with the correct PDF-Icon in the main table [8930](https://github.com/JabRef/jabref/issues/8930)
- We fixed an issue where "open folder" for linked files did not open the folder and did not select the file unter certain Linux desktop environments [#8679](https://github.com/JabRef/jabref/issues/8679), [#8849](https://github.com/JabRef/jabref/issues/8849)
- We fixed an issue where the content of a big shared database library is not shown [#8788](https://github.com/JabRef/jabref/issues/8788)
Expand All @@ -50,6 +52,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where the exception that there are invalid characters in filename. [#8786](https://github.com/JabRef/jabref/issues/8786)
- When the proxy configuration removed the proxy user/password, this change is applied immediately.
- We fixed an issue where removing several groups deletes only one of them. [#8390](https://github.com/JabRef/jabref/issues/8390)
- We fixed an issue where the Sidepane (groups, web search and open office) width is not remembered after restarting JabRef. [#8907](https://github.com/JabRef/jabref/issues/8907)
- We fixed a bug where switching between themes will cause an error/exception. [#8939](https://github.com/JabRef/jabref/pull/8939)

### Removed

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ dependencies {
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.13.3'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.13.3'

implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.5'
implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.6'

implementation 'org.postgresql:postgresql:42.4.0'

Expand Down Expand Up @@ -221,7 +221,7 @@ dependencies {
testImplementation "org.testfx:testfx-junit5:4.0.16-alpha"
testImplementation "org.hamcrest:hamcrest-library:2.2"

checkstyle 'com.puppycrawl.tools:checkstyle:10.1'
checkstyle 'com.puppycrawl.tools:checkstyle:10.3.1'
// xjc needs the runtime as well for the ant task, otherwise it fails
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/org/jabref/gui/JabRefDialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public JabRefDialogService(Window mainWindow, Pane mainPane, ThemeManager themeM

private FXDialog createDialog(AlertType type, String title, String content) {
FXDialog alert = new FXDialog(type, title, true);
themeManager.installCss(alert.getDialogPane().getScene());
alert.setHeaderText(null);
alert.setContentText(content);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
Expand Down Expand Up @@ -113,7 +112,6 @@ protected Node createDetailsButton() {

// Reset the dialog graphic using the default style
alert.getDialogPane().setGraphic(graphic);
themeManager.installCss(alert.getDialogPane().getScene());
alert.setHeaderText(null);
alert.setContentText(content);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
Expand All @@ -138,7 +136,6 @@ public <T> Optional<T> showChoiceDialogAndWait(String title, String content, Str
choiceDialog.setTitle(title);
choiceDialog.setContentText(content);
choiceDialog.initOwner(mainWindow);
themeManager.installCss(choiceDialog.getDialogPane().getScene());
return choiceDialog.showAndWait();
}

Expand All @@ -148,7 +145,6 @@ public Optional<String> showInputDialogAndWait(String title, String content) {
inputDialog.setHeaderText(title);
inputDialog.setContentText(content);
inputDialog.initOwner(mainWindow);
themeManager.installCss(inputDialog.getDialogPane().getScene());
return inputDialog.showAndWait();
}

Expand All @@ -158,7 +154,6 @@ public Optional<String> showInputDialogWithDefaultAndWait(String title, String c
inputDialog.setHeaderText(title);
inputDialog.setContentText(content);
inputDialog.initOwner(mainWindow);
themeManager.installCss(inputDialog.getDialogPane().getScene());
return inputDialog.showAndWait();
}

Expand Down Expand Up @@ -186,7 +181,6 @@ public void showErrorDialogAndWait(String message, Throwable exception) {
exceptionDialog.getDialogPane().setMaxWidth(mainWindow.getWidth() / 2);
exceptionDialog.setHeaderText(message);
exceptionDialog.initOwner(mainWindow);
themeManager.installCss(exceptionDialog.getDialogPane().getScene());
exceptionDialog.showAndWait();
}

Expand All @@ -196,7 +190,6 @@ public void showErrorDialogAndWait(String title, String content, Throwable excep
exceptionDialog.setHeaderText(title);
exceptionDialog.setContentText(content);
exceptionDialog.initOwner(mainWindow);
themeManager.installCss(exceptionDialog.getDialogPane().getScene());
exceptionDialog.showAndWait();
}

Expand Down Expand Up @@ -266,7 +259,6 @@ public Optional<ButtonType> showCustomDialogAndWait(String title, DialogPane con
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(true);
alert.initOwner(mainWindow);
themeManager.installCss(alert.getDialogPane().getScene());
return alert.showAndWait();
}

Expand Down Expand Up @@ -294,7 +286,6 @@ public <V> void showProgressDialog(String title, String content, Task<V> task) {
task.cancel();
progressDialog.close();
});
themeManager.installCss(progressDialog.getDialogPane().getScene());
progressDialog.initOwner(mainWindow);
progressDialog.show();
}
Expand All @@ -319,7 +310,6 @@ public <V> Optional<ButtonType> showBackgroundProgressDialogAndWait(String title
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(true);
alert.initOwner(mainWindow);
themeManager.installCss(alert.getDialogPane().getScene());

stateManager.getAnyTasksThatWillNotBeRecoveredRunning().addListener((observable, oldValue, newValue) -> {
if (!newValue) {
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,10 @@ private void initLayout() {
@Override
public void invalidated(Observable observable) {
if (mainStage.isShowing()) {
setDividerPosition();
observable.removeListener(this);
Platform.runLater(() -> {
setDividerPosition();
observable.removeListener(this);
});
}
}
});
Expand All @@ -472,10 +474,9 @@ private void updateSidePane() {
}

private void setDividerPosition() {
splitPane.setDividerPositions(prefs.getGuiPreferences().getSidePaneWidth());
if (mainStage.isShowing() && !sidePane.getChildren().isEmpty()) {
dividerSubscription = EasyBind.subscribe(splitPane.getDividers().get(0).positionProperty(),
position -> prefs.getGuiPreferences().setSidePaneWidth(position.doubleValue()));
splitPane.setDividerPositions(prefs.getGuiPreferences().getSidePaneWidth() / splitPane.getWidth());
dividerSubscription = EasyBind.subscribe(sidePane.widthProperty(), width -> prefs.getGuiPreferences().setSidePaneWidth(width.doubleValue()));
}
}

Expand Down
41 changes: 34 additions & 7 deletions src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;

import org.jabref.gui.AbstractViewModel;
import org.jabref.gui.DialogService;
Expand All @@ -29,6 +32,7 @@
import org.jabref.model.groups.AbstractGroup;
import org.jabref.model.groups.ExplicitGroup;
import org.jabref.model.groups.GroupTreeNode;
import org.jabref.model.groups.WordKeywordGroup;
import org.jabref.model.metadata.MetaData;
import org.jabref.preferences.PreferencesService;

Expand Down Expand Up @@ -192,9 +196,21 @@ public void editGroup(GroupNodeViewModel oldGroup) {

newGroup.ifPresent(group -> {
// TODO: Keep assignments
boolean keepPreviousAssignments = dialogService.showConfirmationDialogAndWait(
String content = Localization.lang("Assign the original group's entries to this group?");
ButtonType keepAssignments = new ButtonType(Localization.lang("Assign"), ButtonBar.ButtonData.YES);
ButtonType removeAssignments = new ButtonType(Localization.lang("Do not assign"), ButtonBar.ButtonData.NO);
ButtonType cancel = new ButtonType(Localization.lang("Cancel"), ButtonBar.ButtonData.CANCEL_CLOSE);

if (newGroup.get().getClass() == WordKeywordGroup.class) {
content = content + "\n\n" +
Localization.lang("(Note: If original entries lack keywords to qualify for the new group configuration, confirming here will add them)");
}
Optional<ButtonType> previousAssignments = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.WARNING,
Localization.lang("Change of Grouping Method"),
Localization.lang("Assign the original group's entries to this group?"));
content,
keepAssignments,
removeAssignments,
cancel);
// WarnAssignmentSideEffects.warnAssignmentSideEffects(newGroup, panel.frame());
boolean removePreviousAssignments = (oldGroup.getGroupNode().getGroup() instanceof ExplicitGroup)
&& (group instanceof ExplicitGroup);
Expand All @@ -209,11 +225,22 @@ public void editGroup(GroupNodeViewModel oldGroup) {
removePreviousAssignments = false;
}

oldGroup.getGroupNode().setGroup(
group,
keepPreviousAssignments,
removePreviousAssignments,
database.getEntries());
if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.YES)) {
oldGroup.getGroupNode().setGroup(
group,
true,
removePreviousAssignments,
database.getEntries());
} else if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.NO)) {
oldGroup.getGroupNode().setGroup(
group,
false,
removePreviousAssignments,
database.getEntries());
} else if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.CANCEL_CLOSE)) {
return;
}

// stateManager.getEntriesInCurrentDatabase());

// TODO: Add undo
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/preferences/file/FileTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@
</HBox>

<CheckBox fx:id="alwaysReformatBib" text="%Always reformat BIB file on save and export"/>
<CheckBox fx:id="warnAboutDuplicatesOnImport" text="%Warn about duplicates on import"/>
</fx:root>
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/preferences/file/FileTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class FileTab extends AbstractPreferenceTabView<FileTabViewModel> impleme
@FXML private RadioButton resolveStrings;
@FXML private TextField resolveStringsForFields;
@FXML private CheckBox alwaysReformatBib;
@FXML private CheckBox warnAboutDuplicatesOnImport;

@FXML private CheckBox autosaveLocalLibraries;
@FXML private Button autosaveLocalLibrariesHelp;
Expand All @@ -48,7 +47,6 @@ public void initialize() {
resolveStringsForFields.disableProperty().bind(doNotResolveStrings.selectedProperty());

alwaysReformatBib.selectedProperty().bindBidirectional(viewModel.alwaysReformatBibProperty());
warnAboutDuplicatesOnImport.selectedProperty().bindBidirectional(viewModel.warnAboutDuplicatesOnImportProperty());
autosaveLocalLibraries.selectedProperty().bindBidirectional(viewModel.autosaveLocalLibrariesProperty());

ActionFactory actionFactory = new ActionFactory(Globals.getKeyPrefs());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class FileTabViewModel implements PreferenceTabViewModel {
private final BooleanProperty resolveStringsProperty = new SimpleBooleanProperty();
private final StringProperty resolveStringsForFieldsProperty = new SimpleStringProperty("");
private final BooleanProperty alwaysReformatBibProperty = new SimpleBooleanProperty();
private final BooleanProperty warnAboutDuplicatesOnImportProperty = new SimpleBooleanProperty();
private final BooleanProperty autosaveLocalLibraries = new SimpleBooleanProperty();

private final ImportExportPreferences importExportPreferences;
Expand All @@ -34,7 +33,6 @@ public void setValues() {
resolveStringsProperty.setValue(importExportPreferences.resolveStrings());
resolveStringsForFieldsProperty.setValue(importExportPreferences.getResolvableFields());
alwaysReformatBibProperty.setValue(importExportPreferences.shouldAlwaysReformatOnSave());
warnAboutDuplicatesOnImportProperty.setValue(importExportPreferences.shouldWarnAboutDuplicatesOnImport());
autosaveLocalLibraries.setValue(importExportPreferences.shouldAutoSave());
}

Expand All @@ -45,7 +43,6 @@ public void storeSettings() {
importExportPreferences.setNonWrappableFields(noWrapFilesProperty.getValue().trim());
importExportPreferences.setResolvableFields(resolveStringsForFieldsProperty.getValue().trim());
importExportPreferences.setAlwaysReformatOnSave(alwaysReformatBibProperty.getValue());
importExportPreferences.setWarnAboutDuplicatesOnImport(warnAboutDuplicatesOnImportProperty.getValue());
importExportPreferences.setAutoSave(autosaveLocalLibraries.getValue());
}

Expand Down Expand Up @@ -77,10 +74,6 @@ public BooleanProperty alwaysReformatBibProperty() {
return alwaysReformatBibProperty;
}

public BooleanProperty warnAboutDuplicatesOnImportProperty() {
return warnAboutDuplicatesOnImportProperty;
}

// Autosave
public BooleanProperty autosaveLocalLibrariesProperty() {
return autosaveLocalLibraries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<Label styleClass="sectionHeader" text="%General"/>
<CheckBox fx:id="generateNewKeyOnImport" text="%Generate a new key for imported entries (overwriting their default)"/>
<CheckBox fx:id="warnAboutDuplicatesOnImport" text="%Warn about duplicates on import"/>

<Label styleClass="sectionHeader" text="%Custom DOI URI"/>
<HBox alignment="CENTER_LEFT" spacing="10.0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class ImportExportTab extends AbstractPreferenceTabView<ImportExportTabVi
@FXML private CheckBox grobidEnabled;
@FXML private TextField grobidURL;

@FXML private CheckBox warnAboutDuplicatesOnImport;

public ImportExportTab() {
ViewLoader.view(this)
.root(this)
Expand All @@ -44,7 +46,7 @@ public String getTabName() {
}

public void initialize() {
this.viewModel = new ImportExportTabViewModel(preferencesService, preferencesService.getDOIPreferences(), dialogService);
this.viewModel = new ImportExportTabViewModel(preferencesService, preferencesService.getDOIPreferences(), dialogService, preferencesService.getImportExportPreferences());

useCustomDOI.selectedProperty().bindBidirectional(viewModel.useCustomDOIProperty());
useCustomDOIName.textProperty().bindBidirectional(viewModel.useCustomDOINameProperty());
Expand Down Expand Up @@ -85,6 +87,8 @@ public void initialize() {

// Content is set later
viewModel.fetcherApiKeys().addListener((InvalidationListener) change -> apiKeySelector.getSelectionModel().selectFirst());

warnAboutDuplicatesOnImport.selectedProperty().bindBidirectional(viewModel.warnAboutDuplicatesOnImportProperty());
}

private void updateFetcherApiKey(FetcherApiKey apiKey) {
Expand Down
Loading

0 comments on commit 00dee77

Please sign in to comment.