Skip to content

Conversation

@BOgdAnSAM-sudo
Copy link
Contributor

@BOgdAnSAM-sudo BOgdAnSAM-sudo commented Jan 13, 2026

User description

Closes #11791.

Moved the functionality of org.jabref.gui.journals.UndoableAbbreviator and org.jabref.gui.journals.UndoableUnabbreviator to org.jabref.logic.cleanup.AbbreviateJournalCleanup and org.jabref.logic.cleanup.UnabbreviateJournalCleanup respectivly. Added "Journal-related" tab to "Clean up entries" dialog. Added the journal abbreviations actions to the "Cleanup entries" dialog.

Some code was used from #12835.

Before

before before_cleanup

After

after after_quality

Steps to test

  1. Chose entry with journal field.
  2. Open "Quality" menu.
  3. Notice that "Abbreviate journal names" and "Unabbreviate journal names" options are now removed.
  4. Open "Clean up entries" dialog.
  5. Notice that new tab "Journal-related" was added.
  6. In "Journal-related" tab click on "Manage journal abbreviations" combobox and choose desired options.
  7. After pressing "Clean up" button selected actions should be done: abbreviate in case of "Abbreviate (default)", "Abbreviate (dotless)", "Abbreviate (shortest unique)"; uabbreviate in case of "Unabbreviate"; no changes in case of "No changes".

Mandatory checks

Proposed user documentation changes JabRef/user-documentation#613.


PR Type

Enhancement


Description

  • Moved journal abbreviation actions from Quality menu to Cleanup dialog

  • Added new "Journal-related" tab with abbreviation/unabbreviation options

  • Refactored UndoableAbbreviator and UndoableUnabbreviator to cleanup jobs

  • Moved AbbreviationType from GUI to logic package for better separation

  • Updated cleanup worker to support journal field abbreviation operations


Diagram Walkthrough

flowchart LR
  A["Quality Menu<br/>Abbreviate/Unabbreviate"] -->|Removed| B["Cleanup Dialog"]
  C["UndoableAbbreviator<br/>UndoableUnabbreviator"] -->|Refactored to| D["AbbreviateJournalCleanup<br/>UnabbreviateJournalCleanup"]
  E["GUI Package<br/>AbbreviationType"] -->|Moved to| F["Logic Package<br/>AbbreviationType"]
  B -->|New Tab| G["Journal-related Panel<br/>with ComboBox Options"]
  D -->|Integrated into| H["CleanupWorker"]
Loading

File Walkthrough

