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

The following examples show how to use com.intellij.psi.util.PsiTreeUtil#skipParentsOfType() . 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
Source File: EnterInStringLiteralHandler.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
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
Source File: HaxeExpressionUtil.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
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
Source File: HaxeExpressionUtil.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
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;
}