tree.indexOf() always returning -1 [message #455194] |
Tue, 10 May 2005 08:52 |
Eclipse User |
|
|
|
Originally posted by: CupertinoIndian.yahoo.com
I created a tree structure with depth 4 or 5. I am trying to find the
index of the item selected and I am always getting -1. Any ideas?
TreeItem[] treeItem = tree.getSelection();
if(treeItem != null && treeItem.length >= 0)
{
int index = tree.indexOf(treeItem[0]);
// index is always -1 ???
}
|
|
|
|
Re: tree.indexOf() always returning -1 [message #455255 is a reply to message #455248] |
Wed, 11 May 2005 05:07 |
Eclipse User |
|
|
|
Originally posted by: CupertinoIndian.yahoo.com
Ooh, I see. Thanks for information. I guess I need to iterate through
the whole tree to find the real location...unless somebody has better idea.
Steve Northover wrote:
> Tree.indexOf() only returns the index of the direct children of a node. Is
> that what you are seeing?
>
> "Cupertino Indian" <CupertinoIndian@yahoo.com> wrote in message
> news:d5pt64$f9b$1@news.eclipse.org...
>
>>I created a tree structure with depth 4 or 5. I am trying to find the
>>index of the item selected and I am always getting -1. Any ideas?
>>
>>TreeItem[] treeItem = tree.getSelection();
>>if(treeItem != null && treeItem.length >= 0)
>>{
>>int index = tree.indexOf(treeItem[0]);
>>// index is always -1 ???
>>}
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02160 seconds