1 11 12 package org.eclipse.ui.internal.intro.impl.model.viewer; 13 14 import org.eclipse.jface.viewers.ITreeContentProvider; 15 import org.eclipse.jface.viewers.Viewer; 16 import org.eclipse.ui.internal.intro.impl.model.AbstractIntroContainer; 17 import org.eclipse.ui.internal.intro.impl.model.AbstractIntroElement; 18 19 public class IntroModelContentProvider implements ITreeContentProvider { 20 21 public Object [] getChildren(Object element) { 22 23 AbstractIntroElement introElement = null; 24 if (element instanceof AbstractIntroElement) 25 introElement = (AbstractIntroElement) element; 27 28 if (introElement != null 29 && introElement 30 .isOfType(AbstractIntroElement.ABSTRACT_CONTAINER)) 31 return ((AbstractIntroContainer) introElement).getChildren(); 32 33 return new Object [0]; 34 } 35 36 public Object getParent(Object element) { 37 AbstractIntroElement introElement = null; 38 if (element instanceof AbstractIntroElement) { 39 introElement = (AbstractIntroElement) element; 41 return introElement.getParent(); 42 } 43 return null; 44 } 45 46 47 public boolean hasChildren(Object element) { 48 AbstractIntroElement introElement = null; 49 if (element instanceof AbstractIntroElement) 50 introElement = (AbstractIntroElement) element; 52 if (introElement != null 53 && introElement 54 .isOfType(AbstractIntroElement.ABSTRACT_CONTAINER)) 55 return true; 56 return false; 57 } 58 59 60 public Object [] getElements(Object element) { 61 return getChildren(element); 62 } 63 64 65 public void dispose() { 66 } 68 69 75 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 76 78 } 79 80 } 81 | Popular Tags |