Add copy linked files action to contextmneu in general tab#5068
Conversation
| @FXML private ListView<LinkedFileViewModel> listView; | ||
|
|
||
| @Inject private StateManager stateManager; | ||
| private final DialogService dialogService; |
There was a problem hiding this comment.
I actually tried to inject the other stuff as well, but the key problem is that the fxml loader requires the viewModel to be intiialized beforehand cause in the fxml there is an expression on the viewModel defined. And in the ctor the Injects stuff is of course still null.
Refactor preferences parameter Remove unsused parameter from dialog
|
Added a variant for a single entry and did some refactoring. |
tobiasdiez
left a comment
There was a problem hiding this comment.
Looks good to me now. Just some minor remarks
| .build(); | ||
| Optional<Path> exportPath = dialogService.showDirectorySelectionDialog(dirDialogConfiguration); | ||
| exportPath.ifPresent(this::copyFileToDestination); | ||
|
|
| private void copyFileToDestination(Path exportPath) { | ||
| Optional<Path> fileToExport = linkedFile.findIn(databaseContext, Globals.prefs.getFilePreferences()); | ||
|
|
||
| Optional<Path> newPath = OptionalUtil.combine(Optional.of(exportPath), fileToExport, resolvePathFilename); |
There was a problem hiding this comment.
I think this is a bit overly complicated as we can only copy the file if we find it (e.g. fileToExport is not empty). Moreover, please show a warning in case it is empty.
| Globals.TASK_EXECUTOR, | ||
| dialogService, | ||
| JabRefPreferences.getInstance(), ExternalFileTypes.getInstance()); | ||
| JabRefPreferences.getInstance().getXMPPreferences(),JabRefPreferences.getInstance().getFilePreferences(), ExternalFileTypes.getInstance()); |
There was a problem hiding this comment.
please put them on new lines as the other dependencies
…Contextmenu * upstream/master: (21 commits) Bump junit-vintage-engine from 5.4.2 to 5.5.0 Bump log4j-api from 2.11.2 to 2.12.0 Bump junit-platform-launcher from 1.4.2 to 1.5.0 Bump log4j-core from 2.11.2 to 2.12.0 Bump log4j-slf4j18-impl from 2.11.2 to 2.12.0 Bump log4j-jul from 2.11.2 to 2.12.0 Bump junit-jupiter from 5.4.2 to 5.5.0 Bump com.github.johnrengelman.shadow from 5.0.0 to 5.1.0 Bump log4j-jcl from 2.11.2 to 2.12.0 Bump fontbox from 2.0.15 to 2.0.16 (#5080) Bump pdfbox from 2.0.15 to 2.0.16 (#5081) Bump xmpbox from 2.0.15 to 2.0.16 (#5082) Update FUNDING.yml Delete autoapproval.yml Bump com.install4j.gradle from 7.0.11 to 7.0.12 (#5077) Configure autoapproval plugin for dependabot Bump xmlunit-matchers from 2.6.2 to 2.6.3 (#5074) Bump checkstyle from 8.21 to 8.22 (#5072) Bump xmlunit-core from 2.6.2 to 2.6.3 (#5073) Refactor for loop to stream in groupTree Close version socket ...
Fixes #5066