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)
Refactoring
If 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 Refactoring
public boolean isPreviewUsages()
Refactoring
previewUsages
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 Refactoring
public 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 Refactoring
public boolean isInteractive()
Refactoring
isInteractive
in interface Refactoring
Refactoring.setInteractive(Runnable)
public UsageInfo[] findUsages()
Refactoring
findUsages
in interface Refactoring
public boolean preprocessUsages(Ref<UsageInfo[]> usages)
Refactoring
Refactoring.findUsages()
for possible conflicts
and (if refactoring is interactive) presents user with appropriate conflicts dialog.preprocessUsages
in interface Refactoring
Refactoring.setInteractive(Runnable)
public boolean shouldPreviewUsages(UsageInfo[] usages)
Refactoring
shouldPreviewUsages
in interface Refactoring
Refactoring.setPreviewUsages(boolean)
,
Refactoring.isPreviewUsages()
public void doRefactoring(UsageInfo[] usages)
Refactoring
doRefactoring
in interface Refactoring
public void run()
Refactoring
Refactoring.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