mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract compareTypesForUi
This commit is contained in:
@@ -1000,7 +1000,7 @@ open class RunConfigurable @JvmOverloads constructor(private val project: Projec
|
||||
private fun showAddPopup(showApplicableTypesOnly: Boolean) {
|
||||
val allTypes = ConfigurationType.CONFIGURATION_TYPE_EP.extensionList
|
||||
val configurationTypes: MutableList<ConfigurationType?> = getTypesToShow(showApplicableTypesOnly, allTypes).toMutableList()
|
||||
configurationTypes.sortWith(kotlin.Comparator { type1, type2 -> type1!!.displayName.compareTo(type2!!.displayName, ignoreCase = true) })
|
||||
configurationTypes.sortWith(kotlin.Comparator { type1, type2 -> compareTypesForUi(type1!!, type2!!) })
|
||||
val hiddenCount = allTypes.size - configurationTypes.size
|
||||
if (hiddenCount > 0) {
|
||||
configurationTypes.add(null)
|
||||
|
||||
+6
-1
@@ -3,6 +3,7 @@ package com.intellij.execution.impl
|
||||
|
||||
import com.intellij.execution.RunnerAndConfigurationSettings
|
||||
import com.intellij.execution.compound.CompoundRunConfiguration
|
||||
import com.intellij.execution.configurations.ConfigurationType
|
||||
import com.intellij.execution.configurations.RunConfiguration
|
||||
import com.intellij.openapi.util.text.NaturalComparator
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
@@ -94,7 +95,7 @@ internal class RunConfigurationListManagerHelper(val manager: RunManagerImpl) {
|
||||
val type1 = o1.type
|
||||
val type2 = o2.type
|
||||
if (type1 !== type2) {
|
||||
return@Comparator NaturalComparator.INSTANCE.compare(type1.displayName, type2.displayName)
|
||||
return@Comparator compareTypesForUi(type1, type2)
|
||||
}
|
||||
|
||||
val temporary1 = o1.isTemporary
|
||||
@@ -244,3 +245,7 @@ internal inline fun Collection<RunnerAndConfigurationSettings>.forEachManaged(ha
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun compareTypesForUi(type1: ConfigurationType, type2: ConfigurationType): Int {
|
||||
return NaturalComparator.INSTANCE.compare(type1.displayName, type2.displayName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user