Search in sources :

Example 6 with SourceFileEdit

use of org.dartlang.analysis.server.protocol.SourceFileEdit in project intellij-plugins by JetBrains.

the class OrganizeDirectivesProcessor method process.

public void process(JsonObject resultObject, RequestError requestError) {
    if (resultObject != null) {
        try {
            JsonObject editObject = resultObject.get("edit").getAsJsonObject();
            SourceFileEdit fileEdit = SourceFileEdit.fromJson(editObject);
            consumer.computedEdit(fileEdit);
        } catch (Exception exception) {
            // catch any exceptions in the formatting of this response
            requestError = generateRequestError(exception);
        }
    }
    if (requestError != null) {
        consumer.onError(requestError);
    }
}
Also used : SourceFileEdit(org.dartlang.analysis.server.protocol.SourceFileEdit) JsonObject(com.google.gson.JsonObject)

Example 7 with SourceFileEdit

use of org.dartlang.analysis.server.protocol.SourceFileEdit in project intellij-plugins by JetBrains.

the class SortMembersProcessor method process.

public void process(JsonObject resultObject, RequestError requestError) {
    if (resultObject != null) {
        try {
            JsonObject editObject = resultObject.get("edit").getAsJsonObject();
            SourceFileEdit fileEdit = SourceFileEdit.fromJson(editObject);
            consumer.computedEdit(fileEdit);
        } catch (Exception exception) {
            // catch any exceptions in the formatting of this response
            requestError = generateRequestError(exception);
        }
    }
    if (requestError != null) {
        consumer.onError(requestError);
    }
}
Also used : SourceFileEdit(org.dartlang.analysis.server.protocol.SourceFileEdit) JsonObject(com.google.gson.JsonObject)

Aggregations

SourceFileEdit (org.dartlang.analysis.server.protocol.SourceFileEdit)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 Document (com.intellij.openapi.editor.Document)3 JsonObject (com.google.gson.JsonObject)2 DartAnalysisServerService (com.jetbrains.lang.dart.analyzer.DartAnalysisServerService)2 SourceEdit (org.dartlang.analysis.server.protocol.SourceEdit)2 PsiElement2UsageTargetAdapter (com.intellij.find.findUsages.PsiElement2UsageTargetAdapter)1 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)1 TextRange (com.intellij.openapi.util.TextRange)1 PsiElement (com.intellij.psi.PsiElement)1 PsiFile (com.intellij.psi.PsiFile)1 PsiManager (com.intellij.psi.PsiManager)1 UsageInfo (com.intellij.usageView.UsageInfo)1 DartSourceEditException (com.jetbrains.lang.dart.assists.DartSourceEditException)1 IOException (java.io.IOException)1 SourceChange (org.dartlang.analysis.server.protocol.SourceChange)1 NotNull (org.jetbrains.annotations.NotNull)1