in psi/src/com/intellij/r/psi/configuration/RInterpreterDetailsDialog.kt [51:94]
override fun createCenterPanel(): JComponent {
val decorator = ToolbarDecorator.createDecorator(interpreterList).apply {
disableUpDownActions()
setAddAction { button ->
val onAdded = { info: RInterpreterInfo ->
currentInterpreters.add(info)
refresh(true)
currentSelection = info
}
if (RInterpreterSettingsProvider.getProviders().size > 1) {
val popupPoint = button.preferredPopupPoint.screenPoint
RInterpreterDetailsStep.show(currentInterpreters, null, component, popupPoint, onAdded)
} else {
addInterpreter(onAdded)
}
}
setRemoveAction {
removeInterpreter()
}
if (RInterpreterSettingsProvider.getProviders().any { it.isEditingSupported() }) {
setEditAction {
val selection = currentSelection ?: return@setEditAction
val index = currentInterpreters.indexOf(selection).takeIf { it >= 0 } ?: return@setEditAction
RInterpreterSettingsProvider.getProviders()
.firstOrNull { it.canEditInterpreter(selection) }
?.showEditInterpreterDialog(selection, currentInterpreters) {
currentInterpreters[index] = it
refresh(true)
currentSelection = it
}
}
setEditActionUpdater {
val selection = currentSelection
selection != null && RInterpreterSettingsProvider.getProviders().any { provider -> provider.canEditInterpreter(selection) }
}
}
setPreferredSize(DialogUtil.calculatePreferredSize(DialogUtil.SizePreference.NARROW, DialogUtil.SizePreference.MODERATE))
}
refresh(false)
currentSelection = initialSelection
return decorator.createPanel().also { component = it }
}