public static ClassEditorField createClassField(Project project,
                                                  Computable<? extends Module> moduleSelector,
                                                  JavaCodeFragment.VisibilityChecker visibilityChecker,
                                                  @Nullable BrowseModuleValueActionListener<?> classBrowser) {
    if (project.isDefault()) {
      return new ClassEditorField();
    }
    PsiElement defaultPackage = JavaPsiFacade.getInstance(project).findPackage("");
    JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(project);
    JavaCodeFragment fragment = factory.createReferenceCodeFragment("", defaultPackage, true, true);
    fragment.setVisibilityChecker(visibilityChecker);
    Document document = PsiDocumentManager.getInstance(project).getDocument(fragment);

    ClassEditorField field = new ClassEditorField(document, project, JavaFileType.INSTANCE);
    if (classBrowser != null) {
      classBrowser.setTextAccessor(field);
    }
    BrowseModuleValueActionListener<?> browser = classBrowser != null ? classBrowser :
                                            new ClassBrowser.AppClassBrowser<EditorTextField>(project, moduleSelector) {
      @Override
      public String getText() {
        return field.getText();
      }

      @Override
      public void actionPerformed(ActionEvent e) {
        String text = showDialog();
        if (text != null) {
          field.setText(text);
        }
      }
    };
    field.addSettingsProvider(editor -> {
      ExtendableTextComponent.Extension extension =
        ExtendableTextComponent.Extension.create(AllIcons.General.InlineVariables, AllIcons.General.InlineVariablesHover,
                                                 ComponentWithBrowseButton.getTooltip(), () -> browser.actionPerformed(null));
      ExtendableEditorSupport.setupExtension(editor, field.getBackground(), extension);
    });
    new DumbAwareAction() {
      @Override
      public void actionPerformed(@NotNull AnActionEvent e) {
        browser.actionPerformed(null);
      }
    }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)), field);

    return field;
  }
public static ClassEditorField createClassField(Project project,
                                                  Computable<? extends Module> moduleSelector,
                                                  JavaCodeFragment.VisibilityChecker visibilityChecker,
                                                  @Nullable BrowseModuleValueActionListener<?> classBrowser)