use of org.dartlang.analysis.server.protocol.SourceChange in project intellij-plugins by JetBrains.
the class DartInlineLocalRefactoringTest method doTest.
private void doTest(String filePath) {
final ServerInlineLocalRefactoring refactoring = createInlineLocalRefactoring(filePath);
// check initial conditions
final RefactoringStatus initialConditions = refactoring.checkInitialConditions();
assertNotNull(initialConditions);
assertTrue(initialConditions.isOK());
// 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 org.dartlang.analysis.server.protocol.SourceChange in project intellij-plugins by JetBrains.
the class StatementCompletionProcessor method process.
public void process(JsonObject resultObject, RequestError requestError) {
if (resultObject != null) {
try {
SourceChange sourceChange = SourceChange.fromJson(resultObject.get("change").getAsJsonObject());
consumer.computedSourceChange(sourceChange);
} catch (Exception exception) {
// catch any exceptions in the formatting of this response
requestError = generateRequestError(exception);
}
}
}
Aggregations