當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。