restore caret in variable if exist (IDEA-69663; IDEA-69661)

This commit is contained in:
anna
2011-05-16 12:05:25 +04:00
parent bde983aee7
commit e6619536dd
3 changed files with 12 additions and 0 deletions
@@ -486,6 +486,10 @@ public class InplaceIntroduceConstantPopup {
ApplicationManager.getApplication().runWriteAction(runnable);
}
super.moveOffsetAfter(success);
if (myLocalVariable != null && myLocalVariable.isValid()) {
myEditor.getCaretModel().moveToOffset(myLocalVariable.getTextOffset());
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
}
if (myMoveToAnotherClassCb.isSelected()) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
@@ -385,6 +385,10 @@ public class InplaceIntroduceFieldPopup {
ApplicationManager.getApplication().runWriteAction(runnable);
}
super.moveOffsetAfter(success);
if (myLocalVariable != null && myLocalVariable.isValid()) {
myEditor.getCaretModel().moveToOffset(myLocalVariable.getTextOffset());
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
}
}
@Override
@@ -368,6 +368,10 @@ class InplaceIntroduceParameterPopup extends IntroduceParameterSettingsUI {
CommandProcessor.getInstance().executeCommand(myProject, runnable, IntroduceParameterHandler.REFACTORING_NAME, null);
}
super.moveOffsetAfter(false);
if (myLocalVar != null && myLocalVar.isValid()) {
myEditor.getCaretModel().moveToOffset(myLocalVar.getTextOffset());
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
}
}
@Override