本文整理汇总了Java中com.intellij.json.psi.JsonArray类的典型用法代码示例。如果您正苦于以下问题:Java JsonArray类的具体用法?Java JsonArray怎么用?Java JsonArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonArray类属于com.intellij.json.psi包,在下文中一共展示了JsonArray类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compute
import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
@Nullable
@Override
public Result<String[]> compute() {
List<Object> dependencies = new LinkedList<Object>();
for(JsonFile configFile : findConfigFiles()) {
dependencies.add(configFile);
JsonValue jsonValue = JsonPsiUtil.findPropertyValue(configFile.getTopLevelValue(), "componentsGlob");
if(jsonValue == null)
continue;
List<String> paths = new LinkedList<String>();
if(jsonValue instanceof JsonStringLiteral) {
paths.add(((JsonStringLiteral)jsonValue).getValue());
} else if(jsonValue instanceof JsonArray) {
for(JsonStringLiteral item: PsiTreeUtil.findChildrenOfType(jsonValue, JsonStringLiteral.class))
paths.add(item.getValue());
}
return Result.create(createValue(paths.toArray(new String[paths.size()])), jsonValue);
}
dependencies.add(tracker.getValue());
return Result.create(createValue(), dependencies);
}
示例2: getChildrenOfArrayObject
import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
public List<PsiElement> getChildrenOfArrayObject(final PsiElement psiElement) {
return Arrays.stream(psiElement.getChildren())
.filter(child -> child instanceof JsonArray || child instanceof YAMLSequence)
.map(el -> Arrays.asList(el.getChildren()))
.flatMap(Collection::stream)
.collect(Collectors.toList());
}
示例3: JsonBlock
import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
public JsonBlock(@Nullable JsonBlock parent,
@NotNull ASTNode node,
@NotNull CodeStyleSettings settings,
@Nullable Alignment alignment,
@NotNull Indent indent,
@Nullable Wrap wrap) {
myParent = parent;
myNode = node;
myPsiElement = node.getPsi();
myAlignment = alignment;
myIndent = indent;
myWrap = wrap;
mySettings = settings;
mySpacingBuilder = JsonFormattingBuilderModel.createSpacingBuilder(settings);
if (myPsiElement instanceof JsonObject) {
myChildWrap = Wrap.createWrap(getCustomSettings().OBJECT_WRAPPING, true);
}
else if (myPsiElement instanceof JsonArray) {
myChildWrap = Wrap.createWrap(getCustomSettings().ARRAY_WRAPPING, true);
}
else {
myChildWrap = null;
}
myPropertyValueAlignment = myPsiElement instanceof JsonObject ? Alignment.createAlignment(true) : null;
}
示例4: apply
import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
@Override
public void apply(@NotNull Editor editor, @NotNull JsonSmartEnterProcessor processor, @NotNull PsiElement element)
throws IncorrectOperationException {
if (element instanceof JsonValue && element.getParent() instanceof JsonArray) {
final JsonValue arrayElement = (JsonValue)element;
if (terminatedOnCurrentLine(editor, arrayElement) && !isFollowedByTerminal(element, COMMA)) {
editor.getDocument().insertString(arrayElement.getTextRange().getEndOffset(), ",");
processor.myShouldAddNewline = true;
}
}
}
示例5: JsonStructureViewModel
import com.intellij.json.psi.JsonArray; //导入依赖的package包/类
public JsonStructureViewModel(@NotNull PsiFile psiFile, @Nullable Editor editor) {
super(psiFile, editor, new JsonStructureViewElement((JsonFile)psiFile));
withSuitableClasses(JsonFile.class, JsonProperty.class, JsonObject.class, JsonArray.class);
}