Write access is allowed inside write-action only (see com.intellij.openapi.application.Application.runWriteAction()
I only try following:
def type(String str) {
EditorModificationUtil.insertStringAtCaret(ed, str)
}
and I get this error, how to fix it
Please sign in to leave a comment.
try this:
executeOnPooledThread() is entirely wrong here. Write actions may only be executed in the event dispatch thread. See http://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/general_threading_rules.html for more information.
Item 1.5 in the tutorial that I sent you as an answer to your previous question shows the correct way to perform this operation.
ok how about this:
That's correct, yes.
I use a helper function if I have many write actions, which may or may not be called from the dispatch thread, in this class the document is always delegateDocumentEx field:
then to perform some write action somewhere, call the function passing it a Runnable instance:
Hi,
I usually use a similar code: