public void run() {

      ISiteFeatureReference siteFeatureReference = null;

      while (siteFeatureReferences.size() != 0) {

        synchronized (siteFeatureReferences) {
          try {
            siteFeatureReference = (ISiteFeatureReference) siteFeatureReferences.remove(0);
          } catch (IndexOutOfBoundsException e) {
            siteFeatureReference = null;
            break;
          }
        }
        if (siteFeatureReference != null) {
          boolean skipFeature = false;
          if (monitor.isCanceled()) break;
          if (ignores.size() > 0) {
            ICategory[] categories = siteFeatureReference.getCategories();

            for (int j = 0; j < categories.length; j++) {
              ICategory category = categories[j];
              if (ignores.contains(category.getName())) {
                skipFeature = true;
                break;
              }
            }
          }
          try {
            if (!skipFeature) {
              if (filter.accept(siteFeatureReference)) {
                IFeature feature = null;
                if (liteFeaturesAreOK) {
                  feature =
                      (IFeature) liteFeatures.get(siteFeatureReference.getVersionedIdentifier());
                }
                if (feature == null) {
                  feature = siteFeatureReference.getFeature(null);
                }
                synchronized (siteFeatureReferences) {
                  if ((feature != null) && (filter.accept(siteFeatureReference))) {
                    collector.accept(feature);
                    monitor.subTask(feature.getLabel());
                  }
                }
              }
            }
          } catch (CoreException e) {
            UpdateCore.log(e);
          } finally {
            monitor.worked(1);
          }
        }
      }
    }
 public String toString() {
   IConfiguredSite configSite = getConfiguredSite();
   String version = feature.getVersionedIdentifier().getVersion().toString();
   String location = configSite.getSite().getURL().getFile();
   return NLS.bind(
       Messages.DuplicateConflictsDialog_conflict, (new String[] {version, location}));
 }
  private static void computeNewFeature(
      IFeature feature,
      IConfiguredSite csite,
      Hashtable table,
      IFeatureReference[] optionalFeatures)
      throws CoreException {
    addEntry(feature, csite, table);
    IIncludedFeatureReference[] irefs = feature.getIncludedFeatureReferences();
    for (int i = 0; i < irefs.length; i++) {
      IIncludedFeatureReference iref = irefs[i];
      boolean add = true;

      if (iref.isOptional() && optionalFeatures != null) {
        boolean found = false;
        for (int j = 0; j < optionalFeatures.length; j++) {
          IFeatureReference checked = optionalFeatures[j];
          if (checked.equals(iref)) {
            found = true;
            break;
          }
        }
        add = found;
      }
      if (add) computeNewFeature(iref.getFeature(null), csite, table, optionalFeatures);
    }
  }
 private static void addEntry(IFeature feature, IConfiguredSite csite, Hashtable featureTable) {
   String id = feature.getVersionedIdentifier().getIdentifier();
   ArrayList entries = (ArrayList) featureTable.get(id);
   if (entries == null) {
     entries = new ArrayList();
     featureTable.put(id, entries);
   }
   IdEntry entry = new IdEntry(feature, csite);
   boolean replaced = false;
   for (int i = 0; i < entries.size(); i++) {
     IdEntry existingEntry = (IdEntry) entries.get(i);
     IConfiguredSite existingSite = existingEntry.getConfiguredSite();
     if (existingSite.equals(entry.getConfiguredSite())) {
       // same site - replace it if not new
       if (entry.isInstallCandidate()) {
         entries.set(i, entry);
         entries.remove(existingEntry);
       }
       replaced = true;
       break;
     }
   }
   if (!replaced) entries.add(entry);
 }
 public boolean sameLevel(IdEntry entry) {
   VersionedIdentifier vid = feature.getVersionedIdentifier();
   VersionedIdentifier evid = entry.getFeature().getVersionedIdentifier();
   return vid.equals(evid);
 }
 public IConfiguredSite getConfiguredSite() {
   if (csite != null) return csite;
   return feature.getSite().getCurrentConfiguredSite();
 }
 public String getIdentifier() {
   return feature.getVersionedIdentifier().getIdentifier();
 }