public abstract class InplaceRefactoring
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Key<InplaceRefactoring> |
INPLACE_RENAMER |
static Key<java.lang.Boolean> |
INTRODUCE_RESTART |
protected static Logger |
LOG |
protected java.lang.String |
myAdvertisementText |
protected Balloon |
myBalloon |
protected RangeMarker |
myBeforeRevert |
protected RangeMarker |
myCaretRangeMarker |
protected Editor |
myEditor |
protected PsiNamedElement |
myElementToRename |
protected java.lang.String |
myInitialName |
protected java.lang.String |
myInsertedName |
protected StartMarkAction |
myMarkAction |
protected java.util.LinkedHashSet<java.lang.String> |
myNameSuggestions |
protected java.lang.String |
myOldName |
protected Project |
myProject |
protected RangeMarker |
myRenameOffset |
protected PsiElement |
myScope |
protected RelativePoint |
myTarget |
protected java.lang.String |
myTitle |
protected static java.lang.String |
OTHER_VARIABLE_NAME |
protected static Stack<InplaceRefactoring> |
ourRenamersStack |
protected static java.lang.String |
PRIMARY_VARIABLE_NAME |
Constructor and Description |
---|
InplaceRefactoring(Editor editor,
PsiNamedElement elementToRename,
Project project) |
InplaceRefactoring(Editor editor,
PsiNamedElement elementToRename,
Project project,
java.lang.String oldName) |
InplaceRefactoring(Editor editor,
PsiNamedElement elementToRename,
Project project,
java.lang.String initialName,
java.lang.String oldName) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptReference(PsiReference reference) |
protected void |
addAdditionalVariables(TemplateBuilderImpl builder) |
protected void |
addHighlights(java.util.Map<TextRange,TextAttributes> ranges,
Editor editor,
java.util.Collection<RangeHighlighter> highlighters,
HighlightManager highlightManager) |
protected void |
addReferenceAtCaret(java.util.Collection<PsiReference> refs) |
protected void |
adjustBalloon(BalloonBuilder builder) |
protected void |
beforeTemplateStart() |
protected boolean |
buildTemplateAndStart(java.util.Collection<PsiReference> refs,
java.util.Collection<Pair<PsiElement,TextRange>> stringUsages,
PsiElement scope,
PsiFile containingFile) |
static boolean |
canStartAnotherRefactoring(Editor editor,
Project project,
RefactoringActionHandler handler,
PsiElement... element) |
static void |
checkCleared() |
protected PsiElement |
checkLocalScope() |
protected abstract void |
collectAdditionalElementsToRename(java.util.List<Pair<PsiElement,TextRange>> stringUsages) |
protected java.util.Collection<PsiReference> |
collectRefs(SearchScope referencesSearchScope) |
protected MyLookupExpression |
createLookupExpression(PsiElement selectedElement) |
static EditorEx |
createPreviewComponent(Project project,
FileType languageFileType) |
protected Expression |
createTemplateExpression(PsiElement selectedElement) |
void |
finish(boolean success) |
static InplaceRefactoring |
getActiveInplaceRenamer(Editor editor) |
protected abstract java.lang.String |
getCommandName()
Returns the name of the command performed by the refactoring.
|
protected javax.swing.JComponent |
getComponent() |
java.lang.String |
getInitialName() |
protected PsiElement |
getNameIdentifier() |
protected TextRange |
getRangeToRename(PsiElement element) |
protected TextRange |
getRangeToRename(PsiReference reference) |
protected SearchScope |
getReferencesSearchScope(VirtualFile file) |
protected PsiElement |
getSelectedInEditorElement(PsiElement nameIdentifier,
java.util.Collection<? extends PsiReference> refs,
java.util.Collection<? extends Pair<PsiElement,TextRange>> stringUsages,
int offset) |
protected static VirtualFile |
getTopLevelVirtualFile(FileViewProvider fileViewProvider) |
protected PsiNamedElement |
getVariable() |
protected boolean |
isIdentifier(java.lang.String newName,
Language language) |
protected boolean |
isReferenceAtCaret(PsiElement selectedElement,
PsiReference ref) |
protected boolean |
isRestart() |
static boolean |
isShowBalloonInHeadlessMode() |
protected void |
moveOffsetAfter(boolean success)
Called after the completion of the refactoring, either a successful or a failed one.
|
protected void |
navigateToAlreadyStarted(Document oldDocument,
int exitCode) |
protected boolean |
notSameFile(VirtualFile file,
PsiFile containingFile) |
protected void |
performCleanup()
if brokenOff but not canceled
|
boolean |
performInplaceRefactoring(java.util.LinkedHashSet<java.lang.String> nameSuggestions) |
protected abstract boolean |
performRefactoring() |
protected void |
releaseIfNotRestart() |
protected void |
releaseResources() |
protected int |
restoreCaretOffset(int offset) |
protected void |
restoreSelection() |
protected void |
revertState() |
void |
setAdvertisementText(java.lang.String advertisementText) |
void |
setElementToRename(PsiNamedElement elementToRename) |
static void |
setShowBalloonInHeadlessMode(boolean showBalloonInHeadlessMode) |
protected abstract boolean |
shouldSelectAll() |
protected boolean |
shouldStopAtLookupExpression(Expression expression) |
protected void |
showBalloon() |
protected void |
showBalloonInEditor() |
protected void |
showDialogAdvertisement(java.lang.String actionId) |
protected StartMarkAction |
startRename() |
protected boolean |
startsOnTheSameElement(RefactoringActionHandler handler,
PsiElement element) |
protected boolean |
startsOnTheSameElements(Editor editor,
RefactoringActionHandler handler,
PsiElement[] element) |
void |
stopIntroduce(Editor editor) |
static void |
stopIntroduce(Editor editor,
Project project,
java.lang.String commandName) |
static void |
unableToStartWarning(Project project,
Editor editor) |
protected static final Logger LOG
protected static final java.lang.String PRIMARY_VARIABLE_NAME
protected static final java.lang.String OTHER_VARIABLE_NAME
protected static final Stack<InplaceRefactoring> ourRenamersStack
public static final Key<InplaceRefactoring> INPLACE_RENAMER
public static final Key<java.lang.Boolean> INTRODUCE_RESTART
protected PsiNamedElement myElementToRename
protected final Editor myEditor
protected final Project myProject
protected RangeMarker myRenameOffset
protected java.lang.String myAdvertisementText
protected java.lang.String myInitialName
protected java.lang.String myOldName
protected RangeMarker myBeforeRevert
protected java.lang.String myInsertedName
protected java.util.LinkedHashSet<java.lang.String> myNameSuggestions
protected StartMarkAction myMarkAction
protected PsiElement myScope
protected RangeMarker myCaretRangeMarker
protected Balloon myBalloon
protected java.lang.String myTitle
protected RelativePoint myTarget
public InplaceRefactoring(Editor editor, PsiNamedElement elementToRename, Project project)
public InplaceRefactoring(Editor editor, PsiNamedElement elementToRename, Project project, java.lang.String oldName)
public InplaceRefactoring(Editor editor, PsiNamedElement elementToRename, Project project, java.lang.String initialName, java.lang.String oldName)
public void setAdvertisementText(java.lang.String advertisementText)
public boolean performInplaceRefactoring(java.util.LinkedHashSet<java.lang.String> nameSuggestions)
protected boolean notSameFile(VirtualFile file, PsiFile containingFile)
protected SearchScope getReferencesSearchScope(VirtualFile file)
protected PsiElement checkLocalScope()
protected abstract void collectAdditionalElementsToRename(java.util.List<Pair<PsiElement,TextRange>> stringUsages)
protected abstract boolean shouldSelectAll()
protected MyLookupExpression createLookupExpression(PsiElement selectedElement)
protected Expression createTemplateExpression(PsiElement selectedElement)
protected boolean acceptReference(PsiReference reference)
protected java.util.Collection<PsiReference> collectRefs(SearchScope referencesSearchScope)
protected boolean buildTemplateAndStart(java.util.Collection<PsiReference> refs, java.util.Collection<Pair<PsiElement,TextRange>> stringUsages, PsiElement scope, PsiFile containingFile)
protected boolean shouldStopAtLookupExpression(Expression expression)
protected boolean isReferenceAtCaret(PsiElement selectedElement, PsiReference ref)
protected void beforeTemplateStart()
protected void restoreSelection()
protected int restoreCaretOffset(int offset)
public void stopIntroduce(Editor editor)
public static void stopIntroduce(Editor editor, Project project, java.lang.String commandName)
protected void navigateToAlreadyStarted(Document oldDocument, int exitCode)
protected PsiElement getNameIdentifier()
public static EditorEx createPreviewComponent(Project project, FileType languageFileType)
protected StartMarkAction startRename() throws StartMarkAction.AlreadyStartedException
protected PsiNamedElement getVariable()
protected void moveOffsetAfter(boolean success)
success
- true if the refactoring was accepted, false if it was cancelled (by undo or Esc)protected void addAdditionalVariables(TemplateBuilderImpl builder)
protected void addReferenceAtCaret(java.util.Collection<PsiReference> refs)
protected void showDialogAdvertisement(java.lang.String actionId)
public java.lang.String getInitialName()
protected void revertState()
protected abstract java.lang.String getCommandName()
public void finish(boolean success)
protected void addHighlights(java.util.Map<TextRange,TextAttributes> ranges, Editor editor, java.util.Collection<RangeHighlighter> highlighters, HighlightManager highlightManager)
protected abstract boolean performRefactoring()
protected void performCleanup()
protected TextRange getRangeToRename(PsiElement element)
protected TextRange getRangeToRename(PsiReference reference)
public void setElementToRename(PsiNamedElement elementToRename)
protected boolean isIdentifier(java.lang.String newName, Language language)
protected static VirtualFile getTopLevelVirtualFile(FileViewProvider fileViewProvider)
public static void checkCleared()
protected PsiElement getSelectedInEditorElement(PsiElement nameIdentifier, java.util.Collection<? extends PsiReference> refs, java.util.Collection<? extends Pair<PsiElement,TextRange>> stringUsages, int offset)
protected boolean isRestart()
public static boolean canStartAnotherRefactoring(Editor editor, Project project, RefactoringActionHandler handler, PsiElement... element)
public static InplaceRefactoring getActiveInplaceRenamer(Editor editor)
protected boolean startsOnTheSameElements(Editor editor, RefactoringActionHandler handler, PsiElement[] element)
protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element)
protected void releaseResources()
protected javax.swing.JComponent getComponent()
protected void showBalloon()
protected void showBalloonInEditor()
protected void adjustBalloon(BalloonBuilder builder)
protected void releaseIfNotRestart()
public static boolean isShowBalloonInHeadlessMode()
public static void setShowBalloonInHeadlessMode(boolean showBalloonInHeadlessMode)