Enable updating entries from web sources without identifiers#14644
Enable updating entries from web sources without identifiers#14644Nusa942 wants to merge 1 commit intoJabRef:mainfrom
Conversation
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
|
Dont do translation manually. See contributing guide, https://devdocs.jabref.org/code-howtos/localization.html#adding-a-new-key |
| private final TaskExecutor taskExecutor; | ||
| private final DialogService dialogService; | ||
|
|
||
| public UpdateEntryFromWebSourcesAction(StateManager stateManager, UndoManager undoManager, GuiPreferences preferences, NotificationService notificationService, TaskExecutor taskExecutor, DialogService dialogService) { |
| if (stateManager.getActiveDatabase().isEmpty()) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
i'll check all your comments and push again, thank you!
|
Meaning: Undo all changes to l10n files except english one. |
| BibEntry mergedEntry = merged.get(); | ||
| NamedCompoundEdit compoundEdit = new NamedCompoundEdit(Localization.lang("Update entry from web sources")); | ||
|
|
||
| Set<Field> jointFields = new TreeSet<>(Comparator.comparing(Field::getName)); | ||
| jointFields.addAll(mergedEntry.getFields()); | ||
| Set<Field> originalFields = new TreeSet<>(Comparator.comparing(Field::getName)); | ||
| originalFields.addAll(entry.getFields()); | ||
|
|
||
| boolean edited = false; | ||
|
|
||
| for (Field field : jointFields) { | ||
| Optional<String> originalString = entry.getField(field); | ||
| Optional<String> mergedString = mergedEntry.getField(field); | ||
|
|
||
| if (originalString.isEmpty() || !originalString.equals(mergedString)) { | ||
| String newValue = mergedString.orElse(""); | ||
| entry.setField(field, newValue); | ||
| compoundEdit.addEdit(new UndoableFieldChange(entry, field, originalString.orElse(null), newValue)); | ||
| edited = true; | ||
| } | ||
| } | ||
|
|
||
| for (Field field : originalFields) { | ||
| if (!jointFields.contains(field) && !FieldFactory.isInternalField(field)) { | ||
| Optional<String> originalString = entry.getField(field); | ||
| entry.clearField(field); | ||
| compoundEdit.addEdit(new UndoableFieldChange(entry, field, originalString.orElse(null), null)); | ||
| edited = true; | ||
| } | ||
| } |
There was a problem hiding this comment.
This is AI genereted, isn't it? Our merge dialogs should already be able to do it.
There was a problem hiding this comment.
I didn't realized the dialog did it already, i'll take a look.
|
I'll convert this to draft, as it seems there are a lot of work |
# Conflicts: # jabgui/src/main/java/org/jabref/gui/mergeentries/UpdateEntryFromWebSourcesAction.java
bf8a34a to
abfd0e9
Compare
|
Hey, we noticed that you force-pushed your changes. Force pushing is a bad practice when working together on a project (mainly because it is not supported well by GitHub itself). Commits are lost and comments on commits lose their context, thus making it harder to review changes. When the pull request is getting integrated into In future, please avoid that. For now, you can continue working. |
|
JUnit tests of You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide. |
|
The requested changes were not addressed for 14 days. Please follow-up in the next 7 days or your PR will be automatically closed. You can check the contributing guidelines for hints on the pull request process. |
|
This PR is being closed due to continued inactivity. |
Closes #14185
Adds a new Lookup menu action that updates an existing bibliographic entry using web sources based on the entry’s current metadata (title, authors, year), without requiring identifiers. The action retrieves one candidate per source and presents the results in the multi-merge dialog, updating the original entry only after user confirmation.
Steps to test
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user