1 11 package org.eclipse.pde.internal.ui.view; 12 13 import java.util.Set ; 14 15 import org.eclipse.jface.viewers.ITreeContentProvider; 16 import org.eclipse.pde.core.plugin.IPlugin; 17 import org.eclipse.pde.core.plugin.IPluginBase; 18 import org.eclipse.pde.core.plugin.IPluginImport; 19 import org.eclipse.pde.core.plugin.IPluginModelBase; 20 21 public class CallersTreeContentProvider extends CallersContentProvider 22 implements ITreeContentProvider { 23 24 27 public CallersTreeContentProvider(DependenciesView view) { 28 super(view); 29 } 30 31 35 public Object [] getChildren(Object parentElement) { 36 String id = null; 37 if (parentElement instanceof IPluginModelBase) { 38 IPluginBase pluginBase = ((IPluginModelBase) parentElement) 39 .getPluginBase(false); 40 if (pluginBase != null) 41 id = pluginBase.getId(); 42 } else if (parentElement instanceof IPlugin) { 43 id = ((IPlugin) parentElement).getId(); 44 } else if (parentElement instanceof IPluginImport) { 45 id = ((IPluginImport) parentElement).getId(); 46 } 47 if (id == null) { 48 return new Object [0]; 49 } 50 Set l = findReferences(id); 51 return l.toArray(); 52 } 53 54 58 public Object [] getElements(Object inputElement) { 59 if (inputElement instanceof IPluginModelBase) { 60 return new Object [] { ((IPluginModelBase) inputElement) 61 .getPluginBase() }; 62 } 63 return new Object [0]; 64 } 65 66 69 public Object getParent(Object element) { 70 return null; 71 } 72 73 76 public boolean hasChildren(Object element) { 77 return getChildren(element).length > 0; 78 } 79 80 } 81 | Popular Tags |