From 32a02359e934680b6481a36bd9813db5973bb756 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 4 May 2016 17:19:39 +0200 Subject: [PATCH] cleanup --- .../jetbrains/debugger/values/ObjectValue.kt | 4 ++-- .../debugger-ui/src/ValueGroupFactory.kt | 22 ------------------- .../debugger-ui/src/VariableView.kt | 10 ++++----- .../debugger-ui/src/VariablesGroup.kt | 8 +------ 4 files changed, 8 insertions(+), 36 deletions(-) delete mode 100644 platform/script-debugger/debugger-ui/src/ValueGroupFactory.kt diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/values/ObjectValue.kt b/platform/script-debugger/backend/src/org/jetbrains/debugger/values/ObjectValue.kt index f96a55dad535..b0dafeec3eef 100755 --- a/platform/script-debugger/backend/src/org/jetbrains/debugger/values/ObjectValue.kt +++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/values/ObjectValue.kt @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -39,7 +39,7 @@ interface ObjectValue : Value { * "to" could be -1 (sometimes length is unknown, so, you can pass -1 instead of actual elements size) */ - fun getIndexedProperties(from: Int, to: Int, bucketThreshold: Int, consumer: IndexedVariablesConsumer, componentType: ValueType?): Promise<*> + fun getIndexedProperties(from: Int, to: Int, bucketThreshold: Int, consumer: IndexedVariablesConsumer, componentType: ValueType? = null): Promise<*> /** * It must return quickly. Return [com.intellij.util.ThreeState.UNSURE] otherwise. diff --git a/platform/script-debugger/debugger-ui/src/ValueGroupFactory.kt b/platform/script-debugger/debugger-ui/src/ValueGroupFactory.kt deleted file mode 100644 index 489c0143bccb..000000000000 --- a/platform/script-debugger/debugger-ui/src/ValueGroupFactory.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2000-2016 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.debugger - -import com.intellij.xdebugger.frame.XValueGroup - -internal interface ValueGroupFactory { - fun create(data: T, start: Int, end: Int, context: VariableContext): XValueGroup -} \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/VariableView.kt b/platform/script-debugger/debugger-ui/src/VariableView.kt index b48f32562890..4bffc4914cce 100644 --- a/platform/script-debugger/debugger-ui/src/VariableView.kt +++ b/platform/script-debugger/debugger-ui/src/VariableView.kt @@ -198,18 +198,18 @@ class VariableView(override val variableName: String, private val variable: Vari override fun consumeRanges(ranges: IntArray?) { if (ranges == null) { val groupList = XValueChildrenList() - LazyVariablesGroup.addGroups(value, LazyVariablesGroup.GROUP_FACTORY, groupList, 0, value.length, XCompositeNode.MAX_CHILDREN_TO_SHOW, this@VariableView) + addGroups(value, ::lazyVariablesGroup, groupList, 0, value.length, XCompositeNode.MAX_CHILDREN_TO_SHOW, this@VariableView) node.addChildren(groupList, isLastChildren) } else { - LazyVariablesGroup.addRanges(value, ranges, node, this@VariableView, isLastChildren) + addRanges(value, ranges, node, this@VariableView, isLastChildren) } } override fun consumeVariables(variables: List) { node.addChildren(createVariablesList(variables, this@VariableView, null), isLastChildren) } - }, null) + }) } private fun computeNamedProperties(value: ObjectValue, node: XCompositeNode, isLastChildren: Boolean) = processVariables(this, value.properties, node) { memberFilter, variables -> @@ -254,7 +254,7 @@ class VariableView(override val variableName: String, private val variable: Vari val groupList = XValueChildrenList() if (count > 0) { - LazyVariablesGroup.addGroups(variables, GROUP_FACTORY, groupList, 0, count, bucketSize, this) + addGroups(variables, ::createArrayRangeGroup, groupList, 0, count, bucketSize, this) } var notGroupedVariablesOffset: Int @@ -268,7 +268,7 @@ class VariableView(override val variableName: String, private val variable: Vari } if (notGroupedVariablesOffset > 0) { - LazyVariablesGroup.addGroups(variables, GROUP_FACTORY, groupList, count, notGroupedVariablesOffset, bucketSize, this) + addGroups(variables, ::createArrayRangeGroup, groupList, count, notGroupedVariablesOffset, bucketSize, this) } } else { diff --git a/platform/script-debugger/debugger-ui/src/VariablesGroup.kt b/platform/script-debugger/debugger-ui/src/VariablesGroup.kt index 6f802713ce92..357e4b8d7a69 100644 --- a/platform/script-debugger/debugger-ui/src/VariablesGroup.kt +++ b/platform/script-debugger/debugger-ui/src/VariablesGroup.kt @@ -28,13 +28,7 @@ internal class VariablesGroup(private val start: Int, private val end: Int, priv } } -internal val GROUP_FACTORY: ValueGroupFactory> = object : ValueGroupFactory> { - override fun create(data: List, start: Int, end: Int, context: VariableContext): XValueGroup { - return createArrayRangeGroup(start, end, data, context) - } -} - -private fun createArrayRangeGroup(start: Int, end: Int, variables: List, variableContext: VariableContext): VariablesGroup { +internal fun createArrayRangeGroup(variables: List, start: Int, end: Int, variableContext: VariableContext): VariablesGroup { val name = "[" + variables[start].name + " \u2026 " + variables[end - 1].name + "]" return VariablesGroup(start, end, variables, variableContext, name) }