Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » IStructuredSelection not Iterable
IStructuredSelection not Iterable [message #630040] Thu, 30 September 2010 13:20 Go to next message
Eclipse UserFriend
Originally posted by: christian.buergi.post.ch

Hi,

I was doing some work with selections today when I was wondering why the
IStructuredSelection interface does not extend the Iterable interface
since it already contains the iterator() method.

It would be much more handy to use it an a foreach loop:

IStructuredSelection selection = page.getSelection();
for (Object element : selection) {
// do stuff with each element
}

I know I could use the toList() or toArray() methods but why use those
conversions if there would be an easier/more readable way.

Regards,
Christian
Re: IStructuredSelection not Iterable [message #630041 is a reply to message #630040] Thu, 30 September 2010 13:22 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
We can't because Iterable is Java 5

Tom

Am 30.09.10 15:20, schrieb Christian Buergi:
> Hi,
>
> I was doing some work with selections today when I was wondering why the
> IStructuredSelection interface does not extend the Iterable interface
> since it already contains the iterator() method.
>
> It would be much more handy to use it an a foreach loop:
>
> IStructuredSelection selection = page.getSelection();
> for (Object element : selection) {
> // do stuff with each element
> }
>
> I know I could use the toList() or toArray() methods but why use those
> conversions if there would be an easier/more readable way.
>
> Regards,
> Christian
Previous Topic:add a TextModifyListener for each cell in a JFAce TableViewer
Next Topic:hide a Dialog without disposing it
Goto Forum:
  


Current Time: Wed Apr 24 20:59:29 GMT 2024

Powered by FUDForum. Page generated in 0.03225 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top