Package org.eclipse.jface.viewers
Class ComboViewer
java.lang.Object
org.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.jface.viewers.StructuredViewer
org.eclipse.jface.viewers.AbstractListViewer
org.eclipse.jface.viewers.ComboViewer
- All Implemented Interfaces:
- IInputProvider,- IInputSelectionProvider,- IPostSelectionProvider,- ISelectionProvider
A concrete viewer based either on an SWT 
Combo control or CCombo
 control. This class is intended as an alternative to the JFace ListViewer, which displays
 its content in a combo box rather than a list. Wherever possible, this class attempts to behave
 like ListViewer. This class is designed to be instantiated with a pre-existing SWT combo control and configured with a domain-specific content provider, label provider, element filter (optional), and element sorter (optional).
- Since:
- 3.0 (made non-final in 3.4)
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.eclipse.jface.viewers.StructuredViewerStructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
- 
Field SummaryFields inherited from class org.eclipse.jface.viewers.ViewerWIDGET_DATA_KEY
- 
Constructor SummaryConstructorsConstructorDescriptionComboViewer(CCombo list) Creates a combo viewer on the given CCombo control.ComboViewer(Combo list) Creates a combo viewer on the given combo control.ComboViewer(Composite parent) Creates a combo viewer on a newly-created combo control under the given parent.ComboViewer(Composite parent, int style) Creates a combo viewer on a newly-created combo control under the given parent.
- 
Method SummaryModifier and TypeMethodDescriptionReturns this list viewer's list control.getCombo()Returns this list viewer's list control.Returns the primary control associated with this viewer.protected voidAdds the given string to the underlying widget at the given indexprotected voidDeselects all selected items in the underlying widget.protected intReturns the number of items contained in the underlying widget.protected int[]Returns the zero-relative indices of the items which are currently selected in the underlying widget.protected voidlistRemove(int index) Removes the item from the underlying widget at the given zero-relative index.protected voidRemoves all of the items from the underlying widget.protected voidlistSetItem(int index, String string) Sets the text of the item at the given index in the underlying widget.protected voidlistSetItems(String[] labels) Sets the underlying widget's items to be the given array of items.protected voidlistSetSelection(int[] ixs) Selects the items at the given zero-relative indices in the underlying widget.protected voidShows the selection.voidEnsures that the given element is visible, scrolling the viewer if necessary.Methods inherited from class org.eclipse.jface.viewers.AbstractListVieweradd, add, doFindInputItem, doFindItem, doUpdateItem, getElementAt, getLabelProvider, getSelectionFromWidget, indexForElement, inputChanged, insert, internalRefresh, listGetTopIndex, listSetTopIndex, remove, remove, setLabelProvider, setSelectionToWidgetMethods inherited from class org.eclipse.jface.viewers.StructuredVieweraddDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertContentProviderType, assertElementsNotNull, associate, buildLabel, disassociate, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getItem, getRawChildren, getRoot, getSelection, getSortedChildren, getSorter, getStructuredSelection, handleDispose, handleDoubleSelect, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, hookControl, internalRefresh, internalUpdate, mapElement, needsRefilter, preservingSelection, refresh, refresh, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setContentProvider, setFilters, setInput, setSelection, setSelectionToWidget, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, update, updateItem, updateSelection, usingElementMapMethods inherited from class org.eclipse.jface.viewers.ContentViewergetContentProvider, getInput, labelProviderChangedMethods inherited from class org.eclipse.jface.viewers.VieweraddHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelectionMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.viewers.ISelectionProvideraddSelectionChangedListener, removeSelectionChangedListener, setSelection
- 
Constructor Details- 
ComboViewerCreates a combo viewer on a newly-created combo control under the given parent. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.- Parameters:
- parent- the parent control
 
- 
ComboViewerCreates a combo viewer on a newly-created combo control under the given parent. The combo control is created using the given SWT style bits. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.- Parameters:
- parent- the parent control
- style- the SWT style bits
 
- 
ComboViewerCreates a combo viewer on the given combo control. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.- Parameters:
- list- the combo control
 
- 
ComboViewerCreates a combo viewer on the given CCombo control. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.- Parameters:
- list- the CCombo control
- Since:
- 3.3
 
 
- 
- 
Method Details- 
listAddDescription copied from class:AbstractListViewerAdds the given string to the underlying widget at the given index- Specified by:
- listAddin class- AbstractListViewer
- Parameters:
- string- the string to add
- index- position to insert the string into
 
- 
listSetItemDescription copied from class:AbstractListViewerSets the text of the item at the given index in the underlying widget.- Specified by:
- listSetItemin class- AbstractListViewer
- Parameters:
- index- index to modify
- string- new text
 
- 
listGetSelectionIndicesprotected int[] listGetSelectionIndices()Description copied from class:AbstractListViewerReturns the zero-relative indices of the items which are currently selected in the underlying widget. The array is empty if no items are selected.Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver. - Specified by:
- listGetSelectionIndicesin class- AbstractListViewer
- Returns:
- the array of indices of the selected items
 
- 
listGetItemCountprotected int listGetItemCount()Description copied from class:AbstractListViewerReturns the number of items contained in the underlying widget.- Specified by:
- listGetItemCountin class- AbstractListViewer
- Returns:
- the number of items
 
- 
listSetItemsDescription copied from class:AbstractListViewerSets the underlying widget's items to be the given array of items.- Specified by:
- listSetItemsin class- AbstractListViewer
- Parameters:
- labels- the array of label text
 
- 
listRemoveAllprotected void listRemoveAll()Description copied from class:AbstractListViewerRemoves all of the items from the underlying widget.- Specified by:
- listRemoveAllin class- AbstractListViewer
 
- 
listRemoveprotected void listRemove(int index) Description copied from class:AbstractListViewerRemoves the item from the underlying widget at the given zero-relative index.- Specified by:
- listRemovein class- AbstractListViewer
- Parameters:
- index- the index for the item
 
- 
getControlDescription copied from class:ViewerReturns the primary control associated with this viewer.- Specified by:
- getControlin class- Viewer
- Returns:
- the SWT control which displays this viewer's content
 
- 
getCComboReturns this list viewer's list control. If the viewer was not created on a CCombo control, some kind of unchecked exception is thrown.- Returns:
- the list control
- Since:
- 3.3
 
- 
getComboReturns this list viewer's list control. If the viewer was not created on a Combo control, some kind of unchecked exception is thrown.- Returns:
- the list control
 
- 
revealDescription copied from class:StructuredViewerEnsures that the given element is visible, scrolling the viewer if necessary. The selection is unchanged.- Specified by:
- revealin class- StructuredViewer
- Parameters:
- element- the element to reveal
 
- 
listSetSelectionprotected void listSetSelection(int[] ixs) Description copied from class:AbstractListViewerSelects the items at the given zero-relative indices in the underlying widget. The current selection is cleared before the new items are selected.Indices that are out of range and duplicate indices are ignored. If the receiver is single-select and multiple indices are specified, then all indices are ignored. - Specified by:
- listSetSelectionin class- AbstractListViewer
- Parameters:
- ixs- the indices of the items to select
 
- 
listDeselectAllprotected void listDeselectAll()Description copied from class:AbstractListViewerDeselects all selected items in the underlying widget.- Specified by:
- listDeselectAllin class- AbstractListViewer
 
- 
listShowSelectionprotected void listShowSelection()Description copied from class:AbstractListViewerShows the selection. If the selection is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled until the selection is visible.- Specified by:
- listShowSelectionin class- AbstractListViewer
 
 
-