public class ExtractMethodHandler extends java.lang.Object implements RefactoringActionHandler, ContextAwareActionHandler
Constructor and Description |
---|
ExtractMethodHandler() |
Modifier and Type | Method and Description |
---|---|
static void |
extractMethod(Project project,
ExtractMethodProcessor processor) |
static PsiElement[] |
getElements(Project project,
Editor editor,
PsiFile file) |
static ExtractMethodProcessor |
getProcessor(Project project,
PsiElement[] elements,
PsiFile file,
boolean openEditor) |
static java.lang.String |
getRefactoringName() |
static void |
highlightPrepareError(PrepareFailedException e,
PsiFile file,
Editor editor,
Project project) |
void |
invoke(Project project,
Editor editor,
PsiFile file,
DataContext dataContext)
Invokes refactoring action from editor.
|
void |
invoke(Project project,
PsiElement [] elements,
DataContext dataContext)
Invokes refactoring action from elsewhere (not from editor).
|
static void |
invokeOnElements(Project project,
Editor editor,
PsiFile file,
PsiElement [] elements) |
static boolean |
invokeOnElements(Project project,
ExtractMethodProcessor processor,
PsiFile file,
boolean directTypes) |
boolean |
isAvailableForQuickList(Editor editor,
PsiFile file,
DataContext dataContext)
Handlers could provide useful hints when they are actually not available, e.g.
|
static Editor |
openEditor(PsiFile file) |
static void |
selectAndPass(Project project,
Editor editor,
PsiFile file,
Pass<PsiElement[]> callback) |
public void invoke(Project project, PsiElement [] elements, DataContext dataContext)
RefactoringActionHandler
invoke
in interface RefactoringActionHandler
project
- the project in which the refactoring is invoked.elements
- list of elements that refactoring should work on. Refactoring-dependent.dataContext
- can be null
for some but not all of refactoring action handlers
(it is recommended to pass DataManager.getDataContext()
instead of null
)public void invoke(Project project, Editor editor, PsiFile file, DataContext dataContext)
RefactoringActionHandler
invoke
in interface RefactoringActionHandler
project
- the project in which the refactoring is invoked.editor
- editor that refactoring is invoked infile
- file should correspond to editor
dataContext
- can be null
for some but not all of refactoring action handlers
(it is recommended to pass DataManager.getDataContext()
instead of null
)public static void selectAndPass(Project project, Editor editor, PsiFile file, Pass<PsiElement[]> callback)
public boolean isAvailableForQuickList(Editor editor, PsiFile file, DataContext dataContext)
ContextAwareActionHandler
isAvailableForQuickList
in interface ContextAwareActionHandler
public static PsiElement[] getElements(Project project, Editor editor, PsiFile file)
public static void invokeOnElements(Project project, Editor editor, PsiFile file, PsiElement [] elements)
public static void extractMethod(Project project, ExtractMethodProcessor processor)
public static void highlightPrepareError(PrepareFailedException e, PsiFile file, Editor editor, Project project)
public static ExtractMethodProcessor getProcessor(Project project, PsiElement[] elements, PsiFile file, boolean openEditor)
public static boolean invokeOnElements(Project project, ExtractMethodProcessor processor, PsiFile file, boolean directTypes)
public static java.lang.String getRefactoringName()