summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-04-21 02:15:33 (EDT)
committerEike Stepper2008-04-21 02:15:33 (EDT)
commit9acc04f29e9a1d0fba55834cff3dd175c9978dae (patch)
treebe7a3ff500b30372e39361aab8903c059cb97292
parentaff6b16d7ac493d273068eb6c59c17287372ac32 (diff)
downloadcdo-9acc04f29e9a1d0fba55834cff3dd175c9978dae.zip
cdo-9acc04f29e9a1d0fba55834cff3dd175c9978dae.tar.gz
cdo-9acc04f29e9a1d0fba55834cff3dd175c9978dae.tar.bz2
[226233] Issues with EPackages having inter-dependencies
https://bugs.eclipse.org/bugs/show_bug.cgi?id=226233
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java45
1 files changed, 11 insertions, 34 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
index f4b95ed..6ba7a34 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
@@ -60,8 +60,6 @@ public class CDOPackageRegistryImpl extends EPackageRegistryImpl implements CDOP
{
EPackage.Descriptor descriptor = new CDOPackageDescriptor(cdoPackage);
String uri = cdoPackage.getPackageURI();
- checkUnregistered(uri);
-
if (TRACER.isEnabled())
{
TRACER.format("Registering package descriptor for {0}", uri);
@@ -72,56 +70,35 @@ public class CDOPackageRegistryImpl extends EPackageRegistryImpl implements CDOP
public EPackage putEPackage(EPackage ePackage)
{
- checkUnregistered(ePackage);
- putEPackageChecked(ePackage);
- return getEPackage(ePackage.getNsURI());
- }
-
- private void putEPackageChecked(EPackage ePackage)
- {
String uri = ePackage.getNsURI();
- if (uri != null)
+ if (ePackage.getESuperPackage() != null)
{
- if (TRACER.isEnabled())
- {
- TRACER.format("Registering package for {0}", uri);
- }
-
- put(uri, ePackage);
+ throw new IllegalArgumentException("Not a top level package: " + uri);
}
- for (EPackage subPackage : ePackage.getESubpackages())
- {
- putEPackageChecked(subPackage);
- }
+ putEPackage(uri, ePackage);
+ return getEPackage(uri);
}
- private void checkUnregistered(EPackage ePackage)
+ private void putEPackage(String uri, EPackage ePackage)
{
- String uri = ePackage.getNsURI();
- checkUnregistered(uri);
-
- for (EPackage subPackage : ePackage.getESubpackages())
+ if (uri != null)
{
- checkUnregistered(subPackage);
+ put(uri, ePackage);
}
- }
- private void checkUnregistered(String uri)
- {
- if (uri != null && containsKey(uri))
+ for (EPackage subPackage : ePackage.getESubpackages())
{
- throw new IllegalStateException("Package already registered for " + uri);
+ putEPackage(subPackage.getNsURI(), subPackage);
}
}
@Override
public Object put(String key, Object value)
{
- Object oldValue = super.get(key);
- if (oldValue instanceof EPackageImpl)
+ if (TRACER.isEnabled())
{
- throw new IllegalArgumentException("Duplicate key: " + key);
+ TRACER.format("Registering package for {0}", key);
}
if (value instanceof EPackageImpl)