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


Java PsiElement.getNextSibling方法代碼示例

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


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

示例1: findQuotePositionsUntilSeparator

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
public static PsiElement findQuotePositionsUntilSeparator(PsiElement element, List<Integer> quotePositions) {
    PsiElement separatorElement = null;
    while (separatorElement == null && element != null) {
        if (getElementType(element) == CsvTypes.COMMA || getElementType(element) == CsvTypes.CRLF) {
            separatorElement = element;
            continue;
        }
        if (element.getFirstChild() != null) {
            separatorElement = findQuotePositionsUntilSeparator(element.getFirstChild(), quotePositions);
        } else if (element.getText().equals("\"")) {
            quotePositions.add(element.getTextOffset());
        }
        element = element.getNextSibling();
    }
    return separatorElement;
}
 
開發者ID:SeeSharpSoft,項目名稱:intellij-csv-validator,代碼行數:17,代碼來源:CsvIntentionHelper.java

示例2: invokeAutoPopup

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Override
public boolean invokeAutoPopup(@NotNull PsiElement position, char typeChar) {
    MethodReference reference = PsiTreeUtil.getParentOfType(position, MethodReference.class);
    if (reference != null && reference.getName() != null && reference.getName().equals("t") && reference.getClassReference() instanceof ClassReference) {
        ClassReference classReference = (ClassReference) reference.getClassReference();
        if (classReference == null || classReference.getName() == null || !classReference.getName().equals("Yii")) {
            return false;
        }
        if (typeChar == '\'' || typeChar == '"') {
            if (position instanceof LeafPsiElement && (position.getText().equals("$category") || position.getText().equals("$message"))) {
                return true;
            }
            if (position.getNextSibling() instanceof ParameterList) {
                return true;
            }
        }
    }

    return false;
}
 
開發者ID:nvlad,項目名稱:yii2support,代碼行數:21,代碼來源:CompletionContributor.java

示例3: getIdentifiers

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Override
public List<PsiElement> getIdentifiers() {
  final List<PsiElement> result = new ArrayList<>();
  PsiElement psiChild = getFirstChild();
  if (psiChild == null) {
    result.add(this);
    return result;
  }
  while (psiChild != null) {
    if (psiChild.getNode().getElementType() != TokenType.WHITE_SPACE) {
      result.add(psiChild);
    }
    psiChild = psiChild.getNextSibling();
  }
  return result;
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:17,代碼來源:AbstractDictionaryConstantSpecifier.java

示例4: applyFix

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
    final PsiElement expression = descriptor.getPsiElement();
    if (expression instanceof ArrayHashElement) {
        PsiElement next = expression.getNextSibling();
        if (next instanceof PsiWhiteSpace) {
            next.delete();
        }
        next = expression.getNextSibling();
        if (null != next && PhpTokenTypes.opCOMMA == next.getNode().getElementType()) {
            next.delete();
        }
        next = expression.getNextSibling();
        if (next instanceof PsiWhiteSpace) {
            next.delete();
        }

        expression.delete();
    }
}
 
開發者ID:kalessil,項目名稱:yii2inspections,代碼行數:21,代碼來源:UnusedTranslationsInspector.java

