IJ 2017 - AWT events are not allowed inside write action

Hello,

I have to say, I do not like that thing, because it complicates and breaks stuff... 

I have bunch of EditorActions with EditorWriteActionHandler, sometimes with a dialog, and this forced me basically to one ugly boilerplate solution: using Editor#userData 

For example:

https://github.com/krasa/StringManipulation/blob/a2ce7f0843e9b93265e7d27d51336d6c825c3967/src/osmedile/intellij/stringmanip/swap/SwapAction.java#L27-L45

Did I miss something? Or is this really the only/correct thing to do?

0
正式评论

Sorry for this breaking change, but it seems necessary if we ever want to perform write actions in a background thread (and we do).

Have you tried to replace EditorWriteActionHandler usage with EditorActionHandler and take write action yourself after the dialog is shown?

Thanks for the reply!


 


EditorWriteActionHandler contains some perhaps important logic I did not want to copypaste (it changes too much)... but now after I tried it, I found a better solution:


 


https://github.com/krasa/StringManipulation/blob/2a643cc5ee04d50dd7da85936dfbaedb68079773/src/osmedile/intellij/stringmanip/MyEditorWriteActionHandler.java#L18-L45


 


 

0

请先登录再写评论。