public class StructuredSelection extends Object implements IStructuredSelection
IStructuredSelection interface,
suitable for instantiating.
This class is not intended to be subclassed.
| Modifier and Type | Field and Description |
|---|---|
static StructuredSelection |
EMPTY
The canonical empty selection.
|
| Constructor and Description |
|---|
StructuredSelection()
Creates a new empty selection.
|
StructuredSelection(List elements)
Creates a structured selection from the given
List. |
StructuredSelection(List elements,
IElementComparer comparer)
Creates a structured selection from the given
List and
element comparer. |
StructuredSelection(Object element)
Creates a structured selection containing a single object.
|
StructuredSelection(Object[] elements)
Creates a structured selection from the given elements.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Returns whether this structured selection is equal to the given object.
|
Object |
getFirstElement()
Returns the first element in this selection, or
null
if the selection is empty. |
boolean |
isEmpty()
Returns whether this selection is empty.
|
Iterator |
iterator()
Returns an iterator over the elements of this selection.
|
int |
size()
Returns the number of elements selected in this selection.
|
Object[] |
toArray()
Returns the elements in this selection as an array.
|
List |
toList()
Returns the elements in this selection as a
List. |
String |
toString()
Internal method which returns a string representation of this
selection suitable for debug purposes only.
|
public static final StructuredSelection EMPTY
null.public StructuredSelection()
EMPTY which contains an empty selection singleton.EMPTYpublic StructuredSelection(Object[] elements)
null.elements - an array of elementspublic StructuredSelection(Object element)
null.element - the elementpublic StructuredSelection(List elements)
List.elements - list of selected elementspublic StructuredSelection(List elements, IElementComparer comparer)
List and
element comparer. If an element comparer is provided, it will be used to
determine equality between structured selection objects provided that
they both are based on the same (identical) comparer. See bugelements - list of selected elementscomparer - the comparer, or nullpublic boolean equals(Object o)
public Object getFirstElement()
IStructuredSelectionnull
if the selection is empty.getFirstElement in interface IStructuredSelectionnull if nonepublic boolean isEmpty()
ISelectionisEmpty in interface ISelectiontrue if this selection is empty,
and false otherwisepublic Iterator iterator()
IStructuredSelectioniterator in interface IStructuredSelectionpublic int size()
IStructuredSelectionsize in interface IStructuredSelectionpublic Object[] toArray()
IStructuredSelectiontoArray in interface IStructuredSelectionpublic List toList()
IStructuredSelectionList.
Note In the default implementation of IStructuredSelection.toList() in
StructuredSelection the returned list is not a copy of the elements of the
receiver and modifying it will modify the contents of the selection.toList in interface IStructuredSelection
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.