示例5: getNextSiblingOfAnyType

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Nullable
@Contract("null, _ -> null")
public static <T extends PsiElement> T getNextSiblingOfAnyType(
    @Nullable PsiElement sibling,
    @NotNull Class... aClasses
) {
    if (sibling == null) {
        return null;
    } else {
        for (PsiElement child = sibling.getNextSibling(); child != null; child = child.getNextSibling()) {
            for (final Class<T> aClass : aClasses) {
                if (aClass.isInstance(child)) {
                    return (T) child;
                }
            }
        }

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

示例6: nextElementIsHeaderLine

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Nullable
@Contract(pure = true)
public static boolean nextElementIsHeaderLine(@NotNull final PsiElement element) {
    Validate.notNull(element);

    PsiElement nextSibling = element.getNextSibling();

    while (null != nextSibling) {
        if (isImpexValueLine(nextSibling)) {
            return false;
        }
        if (isUserRightsMacros(nextSibling)) {
            return false;
        }
        if (isHeaderLine(nextSibling)) {
            return true;
        }
        nextSibling = nextSibling.getNextSibling();
    }

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

示例7: deleteArrayElement

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
public static void deleteArrayElement(PsiElement element) {
    PsiElement next = element.getNextSibling();
    String endArray = ((ArrayCreationExpression) element.getParent()).isShortSyntax() ? "]" : ")";

    if (next instanceof PsiWhiteSpace && next.getNextSibling().getText() != null) {
        if (next.getNextSibling().getText().equals(endArray)) {
            next = next.getNextSibling();
        }
    }
    if (next.getText().equals(endArray)) {
        Boolean deleteComma = false;
        if (element.getPrevSibling() instanceof PsiWhiteSpace) {
            deleteComma = !element.getPrevSibling().getText().contains("\n");
            element.getPrevSibling().delete();
        }
        if (deleteComma && element.getPrevSibling().getText().equals(",")) {
            element.getPrevSibling().delete();
        }
    }
    if (next.getText().equals(",")) {
        if (next.getNextSibling() instanceof PsiWhiteSpace) {
            next.getNextSibling().delete();
        }
        next.delete();
    }
    element.delete();
}
 
開發者ID:nvlad,項目名稱:yii2support,代碼行數:28,代碼來源:PsiUtil.java

示例8: getNextSeparator

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
private static PsiElement getNextSeparator(PsiElement fieldElement) {
    while (fieldElement != null) {
        if (getElementType(fieldElement) == CsvTypes.COMMA) {
            break;
        }
        fieldElement = fieldElement.getNextSibling();
    }
    return fieldElement;
}
 
開發者ID:SeeSharpSoft,項目名稱:intellij-csv-validator,代碼行數:10,代碼來源:CsvIntentionHelper.java

示例9: getClassByClassPhpDoc

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Nullable
public static PhpClass getClassByClassPhpDoc(PhpDocComment comment) {
    PsiElement nextElement = comment.getNextPsiSibling();
    int limit = 10;
    while (limit > 0) {
        if (nextElement instanceof PhpClass)
            return (PhpClass) nextElement;
        else if (nextElement == null)
            return null;
        nextElement = nextElement.getNextSibling();
        limit--;
    }
    return null;
}
 
開發者ID:nvlad,項目名稱:yii2support,代碼行數:15,代碼來源:DatabaseUtils.java

示例10: getRealNextElement

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
public static PsiElement getRealNextElement (PsiElement p){
    PsiElement p1 = p.getNextSibling();
    if(p1 !=null){
        if(!(p1 instanceof PsiWhiteSpace)){
            return  p1;
        }
        PsiElement p2 = p1.getNextSibling();
        if(p2 !=null && !( p2 instanceof PsiWhiteSpace)){
            return  p2;
        }
    }
    return null;
}
 
開發者ID:dpzxsm,項目名稱:ReactPropTypes-Plugin,代碼行數:14,代碼來源:PsiElementHelper.java

示例11: isRecursive

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
private boolean isRecursive() {
    // Find first element after the LET
    PsiElement firstChild = getFirstChild();
    PsiElement sibling = firstChild.getNextSibling();
    if (sibling != null && sibling instanceof PsiWhiteSpace) {
        sibling = sibling.getNextSibling();
    }

    return sibling != null && "rec".equals(sibling.getText());
}
 
開發者ID:reasonml-editor,項目名稱:reasonml-idea-plugin,代碼行數:11,代碼來源:PsiLetImpl.java

示例12: applyFix

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
    final PsiElement expression = descriptor.getPsiElement();
    if (null != expression && expression.getParent() instanceof ArrayCreationExpression) {
        final ArrayCreationExpression container = (ArrayCreationExpression) expression.getParent();
        final PsiElement closingBracket         = container.getLastChild();
        if (null == closingBracket) {
            return;
        }

        for (String translation : missing) {
            /* reach or create a comma */
            PsiElement last = closingBracket.getPrevSibling();
            if (last instanceof PsiWhiteSpace) {
                last = last.getPrevSibling();
            }
            if (null != last && PhpTokenTypes.opCOMMA != last.getNode().getElementType()) {
                last.getParent().addAfter(PhpPsiElementFactory.createComma(project), last);
                last = last.getNextSibling();
            }

            /* add a new translation */
            final String escaped                = PhpStringUtil.escapeText(translation, true, '\n', '\t');
            final String pairPattern            = "array('%s%' => '%s%')".replace("%s%", escaped).replace("%s%", escaped);
            final ArrayCreationExpression array = PhpPsiElementFactory.createFromText(project, ArrayCreationExpression.class, pairPattern);
            final PhpPsiElement pair            = null == array ? null : array.getHashElements().iterator().next();
            final PsiWhiteSpace space           = PhpPsiElementFactory.createFromText(project, PsiWhiteSpace.class, " ");
            if (null == last || null == pair || null == space) {
                continue;
            }
            last.getParent().addAfter(pair, last);
            last.getParent().addAfter(space, last);
        }
    }
}
 
開發者ID:kalessil,項目名稱:yii2inspections,代碼行數:36,代碼來源:MissingTranslationsInspector.java

示例13: getSelectedTable

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Nullable
final Pair<PsiElement, PsiElement> getSelectedTable(final @NotNull ImpexTableEditor editor) {
    final PsiElement elementAtCaret = getElementAtCaret(editor.getIdeaEditor());


    final PsiElement valueLineAt;
    if (elementAtCaret != null) {
        if (getNextSiblingOfType(elementAtCaret, ImpexValueLine.class) != null) {
            valueLineAt = elementAtCaret.getNextSibling();
        } else if (getPrevSiblingOfType(elementAtCaret, ImpexValueLine.class) != null) {
            valueLineAt = elementAtCaret.getPrevSibling();
        } else {
            valueLineAt = getParentOfType(
                elementAtCaret,
                ImpexValueLine.class
            );

        }
    } else {
        return null;
    }

    if (valueLineAt == null) {
        return null;
    }

    final PsiElement headerLine = scanFirstLine(elementAtCaret, valueLineAt);

    final PsiElement lastValueLine = scanLastLine(valueLineAt, headerLine);

    return Pair.create(headerLine, lastValueLine);
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:33,代碼來源:AbstractOperation.java

示例14: buildVisitor

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
    return new PsiElementVisitor() {
        @Override
        public void visitElement(PsiElement element) {
            if (element == null || !holder.getFile().getLanguage().isKindOf(CsvLanguage.INSTANCE)) {
                return;
            }
            
            IElementType elementType = CsvIntentionHelper.getElementType(element);
            PsiElement firstChild = element.getFirstChild();
            PsiElement nextSibling = element.getNextSibling();
            if (elementType == TokenType.ERROR_ELEMENT && CsvIntentionHelper.getElementType(firstChild) == TokenType.BAD_CHARACTER) {
                if (firstChild.getText().equals("\"")) {
                    holder.registerProblem(element, UNESCAPED_SEQUENCE, fixUnescapedSequence);
                } else {
                    holder.registerProblem(element, SEPARATOR_MISSING, fixSeparatorMissing);
                    holder.registerProblem(element, UNESCAPED_SEQUENCE, fixUnescapedSequence);
                }
            } else if ((elementType == CsvTypes.TEXT || elementType == CsvTypes.ESCAPED_TEXT)
                    && CsvIntentionHelper.getElementType(nextSibling) == TokenType.ERROR_ELEMENT
                    && nextSibling.getFirstChild() == null) {
                holder.registerProblem(element, CLOSING_QUOTE_MISSING, fixClosingQuoteMissing);
            }
        }
    };
}
 
開發者ID:SeeSharpSoft,項目名稱:intellij-csv-validator,代碼行數:29,代碼來源:CsvValidationInspection.java

示例15: isFoldable

import com.intellij.psi.PsiElement; //導入方法依賴的package包/類
@Contract(pure = true)
private boolean isFoldable(@Nullable final PsiElement element) {
    return null != element
           && this.isSupportedType(element)
           && !(isLineBreak(element) && isHeaderLine(element.getPrevSibling()))
           && !(isLineBreak(element) && isUserRightsMacros(element.getPrevSibling()))
           && !(isLineBreak(element) && element.getNextSibling() == null);
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:9,代碼來源:ImpexFoldingLinesFilter.java


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