### Eclipse Workspace Patch 1.0 #P org.eclipse.core.resources Index: src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java,v retrieving revision 1.22 diff -u -r1.22 AbstractDataTreeNode.java --- src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java 4 Apr 2006 20:53:47 -0000 1.22 +++ src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java 5 Oct 2009 14:16:40 -0000 @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.core.internal.dtree; +import java.lang.reflect.Field; + import org.eclipse.core.internal.utils.Messages; import org.eclipse.core.internal.utils.StringPool; import org.eclipse.core.runtime.IPath; @@ -43,6 +45,31 @@ * children of the new node */ AbstractDataTreeNode(String name, AbstractDataTreeNode[] children) { + //find out whether the String to add is actually a substring. + //if yes, then add a part string into the pool. Using introspection. + if (name!=null) { + try { + Class c = String.class; + Field fldValue = c.getDeclaredField("value"); //$NON-NLS-1$ + fldValue.setAccessible(true); + Object o = fldValue.get(name); + if (o!=null) { + char[] value = (char[])o; + if (value.length != name.length()) { + name= new String(name); + } + } + } catch(NoSuchFieldException e) { + /*ignore*/ + e.printStackTrace(); + } catch(IllegalAccessException e) { + /*ignore*/ + e.printStackTrace(); + } catch(Throwable t) { + /*ignore*/ + t.printStackTrace(); + } + } this.name = name; if (children == null || children.length == 0) this.children = AbstractDataTreeNode.NO_CHILDREN;