Skip to content

Open last connected shared DBs at startup preference#9843

Closed
farketar wants to merge 5 commits into
JabRef:mainfrom
farketar:enhancement-issue-9714
Closed

Open last connected shared DBs at startup preference#9843
farketar wants to merge 5 commits into
JabRef:mainfrom
farketar:enhancement-issue-9714

Conversation

@farketar

@farketar farketar commented May 5, 2023

Copy link
Copy Markdown
Contributor

Fixes #9714

Created a new preference tab called Shared Database
new tab on preferences

Added two new preferences to the JabRefPreferences class. One boolean for the checkbox and one list containing the last shared database IDs.

### Compulsory checks
- [ ] Change in `CHANGELOG.md` described in a way that is understandable for the average user (if applicable)
- [ ] Tests created for changes (if applicable)
- [x] Manually tested changed features in running JabRef (always required)
- [x] Screenshots added in PR description (for UI changes)
- [ ] [Checked developer's documentation](https://devdocs.jabref.org/): Is the information available and up to date? If not, I outlined it in this pull request.
- [ ] [Checked documentation](https://docs.jabref.org/): Is the information available and up to date? If not, I created an issue at <https://github.com/JabRef/user-documentation/issues> or, even better, I submitted a pull request to the documentation repository.

@Siedlerchr

Copy link
Copy Markdown
Member

Hi, just a hint, you only need to modify the en.properties file, the rest is managed by crowdin. See https://devdocs.jabref.org/code-howtos/localization.html#localization

Please do not add translations for other languages directly in the properties. They will be overwritten by Crowdin

@farketar

Copy link
Copy Markdown
Contributor Author

Can we take advantage of the file opening feature to open shared databases as if we opened them from the UI?

My current solution adds another preference for opening last connected shared databases at startup but I thought maybe we can use the current preference that opens files at startup, since my implementation was based on it.

But... In the current state connecting to a shared db through a file results in a library that passes its changes to the server but can't be updated on demand (only opening and closing the file) because the action for pulling changes from the server is disabled (CTRL + Shift + R OR File > Shared Database > Pull changes from shared database). This is because the action is allowed only if the location of the activeDatabase(managed by StateManger, basically the currently selected tab's BibDatabaseContext) is SHARED.

In our case the context of the library tab is set from LibraryTab.createLibraryTab method, initally a temporary empty context until the dataLoadingTask (which is a BackgroundTask wrapping OpenDatabaseAction.loadDatabase method) has finished executing. The dataLoadingTask calls SharedDatabaseUIManager.openSharedDatabaseFromParserResult which opens a connection to the server by creating a SHARED location context. This context instance is what I think should be passed to the Library tab in order to enable the 'pull changes' action. I achieve this by attaching the context to the ParserResult as a field which is then passed from the dataLoadingTask to the LibraryTab.onDatabaseLoadingSucceed(ParserResult p) in order to assign it to the library tabs context. Currently the tab's context is created inside the ParserResult.getDatabaseContext() as a LOCAL context.

@calixtus

Copy link
Copy Markdown
Member

Devcall

We quickly looked into the deeper issue, we believe it's complicated to solve this issue now, until we can resolve the issue with the multiple und chaotic database open actions (see #8298). So we think we close this one for now and eventually come back for this one. Thanks for your efforts anyway. Maybe a look into other Issues or Good First Issues provide some idea what to do next?

@calixtus calixtus closed this Jun 19, 2023
@farketar farketar deleted the enhancement-issue-9714 branch June 21, 2023 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reconnect to a shared database at startup

4 participants