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 #2721 append to a field #3395

Merged

Conversation

ethanwharris
Copy link
Contributor

@ethanwharris ethanwharris commented Nov 3, 2017

#2721
Add the append option to the dialog.

  • Change in CHANGELOG.md described
  • Tests created for changes
  • Screenshots added (for bigger UI changes)
  • Manually tested changed features in running JabRef
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)
  • If you changed the localization: Did you run gradle localizationUpdate?

@LinusDietz LinusDietz changed the title Fix for issue 2721 append to a field Fix for issue #2721 append to a field Nov 3, 2017
Copy link
Member

@lenhard lenhard left a 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) {
Copy link
Member

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"));
Copy link
Member

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);
Copy link
Member

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.
@ethanwharris
Copy link
Contributor Author

@lenhard Thanks for your review! Totally agree, have made changes as requested and updated some of the old stuff to match.

Copy link
Member

@LinusDietz LinusDietz left a 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;
Copy link
Member

@LinusDietz LinusDietz Nov 6, 2017

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?

Copy link
Contributor Author

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.

@LinusDietz
Copy link
Member

@ethanwharris nice! We'll merge this as soon as another maintainer approves.

@lenhard lenhard added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Nov 6, 2017
Copy link
Member

@lenhard lenhard left a 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.

@ethanwharris
Copy link
Contributor Author

@lenhard Thank you for your feedback. Have now updated the menu localization to retain original translation, have also reflected this in the JabRef localization.

@lenhard
Copy link
Member

lenhard commented Nov 8, 2017

@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 :-)

@lenhard lenhard merged commit f2744d4 into JabRef:master Nov 8, 2017
Siedlerchr added a commit that referenced this pull request Nov 10, 2017
* 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
  ...
Siedlerchr added a commit that referenced this pull request Nov 18, 2017
* 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
  ...
Siedlerchr added a commit that referenced this pull request Nov 19, 2017
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants