1 18 package org.visualcontent.ui.nodepropertylist; 19 20 import java.util.LinkedList ; 21 import java.util.List ; 22 23 import javax.jcr.Node; 24 import javax.jcr.Property; 25 import javax.jcr.PropertyIterator; 26 import javax.jcr.RepositoryException; 27 28 import org.eclipse.jface.viewers.IStructuredContentProvider; 29 import org.eclipse.jface.viewers.Viewer; 30 import org.visualcontent.ui.UiPlugin; 31 32 class ViewContentProvider implements IStructuredContentProvider { 33 34 37 private final NodePropertyList viewContentProvider; 38 39 42 ViewContentProvider(NodePropertyList list) { 43 viewContentProvider = list; 44 } 45 46 public void inputChanged(Viewer v, Object oldInput, Object newInput) { 47 48 } 49 50 public void dispose() { 51 } 52 53 public Object [] getElements(Object parent) { 54 Property[] propertyArray = null; 55 PropertyIterator propertyIterator = null; 56 try { 57 Node contentNode = (Node) parent; 58 propertyIterator = contentNode.getProperties(); 59 List propertyList = new LinkedList (); 60 while (propertyIterator.hasNext()) { 61 Property element = (Property) propertyIterator.nextProperty(); 62 propertyList.add(element); 63 } 64 propertyArray = (Property[]) propertyList 65 .toArray(new Property[propertyList.size()]); 66 } catch (RepositoryException e) { 67 UiPlugin.getDefault().showError("Could not get the properties.",e); 70 } 71 return propertyArray; 72 } 73 } | Popular Tags |