@Override
 protected SearchScope getReferencesSearchScope(VirtualFile file) {
   PsiFile currentFile =
       PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
   return currentFile != null
       ? new LocalSearchScope(currentFile)
       : ProjectScope.getProjectScope(myProject);
 }
  private void createUIComponents() {
    myMainPanel = new JPanel();

    myWithBrowseButtonReference = createPackageChooser();
    myClassPackageChooser = createPackageChooser();

    GlobalSearchScope scope =
        JavaProjectRootsUtil.getScopeWithoutGeneratedSources(
            ProjectScope.getProjectScope(myProject), myProject);
    myInnerClassChooser = new ClassNameReferenceEditor(myProject, null, scope);
    myInnerClassChooser.addDocumentListener(
        new DocumentAdapter() {
          public void documentChanged(DocumentEvent e) {
            validateButtons();
          }
        });

    // override CardLayout sizing behavior
    myCardPanel =
        new JPanel() {
          public Dimension getMinimumSize() {
            return myHavePackages
                ? myMovePackagePanel.getMinimumSize()
                : myMoveClassPanel.getMinimumSize();
          }

          public Dimension getPreferredSize() {
            return myHavePackages
                ? myMovePackagePanel.getPreferredSize()
                : myMoveClassPanel.getPreferredSize();
          }
        };

    myDestinationFolderCB =
        new DestinationFolderComboBox() {
          @Override
          public String getTargetPackage() {
            return MoveClassesOrPackagesDialog.this.getTargetPackage();
          }
        };
  }
 @Nullable
 private PsiClass findTargetClass() {
   String name = myInnerClassChooser.getText().trim();
   return JavaPsiFacade.getInstance(myManager.getProject())
       .findClass(name, ProjectScope.getProjectScope(myProject));
 }