Error message: Showing of modal dialog is prohibited inside write-action

My plugin gives the following error in version 4. Its OK in version 3. What has changed and how do I fix the problem?

Error message: Showing of modal dialog is prohibited inside write-action, modalityState=ModalityState.NON_MODAL
java.lang.Throwable

3 comments
Comment actions Permalink

They added extra assertions in 4.0. The most visible one is that restriction: you cannot show a modal dialog inside a write-action. The rational is discussed in detail in this thread with some ways to go around it.

http://www.intellij.net/forums/thread.jsp?forum=23&thread=45764&message=592291&q=77726974652d616374696f6e20617373657274696f6e206d6f64616c206469616c6f67#591736

Jacques

0
Comment actions Permalink

No luck. I followed all the threads but it did not help.
If I invoke it later I cannot modify the current edit file as it says "error message: Assertion failed: Write access is allowed inside write-action only " when I try and insert a string into the doc.
I can't perform a invokeAndWait as it also returns and error: Cannot call invokeAndWait from the event dispatcher thread
My situation requires that I show a dialog for the user to input data and then insert this data into the current editor file.

0
Comment actions Permalink

Split your operation into several steps.
Instead of using invokeAndWait just do an invokeLater and whatever you intended on doing after the invokeAndWait returns, do it inside the invokeLater runnable.

The very last option is not to use DialogWrapper for your dialog... (obviously I did not tell you that... ;)

Jacques

0

Please sign in to leave a comment.