-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 9091 - store merge entries toolbar configuration #9712
Conversation
…ainTextOrDiff to JabrefPreferences
…ewaytoolbar fields
…word preference in listener method
I couldn't assign @ssrpro to the PR, but so you know he is working on this PR with @dragos222 on the same team. |
Stored configuration should be loaded when the UI is created, e.g. at the constructor. Have a look at |
src/main/java/org/jabref/gui/mergeentries/MergeEntriesDialog.java
Outdated
Show resolved
Hide resolved
…eferences to threewaymergeview object
Thank you for your feedback. The saveGuiPreferences has been delegated to the ThreeWayMergeView object and the MergeEntriesDialog object does not get access to the toolbar object. |
@@ -185,6 +196,14 @@ public enum PlainTextOrDiff { | |||
this.value = value; | |||
} | |||
|
|||
public static PlainTextOrDiff parse(String name) { | |||
try { | |||
return PlainTextOrDiff.valueOf(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use Guava's https://guava.dev/releases/15.0/api/docs/com/google/common/base/Enums.html#getIfPresent(java.lang.Class,%20java.lang.String) here, it's a little improvement as it does not throw an exception
@@ -176,6 +180,14 @@ public void setOnSelectRightEntryValuesButtonClicked(Runnable onClick) { | |||
selectRightEntryValuesButton.setOnMouseClicked(e -> onClick.run()); | |||
} | |||
|
|||
public void saveGuiPreferences() { | |||
preferencesService.getGuiPreferences().setMergePlainTextOrDiff(plainTextOrDiffComboBox.getValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I created the PlainTextOrDiff
enum type, I thought it would be useful because I can embed the "Plain Text" and "Show Diff" texts in there, and display the labels in UI. In preferences, I think a boolean should suffice. Maybe a boolean property named shouldShowDiffs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would have the advantage that you can then use bidrectional binding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented this for both PlainTextOrDiff and DiffView enums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The merge configurations are being saved perfectly in the MergeEntriesDialog
, however, in the DuplicateResolverDialog
they are not. This is a complication, because the three-way merge UI is being used in multiple dialogs, so it's not obvious when the user is done with the UI and thus when to save the configuration.
I would start by doing the same changes you did to MergeEntriesDialog
to the DuplicateResolverDialog
, but this time, you want to save the configurations on all actions but the "Cancel" one.
Overall, I think you did a good job implementing this. Once the duplicate resolver dialog is updated, I think we can merge.
The three way merge view toolbar preferences are now saved in |
- Also changed some names and code structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the courtesy to adjust some names and restructure the code.
Also, while using the merge dialog, I expected the configuration to be saved even if I clicked "Cancel", so I changed that for both dialogs.
Thanks again for working on this enhancement. It would significantly improve the merging user experience, especially when resolving duplicates.
Fixes #9091
The Merge Entries toolbar configuration now gets saved once the user hits 'Merge entries' button. More specifically, the plainTextOrDiff combo box, diffView combo box, and highlight words/highlight characters values are being stored using the GuiPreferences, and JabRefPreferences objects respectively. The 'Only show changed fields' check box was already handled, therefore I did not change its implementation.
I have a question regarding the showDiff method from ThreeWayMergeView class: should this method be left the way it is now, or should it get updated so that the user's preferences are loaded when invoking the showDiff method?
Compulsory checks