Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore auto rename feature 2 #12604

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

wtfjjking
Copy link

@wtfjjking wtfjjking commented Mar 3, 2025

Screenshot 2025-03-03 at 16 16 13

User now can be able to automatically change their file name when they change their entry data, by just click the checkbox in the preferences ->linked file -> auto rename files if entry changes, and the auto rename functionality will be started,
and also when the user change the entry data, the citation key. Also will automatically change, so they don't need to click the generate button manually,(This automatically change citation key functionality is initiated regardless of the checkbox of the auto rename files functionality is clicked)

Mandatory checks

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

Jiewu (jack deng) Deng added 10 commits March 3, 2025 10:49
…ibliography entries change,

respecting user preferences and file naming patterns.
…nked files based on entry changes

and follows user-defined file naming patterns.
…enaming is enabled based on user preferences.

refreshFileLink(): Updates and returns a linked file with the correct relative path based on its current location and database context.
Files are correctly renamed on disk
File links in the bibliography entries are properly updated
Appropriate fallback mechanisms work when exact renaming isn't possible
Added autoRenameFilesOnEntryChange property to control automatic renaming
Updated constructor and related getter/setter methods
Added "Auto rename files if entry changes" checkbox to the preferences UI
Implemented data binding with the ViewModel
Added properties and methods for managing the automatic renaming setting
Implemented logic for loading and saving settings
Added AUTO_RENAME_FILES_ON_ENTRY_CHANGE constant
Updated FilePreferences initialization code
Added internationalization support for UI text
Register automatic file renamer
@wtfjjking wtfjjking marked this pull request as draft March 3, 2025 16:23
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.
In case of issues with the import order, double check that you activated Auto Import. You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Your code currently does not meet JabRef's code guidelines. We use OpenRewrite to ensure "modern" Java coding practices. The issues found can be automatically fixed. Please execute the gradle task rewriteRun, check the results, commit, and push.
You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".

@subhramit
Copy link
Member

Hello @wtfjjking
Which tool are you using to make these commits?

@wtfjjking
Copy link
Author

hello i am using ide to make these commits not in terminal

@subhramit
Copy link
Member

hello i am using ide to make these commits not in terminal

Can you sign in to GitHub on your IDE properly (using authorization) so that these commits have a traceable author?
Tell me your IDE, I'll help you out.

…is related to the unused method that has been deleted, change bootstrap method so that it has the correct parameters
@wtfjjking wtfjjking marked this pull request as ready for review March 3, 2025 18:29
@wtfjjking wtfjjking marked this pull request as draft March 3, 2025 18:31
… more useful comments to the listen method
@wtfjjking
Copy link
Author

Screenshot 2025-03-03 at 18 44 52 hi i am using intellij here it said that it's already linked to my github account

@wtfjjking wtfjjking marked this pull request as ready for review March 3, 2025 18:46
@subhramit
Copy link
Member

hello i am using ide to make these commits not in terminal

If you are using IntelliJ and not the terminal, how exactly are you adding the commit descriptions (apart from the message)?

@wtfjjking
Copy link
Author

oh i figure it out I am using windsurf ide to commit the code

@@ -105,7 +105,7 @@ private static void insertBasicFactories(XSet xSet, XImplementationLoader xImpLo
* </pre>
*
* @return an array of default commandline options
* @see #bootstrap(String[])
Copy link
Author

Choose a reason for hiding this comment

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

here lacks one parameter it should be @see #bootstrap(String[], Path) otherwise the project doesn't compile

Copy link
Member

Choose a reason for hiding this comment

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

I really don't see why openoffice gui files need to be touched here.

Copy link
Member

Choose a reason for hiding this comment

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

Side track: Git Butler is a neat git client for submitting unrelated pull requests while keeping all changes locally merged. - However, this for advanced users, because one will get feedback on the pull requests and need to handle them.

@koppor
Copy link
Member

koppor commented Mar 13, 2025

oh i figure it out I am using windsurf ide to commit the code

TBH JabRef might not be fitting your coding needs. We are a project where humans curate the code. Especially, we avoid code duplciations nearly at all costs. Windsurf and other AI-driven IDEs just produce code without taking care if there is existing similar functionality.

I suggest either to take this Java learning opportinuity and navigate JabRefs code for yourself using the senior developer IDE IntelliJ or move on to a project which is more relaxed on AI usage.

@koppor koppor marked this pull request as draft March 13, 2025 11:57
@koppor koppor added the status: changes required Pull requests that are not yet complete label Mar 13, 2025
@koppor
Copy link
Member

koppor commented Mar 13, 2025

I clicked on update branch to ensure that our latest quality check workflows run.

Copy link

trag-bot bot commented Mar 17, 2025

@trag-bot didn't find any issues in the code! ✅✨

Copy link
Contributor

You modified Markdown (*.md) files and did not meet JabRef's rules for consistently formatted Markdown files. To ensure consistent styling, we have markdown-lint in place. Markdown lint's rules help to keep our Markdown files consistent within this repository and consistent with the Markdown files outside here.

You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "Markdown".


new Thread(() -> {
try {
Thread.sleep(500); // avoid renaming the file too frequently
Copy link
Member

Choose a reason for hiding this comment

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

Use background task infrasturcture


import com.google.common.eventbus.Subscribe;

public class AutomaticFileRenamer {
Copy link
Member

Choose a reason for hiding this comment

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

Use org.jabref.logic.cleanup.RenamePdfCleanup#cleanup instead of self-written class. If this is not possible, comment why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: changes required Pull requests that are not yet complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants