From b30ac38a2ab6ddaf08ab3e2e339263f0f83a21bb Mon Sep 17 00:00:00 2001 From: John Cortell Date: Fri, 2 Oct 2009 03:32:14 +0000 Subject: [PATCH] [291144] Stringification of VMDelta doesn't reflect delta hierarchy --- .../eclipse/cdt/dsf/ui/viewmodel/VMDelta.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/VMDelta.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/VMDelta.java index dc03d951151..c8b9f16c4ce 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/VMDelta.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/VMDelta.java @@ -271,18 +271,22 @@ public class VMDelta extends ModelDelta { @Override public String toString() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("Model Delta Start\n"); //$NON-NLS-1$ - appendDetail(buf, this); + appendDetail(buf, this, 0); buf.append("Model Delta End\n"); //$NON-NLS-1$ return buf.toString(); } - private void appendDetail(StringBuffer buf, VMDelta delta) { - buf.append("\tElement: "); //$NON-NLS-1$ + private void appendDetail(StringBuilder buf, VMDelta delta, int depth) { + String indent = new String(); + for (int i = 0; i < depth; i++) { + indent += '\t'; + } + buf.append(indent + "\tElement: "); //$NON-NLS-1$ buf.append(delta.getElement()); buf.append('\n'); - buf.append("\t\tFlags: "); //$NON-NLS-1$ + buf.append(indent + "\t\tFlags: "); //$NON-NLS-1$ int flags = delta.getFlags(); if (flags == 0) { buf.append("NO_CHANGE"); //$NON-NLS-1$ @@ -319,14 +323,14 @@ public class VMDelta extends ModelDelta { } } buf.append('\n'); - buf.append("\t\tIndex: "); //$NON-NLS-1$ + buf.append(indent + "\t\tIndex: "); //$NON-NLS-1$ buf.append(delta.fIndex); buf.append(" Child Count: "); //$NON-NLS-1$ buf.append(delta.fChildCount); buf.append('\n'); IModelDelta[] nodes = delta.getChildDeltas(); for (int i = 0; i < nodes.length; i++) { - appendDetail(buf, (VMDelta)nodes[i]); + appendDetail(buf, (VMDelta)nodes[i], depth+1); } }