/**
   * Dump the whole extension registry up to the specified nesting depth.
   *
   * @param extensionPointPrefix considering only extension points that have this prefix or null for
   *     all
   * @param depth nesting depth
   */
  public static void dumpRegistry(final String extensionPointPrefix, final int depth) {
    final IExtensionRegistry extensionRegistry = RegistryFactory.getRegistry();
    if (extensionRegistry == null) {
      System.out.println("No extension registry available."); // $NON-NLS-1$
      return;
    }
    final Object strategy = ReflectionUtils.getHidden(extensionRegistry, "strategy"); // $NON-NLS-1$
    final StringBuilder bob = new StringBuilder("<< Registry"); // $NON-NLS-1$
    if (extensionPointPrefix != null) {
      bob.append(" for prefix ").append(extensionPointPrefix); // $NON-NLS-1$
    }
    bob.append(" with strategy ")
        .append(strategy.getClass().getSimpleName())
        .append(":"); // $NON-NLS-1$ //$NON-NLS-2$
    System.out.println(bob);

    final IExtensionPoint[] extensionPoints = extensionRegistry.getExtensionPoints();

    Arrays.sort(
        extensionPoints,
        new Comparator<IExtensionPoint>() {
          public int compare(final IExtensionPoint ep1, final IExtensionPoint ep2) {
            return ep1.getUniqueIdentifier().compareTo(ep2.getUniqueIdentifier());
          }
        });
    for (final IExtensionPoint extensionPoint : extensionPoints) {
      if (extensionPointPrefix != null
          && !extensionPoint.getUniqueIdentifier().startsWith(extensionPointPrefix)) {
        continue;
      }
      System.out.println(extensionPoint.getUniqueIdentifier() + ":"); // $NON-NLS-1$
      dumpExtensions(extensionPoint.getExtensions(), depth);
    }
    System.out.println(">>"); // $NON-NLS-1$
  }
 /**
  * Get the whole extension registry as a set of paths.
  *
  * @param extensionPointPrefix considering only extension points that have this prefix or null for
  *     all
  * @return
  */
 public static Set<String> getRegistryPaths(final String extensionPointPrefix) {
   final Set<String> result = new HashSet<String>();
   final IExtensionRegistry extensionRegistry = RegistryFactory.getRegistry();
   if (extensionRegistry
       != null) { // is null when running without the workbench (plain junit test)
     final IExtensionPoint[] extensionPoints = extensionRegistry.getExtensionPoints();
     for (final IExtensionPoint extensionPoint : extensionPoints) {
       if (extensionPointPrefix != null
           && !extensionPoint.getUniqueIdentifier().startsWith(extensionPointPrefix)) {
         continue;
       }
       final String path = extensionPoint.getUniqueIdentifier() + ": "; // $NON-NLS-1$
       getExtensionsPaths(result, path, extensionPoint.getExtensions());
     }
   }
   return result;
 }