1 11 package org.eclipse.ui.internal.progress; 12 13 import org.eclipse.jface.viewers.ITreeContentProvider; 14 15 19 public class ProgressTreeContentProvider extends ProgressContentProvider 20 implements ITreeContentProvider { 21 22 NewProgressViewer viewer; 23 24 28 public ProgressTreeContentProvider(NewProgressViewer mainViewer) { 29 super(); 30 viewer = mainViewer; 31 } 32 33 34 41 public ProgressTreeContentProvider(NewProgressViewer mainViewer, 42 boolean debug) { 43 super(debug); 44 viewer = mainViewer; 45 } 46 47 52 53 public Object [] getChildren(Object parentElement) { 54 return ((JobTreeElement) parentElement).getChildren(); 55 } 56 57 62 public Object getParent(Object element) { 63 if (element == this) 64 return null; 65 return ((JobTreeElement) element).getParent(); 66 } 67 68 73 public boolean hasChildren(Object element) { 74 if (element == this) 75 return ProgressManager.getInstance().hasJobInfos(); 76 return ((JobTreeElement) element).hasChildren(); 77 } 78 79 82 public void add(Object [] elements) { 83 viewer.add(viewer.getInput(), elements); 84 85 } 86 87 90 public void refresh() { 91 viewer.refresh(true); 92 93 } 94 95 98 public void refresh(Object [] elements) { 99 for (int i = 0; i < elements.length; i++) { 100 viewer.refresh(elements[i], true); 101 } 102 103 } 104 105 108 public void remove(Object [] elements) { 109 viewer.remove(elements); 110 111 } 112 113 } 114 | Popular Tags |