Relevant files
Enhancement
22 files
JabRefGUI.java
Add journal abbreviation repository to GUI initialization
+4/-2     
StandardActions.java
Remove journal abbreviation menu actions from standard actions
+0/-7     
CleanupAction.java
Add journal abbreviation repository parameter to cleanup action
+7/-2     
CleanupDialog.java
Add journal-related panel to cleanup dialog tabs                 
+10/-5   
CleanupDialogViewModel.java
Add journal abbreviation repository to cleanup view model
+8/-3     
CleanupJournalRelatedPanel.java
New panel for journal abbreviation cleanup options             
+82/-0   
CleanupJournalRelatedViewModel.java
New view model for journal cleanup preferences                     
+33/-0   
CleanupSingleAction.java
Add journal abbreviation repository to single entry cleanup
+6/-2     
EntryEditor.java
Pass journal abbreviation repository to cleanup action     
+1/-1     
JabRefFrame.java
Add journal abbreviation repository field and initialization
+9/-3     
MainMenu.java
Remove journal abbreviation menu items and update cleanup action
+6/-14   
MainToolBar.java
Add journal abbreviation repository to toolbar cleanup button
+5/-2     
AbbreviateAction.java
Remove deprecated abbreviate action class                               
+0/-138 
UndoableUnabbreviator.java
Remove deprecated unabbreviator class                                       
+0/-76   
KeyBinding.java
Remove abbreviation and unabbreviation key bindings           
+0/-2     
AbbreviateJournalCleanup.java
New cleanup job for journal abbreviation                                 
+35/-26 
CleanupPreferences.java
Add journal abbreviation cleanup step enums                           
+9/-2     
CleanupWorker.java
Integrate journal abbreviation cleanup jobs                           
+15/-1   
UnabbreviateJournalCleanup.java
New cleanup job for journal unabbreviation                             
+85/-0   
AbbreviationType.java
Move abbreviation type from GUI to logic package                 
+1/-1     
JabRefCliPreferences.java
Exclude journal abbreviation from default cleanup jobs     
+5/-1     
CleanupJournalRelatedPanel.fxml
New FXML layout for journal cleanup panel                               
+25/-0   
Tests
7 files
KeyBindingRepositoryTest.java
Update test to use different key binding                                 
+3/-3     
KeyBindingsTabModelTest.java
Update tests to use merge entries instead of abbreviate   
+16/-16 
KeyBindingViewModelTest.java
Update test to use different key binding                                 
+4/-4     
JournalAbbreviationRepositoryTest.java
Refactor tests to use new cleanup job classes                       
+32/-37 
AbbreviateJournalCleanupTest.java
Add comprehensive tests for abbreviate journal cleanup     
+307/-0 
CleanupWorkerTest.java
Update cleanup worker test with journal abbreviation repository
+2/-1     
UnabbreviateJournalCleanupTest.java
Add comprehensive tests for unabbreviate journal cleanup 
+183/-0 
Documentation
9 files
JabRef_de.properties
Add German translation for journal-related tab                     
+2/-1     
JabRef_en.properties
Add English translation for journal-related tab                   
+1/-0     
JabRef_es.properties
Add Spanish translation for journal-related tab                   
+3/-2     
JabRef_fr.properties
Add French translation for journal-related tab                     
+1/-0     
JabRef_it.properties
Add Italian translation for journal-related tab                   
+1/-0     
JabRef_pl.properties
Add Polish translation for journal-related tab                     
+1/-0     
JabRef_pt_BR.properties
Add Portuguese translation for journal-related tab             
+1/-0     
JabRef_zh_CN.properties
Add Chinese translation for journal-related tab                   
+2/-1     
CHANGELOG.md
Document journal abbreviation feature relocation                 
+2/-0     
Additional files
2 files
Project.xml +1/-1     
csl-locales +1/-1     

…eanup and AbbreviateJournalCleanup instead of UndoableAbbreviator and UndoableUnabbreviator
@github-actions github-actions bot added the good second issue Issues that involve a tour of two or three interweaved components in JabRef label Jan 13, 2026
@qodo-free-for-open-source-projects
Copy link
Contributor

qodo-free-for-open-source-projects bot commented Jan 13, 2026

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
🟢
🎫 #11791
🟢 Add an option to abbreviate journal titles in the Cleanup operation dialog
Add an option to expand (unabbreviate) journal titles in the Cleanup operation dialog
Help users enforce their convention of using abbreviated or unabbreviated journal titles
through a cleanup operation
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
Copy link
Contributor

qodo-free-for-open-source-projects bot commented Jan 13, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Prevent unintended data loss on restore
Suggestion Impact:The commit directly implements the suggestion by adding a blank check for the fjournal field and moving the newText assignment earlier in the method. This prevents the method from overwriting the journal field with an empty value when fjournal is blank.

code diff:

+        String newText = entry.getField(AMSField.FJOURNAL).orElse("");
+        if (newText.isBlank()) {
+            return List.of();
+        }
+
         List<FieldChange> changes = new ArrayList<>();
 
         String origText = entry.getField(field).orElse("");
-        String newText = entry.getField(AMSField.FJOURNAL).orElse("");

In restoreFromFJournal, add a check to ensure the fjournal field is not blank
before proceeding to prevent accidental data loss in the journal field.

