/**
  * @param state
  * @param bundle
  * @return
  */
 private static DisabledInfo createDisabledInfo(State state, long bundleId) {
   BundleDescription desc = state.getBundle(bundleId);
   DisabledInfo info =
       new DisabledInfo(
           "org.eclipse.pde.ui", //$NON-NLS-1$
           "Disabled via PDE",
           desc); //$NON-NLS-1$
   return info;
 }
  /**
   * Returns a {@link Set} of bundle ids for the dependents of the given objects from the given
   * {@link State}. The set additionally only includes the given set of implicit dependencies.
   *
   * @param selected selected the group of objects to compute dependencies for. Any items in this
   *     array that are not {@link IPluginModelBase}s are ignored.
   * @param implicit the array of additional implicit dependencies to add to the {@link Set}
   * @param state the {@link State} to compute the dependencies in
   * @param removeSelf if the id of one of the bundles were are computing dependencies for should be
   *     included in the result {@link Set} or not
   * @param includeOptional if optional bundle ids should be included
   * @param excludeFragments a collection of <b>fragment</b> bundle symbolic names to exclude from
   *     the dependency resolution
   * @return a set of bundle IDs
   */
  private static Set<String> getDependencies(
      Object[] selected,
      String[] implicit,
      State state,
      boolean removeSelf,
      boolean includeOptional,
      Set<String> excludeFragments) {
    Set<String> set = new TreeSet<>();
    for (int i = 0; i < selected.length; i++) {
      if (!(selected[i] instanceof IPluginModelBase)) continue;
      IPluginModelBase model = (IPluginModelBase) selected[i];
      addBundleAndDependencies(
          model.getBundleDescription(), set, includeOptional, excludeFragments);
      IPluginExtension[] extensions = model.getPluginBase().getExtensions();
      for (int j = 0; j < extensions.length; j++) {
        String point = extensions[j].getPoint();
        if (point != null) {
          int dot = point.lastIndexOf('.');
          if (dot != -1) {
            String id = point.substring(0, dot);
            addBundleAndDependencies(
                state.getBundle(id, null), set, includeOptional, excludeFragments);
          }
        }
      }
    }

    for (int i = 0; i < implicit.length; i++) {
      addBundleAndDependencies(
          state.getBundle(implicit[i], null), set, includeOptional, excludeFragments);
    }

    if (removeSelf) {
      for (int i = 0; i < selected.length; i++) {
        if (!(selected[i] instanceof IPluginModelBase)) {
          continue;
        }
        IPluginModelBase model = (IPluginModelBase) selected[i];
        set.remove(model.getPluginBase().getId());
      }
    }
    return set;
  }
 private BundleDescription[] getPluginModels() {
   ArrayList list = new ArrayList();
   State state = TargetPlatformHelper.getState();
   IProductPlugin[] plugins = product.getPlugins();
   for (int i = 0; i < plugins.length; i++) {
     BundleDescription bundle = null;
     String v = plugins[i].getVersion();
     if (v != null && v.length() > 0) {
       bundle = state.getBundle(plugins[i].getId(), Version.parseVersion(v));
     }
     // if there's no version, just grab a bundle like before
     if (bundle == null) {
       bundle = state.getBundle(plugins[i].getId(), null);
     }
     if (bundle != null) {
       list.add(bundle);
     }
   }
   Object[] bundleArray = list.toArray(new BundleDescription[list.size()]);
   return (BundleDescription[]) bundleArray;
 }