How to rename class right in Editor?

I'm working on a plugin that generates some code.
So the code is generated and now I'd like to allow user to provide name for newly generated class.

I can rename the class like this

RefactoringFactory.getInstance(p)
                .createRename(newClass, null, true, false)
                .run();


However I do not want to show any extra dialogs/windows and I'd like to rename it right inplace, like Idea's refactoring action does.

Could anyone help me and point where should I search for it?

Please sign in to leave a comment.