summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine <veronika>2005-10-27 20:45:49 +0000
committerVeronika Irvine <veronika>2005-10-27 20:45:49 +0000
commit30d64d862c2391ce0e5603549fa1ca6337efe7ff (patch)
tree882d5c4c5d4e52b7d7eddabd8d5ff1ac8a0c3ec8
parent96df9e0eaa4a94a9fbd54b02ae5e553202506f01 (diff)
downloadeclipse.platform.swt-30d64d862c2391ce0e5603549fa1ca6337efe7ff.tar.gz
eclipse.platform.swt-30d64d862c2391ce0e5603549fa1ca6337efe7ff.tar.xz
eclipse.platform.swt-30d64d862c2391ce0e5603549fa1ca6337efe7ff.zip
Bug 113971 creating first child of node when getExpanded(true) has been called on node with no children causes an error
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
index bd3c4310a6..faed9943bf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
@@ -704,11 +704,11 @@ void createItem (TreeItem item, TreeItem parentItem, int index) {
}
System.arraycopy (ids, index, ids, index + 1, ids.length - index - 1);
ids [index] = id;
- if (parentItem == null || parentItem.getExpanded ()) {
+ if (parentItem == null || (parentItem.getExpanded () && parentItem.itemCount > 0)) {
int parentID = parentItem == null ? OS.kDataBrowserNoItem : parentItem.id;
if (OS.AddDataBrowserItems (handle, parentID, 1, new int [] {item.id}, OS.kDataBrowserItemNoProperty) != OS.noErr) {
items [id - 1] = null;
- System.arraycopy (ids, index+1, ids, index, ids.length - index);
+ System.arraycopy (ids, index+1, ids, index, ids.length - index - 1);
error (SWT.ERROR_ITEM_NOT_ADDED);
}
visibleCount++;