mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (formatting)
This commit is contained in:
+17
-21
@@ -10,7 +10,6 @@ import com.intellij.refactoring.introduceVariable.InputValidator;
|
||||
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
|
||||
import com.intellij.refactoring.introduceVariable.IntroduceVariableSettings;
|
||||
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -23,38 +22,35 @@ class MockIntroduceVariableHandler extends IntroduceVariableBase {
|
||||
private final boolean myReplaceAll;
|
||||
private final boolean myDeclareFinal;
|
||||
private final boolean myReplaceLValues;
|
||||
private final String myExpectedTypeCanonicalName;
|
||||
private final String myExpectedTypeText;
|
||||
private final boolean myLookForType;
|
||||
|
||||
MockIntroduceVariableHandler(@NonNls final String name, final boolean replaceAll,
|
||||
final boolean declareFinal, final boolean replaceLValues,
|
||||
@NonNls final String expectedTypeCanonicalName) {
|
||||
this(name, replaceAll, declareFinal, replaceLValues, expectedTypeCanonicalName, false);
|
||||
MockIntroduceVariableHandler(String name, boolean replaceAll, boolean declareFinal, boolean replaceLValues, String expectedTypeText) {
|
||||
this(name, replaceAll, declareFinal, replaceLValues, expectedTypeText, false);
|
||||
}
|
||||
|
||||
MockIntroduceVariableHandler(@NonNls final String name, final boolean replaceAll,
|
||||
final boolean declareFinal, final boolean replaceLValues,
|
||||
@NonNls final String expectedTypeCanonicalName, boolean lookForType) {
|
||||
|
||||
MockIntroduceVariableHandler(String name, boolean replaceAll, boolean declareFinal, boolean replaceLValues, String expectedTypeText, boolean lookForType) {
|
||||
myName = name;
|
||||
myReplaceAll = replaceAll;
|
||||
myDeclareFinal = declareFinal;
|
||||
myReplaceLValues = replaceLValues;
|
||||
myExpectedTypeCanonicalName = expectedTypeCanonicalName;
|
||||
myExpectedTypeText = expectedTypeText;
|
||||
myLookForType = lookForType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntroduceVariableSettings getSettings(Project project, Editor editor,
|
||||
PsiExpression expr, final PsiExpression[] occurrences,
|
||||
PsiExpression expr,
|
||||
PsiExpression[] occurrences,
|
||||
TypeSelectorManagerImpl typeSelectorManager,
|
||||
final boolean declareFinalIfAll,
|
||||
boolean declareFinalIfAll,
|
||||
boolean anyAssignmentLHS,
|
||||
InputValidator validator,
|
||||
PsiElement anchor, final JavaReplaceChoice replaceChoice) {
|
||||
final PsiType type = myLookForType ? findType(typeSelectorManager.getTypesForAll(), typeSelectorManager.getDefaultType())
|
||||
: typeSelectorManager.getDefaultType();
|
||||
assertEquals(type.getInternalCanonicalText(), myExpectedTypeCanonicalName);
|
||||
PsiElement anchor,
|
||||
JavaReplaceChoice replaceChoice) {
|
||||
PsiType defaultType = typeSelectorManager.getDefaultType();
|
||||
PsiType type = myLookForType ? findType(typeSelectorManager.getTypesForAll(), defaultType) : defaultType;
|
||||
assertEquals(type.getInternalCanonicalText(), myExpectedTypeText);
|
||||
IntroduceVariableSettings introduceVariableSettings = new IntroduceVariableSettings() {
|
||||
@Override
|
||||
public String getEnteredName() {
|
||||
@@ -86,12 +82,12 @@ class MockIntroduceVariableHandler extends IntroduceVariableBase {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
final boolean validationResult = validator.isOK(introduceVariableSettings);
|
||||
boolean validationResult = validator.isOK(introduceVariableSettings);
|
||||
assertValidationResult(validationResult);
|
||||
return introduceVariableSettings;
|
||||
}
|
||||
|
||||
protected void assertValidationResult(final boolean validationResult) {
|
||||
protected void assertValidationResult(boolean validationResult) {
|
||||
assertTrue(validationResult);
|
||||
}
|
||||
|
||||
@@ -102,8 +98,8 @@ class MockIntroduceVariableHandler extends IntroduceVariableBase {
|
||||
|
||||
private PsiType findType(final PsiType[] candidates, PsiType defaultType) {
|
||||
for (PsiType candidate : candidates) {
|
||||
if (candidate.equalsToText(myExpectedTypeCanonicalName)) return candidate;
|
||||
if (candidate.equalsToText(myExpectedTypeText)) return candidate;
|
||||
}
|
||||
return defaultType;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user