One more class rename

This commit is contained in:
Valentin Kipyatkov
2014-10-08 18:14:21 +04:00
parent a5223d8a38
commit 38a5b988f0
6 changed files with 13 additions and 13 deletions
@@ -74,7 +74,7 @@ private object KindWeigher : LookupElementWeigher("kotlin.kind") {
override fun weigh(element: LookupElement): Weight { override fun weigh(element: LookupElement): Weight {
val o = element.getObject() val o = element.getObject()
return when (o) { return when (o) {
is DeclarationLookupObject -> when (o.descriptor) { is DeclarationDescriptorLookupObject -> when (o.descriptor) {
is LocalVariableDescriptor, is ValueParameterDescriptor -> Weight.localOrParameter is LocalVariableDescriptor, is ValueParameterDescriptor -> Weight.localOrParameter
is PropertyDescriptor -> Weight.property is PropertyDescriptor -> Weight.property
is PackageViewDescriptor -> Weight.packages is PackageViewDescriptor -> Weight.packages
@@ -91,7 +91,7 @@ private object KindWeigher : LookupElementWeigher("kotlin.kind") {
private object DeprecatedWeigher : LookupElementWeigher("kotlin.deprecated") { private object DeprecatedWeigher : LookupElementWeigher("kotlin.deprecated") {
override fun weigh(element: LookupElement): Int { override fun weigh(element: LookupElement): Int {
val o = element.getObject() val o = element.getObject()
return if (o is DeclarationLookupObject && KotlinBuiltIns.getInstance().isDeprecated(o.descriptor)) 1 else 0 return if (o is DeclarationDescriptorLookupObject && KotlinBuiltIns.getInstance().isDeprecated(o.descriptor)) 1 else 0
} }
} }
@@ -115,7 +115,7 @@ private class JetDeclarationRemotenessWeigher(private val file: JetFile) : Looku
override fun weigh(element: LookupElement): Weight { override fun weigh(element: LookupElement): Weight {
val o = element.getObject() val o = element.getObject()
if (o is DeclarationLookupObject) { if (o is DeclarationDescriptorLookupObject) {
val elementFile = o.psiElement?.getContainingFile() val elementFile = o.psiElement?.getContainingFile()
if (elementFile is JetFile && elementFile.getOriginalFile() == file) { if (elementFile is JetFile && elementFile.getOriginalFile() == file) {
return Weight.thisFile return Weight.thisFile
@@ -25,7 +25,7 @@ import org.jetbrains.jet.lang.resolve.lazy.KotlinCodeAnalyzer
* Stores information about resolved descriptor and position of that descriptor. * Stores information about resolved descriptor and position of that descriptor.
* Position will be used for sorting * Position will be used for sorting
*/ */
public class DeclarationLookupObject(public val descriptor: DeclarationDescriptor, private val analyzer: KotlinCodeAnalyzer, public val psiElement: PsiElement?) { public class DeclarationDescriptorLookupObject(public val descriptor: DeclarationDescriptor, private val analyzer: KotlinCodeAnalyzer, public val psiElement: PsiElement?) {
override fun toString(): String { override fun toString(): String {
return super.toString() + " " + descriptor return super.toString() + " " + descriptor
} }
@@ -38,7 +38,7 @@ public class DeclarationLookupObject(public val descriptor: DeclarationDescripto
if (this identityEquals other) return true if (this identityEquals other) return true
if (other == null || javaClass != other.javaClass) return false if (other == null || javaClass != other.javaClass) return false
val lookupObject = other as DeclarationLookupObject val lookupObject = other as DeclarationDescriptorLookupObject
if (analyzer != lookupObject.analyzer) { if (analyzer != lookupObject.analyzer) {
LOG.warn("Descriptors from different resolve sessions") LOG.warn("Descriptors from different resolve sessions")
@@ -49,6 +49,6 @@ public class DeclarationLookupObject(public val descriptor: DeclarationDescripto
} }
class object { class object {
private val LOG = Logger.getInstance("#" + javaClass<DeclarationLookupObject>().getName()) private val LOG = Logger.getInstance("#" + javaClass<DeclarationDescriptorLookupObject>().getName())
} }
} }
@@ -65,7 +65,7 @@ public object KotlinLookupElementFactory {
} }
val name = descriptor.getName().asString() val name = descriptor.getName().asString()
var element = LookupElementBuilder.create(DeclarationLookupObject(descriptor, analyzer, declaration), name) var element = LookupElementBuilder.create(DeclarationDescriptorLookupObject(descriptor, analyzer, declaration), name)
var presentableText = name var presentableText = name
var typeText = "" var typeText = ""
@@ -19,13 +19,13 @@ package org.jetbrains.jet.plugin.completion.handlers
import com.intellij.codeInsight.completion.InsertHandler import com.intellij.codeInsight.completion.InsertHandler
import com.intellij.codeInsight.lookup.LookupElement import com.intellij.codeInsight.lookup.LookupElement
import com.intellij.codeInsight.completion.InsertionContext import com.intellij.codeInsight.completion.InsertionContext
import org.jetbrains.jet.plugin.completion.DeclarationLookupObject import org.jetbrains.jet.plugin.completion.DeclarationDescriptorLookupObject
import com.intellij.openapi.util.TextRange import com.intellij.openapi.util.TextRange
import org.jetbrains.jet.plugin.util.IdeDescriptorRenderers import org.jetbrains.jet.plugin.util.IdeDescriptorRenderers
open class BaseDeclarationInsertHandler : InsertHandler<LookupElement> { open class BaseDeclarationInsertHandler : InsertHandler<LookupElement> {
override fun handleInsert(context: InsertionContext, item: LookupElement) { override fun handleInsert(context: InsertionContext, item: LookupElement) {
val descriptor = (item.getObject() as? DeclarationLookupObject)?.descriptor val descriptor = (item.getObject() as? DeclarationDescriptorLookupObject)?.descriptor
if (descriptor != null) { if (descriptor != null) {
val name = descriptor.getName() val name = descriptor.getName()
val nameInCode = IdeDescriptorRenderers.SOURCE_CODE.renderName(name) val nameInCode = IdeDescriptorRenderers.SOURCE_CODE.renderName(name)
@@ -34,7 +34,7 @@ import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper
import com.intellij.openapi.editor.Document import com.intellij.openapi.editor.Document
import org.jetbrains.jet.lang.types.JetType import org.jetbrains.jet.lang.types.JetType
import com.intellij.openapi.util.TextRange import com.intellij.openapi.util.TextRange
import org.jetbrains.jet.plugin.completion.DeclarationLookupObject import org.jetbrains.jet.plugin.completion.DeclarationDescriptorLookupObject
import org.jetbrains.jet.lang.descriptors.CallableDescriptor import org.jetbrains.jet.lang.descriptors.CallableDescriptor
import org.jetbrains.jet.lang.psi.JetBinaryExpression import org.jetbrains.jet.lang.psi.JetBinaryExpression
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression import org.jetbrains.jet.lang.psi.JetSimpleNameExpression
@@ -57,7 +57,7 @@ public abstract class JetCallableInsertHandler : BaseDeclarationInsertHandler()
val file = context.getFile() val file = context.getFile()
val o = item.getObject() val o = item.getObject()
if (file is JetFile && o is DeclarationLookupObject) { if (file is JetFile && o is DeclarationDescriptorLookupObject) {
val descriptor = o.descriptor as? CallableDescriptor val descriptor = o.descriptor as? CallableDescriptor
if (descriptor != null) { if (descriptor != null) {
if (PsiTreeUtil.getParentOfType(element, javaClass<JetQualifiedExpression>()) != null && if (PsiTreeUtil.getParentOfType(element, javaClass<JetQualifiedExpression>()) != null &&
@@ -22,7 +22,7 @@ import com.intellij.openapi.editor.Document
import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiDocumentManager
import org.jetbrains.jet.lang.psi.JetFile import org.jetbrains.jet.lang.psi.JetFile
import org.jetbrains.jet.plugin.codeInsight.ShortenReferences import org.jetbrains.jet.plugin.codeInsight.ShortenReferences
import org.jetbrains.jet.plugin.completion.DeclarationLookupObject import org.jetbrains.jet.plugin.completion.DeclarationDescriptorLookupObject
import org.jetbrains.jet.lang.descriptors.ClassDescriptor import org.jetbrains.jet.lang.descriptors.ClassDescriptor
import org.jetbrains.jet.plugin.completion.qualifiedNameForSourceCode import org.jetbrains.jet.plugin.completion.qualifiedNameForSourceCode
@@ -32,7 +32,7 @@ public object KotlinClassInsertHandler : BaseDeclarationInsertHandler() {
val file = context.getFile() val file = context.getFile()
if (file is JetFile) { if (file is JetFile) {
val descriptor = (item.getObject() as DeclarationLookupObject).descriptor as ClassDescriptor val descriptor = (item.getObject() as DeclarationDescriptorLookupObject).descriptor as ClassDescriptor
val startOffset = context.getStartOffset() val startOffset = context.getStartOffset()
val document = context.getDocument() val document = context.getDocument()
if (!isAfterDot(document, startOffset)) { if (!isAfterDot(document, startOffset)) {