mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
suggest to turn refs to super after extract superclass/interface is already finished in order to prevent command break (IDEA-80565)
This commit is contained in:
+10
-7
@@ -23,13 +23,8 @@ import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.HelpID;
|
||||
import com.intellij.refactoring.RefactoringActionHandler;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
@@ -45,6 +40,8 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class ExtractInterfaceHandler implements RefactoringActionHandler, ElementsHandler {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.extractInterface.ExtractInterfaceHandler");
|
||||
|
||||
@@ -116,7 +113,7 @@ public class ExtractInterfaceHandler implements RefactoringActionHandler, Elemen
|
||||
|
||||
private void doRefactoring() throws IncorrectOperationException {
|
||||
LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());
|
||||
PsiClass anInterface = null;
|
||||
final PsiClass anInterface;
|
||||
try {
|
||||
anInterface = extractInterface(myTargetDir, myClass, myInterfaceName, mySelectedMembers, myJavaDocPolicy);
|
||||
}
|
||||
@@ -125,7 +122,13 @@ public class ExtractInterfaceHandler implements RefactoringActionHandler, Elemen
|
||||
}
|
||||
|
||||
if (anInterface != null) {
|
||||
ExtractClassUtil.askAndTurnRefsToSuper(myProject, myClass, anInterface);
|
||||
final Runnable turnRefsToSuperRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExtractClassUtil.askAndTurnRefsToSuper(myProject, myClass, anInterface);
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeLater(turnRefsToSuperRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -47,6 +47,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
public class ExtractSuperclassHandler implements RefactoringActionHandler, ExtractSuperclassDialog.Callback, ElementsHandler {
|
||||
@@ -152,7 +153,7 @@ public class ExtractSuperclassHandler implements RefactoringActionHandler, Extra
|
||||
final DocCommentPolicy javaDocPolicy = new DocCommentPolicy(dialog.getDocCommentPolicy());
|
||||
LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName(subclass, superclassName));
|
||||
try {
|
||||
PsiClass superclass = null;
|
||||
final PsiClass superclass;
|
||||
|
||||
try {
|
||||
superclass =
|
||||
@@ -164,7 +165,12 @@ public class ExtractSuperclassHandler implements RefactoringActionHandler, Extra
|
||||
|
||||
// ask whether to search references to subclass and turn them into refs to superclass if possible
|
||||
if (superclass != null) {
|
||||
ExtractClassUtil.askAndTurnRefsToSuper(project, subclass, superclass);
|
||||
final Runnable turnRefsToSuperRunnable = new Runnable() {
|
||||
public void run() {
|
||||
ExtractClassUtil.askAndTurnRefsToSuper(project, subclass, superclass);
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeLater(turnRefsToSuperRunnable);
|
||||
}
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
|
||||
Reference in New Issue
Block a user