1 11 package org.eclipse.pde.internal.ui.view; 12 13 import java.util.HashSet ; 14 import java.util.Iterator ; 15 import java.util.Set ; 16 17 import org.eclipse.jface.viewers.IStructuredContentProvider; 18 import org.eclipse.pde.core.plugin.IPluginBase; 19 import org.eclipse.pde.core.plugin.IPluginModelBase; 20 21 public class CallersListContentProvider extends CallersContentProvider 22 implements IStructuredContentProvider { 23 24 public CallersListContentProvider(DependenciesView view) { 25 super(view); 26 } 27 28 31 public Object [] getElements(Object inputElement) { 32 if (inputElement instanceof IPluginModelBase) { 34 IPluginBase pluginBase = ((IPluginModelBase) inputElement) 35 .getPluginBase(); 36 37 Set callers = new HashSet (); 38 Set candidates = new HashSet (); 39 candidates.addAll(findReferences(pluginBase.getId())); 40 while (!candidates.isEmpty()) { 41 Set newCandidates = new HashSet (); 42 for (Iterator it = candidates.iterator(); it.hasNext();) { 43 Object o = it.next(); 44 it.remove(); 45 IPluginBase caller = (IPluginBase) o; 46 if (!callers.contains(caller)) { 47 callers.add(caller); 48 newCandidates.addAll(findReferences(caller.getId())); 49 } 50 } 51 candidates = newCandidates; 52 53 } 54 55 return callers.toArray(); 56 } 57 return new Object [0]; 58 } 59 } 60 | Popular Tags |