AbstractContentProvider.java
Go to the documentation of this file.00001 package edu.rice.cs.hpc.viewer.scope;
00002
00003 import org.eclipse.jface.viewers.ITreeContentProvider;
00004 import org.eclipse.jface.viewers.Viewer;
00005
00006 import edu.rice.cs.hpc.data.experiment.scope.Scope;
00007
00008 public abstract class AbstractContentProvider implements ITreeContentProvider
00009 {
00010 protected ScopeTreeViewer viewer;
00011 protected boolean enableFilter = false;
00012
00013 public void setEnableFilter(boolean isFilterEnabled)
00014 {
00015 this.enableFilter = isFilterEnabled;
00016 }
00017
00021 public Object[] getElements(Object inputElement) {
00022 return getChildren(inputElement);
00023 }
00024
00028 public Object[] getChildren(Object parentElement) {
00029 if(parentElement instanceof Scope) {
00030
00031 Scope parent = ((Scope) parentElement);
00032 Object arrChildren[] = parent.getChildren();
00033
00034 if (arrChildren != null && arrChildren.length>0)
00035 {
00036 return arrChildren;
00037 }
00038 }
00039 return null;
00040 }
00041
00042
00043
00044
00045
00046
00047 public Object getParent(Object element) {
00048 if(element instanceof Scope)
00049 return ((Scope) element).getParent();
00050 else
00051 return null;
00052 }
00053
00054
00055
00056
00057
00058 public boolean hasChildren(Object element) {
00059 if(element instanceof Scope)
00060 return ((Scope) element).hasChildren();
00061 else
00062 return false;
00063 }
00064
00075 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
00076 if (viewer instanceof ScopeTreeViewer)
00077 this.viewer = (ScopeTreeViewer)viewer;
00078 }
00079
00080
00081
00082
00083
00084 public void dispose() {}
00085 }