Lines 10-15
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.core.internal.dtree; |
11 |
package org.eclipse.core.internal.dtree; |
12 |
|
12 |
|
|
|
13 |
import java.lang.reflect.Field; |
14 |
|
13 |
import org.eclipse.core.internal.utils.Messages; |
15 |
import org.eclipse.core.internal.utils.Messages; |
14 |
import org.eclipse.core.internal.utils.StringPool; |
16 |
import org.eclipse.core.internal.utils.StringPool; |
15 |
import org.eclipse.core.runtime.IPath; |
17 |
import org.eclipse.core.runtime.IPath; |
Lines 43-48
Link Here
|
43 |
* children of the new node |
45 |
* children of the new node |
44 |
*/ |
46 |
*/ |
45 |
AbstractDataTreeNode(String name, AbstractDataTreeNode[] children) { |
47 |
AbstractDataTreeNode(String name, AbstractDataTreeNode[] children) { |
|
|
48 |
//find out whether the String to add is actually a substring. |
49 |
//if yes, then add a part string into the pool. Using introspection. |
50 |
if (name!=null) { |
51 |
try { |
52 |
Class c = String.class; |
53 |
Field fldValue = c.getDeclaredField("value"); //$NON-NLS-1$ |
54 |
fldValue.setAccessible(true); |
55 |
Object o = fldValue.get(name); |
56 |
if (o!=null) { |
57 |
char[] value = (char[])o; |
58 |
if (value.length != name.length()) { |
59 |
name= new String(name); |
60 |
} |
61 |
} |
62 |
} catch(NoSuchFieldException e) { |
63 |
/*ignore*/ |
64 |
e.printStackTrace(); |
65 |
} catch(IllegalAccessException e) { |
66 |
/*ignore*/ |
67 |
e.printStackTrace(); |
68 |
} catch(Throwable t) { |
69 |
/*ignore*/ |
70 |
t.printStackTrace(); |
71 |
} |
72 |
} |
46 |
this.name = name; |
73 |
this.name = name; |
47 |
if (children == null || children.length == 0) |
74 |
if (children == null || children.length == 0) |
48 |
this.children = AbstractDataTreeNode.NO_CHILDREN; |
75 |
this.children = AbstractDataTreeNode.NO_CHILDREN; |