| 1 19 20 package ca.mcgill.sable.soot.ui; 21 22 import org.eclipse.jface.viewers.ITreeContentProvider; 23 import org.eclipse.jface.viewers.Viewer; 24 25 public class SootOptionsContentProvider implements ITreeContentProvider { 26 27 28 protected static final Object [] EMPTY_ARRAY = new Object [0]; 29 30 31 34 public SootOptionsContentProvider() { 35 super(); 36 } 37 38 41 public Object [] getChildren(Object parentElement) { 42 if (parentElement instanceof SootOption) { 43 SootOption opt = (SootOption)parentElement; 44 if (opt.getChildren() != null) { 45 return opt.getChildren().toArray(); 46 } 47 else { 48 return EMPTY_ARRAY; 49 } 50 } 51 else { 52 return EMPTY_ARRAY; 53 } 54 55 } 56 57 58 61 public Object getParent(Object element) { 62 return ((SootOption)element).getParent(); 63 } 64 65 68 public boolean hasChildren(Object element) { 69 if (element instanceof SootOption) { 70 if (((SootOption)element).getChildren() != null) { 71 return true; 72 } 73 else { 74 return false; 75 } 76 } 77 else { 78 return false; 79 } 80 } 81 82 85 public Object [] getElements(Object inputElement) { 86 return getChildren(inputElement); 87 } 88 89 92 public void dispose() { 93 } 94 95 98 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 99 100 } 101 102 } 103 | Popular Tags |