Skip to content

Fix #14948: imported entries group should not focus it#14983

Merged
koppor merged 7 commits into
JabRef:mainfrom
LoayTarek5:fix-imported-entries-group
Feb 1, 2026
Merged

Fix #14948: imported entries group should not focus it#14983
koppor merged 7 commits into
JabRef:mainfrom
LoayTarek5:fix-imported-entries-group

Conversation

@LoayTarek5

@LoayTarek5 LoayTarek5 commented Feb 1, 2026

Copy link
Copy Markdown
Collaborator

User description

Closes #14948

Fixed an issue where the "Imported entries" group was being automatically selected/focused when switching between library tabs, even when the group was empty and no import operation was occurring.
The fix removes the unwanted auto-selection behavior, while still creating the group when the preference is enabled.
Now the group is only selected when explicitly chosen by the user or during an actual import operation.
capture_260201_115801

Steps to test

  1. Go to PreferencesLibrary
  2. Enable the checkbox "Automatically assign imported entries to group"
  3. Open or create at least 2 different .bib library files (so you have multiple tabs)
    In the first library tab, select any group other than "Imported entries"
  4. Switch to the second library tab
  5. Switch back to the first library tab
  6. Create a new library (or use one without the "Imported entries" group)
  7. Switch to another tab and back
  8. Go to PreferencesLibrary
  9. Disable the checkbox "Automatically assign imported entries to group"
  10. Switch between library tabs

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • 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 described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [/] I checked the user 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 updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

PR Type

Bug fix


Description

  • Removes auto-selection of "Imported entries" group on tab switch

  • Group still created when preference enabled, but not focused

  • Prevents unwanted focus theft when switching library tabs


Diagram Walkthrough

flowchart LR
  A["Tab Switch Event"] --> B["Check Preference Enabled"]
  B --> C["Create Group if Missing"]
  C --> D["Skip Auto-Selection"]
  D --> E["User Retains Current Selection"]
Loading

File Walkthrough

Relevant files
Bug fix
GroupTreeViewModel.java
Remove auto-selection of imported entries group                   

jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java

  • Removed selectedGroups.setAll() call that auto-selected the imported
    entries group
  • Added clarifying comments explaining group creation without selection
  • Group is now created when preference enabled but not automatically
    focused
+2/-1     
Documentation
CHANGELOG.md
Document imported entries group fix                                           

CHANGELOG.md

+1/-0     

@github-actions

github-actions Bot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Hey @LoayTarek5! 👋

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

qodo-free-for-open-source-projects Bot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟡
🎫 #13109
🔴 Make the Pseudonymization functionality available on the CLI
Implement similar CLI experience as the consistency check
Follow the implementation pattern of the CheckConsistency class
🟡
🎫 #14948
🟢 Prevent automatic selection/focus of the "Imported Entries" group when switching between
library tabs
Ensure the group is still created when the preference is enabled
Fix the issue where the group shows as selected with 0 entries while the main table shows
entries
The fix should apply when multiple bib files are opened and the import to group preference
is activated
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

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

qodo-free-for-open-source-projects Bot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add null check to prevent crash

Add a null check for the parent parameter in the addGroupImportEntries method to
prevent a potential NullPointerException.

jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java [189-209]

 private void addGroupImportEntries(GroupNodeViewModel parent) {
-    if (!preferences.getLibraryPreferences().isAddImportedEntriesEnabled()) {
+    if (parent == null || !preferences.getLibraryPreferences().isAddImportedEntriesEnabled()) {
         return;
     }
 
     String groupName = preferences.getLibraryPreferences().getAddImportedEntriesGroupName();
     boolean groupExists = parent.getGroupNode()
                                 .getChildren()
                                 .stream()
                                 .map(GroupTreeNode::getGroup)
                                 .anyMatch(grp -> grp instanceof ExplicitGroup && grp.getName().equals(groupName));
     if (!groupExists) {
         currentDatabase.ifPresent(db -> {
             char keywordSeparator = preferences.getBibEntryPreferences().getKeywordSeparator();
             AbstractGroup importEntriesGroup = new ExplicitGroup(groupName, GroupHierarchyType.INDEPENDENT, keywordSeparator);
             GroupTreeNode newSubgroup = parent.addSubgroup(importEntriesGroup);
             newSubgroup.moveTo(parent.getGroupNode(), 0);
             writeGroupChangesToMetaData();
         });
     }
 }
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a potential NullPointerException because addGroupImportEntries can be called with a null parent from onActiveDatabaseChanged. Adding a null check is a robust way to prevent this potential crash.

Medium
  • Update

@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Feb 1, 2026
@LoayTarek5 LoayTarek5 force-pushed the fix-imported-entries-group branch 2 times, most recently from 8514929 to 0372f95 Compare February 1, 2026 11:25
@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Feb 1, 2026
@LoayTarek5 LoayTarek5 force-pushed the fix-imported-entries-group branch from 0372f95 to c5944db Compare February 1, 2026 11:49
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Feb 1, 2026
@LoayTarek5 LoayTarek5 changed the title Fix imported entries group Fix #14948: imported entries group should not focus it Feb 1, 2026
@github-actions github-actions Bot added the good second issue Issues that involve a tour of two or three interweaved components in JabRef label Feb 1, 2026

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

Tried out locally. Works fine. Just added a dot to the end of the two sentecnes.

Comment thread jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java Outdated
@koppor koppor enabled auto-merge February 1, 2026 23:06
@koppor

koppor commented Feb 1, 2026

Copy link
Copy Markdown
Member

Now the group is only selected when explicitly chosen by the user or during an actual import operation.

Side note: You don't need to anonymize a bibtex file with zero entries. -- You have "create example library" in the Welcome Tab and https://github.com/JabRef/jabref-demonstration-libraries/ for examples.

@koppor koppor added this pull request to the merge queue Feb 1, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Feb 1, 2026
Merged via the queue into JabRef:main with commit 227c3e7 Feb 1, 2026
50 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first contrib good second issue Issues that involve a tour of two or three interweaved components in JabRef Review effort 2/5 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.

Creation of the "Imported Entries" group should not focus it

2 participants