idea: cleanup code

This commit is contained in:
Dmitry Gridin
2019-12-13 22:11:25 +07:00
parent e77d8657f4
commit 8dbbd64beb
897 changed files with 13161 additions and 18514 deletions
@@ -1,17 +1,6 @@
/*
* 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.
* Copyright 2010-2019 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.j2k
@@ -31,14 +20,19 @@ import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.j2k.ReferenceSearcher
import java.util.*
object IdeaReferenceSearcher: ReferenceSearcher {
override fun findLocalUsages(element: PsiElement, scope: PsiElement) = ReferencesSearch.search(element, LocalSearchScope(scope)).findAll()
object IdeaReferenceSearcher : ReferenceSearcher {
override fun findLocalUsages(element: PsiElement, scope: PsiElement) =
ReferencesSearch.search(element, LocalSearchScope(scope)).findAll()
override fun hasInheritors(`class`: PsiClass) = ClassInheritorsSearch.search(`class`, false).any()
override fun hasOverrides(method: PsiMethod) = OverridingMethodsSearch.search(method, false).any()
override fun findUsagesForExternalCodeProcessing(element: PsiElement, searchJava: Boolean, searchKotlin: Boolean): Collection<PsiReference> {
override fun findUsagesForExternalCodeProcessing(
element: PsiElement,
searchJava: Boolean,
searchKotlin: Boolean
): Collection<PsiReference> {
val fileTypes = ArrayList<FileType>()
if (searchJava) {
fileTypes.add(JavaLanguage.INSTANCE.associatedFileType!!)
@@ -46,7 +40,8 @@ object IdeaReferenceSearcher: ReferenceSearcher {
if (searchKotlin) {
fileTypes.add(KotlinLanguage.INSTANCE.associatedFileType!!)
}
val searchScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(element.project), *fileTypes.toTypedArray())
val searchScope =
GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(element.project), *fileTypes.toTypedArray())
return ReferencesSearch.search(element, searchScope).findAll()
}
}