Skip to content

Refactor OpenExternalFileAction #13508

Merged
Siedlerchr merged 15 commits into
JabRef:mainfrom
Muskan244:fix-for-issue-13431
Jul 12, 2025
Merged

Refactor OpenExternalFileAction #13508
Siedlerchr merged 15 commits into
JabRef:mainfrom
Muskan244:fix-for-issue-13431

Conversation

@Muskan244

Copy link
Copy Markdown
Contributor

Closes #13431

This PR refactors the existing OpenExternalFileAction logic by introducing two separate files:

  • OpenSingleExternalFileAction: Handles the case where exactly one entry is selected and it contains exactly one linked file.
  • OpenSelectedEntriesFilesAction: Handles all other cases. Also includes a check for the single-entry-single-file scenario and delegates to OpenSingleExternalFileAction when appropriate.

Steps to test

  1. Open JabRef and select one entry with one linked file.
  2. If there is no attached file, Right-click and choose "Attach File".
  3. Right-click and choose "Open File". It should invoke OpenSingleExternalFileAction and open that file.
  4. Select multiple entries or an entry with multiple files.
  5. Right-click and choose "Open File". It should invoke OpenSelectedEntriesFilesAction and open all files (with confirmation if more than 10).

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.

Muskan244 and others added 3 commits July 8, 2025 13:23
…ion and OpenSelectedEntriesFilesAction

- Introduced OpenSingleExternalFileAction to handle single entry with one linked file
- Introduced OpenSelectedEntriesFilesAction to handle multiple selection cases

Fixes JabRef#13431
Comment thread jabgui/src/main/java/org/jabref/gui/maintable/OpenSingleExternalFileAction.java Outdated
@Muskan244 Muskan244 changed the title Fix for issue 13431 Refactor OpenExternalFileAction Jul 8, 2025
@Muskan244

Copy link
Copy Markdown
Contributor Author

Hi @koppor,
I noticed that the CI reports some test failures in CitationStyleGeneratorTest and CSLFormatUtilsTest, mainly due to month formatting differences like "July" vs. "Jul." and some submodules modification detection when i haven't done any.
These tests seem unrelated to my changes, which are limited to splitting OpenExternalFileAction into two separate classes for better handling of file opening based on selection. Just wanted to flag this for clarity. Please let me know if there is some issue from my side and i am missing it or if anything else is needed from my side!

@koppor

koppor commented Jul 8, 2025

Copy link
Copy Markdown
Member

@Muskan244 look at submodules FAQ at https://devdocs.jabref.org/code-howtos/faq.html

With the right sub module checkout, the tests will pass.

@Muskan244

Copy link
Copy Markdown
Contributor Author

Hi! I’ve pushed the requested changes, and it looks like all checks have passed. Just checking in to see if there's anything more I should do. Thanks again for guiding me through this!

koppor
koppor previously requested changes Jul 10, 2025
Comment thread jabgui/src/main/java/org/jabref/gui/maintable/OpenSelectedEntriesFilesAction.java Outdated
Comment thread jabgui/src/main/java/org/jabref/gui/maintable/OpenSelectedEntriesFilesAction.java Outdated
dependabot Bot and others added 3 commits July 11, 2025 13:30
…13505)

Bumps [org.junit.platform:junit-platform-launcher](https://github.com/junit-team/junit-framework) from 1.13.1 to 1.13.3.
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](https://github.com/junit-team/junit-framework/commits)

---
updated-dependencies:
- dependency-name: org.junit.platform:junit-platform-launcher
  dependency-version: 1.13.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
@koppor

koppor commented Jul 11, 2025

Copy link
Copy Markdown
Member

I removed the check for the single file. Works here.

I just ask for a second review.

@koppor koppor added the status: awaiting-second-review For non-trivial changes label Jul 11, 2025
@trag-bot

trag-bot Bot commented Jul 11, 2025

Copy link
Copy Markdown

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

@Siedlerchr Siedlerchr added this pull request to the merge queue Jul 12, 2025
Merged via the queue into JabRef:main with commit dd823a4 Jul 12, 2025
1 check passed
@Muskan244 Muskan244 deleted the fix-for-issue-13431 branch July 18, 2025 09:51
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 1, 2025
JabRef/jabref#13508
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSelectedEntriesFilesAction
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSingleExternalFileAction
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 1, 2025
JabRef/jabref#13508
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSelectedEntriesFilesAction
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSingleExternalFileAction
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 1, 2025
JabRef/jabref#13508
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSelectedEntriesFilesAction
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSingleExternalFileAction
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 2, 2025
Siedlerchr added a commit that referenced this pull request Aug 2, 2025
* upstream/main:
  Bump com.squareup.okhttp3:okhttp from 5.0.0 to 5.1.0 in /versions (#13541)
  Fixed Issue 13418: "Search ShortSience" should do a latex-to-unicode conversion (#13532)
  New Crowdin updates (#13548)
  Add focus to field Link in the "Add file link" dialog. (#13520)
  Bump org.ow2.asm:asm from 9.6 to 9.8 in /versions (#13547)
  Make validation optional for saving library properties preferences (#13488)
  Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0 in /versions (#13546)
  --porcelain does not output any info or warn errors on the console (#13469)
  Bump jablib/src/main/resources/csl-locales from `7e137db` to `3bad433` (#13545)
  Refine "File exists" warning (#13491)
  Bump org.openrewrite.recipe:rewrite-recipe-bom from 3.8.0 to 3.11.1 (#13544)
  Bump org.openrewrite.rewrite from 7.8.0 to 7.11.0 (#13542)
  Bump jablib/src/main/resources/csl-styles from `704ff9f` to `59f124d` (#13540)
  Add architecture test for logging infrastructure (#13534)
  More harsh test on title of PR
  New Crowdin updates (#13533)
  Update extra-java-module-info plugin (#13527)
  [Junie]: fix: display help output for --help argument (#13446)
  Refactor OpenExternalFileAction  (#13508)
maorethians pushed a commit to maorethians/RefactoringMiner that referenced this pull request Jun 8, 2026
JabRef/jabref#13508
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSelectedEntriesFilesAction
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSingleExternalFileAction
maorethians pushed a commit to maorethians/RefactoringMiner that referenced this pull request Jun 8, 2026
JabRef/jabref#13508
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSelectedEntriesFilesAction
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSingleExternalFileAction
maorethians pushed a commit to maorethians/RefactoringMiner that referenced this pull request Jun 8, 2026
JabRef/jabref#13508
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSelectedEntriesFilesAction
Move Method	public execute() : void from class org.jabref.gui.maintable.OpenExternalFileAction to public execute() : void from class org.jabref.gui.maintable.OpenSingleExternalFileAction
maorethians pushed a commit to maorethians/RefactoringMiner that referenced this pull request Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: awaiting-second-review For non-trivial changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor OpenExternalFileAction

3 participants