Skip to content

Update linked file tooltip when the file is renamed or moved - #17543

Merged
Siedlerchr merged 4 commits into
JabRef:mainfrom
Skyhawkcoder30:fix-for-issue-9277
Oct 26, 2026
Merged

Siedlerchr merged 4 commits into
JabRef:mainfrom
Skyhawkcoder30:fix-for-issue-9277

Conversation

@Skyhawkcoder30

Copy link
Copy Markdown
Contributor

Summary

Tooltip was not up to date after moving and renaming a file in the main tab under files and links. We changed and made the tooltip connected to the files link/description as well. Now, when the link changes, the tooltip text updates simultaneously.

Steps to test

  1. Create a Library and save it
  2. Add or pick an entry (double click any row)
  3. In the Main tab under "Files and links", attach a file
  4. Change the entry's title
  5. Right click the file and click Rename file to defined pattern
  6. Hover over the file and it shows the new updated file name
After Image for Pull request

Related issues and pull requests

Closes #9277

AI usage

Claude (Anthropic), model Claude Opus 5.5
AIL3 (AI Created, Human full Structure)
It generated the code. I reviewed the code and made sure it was correct/well written, and I understood fully what the AI wrote. I first reproduced the bug, then tested the fix manually in JabRef to make sure changes were correct.

AI CHECKLIST.md walkthrough

1. Code self-review

  • [/] No == null / != null checks — none added.
  • [/] No Objects.requireNonNull(...) — none added.
  • [/] New classes annotated with @NullMarked — no new classes.
  • [/] New packages annotated with @NullMarked — no new packages.
  • [/] Optional consumed correctly — no Optional used.
  • [/] StringUtil.isBlank(...) — no blank checks added.
  • [/] No catch (Exception e) — no catch blocks.
  • [/] No throw new RuntimeException(...) — none.
  • [/] Logged exceptions as last argument — no logging.
  • [/] New BibEntry objects built with withers — none.
  • [/] Modern Java used — no collections or paths involved.
  • [/] Regexes precompiled — none.
  • [/] Alphabetical ordering — no variables or enum items added.
  • [/] Background work uses BackgroundTask — none.
  • No commented-out code, no trivial comments, no AI-disclosure comments in source.
  • [/] Markdown Javadoc — none added.
  • [/] User-facing text localized — no new text; tooltip shows the same text as before.
  • [/] Sentence case — no new text.
  • [/] Variance with placeholders — no new text.
  • [/] HTML escaping — no HTML output.
  • [/] Issue example covered by a test — UI-only change in jabgui; tested manually.
  • [/] Behavior changes in model/logic have tests — change is in jabgui only.
  • [/] Test conventions — no tests added.
  • [/] Fetcher tests — not a fetcher.

2. Verification commands

  • ./gradlew :jablib:check
  • ./gradlew checkstyleMain checkstyleTest checkstyleJmh (ran :jabgui:checkstyleMain passed.)
  • ./gradlew modernizer
  • ./gradlew --no-configuration-cache :rewriteDryRun
  • ./gradlew javadoc
  • npx markdownlint-cli2 "docs/**/.md" ".md"
  • npm ci && npm run textlint
  • [/] intellij-format via docker — only if formatting is still off after rewriteRun.

3. Documentation

4. Pull request

  • PR body built from the template, every section filled.
  • All checklist items kept and marked.
  • "Steps to test" is a numbered list with a cropped screenshot.
  • All HTML comments removed.
  • PR created with gh pr create --body-file — created through the GitHub website instead.
  • [/] CHANGELOG TODO placeholder — not used; real issue link.

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • If AI tools were used, I disclosed them in the "AI usage" section and reviewed, understood, and take full ownership of all AI-generated code
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if change is visible to the user)
  • I added one sentence (max 20 words) to CHANGELOG.md describing the change from the user's point of view (if the change is visible to the user)
  • [/] I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

@jabref-machine jabref-machine added the dev: send-to-black-forest Port to the black-forest branch of JabRef/jabref-black-forest after merging (ADR-0073) label Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @Skyhawkcoder30! 👋

Thank you for contributing to JabRef!

We have automated checks in place, based on which you will soon get feedback if any of them are failing. We also use Qodo for review assistance. It will update your pull request description with a review help and offer suggestions to improve the pull request.

After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. You can read about the whole pull request process in our contribution guide.

Please ensure that your pull request is in line with our AI Usage Policy and make necessary disclosures.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Keep linked-file tooltips current after renaming or moving files

🐞 Bug fix 📝 Documentation 🕐 Less than 10 minutes

Grey Divider

AI Description

• Bind linked-file tooltips to file links and descriptions so they reflect renames and moves.
• Document the tooltip fix in the changelog.
Diagram

graph TD
    A["File properties"] --> B["Linked-file view model"] --> C["Tooltip binding"] --> D["List-cell tooltip"]
Loading
High-Level Assessment

Binding this tooltip to the two properties it displays is appropriately scoped. Extending the shared list-cell factory to make all string tooltips reactive would broaden the change without a demonstrated need.

Files changed (2) +9 / -1

Bug fix (1) +8 / -1
LinkedFilesEditor.javaBind linked-file tooltip text to mutable file details +8/-1

