Java Code Examples for com.intellij.psi.util.PsiTreeUtil#skipParentsOfType()

The following examples show how to use com.intellij.psi.util.PsiTreeUtil#skipParentsOfType() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private boolean isInString(PsiElement start) {
    PsiElement parent = PsiTreeUtil.skipParentsOfType(start, LeafPsiElement.class, BashVar.class);
    if (parent != null) {
        return parent instanceof BashString;
    }
    return start instanceof BashString;
}
 
Example 2
public static boolean isOnAssignmentLeftHand(@NotNull HaxeExpression expr) {
  final PsiElement parent = PsiTreeUtil.skipParentsOfType(expr, HaxeParenthesizedExpression.class);
  return parent instanceof HaxeAssignExpression &&
         PsiTreeUtil.isAncestor(((HaxeAssignExpression)parent).getExpressionList().get(0), expr, false);
}
 
Example 3
public static boolean isAccessedForReading(@NotNull HaxeExpression expr) {
  final PsiElement parent = PsiTreeUtil.skipParentsOfType(expr, HaxeParenthesizedExpression.class);
  return !(parent instanceof HaxeAssignExpression) ||
         !PsiTreeUtil.isAncestor(((HaxeAssignExpression)parent).getExpressionList().get(0), expr, false) ||
         getAssignOperationElementType((HaxeAssignExpression)parent) != HaxeTokenTypes.OASSIGN;
}