1 11 package org.eclipse.pde.internal.build.site; 12 13 import java.util.*; 14 import org.eclipse.osgi.service.resolver.BundleDescription; 15 import org.eclipse.osgi.service.resolver.VersionRange; 16 import org.osgi.framework.Version; 17 18 public class FilteringState extends PDEState { 19 SortedSet allPlugins; 20 21 public void setFilter(SortedSet filter) { 22 allPlugins = filter; 23 } 24 25 public boolean addBundleDescription(BundleDescription toAdd) { 26 if (allPlugins == null) { 27 return super.addBundleDescription(toAdd); 28 } 29 30 SortedSet includedMatches = allPlugins.subSet(new ReachablePlugin(toAdd.getSymbolicName(), ReachablePlugin.WIDEST_RANGE), new ReachablePlugin(toAdd.getSymbolicName(), new VersionRange(Version.emptyVersion, true, Version.emptyVersion, true))); 31 for (Iterator iterator = includedMatches.iterator(); iterator.hasNext();) { 32 ReachablePlugin constraint = (ReachablePlugin) iterator.next(); 33 if (constraint.getRange().isIncluded(toAdd.getVersion())) 34 return super.addBundleDescription(toAdd); 35 } 36 return false; 37 } 38 } 39 | Popular Tags |