mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
limit long string labels in debugger tree to save memory
This commit is contained in:
+14
-3
@@ -49,6 +49,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
|
||||
private boolean myIsDirty = false;
|
||||
private boolean myIsLvalue = false;
|
||||
private boolean myIsExpandable;
|
||||
public static final int MAX_DISPLAY_LABEL_LENGTH = 128;
|
||||
|
||||
protected ValueDescriptorImpl(Project project, Value value) {
|
||||
myProject = project;
|
||||
@@ -217,14 +218,24 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
|
||||
buf.append("null");
|
||||
}
|
||||
else {
|
||||
if(label.length() > 1 && StringUtil.startsWithChar(label, '\"') && StringUtil.endsWithChar(label, '\"')) {
|
||||
buf.append('"');
|
||||
buf.append(DebuggerUtils.translateStringValue(label.substring(1, label.length() - 1)));
|
||||
final boolean isQuoted = label.length() > 1 && StringUtil.startsWithChar(label, '\"') && StringUtil.endsWithChar(label, '\"');
|
||||
if(isQuoted) {
|
||||
label = label.substring(1, label.length() - 1);
|
||||
buf.append('"');
|
||||
}
|
||||
if (label.length() > MAX_DISPLAY_LABEL_LENGTH) {
|
||||
label = DebuggerUtils.translateStringValue(label.substring(0, MAX_DISPLAY_LABEL_LENGTH));
|
||||
buf.append(label);
|
||||
if (!label.endsWith("...")) {
|
||||
buf.append("...");
|
||||
}
|
||||
}
|
||||
else {
|
||||
buf.append(DebuggerUtils.translateStringValue(label));
|
||||
}
|
||||
if (isQuoted) {
|
||||
buf.append('"');
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user