jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Implement journal abbreviation storage in separate directory (Closes #10557)

Open Daniel-Ruan opened this issue 4 months ago • 0 comments

"Closes #10557".

Description

This pull request addresses issue #10557 by implementing two features to store journal abbreviation lists in a separate directory. The main goal is to improve the organization and management of journal abbreviations in JabRef.

Changes made:

  1. Implemented a new default directory for journal abbreviation lists:

    • On Windows: %APPDATA%\..\local\org.jabref\jabref\journal-abbreviations
    • Similar paths for other operating systems
  2. Added a preference option for users to change the journal abbreviation directory.

  3. Implemented automatic creation of custom.csv in the journal abbreviation directory if it doesn't exist.

  4. Updated the relevant logic classes:

    • Added new properties and methods to handle the journal abbreviation directory
  5. Updated related components:

    • Modified the preferences dialog to include the new journal abbreviation directory setting
    • Updated the journal abbreviation management UI to reflect the new directory structure
  6. Implemented automatic detection of journal lists in the specified directory:

    • Added logic to scan for .csv files in the directory
    • Prepared groundwork for future implementation of .csv to .mv store conversion (not implemented in this PR)
    • Update the journal abbreviation management UI to reflect the new directory structure

TODO (Not implemented in this PR):

Implement automatic detection of journal lists in the specified directory:

  • Add logic to scan for .csv files in the directory

  • Prepare groundwork for future implementation of .csv to .mv store conversion

  • Implemented logic to ensure the directory always returns a valid path

UI Changes

We have attached three screenshots showing the updated UI for journal abbreviations in the preferences dialog:

[Attach your three screenshots here]

  1. Screenshot 1: Overview of the journal abbreviations preference page 1

  2. Screenshot 2: Switch to the default custom CSV 2

  3. Screenshot 3: List of detected journal abbreviation files in the new directory 3

Testing

  • Extensive manual testing has been performed to verify the functionality of the new journal abbreviation directory feature.
  • Unit tests have been added for the JournalAbbreviationPreferences class to ensure proper handling of the new directory setting.
  • During units testing, we encountered bugs related to the newly introduced directory variable:
    • In some test scenarios, attempts to get the directory path resulted in null values.
    • We are still working on a robust solution to handle these null cases consistently.

Request for Review Guidance

We would greatly appreciate any suggestions or guidance from the reviewers on how to effectively handle potential null values when retrieving the journal abbreviation directory path. Specifically:

  • Are there best practices within the JabRef codebase for handling potentially null file paths?
  • Should we implement additional null checks, or is there a preferred way to ensure the directory is always initialized?
  • Are there any specific test scenarios or edge cases we should consider to improve the robustness of our implementation?

Your insights on these matters would be invaluable in helping us refine our approach and ensure the reliability of this new feature.

Mandatory checks

  • [x] I own the copyright of the code submitted and I licence it under the MIT license
  • [x] ] Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • [ ] ] Tests created for changes (if applicable)
  • [x] ] Manually tested changed features in running JabRef (always required)
  • [x] ] Screenshots added in PR description (for UI changes)
  • [x] ] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [x] ] 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.

Daniel-Ruan avatar Oct 20 '24 02:10 Daniel-Ruan