-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add directory monitor for Latex citations #11245
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the File update monitor and the DirectoryMonitor be merged to a more generic class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.md
described in a way that is understandable for the average user (if applicable)