Question

I'm writing a refactoring plugin for IntelliJ and I'd like to call the action to Inline method (ctrl+alt+n).

Given I have the PsiMethod of the method to be inlined, what is the best approach ?

Should I somehow try to find and execute the inlining via the command id (and can I skip the dialog ?)

Or can I use something like InlineMethodProcessor manually ?

Was it helpful?

Solution

Ok, I found it, you can do it like this:

new InlineMethodProcessor(project, psiMethod1, null, editor, false).run();
new InlineMethodProcessor(project, psiMethod2, null, editor, false).run();

Incidentally, now that I've done 2 refactorings, they result in 2 undo actions.

Is there a way to "wrap" them (and other things) into one undo action, I wonder?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top