public abstract class RefactoringImpl<T extends BaseRefactoringProcessor> extends java.lang.Object implements Refactoring
| Modifier and Type | Field and Description |
|---|---|
protected T |
myProcessor |
| Constructor and Description |
|---|
RefactoringImpl(T refactoringProcessor) |
| Modifier and Type | Method and Description |
|---|---|
void |
doRefactoring(UsageInfo[] usages)
Performs all changes in code that are necessary.
|
UsageInfo[] |
findUsages()
Searches for places in code that refactoring will change.
|
boolean |
isInteractive()
Returns whether refactoring is interactive.
|
boolean |
isPreviewUsages()
Returns value of
previewUsages property. |
boolean |
preprocessUsages(Ref<UsageInfo[]> usages)
Analyses usages (presumably obtained from
Refactoring.findUsages() for possible conflicts
and (if refactoring is interactive) presents user with appropriate conflicts dialog. |
void |
run()
Runs the whole refactoring.
|
void |
setInteractive(java.lang.Runnable prepareSuccessfulCallback)
Controls whether this refactoring is interactive: whether it should show conflicts dialog
and other dialogs.
|
void |
setPreviewUsages(boolean value)
Controls whether refactoring shows a preview.
|
boolean |
shouldPreviewUsages(UsageInfo[] usages)
Checks whether usages need to be shown.
|
protected final T extends BaseRefactoringProcessor myProcessor
public RefactoringImpl(T refactoringProcessor)
public void setPreviewUsages(boolean value)
RefactoringIf there are modifications that should be performed in non-java files or not in code, preview will be shown regardless of this setting.
setPreviewUsages in interface Refactoringpublic boolean isPreviewUsages()
RefactoringpreviewUsages property.
If there are modifications that should be performed in non-java files or not in code,
preview will be shown regardless of this setting.isPreviewUsages in interface Refactoringpublic void setInteractive(java.lang.Runnable prepareSuccessfulCallback)
Refactoring
If prepareSuccessfulCallback is not null, refactoring is interactive, and
the callback is executed if user did not cancel the refactoring operation, right after
preprocessUsages has finished.
If prepareSuccessfulCallback is null, user is not presented with
conflicts etc., but the preview may still be shown.
Note: the callback is executed in dispatch thread.
Refactorings are interactive by default, with empty runnable as a callback.
setInteractive in interface Refactoringpublic boolean isInteractive()
RefactoringisInteractive in interface RefactoringRefactoring.setInteractive(Runnable)public UsageInfo[] findUsages()
RefactoringfindUsages in interface Refactoringpublic boolean preprocessUsages(Ref<UsageInfo[]> usages)
RefactoringRefactoring.findUsages() for possible conflicts
and (if refactoring is interactive) presents user with appropriate conflicts dialog.preprocessUsages in interface RefactoringRefactoring.setInteractive(Runnable)public boolean shouldPreviewUsages(UsageInfo[] usages)
RefactoringshouldPreviewUsages in interface RefactoringRefactoring.setPreviewUsages(boolean),
Refactoring.isPreviewUsages()public void doRefactoring(UsageInfo[] usages)
RefactoringdoRefactoring in interface Refactoringpublic void run()
RefactoringRefactoring.findUsages() (with progress dialog and all)
Refactoring.preprocessUsages(Ref)
Refactoring.shouldPreviewUsages(UsageInfo[]), and show the preview
Refactoring.doRefactoring(UsageInfo[]) if appropriate (if either the preview
was not shown, or 'Do Refactor' button has been pressed)
run in interface Refactoring