diff --git a/platform/core-api/src/com/intellij/navigation/NavigationTarget.java b/platform/core-api/src/com/intellij/navigation/NavigationTarget.java index 71c0dd9c9283..d6f782f97372 100644 --- a/platform/core-api/src/com/intellij/navigation/NavigationTarget.java +++ b/platform/core-api/src/com/intellij/navigation/NavigationTarget.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.navigation; import com.intellij.model.Pointer; @@ -32,7 +32,9 @@ public interface NavigationTarget { * * @return presentation to render this target in navigation popup */ - @NotNull TargetPresentation getTargetPresentation(); + @RequiresReadLock + @RequiresBackgroundThread + @NotNull TargetPresentation presentation(); /** * This method is called once before the actual navigation. diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/PsiElementNavigationTarget.kt b/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/PsiElementNavigationTarget.kt index 1cbec960ca6c..c720b4c66ac9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/PsiElementNavigationTarget.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/PsiElementNavigationTarget.kt @@ -15,7 +15,7 @@ internal class PsiElementNavigationTarget(private val myElement: PsiElement) : N myElement.createSmartPointer(), ::PsiElementNavigationTarget ) - override fun getTargetPresentation(): TargetPresentation = targetPresentation(myElement) + override fun presentation(): TargetPresentation = targetPresentation(myElement) override fun navigationRequest(): NavigationRequest? = myElement.psiNavigatable()?.navigationRequest() diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/PsiFileNavigationTarget.kt b/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/PsiFileNavigationTarget.kt index f322da841f9c..76d86c6bd9dd 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/PsiFileNavigationTarget.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/PsiFileNavigationTarget.kt @@ -19,7 +19,7 @@ internal class PsiFileNavigationTarget( psiFile.createSmartPointer(), ::PsiFileNavigationTarget ) - override fun getTargetPresentation(): TargetPresentation { + override fun presentation(): TargetPresentation { val project = psiFile.project var builder = TargetPresentation diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/gtd.kt b/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/gtd.kt index 24355b6f64a4..b51c69f042f0 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/gtd.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/gtd.kt @@ -86,7 +86,7 @@ private class TargetGTDActionData(private val project: Project, private val targ } else -> { val targets = result.map { (navigationTarget, navigationProvider) -> - LazyTargetWithPresentation(navigationTarget::navigationRequest, navigationTarget.targetPresentation, navigationProvider) + LazyTargetWithPresentation(navigationTarget::navigationRequest, navigationTarget.presentation(), navigationProvider) } MultipleTargets(targets) } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/gttd.kt b/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/gttd.kt index 502d1530e52a..c8e52d692fcc 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/gttd.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/impl/gttd.kt @@ -156,7 +156,7 @@ internal fun result(navigationTargets: Collection): Navigation SingleTarget(request, null) } else -> MultipleTargets(navigationTargets.map { navigationTarget -> - LazyTargetWithPresentation(navigationTarget::navigationRequest, navigationTarget.targetPresentation, null) + LazyTargetWithPresentation(navigationTarget::navigationRequest, navigationTarget.presentation(), null) }) } } diff --git a/platform/lang-impl/src/com/intellij/find/actions/SearchTarget2UsageTarget.kt b/platform/lang-impl/src/com/intellij/find/actions/SearchTarget2UsageTarget.kt index 1f383b176898..a155feb84a85 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/SearchTarget2UsageTarget.kt +++ b/platform/lang-impl/src/com/intellij/find/actions/SearchTarget2UsageTarget.kt @@ -41,7 +41,7 @@ class SearchTarget2UsageTarget( } private fun getItemPresentation(target: SearchTarget): ItemPresentation { - val presentation = target.presentation + val presentation = target.presentation() return object : ItemPresentation { override fun getIcon(unused: Boolean): Icon? = presentation.icon override fun getPresentableText(): String = presentation.presentableText diff --git a/platform/lang-impl/src/com/intellij/find/actions/findUsages.kt b/platform/lang-impl/src/com/intellij/find/actions/findUsages.kt index 1a4f50f7d53c..9c477b3c2ac6 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/findUsages.kt +++ b/platform/lang-impl/src/com/intellij/find/actions/findUsages.kt @@ -75,7 +75,7 @@ private fun canReuseTab(project: Project): Boolean { } } -internal val SearchTarget.displayString: String get() = presentation.presentableText +internal val SearchTarget.displayString: String get() = presentation().presentableText @Nls(capitalization = Nls.Capitalization.Title) internal fun UsageHandler.getSearchString(allOptions: AllSearchOptions): String { diff --git a/platform/lang-impl/src/com/intellij/find/actions/resolver.kt b/platform/lang-impl/src/com/intellij/find/actions/resolver.kt index bd2d235b0f86..bae66685aee5 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/resolver.kt +++ b/platform/lang-impl/src/com/intellij/find/actions/resolver.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. @file:ApiStatus.Internal package com.intellij.find.actions @@ -63,7 +63,7 @@ internal sealed class TargetVariant { } internal class SearchTargetVariant(private val target: SearchTarget) : TargetVariant() { - override val presentation: TargetPresentation get() = target.presentation + override val presentation: TargetPresentation get() = target.presentation() override fun handle(handler: UsageVariantHandler): Unit = handler.handleTarget(target) } diff --git a/platform/lang-impl/src/com/intellij/find/usages/api/SearchTarget.kt b/platform/lang-impl/src/com/intellij/find/usages/api/SearchTarget.kt index 4220630753a0..032913860ff4 100644 --- a/platform/lang-impl/src/com/intellij/find/usages/api/SearchTarget.kt +++ b/platform/lang-impl/src/com/intellij/find/usages/api/SearchTarget.kt @@ -6,6 +6,8 @@ import com.intellij.model.search.SearchRequest import com.intellij.navigation.TargetPresentation import com.intellij.psi.search.LocalSearchScope import com.intellij.psi.search.SearchScope +import com.intellij.util.concurrency.annotations.RequiresBackgroundThread +import com.intellij.util.concurrency.annotations.RequiresReadLock /** * Represents the search implementation (the usage handler and the text search strings) @@ -34,7 +36,9 @@ interface SearchTarget { * or in the Usage View (only [icon][TargetPresentation.icon] * and [presentable text][TargetPresentation.presentableText] are used) */ - val presentation: TargetPresentation + @RequiresReadLock + @RequiresBackgroundThread + fun presentation(): TargetPresentation /** * @see UsageHandler.createEmptyUsageHandler diff --git a/platform/lang-impl/src/com/intellij/lang/documentation/DocumentationTarget.kt b/platform/lang-impl/src/com/intellij/lang/documentation/DocumentationTarget.kt index 8b2a21d13733..2f73251d3e5a 100644 --- a/platform/lang-impl/src/com/intellij/lang/documentation/DocumentationTarget.kt +++ b/platform/lang-impl/src/com/intellij/lang/documentation/DocumentationTarget.kt @@ -35,10 +35,9 @@ interface DocumentationTarget { * Returned presentation is used to render the tab name and icon in the tool window, * and to render location info under the documentation in the popup. */ - val presentation: TargetPresentation - @RequiresReadLock - @RequiresBackgroundThread - get + @RequiresReadLock + @RequiresBackgroundThread + fun presentation(): TargetPresentation @Suppress("DEPRECATION") // deprecated JvmDefault @JvmDefault diff --git a/platform/lang-impl/src/com/intellij/lang/documentation/impl/EmptyDocumentationTarget.kt b/platform/lang-impl/src/com/intellij/lang/documentation/impl/EmptyDocumentationTarget.kt index d9c945c551b4..57dda1503fcc 100644 --- a/platform/lang-impl/src/com/intellij/lang/documentation/impl/EmptyDocumentationTarget.kt +++ b/platform/lang-impl/src/com/intellij/lang/documentation/impl/EmptyDocumentationTarget.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.lang.documentation.impl import com.intellij.lang.documentation.DocumentationResult @@ -12,9 +12,9 @@ internal object EmptyDocumentationTarget : DocumentationTarget, Pointer internal fun DocumentationTarget.documentationRequest(): DocumentationRequest { ApplicationManager.getApplication().assertReadAccessAllowed() - return DocumentationRequest(createPointer(), presentation) + return DocumentationRequest(createPointer(), presentation()) } @Internal diff --git a/platform/lang-impl/src/com/intellij/lang/documentation/psi/PsiElementDocumentationTarget.kt b/platform/lang-impl/src/com/intellij/lang/documentation/psi/PsiElementDocumentationTarget.kt index fe19a8a69773..0adbf85b384e 100644 --- a/platform/lang-impl/src/com/intellij/lang/documentation/psi/PsiElementDocumentationTarget.kt +++ b/platform/lang-impl/src/com/intellij/lang/documentation/psi/PsiElementDocumentationTarget.kt @@ -62,7 +62,7 @@ class PsiElementDocumentationTarget private constructor( override fun createPointer(): Pointer = pointer - override val presentation: TargetPresentation get() = targetPresentation(targetElement) + override fun presentation(): TargetPresentation = targetPresentation(targetElement) override val navigatable: Navigatable? get() = targetElement as? Navigatable diff --git a/platform/lang-impl/src/com/intellij/lang/documentation/psi/PsiExternalDocumentationHandlerTarget.java b/platform/lang-impl/src/com/intellij/lang/documentation/psi/PsiExternalDocumentationHandlerTarget.java index db9b4bf89156..cbcc9268e512 100644 --- a/platform/lang-impl/src/com/intellij/lang/documentation/psi/PsiExternalDocumentationHandlerTarget.java +++ b/platform/lang-impl/src/com/intellij/lang/documentation/psi/PsiExternalDocumentationHandlerTarget.java @@ -50,7 +50,7 @@ final class PsiExternalDocumentationHandlerTarget implements DocumentationTarget @NotNull @Override - public TargetPresentation getPresentation() { + public TargetPresentation presentation() { return UtilKt.targetPresentation(myTargetElement); } diff --git a/platform/lang-impl/src/com/intellij/openapi/paths/UrlReference.kt b/platform/lang-impl/src/com/intellij/openapi/paths/UrlReference.kt index df8fa4be7eef..6bade4a947f6 100644 --- a/platform/lang-impl/src/com/intellij/openapi/paths/UrlReference.kt +++ b/platform/lang-impl/src/com/intellij/openapi/paths/UrlReference.kt @@ -50,7 +50,7 @@ private class UrlSymbol( override fun getNavigationTargets(project: Project): Collection = listOf(this) - override fun getTargetPresentation(): TargetPresentation = TODO( + override fun presentation(): TargetPresentation = TODO( "In all known cases the symbol doesn't appear in the disambiguation popup, " + "because this symbol is usually alone, so no popup required. Implement this method when needed." ) diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/api/RenameTarget.kt b/platform/lang-impl/src/com/intellij/refactoring/rename/api/RenameTarget.kt index 7f5e965230d4..32be47aa72e9 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/api/RenameTarget.kt +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/api/RenameTarget.kt @@ -1,9 +1,11 @@ -// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.rename.api import com.intellij.model.Pointer import com.intellij.navigation.TargetPresentation import com.intellij.psi.search.SearchScope +import com.intellij.util.concurrency.annotations.RequiresBackgroundThread +import com.intellij.util.concurrency.annotations.RequiresReadLock /** * The thing being renamed. @@ -41,7 +43,9 @@ interface RenameTarget { * and [presentable text][TargetPresentation.presentableText] are used) * @see com.intellij.find.usages.api.SearchTarget.presentation */ - val presentation: TargetPresentation + @RequiresReadLock + @RequiresBackgroundThread + fun presentation(): TargetPresentation /** * The single [RenameTarget] might be referenced differently in different contexts, diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/impl/RenameTarget2UsageTarget.kt b/platform/lang-impl/src/com/intellij/refactoring/rename/impl/RenameTarget2UsageTarget.kt index e5493c20358e..05531cb5d167 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/impl/RenameTarget2UsageTarget.kt +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/impl/RenameTarget2UsageTarget.kt @@ -3,6 +3,7 @@ package com.intellij.refactoring.rename.impl import com.intellij.model.Pointer import com.intellij.navigation.ItemPresentation +import com.intellij.navigation.TargetPresentation import com.intellij.openapi.application.ApplicationManager import com.intellij.refactoring.RefactoringBundle import com.intellij.refactoring.rename.api.RenameTarget @@ -34,13 +35,15 @@ internal class RenameTarget2UsageTarget( private fun computeItemPresentation(target: RenameTarget): ItemPresentation = object : ItemPresentation { - override fun getIcon(unused: Boolean): Icon? = target.presentation.icon + private val presentation: TargetPresentation = target.presentation() + + override fun getIcon(unused: Boolean): Icon? = presentation.icon override fun getPresentableText(): String = RefactoringBundle.message( - "rename.target.text.0.1", target.presentation.presentableText, newName + "rename.target.text.0.1", presentation.presentableText, newName ) - override fun getLocationString(): String? = target.presentation.locationText + override fun getLocationString(): String? = presentation.locationText } diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/impl/RenameTargetRenamer.kt b/platform/lang-impl/src/com/intellij/refactoring/rename/impl/RenameTargetRenamer.kt index 1c8237b34409..0f6deb347ec6 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/impl/RenameTargetRenamer.kt +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/impl/RenameTargetRenamer.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.rename.impl import com.intellij.openapi.editor.Editor @@ -13,7 +13,7 @@ class RenameTargetRenamer( private val target: RenameTarget ) : Renamer { - override fun getPresentableText(): String = target.presentation.presentableText + override fun getPresentableText(): String = target.presentation().presentableText override fun performRename(): Unit = startRename(project, editor, target) } diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/impl/rename.kt b/platform/lang-impl/src/com/intellij/refactoring/rename/impl/rename.kt index 0f2c3f7cb5e9..2f3b1724b324 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/impl/rename.kt +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/impl/rename.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.rename.impl import com.intellij.codeInsight.actions.VcsFacade @@ -52,7 +52,7 @@ internal fun showDialogAndRename(project: Project, target: RenameTarget, targetN targetName = targetName, renameOptions = renameOptions(project, target) ) - val dialog = RenameDialog(project, target.presentation.presentableText, initOptions) + val dialog = RenameDialog(project, target.presentation().presentableText, initOptions) if (!dialog.showAndGet()) { // cancelled return diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/inplaceRename.kt b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/inplaceRename.kt index d1d64a75f35e..963da71d4cfc 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/inplaceRename.kt +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/inplaceRename.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.rename.inplace import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer @@ -94,7 +94,7 @@ internal fun inplaceRename(project: Project, editor: Editor, target: RenameTarge var textOptions: TextOptions = getTextOptions(target) val data = prepareTemplate(hostDocument, hostFile, originUsage, psiUsages, textOptionsRef = { textOptions }) ?: return false - val commandName: String = RefactoringBundle.message("rename.command.name.0.in.place.template", target.presentation.presentableText) + val commandName: String = RefactoringBundle.message("rename.command.name.0.in.place.template", target.presentation().presentableText) val startMarkAction: StartMarkAction = try { InplaceRefactoring.startMarkAction(project, hostEditor, commandName) } diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/ui/renameUi.kt b/platform/lang-impl/src/com/intellij/refactoring/rename/ui/renameUi.kt index 66b790424731..4f097024c8df 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/ui/renameUi.kt +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/ui/renameUi.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.rename.ui import com.intellij.model.Pointer @@ -62,7 +62,7 @@ private class CoroutineBackgroundTask( private suspend fun Pointer.presentableText(): String? { return readAction { - dereference()?.presentation?.presentableText + dereference()?.presentation()?.presentableText } } diff --git a/platform/webSymbols/src/com/intellij/webSymbols/documentation/WebSymbolDocumentationTarget.kt b/platform/webSymbols/src/com/intellij/webSymbols/documentation/WebSymbolDocumentationTarget.kt index efe9550c28bf..4f7319553590 100644 --- a/platform/webSymbols/src/com/intellij/webSymbols/documentation/WebSymbolDocumentationTarget.kt +++ b/platform/webSymbols/src/com/intellij/webSymbols/documentation/WebSymbolDocumentationTarget.kt @@ -16,10 +16,11 @@ interface WebSymbolDocumentationTarget : DocumentationTarget { val symbol: WebSymbol @JvmDefault - override val presentation: TargetPresentation - get() = TargetPresentation.builder(symbol.name) + override fun presentation(): TargetPresentation { + return TargetPresentation.builder(symbol.name) .icon(symbol.icon) .presentation() + } @JvmDefault override fun computeDocumentation(): DocumentationResult? = diff --git a/platform/webSymbols/src/com/intellij/webSymbols/refactoring/WebSymbolRenameTarget.kt b/platform/webSymbols/src/com/intellij/webSymbols/refactoring/WebSymbolRenameTarget.kt index d61a7fb86d2c..3935a9686f47 100644 --- a/platform/webSymbols/src/com/intellij/webSymbols/refactoring/WebSymbolRenameTarget.kt +++ b/platform/webSymbols/src/com/intellij/webSymbols/refactoring/WebSymbolRenameTarget.kt @@ -1,3 +1,4 @@ +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.webSymbols.refactoring import com.intellij.model.Pointer @@ -17,7 +18,7 @@ open class WebSymbolRenameTarget(val symbol: WebSymbol) : RenameTarget { override val targetName: String get() = symbol.matchedName - override val presentation: TargetPresentation - get() = symbol.presentation - + override fun presentation(): TargetPresentation { + return symbol.presentation + } } \ No newline at end of file diff --git a/platform/webSymbols/src/com/intellij/webSymbols/search/impl/WebSymbolSearchTargetImpl.kt b/platform/webSymbols/src/com/intellij/webSymbols/search/impl/WebSymbolSearchTargetImpl.kt index d5ec466f5d1d..61025fc2db2e 100644 --- a/platform/webSymbols/src/com/intellij/webSymbols/search/impl/WebSymbolSearchTargetImpl.kt +++ b/platform/webSymbols/src/com/intellij/webSymbols/search/impl/WebSymbolSearchTargetImpl.kt @@ -17,11 +17,12 @@ class WebSymbolSearchTargetImpl(override val symbol: WebSymbol) : WebSymbolSearc } } - override val presentation: TargetPresentation - get() = symbol.presentation + override fun presentation(): TargetPresentation { + return symbol.presentation + } override val usageHandler: UsageHandler - get() = UsageHandler.createEmptyUsageHandler(presentation.presentableText) + get() = UsageHandler.createEmptyUsageHandler(presentation().presentableText) override fun equals(other: Any?): Boolean = other === this || diff --git a/platform/webSymbols/src/com/intellij/webSymbols/utils/WebSymbolUtils.kt b/platform/webSymbols/src/com/intellij/webSymbols/utils/WebSymbolUtils.kt index d65e60190b65..6bd764f9ece4 100644 --- a/platform/webSymbols/src/com/intellij/webSymbols/utils/WebSymbolUtils.kt +++ b/platform/webSymbols/src/com/intellij/webSymbols/utils/WebSymbolUtils.kt @@ -17,8 +17,8 @@ import com.intellij.psi.util.PsiModificationTracker import com.intellij.util.containers.Stack import com.intellij.webSymbols.* import com.intellij.webSymbols.html.WebSymbolHtmlAttributeValue -import com.intellij.webSymbols.references.WebSymbolReferenceProblem.ProblemKind import com.intellij.webSymbols.impl.sortSymbolsByPriority +import com.intellij.webSymbols.references.WebSymbolReferenceProblem.ProblemKind import com.intellij.webSymbols.registry.WebSymbolMatch import com.intellij.webSymbols.registry.WebSymbolNamesProvider import com.intellij.webSymbols.registry.WebSymbolsNameMatchQueryParams @@ -194,7 +194,7 @@ fun Sequence.merge(): WebSymbolHtmlAttributeValue? fun NavigationTarget.createPsiRangeNavigationItem(element: PsiElement, offsetWithinElement: Int): Navigatable { val vf = element.containingFile.virtualFile ?: return EmptyNavigatable.INSTANCE - val targetPresentation = this.targetPresentation + val targetPresentation = this.presentation() val descriptor = OpenFileDescriptor( element.project, vf, element.textRange.startOffset + offsetWithinElement) diff --git a/plugins/editorconfig/test/org/editorconfig/language/documentation/EditorConfigDocumentationTest.kt b/plugins/editorconfig/test/org/editorconfig/language/documentation/EditorConfigDocumentationTest.kt index a4478c1f8424..c3a86f71949e 100644 --- a/plugins/editorconfig/test/org/editorconfig/language/documentation/EditorConfigDocumentationTest.kt +++ b/plugins/editorconfig/test/org/editorconfig/language/documentation/EditorConfigDocumentationTest.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.editorconfig.language.documentation import com.intellij.codeInsight.documentation.DocumentationManager @@ -22,7 +22,7 @@ class EditorConfigDocumentationTest : BasePlatformTestCase() { val targets = IdeDocumentationTargetProvider.getInstance(project).documentationTargets(myFixture.editor, myFixture.file, offset) UsefulTestCase.assertSize(1, targets) val target = targets[0] - val text = target.presentation.presentableText + val text = target.presentation().presentableText assertEquals("indent_size", text) val doc = EditorConfigDocumentationProvider().generateDoc(element, originalElement) val expected = "number of whitespace symbols used for indents" diff --git a/plugins/gradle/java/src/service/resolve/GradleProjectSymbol.kt b/plugins/gradle/java/src/service/resolve/GradleProjectSymbol.kt index 47b325ce464e..d4d126123582 100644 --- a/plugins/gradle/java/src/service/resolve/GradleProjectSymbol.kt +++ b/plugins/gradle/java/src/service/resolve/GradleProjectSymbol.kt @@ -50,14 +50,13 @@ abstract class GradleProjectSymbol( override val usageHandler: UsageHandler get() = UsageHandler.createEmptyUsageHandler(projectName) - override val presentation: TargetPresentation - get() { - val presentation = symbolPresentation - return TargetPresentation - .builder(presentation.longDescription) - .icon(presentation.icon) - .presentation() - } + override fun presentation(): TargetPresentation { + val presentation = symbolPresentation + return TargetPresentation + .builder(presentation.longDescription) + .icon(presentation.icon) + .presentation() + } override fun equals(other: Any?): Boolean { if (this === other) return true diff --git a/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/quickDoc/KotlinDocumentationTarget.kt b/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/quickDoc/KotlinDocumentationTarget.kt index 0c8f4d7afa13..9e197bf9bcfc 100644 --- a/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/quickDoc/KotlinDocumentationTarget.kt +++ b/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/quickDoc/KotlinDocumentationTarget.kt @@ -47,7 +47,9 @@ internal class KotlinDocumentationTarget(val element: PsiElement, private val or } } - override val presentation: TargetPresentation get() = targetPresentation(element) + override fun presentation(): TargetPresentation { + return targetPresentation(element) + } override fun computeDocumentationHint(): String? { return computeLocalDocumentation(element, originalElement, true) diff --git a/plugins/kotlin/refactorings/rename.k2/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinNamedDeclarationRenameUsage.kt b/plugins/kotlin/refactorings/rename.k2/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinNamedDeclarationRenameUsage.kt index 0fdd93b296a1..25db9224a624 100644 --- a/plugins/kotlin/refactorings/rename.k2/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinNamedDeclarationRenameUsage.kt +++ b/plugins/kotlin/refactorings/rename.k2/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinNamedDeclarationRenameUsage.kt @@ -24,8 +24,9 @@ internal class KotlinNamedDeclarationRenameUsage private constructor( override val targetName: String get() = element.name ?: reportMissingName() - override val presentation: TargetPresentation - get() = TargetPresentation.builder(targetName).presentation() + override fun presentation(): TargetPresentation { + return TargetPresentation.builder(targetName).presentation() + } override val file: PsiFile get() = element.containingFile diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownLinkDestination.kt b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownLinkDestination.kt index 3c05bd18ef83..647c3f4cb1da 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownLinkDestination.kt +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownLinkDestination.kt @@ -52,7 +52,7 @@ class MarkdownLinkDestination(node: ASTNode): MarkdownLinkDestinationImpl(node), return Pointer.hardPointer(this) } - override fun getTargetPresentation(): TargetPresentation { + override fun presentation(): TargetPresentation { return TargetPresentation.builder(text) .icon(MarkdownIcons.EditorActions.Link) .presentation() diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/model/psi/headers/HeaderSymbol.kt b/plugins/markdown/core/src/org/intellij/plugins/markdown/model/psi/headers/HeaderSymbol.kt index 468bebac8e1e..81dc8d95961e 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/model/psi/headers/HeaderSymbol.kt +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/model/psi/headers/HeaderSymbol.kt @@ -55,13 +55,10 @@ data class HeaderSymbol( override val maximalSearchScope: SearchScope get() = GlobalSearchScope.allScope(file.project) - override val presentation: TargetPresentation - get() = targetPresentation - override val usageHandler: UsageHandler get() = UsageHandler.createEmptyUsageHandler(anchorText) - override fun getTargetPresentation(): TargetPresentation { + override fun presentation(): TargetPresentation { val virtualFile = file.containingFile.virtualFile val builder = TargetPresentation.builder(text).icon(MarkdownIcons.EditorActions.Header_level_up) val presentation = when (virtualFile) { diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/model/psi/labels/LinkLabelSymbol.kt b/plugins/markdown/core/src/org/intellij/plugins/markdown/model/psi/labels/LinkLabelSymbol.kt index 334da7880a6f..8b6f8c6b6aae 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/model/psi/labels/LinkLabelSymbol.kt +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/model/psi/labels/LinkLabelSymbol.kt @@ -47,16 +47,13 @@ data class LinkLabelSymbol( override val maximalSearchScope: SearchScope? get() = GlobalSearchScope.fileScope(file) - override val presentation: TargetPresentation - get() = targetPresentation - override val usageHandler: UsageHandler get() = UsageHandler.createEmptyUsageHandler(text) override val searchText: String get() = text - override fun getTargetPresentation(): TargetPresentation { + override fun presentation(): TargetPresentation { return TargetPresentation.builder(text).icon(MarkdownIcons.EditorActions.Link).presentation() }