Add directory monitor for Latex citations#11245
Conversation
koppor
left a comment
There was a problem hiding this comment.
Oh, wow! Did not expect that much changes to fix the code.
Very minor comments. Need to try out and to read the code inside IntelliJ.
I think, tests are hard for that one; thus it is OK not to have any test. -- However, maybe with @tempdir and some files.write things there could be tests?
| if (stateManager.getDirectoryMonitor() != null) { | ||
| stateManager.getDirectoryMonitor().shutdown(); | ||
| } |
There was a problem hiding this comment.
@calixtus Can you check if the file DirectoryMonitor should reside in StateManager or if we should move it to Globals (similar to fileUpdateMonitor).
There was a problem hiding this comment.
Neither.
Globals is deprecated and is annoted as such. It shall not be used at all. We are working towards dissolving that class.
StateManager is not the new Globals.
The directory manager should be injected by constructor or in a view by the viewloader.
There was a problem hiding this comment.
Can the File update monitor and the DirectoryMonitor be merged to a more generic class?
There was a problem hiding this comment.
Note that Globals points to StateManager:
/**
* @deprecated try to use {@link StateManager} and {@link org.jabref.preferences.PreferencesService}
*/We need a "Global" DirectoryMonitor. Would you place it in org.jabref.gui.DefaultInjector and then add a shutdown method to it?
We need to have a full lifecycle of DirectoryMonitor. Creation, running, and shutdown. There currently is no migration guide at org.jabref.gui.Globals#shutdownThreadPools
To keep things going, I vote to move the currently directoryMonitor code into Globals and do a refactoring towards dependency injection afterwards.
Also the more generic ones migration away from FileUpdateMonitor to Apache Commons IO or other classes should be done later. Otherwise, IMHO the PR blows up only because of "clean code".
Side comment: Injector.registerExistingAndInject(this); is a neat thing. I wonder why we don't use that more often :p.
There was a problem hiding this comment.
Lets go for Globals and then refactor it afterwards, so this PR keeps its focus,
Thinking about testing, what aspects we should cover?
What are your thoughts on this? |
I was thinking about more an "integration test" (or "system test" how JavaFX calls it; or "End-to-end test"). The separate parts are tested, but the combination you are doing in this PR is not tested. |
|
Tried out, works great! |
Closes #10585.
preview.mp4
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)