-
-
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 #2721 append to a field #3395
Fix for issue #2721 append to a field #3395
Conversation
…ity -> set/clear/rename fields
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.
Thanks for your PR!
I had a first look at the code and overall everything looks fine. Good work! I just have a few minor naming suggestions, but nothing big. I would still test your changes locally, but am lacking time for that right now. More feedback later.
@@ -235,6 +251,10 @@ public void actionPerformed(ActionEvent e) { | |||
ce.addEdit(MassSetFieldAction.massRenameField(entryList, fields[0], renameTo.getText(), | |||
overwrite.isSelected())); | |||
} | |||
} else if (append.isSelected()) { | |||
for (String field1 : fields) { |
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.
Nitpick: field1
is not really a good variable name here. The loop iterates over all fields and not just the first. Please rename this to field
.
text = ""; | ||
} | ||
|
||
NamedCompound ce = new NamedCompound(Localization.lang("Append field")); |
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.
Since this is new code, please do proper naming (and don't get inspired by all the bad naming in JabRef). So please call this compoundEdit
(or something similar) instead of ce
.
|
||
NamedCompound ce = new NamedCompound(Localization.lang("Append field")); | ||
for (BibEntry entry : entries) { | ||
Optional<String> oldVal = entry.getField(field); |
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.
Same here: Why not call it oldValue
.
…tToAppend / Set etc.) for review and rename some variables from old code to match.
@lenhard Thanks for your review! Totally agree, have made changes as requested and updated some of the old stuff to match. |
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.
Thank you for this contribution! The functionality looks fine, I just have one remark regarding the naming of variables. Would you mind changing that? Besides that the PR can be merged to master!
private JRadioButton rename; | ||
private JComboBox<String> field; | ||
private JTextField text; | ||
private JTextField setText; |
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 know this has been there before your PR, but I would like to encourage you to change the naming of these JTextFields.
Background: In Java you usually use verbs or verbs+nouns for method names. When having some buttons in a GUI I can still understand that it is acceptable to name the variables after the button's functionality. However, when it comes to these Textfields, I would say a verb+noun combination is really misleading.
How about naming them something like textFieldSet
, textFieldAppend
, textFieldRename
?
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.
@LinusDietz Thank you for your review. Those names are much better! Have made the changes as requested.
@ethanwharris nice! We'll merge this as soon as another maintainer approves. |
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.
Ok, I have tested your PR now manually and everything works as it should, great job!
I have one last issue, though: Because you change the localization of the menu item, all translations except for the English one are lost. Could you please keep all translations for the menu item as they are? They won't be accurate (missing the append option), but at least they'll be partly translated. That is better then suddenly having an English menu item in a UI with an otherwise different language. And I hate to lose the effort of our translators.
…m set/clear/rename_fields
@lenhard Thank you for your feedback. Have now updated the menu localization to retain original translation, have also reflected this in the JabRef localization. |
@ethanwharris Ok, perfect! I've looked at the code again and this seems to be ready for merge now (which is what I will do right away). Thank you very much for your contribution! Feel very much invited to contribute more :-) |
* upstream/master: (26 commits) Fix test for quoted lang messages (#3424) Update gradle from 4.3 to 4.3.1 Fix #3411: ordering of fields in customized entry types works again (#3422) Backport of syncLang to python2 (#3420) Remove Versioneye badge Fix some error prone warnings Fix for issue #2721 append to a field (#3395) Fix travis - hopefully Remove 3.x changelog (#3250) Try to use hint of https://github.com/TheBoegl/shadow-log4j-transformer#usage-as-library Try to enable LGTM Update guava from 23.2 -> 23.3 (#3409) Update wiremock from 2.8.0 -> 2.10.1 Move groups field from others to general (#3407) Fix checkstyle issues to repair build Fix #3046: No longer allow duplicate fields in customized entry types (#3405) Strip invalid prolog when loading CitationStyles (#3404) Integrity check "Abbreviation Detection" detects abbreviated names for journals and booktitles based on the internal list instead of only looking for "." signs. (#3362) Update gradle from 4.2.1 to 4.3 Update gradle from 4.2.1 to 4.3 ...
* upstream/master: (23 commits) Feature java version check again (#3428) Fix test for quoted lang messages (#3424) Update gradle from 4.3 to 4.3.1 Fix #3411: ordering of fields in customized entry types works again (#3422) Backport of syncLang to python2 (#3420) Remove Versioneye badge Fix some error prone warnings Fix for issue #2721 append to a field (#3395) Fix travis - hopefully Remove 3.x changelog (#3250) Try to use hint of https://github.com/TheBoegl/shadow-log4j-transformer#usage-as-library Try to enable LGTM Update guava from 23.2 -> 23.3 (#3409) Update wiremock from 2.8.0 -> 2.10.1 Move groups field from others to general (#3407) Fix checkstyle issues to repair build Fix #3046: No longer allow duplicate fields in customized entry types (#3405) Strip invalid prolog when loading CitationStyles (#3404) Integrity check "Abbreviation Detection" detects abbreviated names for journals and booktitles based on the internal list instead of only looking for "." signs. (#3362) Update gradle from 4.2.1 to 4.3 ...
* upstream/master: (30 commits) Add Hint for checking master version (#3439) Replace LinkedFiles backslashes with forward slashes (#3403) fix isbn result from chimbori (#3442) Feature java version check again (#3428) Fix test for quoted lang messages (#3424) Update gradle from 4.3 to 4.3.1 Fix #3411: ordering of fields in customized entry types works again (#3422) Backport of syncLang to python2 (#3420) Remove Versioneye badge Fix some error prone warnings Fix for issue #2721 append to a field (#3395) Fix travis - hopefully Remove 3.x changelog (#3250) Try to use hint of https://github.com/TheBoegl/shadow-log4j-transformer#usage-as-library Try to enable LGTM Update guava from 23.2 -> 23.3 (#3409) Update wiremock from 2.8.0 -> 2.10.1 Move groups field from others to general (#3407) Fix checkstyle issues to repair build Fix #3046: No longer allow duplicate fields in customized entry types (#3405) ...
#2721
Add the append option to the dialog.
gradle localizationUpdate
?