Skip to content

Fix #13269 : support multi-file import across different formats #13271

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

070jhz
Copy link
Contributor

@070jhz 070jhz commented Jun 7, 2025

Closes #13269

this PR improves the import command to properly handle importing multiple files with different supported formats in a single operation.

ImportCommand::execute now calls dialogService.showFileOpenDialogAndGetMultipleFiles instead of dialogService.showFileOpenDialog and importSingleFile() has been refactored to importMultipleFiles() to handle one or more files

Steps to test

  1. File menu > Import > Import into current/new library
  2. Select one or more files
  3. ???
  4. Profit

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • [/] Screenshots added in PR description (if change is visible to the user)
  • 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.

@070jhz 070jhz changed the title Fix 13269 Fix #13269 : support multi-file import across different formats Jun 7, 2025
@Siedlerchr
Copy link
Member

PLease add a changelog entry, otherwise it's good to go!

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jun 11, 2025
@jabref-machine
Copy link
Collaborator

You modified Markdown (*.md) files and did not meet JabRef's rules for consistently formatted Markdown files. To ensure consistent styling, we have markdown-lint in place. Markdown lint's rules help to keep our Markdown files consistent within this repository and consistent with the Markdown files outside here.

You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "Markdown".

Copy link
Member

@subhramit subhramit left a comment

Choose a reason for hiding this comment

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

I have some questions

|| selectedExtensionFilter == FileFilterConverter.ANY_FILE
|| "Available import formats".equals(selectedExtensionFilter.getDescription())) {
task = BackgroundTask.wrap(
() -> doImport(files, null));
Copy link
Member

Choose a reason for hiding this comment

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

Why should it be null for cases selectedExtensionFilter == FileFilterConverter.ANY_FILE || "Available import formats".equals(selectedExtensionFilter.getDescription()) ? The logic in the else case is more general - shouldn't that work here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I just realized that it worked because showFileOpenDialogAndGetMultipleFiles doesn't update selectedExtensionFilter which makes sense, but then it's always null and always imports with no format specified, whether its a singular or multiple files.

I'll update showFileOpenDialogAndGetMultipleFiles and refactor importMultipleFiles to infer format only when there's only one file to be imported and no specific filter


if (importMethod == ImportMethod.AS_NEW) {
if (importMethod == ImportMethod.AS_NEW || tab == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment why the second condition works, as otherwise just by reading code this seems like a logic proxy/hacky way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Import into current library" can still be enabled if there are no libraries open. Is that intentional ? If not, then comment should mention a bug report ?

@subhramit subhramit added status: changes-required Pull requests that are not yet complete status: waiting-for-feedback The submitter or other users need to provide more information about the issue labels Jun 14, 2025
Copy link

trag-bot bot commented Jun 14, 2025

@trag-bot didn't find any issues in the code! ✅✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: changes-required Pull requests that are not yet complete status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers status: waiting-for-feedback The submitter or other users need to provide more information about the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

multi file import not working
4 participants