summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine <veronika>2005-10-28 13:18:05 +0000
committerVeronika Irvine <veronika>2005-10-28 13:18:05 +0000
commit2cd9c142b2dc2cb5847c910c44c758dfcfaf6ef3 (patch)
treea2bcdd2b8118bae30aa5b0fc361f32bd236cb99a
parentee11fd0610769b9b84a88ab68cd8960b0a48f280 (diff)
downloadeclipse.platform.swt-2cd9c142b2dc2cb5847c910c44c758dfcfaf6ef3.tar.gz
eclipse.platform.swt-2cd9c142b2dc2cb5847c910c44c758dfcfaf6ef3.tar.xz
eclipse.platform.swt-2cd9c142b2dc2cb5847c910c44c758dfcfaf6ef3.zip
Bug 113971 must update item count before creating item in OS
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java5
2 files changed, 4 insertions, 6 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 faed9943bf..9843bb57e1 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,7 +704,8 @@ 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 () && parentItem.itemCount > 0)) {
+ if (parentItem != null) parentItem.itemCount++;
+ if (parentItem == null || (parentItem.getExpanded ())) {
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;
@@ -718,7 +719,7 @@ void createItem (TreeItem item, TreeItem parentItem, int index) {
* added and the parent is not expanded, the parent does not
* redraw to show the expander. The fix is to force a redraw.
*/
- if (count == 0 && parentItem != null) parentItem.redraw (OS.kDataBrowserNoItem);
+ if (parentItem != null && parentItem.itemCount == 1) parentItem.redraw (OS.kDataBrowserNoItem);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java
index 192ad17410..b3b0c15d47 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java
@@ -187,10 +187,7 @@ TreeItem (Tree parent, TreeItem parentItem, int style, int index, boolean create
super (parent, style);
this.parent = parent;
this.parentItem = parentItem;
- if (create) {
- parent.createItem (this, parentItem, index);
- if (parentItem != null) parentItem.itemCount++;
- }
+ if (create) parent.createItem (this, parentItem, index);
}
boolean _getExpanded () {