當前位置: 首頁>>代碼示例>>Java>>正文


Java YAMLPsiElement類代碼示例

本文整理匯總了Java中org.jetbrains.yaml.psi.YAMLPsiElement的典型用法代碼示例。如果您正苦於以下問題:Java YAMLPsiElement類的具體用法?Java YAMLPsiElement怎麽用?Java YAMLPsiElement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


YAMLPsiElement類屬於org.jetbrains.yaml.psi包,在下文中一共展示了YAMLPsiElement類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: searchForKey

import org.jetbrains.yaml.psi.YAMLPsiElement; //導入依賴的package包/類
private static YAMLKeyValue searchForKey(YAMLPsiElement yamlPsiElement, String[] path, int index) {
    if (index < path.length) {
        for (YAMLPsiElement current : yamlPsiElement.getYAMLElements()) {
            if (current instanceof YAMLKeyValue) {
                if (path[index].equals(((YAMLKeyValue) current).getKeyText())) {
                    if (index == path.length - 1) {
                        return ((YAMLKeyValue) current);
                    } else {
                        return searchForKey(current, path, index + 1);
                    }
                }
            } else {
                return searchForKey(current, path, index);
            }
        }
    }
    return null;
}
 
開發者ID:seedstack,項目名稱:intellij-plugin,代碼行數:19,代碼來源:CoffigUtil.java

示例2: getElementNamePairs

import org.jetbrains.yaml.psi.YAMLPsiElement; //導入依賴的package包/類
private List<Pair<PsiElement, String>> getElementNamePairs(YAMLDocument yamlDocument, String elementName) {
    final PsiElement psiElement = findChildRecursively(yamlDocument, new String[]{elementName});
    if (psiElement == null) {
        return Collections.emptyList();
    }

    List<Pair<PsiElement, String>> elementStringPairs = new ArrayList<>();
    try (BufferedReader reader = new BufferedReader(new StringReader(psiElement.getText()))) {
        for (String line; (line = reader.readLine()) != null;) {
            final Matcher matcher = keyInListPattern.matcher(line);
            if (matcher.find()) {
                String elementNameGroup = matcher.group(1);
                YAMLPsiElement childElement = findChildRecursively((YAMLPsiElement) psiElement, new String[]{elementNameGroup});
                PsiElement elementToHighlight = (childElement != null) ? childElement : ((psiElement instanceof YAMLKeyValue) ? ((YAMLKeyValue) psiElement).getKey() : psiElement);
                elementStringPairs.add(new ImmutablePair<>(elementToHighlight, elementNameGroup));
            }
        }
    } catch (IOException ignore) {  // this code is never reached because the reader reads from memory
    }
    return elementStringPairs;
}
 
開發者ID:CloudSlang,項目名稱:cs-intellij-plugin,代碼行數:22,代碼來源:ExecutableAnnotator.java

示例3: getYAMLElements

import org.jetbrains.yaml.psi.YAMLPsiElement; //導入依賴的package包/類
public List<YAMLPsiElement> getYAMLElements() {
    final ArrayList<YAMLPsiElement> result = new ArrayList<>();
    for (ASTNode node : getNode().getChildren(null)) {
        final PsiElement psi = node.getPsi();
        if (psi instanceof YAMLPsiElement) {
            result.add((YAMLPsiElement) psi);
        }
    }
    return result;
}
 
開發者ID:seedstack,項目名稱:intellij-plugin,代碼行數:11,代碼來源:CoffigYamlFileImpl.java

示例4: getYAMLElements

import org.jetbrains.yaml.psi.YAMLPsiElement; //導入依賴的package包/類
public List<YAMLPsiElement> getYAMLElements()
{
    ArrayList<YAMLPsiElement> result = new ArrayList<>();
    ASTNode[] var2 = this.getNode().getChildren(null);
    for (ASTNode node : var2)
    {
        PsiElement psi = node.getPsi();
        if (psi instanceof YAMLPsiElement)
        {
            result.add((YAMLPsiElement) psi);
        }
    }

    return result;
}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:16,代碼來源:RamlFile.java

示例5: findChildRecursively

import org.jetbrains.yaml.psi.YAMLPsiElement; //導入依賴的package包/類
private YAMLPsiElement findChildRecursively(YAMLPsiElement element, String[] possibleName) {
    List<YAMLPsiElement> yamlElements = element.getYAMLElements();
    if (yamlElements.isEmpty()) {
        return null;
    }
    Optional<YAMLPsiElement> matchingNode = yamlElements.stream().filter(e -> hasAcceptedName(e, possibleName)).findFirst();
    return matchingNode.orElseGet(() -> yamlElements.stream()
            .map(e -> findChildRecursively(e, possibleName))
            .filter(Objects::nonNull)
            .findFirst()
            .orElse(null));
}
 
開發者ID:CloudSlang,項目名稱:cs-intellij-plugin,代碼行數:13,代碼來源:ExecutableAnnotator.java

示例6: isPrivatePropertyTrue

import org.jetbrains.yaml.psi.YAMLPsiElement; //導入依賴的package包/類
private boolean isPrivatePropertyTrue(YAMLValue value) {
    List<YAMLPsiElement> yamlElements = value.getYAMLElements();
    for (YAMLPsiElement e : yamlElements) {
        if (e instanceof YAMLKeyValue) {
            YAMLKeyValue property = (YAMLKeyValue) e;
            if (property.getKeyText().equals(PRIVATE) && property.getValueText().equals(TRUE.toString())) {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:CloudSlang,項目名稱:cs-intellij-plugin,代碼行數:13,代碼來源:ExecutableAnnotator.java

示例7: hasAcceptedName

import org.jetbrains.yaml.psi.YAMLPsiElement; //導入依賴的package包/類
private boolean hasAcceptedName(YAMLPsiElement e, String[] possibleName) {
    return Stream.of(possibleName).anyMatch(n -> n.equals(e.getName()));
}
 
開發者ID:CloudSlang,項目名稱:cs-intellij-plugin,代碼行數:4,代碼來源:ExecutableAnnotator.java


注:本文中的org.jetbrains.yaml.psi.YAMLPsiElement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。