use of com.jetbrains.lang.dart.ide.refactoring.ServerInlineMethodRefactoring in project intellij-plugins by JetBrains.
the class DartInlineMethodRefactoringTest method doTest.
private void doTest(String filePath, boolean all) {
final ServerInlineMethodRefactoring refactoring = createRefactoring(filePath);
// check initial conditions
final RefactoringStatus initialConditions = refactoring.checkInitialConditions();
assertNotNull(initialConditions);
assertTrue(initialConditions.isOK());
// all
if (all) {
refactoring.setInlineAll(true);
refactoring.setDeleteSource(true);
}
// check final conditions
final RefactoringStatus finalConditions = refactoring.checkFinalConditions();
assertNotNull(finalConditions);
assertTrue(finalConditions.isOK());
// apply the SourceChange
final SourceChange change = refactoring.getChange();
assertNotNull(change);
ApplicationManager.getApplication().runWriteAction(() -> {
try {
AssistUtils.applySourceChange(myFixture.getProject(), change, false);
} catch (DartSourceEditException e) {
fail(e.getMessage());
}
});
// validate
myFixture.checkResultByFile(getTestName(false) + ".after.dart");
}
use of com.jetbrains.lang.dart.ide.refactoring.ServerInlineMethodRefactoring in project intellij-plugins by JetBrains.
the class DartInlineMethodRefactoringTest method createRefactoring.
@NotNull
private ServerInlineMethodRefactoring createRefactoring(String filePath) {
((CodeInsightTestFixtureImpl) myFixture).canChangeDocumentDuringHighlighting(true);
final PsiFile psiFile = myFixture.configureByFile(filePath);
// make sure server is warmed up
myFixture.doHighlighting();
// find the Element to rename
final int offset = getEditor().getCaretModel().getOffset();
return new ServerInlineMethodRefactoring(getProject(), psiFile.getVirtualFile(), offset, 0);
}
Aggregations