/**
   * Gets a list of all the bundles that can be added as implicit dependencies
   *
   * @return list of possible dependencies
   */
  protected BundleInfo[] getValidBundles() throws CoreException {
    NameVersionDescriptor[] current = getTargetDefinition().getImplicitDependencies();
    Set<String> currentBundles = new HashSet<String>();
    if (current != null) {
      for (int i = 0; i < current.length; i++) {
        if (!currentBundles.contains(current[i].getId())) {
          currentBundles.add(current[i].getId());
        }
      }
    }

    List<BundleInfo> targetBundles = new ArrayList<BundleInfo>();
    TargetBundle[] allTargetBundles = getTargetDefinition().getAllBundles();
    if (allTargetBundles == null || allTargetBundles.length == 0) {
      throw new CoreException(
          new Status(
              IStatus.WARNING,
              PDEPlugin.getPluginId(),
              PDEUIMessages.ImplicitDependenciesSection_0));
    }
    for (int i = 0; i < allTargetBundles.length; i++) {
      BundleInfo bundleInfo = allTargetBundles[i].getBundleInfo();
      if (!currentBundles.contains(bundleInfo.getSymbolicName())) {
        currentBundles.add(bundleInfo.getSymbolicName()); // to avoid duplicate entries
        targetBundles.add(bundleInfo);
      }
    }

    return targetBundles.toArray(new BundleInfo[targetBundles.size()]);
  }
 private void computeSelected(Collection<?> initialSelection) {
   if (initialSelection == null || initialSelection.size() == 0) return;
   Set<IPluginModelBase> selected = new HashSet<IPluginModelBase>();
   Iterator<?> iter = initialSelection.iterator();
   while (iter.hasNext()) {
     Object obj = iter.next();
     if (obj instanceof IProject) {
       IPluginModelBase model = PluginRegistry.findModel((IProject) obj);
       if (model != null) {
         selected.add(model);
       }
     }
   }
   fSelected = selected.toArray(new IPluginModelBase[selected.size()]);
 }
 /**
  * Delimits a comma separated preference and add the items to the given set
  *
  * @param set
  * @param preference
  */
 private void addExtraChoices(Set<String> set, String preference) {
   StringTokenizer tokenizer = new StringTokenizer(preference, ","); // $NON-NLS-1$
   while (tokenizer.hasMoreTokens()) {
     set.add(tokenizer.nextToken().trim());
   }
 }