override fun getLegend()

in intellij/src/main/kotlin/motif/intellij/hierarchy/descriptor/ScopeHierarchySinkDescriptor.kt [83:124]


  override fun getLegend(): String? {
    val sb: StringBuilder = StringBuilder()
    when (sink) {
      is FactoryMethodSink -> {
        val method: IrMethod = sink.parameter.method
        if (method.isConstructor) {
          sb.append(
              "Object <b>" +
                  method.name +
                  "</b> used in Scope <b>" +
                  sink.scope.simpleName +
                  "</b>" +
                  " has a dependency on type <b>" +
                  sink.type.simpleName +
                  "</b>.",
          )
        }
        graph.getProviders(sink).forEach { source ->
          when (source) {
            is FactoryMethodSource -> {
              sb.append(
                  "This dependency is provided by Scope <b>" +
                      source.scope.simpleName +
                      "</b>" +
                      ", via Motif Factory method <b>" +
                      source.factoryMethod.name +
                      "()</b>.",
              )
            }
            else -> {
              // TODO : Handle all types
            }
          }
        }
        return sb.toString()
      }
      is AccessMethodSink -> {
        // TODO : Handle all types
      }
    }
    return null
  }