Refactoring: HasActualMarker (use not-null declarations)
This commit is contained in:
@@ -27,8 +27,8 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
|||||||
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
|
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
|
||||||
import java.awt.event.MouseEvent
|
import java.awt.event.MouseEvent
|
||||||
|
|
||||||
fun getPlatformActualTooltip(declaration: KtDeclaration?): String? {
|
fun getPlatformActualTooltip(declaration: KtDeclaration): String? {
|
||||||
val actualDeclarations = declaration?.actualsForExpected() ?: return null
|
val actualDeclarations = declaration.actualsForExpected()
|
||||||
if (actualDeclarations.isEmpty()) return null
|
if (actualDeclarations.isEmpty()) return null
|
||||||
|
|
||||||
return actualDeclarations.asSequence()
|
return actualDeclarations.asSequence()
|
||||||
@@ -49,8 +49,8 @@ fun getPlatformActualTooltip(declaration: KtDeclaration?): String? {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun navigateToPlatformActual(e: MouseEvent?, declaration: KtDeclaration?) {
|
fun navigateToPlatformActual(e: MouseEvent?, declaration: KtDeclaration) {
|
||||||
val actualDeclarations = declaration?.actualsForExpected() ?: return
|
val actualDeclarations = declaration.actualsForExpected()
|
||||||
if (actualDeclarations.isEmpty()) return
|
if (actualDeclarations.isEmpty()) return
|
||||||
|
|
||||||
val renderer = object : DefaultPsiElementCellRenderer() {
|
val renderer = object : DefaultPsiElementCellRenderer() {
|
||||||
|
|||||||
@@ -200,10 +200,10 @@ private val PsiElement.markerDeclaration
|
|||||||
|
|
||||||
private val PLATFORM_ACTUAL = MarkerType(
|
private val PLATFORM_ACTUAL = MarkerType(
|
||||||
"PLATFORM_ACTUAL",
|
"PLATFORM_ACTUAL",
|
||||||
{ it?.let { getPlatformActualTooltip(it.markerDeclaration) } },
|
{ element -> element?.markerDeclaration?.let { getPlatformActualTooltip(it) } },
|
||||||
object : LineMarkerNavigator() {
|
object : LineMarkerNavigator() {
|
||||||
override fun browse(e: MouseEvent?, element: PsiElement?) {
|
override fun browse(e: MouseEvent?, element: PsiElement?) {
|
||||||
element?.let { navigateToPlatformActual(e, it.markerDeclaration) }
|
element?.markerDeclaration?.let { navigateToPlatformActual(e, it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user