diff options
author | Tor Norbye <tnorbye@google.com> | 2014-08-19 22:27:03 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-08-19 21:25:05 +0000 |
commit | 4ca751c002784c4bfd349cc5240b045b62277c80 (patch) | |
tree | dfc17b31990e2429535609b85f6d080c4fa0d9fe /java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java | |
parent | 890d9a2952301682ffecaed4495f5f65c84c3642 (diff) | |
parent | 060e58b3afea3ea39f5ba1cb5a443ca3ebda28c8 (diff) | |
download | idea-4ca751c002784c4bfd349cc5240b045b62277c80.tar.gz |
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge"
Diffstat (limited to 'java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java')
-rw-r--r-- | java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java index 75544f9d8ab9..ce52274140bb 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java @@ -19,6 +19,7 @@ import com.intellij.codeInsight.ChangeContextUtil; import com.intellij.codeInsight.ExceptionUtil; import com.intellij.codeInsight.NullableNotNullManager; import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil; +import com.intellij.codeInsight.daemon.impl.quickfix.AnonymousTargetClassPreselectionUtil; import com.intellij.codeInsight.highlighting.HighlightManager; import com.intellij.codeInsight.intention.impl.AddNullableAnnotationFix; import com.intellij.codeInsight.navigation.NavigationUtil; @@ -1133,6 +1134,7 @@ public class ExtractMethodProcessor implements MatchProvider { final PsiElementProcessor<PsiClass> processor = new PsiElementProcessor<PsiClass>() { @Override public boolean execute(@NotNull PsiClass selectedClass) { + AnonymousTargetClassPreselectionUtil.rememberSelection(selectedClass, myTargetClass); final List<PsiVariable> array = classes.get(selectedClass); myNeedChangeContext = myTargetClass != selectedClass; myTargetClass = selectedClass; @@ -1184,7 +1186,9 @@ public class ExtractMethodProcessor implements MatchProvider { if (classes.size() > 1) { final PsiClass[] psiClasses = classes.keySet().toArray(new PsiClass[classes.size()]); - NavigationUtil.getPsiElementPopup(psiClasses, new PsiClassListCellRenderer(), "Choose Destination Class", processor).showInBestPositionFor(myEditor); + final PsiClass preselection = AnonymousTargetClassPreselectionUtil.getPreselection(classes.keySet(), psiClasses[0]); + NavigationUtil.getPsiElementPopup(psiClasses, new PsiClassListCellRenderer(), "Choose Destination Class", processor, preselection) + .showInBestPositionFor(myEditor); return true; } } |