-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add copy linked files action to contextmneu in general tab #5068
Conversation
@@ -48,10 +52,14 @@ | |||
@FXML private final LinkedFilesEditorViewModel viewModel; | |||
@FXML private ListView<LinkedFileViewModel> listView; | |||
|
|||
@Inject private StateManager stateManager; | |||
private final DialogService dialogService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use @Inject ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java
Outdated
Show resolved
Hide resolved
Refactor preferences parameter Remove unsused parameter from dialog
Added a variant for a single entry and did some refactoring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now. Just some minor remarks
.build(); | ||
Optional<Path> exportPath = dialogService.showDirectorySelectionDialog(dirDialogConfiguration); | ||
exportPath.ifPresent(this::copyFileToDestination); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty new line
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -137,7 +137,7 @@ private void addLinkedFileFromURL(URL url, BibEntry entry, Path targetDirectory) | |||
basePanel.getBibDatabaseContext(), | |||
Globals.TASK_EXECUTOR, | |||
dialogService, | |||
JabRefPreferences.getInstance(), ExternalFileTypes.getInstance()); | |||
JabRefPreferences.getInstance().getXMPPreferences(),JabRefPreferences.getInstance().getFilePreferences(), ExternalFileTypes.getInstance()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put them on new lines as the other dependencies
src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java
Outdated
Show resolved
Hide resolved
…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