private void importOrQualify(Document document, PsiFile file, PsiMethod method, int startOffset) {
    if (!needImportOrQualify()) {
      return;
    }
    if (willBeImported()) {
      if (method.isConstructor()) {
        final PsiNewExpression newExpression = PsiTreeUtil.findElementOfClassAtOffset(file, startOffset, PsiNewExpression.class, false);
        if (newExpression != null) {
          PsiJavaCodeReferenceElement ref = newExpression.getClassReference();
          if (ref != null && myContainingClass != null && !ref.isReferenceTo(myContainingClass)) {
            ref.bindToElement(myContainingClass);
            return;
          }
        }
      }
      else {
        final PsiReferenceExpression ref = PsiTreeUtil.findElementOfClassAtOffset(file, startOffset, PsiReferenceExpression.class, false);
        if (ref != null && myContainingClass != null && !ref.isReferenceTo(method)) {
          ref.bindToElementViaStaticImport(myContainingClass);
        }
        return;
      }
    }

    qualifyMethodCall(file, startOffset, document);
  }
private void importOrQualify(Document document, PsiFile file, PsiMethod method, int startOffset)