Skip to content

[Port to stable] Update linked file tooltip when the file is renamed or moved - #17594

Closed
jabref-machine wants to merge 1 commit into
stablefrom
port-17543-to-stable
Closed

jabref-machine wants to merge 1 commit into
stablefrom
port-17543-to-stable

Conversation

@jabref-machine

Copy link
Copy Markdown
Collaborator

Port of #17543 to stable, see Branching strategy.

If this PR is a draft, the cherry-pick conflicted: the conflicting files are committed with Git's conflict markers left in. Resolve the markers locally, push, and mark the PR ready.

* Update linked file tooltip when the file is renamed or moved

* fix(gui): reuse linked-file cell tooltips

---------

Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
(cherry picked from commit 6124ec8)
@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 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Keep linked-file tooltips in sync with file paths and descriptions after changes.
• Reuse a tooltip per list cell while detaching listeners when cells are cleared or reused.
• Add lifecycle tests and document the observable-tooltip API.
Diagram

graph TD
  Link["Link property"] --> VM["Linked file VM"] --> Factory["Cell factory"] --> Tooltip["Bound tooltip"] --> Cell["List cell"]
  Description["Description property"] --> VM
Loading
High-Level Assessment

Use the proposed per-cell JavaFX binding. Explicit listeners would require manual cleanup during cell reuse, while a derived view-model property would add an abstraction for a single tooltip consumer.

Files changed (5) +246 / -41

Enhancement (1) +64 / -40
ViewModelListCellFactory.javaSupport reusable, observable cell tooltips +64/-40

Support reusable, observable cell tooltips

• Adds an observable-tooltip API that creates one tooltip per cell and binds its text to the current item. Retains the existing static and custom tooltip options, adds nullability annotations, and captures event callbacks locally.

jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java

Bug fix (1) +2 / -1
LinkedFilesEditor.javaBind linked-file tooltips to path and description +2/-1

Bind linked-file tooltips to path and description

• Replaces a snapshot tooltip string with observable text derived from the linked file's path and description. The tooltip now reflects renames, moves, and description changes.

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

Tests (1) +174 / -0
ViewModelListCellFactoryTest.javaTest tooltip updates and cell lifecycle +174/-0

Test tooltip updates and cell lifecycle

• Adds JavaFX tests for tooltip defaults, path and description updates, tooltip reuse, and listener removal when a cell changes items or becomes empty. Also checks interaction with validation-message tooltips.

jabgui/src/test/java/org/jabref/gui/util/ViewModelListCellFactoryTest.java

Documentation (2) +6 / -0
CHANGELOG.mdRecord the linked-file tooltip fix +1/-0

Record the linked-file tooltip fix

• Adds a changelog entry for stale file names in linked-file tooltips after a rename or move.

CHANGELOG.md

javafx.mdDocument observable list-cell tooltips +5/-0

Document observable list-cell tooltips

• Explains when to use observable, static-text, and custom tooltips. Describes how the observable binding follows cell reuse and releases listeners.

docs/code-howtos/javafx.md

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

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. The linked-file fix lacks a requirement 📘 Rule violation ⚙ Maintainability
Description
LinkedFilesEditor now binds tooltip text to linked-file properties so renames and moves change the
displayed name. Because this user-visible bug fix adds no corresponding entry under
docs/requirements/, its intended behavior is not captured in the requirements set for future
verification.
Code

jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java[R166-167]

+                .withTooltipText(linkedFile -> linkedFile.linkProperty().flatMap(_ ->
+                        linkedFile.descriptionProperty().map(_ -> linkedFile.getDescriptionAndLink())))
Evidence
The changed editor introduces a user-visible tooltip behavior tied to linked-file path and
description properties, and the changelog identifies it as a bug fix. No corresponding linked-file
tooltip requirement is added anywhere in the PR diff, violating the requirement-documentation
checklist item.

AGENTS.md: Document New Features and Significant Fixes in Requirements
jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java[166-167]
CHANGELOG.md[19-19]

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 linked-file tooltip behavior changed so the displayed file name updates after a rename or move, but the PR does not add a corresponding documented requirement.

## Fix Focus Areas
- docs/requirements/ux.md[1-194]
- jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java[166-167]

