Finds the library needed for a resource; this depends on `findAllResources` having
already been called.  `uri` can include optional explicit namespace (eg "qx:blah/blah.png"),
otherwise the library resource lookups are examined to find the library.

@param uri {String} URI
@return {Library?} the library, null if not found
function(uri) {
      var t = this;

      // Explicit library?
      var pos = uri.indexOf(":");
      if (pos !== -1) {
        var ns = uri.substring(0, pos);
        var library = this.__analyser.findLibrary(ns);
        return library || null;
      }
          
      // Non-wildcards are a direct lookup
      // check for $ and *. less pos wins
      // fix for https://github.com/qooxdoo/qooxdoo-compiler/issues/260
      var pos1 = uri.indexOf("$"); // Variable references are effectively a wildcard lookup
      var pos2 = uri.indexOf("*"); 
      if (pos1 === -1) {
        pos = pos2;
      } else if (pos2 === -1) {
        pos = pos1; 
      } else {
        pos = Math.min(pos1, pos2);
      } 
      if (pos === -1) {
        library = t.__librariesByResourceUri[uri] || null;
        return library;
      }

      // Strip wildcard
      var isFolderMatch = uri[pos - 1] === "/";
      uri = uri.substring(0, pos - 1);

      // Fast folder match
      if (isFolderMatch) {
        library = t.__librariesByResourceFolderUri[uri] || null;
        return library;
      }

      // Slow scan
      pos = qx.tool.compiler.utils.Values.binaryStartsWith(t.__allResourceUris, uri);
      if (pos > -1) {
        var firstUri = t.__allResourceUris[pos];
        library = t.__librariesByResourceUri[firstUri] || t.__librariesByResourceFolderUri[firstUri] || null;
        return library;
      }

      return null;
    }