private static void collapseIfPossible(@NotNull EditorTextField editorTextField,
                                         @NotNull ProjectSystemId systemId,
                                         @NotNull Project project) {
    Editor editor = editorTextField.getEditor();
    if (editor != null) {
      String rawText = editor.getDocument().getText();
      if (StringUtil.isEmpty(rawText)) return;
      if (EMPTY_PARENT.equals(rawText)) {
        editorTextField.setEnabled(false);
        return;
      }
      final Collection<ExternalProjectInfo> projectsData =
        ProjectDataManager.getInstance().getExternalProjectsData(project, systemId);
      for (ExternalProjectInfo projectInfo : projectsData) {
        if (projectInfo.getExternalProjectStructure() != null && projectInfo.getExternalProjectPath().equals(rawText)) {
          editorTextField.setEnabled(true);
          ExternalProjectPathField.collapse(
            editorTextField.getEditor(), projectInfo.getExternalProjectStructure().getData().getExternalName());
          return;
        }
      }
    }
  }
private static void collapseIfPossible(@NotNull EditorTextField editorTextField,
                                         @NotNull ProjectSystemId systemId,
                                         @NotNull Project project)