private static void consumeDependencyElement(PsiElement psiElement,
                                               Consumer<GrClosableBlock> closureNotationConsumer,
                                               Consumer<PsiElement> stringNotationConsumer) {
    final GrClosableBlock owner = PsiTreeUtil.getParentOfType(psiElement, GrClosableBlock.class);
    if (owner != null && owner.getParent() instanceof GrMethodCallExpression) {
      String invokedExpressionText = ((GrMethodCallExpression)owner.getParent()).getInvokedExpression().getText();
      if ("dependency".equals(invokedExpressionText)) {
        closureNotationConsumer.consume(owner);
      }
      if ("dependencies".equals(invokedExpressionText)) {
        GrMethodCall methodCall = PsiTreeUtil.getParentOfType(psiElement, GrMethodCall.class);
        if (methodCall != null && "dependency".equals(methodCall.getInvokedExpression().getText())) {
          stringNotationConsumer.consume(psiElement);
        }
      }
    }
  }
private static void consumeDependencyElement(PsiElement psiElement,
                                               Consumer<GrClosableBlock> closureNotationConsumer,
                                               Consumer<PsiElement> stringNotationConsumer)