当前位置: 首页>>代码示例>>Java>>正文


Java PsiTreeUtil.skipSiblingsBackward方法代码示例

本文整理汇总了Java中com.intellij.psi.util.PsiTreeUtil.skipSiblingsBackward方法的典型用法代码示例。如果您正苦于以下问题:Java PsiTreeUtil.skipSiblingsBackward方法的具体用法?Java PsiTreeUtil.skipSiblingsBackward怎么用?Java PsiTreeUtil.skipSiblingsBackward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.util.PsiTreeUtil的用法示例。


在下文中一共展示了PsiTreeUtil.skipSiblingsBackward方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prevElementIsUserRightsMacros

import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@Nullable
@Contract(pure = true)
public static boolean prevElementIsUserRightsMacros(@NotNull final PsiElement element) {
    Validate.notNull(element);

    final Class[] skipClasses = {ImpexValueLine.class, PsiComment.class, PsiWhiteSpace.class};
    PsiElement prevElement = PsiTreeUtil.skipSiblingsBackward(element, skipClasses);

    while (null != prevElement) {
        if (isHeaderLine(prevElement)) {
            return false;
        }
        if (isUserRightsMacros(prevElement)) {
            return true;
        }
        prevElement = PsiTreeUtil.skipSiblingsBackward(prevElement, skipClasses);
    }

    return false;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:ImpexPsiUtils.java

示例2: adjustWhiteSpaceAndSeparator

import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
private static PsiElement adjustWhiteSpaceAndSeparator(PsiElement psi) {
    if (psi instanceof PsiWhiteSpace) {
        //white space should be adjusted to left
        PsiElement prev = PsiTreeUtil.skipSiblingsBackward(psi, PsiWhiteSpace.class);
        if (prev != null) {
            psi = prev;
        }
    } else if (psi.getNode().getElementType() == ImpexTypes.PARAMETERS_SEPARATOR && psi.getNextSibling() != null) {
        //separator is always belongs to the *next* parameter, so adjusting to right
        psi = psi.getNextSibling();
    }
    return psi;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:14,代码来源:ImpexColumnBreadcrumbsProvider.java

示例3: getPrevMeaningSibling

import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@Nullable
public static PsiElement getPrevMeaningSibling(PsiElement element) {
  return PsiTreeUtil.skipSiblingsBackward(element, PsiWhiteSpace.class, PsiComment.class);
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:5,代码来源:WhitespaceUtils.java

示例4: aroundIsValueLine

import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@Contract(pure = true)
public static boolean aroundIsValueLine(@Nullable final PsiElement element) {
    if (element == null) {
        return false;
    }

    if (isImpexValueLine(element)
        || isImpexValueLine(element.getParent())
        || isImpexValueLine(element.getParent().getParent())) {
        return true;
    }

    boolean prevElementIsValueLine = false;
    PsiElement prevSibling = PsiTreeUtil.skipSiblingsBackward(
        element,
        PsiWhiteSpace.class,
        PsiComment.class,
        ImpexBeanShell.class,
        ImpexComment.class
    );
    while (null != prevSibling) {
        if (isHeaderLine(prevSibling) || isImpexValueLine(prevSibling) || isUserRightsMacros(prevSibling)) {
            prevElementIsValueLine = true;
            break;
        }
        prevSibling = PsiTreeUtil.skipSiblingsBackward(
            prevSibling,
            PsiWhiteSpace.class,
            PsiComment.class,
            ImpexBeanShell.class,
            ImpexComment.class
        );
    }


    boolean nextElementIsValueLine = false;
    PsiElement nextSibling = PsiTreeUtil.skipSiblingsForward(element,
                                                             PsiWhiteSpace.class, ImpexBeanShell.class,
                                                             ImpexComment.class
    );

    while (null != nextSibling) {
        if (isImpexValueLine(nextSibling)) {
            nextElementIsValueLine = true;
            break;
        }
        if (isHeaderLine(nextSibling)) {
            nextElementIsValueLine = false;
            break;
        }
        if (isUserRightsMacros(nextSibling)) {
            nextElementIsValueLine = false;
            break;
        }
        nextSibling = PsiTreeUtil.skipSiblingsForward(nextSibling,
                                                      PsiWhiteSpace.class, ImpexBeanShell.class,
                                                      ImpexComment.class
        );
    }

    return nextElementIsValueLine && prevElementIsValueLine;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:63,代码来源:ImpexPsiUtils.java


注:本文中的com.intellij.psi.util.PsiTreeUtil.skipSiblingsBackward方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。