mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+3
-3
@@ -36,7 +36,7 @@ public class CustomPropertiesValuePresentation extends XValuePresentation {
|
||||
|
||||
@Override
|
||||
public void renderValue(@NotNull XValueTextRenderer renderer) {
|
||||
renderer.renderComment(VariableView.Companion.getObjectValueDescription(value));
|
||||
renderer.renderComment(VariableViewKt.getObjectValueDescription(value));
|
||||
renderer.renderSpecialSymbol(" {");
|
||||
boolean isFirst = true;
|
||||
for (Variable property : properties) {
|
||||
@@ -74,11 +74,11 @@ public class CustomPropertiesValuePresentation extends XValuePresentation {
|
||||
break;
|
||||
|
||||
case FUNCTION:
|
||||
renderer.renderComment(VariableView.Companion.trimFunctionDescription(value));
|
||||
renderer.renderComment(VariableViewKt.trimFunctionDescription(value));
|
||||
break;
|
||||
|
||||
case OBJECT:
|
||||
renderer.renderComment(VariableView.Companion.getObjectValueDescription((ObjectValue)value));
|
||||
renderer.renderComment(VariableViewKt.getObjectValueDescription((ObjectValue)value));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -338,17 +338,11 @@ class VariableView(name: String, private val variable: Variable, private val con
|
||||
}
|
||||
}
|
||||
|
||||
override fun getEvaluateContext(): EvaluateContext {
|
||||
return context.evaluateContext
|
||||
}
|
||||
override fun getEvaluateContext() = context.evaluateContext
|
||||
|
||||
fun getValue(): Value? {
|
||||
return variable.value
|
||||
}
|
||||
fun getValue() = variable.value
|
||||
|
||||
override fun canNavigateToSource(): Boolean {
|
||||
return value is FunctionValue || viewSupport.canNavigateToSource(variable, context)
|
||||
}
|
||||
override fun canNavigateToSource() = value is FunctionValue || viewSupport.canNavigateToSource(variable, context)
|
||||
|
||||
override fun computeSourcePosition(navigatable: XNavigatable) {
|
||||
if (value is FunctionValue) {
|
||||
@@ -403,9 +397,7 @@ class VariableView(name: String, private val variable: Variable, private val con
|
||||
}
|
||||
}
|
||||
|
||||
override fun computeInlineDebuggerData(callback: XInlineDebuggerDataCallback): ThreeState {
|
||||
return viewSupport.computeInlineDebuggerData(name, variable, context, callback)
|
||||
}
|
||||
override fun computeInlineDebuggerData(callback: XInlineDebuggerDataCallback) = viewSupport.computeInlineDebuggerData(name, variable, context, callback)
|
||||
|
||||
override fun getEvaluationExpression(): String? {
|
||||
if (!watchableAsEvaluationExpression()) {
|
||||
@@ -422,7 +414,6 @@ class VariableView(name: String, private val variable: Variable, private val con
|
||||
}
|
||||
|
||||
private class MyFullValueEvaluator(private val value: Value) : XFullValueEvaluator(if (value is StringValue) value.length else value.valueString.length()) {
|
||||
|
||||
override fun startEvaluation(callback: XFullValueEvaluator.XFullValueEvaluationCallback) {
|
||||
if (value !is StringValue || !value.isTruncated) {
|
||||
callback.evaluated(value.valueString)
|
||||
@@ -443,16 +434,6 @@ class VariableView(name: String, private val variable: Variable, private val con
|
||||
override fun getScope() = context.scope
|
||||
|
||||
companion object {
|
||||
fun getClassName(value: ObjectValue): String {
|
||||
val className = value.className
|
||||
return if (className.isNullOrEmpty()) "Object" else className!!
|
||||
}
|
||||
|
||||
fun getObjectValueDescription(value: ObjectValue): String {
|
||||
val description = value.valueString
|
||||
return if (StringUtil.isEmpty(description)) getClassName(value) else description
|
||||
}
|
||||
|
||||
fun setObjectPresentation(value: ObjectValue, icon: Icon, node: XValueNode) {
|
||||
node.setPresentation(icon, ObjectValuePresentation(getObjectValueDescription(value)), value.hasProperties() != ThreeState.NO)
|
||||
}
|
||||
@@ -492,22 +473,32 @@ class VariableView(name: String, private val variable: Variable, private val con
|
||||
else -> if (type.isObjectType) AllIcons.Debugger.Value else AllIcons.Debugger.Db_primitive
|
||||
}
|
||||
}
|
||||
|
||||
internal fun trimFunctionDescription(value: Value): String {
|
||||
val presentableValue = value.valueString ?: return ""
|
||||
|
||||
var endIndex = 0
|
||||
while (endIndex < presentableValue.length() && !StringUtil.isLineBreak(presentableValue.charAt(endIndex))) {
|
||||
endIndex++
|
||||
}
|
||||
while (endIndex > 0 && Character.isWhitespace(presentableValue.charAt(endIndex - 1))) {
|
||||
endIndex--
|
||||
}
|
||||
return presentableValue.substring(0, endIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getClassName(value: ObjectValue): String {
|
||||
val className = value.className
|
||||
return if (className.isNullOrEmpty()) "Object" else className!!
|
||||
}
|
||||
|
||||
fun getObjectValueDescription(value: ObjectValue): String {
|
||||
val description = value.valueString
|
||||
return if (description.isNullOrEmpty()) getClassName(value) else description
|
||||
}
|
||||
|
||||
internal fun trimFunctionDescription(value: Value): String {
|
||||
val presentableValue = value.valueString ?: return ""
|
||||
|
||||
var endIndex = 0
|
||||
while (endIndex < presentableValue.length() && !StringUtil.isLineBreak(presentableValue.charAt(endIndex))) {
|
||||
endIndex++
|
||||
}
|
||||
while (endIndex > 0 && Character.isWhitespace(presentableValue.charAt(endIndex - 1))) {
|
||||
endIndex--
|
||||
}
|
||||
return presentableValue.substring(0, endIndex)
|
||||
}
|
||||
|
||||
private fun createNumberPresentation(value: String): XValuePresentation {
|
||||
return if (value == PrimitiveValue.NA_N_VALUE || value == PrimitiveValue.INFINITY_VALUE) XKeywordValuePresentation(value) else XNumericValuePresentation(value)
|
||||
}
|
||||
|
||||
@@ -55,21 +55,21 @@ fun processScopeVariables(scope: Scope,
|
||||
node: XCompositeNode,
|
||||
context: VariableContext,
|
||||
isLast: Boolean): Promise<Void> {
|
||||
return processVariables(context, scope.variablesHost.get(), node, {memberFilter, variables ->
|
||||
val additionalVariables = memberFilter.additionalVariables
|
||||
val properties = ArrayList<Variable>(variables.size() + additionalVariables.size())
|
||||
val functions = SmartList<Variable>()
|
||||
for (variable in variables) {
|
||||
if (memberFilter.isMemberVisible(variable)) {
|
||||
val value = variable.value
|
||||
if (value != null && value.type == ValueType.FUNCTION && value.valueString != null && !UNNAMED_FUNCTION_PATTERN.matcher(value.valueString).lookingAt()) {
|
||||
functions.add(variable)
|
||||
}
|
||||
else {
|
||||
properties.add(variable)
|
||||
}
|
||||
return processVariables(context, scope.variablesHost.get(), node, { memberFilter, variables ->
|
||||
val additionalVariables = memberFilter.additionalVariables
|
||||
val properties = ArrayList<Variable>(variables.size() + additionalVariables.size())
|
||||
val functions = SmartList<Variable>()
|
||||
for (variable in variables) {
|
||||
if (memberFilter.isMemberVisible(variable)) {
|
||||
val value = variable.value
|
||||
if (value != null && value.type == ValueType.FUNCTION && value.valueString != null && !UNNAMED_FUNCTION_PATTERN.matcher(value.valueString).lookingAt()) {
|
||||
functions.add(variable)
|
||||
}
|
||||
else {
|
||||
properties.add(variable)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val comparator = if (memberFilter.hasNameMappings()) comparator { o1, o2 -> naturalCompare(memberFilter.rawNameToSource(o1), memberFilter.rawNameToSource(o2)) } else NATURAL_NAME_COMPARATOR
|
||||
properties.sort(comparator)
|
||||
|
||||
Reference in New Issue
Block a user