Delete unused extension point
This commit is contained in:
@@ -17,9 +17,6 @@
|
||||
<extensionPoint name="jsSyntheticTranslateExtension"
|
||||
interface="org.jetbrains.kotlin.js.translate.extensions.JsSyntheticTranslateExtension"
|
||||
area="IDEA_PROJECT"/>
|
||||
<extensionPoint name="findUsagesHandlerDecorator"
|
||||
interface="org.jetbrains.kotlin.plugin.findUsages.handlers.KotlinFindUsagesHandlerDecorator"
|
||||
area="IDEA_PROJECT"/>
|
||||
<extensionPoint name="simpleNameReferenceExtension"
|
||||
interface="org.jetbrains.kotlin.plugin.references.SimpleNameReferenceExtension"
|
||||
area="IDEA_PROJECT"/>
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.find.findUsages.FindUsagesHandler
|
||||
import com.intellij.find.findUsages.FindUsagesHandlerFactory
|
||||
import com.intellij.find.findUsages.FindUsagesOptions
|
||||
import com.intellij.find.findUsages.JavaFindUsagesHandlerFactory
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.psi.PsiElement
|
||||
@@ -35,7 +34,6 @@ import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinFindClassUsagesHandle
|
||||
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinFindMemberUsagesHandler
|
||||
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinTypeParameterFindUsagesHandler
|
||||
import org.jetbrains.kotlin.idea.refactoring.checkSuperMethods
|
||||
import org.jetbrains.kotlin.plugin.findUsages.handlers.KotlinFindUsagesHandlerDecorator
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parameterIndex
|
||||
import java.lang.IllegalArgumentException
|
||||
@@ -56,29 +54,13 @@ class KotlinFindUsagesHandlerFactory(project: Project) : FindUsagesHandlerFactor
|
||||
element is KtTypeParameter ||
|
||||
element is KtConstructor<*>
|
||||
|
||||
fun createFindUsagesHandlerNoQuestions(element: PsiElement): FindUsagesHandler {
|
||||
return createFindUsagesHandler(element, forHighlightUsages = false, canAsk = false)
|
||||
}
|
||||
|
||||
override fun createFindUsagesHandler(element: PsiElement, forHighlightUsages: Boolean): FindUsagesHandler {
|
||||
return createFindUsagesHandler(element, forHighlightUsages, canAsk = !forHighlightUsages)
|
||||
}
|
||||
|
||||
fun createFindUsagesHandler(element: PsiElement, forHighlightUsages: Boolean, canAsk: Boolean): FindUsagesHandler {
|
||||
val handler = createFindUsagesHandlerNoDecoration(element, canAsk)
|
||||
|
||||
return Extensions.getArea(element.project).getExtensionPoint(KotlinFindUsagesHandlerDecorator.EP_NAME).extensions.fold(handler) {
|
||||
handler, decorator -> decorator.decorateHandler(element, forHighlightUsages, handler)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createFindUsagesHandlerNoDecoration(element: PsiElement, canAsk: Boolean): FindUsagesHandler {
|
||||
when (element) {
|
||||
is KtClassOrObject ->
|
||||
return KotlinFindClassUsagesHandler(element, this)
|
||||
|
||||
is KtParameter -> {
|
||||
if (canAsk) {
|
||||
if (!forHighlightUsages) {
|
||||
if (element.hasValOrVar()) {
|
||||
val declarationsToSearch = checkSuperMethods(element, null, "find usages of")
|
||||
return handlerForMultiple(element, declarationsToSearch)
|
||||
@@ -93,8 +75,8 @@ class KotlinFindUsagesHandlerFactory(project: Project) : FindUsagesHandlerFactor
|
||||
val parameterIndex = element.parameterIndex()
|
||||
assert(parameterIndex < parametersCount)
|
||||
val overridingParameters = OverridingMethodsSearch.search(psiMethod, true)
|
||||
.filter { it.parameterList.parametersCount == parametersCount }
|
||||
.mapNotNull { it.parameterList.parameters[parameterIndex].unwrapped }
|
||||
.filter { it.parameterList.parametersCount == parametersCount }
|
||||
.mapNotNull { it.parameterList.parameters[parameterIndex].unwrapped }
|
||||
return handlerForMultiple(element, listOf(element) + overridingParameters)
|
||||
}
|
||||
}
|
||||
@@ -108,7 +90,7 @@ class KotlinFindUsagesHandlerFactory(project: Project) : FindUsagesHandlerFactor
|
||||
is KtNamedFunction, is KtProperty, is KtConstructor<*> -> {
|
||||
val declaration = element as KtNamedDeclaration
|
||||
|
||||
if (!canAsk) {
|
||||
if (forHighlightUsages) {
|
||||
return KotlinFindMemberUsagesHandler.getInstance(declaration, factory = this)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ fun KtDeclaration.processAllExactUsages(
|
||||
options: () -> FindUsagesOptions,
|
||||
processor: (UsageInfo) -> Unit
|
||||
) {
|
||||
val findUsagesHandler = KotlinFindUsagesHandlerFactory(project).createFindUsagesHandler(this, false, false)
|
||||
val findUsagesHandler = KotlinFindUsagesHandlerFactory(project).createFindUsagesHandler(this, true)
|
||||
findUsagesHandler.processElementUsages(
|
||||
this,
|
||||
{
|
||||
@@ -41,7 +41,7 @@ fun KtDeclaration.processAllUsages(
|
||||
options: FindUsagesOptions,
|
||||
processor: (UsageInfo) -> Unit
|
||||
) {
|
||||
val findUsagesHandler = KotlinFindUsagesHandlerFactory(project).createFindUsagesHandler(this, false, false)
|
||||
val findUsagesHandler = KotlinFindUsagesHandlerFactory(project).createFindUsagesHandler(this, true)
|
||||
findUsagesHandler.processElementUsages(
|
||||
this,
|
||||
{
|
||||
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.findUsages.handlers
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.find.findUsages.FindUsagesHandler
|
||||
|
||||
interface KotlinFindUsagesHandlerDecorator {
|
||||
companion object {
|
||||
val EP_NAME: ExtensionPointName<KotlinFindUsagesHandlerDecorator> = ExtensionPointName.create("org.jetbrains.kotlin.findUsagesHandlerDecorator")
|
||||
}
|
||||
|
||||
fun decorateHandler(element: PsiElement, forHighlightUsages: Boolean, delegate: FindUsagesHandler): FindUsagesHandler
|
||||
}
|
||||
Reference in New Issue
Block a user