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

Fix for issue 571: File folders: Move between global and user-specific #12059

Closed
wants to merge 70 commits into from

Conversation

Officialshubham
Copy link

Describe the changes you have made here:
Created a separate class to handle movement of files between directories. The class follows the structure and logic mention in issue #12287

Class Location: org.jabref/gui/fieldeditors
Class Name: FileDirectoryHandler
Class Description: Primary objective of this class to give target directory based on the current location/path of the file.

Changes in LinkedFilesEditor.java

  1. Instead of relying upon static text in context menu, based on target path, the text will change.
  2. Dynamic update of text once the file moved to its destination.
  3. Changes to both MOVE_TO_FOLDER and MOVE_TO_FOLDER_AND_RENAME menu item and action.

Changes in LinkedFileViewModel.java

  1. Add moveToDirectory function responsible for actually moving the file based on the return value from file directory handler class.
  2. Add extra helper functions to update text in context menu as well as to determine OS specific directories.
  3. Preserved the sub directory structures.

Add some tests to check the functionality of FileDirectoryHandler

Closes https://github.com/koppor/jabref/issues/571

Special Note: Want to confirm whether going in right direction or not. Unit Testing is in process.
Manual testing is performed. Creating a draft PR for review.

Screenshots

library-specific

user-specific

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 applicable)
  • 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.

Officialshubham and others added 30 commits October 8, 2024 01:26
@Officialshubham
Copy link
Author

@koppor and @HoussemNasri.
I have resolved all the comments mentioned. Have a look at it. Thanks

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

an old review comment was not posted - it is still valid.

Pleae also fix buildres/abbrv.jabref.org

}
}

public void moveToDirectory(MenuItem moveFileItem, MenuItem moveAndRenameFileItem, boolean toRename) {
Copy link
Member

Choose a reason for hiding this comment

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

I think, a similar function already exists at org.jabref.logic.externalfiles.LinkedFileHandler#copyOrMoveToDefaultDirectory. One "just" needs to make it more generic to get the target directory (instead of databaseContext.getFirstExistingFileDir(filePreferences);).

With the record I proposed, this should be very easy.

@@ -325,68 +371,96 @@ private ContextMenu createContextMenuForFile(LinkedFileViewModel linkedFile) {
factory.createMenuItem(StandardActions.OPEN_FOLDER, new ContextAction(StandardActions.OPEN_FOLDER, linkedFile, preferences)),
new SeparatorMenuItem(),
factory.createMenuItem(StandardActions.DOWNLOAD_FILE, new ContextAction(StandardActions.DOWNLOAD_FILE, linkedFile, preferences)),
moveFileItems[0],
Copy link
Member

Choose a reason for hiding this comment

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

No - not any arrays in Java.

rl712 and others added 15 commits October 27, 2024 11:44
…irectory and person + pdf icon to be displayed for user-specific file directory.

Signed-off-by: Rhonda Luu <[email protected]>
# Conflicts:
#	src/main/resources/l10n/JabRef_en.properties
…n file directory and person + pdf icon to be displayed for user-specific file directory."

This reverts commit c4f9212.
… for main file directory and person + pdf icon to be displayed for user-specific file directory.""

This reverts commit 216ba2d.
NOTE: not sure if this may cause other issues
…ssue-571

# Conflicts:
#	src/main/resources/l10n/JabRef_en.properties
…for-issue-571

# Conflicts:
#	src/main/resources/l10n/JabRef_en.properties
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".

…as "world + pdf" icons if stored in the "General file directory" and "person+ pdf" if stored in the "user-specific file directory"
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".

@koppor koppor added the status: changes required Pull requests that are not yet complete label Oct 31, 2024
@koppor
Copy link
Member

koppor commented Dec 9, 2024

Closing this issue due to inactivity 💤

@koppor koppor closed this Dec 9, 2024
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.

7 participants