OpenOffice refactoring- subtask: Break down large methods like guiActionInsertEntry()#15380
OpenOffice refactoring- subtask: Break down large methods like guiActionInsertEntry()#15380anuv-bit wants to merge 24 commits intoJabRef:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| public void guiActionSelectDocument(boolean autoSelectForSingle) throws WrappedTargetException, NoSuchElementException { | ||
| final String errorTitle = Localization.lang("Problem connecting"); | ||
| final String connectionError = Localization.lang("Problem connecting"); |
There was a problem hiding this comment.
Please revert these renamings - since they are function-local, they needn't be more specific
There was a problem hiding this comment.
Understood, I reverted them. Are there more magic strings that you would like replaced with constants (that I have not already replaced)? My understanding was that not every single string needed to be replaced with a constant, especially in cases where the string is unique and is only used once.
Thank you!
There was a problem hiding this comment.
These above were not magic strings. They were already constants.
Yes, ideally we extract constants for strings used more than once.
But there is one other case - when the string reduces readability of the code, or is long.
There was a problem hiding this comment.
Thank you for the confirmation! To clarify: I was referring to changes made in a previous commit in which I did replace magic strings with constants, not this commit which was just renaming the existing constants.
| /// @param citationType Indicates whether it is an in-text citation, a citation in parenthesis or an invisible citation. | ||
| /// @param citationStyle Indicates style, name and path of citation | ||
| /// @param syncOptions Indicates whether in-text citations should be refreshed in the document. Optional.empty() indicates no refresh. Otherwise, provides options for refreshing the reference list. | ||
| public void guiActionCSLCitationHandler(List<BibEntry> entries, XTextDocument doc, CitationType citationType, CitationStyle citationStyle, |
There was a problem hiding this comment.
These are more like class names - please use names denoting actions for methods
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…s-for-issue-11829 # Conflicts: # jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBase.java
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| LOGGER.error("Could not insert entry", e); | ||
| OOError.fromMisc(e).setTitle(errorTitle).showErrorDialog(dialogService); | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
Shouldn't this still use OOError.fromMisc?
|
Could you please also extract methods for JStyle and CSL in |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ame methods for clarity
This comment has been minimized.
This comment has been minimized.
✅ All tests passed ✅🏷️ Commit: 0751f17 Learn more about TestLens at testlens.app. |
Thank you for the guidance @pluto-han. I extracted a 'performPreUpdateChecks()' method similar to the 'performPreInsertionChecks()' method extracted from |
Thank you for helping in reviews @pluto-han! |
For me, I would prefer include try-catch as well for more readability, but I am not maintainer cannot simply decide it. |
Related issues and pull requests
Closes #11829
PR Description
This PR focuses on the subtask of breaking down the large methods guiActionInsertEntry() and guiActionUpdateDocument() in OOBibBase.java. Next steps would be making sure changes line up with the guidelines.
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)