View Javadoc
1   package org.argeo.connect.ui.util;
2   
3   import java.util.List;
4   
5   import javax.jcr.Node;
6   
7   import org.eclipse.jface.viewers.IStructuredContentProvider;
8   import org.eclipse.jface.viewers.Viewer;
9   
10  /**
11   * Default implementation of a content provider for all tables and viewer that
12   * display a list of Nodes
13   */
14  public class BasicNodeListContentProvider implements IStructuredContentProvider {
15  	private static final long serialVersionUID = 1L;
16  	// keep a cache of the Nodes in the content provider to be able to
17  	// manage long request
18  	private List<Node> nodes;
19  
20  	public void dispose() {
21  	}
22  
23  	/** Expects a list of nodes as a new input */
24  	@SuppressWarnings("unchecked")
25  	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
26  		nodes = (List<Node>) newInput;
27  	}
28  
29  	public Object[] getElements(Object arg0) {
30  		return nodes.toArray();
31  	}
32  }