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 import ca.mcgill.sable.soot.launching.SootConfiguration; 26 public class SootConfigContentProvider implements ITreeContentProvider { 27 28 29 protected static final Object [] EMPTY_ARRAY = new Object [0]; 30 31 32 35 public SootConfigContentProvider() { 36 super(); 37 } 38 39 42 public Object [] getChildren(Object parentElement) { 43 if (parentElement instanceof SootConfiguration) { 44 SootConfiguration opt = (SootConfiguration)parentElement; 45 if (opt.getChildren() != null) { 46 return opt.getChildren().toArray(); 47 } 48 else { 49 return EMPTY_ARRAY; 50 } 51 } 52 else { 53 return EMPTY_ARRAY; 54 } 55 56 } 57 58 59 62 public Object getParent(Object element) { 63 return ((SootConfiguration)element).getParent(); 64 } 65 66 69 public boolean hasChildren(Object element) { 70 if (element instanceof SootConfiguration) { 71 if (((SootConfiguration)element).getChildren() != null) { 72 return true; 73 } 74 else { 75 return false; 76 } 77 } 78 else { 79 return false; 80 } 81 } 82 83 86 public Object [] getElements(Object inputElement) { 87 return getChildren(inputElement); 88 } 89 90 93 public void dispose() { 94 } 95 96 99 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 100 101 } 102 103 } 104 | Popular Tags |