jablib/src/main/java/org/jabref/logic/cleanup/UnabbreviateJournalCleanup.java [67-84]

 private List<FieldChange> restoreFromFJournal(BibEntry entry, Field field) {
     if ((StandardField.JOURNAL != field && StandardField.JOURNALTITLE != field) || !entry.hasField(AMSField.FJOURNAL)) {
+        return List.of();
+    }
+
+    String newText = entry.getField(AMSField.FJOURNAL).orElse("");
+    if (newText.isBlank()) {
         return List.of();
     }
 
     List<FieldChange> changes = new ArrayList<>();
 
     String origText = entry.getField(field).orElse("");
-    String newText = entry.getField(AMSField.FJOURNAL).orElse("");
 
     entry.setField(AMSField.FJOURNAL, "");
     changes.add(new FieldChange(entry, AMSField.FJOURNAL, newText, ""));
 
     entry.setField(field, newText);
     changes.add(new FieldChange(entry, field, origText, newText));
 
     return changes;
 }

[Suggestion processed]

Suggestion importance[1-10]: 8

__

Why: The suggestion identifies a critical bug where an empty fjournal field could incorrectly clear an existing journal field, leading to data loss. This is a significant correctness issue.

Medium
High-level
Refactor cleanup jobs for better composition

Refactor the journal abbreviation cleanup jobs to operate on a single field
instead of multiple hardcoded fields. This change will improve modularity and
allow for more flexible composition in the future.

Examples:

jablib/src/main/java/org/jabref/logic/cleanup/AbbreviateJournalCleanup.java [34-42]
    public List<FieldChange> cleanup(BibEntry entry) {
        List<FieldChange> allChanges = new ArrayList<>();

        allChanges.addAll(abbreviateField(entry, StandardField.JOURNAL));
        allChanges.addAll(abbreviateField(entry, StandardField.JOURNALTITLE));

        return allChanges;
    }
jablib/src/main/java/org/jabref/logic/cleanup/UnabbreviateJournalCleanup.java [27-35]
    @Override
    public List<FieldChange> cleanup(BibEntry entry) {
        List<FieldChange> allChanges = new ArrayList<>();

        allChanges.addAll(unabbreviate(entry, StandardField.JOURNAL));
        allChanges.addAll(unabbreviate(entry, StandardField.JOURNALTITLE));

        return allChanges;
    }

Solution Walkthrough:

Before:

public class AbbreviateJournalCleanup implements CleanupJob {
    @Override
    public List<FieldChange> cleanup(BibEntry entry) {
        List<FieldChange> allChanges = new ArrayList<>();

        // Hardcoded fields
        allChanges.addAll(abbreviateField(entry, StandardField.JOURNAL));
        allChanges.addAll(abbreviateField(entry, StandardField.JOURNALTITLE));

        return allChanges;
    }
    // ...
}

After:

public class AbbreviateFieldCleanup implements CleanupJob {
    private final Field field;
    // ... constructor ...

    @Override
    public List<FieldChange> cleanup(BibEntry entry) {
        return abbreviateField(entry, this.field);
    }
    // ...
}

// In CleanupWorker or similar factory:
// jobs.add(new AbbreviateFieldCleanup(StandardField.JOURNAL, ...));
// jobs.add(new AbbreviateFieldCleanup(StandardField.JOURNALTITLE, ...));
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a design limitation where the new cleanup jobs hardcode multiple fields, reducing flexibility and reusability, which is a valid point for improving the architecture.

Low
General
Localize user-facing strings in UI
Suggestion Impact:The commit directly implements the suggestion by adding the Localization import (line 5) and wrapping all five user-facing strings in the toString method with Localization.lang() calls (lines 14, 17, 20, 23, 26), exactly as suggested.

code diff:

+import org.jabref.logic.l10n.Localization;
 
 import com.airhacks.afterburner.views.ViewLoader;
 import org.jspecify.annotations.NonNull;
@@ -42,15 +43,15 @@
                     case null ->
                             "";
                     case ABBREVIATE_DEFAULT ->
-                            "Abbreviate (default)";
+                            Localization.lang("Abbreviate (default)");
                     case ABBREVIATE_DOTLESS ->
-                            "Abbreviate (dotless)";
+                            Localization.lang("Abbreviate (dotless)");
                     case ABBREVIATE_SHORTEST_UNIQUE ->
-                            "Abbreviate (shortest unique)";
+                            Localization.lang("Abbreviate (shortest unique)");
                     case UNABBREVIATE ->
