-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Refactor cleanup code #572
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
Conversation
By the way, does somebody know why the tests fail on the ci server but pass locally? Is there a secretly hidden preference controlling whether the file type is added? |
Any comments on this one? Should I rebase? |
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.
During the run method, NO swing class must be accessed. You use panels and option panes.
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 method contains nearly the same code as the previous run method. The code somehow needs to get the selected cleanup actions. What would be the proper way to do this?
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 would move some of the code in the init part and some of it in the update part. You can have a look at the SearchWorker
, which separate this correctly. The issue is that the run method is always executed outside of the EDT, and the update method always on the EDT. And swing only works correctly if all methods on all swing classes are executed on the EDT.
This change may require a lot of work. If you think this is too much, we can leave it as is and improve that in another 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.
I'll have a look at it tomorrow.
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 run method asks the user if he wants to continue with autogenerating pdf names. I'm not sure how to implement this properly with the Worker interface. Maybe the problem disappears automatically after migration to javafx?
|
- Remove CleanupUtil class by moving its methods to appropriate cleanup classes (and use FileField instead of FileListTableModel) - Reimplement counting of unsuccessful renames - Add tests for rename files and make relative cleanups
09c4a31
to
0a4da90
Compare
I implemented everything we had discussed yesterday. In particular:
However, I didn't make CleanupPreset stateless (i.e. it still contains setter) because I don't want to create a constructor accepting 19 booleans...Any idea how to proceed here? |
Why not use a list of enums, each enum stands for a cleanup that is active aka true. |
Because this would be too simple 😃 . Nice idea 👍 |
Awesome PR. Thanks for the contribution! |
This PR (again) refactors the cleanup department. The motivation was to extract as much logic as possible from the cleanup action to make it easier to use cleanup operations also at different points (like on save).
Biggest changes:
CleanupPreset
and the execution of the cleanup process toCleanupWorker
. Thus starting a cleanup process is reduced to setting up a proper preset and passing it to the worker.JabRefPreferences
. Well, this is the place where it belongs.CleanupWorker
. More detailed tests of the different cleanup processes are still missing.Todo's/Breaking changes: These are all related to the fact that there is no nice interface to get/set the file field of an entry (all the code is in the gui class FileListTableModel).