protected static boolean canPutAtElement(@NotNull final VirtualFile file,
                                           final int line,
                                           @NotNull Project project,
                                           @NotNull BiFunction<? super PsiElement, ? super Document, Boolean> processor) {
    PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
    // JSPX supports jvm debugging, but not in XHTML files
    if (psiFile == null || psiFile.getViewProvider().getFileType() == StdFileTypes.XHTML) {
      return false;
    }

    if (!JavaClassFileType.INSTANCE.equals(psiFile.getFileType()) && !DebuggerUtils.isBreakpointAware(psiFile)) {
      return false;
    }

    Document document = FileDocumentManager.getInstance().getDocument(file);
    if (document != null) {
      Ref<Boolean> res = Ref.create(false);
      XDebuggerUtil.getInstance().iterateLine(project, document, line, element -> {
        // avoid comments
        if ((element instanceof PsiWhiteSpace)
            || (PsiTreeUtil.getNonStrictParentOfType(element, PsiComment.class, PsiImportStatementBase.class, PsiPackageStatement.class) != null)) {
          return true;
        }
        PsiElement parent = element;
        while (element != null) {
          // skip modifiers
          if (element instanceof PsiModifierList) {
            element = element.getParent();
            continue;
          }

          final int offset = element.getTextOffset();
          if (!DocumentUtil.isValidOffset(offset, document) || document.getLineNumber(offset) != line) {
            break;
          }
          parent = element;
          element = element.getParent();
        }

        if (processor.apply(parent, document)) {
          res.set(true);
          return false;
        }
        return true;
      });
      return res.get();
    }
    return false;
  }
protected static boolean canPutAtElement(@NotNull final VirtualFile file,
                                           final int line,
                                           @NotNull Project project,
                                           @NotNull BiFunction<? super PsiElement, ? super Document, Boolean> processor)