diff options
author | Silenio Quarti <silenio> | 2010-08-16 14:48:49 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2010-08-16 14:48:49 +0000 |
commit | acc96943d4c5e1e9a48afc4b1dff1cffe30a9357 (patch) | |
tree | 389797ba9d08317298a68695c2506601bd2b2fbf | |
parent | cf946632967ea42c42e2aa22ad07e460d1dcb4c8 (diff) | |
download | eclipse.platform.swt-acc96943d4c5e1e9a48afc4b1dff1cffe30a9357.tar.gz eclipse.platform.swt-acc96943d4c5e1e9a48afc4b1dff1cffe30a9357.tar.xz eclipse.platform.swt-acc96943d4c5e1e9a48afc4b1dff1cffe30a9357.zip |
Bug 309269 - [Widgets] Table selection event does not return a correct table item (back port to 3.6.x)
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java | 2 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java index 1ccddb446c..d4b58327e3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java @@ -2208,6 +2208,8 @@ int itemNotificationProc (int browser, int id, int message) { selected = true; } else { selected = first [0] == last [0]; + index = getIndex (last [0]); + if (0 <= index && index < items.length) item = _getItem (index); } } } else { 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 075b92bd5d..b499f4eb0f 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 @@ -2348,6 +2348,7 @@ int itemNotificationProc (int browser, int id, int message) { case OS.kDataBrowserItemDeselected: { wasSelected = true; if (ignoreSelect) break; + int selectedId = id; int [] first = new int [1], last = new int [1]; OS.GetDataBrowserSelectionAnchor (handle, first, last); boolean selected = false; @@ -2364,6 +2365,7 @@ int itemNotificationProc (int browser, int id, int message) { selected = true; } else { selected = first [0] == last [0]; + if (last [0] != 0) selectedId = last [0]; } } } else { @@ -2373,7 +2375,7 @@ int itemNotificationProc (int browser, int id, int message) { anchorFirst = first [0]; anchorLast = last [0]; Event event = new Event (); - event.item = _getItem (id, true); + event.item = _getItem (selectedId, true); sendSelectionEvent (SWT.Selection, event, false); } break; |