Bind linked-file tooltip text to mutable file details

• Replaces the one-time tooltip string with a tooltip whose text is bound to the linked file's link and description properties. Renaming, moving, or changing the description now refreshes the tooltip without recreating the list cell.

jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java

Documentation (1) +1 / -0
CHANGELOG.mdDocument the linked-file tooltip fix +1/-0

Document the linked-file tooltip fix

• Adds a user-facing note explaining that tooltips no longer show the old file name after a rename or move, with a link to issue #9277.

CHANGELOG.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Refreshes retain dead file listeners ✓ Resolved
Description
The tooltip callback creates a new string binding every time a non-empty cell is refreshed, but the
binding is not disposed when the cell receives another item. Repeated list updates can therefore
leave stale weak listener registrations on long-lived linked-file properties until those properties
invalidate, adding avoidable memory and update overhead.
Code

jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java[R168-171]

+                    tooltip.textProperty().bind(Bindings.createStringBinding(
+                            linkedFile::getDescriptionAndLink,
+                            linkedFile.linkProperty(),
+                            linkedFile.descriptionProperty()));
Evidence
The PR creates a new binding inside the tooltip callback. The cell factory invokes that callback
during every non-empty update, while its cleanup only unsubscribes entries in the separate
subscriptions list; the linked-file properties are long-lived model properties, so discarded
tooltip bindings can leave stale listener registrations until invalidation.

jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java[166-173]
jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java[169-195]
jablib/src/main/java/org/jabref/model/entry/LinkedFile.java[101-105]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The tooltip callback creates a new JavaFX string binding for every cell refresh, but `ViewModelListCellFactory` only disposes subscriptions explicitly registered by the cell. Old tooltip bindings can consequently leave stale listener registrations on linked-file properties.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java[166-173]
- jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java[169-195]
### Recommended Fix
Ensure the binding created for a tooltip is disposed when the list cell changes or is cleared. Extend the tooltip/cell-factory lifecycle if necessary so callback-created bindings are registered with the cell's existing subscription cleanup rather than being left attached after the tooltip is replaced.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The requested changes were not addressed for 3 days. Please follow-up in the next 7 days or your PR will be automatically closed. You can check the contributing guidelines for hints on the pull request process.

@github-actions github-actions Bot added the status: stale Issues marked by a bot as "stale". All issues need to be investigated manually. label Oct 25, 2026
… into fix-for-issue-9277

* 'fix-for-issue-9277' of github.com:Skyhawkcoder30/jabref: (38 commits)
  Accept single-line entry fields on Enter (JabRef#17530)
  ci: skip changelog check for stable ports (JabRef#17593)
  Fix wrong author and year when importing PDFs with creator-app metadata (JabRef#16247)
  Chore(deps): Bump us.hebi.graalvm:jfx-static-feature in /versions (JabRef#17589)
  Chore(deps): Bump org.graalvm.sdk:nativeimage in /versions (JabRef#17588)
  Chore(deps): Bump us.hebi.graalvm:jfx-static-libs in /versions (JabRef#17587)
  Chore(deps): Bump net.bytebuddy:byte-buddy in /versions (JabRef#17585)
  Chore(deps): Bump com.uber.nullaway:nullaway in /versions (JabRef#17584)
  Chore(deps): Bump org.hisp.dhis:json-tree in /versions (JabRef#17586)
  Update dependency com.konghq:unirest-modules-gson to v4.10.3 (JabRef#17583)
  New translations jabref_en.properties for (Italian) (JabRef#17580)
  Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.6.1 (JabRef#17579)
  Feature 12874 pdf isbn extraction (JabRef#17467)
  Fail "Check PR Format" when the MIT license checkbox is not ticked (JabRef#17550)
  Tighten PR title check to catch branch-name-like titles (JabRef#17568)
  Improve OCR failure diagnostics (JabRef#17220)
  Sort organisations in correct alphabetical order (JStyle) (JabRef#17499)
  Serve linked PDF files per entry in the HTTP server (JabRef#17567)
  Fix bibtex key leading whitespace (JabRef#17496)
  Add GraalVM native image support for JabGui (JabRef#17407)
  ...

@Siedlerchr Siedlerchr 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.

works bow

@Siedlerchr
Siedlerchr enabled auto-merge October 26, 2026 21:04
@github-actions github-actions Bot added size: medium component: ui and removed size: small component: ui status: changes-required Pull requests that are not yet complete status: stale Issues marked by a bot as "stale". All issues need to be investigated manually. labels Oct 26, 2026
@Siedlerchr
Siedlerchr added this pull request to the merge queue Oct 26, 2026
@github-actions github-actions Bot added status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers status: to-be-merged PRs which are accepted and should go into the merge-queue. and removed status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Oct 26, 2026
Merged via the queue into JabRef:main with commit 6124ec8 Oct 26, 2026
77 checks passed
@jabref-machine

Copy link
Copy Markdown
Collaborator

Successfully created backport PR for stable:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: entry-editor component: ui dev: send-to-black-forest Port to the black-forest branch of JabRef/jabref-black-forest after merging (ADR-0073) first contrib size: medium status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tooltip not up to date after moving and renaming file

3 participants