diff --git a/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties b/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties index 5703763829e..62f8a510629 100644 --- a/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties +++ b/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties @@ -78,28 +78,6 @@ unwrap.expression = Unwrap ''{0}'' remove.else = Remove else in ''{0}'' unwrap.else = Unwrap else in ''{0}'' -find.usages.type.callable.reference = Callable reference -find.usages.type.type.constraint = Type constraint -find.usages.type.value.parameter.type = Parameter type -find.usages.type.nonLocal.property.type = Class/object property type -find.usages.type.function.return.type = Function return types -find.usages.type.superType = Supertype -find.usages.type.is = Target type of 'is' operation -find.usages.type.class.object = Nested class/object -find.usages.type.companion.object = Companion object -find.usages.type.function.call = Function call -find.usages.type.implicit.get = Implicit 'get' -find.usages.type.implicit.set = Implicit 'set' -find.usages.type.implicit.invoke = Implicit 'invoke' -find.usages.type.implicit.iteration = Implicit iteration -find.usages.type.property.delegation = Property delegation -find.usages.type.extension.receiver.type = Extension receiver type -find.usages.type.super.type.qualifier = Super type qualifier -find.usages.type.receiver = Receiver -find.usages.type.delegate = Delegate -find.usages.type.packageDirective = Package directive -find.usages.type.packageMemberAccess = Package member access - override.declaration.x.in.y={0} in {1} override.declaration.x.implements.y={0} in {1} implements {2} in {3}. override.declaration.x.overrides.y.in.class.list={0} overrides declarations in the following classes/interfaces: {1} Do you want to {2} the base declarations? diff --git a/idea/resources/messages/KotlinFindUsagesBundle.properties b/idea/resources/messages/KotlinFindUsagesBundle.properties new file mode 100644 index 00000000000..f95608084b2 --- /dev/null +++ b/idea/resources/messages/KotlinFindUsagesBundle.properties @@ -0,0 +1,51 @@ +kotlin.lang.class=class +kotlin.lang.companion.object=companion object +kotlin.lang.constructor=constructor +kotlin.lang.facade.class=facade class +kotlin.lang.for.property=for property +kotlin.lang.function=function +kotlin.lang.getter=getter +kotlin.lang.import.alias=import alias +kotlin.lang.interface=interface +kotlin.lang.label=label +kotlin.lang.lambda=lambda +kotlin.lang.object=object +kotlin.lang.parameter=parameter +kotlin.lang.property.accessor=property accessor +kotlin.lang.property=property +kotlin.lang.setter=setter +kotlin.lang.type.alias=type alias +kotlin.lang.type.parameter=type parameter +kotlin.lang.variable=variable +checkbox.name.expected.classes=Expected classes +class.name.anonymous=Anonymous +checkbox.name.expected.functions=Expected functions +text.find.usages.for.data.class.components.and.destruction.declarations=

Find usages for data class components and destruction declarations
could be disabled once or disabled for a project.

