public final class ComboViewer extends AbstractListViewer
Combo 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).
ListViewerStructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProvidersWIDGET_DATA_KEY| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
Combo |
getCombo()
Returns this list viewer's list control.
|
Control |
getControl()
Returns the primary control associated with this viewer.
|
protected void |
listAdd(String string,
int index)
Adds the given string to the underlying widget at the given index
|
protected void |
listDeselectAll()
Deselects all selected items in the underlying widget.
|
protected int |
listGetItemCount()
Returns the number of items contained in the underlying widget.
|
protected int[] |
listGetSelectionIndices()
Returns the zero-relative indices of the items which are currently
selected in the underlying widget.
|
protected void |
listRemove(int index)
Removes the item from the underlying widget at the given
zero-relative index.
|
protected void |
listRemoveAll()
Removes all of the items from the underlying widget.
|
protected void |
listSetItem(int index,
String string)
Sets the text of the item at the given index in the underlying widget.
|
protected void |
listSetItems(String[] labels)
Sets the underlying widget's items to be the given array of items.
|
protected void |
listSetSelection(int[] ixs)
Selects the items at the given zero-relative indices in the underlying widget.
|
protected void |
listShowSelection()
Shows the selection.
|
void |
reveal(Object element)
Ensures that the given element is visible, scrolling the viewer if
necessary.
|
add, add, doFindInputItem, doFindItem, doUpdateItem, getElementAt, getLabelProvider, getSelectionFromWidget, indexForElement, inputChanged, internalRefresh, remove, remove, setLabelProvider, setSelectionToWidgetaddDoubleClickListener, 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, 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, setInput, setSelection, setSelectionToWidget, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, update, updateItem, updateSelection, usingElementMapgetContentProvider, getInput, handleDispose, labelProviderChangedaddHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelectionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddSelectionChangedListener, removeSelectionChangedListener, setSelectionpublic ComboViewer(Composite parent)
parent - the parent controlpublic ComboViewer(Composite parent, int style)
parent - the parent controlstyle - the SWT style bitspublic ComboViewer(Combo list)
list - the combo controlprotected void listAdd(String string, int index)
AbstractListViewerlistAdd in class AbstractListViewerstring - the string to addindex - position to insert the string intoprotected void listSetItem(int index,
String string)
AbstractListViewerlistSetItem in class AbstractListViewerindex - index to modifystring - new textprotected int[] listGetSelectionIndices()
AbstractListViewerNote: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.
listGetSelectionIndices in class AbstractListViewerprotected int listGetItemCount()
AbstractListViewerlistGetItemCount in class AbstractListViewerprotected void listSetItems(String[] labels)
AbstractListViewerlistSetItems in class AbstractListViewerlabels - the array of label textprotected void listRemoveAll()
AbstractListViewerlistRemoveAll in class AbstractListViewerprotected void listRemove(int index)
AbstractListViewerlistRemove in class AbstractListViewerindex - the index for the itempublic Control getControl()
ViewergetControl in class AbstractListViewerpublic Combo getCombo()
public void reveal(Object element)
StructuredViewerreveal in class StructuredViewerelement - the element to revealprotected void listSetSelection(int[] ixs)
AbstractListViewerIndices 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.
listSetSelection in class AbstractListViewerixs - the indices of the items to selectprotected void listDeselectAll()
AbstractListViewerlistDeselectAll in class AbstractListViewerprotected void listShowSelection()
AbstractListViewerlistShowSelection in class AbstractListViewerGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.