Creating Custom extract action

I am trying to create a custom extract action using the following class

public class RefactoringSupportProvider extends com.intellij.lang.refactoring.RefactoringSupportProvider {
RefactoringActionHandler getIntroduceConstantHandler() {
        return new ExtractHandler();

The flow in Intellij is :  Refactor -----> extract -----> constant (refer to attachment)

I want to change 'constant' to  'custom extract' so that flow becomes like : Refactor -----> extract -----> custom extract

Any suggestions how to do that?

Screen Shot 2015-03-31 at 10.54.43 AM.png
Comment actions Permalink

If you want to create a custom refactoring, you don't need to touch RefactoringSupportProvider at all. Simply implement your own AnAction and add it to the correct action group (the ID is IntroduceActionGroup).

Comment actions Permalink

Thanks for the suggestion.
I tried creating an action in plugin.xml, it works as expected.

    <action id="Custom Extract"
            text="Custom Extract">
        <add-to-group group-id="RefactoringMenu" anchor="last"/>
        <keyboard-shortcut first-keystroke="ctrl alt c" keymap="$default"/>

But Is there any way to disable that action for specific files ?


Please sign in to leave a comment.