public ReferenceEditorComboWithBrowseButton(
     final ActionListener browseActionListener,
     final String text,
     @NotNull final Project project,
     boolean toAcceptClasses,
     final JavaCodeFragment.VisibilityChecker visibilityChecker,
     final String recentsKey) {
   super(
       new EditorComboBox(
           createDocument(
               StringUtil.isEmpty(text) ? "" : text, project, toAcceptClasses, visibilityChecker),
           project,
           StdFileTypes.JAVA),
       browseActionListener);
   final List<String> recentEntries =
       RecentsManager.getInstance(project).getRecentEntries(recentsKey);
   if (recentEntries != null) {
     setHistory(ArrayUtil.toStringArray(recentEntries));
   }
   if (text != null && text.length() > 0) {
     prependItem(text);
   }
 }
  public void setData(
      PsiElement[] psiElements,
      String targetPackageName,
      final PsiDirectory initialTargetDirectory,
      boolean isTargetDirectoryFixed,
      boolean searchInComments,
      boolean searchForTextOccurences,
      String helpID) {
    myInitialTargetDirectory = initialTargetDirectory;
    myTargetDirectoryFixed = isTargetDirectoryFixed;
    if (targetPackageName.length() != 0) {
      myWithBrowseButtonReference.prependItem(targetPackageName);
      myClassPackageChooser.prependItem(targetPackageName);
    }

    String nameFromCallback =
        myMoveCallback instanceof MoveClassesOrPackagesCallback
            ? ((MoveClassesOrPackagesCallback) myMoveCallback).getElementsToMoveName()
            : null;
    if (nameFromCallback != null) {
      myNameLabel.setText(nameFromCallback);
    } else if (psiElements.length == 1) {
      PsiElement firstElement = psiElements[0];
      if (firstElement instanceof PsiClass) {
        LOG.assertTrue(!MoveClassesOrPackagesImpl.isClassInnerOrLocal((PsiClass) firstElement));
      } else {
        PsiElement parent = firstElement.getParent();
        LOG.assertTrue(parent != null);
      }
      myNameLabel.setText(
          RefactoringBundle.message(
              "move.single.class.or.package.name.label",
              UsageViewUtil.getType(firstElement),
              UsageViewUtil.getLongName(firstElement)));
    } else if (psiElements.length > 1) {
      myNameLabel.setText(
          psiElements[0] instanceof PsiClass
              ? RefactoringBundle.message("move.specified.classes")
              : RefactoringBundle.message("move.specified.packages"));
    }
    selectInitialCard();

    myCbSearchInComments.setSelected(searchInComments);
    myCbSearchTextOccurences.setSelected(searchForTextOccurences);

    ((DestinationFolderComboBox) myDestinationFolderCB)
        .setData(
            myProject,
            myInitialTargetDirectory,
            new Pass<String>() {
              @Override
              public void pass(String s) {
                setErrorText(s);
              }
            },
            myClassPackageChooser.getChildComponent());
    UIUtil.setEnabled(
        myTargetPanel,
        getSourceRoots().length > 0 && isMoveToPackage() && !isTargetDirectoryFixed,
        true);
    validateButtons();
    myHelpID = helpID;
  }
  public void setData(
      PsiElement[] psiElements,
      String targetPackageName,
      PsiDirectory initialTargetDirectory,
      boolean isTargetDirectoryFixed,
      boolean suggestToMoveToAnotherRoot,
      boolean searchInComments,
      boolean searchForTextOccurences,
      String helpID) {
    myTargetDirectoryFixed = isTargetDirectoryFixed;
    mySuggestToMoveToAnotherRoot = suggestToMoveToAnotherRoot;
    if (targetPackageName.length() != 0) {
      myWithBrowseButtonReference.prependItem(targetPackageName);
      myClassPackageChooser.prependItem(targetPackageName);
    }

    String nameFromCallback =
        myMoveCallback instanceof MoveClassesOrPackagesCallback
            ? ((MoveClassesOrPackagesCallback) myMoveCallback).getElementsToMoveName()
            : null;
    if (nameFromCallback != null) {
      myNameLabel.setText(nameFromCallback);
    } else if (psiElements.length == 1) {
      PsiElement firstElement = psiElements[0];
      if (firstElement instanceof PsiClass) {
        LOG.assertTrue(!MoveClassesOrPackagesImpl.isClassInnerOrLocal((PsiClass) firstElement));
      } else {
        PsiElement parent = firstElement.getParent();
        LOG.assertTrue(parent != null);
      }
      myNameLabel.setText(
          RefactoringBundle.message(
              "move.single.class.or.package.name.label",
              UsageViewUtil.getType(firstElement),
              UsageViewUtil.getLongName(firstElement)));
    } else if (psiElements.length > 1) {
      myNameLabel.setText(
          psiElements[0] instanceof PsiClass
              ? RefactoringBundle.message("move.specified.classes")
              : RefactoringBundle.message("move.specified.packages"));
    }
    selectInitialCard();

    myCbSearchInComments.setSelected(searchInComments);
    myCbSearchTextOccurences.setSelected(searchForTextOccurences);

    if (initialTargetDirectory != null
        && JavaMoveClassesOrPackagesHandler.packageHasMultipleDirectoriesInModule(
            myProject, initialTargetDirectory)) {
      final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
      final Set<VirtualFile> initialRoots = new HashSet<VirtualFile>();
      collectSourceRoots(psiElements, fileIndex, initialRoots);
      if (initialRoots.size() > 1) {
        initialTargetDirectory = null;
      }
    }
    ((DestinationFolderComboBox) myDestinationFolderCB)
        .setData(
            myProject,
            initialTargetDirectory,
            new Pass<String>() {
              @Override
              public void pass(String s) {
                setErrorText(s);
              }
            },
            myHavePackages
                ? myWithBrowseButtonReference.getChildComponent()
                : myClassPackageChooser.getChildComponent());
    UIUtil.setEnabled(
        myTargetPanel,
        !getSourceRoots().isEmpty() && isMoveToPackage() && !isTargetDirectoryFixed,
        true);
    validateButtons();
    myHelpID = helpID;
  }