1 11 package org.eclipse.ui.model; 12 13 import org.eclipse.jface.viewers.ITreeContentProvider; 14 import org.eclipse.jface.viewers.Viewer; 15 import org.eclipse.ui.internal.util.Util; 16 17 27 public class BaseWorkbenchContentProvider implements ITreeContentProvider { 28 29 33 public BaseWorkbenchContentProvider() { 34 super(); 35 } 36 37 40 public void dispose() { 41 } 43 44 54 protected IWorkbenchAdapter getAdapter(Object element) { 55 return (IWorkbenchAdapter)Util.getAdapter(element, IWorkbenchAdapter.class); 56 } 57 58 61 public Object [] getChildren(Object element) { 62 IWorkbenchAdapter adapter = getAdapter(element); 63 if (adapter != null) { 64 return adapter.getChildren(element); 65 } 66 return new Object [0]; 67 } 68 69 72 public Object [] getElements(Object element) { 73 return getChildren(element); 74 } 75 76 79 public Object getParent(Object element) { 80 IWorkbenchAdapter adapter = getAdapter(element); 81 if (adapter != null) { 82 return adapter.getParent(element); 83 } 84 return null; 85 } 86 87 90 public boolean hasChildren(Object element) { 91 return getChildren(element).length > 0; 92 } 93 94 97 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 98 } 100 101 } 102 | Popular Tags |