-                            "Unabbreviate";
+                            Localization.lang("Unabbreviate");
                     case ABBREVIATION_NO_CHANGES ->
-                            "No changes";
+                            Localization.lang("No changes");

Localize the user-facing strings in the toString method of the StringConverter
by wrapping them with Localization.lang().

jabgui/src/main/java/org/jabref/gui/cleanup/CleanupJournalRelatedPanel.java [38-57]

 public String toString(CleanupPreferences.CleanupStep object) {
     return switch (object) {
         case null ->
                 "";
         case ABBREVIATE_DEFAULT ->
-                "Abbreviate (default)";
+                Localization.lang("Abbreviate (default)");
         case ABBREVIATE_DOTLESS ->
-                "Abbreviate (dotless)";
+                Localization.lang("Abbreviate (dotless)");
         case ABBREVIATE_SHORTEST_UNIQUE ->
-                "Abbreviate (shortest unique)";
+                Localization.lang("Abbreviate (shortest unique)");
         case UNABBREVIATE ->
-                "Unabbreviate";
+                Localization.lang("Unabbreviate");
         case ABBREVIATION_NO_CHANGES ->
-                "No changes";
+                Localization.lang("No changes");
         default ->
                 object.toString();
     };
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly points out that user-facing strings in the new CleanupJournalRelatedPanel class should be localized for internationalization, which is a standard practice in the project.

Low
Learned
best practice
Verify semantic change in documentation

The comment was changed from "iff" (if and only if) to "if", but this changes
the semantic meaning. "iff" is a mathematical term indicating bidirectional
implication, while "if" only indicates one direction. Verify whether the
original "iff" was intentional and correct.

jablib/src/main/java/org/jabref/logic/cleanup/CleanupDialogViewModel.java [138-142]

 /**
  * Runs the cleanup on the entry and records the change.
  *
- * @return true if entry was modified
+ * @return true iff entry was modified
  */

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why:
Relevant best practice - Correct typographical errors in documentation, code comments, configuration files, and user-facing strings. This includes fixing misspellings in variable names, method names, documentation text, changelog entries, and localization strings to maintain code quality and professionalism.

Low
Fix typo in changelog entry
Suggestion Impact:The suggestion was directly implemented. The commit changed "journal abbreviation" to "journal abbreviations" in the CHANGELOG.md file, exactly as suggested.

code diff:

-- We moved journal abbreviation from the "Quality" menu to the "Clean up entries" dialog [#11791](https://github.com/JabRef/jabref/issues/11791)
+- We moved journal abbreviations from the "Quality" menu to the "Clean up entries" dialog [#11791](https://github.com/JabRef/jabref/issues/11791)

The word "abbreviation" should be pluralized to "abbreviations" to match the
feature name and maintain consistency with the rest of the codebase where
"journal abbreviations" is used.

CHANGELOG.md [20]

-- We moved journal abbreviation from the "Quality" menu to the "Clean up entries" dialog [#11791](https://github.com/JabRef/jabref/issues/11791)
+- We moved journal abbreviations from the "Quality" menu to the "Clean up entries" dialog [#11791](https://github.com/JabRef/jabref/issues/11791)

[Suggestion processed]

Suggestion importance[1-10]: 5

__

Why:
Relevant best practice - Correct typographical errors in documentation, code comments, configuration files, and user-facing strings. This includes fixing misspellings in variable names, method names, documentation text, changelog entries, and localization strings to maintain code quality and professionalism.

Low
  • Update

@github-actions github-actions bot added the status: changes-required Pull requests that are not yet complete label Jan 13, 2026
@github-actions github-actions bot added status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete labels Jan 13, 2026
@github-actions
Copy link
Contributor

Your pull request conflicts with the target branch.

Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Jan 15, 2026
BOgdAnSAM-sudo added a commit to BOgdAnSAM-sudo/user-documentation that referenced this pull request Jan 15, 2026
Updated instructions for bulk journal name conversion to reflect new menu structure and options added in JabRef/jabref#14850.
@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good second issue Issues that involve a tour of two or three interweaved components in JabRef Review effort 4/5 status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add cleanup operation for journal abbreviation

2 participants