Skip to content
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

Fix deletion of multiple files should show one confirmation dialog #9573

Closed
wants to merge 5 commits into from
Closed

Fix deletion of multiple files should show one confirmation dialog #9573

wants to merge 5 commits into from

Conversation

shreverr
Copy link

Fixes #9473

Moved code of delete dialog from LinkedFileViewModel to LinkedFilesEditorViewModel.
Made a separate method in 'LinkedFilesEditorViewModel' for deleting multiple files deleteFiles.
Made a 'getDir' method in LinkedFileViewModel to get the path of file.

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Deleting single File

image

Deleting Multiple Files

image

Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your interest in JabRef development and your proposed changes. I took a quick look into it and am a bit concerned that the changes do not really work well as they are right now.
I believe the whole delete stuff should move to a new class extending SimpleCommand to make this undoable eventually. This command could then be called at any place and should not depend on JavaFX dialog buttons.

Thanks!

Comment on lines +381 to +382
public boolean delete(Optional<ButtonType> buttonType, ButtonType removeFromEntry, ButtonType deleteFromEntry) {
Optional<Path> file = getDir();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid passing Optionals as arguments.
Why at all is a ButtonType object being used in the ViewModel?
This does not seem right at all. The ViewModel should not have to deal with the ui elements, this breaks the mvvm pattern. Please use primitives here.

@@ -589,4 +579,9 @@ private Supplier<BibEntry> wrapImporterToSupplier(Importer importer, Path filePa
}
};
}

public Optional<Path> getDir() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use abbreviations. Try to be more concise, what directory is being looked for?

@Siedlerchr
Copy link
Member

Closing this PR due to inactivity 💤
Please reopen the PR if you plan to continue working on this

@Siedlerchr Siedlerchr closed this Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting multiple linked files should show a single confirmation dialog
4 participants