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


Java PsiElement.equals方法代碼示例

本文整理匯總了Java中com.intellij.psi.PsiElement.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiElement.equals方法的具體用法?Java PsiElement.equals怎麽用?Java PsiElement.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.psi.PsiElement的用法示例。


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

示例1: addLineMarkerUnique

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
private void addLineMarkerUnique(@NotNull Collection<LineMarkerInfo> collection, @Nullable LineMarkerInfo newMarker) {
    if (newMarker == null) {
        return;
    }
    for (LineMarkerInfo lineMarkerInfo : collection) {
        PsiElement element = lineMarkerInfo.getElement();
        if (element == null) {
            return;
        }
        if (element.equals(newMarker.getElement())) {
            return;
        }
    }
    collection.add(newMarker);
}
 
開發者ID:dmeybohm,項目名稱:chocolate-cakephp,代碼行數:16,代碼來源:ControllerMethodLineMarker.java

示例2: getColumnForHeader

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
public static List<PsiElement> getColumnForHeader(@NotNull final ImpexFullHeaderParameter headerParameter) {

        final PsiElement[] children = headerParameter.getParent().getChildren();
        int i = -2;
        for (final PsiElement child : children) {
            if (!child.equals(headerParameter)) {
                i++;
            } else {
                break;
            }
        }

        final List<PsiElement> result = newArrayList();
        PsiElement psiElement = getNextSiblingOfAnyType(
            PsiTreeUtil.getParentOfType(headerParameter, ImpexHeaderLine.class),
            ImpexValueLine.class,
            ImpexHeaderLine.class,
            ImpexRootMacroUsage.class
        );

        while (psiElement != null && !isHeaderLine(psiElement) && !isUserRightsMacros(psiElement)) {
            if (isImpexValueLine(psiElement)) {
                final PsiElement[] elements = psiElement.getChildren();
                if (elements.length > i) {
                    result.add(elements[i]);
                }
            }


            psiElement = getNextSiblingOfAnyType(
                psiElement,
                ImpexValueLine.class,
                ImpexHeaderLine.class,
                ImpexRootMacroUsage.class
            );
        }

        return result;
    }
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:40,代碼來源:ImpexPsiUtils.java

示例3: addCompletions

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters completionParameters, ProcessingContext processingContext, @NotNull CompletionResultSet completionResultSet) {
    final PsiElement psiElement = completionParameters.getPosition();
    final MethodReference method = PsiTreeUtil.getParentOfType(psiElement, MethodReference.class);

    if (method == null || method.getParameters().length == 0) {
        return;
    }

    if (!ViewsUtil.isValidRenderMethod(method)) {
        return;
    }

    PsiElement parameter = psiElement;
    while (parameter != null && !(parameter.getParent() instanceof ParameterList)) {
        parameter = parameter.getParent();
    }
    if (parameter == null || !parameter.equals(method.getParameters()[0])) {
        return;
    }

    String path = getValue(method.getParameters()[0]);
    PsiDirectory directory;
    if (path.startsWith("/")) {
        path = path.substring(1);
        directory = ViewsUtil.getRootDirectory(psiElement);
    } else {
        directory = ViewsUtil.getContextDirectory(psiElement);
    }
    if (path.contains("/")) {
        path = path.substring(0, path.lastIndexOf('/') + 1);
    }

    while (path.contains("/") && directory != null) {
        String subdirectory = path.substring(0, path.indexOf('/'));
        path = path.substring(path.indexOf('/') + 1);
        directory = subdirectory.equals("..") ? directory.getParent() : directory.findSubdirectory(subdirectory);
    }
    if (directory != null) {
        if (completionResultSet.getPrefixMatcher().getPrefix().contains("/")) {
            String prefix = completionResultSet.getPrefixMatcher().getPrefix();
            prefix = prefix.substring(prefix.lastIndexOf("/") + 1);
            completionResultSet = completionResultSet.withPrefixMatcher(prefix);
        }

        for (PsiDirectory psiDirectory : directory.getSubdirectories()) {
            completionResultSet.addElement(new DirectoryLookupElement(psiDirectory));
        }

        for (PsiFile psiFile : directory.getFiles()) {
            completionResultSet.addElement(new ViewLookupElement(psiFile));
        }
    }
}
 
開發者ID:nvlad,項目名稱:yii2support,代碼行數:55,代碼來源:CompletionProvider.java

示例4: getColumnOfHeaderUnderCaret

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
public static List<PsiElement> getColumnOfHeaderUnderCaret(@NotNull final Editor editor) {
    Validate.notNull(editor);

    final PsiElement psiElementUnderCaret = PsiUtilBase.getElementAtCaret(editor);
    if (null == psiElementUnderCaret) {
        return null;
    }

    final ImpexFullHeaderParameter headerParameter = PsiTreeUtil.getParentOfType(
        psiElementUnderCaret,
        ImpexFullHeaderParameter.class
    );
    if (null != headerParameter) {

        final PsiElement[] children = headerParameter.getParent().getChildren();
        int i = -2;
        for (final PsiElement child : children) {
            if (!child.equals(headerParameter)) {
                i++;
            } else {
                break;
            }
        }

        final List<PsiElement> result = newArrayList();
        PsiElement psiElement = getNextSiblingOfAnyType(
            PsiTreeUtil.getParentOfType(headerParameter, ImpexHeaderLine.class),
            ImpexValueLine.class,
            ImpexHeaderLine.class,
            ImpexRootMacroUsage.class
        );

        while (psiElement != null && !isHeaderLine(psiElement) && !isUserRightsMacros(psiElement)) {
            if (isImpexValueLine(psiElement)) {
                final PsiElement[] elements = psiElement.getChildren();
                if (elements.length > i) {
                    result.add(elements[i]);
                }
            }


            psiElement = getNextSiblingOfAnyType(
                psiElement,
                ImpexValueLine.class,
                ImpexHeaderLine.class,
                ImpexRootMacroUsage.class
            );
        }

        return result;
    }

    return null;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:55,代碼來源:ImpexPsiUtils.java


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