## Recommended Fix
Add a requirement to the appropriate requirements document describing that linked-file tooltips display the current file name and update when the linked file is renamed or moved. Include the required requirement identifier immediately after its heading and preserve the file's required markdownlint footer.

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



Informational

2. Blank file links can show empty tooltips 🐞 Bug ≡ Correctness
Description
withTooltipText always attaches a Tooltip, even when its bound text is blank, unlike
withStringTooltip, which leaves the cell without one. A linked file can have an empty link and
description, so a cell without an overriding validation warning receives an empty tooltip rather
than no tooltip.
Code

jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java[R105-107]

+            Tooltip tooltip = new Tooltip();
+            tooltip.textProperty().bind(cell.itemProperty().flatMap(toTooltipText::call).when(cell.emptyProperty().not()));
+            return _ -> tooltip;
Evidence
The new callback always returns its tooltip and updateItem installs that return value. The
previous static tooltip path filters blank strings; the linked-file model and add dialog permit
empty link and description values.

jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java[81-89]
jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java[103-108]
jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java[205-213]
jabgui/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialog.java[40-46]
jabgui/src/main/java/org/jabref/gui/linkedfile/LinkedFileEditDialogViewModel.java[165-177]
jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java[159-165]

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

## Issue description
`withTooltipText` attaches a tooltip even when its observable text is blank, whereas static string tooltips are omitted for blank text.

## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java[103-108]
- jabgui/src/test/java/org/jabref/gui/util/ViewModelListCellFactoryTest.java[70-97]

## Recommended Fix
Make the reactive tooltip absent when the current text is blank, while retaining the per-cell tooltip and listener cleanup when text becomes nonblank again. Add a test for both transitions.

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


Grey Divider

Context sources
❌ Tickets: failed to load — Ticket collection could not establish complete evidence
Review mode: Auto: ⚖️ Balanced: Behavioral JavaFX utility changes affect multiple cell configuration and lifecycle paths.

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

Comment on lines +166 to +167
.withTooltipText(linkedFile -> linkedFile.linkProperty().flatMap(_ ->
linkedFile.descriptionProperty().map(_ -> linkedFile.getDescriptionAndLink())))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. The linked-file fix lacks a requirement 📘 Rule violation ⚙ Maintainability

LinkedFilesEditor now binds tooltip text to linked-file properties so renames and moves change the
displayed name. Because this user-visible bug fix adds no corresponding entry under
docs/requirements/, its intended behavior is not captured in the requirements set for future
verification.
Agent Prompt
## Issue description
The linked-file tooltip behavior changed so the displayed file name updates after a rename or move, but the PR does not add a corresponding documented requirement.

## Fix Focus Areas
- docs/requirements/ux.md[1-194]
- jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java[166-167]

## Recommended Fix
Add a requirement to the appropriate requirements document describing that linked-file tooltips display the current file name and update when the linked file is renamed or moved. Include the required requirement identifier immediately after its heading and preserve the file's required markdownlint footer.

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

Comment on lines +105 to +107
Tooltip tooltip = new Tooltip();
tooltip.textProperty().bind(cell.itemProperty().flatMap(toTooltipText::call).when(cell.emptyProperty().not()));
return _ -> tooltip;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Informational

2. Blank file links can show empty tooltips 🐞 Bug ≡ Correctness

withTooltipText always attaches a Tooltip, even when its bound text is blank, unlike
withStringTooltip, which leaves the cell without one. A linked file can have an empty link and
description, so a cell without an overriding validation warning receives an empty tooltip rather
than no tooltip.
Agent Prompt
## Issue description
`withTooltipText` attaches a tooltip even when its observable text is blank, whereas static string tooltips are omitted for blank text.

## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java[103-108]
- jabgui/src/test/java/org/jabref/gui/util/ViewModelListCellFactoryTest.java[70-97]

## Recommended Fix
Make the reactive tooltip absent when the current text is blank, while retaining the per-cell tooltip and listener cleanup when text becomes nonblank again. Add a test for both transitions.

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

@koppor

koppor commented Oct 27, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code
Moved to JabRef#1: ports now target black-forest in that repository. Branch kept.

@koppor koppor closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants