jabref
jabref copied to clipboard
Add "Accept external changes" button for "The library has been modified by another program"
When message "The library has been modified by another program" is shown (both when the BibTeX file has been modified by another program and when JabRef itself saves it and bug #4810 or #4877 comes into play), it comes with two buttons (as seen in descriptions of #4810 or #4877):
- Dismiss changes
- Review changes
However, there are three possibilities:
- Use the version open in JabRef, rejecting external modifications
- Use the version on the disk, accepting external modifications
- Choose something else (maybe look at the changes first, maybe merge those versions in some way)
The first option seems to be covered by "Dismiss changes", the third option is covered by "Review changes", but it looks like nothing covers the second option (other than closing the program and running it again, which seems to be suboptimal).
So, perhaps adding a third button (let's say, "Reload from disk") to the message "The library has been modified by another program" would be a good idea?
I will first fix #4877 then we can come back to here.
Assume the "Review changes" functionality would work (which is our aim). Then the button "Reload from disk" would assume that the user blindly trusts the content on disk and his own changes will be overwritten?
I think, the issue is that the change detection is not working well. This can cause risk that "Reload from disk" destroys in-memory data - in the use case of a shared .bib file (e.g., dropbox, onedrive, ...)
This strongly refs https://github.com/JabRef/jabref/pull/5669
Assume the "Review changes" functionality would work (which is our aim). Then the button "Reload from disk" would assume that the user blindly trusts the content on disk and his own changes will be overwritten?
Sometimes the user does trust the content on disk, and does so for a good reason.
For example, that happens when the user was working on a different computer and has put a new version to the disk using FTP, Git, E-Mail or something else.
Sure, there are other cases when pressing such a button would be a bad idea, which is a good reason for having three buttons and not one.
But, of course, such a button would be less important, if the changes of files are going to be detected correctly.
I would like to suggest to point out in the choices which one will dismiss the changes one had done in Jabref and which one will dismiss the one changes according to the changed file.
Hi, I am a junior student and now I am learning software engineering. I have read your development documentation https://devdocs.jabref.org/contributing. I am wondering whether I can try to solve this problem. Am I the first person who proposed to solve this problem?
@NYH-Dolphin I am working on the underlying issue (as written at https://github.com/JabRef/jabref/issues/8235#issuecomment-967972449). This issue is about the UI.
The issue is about having three buttons when a change on the disk occurred:
- Use the opened version (currently "Dismiss changes"; already exiting)
- Use the version on the disk (currently not existing)
- Review changes (already existing)
The main challenge will be the localization. - Jsut go ahead!
Hi Jabref, I am trying to fix this issue now. I am wondering whether [Accept Changes] need to automatically save the modified file? This need to call the variable of SaveDatabaseAction
in the DatabaseChangeMonitor
class. I am not sure whether I have break the calling rules?
This is the part that I am trying to modify
In order to implement this function, I have to pass the LibarayTab
parameter instead of LibraryTab.DatabaseNotification
class.
So the parameters passed are just like this
Now when Jabref detects the violation, it will display a dialogue like this
When you click [Accept changes], it will quickly show the changes and save it automatically
Is it possible to make [accept external changes] automatic? One can set it to always accept external changes: like in Texstudio.
Is it possible to make [accept external changes] automatic? One can set it to always accept external changes: like in Texstudio.
What would be the use case? I fear that "silently" accepting external changes and always overwriting local changes is not that good, is it? - Maybe, there is never the case there is data in the entry editor, but I would like to be really sure...
Actually, I think there are 4 options:
- Use the opened version (currently "Dismiss changes"; already exiting)
- Use the version on the disk (currently not existing, but exists within the "Review changes" dialogue)
- Use the version on the disk, which was changed AFTER JabRef created the "The library has been modified by another program" (does not exist) --> Refs. #9074
- Review changes (already existing)
This issue should have become less important overall, as
- 6a7139566b555903daafa2913d10431a5f02d704 should have fixed bugs #4810 and #4877, therefore this popup will trigger A LOT less often.
- Accepting external changes can be done from within the "Review Changes" dialogue (using the new implementation of #9021:
State of today: "Accept changes" is not available:
I think, it is because we wanted the user to check the external changes and not just overwrite any changes the user did during editing.
@claell @mpatas May I ask how often you run into this? I would have pressed "Dismiss changes" and immediately closed the library (and reopened it again) to have the same effect. -- I think, your use case is that you are using git
and switching branches (refs https://github.com/koppor/jabref/issues/578) and just want to say: Yeah, dear JabRef, just reload from disk. I know what I am doing.