Running logic after CloseTaskDialog's "commit"
I develop the gitflow4idea plugin.
A user pointed out an issue with my integration with the close task dialog:
The gitflow "finish feature" logic should run only after the "commit changes" had ended, but turns out they run concurrently.
I tracked down the bug to this line in CloseTaskDialog
:
https://github.com/JetBrains/intellij-community/blob/0e91550e746c94ab6afe5c0d36450b93b587dd2d/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.java#L103
Seems like the commit
function of all the TaskDialog integrations is executed sequentially, so what happens is that the git commit and the gitflow finish actions are executed almost instantaneously, which means that the actual commit doesn't finish by the time the gitflow finish action starts.
I'm not entirely sure how to solve this, since the dialog integration doesn't provide a way to synchronously rely on other integrations.
Maybe there's a way to specifically query git4idea and register logic to run if the plugin isn't "busy"?
Please sign in to leave a comment.
There is `CheckinHandler#checkinSuccessful()` method, it is called after commit is executed successfully. Please try if works for you.
Looks like It doesn't work?
This is my test handler:
And in my plugin.xml:
However the checkinSuccessful nor the actual instantiation gets called at all on task close with "commit changes".
Any tips?
I see that `VcsCloseTaskPanel#commit()` does not perform commit with `CheckinHandler`-s - it just calls corresponding `CheckinEnvironment#commit()` implementations. So unfortunately you can't use `checkinSuccessful` here.
Possible workaround could be for instance to add `ChangeListListener` (`ChangeListManager#addChangeListListener()`) and track until necessary changes are removed after "close task" is invoked.