private void doAddImport(@NotNull PsiReference ref, @NotNull PsiClass targetClass) {
    try {
      bindReference(ref, targetClass);
      if (CodeInsightWorkspaceSettings.getInstance(myProject).isOptimizeImportsOnTheFly()) {
        Document document = myEditor.getDocument();
        PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
        new OptimizeImportsProcessor(myProject, psiFile).runWithoutProgress();
      }
    }
    catch (IncorrectOperationException e) {
      LOG.error(e);
    }
    myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
  }
private void doAddImport(@NotNull PsiReference ref, @NotNull PsiClass targetClass)