Skip to content

Commit 00dee77

Browse files
committed
Merge remote-tracking branch 'upstream/main' into detectCharset
* 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)
2 parents ded49cd + e6d9109 commit 00dee77

File tree

14 files changed

+97
-68
lines changed

14 files changed

+97
-68
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
3434
- 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)
3535
- When configured SSL certificates changed, JabRef warns the user to restart to apply the configuration.
3636
- 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)
37-
- 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)
37+
- We improved the message explaining the options when modifying an automatic keyword group [#8911](https://github.com/JabRef/jabref/issues/8911)
38+
- 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)
3839

3940
### Fixed
4041

42+
- 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)
4143
- 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)
4244
- 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)
4345
- We fixed an issue where the content of a big shared database library is not shown [#8788](https://github.com/JabRef/jabref/issues/8788)
@@ -50,6 +52,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
5052
- We fixed an issue where the exception that there are invalid characters in filename. [#8786](https://github.com/JabRef/jabref/issues/8786)
5153
- When the proxy configuration removed the proxy user/password, this change is applied immediately.
5254
- We fixed an issue where removing several groups deletes only one of them. [#8390](https://github.com/JabRef/jabref/issues/8390)
55+
- 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)
56+
- We fixed a bug where switching between themes will cause an error/exception. [#8939](https://github.com/JabRef/jabref/pull/8939)
5357

5458
### Removed
5559

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ dependencies {
151151
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.13.3'
152152
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.13.3'
153153

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

156156
implementation 'org.postgresql:postgresql:42.4.0'
157157

@@ -221,7 +221,7 @@ dependencies {
221221
testImplementation "org.testfx:testfx-junit5:4.0.16-alpha"
222222
testImplementation "org.hamcrest:hamcrest-library:2.2"
223223

224-
checkstyle 'com.puppycrawl.tools:checkstyle:10.1'
224+
checkstyle 'com.puppycrawl.tools:checkstyle:10.3.1'
225225
// xjc needs the runtime as well for the ant task, otherwise it fails
226226
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
227227
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

src/main/java/org/jabref/gui/JabRefDialogService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public JabRefDialogService(Window mainWindow, Pane mainPane, ThemeManager themeM
8080

8181
private FXDialog createDialog(AlertType type, String title, String content) {
8282
FXDialog alert = new FXDialog(type, title, true);
83-
themeManager.installCss(alert.getDialogPane().getScene());
8483
alert.setHeaderText(null);
8584
alert.setContentText(content);
8685
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
@@ -113,7 +112,6 @@ protected Node createDetailsButton() {
113112

114113
// Reset the dialog graphic using the default style
115114
alert.getDialogPane().setGraphic(graphic);
116-
themeManager.installCss(alert.getDialogPane().getScene());
117115
alert.setHeaderText(null);
118116
alert.setContentText(content);
119117
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
@@ -138,7 +136,6 @@ public <T> Optional<T> showChoiceDialogAndWait(String title, String content, Str
138136
choiceDialog.setTitle(title);
139137
choiceDialog.setContentText(content);
140138
choiceDialog.initOwner(mainWindow);
141-
themeManager.installCss(choiceDialog.getDialogPane().getScene());
142139
return choiceDialog.showAndWait();
143140
}
144141

@@ -148,7 +145,6 @@ public Optional<String> showInputDialogAndWait(String title, String content) {
148145
inputDialog.setHeaderText(title);
149146
inputDialog.setContentText(content);
150147
inputDialog.initOwner(mainWindow);
151-
themeManager.installCss(inputDialog.getDialogPane().getScene());
152148
return inputDialog.showAndWait();
153149
}
154150

@@ -158,7 +154,6 @@ public Optional<String> showInputDialogWithDefaultAndWait(String title, String c
158154
inputDialog.setHeaderText(title);
159155
inputDialog.setContentText(content);
160156
inputDialog.initOwner(mainWindow);
161-
themeManager.installCss(inputDialog.getDialogPane().getScene());
162157
return inputDialog.showAndWait();
163158
}
164159

@@ -186,7 +181,6 @@ public void showErrorDialogAndWait(String message, Throwable exception) {
186181
exceptionDialog.getDialogPane().setMaxWidth(mainWindow.getWidth() / 2);
187182
exceptionDialog.setHeaderText(message);
188183
exceptionDialog.initOwner(mainWindow);
189-
themeManager.installCss(exceptionDialog.getDialogPane().getScene());
190184
exceptionDialog.showAndWait();
191185
}
192186

@@ -196,7 +190,6 @@ public void showErrorDialogAndWait(String title, String content, Throwable excep
196190
exceptionDialog.setHeaderText(title);
197191
exceptionDialog.setContentText(content);
198192
exceptionDialog.initOwner(mainWindow);
199-
themeManager.installCss(exceptionDialog.getDialogPane().getScene());
200193
exceptionDialog.showAndWait();
201194
}
202195

@@ -266,7 +259,6 @@ public Optional<ButtonType> showCustomDialogAndWait(String title, DialogPane con
266259
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
267260
alert.setResizable(true);
268261
alert.initOwner(mainWindow);
269-
themeManager.installCss(alert.getDialogPane().getScene());
270262
return alert.showAndWait();
271263
}
272264

@@ -294,7 +286,6 @@ public <V> void showProgressDialog(String title, String content, Task<V> task) {
294286
task.cancel();
295287
progressDialog.close();
296288
});
297-
themeManager.installCss(progressDialog.getDialogPane().getScene());
298289
progressDialog.initOwner(mainWindow);
299290
progressDialog.show();
300291
}
@@ -319,7 +310,6 @@ public <V> Optional<ButtonType> showBackgroundProgressDialogAndWait(String title
319310
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
320311
alert.setResizable(true);
321312
alert.initOwner(mainWindow);
322-
themeManager.installCss(alert.getDialogPane().getScene());
323313

324314
stateManager.getAnyTasksThatWillNotBeRecoveredRunning().addListener((observable, oldValue, newValue) -> {
325315
if (!newValue) {

src/main/java/org/jabref/gui/JabRefFrame.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,10 @@ private void initLayout() {
448448
@Override
449449
public void invalidated(Observable observable) {
450450
if (mainStage.isShowing()) {
451-
setDividerPosition();
452-
observable.removeListener(this);
451+
Platform.runLater(() -> {
452+
setDividerPosition();
453+
observable.removeListener(this);
454+
});
453455
}
454456
}
455457
});
@@ -472,10 +474,9 @@ private void updateSidePane() {
472474
}
473475

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

src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
import javafx.beans.property.StringProperty;
1818
import javafx.collections.FXCollections;
1919
import javafx.collections.ObservableList;
20+
import javafx.scene.control.Alert;
21+
import javafx.scene.control.ButtonBar;
22+
import javafx.scene.control.ButtonType;
2023

2124
import org.jabref.gui.AbstractViewModel;
2225
import org.jabref.gui.DialogService;
@@ -29,6 +32,7 @@
2932
import org.jabref.model.groups.AbstractGroup;
3033
import org.jabref.model.groups.ExplicitGroup;
3134
import org.jabref.model.groups.GroupTreeNode;
35+
import org.jabref.model.groups.WordKeywordGroup;
3236
import org.jabref.model.metadata.MetaData;
3337
import org.jabref.preferences.PreferencesService;
3438

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

193197
newGroup.ifPresent(group -> {
194198
// TODO: Keep assignments
195-
boolean keepPreviousAssignments = dialogService.showConfirmationDialogAndWait(
199+
String content = Localization.lang("Assign the original group's entries to this group?");
200+
ButtonType keepAssignments = new ButtonType(Localization.lang("Assign"), ButtonBar.ButtonData.YES);
201+
ButtonType removeAssignments = new ButtonType(Localization.lang("Do not assign"), ButtonBar.ButtonData.NO);
202+
ButtonType cancel = new ButtonType(Localization.lang("Cancel"), ButtonBar.ButtonData.CANCEL_CLOSE);
203+
204+
if (newGroup.get().getClass() == WordKeywordGroup.class) {
205+
content = content + "\n\n" +
206+
Localization.lang("(Note: If original entries lack keywords to qualify for the new group configuration, confirming here will add them)");
207+
}
208+
Optional<ButtonType> previousAssignments = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.WARNING,
196209
Localization.lang("Change of Grouping Method"),
197-
Localization.lang("Assign the original group's entries to this group?"));
210+
content,
211+
keepAssignments,
212+
removeAssignments,
213+
cancel);
198214
// WarnAssignmentSideEffects.warnAssignmentSideEffects(newGroup, panel.frame());
199215
boolean removePreviousAssignments = (oldGroup.getGroupNode().getGroup() instanceof ExplicitGroup)
200216
&& (group instanceof ExplicitGroup);
@@ -209,11 +225,22 @@ public void editGroup(GroupNodeViewModel oldGroup) {
209225
removePreviousAssignments = false;
210226
}
211227

212-
oldGroup.getGroupNode().setGroup(
213-
group,
214-
keepPreviousAssignments,
215-
removePreviousAssignments,
216-
database.getEntries());
228+
if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.YES)) {
229+
oldGroup.getGroupNode().setGroup(
230+
group,
231+
true,
232+
removePreviousAssignments,
233+
database.getEntries());
234+
} else if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.NO)) {
235+
oldGroup.getGroupNode().setGroup(
236+
group,
237+
false,
238+
removePreviousAssignments,
239+
database.getEntries());
240+
} else if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.CANCEL_CLOSE)) {
241+
return;
242+
}
243+
217244
// stateManager.getEntriesInCurrentDatabase());
218245

219246
// TODO: Add undo

src/main/java/org/jabref/gui/preferences/file/FileTab.fxml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@
4242
</HBox>
4343

4444
<CheckBox fx:id="alwaysReformatBib" text="%Always reformat BIB file on save and export"/>
45-
<CheckBox fx:id="warnAboutDuplicatesOnImport" text="%Warn about duplicates on import"/>
4645
</fx:root>

src/main/java/org/jabref/gui/preferences/file/FileTab.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public class FileTab extends AbstractPreferenceTabView<FileTabViewModel> impleme
2525
@FXML private RadioButton resolveStrings;
2626
@FXML private TextField resolveStringsForFields;
2727
@FXML private CheckBox alwaysReformatBib;
28-
@FXML private CheckBox warnAboutDuplicatesOnImport;
2928

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

5049
alwaysReformatBib.selectedProperty().bindBidirectional(viewModel.alwaysReformatBibProperty());
51-
warnAboutDuplicatesOnImport.selectedProperty().bindBidirectional(viewModel.warnAboutDuplicatesOnImportProperty());
5250
autosaveLocalLibraries.selectedProperty().bindBidirectional(viewModel.autosaveLocalLibrariesProperty());
5351

5452
ActionFactory actionFactory = new ActionFactory(Globals.getKeyPrefs());

src/main/java/org/jabref/gui/preferences/file/FileTabViewModel.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class FileTabViewModel implements PreferenceTabViewModel {
1616
private final BooleanProperty resolveStringsProperty = new SimpleBooleanProperty();
1717
private final StringProperty resolveStringsForFieldsProperty = new SimpleStringProperty("");
1818
private final BooleanProperty alwaysReformatBibProperty = new SimpleBooleanProperty();
19-
private final BooleanProperty warnAboutDuplicatesOnImportProperty = new SimpleBooleanProperty();
2019
private final BooleanProperty autosaveLocalLibraries = new SimpleBooleanProperty();
2120

2221
private final ImportExportPreferences importExportPreferences;
@@ -34,7 +33,6 @@ public void setValues() {
3433
resolveStringsProperty.setValue(importExportPreferences.resolveStrings());
3534
resolveStringsForFieldsProperty.setValue(importExportPreferences.getResolvableFields());
3635
alwaysReformatBibProperty.setValue(importExportPreferences.shouldAlwaysReformatOnSave());
37-
warnAboutDuplicatesOnImportProperty.setValue(importExportPreferences.shouldWarnAboutDuplicatesOnImport());
3836
autosaveLocalLibraries.setValue(importExportPreferences.shouldAutoSave());
3937
}
4038

@@ -45,7 +43,6 @@ public void storeSettings() {
4543
importExportPreferences.setNonWrappableFields(noWrapFilesProperty.getValue().trim());
4644
importExportPreferences.setResolvableFields(resolveStringsForFieldsProperty.getValue().trim());
4745
importExportPreferences.setAlwaysReformatOnSave(alwaysReformatBibProperty.getValue());
48-
importExportPreferences.setWarnAboutDuplicatesOnImport(warnAboutDuplicatesOnImportProperty.getValue());
4946
importExportPreferences.setAutoSave(autosaveLocalLibraries.getValue());
5047
}
5148

@@ -77,10 +74,6 @@ public BooleanProperty alwaysReformatBibProperty() {
7774
return alwaysReformatBibProperty;
7875
}
7976

80-
public BooleanProperty warnAboutDuplicatesOnImportProperty() {
81-
return warnAboutDuplicatesOnImportProperty;
82-
}
83-
8477
// Autosave
8578
public BooleanProperty autosaveLocalLibrariesProperty() {
8679
return autosaveLocalLibraries;

src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.fxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

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

2021
<Label styleClass="sectionHeader" text="%Custom DOI URI"/>
2122
<HBox alignment="CENTER_LEFT" spacing="10.0">

src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public class ImportExportTab extends AbstractPreferenceTabView<ImportExportTabVi
3232
@FXML private CheckBox grobidEnabled;
3333
@FXML private TextField grobidURL;
3434

35+
@FXML private CheckBox warnAboutDuplicatesOnImport;
36+
3537
public ImportExportTab() {
3638
ViewLoader.view(this)
3739
.root(this)
@@ -44,7 +46,7 @@ public String getTabName() {
4446
}
4547

4648
public void initialize() {
47-
this.viewModel = new ImportExportTabViewModel(preferencesService, preferencesService.getDOIPreferences(), dialogService);
49+
this.viewModel = new ImportExportTabViewModel(preferencesService, preferencesService.getDOIPreferences(), dialogService, preferencesService.getImportExportPreferences());
4850

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

8688
// Content is set later
8789
viewModel.fetcherApiKeys().addListener((InvalidationListener) change -> apiKeySelector.getSelectionModel().selectFirst());
90+
91+
warnAboutDuplicatesOnImport.selectedProperty().bindBidirectional(viewModel.warnAboutDuplicatesOnImportProperty());
8892
}
8993

9094
private void updateFetcherApiKey(FetcherApiKey apiKey) {

0 commit comments

Comments
 (0)