summaryrefslogtreecommitdiffstats
path: root/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2008-01-18 21:42:14 +0000
committerGrant Gayed <ggayed>2008-01-18 21:42:14 +0000
commit55d18b0633bb86ebc11d9fd5785d8989fd437832 (patch)
tree2b96c9c8653302eabd01ca814768a896d50b5250 /examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java
parent6b3f40fb94f6858bfa876ed525a9745360cf8cba (diff)
downloadeclipse.platform.swt-55d18b0633bb86ebc11d9fd5785d8989fd437832.tar.gz
eclipse.platform.swt-55d18b0633bb86ebc11d9fd5785d8989fd437832.tar.xz
eclipse.platform.swt-55d18b0633bb86ebc11d9fd5785d8989fd437832.zip
*** empty log message ***
Diffstat (limited to 'examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java')
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java
index 22bc34203f..7aee84e891 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java
@@ -50,9 +50,10 @@ public static void main(String[] args) {
button.setText ("Find '" + SEARCH_STRING + "'");
button.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event event) {
- TreeItem[] rootItems = tree.getItems ();
- for (int i = 0; i < rootItems.length; i++) {
- boolean success = find (rootItems[i], SEARCH_STRING);
+ int itemCount = tree.getItemCount ();
+ for (int i = 0; i < itemCount; i++) {
+ TreeItem item = tree.getItem (i);
+ boolean success = find (item, SEARCH_STRING);
if (success) {
System.out.println ("Found it");
return;
@@ -96,9 +97,10 @@ public static boolean find (TreeItem item, String searchString) {
if (!item.getExpanded ()) return false; /* don't check child items */
/* check child items */
- TreeItem[] children = item.getItems ();
- for (int i = 0; i < children.length; i++) {
- boolean success = find (children[i], searchString);
+ int childCount = item.getItemCount ();
+ for (int i = 0; i < childCount; i++) {
+ TreeItem child = item.getItem (i);
+ boolean success = find (child, searchString);
if (success) return true;
}