Skip to content

Commit

Permalink
Allow adding and deleting multiple files in the general tab
Browse files Browse the repository at this point in the history
Fixes #8659
Make @AEgit happy
  • Loading branch information
Siedlerchr committed Apr 11, 2022
1 parent 9ba9d0b commit 39ca92e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Fixed

- We fixed an issue where it was no longer possible to add or delete multiple files in the `file` field in the entry editor [#8659](https://github.com/JabRef/jabref/issues/8659)
- We fixed an issue where the author's lastname was not used for the citation key generation if it started with a lowercase letter [#8601](https://github.com/JabRef/jabref/issues/8601)
- We fixed an issue where custom "Protected terms" files were missing after a restart of JabRef [#8608](https://github.com/JabRef/jabref/issues/8608)
- We fixed an issue where JabRef could not start due to a missing directory for the fulltex index [#8579](https://github.com/JabRef/jabref/issues/8579)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<?import org.jabref.gui.icon.JabRefIconView?>
<fx:root xmlns:fx="http://javafx.com/fxml/1" type="HBox" xmlns="http://javafx.com/javafx/8.0.112"
fx:controller="org.jabref.gui.fieldeditors.LinkedFilesEditor">
<ListView fx:id="listView" prefHeight="0" HBox.hgrow="ALWAYS" maxHeight="100"/>
<ListView fx:id="listView" prefHeight="0" HBox.hgrow="ALWAYS" maxHeight="100" />
<Button onAction="#addNewFile"
styleClass="icon-button">
<graphic>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javafx.scene.control.ContextMenu;
import javafx.scene.control.ListView;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.Tooltip;
import javafx.scene.input.ClipboardContent;
Expand Down Expand Up @@ -92,6 +93,7 @@ public LinkedFilesEditor(Field field,
.withValidation(LinkedFileViewModel::fileExistsValidationStatus);

listView.setCellFactory(cellFactory);
listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

decoratedModelList = new UiThreadObservableList<>(viewModel.filesProperty());
Bindings.bindContentBidirectional(listView.itemsProperty().get(), decoratedModelList);
Expand Down Expand Up @@ -204,8 +206,8 @@ private void setUpKeyBindings() {
if (keyBinding.isPresent()) {
switch (keyBinding.get()) {
case DELETE_ENTRY:
LinkedFileViewModel selectedItem = listView.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
ObservableList<LinkedFileViewModel> selectedItems = listView.getSelectionModel().getSelectedItems();
for (LinkedFileViewModel selectedItem : selectedItems) {
viewModel.deleteFile(selectedItem);
}
event.consume();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void addNewFile() {
.build();

List<Path> fileDirectories = databaseContext.getFileDirectories(preferences.getFilePreferences());
dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(newFile -> {
dialogService.showFileOpenDialogAndGetMultipleFiles(fileDialogConfiguration).forEach(newFile -> {
LinkedFile newLinkedFile = fromFile(newFile, fileDirectories, externalFileTypes);
files.add(new LinkedFileViewModel(
newLinkedFile,
Expand Down

0 comments on commit 39ca92e

Please sign in to comment.