-
-
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
Add compare button to duplicates in Citation relations tab #11915
Changes from 3 commits
c0f54ec
2edb8b6
e3c759c
ea4bb0e
a708875
09a35b0
95c1362
8bec936
8fc4f91
5eed679
99fa500
4bd4872
4bf1f44
0710c3d
9566980
272e686
f8736fc
6cfb3b9
447f220
080e80f
5f4264c
fbbd5f0
2631280
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,6 +5,7 @@ | |||||
import java.net.URI; | ||||||
import java.util.Arrays; | ||||||
import java.util.List; | ||||||
import java.util.Optional; | ||||||
|
||||||
import javax.swing.undo.UndoManager; | ||||||
|
||||||
|
@@ -39,6 +40,9 @@ | |||||
import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.CitationFetcher; | ||||||
import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.SemanticScholarFetcher; | ||||||
import org.jabref.gui.icon.IconTheme; | ||||||
import org.jabref.gui.mergeentries.EntriesMergeResult; | ||||||
import org.jabref.gui.mergeentries.MergeEntriesDialog; | ||||||
import org.jabref.gui.mergeentries.MergeTwoEntriesAction; | ||||||
import org.jabref.gui.preferences.GuiPreferences; | ||||||
import org.jabref.gui.util.NoSelectionModel; | ||||||
import org.jabref.gui.util.ViewModelListCellFactory; | ||||||
|
@@ -89,6 +93,8 @@ public class CitationRelationsTab extends EntryEditorTab { | |||||
private final CitationsRelationsTabViewModel citationsRelationsTabViewModel; | ||||||
private final DuplicateCheck duplicateCheck; | ||||||
private final BibEntryTypesManager entryTypesManager; | ||||||
private final StateManager stateManager; | ||||||
private final UndoManager undoManager; | ||||||
|
||||||
public CitationRelationsTab(DialogService dialogService, | ||||||
BibDatabaseContext databaseContext, | ||||||
|
@@ -104,6 +110,8 @@ public CitationRelationsTab(DialogService dialogService, | |||||
this.preferences = preferences; | ||||||
this.libraryTab = libraryTab; | ||||||
this.taskExecutor = taskExecutor; | ||||||
this.undoManager = undoManager; | ||||||
this.stateManager = stateManager; | ||||||
setText(Localization.lang("Citation relations")); | ||||||
setTooltip(new Tooltip(Localization.lang("Show articles related by citation"))); | ||||||
|
||||||
|
@@ -238,6 +246,13 @@ private void styleFetchedListView(CheckListView<CitationRelationItem> listView) | |||||
libraryTab.clearAndSelect(entry.localEntry()); | ||||||
}); | ||||||
vContainer.getChildren().add(jumpTo); | ||||||
|
||||||
Button compareButton = IconTheme.JabRefIcons.MERGE_ENTRIES.asButton(); | ||||||
compareButton.setTooltip(new Tooltip(Localization.lang("Compare with duplicate entries"))); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think "duplicate" is not a good term. It is about an existing entry in the library
Suggested change
|
||||||
compareButton.setOnMouseClicked(event -> { | ||||||
openPossibleDuplicateEntriesWindow(entry); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that every entry is potentially a duplicate? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the broader context of the code, there’s a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
}); | ||||||
vContainer.getChildren().add(compareButton); | ||||||
} else { | ||||||
ToggleButton addToggle = IconTheme.JabRefIcons.ADD.asToggleButton(); | ||||||
addToggle.setTooltip(new Tooltip(Localization.lang("Select entry"))); | ||||||
|
@@ -504,4 +519,24 @@ private void importEntries(List<CitationRelationItem> entriesToImport, CitationF | |||||
|
||||||
dialogService.notify(Localization.lang("Number of entries successfully imported") + ": " + entriesToImport.size()); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Function to open possible duplicate entries window to compare duplicate entries | ||||||
* | ||||||
* @param duplicateItem duplicate in the citation relations tab | ||||||
*/ | ||||||
private void openPossibleDuplicateEntriesWindow(CitationRelationItem duplicateItem) { | ||||||
BibEntry localEntry = duplicateItem.localEntry(); | ||||||
BibEntry duplicateEntry = duplicateItem.entry(); | ||||||
|
||||||
MergeEntriesDialog dialog = new MergeEntriesDialog(localEntry, duplicateEntry, preferences); | ||||||
dialog.setTitle(Localization.lang("Possible duplicate entries")); | ||||||
|
||||||
Optional<EntriesMergeResult> mergeResultOpt = dialogService.showCustomDialogAndWait(dialog); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you really need the |
||||||
mergeResultOpt.ifPresentOrElse(entriesMergeResult -> { | ||||||
new MergeTwoEntriesAction(entriesMergeResult, stateManager, undoManager).execute(); | ||||||
|
||||||
dialogService.notify(Localization.lang("Merged entries")); | ||||||
}, () -> dialogService.notify(Localization.lang("Canceled merging entries"))); | ||||||
} | ||||||
} |
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.
"We added" 😅
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 will fix that