当前位置: 首页>>代码示例>>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;未经允许,请勿转载。