-
-
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
Added auto-key-generation task to task-progress #7797
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c58fcdd
Added auto-key-generation task to task-progress
btut 20530a2
Run progress-update on JavaFX Thread
btut 09a9cdf
Created anonymous class for background task
btut d3e1334
Checkstyle fix
btut 258b26a
Fixes for JavaFX concurrency
btut db72640
Reverted making BackgroundProgress public
btut 357219d
Revert "Reverted making BackgroundProgress public"
btut 9970966
Actually reverted making BackgroundProgress public
btut 721a9f1
Better message (and correct localization usage)
btut 18581e4
Removed progress from message
btut f5e67b1
Fixed localization
btut 3b0dfed
Pass TaskExecutor instead of using Globals
btut ff6e55f
Removed dependency on Globals
btut 10cae32
Merge branch 'main' into fix/keygenerationBackgroundTask
btut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The runInJavaFXThread shouldn't be necessary as this is handled by updateProgress.
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.
I wondered about that, but it is done in ImportHandler as well. Shall I remove it there as well (in an additional PR)?
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.
For some reason it is not working in this context, see https://github.com/JabRef/jabref/pull/7209/files#r551271470. Maybe @Siedlerchr still remembers where the problem was.
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.
The relevant code is
jabref/src/main/java/org/jabref/gui/util/DefaultTaskExecutor.java
Lines 146 to 155 in fa8cc82
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.
The progress updating is not happening in the fx thread by the BackgroundTask. This will leead to an exception.
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.
So shall we explicitly make updating the progress variable run on the fx thread in updateProgress?
`
protected void updateProgress(BackgroundProgress newProgress) {
}
`
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.
Ideally yes it would happend in the BackgroundTask itself, but I am unsure if this has any side effects on existing tasks
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.
would nesting DefaultTaskExecutor.runInJavaFXThread() be problematic (in addition to being ugly)?
I don't think there are many tasks that use updateProgress right now, let me investigate.
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.
As far as I (and Intellij) can tell, updateProgress is only used by GenerateCitationKeyAction, FileDownloadTask and ImportHandler.
FileDownloadTask uses EasyBind to update the progress. Does EasyBind already take care of running on the JavaFX thread?
jabref/src/main/java/org/jabref/gui/externalfiles/FileDownloadTask.java
Lines 24 to 39 in fa8cc82
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.
I'm not sure... then using
setValue
onprogress
still leads to the same problems (i.e. you cannot bind something to the progress property). Personally, I would leave the whole what happens on which thread hidden as long as possible, i.e. only the DefaultTaskExecutor cares about these things when converting a background task to a JavaFX task.I guess these problems we are discussing can be easily fixed by not using the progress/message properties of the background task anywhere outside of the task itself. So here for the citation generation there shouldn't be any problem.