public static VariableCollector createCollector(
      DartiumDebugTarget target,
      WebkitRemoteObject thisObject,
      List<WebkitRemoteObject> remoteObjects,
      WebkitRemoteObject libraryObject,
      WebkitRemoteObject exception) {
    final VariableCollector collector = new VariableCollector(target, remoteObjects.size());

    if (exception != null) {
      collector.createExceptionVariable(exception);
    }

    if (libraryObject != null) {
      collector.createLibraryVariable(libraryObject);
    }

    if (thisObject != null) {
      collector.createThisVariable(thisObject);
    }

    for (final WebkitRemoteObject obj : remoteObjects) {
      try {
        target
            .getConnection()
            .getRuntime()
            .getProperties(
                obj,
                true,
                new WebkitCallback<WebkitPropertyDescriptor[]>() {
                  @Override
                  public void handleResult(WebkitResult<WebkitPropertyDescriptor[]> result) {
                    try {
                      collector.collectFields(result, false, !obj.isList());
                    } catch (Throwable t) {
                      DartDebugCorePlugin.logError(t);

                      collector.worked();
                    }
                  }
                });
      } catch (Throwable e) {
        DartDebugCorePlugin.logError(e);

        collector.worked();
      }
    }

    return collector;
  }
  public static VariableCollector createCollector(
      DartiumDebugTarget target,
      DartiumDebugVariable variable,
      List<WebkitRemoteObject> remoteObjects) {
    final VariableCollector collector =
        new VariableCollector(target, remoteObjects.size(), variable);

    for (final WebkitRemoteObject obj : remoteObjects) {
      try {
        target
            .getConnection()
            .getRuntime()
            .getProperties(
                obj,
                true,
                new WebkitCallback<WebkitPropertyDescriptor[]>() {
                  @Override
                  public void handleResult(WebkitResult<WebkitPropertyDescriptor[]> result) {
                    try {
                      collector.collectFields(result, !obj.isList(), !obj.isList());
                    } catch (Throwable t) {
                      DartDebugCorePlugin.logError(t);

                      collector.worked();
                    }
                  }
                });
      } catch (Throwable e) {
        DartDebugCorePlugin.logError(e);

        collector.worked();
      }
    }

    return collector;
  }