use of com.intellij.json.psi.JsonFile in project intellij-community by JetBrains.
the class JsonSchemaReader method create.
@Nullable
public static JsonSchemaReader create(@NotNull Project project, @NotNull VirtualFile key) {
final PsiFile psiFile = PsiManager.getInstance(project).findFile(key);
if (!(psiFile instanceof JsonFile))
return null;
final List<JsonValue> values = ((JsonFile) psiFile).getAllTopLevelValues();
if (values.size() != 1 || !(values.get(0) instanceof JsonObject))
return null;
return new JsonSchemaReader((JsonObject) values.get(0));
}
use of com.intellij.json.psi.JsonFile in project intellij-community by JetBrains.
the class JsonSmartEnterProcessor method collectAdditionalElements.
@Override
protected void collectAdditionalElements(@NotNull PsiElement element, @NotNull List<PsiElement> result) {
// include all parents as well
PsiElement parent = element.getParent();
while (parent != null && !(parent instanceof JsonFile)) {
result.add(parent);
parent = parent.getParent();
}
}
Aggregations