Skip to content

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

Merged
Siedlerchr merged 12 commits into
JabRef:mainfrom
070jhz:fix-13269
Jun 19, 2025
Merged

Fix #13269 : support multi-file import across different formats#13271
Siedlerchr merged 12 commits into
JabRef:mainfrom
070jhz:fix-13269

Conversation

@070jhz

@070jhz 070jhz commented Jun 7, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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".

@subhramit subhramit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have some questions

Comment thread CHANGELOG.md
|| selectedExtensionFilter == FileFilterConverter.ANY_FILE
|| "Available import formats".equals(selectedExtensionFilter.getDescription())) {
task = BackgroundTask.wrap(
() -> doImport(files, null));

Copy link
Copy Markdown
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
Copy Markdown
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

LibraryTab tab = tabContainer.getCurrentLibraryTab();

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

Copy link
Copy Markdown
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
Copy Markdown
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
@trag-bot

trag-bot Bot commented Jun 14, 2025

Copy link
Copy Markdown

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

@Siedlerchr Siedlerchr enabled auto-merge June 19, 2025 16:23
@Siedlerchr Siedlerchr dismissed subhramit’s stale review June 19, 2025 16:23

got addresed I think

@Siedlerchr Siedlerchr added this pull request to the merge queue Jun 19, 2025
Merged via the queue into JabRef:main with commit 1a1cc24 Jun 19, 2025
1 check passed
@github-actions github-actions Bot mentioned this pull request Jun 19, 2025
2 tasks
Siedlerchr added a commit that referenced this pull request Jun 20, 2025
* upstream/main:
  Make snap available for arm64 as well (#13383)
  Hide Merge Metadata Dialog if there is nothing to merge (#13309)
  Fix #13269 : support multi-file import across different formats (#13271)
  Fix Javadoc in CitaviXmlImporter.java/getPages (#13381)
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