Added Button to Shorten the DOI#13657
Merged
Merged
Conversation
…r shortening the DOI to the button
| @Inject private GuiPreferences preferences; | ||
| @Inject private UndoManager undoManager; | ||
| @Inject private StateManager stateManager; | ||
| private Optional<BibEntry> entry = Optional.empty(); |
There was a problem hiding this comment.
The entry field is modified directly in bindToEntry method instead of being treated as immutable. Optional should be used for return values, not for fields.
Member
There was a problem hiding this comment.
Generally we should refactor this to be more elegant without the use of an Optional field here. Needs also to be done in ISSNEditor and IdentifierEditor.
But on the other hand we would add null checks on other places or we would add an get function for the entry that returns an optional.
So it's more of an moving the problem to other places
palukku
requested changes
Aug 6, 2025
HoussemNasri
reviewed
Aug 6, 2025
HoussemNasri
requested changes
Aug 6, 2025
- Add requested notification for successful DOI shortening - Fix formatting issues in DoiIdentifierEditorViewModel - Clarify changelog entry as suggested
- Add notification text to JabRef_en.properties - Change name of the function in DOIEditor to shortenID
- shortenID method in BaseIdentifierEditorViewModel.java now throws an exception for unsupported operation. -Merged DOIEditor contents to IdentifierEditor -Added tooltip to the button
HoussemNasri
reviewed
Aug 7, 2025
- Added sentence to JabRef_en.properties_en
- Changed notification message code to obey UI language rules - Added canShortenIdentifier boolean to the BaseIdentifierEditorViewModel.java, changed the configure method, added new methods associated with it and changed affected classes.
palukku
requested changes
Aug 7, 2025
HoussemNasri
reviewed
Aug 8, 2025
| String shortenedDOI = shortenDOIFormatter.format(doi); | ||
| entry.setField(field, shortenedDOI); | ||
| LOGGER.info("Shortened DOI: {} to {}", doi, shortenedDOI); | ||
| dialogService.notify(Localization.lang("Shortened DOI to: %0", shortenedDOI)); |
Member
There was a problem hiding this comment.
We should show an alternative message if DOI is already short.
…entifierEditor.java Co-authored-by: Philip <37398281+palukku@users.noreply.github.com>
- Added a message for when the DOI is already shortened
|
@trag-bot didn't find any issues in the code! ✅✨ |
HoussemNasri
approved these changes
Aug 8, 2025
palukku
approved these changes
Aug 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13639
Created new DOI package for handling DOI data. Created new DOIEditor class and fxml file, moving the logic for DOI from IdentifierEditor. Added an if statement to the FieldEditors to implement the new DOIEditor class.
Steps to take:
-Implement the shorten DOI logic to the button
Steps to test
Open the program and create a new example library.

Double click an entry and click the 'General' tab.
There should be a button that indicates shortening near the DOI field.
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)