use of com.intellij.refactoring.introduceParameter.IntroduceParameterHandler in project intellij-community by JetBrains.
the class IntroduceParameterTest method doTestThroughHandler.
private void doTestThroughHandler() {
configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
boolean enabled = true;
try {
configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
enabled = myEditor.getSettings().isVariableInplaceRenameEnabled();
myEditor.getSettings().setVariableInplaceRenameEnabled(false);
new IntroduceParameterHandler().invoke(getProject(), myEditor, myFile, DataContext.EMPTY_CONTEXT);
checkResultByFile("/refactoring/introduceParameter/after" + getTestName(false) + ".java");
} finally {
myEditor.getSettings().setVariableInplaceRenameEnabled(enabled);
}
}
use of com.intellij.refactoring.introduceParameter.IntroduceParameterHandler in project intellij-community by JetBrains.
the class IntroduceFunctionalParameterTest method doTest.
private void doTest(String conflict) {
boolean enabled = true;
try {
configureByFile("/refactoring/introduceFunctionalParameter/before" + getTestName(false) + ".java");
enabled = myEditor.getSettings().isVariableInplaceRenameEnabled();
myEditor.getSettings().setVariableInplaceRenameEnabled(false);
final SelectionModel selectionModel = getEditor().getSelectionModel();
if (selectionModel.hasSelection()) {
PsiElement[] elements = ExtractMethodHandler.getElements(getProject(), getEditor(), getFile());
new IntroduceParameterHandler().introduceStrategy(getProject(), getEditor(), getFile(), elements);
}
checkResultByFile("/refactoring/introduceFunctionalParameter/after" + getTestName(false) + ".java");
if (conflict != null) {
fail("Conflict expected");
}
} catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
if (conflict == null) {
throw e;
}
assertEquals(conflict, e.getMessage());
} finally {
myEditor.getSettings().setVariableInplaceRenameEnabled(enabled);
}
}
Aggregations