diff --git a/src/main/kotlin/org/arend/navigation/Utils.kt b/src/main/kotlin/org/arend/navigation/Utils.kt index 021fad5d8..0a250edfc 100644 --- a/src/main/kotlin/org/arend/navigation/Utils.kt +++ b/src/main/kotlin/org/arend/navigation/Utils.kt @@ -2,10 +2,12 @@ package org.arend.navigation import com.intellij.ide.projectView.PresentationData import com.intellij.navigation.ItemPresentation +import com.intellij.openapi.application.ApplicationManager import com.intellij.psi.PsiElement import org.arend.psi.ArendFile import org.arend.psi.ext.ArendCompositeElement import org.arend.psi.ext.PsiReferable +import javax.swing.Icon fun getPresentation(psi: ArendCompositeElement): ItemPresentation { val location = run { @@ -14,7 +16,16 @@ fun getPresentation(psi: ArendCompositeElement): ItemPresentation { } val name = presentableName(psi) - return PresentationData(name, location, psi.getIcon(0), null) + var icon: Icon? = null + ApplicationManager.getApplication().run { + executeOnPooledThread { + runReadAction { + icon = psi.getIcon(0) + } + }.get() + } + + return PresentationData(name, location, icon, null) } fun getPresentationForStructure(psi: ArendCompositeElement): ItemPresentation = diff --git a/src/main/kotlin/org/arend/search/proof/ProofSearchUtils.kt b/src/main/kotlin/org/arend/search/proof/ProofSearchUtils.kt index 0e9430db2..2265e68cd 100644 --- a/src/main/kotlin/org/arend/search/proof/ProofSearchUtils.kt +++ b/src/main/kotlin/org/arend/search/proof/ProofSearchUtils.kt @@ -1,5 +1,6 @@ package org.arend.search.proof +import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.runReadAction import com.intellij.openapi.components.service import com.intellij.openapi.project.DumbService @@ -258,7 +259,18 @@ class ProofSearchUISettings(private val project: Project) { } fun getCompleteModuleLocation(def: ReferableBase<*>): String? { - val file = def.location?.toString() ?: return null + var file: String? = null + ApplicationManager.getApplication().run { + executeOnPooledThread { + runReadAction { + file = def.location?.toString() + } + }.get() + } + if (file == null) { + return null + } + val module = def.parentsOfType(false).toList().reversed().drop(1).map { it.name } return (listOf(file) + module).joinToString(".") } \ No newline at end of file