mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
introduce: allow to provide checks to filter unacceptable expressions before showing them to user (IDEA-100776)
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
public class Test {
|
||||
|
||||
void foo(Integer i) {
|
||||
i.compareTo(<caret>1)
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
public class Test {
|
||||
|
||||
public static final int xxx = 1;
|
||||
|
||||
void foo(Integer i) {
|
||||
i.compareTo(xxx)
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,12 @@ public class IntroduceConstantTest extends LightCodeInsightTestCase {
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
public void testTailingErrorUnacceptableWholeLineSelection() throws Exception {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".java");
|
||||
new MockIntroduceConstantHandler(null).invoke(getProject(), getEditor(), getFile(), null);
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
private static void convertLocal(final boolean makeEnumConstant) {
|
||||
PsiLocalVariable local = PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiLocalVariable.class);
|
||||
new MockLocalToFieldHandler(getProject(), true, makeEnumConstant).convertLocalToField(local, getEditor());
|
||||
|
||||
@@ -11,7 +11,6 @@ package com.intellij.refactoring;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.CodeInsightUtil;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.util.Pass;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
@@ -365,7 +364,12 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
|
||||
int enclosingLevel) {
|
||||
final ElementToWorkOn[] elementToWorkOn = new ElementToWorkOn[1];
|
||||
ElementToWorkOn
|
||||
.processElementToWorkOn(myEditor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, getProject(), new Pass<ElementToWorkOn>() {
|
||||
.processElementToWorkOn(myEditor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, getProject(), new ElementToWorkOn.ElementsProcessor<ElementToWorkOn>() {
|
||||
@Override
|
||||
public boolean accept(ElementToWorkOn el) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pass(final ElementToWorkOn e) {
|
||||
if (e == null) return;
|
||||
|
||||
Reference in New Issue
Block a user