{
    if (element.getName().equals(TAG_RESOURCE))
    {
      String packageURI = element.getAttribute(ATT_URI);
      if (packageURI == null)
      {
        logMissingAttribute(element, ATT_URI);
      }
      else if (element.getAttribute(ATT_LOCATION) == null)
      {
        logMissingAttribute(element, ATT_LOCATION);
      }
      else if (add)
      {
        Object previous = EPackage.Registry.INSTANCE.put(packageURI, new EPackageDescriptor.Dynamic(element, ATT_LOCATION));
        if (previous instanceof PluginClassDescriptor)
        {
          PluginClassDescriptor descriptor = (PluginClassDescriptor)previous;
          EcorePlugin.INSTANCE.log
            ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a package for '" + packageURI + "'");
        }
        
        return true;
      }
      else
      {
        EPackage.Registry.INSTANCE.remove(packageURI);
        return true;
      }
    }

    return false;
  }