override fun createHierarchyTreeStructure()

in intellij/src/main/kotlin/motif/intellij/hierarchy/ScopeHierarchyBrowser.kt [132:155]


  override fun createHierarchyTreeStructure(
      typeName: String,
      psiElement: PsiElement,
  ): HierarchyTreeStructure? {
    if (psiElement == rootElement) {
      // Display entire graph hierarchy
      return ScopeHierarchyTreeStructure(
          myProject,
          graph,
          ScopeHierarchyRootDescriptor(myProject, graph, psiElement, status),
      )
    } else if (psiElement is PsiClass && isMotifScopeClass(psiElement)) {
      // Display the scope ancestors hierarchy
      val scopeType: PsiType = PsiElementFactory.SERVICE.getInstance(project).createType(psiElement)
      val type: IrType = IntelliJType(project, scopeType)
      graph.getScope(type)?.let { scope ->
        val clazz = (scope.clazz as IntelliJClass).psiClass
        val descriptor =
            ScopeHierarchyScopeAncestorDescriptor(myProject, graph, null, clazz, scope, true)
        return ScopeHierarchyTreeStructure(myProject, graph, descriptor)
      }
    }
    return null
  }