01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.viewers;
11:
12: import java.util.Iterator;
13: import java.util.List;
14:
15: /**
16: * A selection containing elements.
17: */
18: public interface IStructuredSelection extends ISelection {
19: /**
20: * Returns the first element in this selection, or <code>null</code>
21: * if the selection is empty.
22: *
23: * @return an element, or <code>null</code> if none
24: */
25: public Object getFirstElement();
26:
27: /**
28: * Returns an iterator over the elements of this selection.
29: *
30: * @return an iterator over the selected elements
31: */
32: public Iterator iterator();
33:
34: /**
35: * Returns the number of elements selected in this selection.
36: *
37: * @return the number of elements selected
38: */
39: public int size();
40:
41: /**
42: * Returns the elements in this selection as an array.
43: *
44: * @return the selected elements as an array
45: */
46: public Object[] toArray();
47:
48: /**
49: * Returns the elements in this selection as a <code>List</code>.
50: *
51: * @return the selected elements as a list
52: */
53: public List toList();
54: }
|