+tool.tip.text.disable.search.for.data.class.components.and.destruction.declarations.project.wide.setting=Disable search for data class components and destruction declarations. (Project wide setting) +checkbox.text.fast.data.class.component.search=Fast data class component search +checkbox.name.expected.properties=Expected properties +action.text.find.usages.of=find usages of +type.named.argument=Named argument +type.type.alias=Type alias + +find.usages.type.callable.reference = Callable reference +find.usages.type.type.constraint = Type constraint +find.usages.type.value.parameter.type = Parameter type +find.usages.type.nonLocal.property.type = Class/object property type +find.usages.type.function.return.type = Function return types +find.usages.type.superType = Supertype +find.usages.type.is = Target type of ''is'' operation +find.usages.type.class.object = Nested class/object +find.usages.type.companion.object = Companion object +find.usages.type.function.call = Function call +find.usages.type.implicit.get = Implicit ''get'' +find.usages.type.implicit.set = Implicit ''set'' +find.usages.type.implicit.invoke = Implicit 'invoke' +find.usages.type.implicit.iteration = Implicit iteration +find.usages.type.property.delegation = Property delegation +find.usages.type.extension.receiver.type = Extension receiver type +find.usages.type.super.type.qualifier = Super type qualifier +find.usages.type.receiver = Receiver +find.usages.type.delegate = Delegate +find.usages.type.packageDirective = Package directive +find.usages.type.packageMemberAccess = Package member access \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt index c43ac4ebd7b..ade4aa4b9fb 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt @@ -117,22 +117,34 @@ class KotlinElementDescriptionProvider : ElementDescriptionProvider { val targetElement = if (shouldUnwrap) element.unwrapped ?: element else element fun elementKind() = when (targetElement) { - is KtClass -> if (targetElement.isInterface()) "interface" else "class" - is KtObjectDeclaration -> if (targetElement.isCompanion()) "companion object" else "object" - is KtNamedFunction -> "function" - is KtPropertyAccessor -> (if (targetElement.isGetter) "getter" else "setter") + " for property " - is KtFunctionLiteral -> "lambda" - is KtPrimaryConstructor, is KtSecondaryConstructor -> "constructor" - is KtProperty -> if (targetElement.isLocal) "variable" else "property" - is KtTypeParameter -> "type parameter" - is KtParameter -> "parameter" - is KtDestructuringDeclarationEntry -> "variable" - is KtTypeAlias -> "type alias" - is KtLabeledExpression -> "label" - is KtImportAlias -> "import alias" - is RenameJavaSyntheticPropertyHandler.SyntheticPropertyWrapper -> "property" - is KtLightClassForFacade -> "facade class" - is RenameKotlinPropertyProcessor.PropertyMethodWrapper -> "property accessor" + is KtClass -> if (targetElement.isInterface()) + KotlinFindUsagesBundle.message("kotlin.lang.interface") + else + KotlinFindUsagesBundle.message("kotlin.lang.class") + is KtObjectDeclaration -> if (targetElement.isCompanion()) + KotlinFindUsagesBundle.message("kotlin.lang.companion.object") + else + KotlinFindUsagesBundle.message("kotlin.lang.object") + is KtNamedFunction -> KotlinFindUsagesBundle.message("kotlin.lang.function") + is KtPropertyAccessor -> (if (targetElement.isGetter) + KotlinFindUsagesBundle.message("kotlin.lang.getter") + else + KotlinFindUsagesBundle.message("kotlin.lang.setter")) + " " + KotlinFindUsagesBundle.message("kotlin.lang.for.property") + " " + is KtFunctionLiteral -> KotlinFindUsagesBundle.message("kotlin.lang.lambda") + is KtPrimaryConstructor, is KtSecondaryConstructor -> KotlinFindUsagesBundle.message("kotlin.lang.constructor") + is KtProperty -> if (targetElement.isLocal) + KotlinFindUsagesBundle.message("kotlin.lang.variable") + else + KotlinFindUsagesBundle.message("kotlin.lang.property") + is KtTypeParameter -> KotlinFindUsagesBundle.message("kotlin.lang.type.parameter") + is KtParameter -> KotlinFindUsagesBundle.message("kotlin.lang.parameter") + is KtDestructuringDeclarationEntry -> KotlinFindUsagesBundle.message("kotlin.lang.variable") + is KtTypeAlias -> KotlinFindUsagesBundle.message("kotlin.lang.type.alias") + is KtLabeledExpression -> KotlinFindUsagesBundle.message("kotlin.lang.label") + is KtImportAlias -> KotlinFindUsagesBundle.message("kotlin.lang.import.alias") + is RenameJavaSyntheticPropertyHandler.SyntheticPropertyWrapper -> KotlinFindUsagesBundle.message("kotlin.lang.property") + is KtLightClassForFacade -> KotlinFindUsagesBundle.message("kotlin.lang.facade.class") + is RenameKotlinPropertyProcessor.PropertyMethodWrapper -> KotlinFindUsagesBundle.message("kotlin.lang.property.accessor") else -> null } diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesBundle.kt b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesBundle.kt new file mode 100644 index 00000000000..2cf9b2c88f0 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesBundle.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.findUsages + +import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.PropertyKey +import org.jetbrains.kotlin.util.AbstractKotlinBundle + +@NonNls +private const val BUNDLE = "messages.KotlinFindUsagesBundle" + +object KotlinFindUsagesBundle : AbstractKotlinBundle(BUNDLE) { + @JvmStatic + fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params) + + @JvmStatic + fun lazyMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): () -> String = { getMessage(key, *params) } +} diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesHandlerFactory.kt b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesHandlerFactory.kt index a6a81cd1960..d012ff51b02 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesHandlerFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesHandlerFactory.kt @@ -61,7 +61,12 @@ class KotlinFindUsagesHandlerFactory(project: Project) : FindUsagesHandlerFactor is KtParameter -> { if (!forHighlightUsages) { if (element.hasValOrVar()) { - val declarationsToSearch = checkSuperMethods(element, null, "find usages of") + val declarationsToSearch = checkSuperMethods( + element, + null, + KotlinFindUsagesBundle.message("action.text.find.usages.of") + ) + return handlerForMultiple(element, declarationsToSearch) } val function = element.ownerFunction @@ -93,7 +98,12 @@ class KotlinFindUsagesHandlerFactory(project: Project) : FindUsagesHandlerFactor return KotlinFindMemberUsagesHandler.getInstance(declaration, factory = this) } - val declarationsToSearch = checkSuperMethods(declaration, null, "find usages of") + val declarationsToSearch = checkSuperMethods( + declaration, + null, + KotlinFindUsagesBundle.message("action.text.find.usages.of") + ) + return handlerForMultiple(declaration, declarationsToSearch) } diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesProvider.kt b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesProvider.kt index ada5797711b..a838e415397 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesProvider.kt @@ -30,14 +30,17 @@ class KotlinFindUsagesProvider : FindUsagesProvider { override fun getType(element: PsiElement): String { return when (element) { - is KtNamedFunction -> "function" - is KtClass -> "class" - is KtParameter -> "parameter" - is KtProperty -> if (element.isLocal) "variable" else "property" - is KtDestructuringDeclarationEntry -> "variable" - is KtTypeParameter -> "type parameter" - is KtSecondaryConstructor -> "constructor" - is KtObjectDeclaration -> "object" + is KtNamedFunction -> KotlinFindUsagesBundle.message("kotlin.lang.function") + is KtClass -> KotlinFindUsagesBundle.message("kotlin.lang.class") + is KtParameter -> KotlinFindUsagesBundle.message("kotlin.lang.parameter") + is KtProperty -> if (element.isLocal) + KotlinFindUsagesBundle.message("kotlin.lang.variable") + else + KotlinFindUsagesBundle.message("kotlin.lang.property") + is KtDestructuringDeclarationEntry -> KotlinFindUsagesBundle.message("kotlin.lang.variable") + is KtTypeParameter -> KotlinFindUsagesBundle.message("kotlin.lang.type.parameter") + is KtSecondaryConstructor -> KotlinFindUsagesBundle.message("kotlin.lang.constructor") + is KtObjectDeclaration -> KotlinFindUsagesBundle.message("kotlin.lang.object") else -> "" } } diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProvider.kt b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProvider.kt index 68a71987851..2bbd4705c27 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProvider.kt @@ -20,7 +20,6 @@ import com.intellij.psi.PsiElement import com.intellij.usages.UsageTarget import com.intellij.usages.impl.rules.UsageType import com.intellij.usages.impl.rules.UsageTypeProviderEx -import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.findUsages.UsageTypeEnum.* object KotlinUsageTypeProvider : UsageTypeProviderEx { @@ -75,35 +74,35 @@ object KotlinUsageTypeProvider : UsageTypeProviderEx { object KotlinUsageTypes { // types - val TYPE_CONSTRAINT = UsageType(KotlinBundle.message("find.usages.type.type.constraint")) - val VALUE_PARAMETER_TYPE = UsageType(KotlinBundle.message("find.usages.type.value.parameter.type")) - val NON_LOCAL_PROPERTY_TYPE = UsageType(KotlinBundle.message("find.usages.type.nonLocal.property.type")) - val FUNCTION_RETURN_TYPE = UsageType(KotlinBundle.message("find.usages.type.function.return.type")) - val SUPER_TYPE = UsageType(KotlinBundle.message("find.usages.type.superType")) - val IS = UsageType(KotlinBundle.message("find.usages.type.is")) - val CLASS_OBJECT_ACCESS = UsageType(KotlinBundle.message("find.usages.type.class.object")) - val COMPANION_OBJECT_ACCESS = UsageType(KotlinBundle.message("find.usages.type.companion.object")) - val EXTENSION_RECEIVER_TYPE = UsageType(KotlinBundle.message("find.usages.type.extension.receiver.type")) - val SUPER_TYPE_QUALIFIER = UsageType(KotlinBundle.message("find.usages.type.super.type.qualifier")) - val TYPE_ALIAS = UsageType("Type alias") + val TYPE_CONSTRAINT = UsageType(KotlinFindUsagesBundle.message("find.usages.type.type.constraint")) + val VALUE_PARAMETER_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.value.parameter.type")) + val NON_LOCAL_PROPERTY_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.nonLocal.property.type")) + val FUNCTION_RETURN_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.function.return.type")) + val SUPER_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.superType")) + val IS = UsageType(KotlinFindUsagesBundle.message("find.usages.type.is")) + val CLASS_OBJECT_ACCESS = UsageType(KotlinFindUsagesBundle.message("find.usages.type.class.object")) + val COMPANION_OBJECT_ACCESS = UsageType(KotlinFindUsagesBundle.message("find.usages.type.companion.object")) + val EXTENSION_RECEIVER_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.extension.receiver.type")) + val SUPER_TYPE_QUALIFIER = UsageType(KotlinFindUsagesBundle.message("find.usages.type.super.type.qualifier")) + val TYPE_ALIAS = UsageType(KotlinFindUsagesBundle.message("type.type.alias")) // functions - val FUNCTION_CALL = UsageType(KotlinBundle.message("find.usages.type.function.call")) - val IMPLICIT_GET = UsageType(KotlinBundle.message("find.usages.type.implicit.get")) - val IMPLICIT_SET = UsageType(KotlinBundle.message("find.usages.type.implicit.set")) - val IMPLICIT_INVOKE = UsageType(KotlinBundle.message("find.usages.type.implicit.invoke")) - val IMPLICIT_ITERATION = UsageType(KotlinBundle.message("find.usages.type.implicit.iteration")) - val PROPERTY_DELEGATION = UsageType(KotlinBundle.message("find.usages.type.property.delegation")) + val FUNCTION_CALL = UsageType(KotlinFindUsagesBundle.message("find.usages.type.function.call")) + val IMPLICIT_GET = UsageType(KotlinFindUsagesBundle.message("find.usages.type.implicit.get")) + val IMPLICIT_SET = UsageType(KotlinFindUsagesBundle.message("find.usages.type.implicit.set")) + val IMPLICIT_INVOKE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.implicit.invoke")) + val IMPLICIT_ITERATION = UsageType(KotlinFindUsagesBundle.message("find.usages.type.implicit.iteration")) + val PROPERTY_DELEGATION = UsageType(KotlinFindUsagesBundle.message("find.usages.type.property.delegation")) // values - val RECEIVER = UsageType(KotlinBundle.message("find.usages.type.receiver")) - val DELEGATE = UsageType(KotlinBundle.message("find.usages.type.delegate")) + val RECEIVER = UsageType(KotlinFindUsagesBundle.message("find.usages.type.receiver")) + val DELEGATE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.delegate")) // packages - val PACKAGE_DIRECTIVE = UsageType(KotlinBundle.message("find.usages.type.packageDirective")) - val PACKAGE_MEMBER_ACCESS = UsageType(KotlinBundle.message("find.usages.type.packageMemberAccess")) + val PACKAGE_DIRECTIVE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.packageDirective")) + val PACKAGE_MEMBER_ACCESS = UsageType(KotlinFindUsagesBundle.message("find.usages.type.packageMemberAccess")) // common usage types - val CALLABLE_REFERENCE = UsageType(KotlinBundle.message("find.usages.type.callable.reference")) - val NAMED_ARGUMENT = UsageType("Named argument") + val CALLABLE_REFERENCE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.callable.reference")) + val NAMED_ARGUMENT = UsageType(KotlinFindUsagesBundle.message("type.named.argument")) } diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProvider.kt.201 b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProvider.kt.201 new file mode 100644 index 00000000000..83a7ce21c84 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProvider.kt.201 @@ -0,0 +1,108 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.findUsages + +import com.intellij.psi.PsiElement +import com.intellij.usages.UsageTarget +import com.intellij.usages.impl.rules.UsageType +import com.intellij.usages.impl.rules.UsageTypeProviderEx +import org.jetbrains.kotlin.idea.findUsages.UsageTypeEnum.* + +object KotlinUsageTypeProvider : UsageTypeProviderEx { + override fun getUsageType(element: PsiElement?): UsageType? = getUsageType(element, UsageTarget.EMPTY_ARRAY) + + override fun getUsageType(element: PsiElement?, targets: Array): UsageType? { + val usageType = UsageTypeUtils.getUsageType(element) ?: return null + return convertEnumToUsageType(usageType) + } + + private fun convertEnumToUsageType(usageType: UsageTypeEnum): UsageType = when (usageType) { + TYPE_CONSTRAINT -> KotlinUsageTypes.TYPE_CONSTRAINT + VALUE_PARAMETER_TYPE -> KotlinUsageTypes.VALUE_PARAMETER_TYPE + NON_LOCAL_PROPERTY_TYPE -> KotlinUsageTypes.NON_LOCAL_PROPERTY_TYPE + FUNCTION_RETURN_TYPE -> KotlinUsageTypes.FUNCTION_RETURN_TYPE + SUPER_TYPE -> KotlinUsageTypes.SUPER_TYPE + IS -> KotlinUsageTypes.IS + CLASS_OBJECT_ACCESS -> KotlinUsageTypes.CLASS_OBJECT_ACCESS + COMPANION_OBJECT_ACCESS -> KotlinUsageTypes.COMPANION_OBJECT_ACCESS + EXTENSION_RECEIVER_TYPE -> KotlinUsageTypes.EXTENSION_RECEIVER_TYPE + SUPER_TYPE_QUALIFIER -> KotlinUsageTypes.SUPER_TYPE_QUALIFIER + TYPE_ALIAS -> KotlinUsageTypes.TYPE_ALIAS + + FUNCTION_CALL -> KotlinUsageTypes.FUNCTION_CALL + IMPLICIT_GET -> KotlinUsageTypes.IMPLICIT_GET + IMPLICIT_SET -> KotlinUsageTypes.IMPLICIT_SET + IMPLICIT_INVOKE -> KotlinUsageTypes.IMPLICIT_INVOKE + IMPLICIT_ITERATION -> KotlinUsageTypes.IMPLICIT_ITERATION + PROPERTY_DELEGATION -> KotlinUsageTypes.PROPERTY_DELEGATION + + RECEIVER -> KotlinUsageTypes.RECEIVER + DELEGATE -> KotlinUsageTypes.DELEGATE + + PACKAGE_DIRECTIVE -> KotlinUsageTypes.PACKAGE_DIRECTIVE + PACKAGE_MEMBER_ACCESS -> KotlinUsageTypes.PACKAGE_MEMBER_ACCESS + + CALLABLE_REFERENCE -> KotlinUsageTypes.CALLABLE_REFERENCE + + READ -> UsageType.READ + WRITE -> UsageType.WRITE + CLASS_IMPORT -> UsageType.CLASS_IMPORT + CLASS_LOCAL_VAR_DECLARATION -> UsageType.CLASS_LOCAL_VAR_DECLARATION + TYPE_PARAMETER -> UsageType.TYPE_PARAMETER + CLASS_CAST_TO -> UsageType.CLASS_CAST_TO + ANNOTATION -> UsageType.ANNOTATION + CLASS_NEW_OPERATOR -> UsageType.CLASS_NEW_OPERATOR + NAMED_ARGUMENT -> KotlinUsageTypes.NAMED_ARGUMENT + + USAGE_IN_STRING_LITERAL -> UsageType.LITERAL_USAGE + } +} + +object KotlinUsageTypes { + // types + val TYPE_CONSTRAINT = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.type.constraint")) + val VALUE_PARAMETER_TYPE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.value.parameter.type")) + val NON_LOCAL_PROPERTY_TYPE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.nonLocal.property.type")) + val FUNCTION_RETURN_TYPE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.function.return.type")) + val SUPER_TYPE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.superType")) + val IS = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.is")) + val CLASS_OBJECT_ACCESS = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.class.object")) + val COMPANION_OBJECT_ACCESS = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.companion.object")) + val EXTENSION_RECEIVER_TYPE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.extension.receiver.type")) + val SUPER_TYPE_QUALIFIER = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.super.type.qualifier")) + val TYPE_ALIAS = UsageType(KotlinFindUsagesBundle.lazyMessage("type.type.alias")) + + // functions + val FUNCTION_CALL = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.function.call")) + val IMPLICIT_GET = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.implicit.get")) + val IMPLICIT_SET = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.implicit.set")) + val IMPLICIT_INVOKE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.implicit.invoke")) + val IMPLICIT_ITERATION = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.implicit.iteration")) + val PROPERTY_DELEGATION = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.property.delegation")) + + // values + val RECEIVER = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.receiver")) + val DELEGATE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.delegate")) + + // packages + val PACKAGE_DIRECTIVE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.packageDirective")) + val PACKAGE_MEMBER_ACCESS = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.packageMemberAccess")) + + // common usage types + val CALLABLE_REFERENCE = UsageType(KotlinFindUsagesBundle.lazyMessage("find.usages.type.callable.reference")) + val NAMED_ARGUMENT = UsageType(KotlinFindUsagesBundle.lazyMessage("type.named.argument")) +} diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindClassUsagesDialog.java b/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindClassUsagesDialog.java index 9071e021ba7..d89977a41b2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindClassUsagesDialog.java +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindClassUsagesDialog.java @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.asJava.LightClassUtilsKt; import org.jetbrains.kotlin.idea.KotlinBundle; import org.jetbrains.kotlin.idea.core.PsiModificationUtilsKt; import org.jetbrains.kotlin.idea.findUsages.KotlinClassFindUsagesOptions; +import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesBundle; import org.jetbrains.kotlin.idea.refactoring.RenderingUtilsKt; import org.jetbrains.kotlin.psi.KtClass; import org.jetbrains.kotlin.psi.KtClassOrObject; @@ -74,7 +75,7 @@ public class KotlinFindClassUsagesDialog extends FindClassUsagesDialog { String name = classOrObject.getName(); if (name == null || name.isEmpty()) { - name = "Anonymous"; + name = KotlinFindUsagesBundle.message("class.name.anonymous"); } PsiClass javaClass; @@ -165,7 +166,7 @@ public class KotlinFindClassUsagesDialog extends FindClassUsagesDialog { KotlinClassFindUsagesOptions options = getFindUsagesOptions(); if (isActual) { expectedUsages = addCheckboxToPanel( - "Expected classes", + KotlinFindUsagesBundle.message("checkbox.name.expected.classes"), options.getSearchExpected(), optionsPanel, false diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindFunctionUsagesDialog.java b/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindFunctionUsagesDialog.java index 65ddc33faf9..191d5719002 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindFunctionUsagesDialog.java +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindFunctionUsagesDialog.java @@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.asJava.LightClassUtilsKt; import org.jetbrains.kotlin.asJava.elements.KtLightMethod; import org.jetbrains.kotlin.idea.KotlinBundle; +import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesBundle; import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions; import org.jetbrains.kotlin.idea.refactoring.RenderingUtilsKt; import org.jetbrains.kotlin.psi.KtDeclaration; @@ -110,7 +111,7 @@ public class KotlinFindFunctionUsagesDialog extends FindMethodUsagesDialog { KotlinFunctionFindUsagesOptions options = getFindUsagesOptions(); if (isActual) { expectedUsages = addCheckboxToPanel( - "Expected functions", + KotlinFindUsagesBundle.message("checkbox.name.expected.functions"), options.getSearchExpected(), optionsPanel, false diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindPropertyUsagesDialog.java b/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindPropertyUsagesDialog.java index 35bb5964a12..9c568a28a81 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindPropertyUsagesDialog.java +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/dialogs/KotlinFindPropertyUsagesDialog.java @@ -28,6 +28,7 @@ import com.intellij.ui.SimpleColoredComponent; import com.intellij.ui.StateRestoringCheckBox; import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.idea.KotlinBundle; +import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesBundle; import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions; import org.jetbrains.kotlin.lexer.KtTokens; import org.jetbrains.kotlin.psi.*; @@ -127,7 +128,7 @@ public class KotlinFindPropertyUsagesDialog extends JavaFindUsagesDialog protected c private const val DISABLE_ONCE = "DISABLE_ONCE" private const val DISABLE = "DISABLE" - private const val DISABLE_COMPONENT_AND_DESTRUCTION_SEARCH_TEXT = - "

Find usages for data class components and destruction declarations
could be disabled once or disabled for a project.

" + private val DISABLE_COMPONENT_AND_DESTRUCTION_SEARCH_TEXT = KotlinFindUsagesBundle.message( + "text.find.usages.for.data.class.components.and.destruction.declarations", + DISABLE_ONCE, + DISABLE + ) + private const val DISABLE_COMPONENT_AND_DESTRUCTION_SEARCH_TIMEOUT = 5000 private val FIND_USAGES_ONES_FOR_DATA_CLASS_KEY = Key("FIND_USAGES_ONES")