org.eclipse.jface.viewers.ITreePathContentProvider Java Examples
The following examples show how to use
org.eclipse.jface.viewers.ITreePathContentProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CTableTreeViewer.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * @param element * @param index */ protected void createItem(Object element, int index) { Object parent = null; IContentProvider cp = getContentProvider(); if(cp != null && cp instanceof ITreeContentProvider) { parent = ((ITreeContentProvider) cp).getParent(element); } else if(cp != null && cp instanceof ITreePathContentProvider) { TreePath[] paths = ((ITreePathContentProvider) cp).getParents(element); if(paths.length > 0) { parent = paths[0].getLastSegment(); } } createItem(parent, element, index); }
Example #2
Source File: GalleryTreeViewer.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * <p> * Gallery expects contents to have exactly 2 levels of hierarchy, with * groups as the root elements and image thumbnails as direct children of * the groups. This method accepts ITreeContentProvider and * ITreePathContentProvider as-is, and relies on the providers to return * contents with the correct structure. * </p> * <p> * This method also accepts IStructuredContentProvider and wraps it in a * FlatTreeContentProvider with an empty string as the root node. If you * need a different root node, construct your own FlatTreeContentProvider * and pass it here. If you want the Gallery to suppress the collapsable * group header, call * </p> * <code>getGallery().setGroupRenderer(new NoGroupRenderer());</code> */ public void setContentProvider(IContentProvider provider) { if (provider instanceof IStructuredContentProvider && !(provider instanceof ITreeContentProvider || provider instanceof ITreePathContentProvider)) { // Wrap a table-style contents with a single root node. super.setContentProvider(new FlatTreeContentProvider( (IStructuredContentProvider) provider)); } else { super.setContentProvider(provider); } }