i18n: add bundle for idea/findUsages
This commit is contained in:
@@ -78,28 +78,6 @@ unwrap.expression = Unwrap ''{0}''
|
|||||||
remove.else = Remove else in ''{0}''
|
remove.else = Remove else in ''{0}''
|
||||||
unwrap.else = Unwrap 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.in.y={0} in {1}
|
||||||
override.declaration.x.implements.y={0} in {1} implements {2} in {3}.
|
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?
|
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?
|
||||||
|
|||||||
@@ -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=<p>Find usages for data class components and destruction declarations<br/>could be <a href="{0}">disabled once</a> or <a href="{1}">disabled for a project</a>.</p>
|
||||||
|
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
|
||||||
@@ -117,22 +117,34 @@ class KotlinElementDescriptionProvider : ElementDescriptionProvider {
|
|||||||
val targetElement = if (shouldUnwrap) element.unwrapped ?: element else element
|
val targetElement = if (shouldUnwrap) element.unwrapped ?: element else element
|
||||||
|
|
||||||
fun elementKind() = when (targetElement) {
|
fun elementKind() = when (targetElement) {
|
||||||
is KtClass -> if (targetElement.isInterface()) "interface" else "class"
|
is KtClass -> if (targetElement.isInterface())
|
||||||
is KtObjectDeclaration -> if (targetElement.isCompanion()) "companion object" else "object"
|
KotlinFindUsagesBundle.message("kotlin.lang.interface")
|
||||||
is KtNamedFunction -> "function"
|
else
|
||||||
is KtPropertyAccessor -> (if (targetElement.isGetter) "getter" else "setter") + " for property "
|
KotlinFindUsagesBundle.message("kotlin.lang.class")
|
||||||
is KtFunctionLiteral -> "lambda"
|
is KtObjectDeclaration -> if (targetElement.isCompanion())
|
||||||
is KtPrimaryConstructor, is KtSecondaryConstructor -> "constructor"
|
KotlinFindUsagesBundle.message("kotlin.lang.companion.object")
|
||||||
is KtProperty -> if (targetElement.isLocal) "variable" else "property"
|
else
|
||||||
is KtTypeParameter -> "type parameter"
|
KotlinFindUsagesBundle.message("kotlin.lang.object")
|
||||||
is KtParameter -> "parameter"
|
is KtNamedFunction -> KotlinFindUsagesBundle.message("kotlin.lang.function")
|
||||||
is KtDestructuringDeclarationEntry -> "variable"
|
is KtPropertyAccessor -> (if (targetElement.isGetter)
|
||||||
is KtTypeAlias -> "type alias"
|
KotlinFindUsagesBundle.message("kotlin.lang.getter")
|
||||||
is KtLabeledExpression -> "label"
|
else
|
||||||
is KtImportAlias -> "import alias"
|
KotlinFindUsagesBundle.message("kotlin.lang.setter")) + " " + KotlinFindUsagesBundle.message("kotlin.lang.for.property") + " "
|
||||||
is RenameJavaSyntheticPropertyHandler.SyntheticPropertyWrapper -> "property"
|
is KtFunctionLiteral -> KotlinFindUsagesBundle.message("kotlin.lang.lambda")
|
||||||
is KtLightClassForFacade -> "facade class"
|
is KtPrimaryConstructor, is KtSecondaryConstructor -> KotlinFindUsagesBundle.message("kotlin.lang.constructor")
|
||||||
is RenameKotlinPropertyProcessor.PropertyMethodWrapper -> "property accessor"
|
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
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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) }
|
||||||
|
}
|
||||||
@@ -61,7 +61,12 @@ class KotlinFindUsagesHandlerFactory(project: Project) : FindUsagesHandlerFactor
|
|||||||
is KtParameter -> {
|
is KtParameter -> {
|
||||||
if (!forHighlightUsages) {
|
if (!forHighlightUsages) {
|
||||||
if (element.hasValOrVar()) {
|
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)
|
return handlerForMultiple(element, declarationsToSearch)
|
||||||
}
|
}
|
||||||
val function = element.ownerFunction
|
val function = element.ownerFunction
|
||||||
@@ -93,7 +98,12 @@ class KotlinFindUsagesHandlerFactory(project: Project) : FindUsagesHandlerFactor
|
|||||||
return KotlinFindMemberUsagesHandler.getInstance(declaration, factory = this)
|
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)
|
return handlerForMultiple(declaration, declarationsToSearch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,17 @@ class KotlinFindUsagesProvider : FindUsagesProvider {
|
|||||||
|
|
||||||
override fun getType(element: PsiElement): String {
|
override fun getType(element: PsiElement): String {
|
||||||
return when (element) {
|
return when (element) {
|
||||||
is KtNamedFunction -> "function"
|
is KtNamedFunction -> KotlinFindUsagesBundle.message("kotlin.lang.function")
|
||||||
is KtClass -> "class"
|
is KtClass -> KotlinFindUsagesBundle.message("kotlin.lang.class")
|
||||||
is KtParameter -> "parameter"
|
is KtParameter -> KotlinFindUsagesBundle.message("kotlin.lang.parameter")
|
||||||
is KtProperty -> if (element.isLocal) "variable" else "property"
|
is KtProperty -> if (element.isLocal)
|
||||||
is KtDestructuringDeclarationEntry -> "variable"
|
KotlinFindUsagesBundle.message("kotlin.lang.variable")
|
||||||
is KtTypeParameter -> "type parameter"
|
else
|
||||||
is KtSecondaryConstructor -> "constructor"
|
KotlinFindUsagesBundle.message("kotlin.lang.property")
|
||||||
is KtObjectDeclaration -> "object"
|
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 -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import com.intellij.psi.PsiElement
|
|||||||
import com.intellij.usages.UsageTarget
|
import com.intellij.usages.UsageTarget
|
||||||
import com.intellij.usages.impl.rules.UsageType
|
import com.intellij.usages.impl.rules.UsageType
|
||||||
import com.intellij.usages.impl.rules.UsageTypeProviderEx
|
import com.intellij.usages.impl.rules.UsageTypeProviderEx
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
|
||||||
import org.jetbrains.kotlin.idea.findUsages.UsageTypeEnum.*
|
import org.jetbrains.kotlin.idea.findUsages.UsageTypeEnum.*
|
||||||
|
|
||||||
object KotlinUsageTypeProvider : UsageTypeProviderEx {
|
object KotlinUsageTypeProvider : UsageTypeProviderEx {
|
||||||
@@ -75,35 +74,35 @@ object KotlinUsageTypeProvider : UsageTypeProviderEx {
|
|||||||
|
|
||||||
object KotlinUsageTypes {
|
object KotlinUsageTypes {
|
||||||
// types
|
// types
|
||||||
val TYPE_CONSTRAINT = UsageType(KotlinBundle.message("find.usages.type.type.constraint"))
|
val TYPE_CONSTRAINT = UsageType(KotlinFindUsagesBundle.message("find.usages.type.type.constraint"))
|
||||||
val VALUE_PARAMETER_TYPE = UsageType(KotlinBundle.message("find.usages.type.value.parameter.type"))
|
val VALUE_PARAMETER_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.value.parameter.type"))
|
||||||
val NON_LOCAL_PROPERTY_TYPE = UsageType(KotlinBundle.message("find.usages.type.nonLocal.property.type"))
|
val NON_LOCAL_PROPERTY_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.nonLocal.property.type"))
|
||||||
val FUNCTION_RETURN_TYPE = UsageType(KotlinBundle.message("find.usages.type.function.return.type"))
|
val FUNCTION_RETURN_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.function.return.type"))
|
||||||
val SUPER_TYPE = UsageType(KotlinBundle.message("find.usages.type.superType"))
|
val SUPER_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.superType"))
|
||||||
val IS = UsageType(KotlinBundle.message("find.usages.type.is"))
|
val IS = UsageType(KotlinFindUsagesBundle.message("find.usages.type.is"))
|
||||||
val CLASS_OBJECT_ACCESS = UsageType(KotlinBundle.message("find.usages.type.class.object"))
|
val CLASS_OBJECT_ACCESS = UsageType(KotlinFindUsagesBundle.message("find.usages.type.class.object"))
|
||||||
val COMPANION_OBJECT_ACCESS = UsageType(KotlinBundle.message("find.usages.type.companion.object"))
|
val COMPANION_OBJECT_ACCESS = UsageType(KotlinFindUsagesBundle.message("find.usages.type.companion.object"))
|
||||||
val EXTENSION_RECEIVER_TYPE = UsageType(KotlinBundle.message("find.usages.type.extension.receiver.type"))
|
val EXTENSION_RECEIVER_TYPE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.extension.receiver.type"))
|
||||||
val SUPER_TYPE_QUALIFIER = UsageType(KotlinBundle.message("find.usages.type.super.type.qualifier"))
|
val SUPER_TYPE_QUALIFIER = UsageType(KotlinFindUsagesBundle.message("find.usages.type.super.type.qualifier"))
|
||||||
val TYPE_ALIAS = UsageType("Type alias")
|
val TYPE_ALIAS = UsageType(KotlinFindUsagesBundle.message("type.type.alias"))
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
val FUNCTION_CALL = UsageType(KotlinBundle.message("find.usages.type.function.call"))
|
val FUNCTION_CALL = UsageType(KotlinFindUsagesBundle.message("find.usages.type.function.call"))
|
||||||
val IMPLICIT_GET = UsageType(KotlinBundle.message("find.usages.type.implicit.get"))
|
val IMPLICIT_GET = UsageType(KotlinFindUsagesBundle.message("find.usages.type.implicit.get"))
|
||||||
val IMPLICIT_SET = UsageType(KotlinBundle.message("find.usages.type.implicit.set"))
|
val IMPLICIT_SET = UsageType(KotlinFindUsagesBundle.message("find.usages.type.implicit.set"))
|
||||||
val IMPLICIT_INVOKE = UsageType(KotlinBundle.message("find.usages.type.implicit.invoke"))
|
val IMPLICIT_INVOKE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.implicit.invoke"))
|
||||||
val IMPLICIT_ITERATION = UsageType(KotlinBundle.message("find.usages.type.implicit.iteration"))
|
val IMPLICIT_ITERATION = UsageType(KotlinFindUsagesBundle.message("find.usages.type.implicit.iteration"))
|
||||||
val PROPERTY_DELEGATION = UsageType(KotlinBundle.message("find.usages.type.property.delegation"))
|
val PROPERTY_DELEGATION = UsageType(KotlinFindUsagesBundle.message("find.usages.type.property.delegation"))
|
||||||
|
|
||||||
// values
|
// values
|
||||||
val RECEIVER = UsageType(KotlinBundle.message("find.usages.type.receiver"))
|
val RECEIVER = UsageType(KotlinFindUsagesBundle.message("find.usages.type.receiver"))
|
||||||
val DELEGATE = UsageType(KotlinBundle.message("find.usages.type.delegate"))
|
val DELEGATE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.delegate"))
|
||||||
|
|
||||||
// packages
|
// packages
|
||||||
val PACKAGE_DIRECTIVE = UsageType(KotlinBundle.message("find.usages.type.packageDirective"))
|
val PACKAGE_DIRECTIVE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.packageDirective"))
|
||||||
val PACKAGE_MEMBER_ACCESS = UsageType(KotlinBundle.message("find.usages.type.packageMemberAccess"))
|
val PACKAGE_MEMBER_ACCESS = UsageType(KotlinFindUsagesBundle.message("find.usages.type.packageMemberAccess"))
|
||||||
|
|
||||||
// common usage types
|
// common usage types
|
||||||
val CALLABLE_REFERENCE = UsageType(KotlinBundle.message("find.usages.type.callable.reference"))
|
val CALLABLE_REFERENCE = UsageType(KotlinFindUsagesBundle.message("find.usages.type.callable.reference"))
|
||||||
val NAMED_ARGUMENT = UsageType("Named argument")
|
val NAMED_ARGUMENT = UsageType(KotlinFindUsagesBundle.message("type.named.argument"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<out UsageTarget>): 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"))
|
||||||
|
}
|
||||||
+3
-2
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.asJava.LightClassUtilsKt;
|
|||||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
import org.jetbrains.kotlin.idea.KotlinBundle;
|
||||||
import org.jetbrains.kotlin.idea.core.PsiModificationUtilsKt;
|
import org.jetbrains.kotlin.idea.core.PsiModificationUtilsKt;
|
||||||
import org.jetbrains.kotlin.idea.findUsages.KotlinClassFindUsagesOptions;
|
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.idea.refactoring.RenderingUtilsKt;
|
||||||
import org.jetbrains.kotlin.psi.KtClass;
|
import org.jetbrains.kotlin.psi.KtClass;
|
||||||
import org.jetbrains.kotlin.psi.KtClassOrObject;
|
import org.jetbrains.kotlin.psi.KtClassOrObject;
|
||||||
@@ -74,7 +75,7 @@ public class KotlinFindClassUsagesDialog extends FindClassUsagesDialog {
|
|||||||
|
|
||||||
String name = classOrObject.getName();
|
String name = classOrObject.getName();
|
||||||
if (name == null || name.isEmpty()) {
|
if (name == null || name.isEmpty()) {
|
||||||
name = "Anonymous";
|
name = KotlinFindUsagesBundle.message("class.name.anonymous");
|
||||||
}
|
}
|
||||||
|
|
||||||
PsiClass javaClass;
|
PsiClass javaClass;
|
||||||
@@ -165,7 +166,7 @@ public class KotlinFindClassUsagesDialog extends FindClassUsagesDialog {
|
|||||||
KotlinClassFindUsagesOptions options = getFindUsagesOptions();
|
KotlinClassFindUsagesOptions options = getFindUsagesOptions();
|
||||||
if (isActual) {
|
if (isActual) {
|
||||||
expectedUsages = addCheckboxToPanel(
|
expectedUsages = addCheckboxToPanel(
|
||||||
"Expected classes",
|
KotlinFindUsagesBundle.message("checkbox.name.expected.classes"),
|
||||||
options.getSearchExpected(),
|
options.getSearchExpected(),
|
||||||
optionsPanel,
|
optionsPanel,
|
||||||
false
|
false
|
||||||
|
|||||||
+2
-1
@@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.kotlin.asJava.LightClassUtilsKt;
|
import org.jetbrains.kotlin.asJava.LightClassUtilsKt;
|
||||||
import org.jetbrains.kotlin.asJava.elements.KtLightMethod;
|
import org.jetbrains.kotlin.asJava.elements.KtLightMethod;
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
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.findUsages.KotlinFunctionFindUsagesOptions;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.RenderingUtilsKt;
|
import org.jetbrains.kotlin.idea.refactoring.RenderingUtilsKt;
|
||||||
import org.jetbrains.kotlin.psi.KtDeclaration;
|
import org.jetbrains.kotlin.psi.KtDeclaration;
|
||||||
@@ -110,7 +111,7 @@ public class KotlinFindFunctionUsagesDialog extends FindMethodUsagesDialog {
|
|||||||
KotlinFunctionFindUsagesOptions options = getFindUsagesOptions();
|
KotlinFunctionFindUsagesOptions options = getFindUsagesOptions();
|
||||||
if (isActual) {
|
if (isActual) {
|
||||||
expectedUsages = addCheckboxToPanel(
|
expectedUsages = addCheckboxToPanel(
|
||||||
"Expected functions",
|
KotlinFindUsagesBundle.message("checkbox.name.expected.functions"),
|
||||||
options.getSearchExpected(),
|
options.getSearchExpected(),
|
||||||
optionsPanel,
|
optionsPanel,
|
||||||
false
|
false
|
||||||
|
|||||||
+5
-3
@@ -28,6 +28,7 @@ import com.intellij.ui.SimpleColoredComponent;
|
|||||||
import com.intellij.ui.StateRestoringCheckBox;
|
import com.intellij.ui.StateRestoringCheckBox;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
import org.jetbrains.kotlin.idea.KotlinBundle;
|
||||||
|
import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesBundle;
|
||||||
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions;
|
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions;
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||||
import org.jetbrains.kotlin.psi.*;
|
import org.jetbrains.kotlin.psi.*;
|
||||||
@@ -127,7 +128,7 @@ public class KotlinFindPropertyUsagesDialog extends JavaFindUsagesDialog<KotlinP
|
|||||||
KotlinPropertyFindUsagesOptions options = getFindUsagesOptions();
|
KotlinPropertyFindUsagesOptions options = getFindUsagesOptions();
|
||||||
if (isActual) {
|
if (isActual) {
|
||||||
expectedUsages = addCheckboxToPanel(
|
expectedUsages = addCheckboxToPanel(
|
||||||
"Expected properties",
|
KotlinFindUsagesBundle.message("checkbox.name.expected.properties"),
|
||||||
options.getSearchExpected(),
|
options.getSearchExpected(),
|
||||||
optionsPanel,
|
optionsPanel,
|
||||||
false
|
false
|
||||||
@@ -136,8 +137,9 @@ public class KotlinFindPropertyUsagesDialog extends JavaFindUsagesDialog<KotlinP
|
|||||||
|
|
||||||
if (isDataClassConstructorProperty(property)) {
|
if (isDataClassConstructorProperty(property)) {
|
||||||
JCheckBox dataClassComponentCheckBox =
|
JCheckBox dataClassComponentCheckBox =
|
||||||
new JCheckBox("Fast data class component search");
|
new JCheckBox(KotlinFindUsagesBundle.message("checkbox.text.fast.data.class.component.search"));
|
||||||
dataClassComponentCheckBox.setToolTipText("Disable search for data class components and destruction declarations. (Project wide setting)");
|
dataClassComponentCheckBox.setToolTipText(KotlinFindUsagesBundle.message(
|
||||||
|
"tool.tip.text.disable.search.for.data.class.components.and.destruction.declarations.project.wide.setting"));
|
||||||
Project project = property.getProject();
|
Project project = property.getProject();
|
||||||
dataClassComponentCheckBox.setSelected(getDisableComponentAndDestructionSearch(project));
|
dataClassComponentCheckBox.setSelected(getDisableComponentAndDestructionSearch(project));
|
||||||
optionsPanel.add(dataClassComponentCheckBox);
|
optionsPanel.add(dataClassComponentCheckBox);
|
||||||
|
|||||||
+7
-6
@@ -45,10 +45,7 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
|
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
|
||||||
import org.jetbrains.kotlin.idea.debugger.readAction
|
import org.jetbrains.kotlin.idea.debugger.readAction
|
||||||
import org.jetbrains.kotlin.idea.findUsages.KotlinCallableFindUsagesOptions
|
import org.jetbrains.kotlin.idea.findUsages.*
|
||||||
import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesHandlerFactory
|
|
||||||
import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions
|
|
||||||
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions
|
|
||||||
import org.jetbrains.kotlin.idea.findUsages.dialogs.KotlinFindFunctionUsagesDialog
|
import org.jetbrains.kotlin.idea.findUsages.dialogs.KotlinFindFunctionUsagesDialog
|
||||||
import org.jetbrains.kotlin.idea.findUsages.dialogs.KotlinFindPropertyUsagesDialog
|
import org.jetbrains.kotlin.idea.findUsages.dialogs.KotlinFindPropertyUsagesDialog
|
||||||
import org.jetbrains.kotlin.idea.search.declarationsSearch.HierarchySearchRequest
|
import org.jetbrains.kotlin.idea.search.declarationsSearch.HierarchySearchRequest
|
||||||
@@ -313,8 +310,12 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
|
|||||||
|
|
||||||
private const val DISABLE_ONCE = "DISABLE_ONCE"
|
private const val DISABLE_ONCE = "DISABLE_ONCE"
|
||||||
private const val DISABLE = "DISABLE"
|
private const val DISABLE = "DISABLE"
|
||||||
private const val DISABLE_COMPONENT_AND_DESTRUCTION_SEARCH_TEXT =
|
private val DISABLE_COMPONENT_AND_DESTRUCTION_SEARCH_TEXT = KotlinFindUsagesBundle.message(
|
||||||
"<p>Find usages for data class components and destruction declarations<br/>could be <a href=\"$DISABLE_ONCE\">disabled once</a> or <a href=\"$DISABLE\">disabled for a project</a>.</p>"
|
"text.find.usages.for.data.class.components.and.destruction.declarations",
|
||||||
|
DISABLE_ONCE,
|
||||||
|
DISABLE
|
||||||
|
)
|
||||||
|
|
||||||
private const val DISABLE_COMPONENT_AND_DESTRUCTION_SEARCH_TIMEOUT = 5000
|
private const val DISABLE_COMPONENT_AND_DESTRUCTION_SEARCH_TIMEOUT = 5000
|
||||||
|
|
||||||
private val FIND_USAGES_ONES_FOR_DATA_CLASS_KEY = Key<Boolean>("FIND_USAGES_ONES")
|
private val FIND_USAGES_ONES_FOR_DATA_CLASS_KEY = Key<Boolean>("FIND_USAGES_ONES")
|
||||||
|
|||||||
Reference in New Issue
Block a user