com.intellij.codeInsight.intention
Interface IntentionAction


public interface IntentionAction


Method Summary
 java.lang.String getFamilyName()
           
 java.lang.String getText()
          Returns text to be shown in the list of available actions, if this action is available.
 void invoke(Project project, Editor editor, PsiFile file)
          Called when user invokes intention.
 boolean isAvailable(Project project, Editor editor, PsiFile file)
          Checks whether this intention is available at a caret offset in file.
 boolean startInWriteAction()
          Indicate whether this action should be invoked inside write action.
 

Method Detail

getText

java.lang.String getText()
Returns text to be shown in the list of available actions, if this action is available.

See Also:
isAvailable(Project,Editor,PsiFile)

getFamilyName

java.lang.String getFamilyName()
Returns:
this intention's "id". This id is used to externalize "auto-show" state of intentions. When user clicks on a lightbulb in intention list), all intentions with the same family name gets enabled/disabled.

isAvailable

boolean isAvailable(Project project,
                    Editor editor,
                    PsiFile file)
Checks whether this intention is available at a caret offset in file. If this method returns true, a light bulb for this intention is shown.


invoke

void invoke(Project project,
            Editor editor,
            PsiFile file)
            throws IncorrectOperationException
Called when user invokes intention. This method is called inside command. If startInWriteAction() returns true, this method is also called inside write action.

Throws:
IncorrectOperationException

startInWriteAction

boolean startInWriteAction()
Indicate whether this action should be invoked inside write action. Should return false if e.g. modal dialog is shown inside the action. If false is returned the action itself is responsible for starting write action when needed