boolean (PsiElement context) { if (context.getParent() != null && GroovyCompletionUtil.nearestLeftSibling(context.getParent()) instanceof GrIfStatement) { return true; } if (context.getParent() != null && GroovyCompletionUtil.nearestLeftSibling(context.getParent()) instanceof PsiErrorElement && GroovyCompletionUtil.nearestLeftSibling(GroovyCompletionUtil.nearestLeftSibling(context.getParent())) instanceof GrIfStatement) { return true; } if (context.getParent() != null && GroovyCompletionUtil.nearestLeftSibling(context) != null && GroovyCompletionUtil.nearestLeftSibling(context).getPrevSibling() instanceof GrIfStatement) { GrIfStatement statement = (GrIfStatement) GroovyCompletionUtil.nearestLeftSibling(context).getPrevSibling(); if (statement.getElseBranch() == null) { return true; } } if (context.getParent() != null && context.getParent().getParent() instanceof GrCommandArgumentList && context.getParent().getParent().getParent().getParent() instanceof GrIfStatement) { GrIfStatement statement = (GrIfStatement) context.getParent().getParent().getParent().getParent(); if (statement.getElseBranch() == null) { return true; } } return false; }