koppor / jabref

Collection of simple for JabRef issues. Please submit PRs to https://github.com/jabRef/jabref/.
https://github.com/jabRef/jabref/
MIT License
8 stars 14 forks source link

Jump to entry key cli (WIP) #659

Closed u7282852 closed 7 months ago

u7282852 commented 8 months ago

Addresses Issue: https://github.com/koppor/jabref/issues/540 Command line now supports option "jumpToEntryKey" or "-j" folowed by one entrykey argument. Upon start up, jabref will search the imported files for the entrykey and focus this library and select this entry.

However, I am experiencing issues when there are previously opened databases that are not opened through the command line. The last database within the previously opened databases seems to always be the library focused on start up as they seem to run on a different thread or something.

Currently the key is searched only in the imported files specified in the commandline [BIBTEX_FILE] fields. I also request some assistance as to how I can search the previously opened/edited databases as well for the entrykey.

Mandatory checks

koppor commented 8 months ago

I also request some assistance as to how I can search the previously opened/edited databases as well for the entrykey.

I found org.jabref.gui.JabRefGUI#openLastEditedDatabases, which opens the libraries. Maybe this helps to understand the control flow of opening.

I think, the place could be https://github.com/JabRef/jabref/blob/31f137bcf22c15314f9bc951b694286b34ab2f2f/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java#L178-L178.

The above LOC also answers the following, doesn't it?

The last database within the previously opened databases seems to always be the library focused on start up as they seem to run on a different thread or something.

koppor commented 7 months ago

Follow-up at https://github.com/JabRef/jabref/pull/10578. Closing this one. The other PR is the same branch, but more committers can see it!