Example usage for org.eclipse.jface.viewers AbstractListViewer add

List of usage examples for org.eclipse.jface.viewers AbstractListViewer add

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers AbstractListViewer add.

Prototype

public void add(Object element) 

Source Link

Document

Adds the given element to this list viewer.

Usage

From source file:org.eclipse.nebula.widgets.pagination.PageLoaderStrategyHelper.java

License:Open Source License

/**
 * This method loads the paginated list by using the given page loader
 * {@link IPageLoader} and information about pagination from the given
 * controller {@link PageableController}. After loading paginated list
 * returned in a pagination structure {@link PageResult}, this method :
 * /*  ww  w . ja v a  2s  .co m*/
 * <ul>
 * <li>update the total elements of the given controller
 * {@link PageableController}</li>
 * <li>refresh the given {@link Viewer} by replacing data with the new
 * paginated list.</li>
 * </ul>
 * 
 * @param controller
 *            the controller to use to load paginated list and update the
 *            total elements.
 * @param viewer
 *            the viewer to refresh with new paginated list.
 * @param pageLoader
 *            the page loader used to load paginated list.
 * @pageContentProvider the page content provider to retrieves total
 *                      elements+paginated list from the page result
 *                      structure returned by the pageLoader.
 * @param handler
 *            the page loader handler to observe before/after page loading
 *            process. If null no observation is done.
 */
public static void loadPageAndAddItems(final PageableController controller, final AbstractListViewer viewer,
        final IPageLoader<?> pageLoader, final IPageContentProvider pageContentProvider,
        final IPageLoaderHandler<PageableController> handler) {
    Object page = loadPageAndUpdateTotalElements(controller, pageLoader, pageContentProvider, handler);
    List<?> content = pageContentProvider.getPaginatedList(page);
    if (content != null && !content.isEmpty()) {
        viewer.add(content.toArray());
    }
}