Section 5.1.5. StructuredViewer class


5.1.5. StructuredViewer class

The StructuredViewer class is the abstract superclass of list viewers, table viewers, and tree viewers (see Figure 5-7).

Figure 5-7. StructuredViewer hierarchy.


It defines a large number of useful APIs that are common to each class.

addDoubleClickListener(IDoubleClickListener) Adds a listener for double-clicks in this viewer.

addDragSupport(int, Transfer[], DragSourceListener) Adds support for dragging items out of this viewer via a user drag-and-drop operation.

addDropSupport(int, Transfer[], DropTargetListener) Adds support for dropping items into this viewer via a user drag-and-drop operation.

addFilter(ViewerFilter) Adds the given filter to this viewer and triggers refiltering and resorting of the elements.

addHelpListener(HelpListener) Adds a listener for help requests in this viewer.

addOpenListener(IOpenListener) Adds a listener for selection open in this viewer.

addSelectionChangedListener(ISelectionChangedListener) Adds a listener for selection changes in this selection provider.

addPostSelectionChangedListener(ISelectionChangedListener) Adds a listener for post-selection in this viewer.

getSelection() The StructuredViewer implementation of this method returns the result as an IStructuredSelection.

refresh() Refreshes this viewer completely with information freshly obtained from this viewer's model.

refresh(boolean) Refreshes this viewer with information freshly obtained from this viewer's model.

refresh(Object) Refreshes this viewer starting with the given element.

refresh(Object, boolean) Refreshes this viewer starting with the given element.

resetFilters() Discards this viewer's filters and triggers refiltering and resorting of the elements.

setComparer(IElementComparer) Sets the comparator to use for comparing elements, or null to use the default equals and hashCode methods on the elements themselves.

setContentProvider(IContentProvider) The implementation, StructuredViewer, of this method checks to ensure that the content provider is an IStructuredContentProvider.

setData(String, Object) Sets the value of the property with the given name to the given value, or to null if the property is to be removed.

setInput(Object) The ContentViewer implementation of this viewer method invokes inputChanged on the content provider and then the inputChanged hook method. The content provider's getElements(Object) method is called later with this input object as its argument to determine the root-level elements in the viewer.

setSelection(ISelection, boolean) The StructuredViewer implementation of this method updates the current viewer selection based on the specified selection.

setSorter(ViewerSorter) Sets this viewer's sorter and triggers refiltering and resorting of this viewer's element.

setUseHashlookup(boolean) Configures whether this structured viewer uses an internal hash table to speed up the mapping between elements and SWT items.

update(Object[], String[]) Updates the given element's presentation when one or more of its properties changes.

update(Object, String[]) Updates the given element's presentation when one or mo re of its properties changes.



Eclipse(c) Building Commercial-Quality Plug-ins
Eclipse: Building Commercial-Quality Plug-ins (2nd Edition)
ISBN: 032142672X
EAN: 2147483647
Year: 2004
Pages: 200

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net