mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract functional: don't show error dialogs (IDEA-174180)
unable to perform in complex cases instead
This commit is contained in:
+17
-1
@@ -42,6 +42,7 @@ import com.intellij.refactoring.util.RefactoringUtil;
|
||||
import com.intellij.refactoring.util.VariableData;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -67,8 +68,12 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
|
||||
MyExtractMethodProcessor processor =
|
||||
new MyExtractMethodProcessor(project, editor, elementsInCopy, null, IntroduceFunctionalVariableAction.REFACTORING_NAME, null,
|
||||
HelpID.INTRODUCE_VARIABLE);
|
||||
processor.setShowErrorDialogs(false);
|
||||
try {
|
||||
processor.prepare();
|
||||
if (!processor.prepare()) {
|
||||
showErrorMessage(project, editor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (PrepareFailedException e) {
|
||||
showErrorMessage(project, editor);
|
||||
@@ -259,6 +264,17 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepare(@Nullable Pass<ExtractMethodProcessor> pass) throws PrepareFailedException {
|
||||
final boolean prepare = super.prepare(pass);
|
||||
if (prepare) {
|
||||
if (myNotNullConditionalCheck || myNullConditionalCheck) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return prepare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDialog() {
|
||||
if (!myInputVariables.hasInstanceFields() && myInputVariables.getInputVariables().isEmpty() ||
|
||||
|
||||
Reference in New Issue
Block a user