jabref
jabref copied to clipboard
Citation Relations should be aware of existing papers
Open jabref-authors.bib.
Click on paper 1.
This references paper 2 at position 3. The paper at 3 should be marked in light green (to indicate that it already exists). Additionally, at button 4, the duplicate check should be called (which then warns about possible duplicates).
In the example, I added the paper resulting in paper marked at 5.
Is this project is ongoing? Let me know further (DOCS) to contribute on it as "good first issue".
Yes, this project (JabRef) is still ongoing and this issue is free to take. I will assign you.
As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at.
Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback.
@vimalJD are you still on it or have you given up on this?
I would like to work on this. Is it still unresolved?
Also, I was trying to figure out where the code is that determines the appearance for the entries table. For example, let's say I wanted to change the color of the selected entry to green for whatever reason, where would I go to change that?
You will have to add a styleclass to the entry that matches. This can be done by configuring the ViewModelTableCellFactory or ViewModelListCellFactory. The css can be added to base.css
In the citations relations tab this would be somewhere here: https://github.com/JabRef/jabref/blob/14d95025d462bad367118a8b47b694ac14f00e32/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java#L194
So, after digging through the code for a while pressing the button (marked as 4 in @koppor 's image in the original post) calls the importEntries method of the ImportHandler class. However, the logic that we want (that checks for duplicates) is in the importEntries method of the ImportEntriesViewModel class. I am wondering what the best way to approach this is. Creating a new instance of the ImportEntriesViewModel just to access that method does not seem like a good choice. Should I try to move some of that logic to the ImportHandler class, maybe with a new method?
@supernoob00 Hi, are you still working on the issue?
Assigned @supernoob00 because of first come, first serve.
@AbdAlRahmanGad Please have a look at other issues that are not yet reserved or assigned. You can see that in the top right corner of GitHub.
But yes, if an issue has not been worked on for more than 4 weeks or some months and the assigned person is not responding then you may ask to work on it. Our policy is to usually only assign one student per issue or one group of students from the same course to avoid trouble with grading down the road.
@supernoob00 Difficult question. Doesn't the dialog know the bibdatabasecontext and thus the entries? There is a duplicate checker. And that also is in use in the import dialog. And can say if an entry exists. We recently worked on that at https://github.com/JabRef/jabref/pull/10914... But you are at a different place in the code. No import, but citation relations. But maybe you get inspirations. Maybe @HoussemNasri can also give hints?
Hi @supernoob00, thanks for digging into this,
Creating a new instance of the ImportEntriesViewModel just to access that method does not seem like a good choice.
I totally agree that using view models wouldn't be a great idea here. Usually, each UI component has its own view model, but it's possible to use the same one for components that have the same state. Take Android apps, for example. They can run on all sorts of devices, from phones to TVs to watches. You might tweak the design of the UI pages to fit different screen sizes, but you can still keep the state consistent. In our case, we would be sharing the view model to not share the state but to share a single method which is not ideal.
Should I try to move some of that logic to the ImportHandler class, maybe with a new method?
Have you looked into ImportHandler#importEntriesWithDuplicateCheck? It is the same method called when you paste an entry into JabRef.
From what I see in the code, there might already be something to try to handle this better, in CitationRelationsTab.java:styleFetchedListView there's this block that looks like might be trying to show that an entry is already in the library:
if (entry.isLocal()) {
Button jumpTo = IconTheme.JabRefIcons.LINK.asButton();
jumpTo.setTooltip(new Tooltip(Localization.lang("Jump to entry in library")));
jumpTo.getStyleClass().add("addEntryButton");
jumpTo.setOnMouseClicked(event -> {
libraryTab.showAndEdit(entry.entry());
libraryTab.clearAndSelect(entry.entry());
citingTask.cancel();
citedByTask.cancel();
});
hContainer.getChildren().addAll(entryNode, separator, jumpTo);
}
The problem is, currently in CitationRelationsTab.java:onSearchForRelationsSucceed there's this block:
private void onSearchForRelationsSucceed(BibEntry entry, CheckListView<CitationRelationItem> listView,
Button abortButton, Button refreshButton,
CitationFetcher.SearchType searchType, Button importButton,
ProgressIndicator progress, List<BibEntry> fetchedList,
ObservableList<CitationRelationItem> observableList) {
hideNodes(abortButton, progress);
observableList.setAll(fetchedList.stream().map(entr -> new CitationRelationItem(entr, false))
.collect(Collectors.toList()));
where the new CitationRelationItem is initialized to isLocal = false and I don't think there's code to change it to true if the entry is duplicate.
Hi @supernoob00, are you still working on this?
@HoussemNasri can I work on this?
Sure!