Hello World Plugin Example

Can someone write a hello world plugin example that will put in hello world at the current cursor postion.

Im writing a plugin that enters in text correctly at the current position.
I use the following code :
EditorModificationUtil.insertStringAtCaret(editor, string, true, true);

but it always throws the following error:
Assertion failed: Write access is allowed inside write-action only (see com.intellij.openapi.application.Application.runWriteAction())

I have tried wrapping it in a thread and calling
Runnable runnable = new Runnable() {
public void run() {
EditorModificationUtil.insertStringAtCaret(editor, string, true, true);
}
};
ApplicationManager.getApplication().runWriteAction(runnable);
but it still doesnt work.

Thanks in Advance,
Greg

Please sign in to leave a comment.