Java Code Examples for org.eclipse.emf.ecore.EPackage#Registry

The following examples show how to use org.eclipse.emf.ecore.EPackage#Registry . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
/**
    * Determine whether the class represented by {@code left} is either the same as
    * or is a superclass of the class represented by {@code right}.
 */
protected boolean isAssignableFrom(EClass left, EClass right) {
	if (right != null && left.isSuperTypeOf(right))
		return true;
	EClass eObjectType = GrammarUtil.findEObject(grammar);
	if (left == eObjectType)
		return true;
	if (grammar != null) {
		Resource grammarResource = grammar.eResource();
		if (grammarResource != null) {
			ResourceSet resourceSet = grammarResource.getResourceSet();
			if (resourceSet != null) {
				EPackage.Registry registry = resourceSet.getPackageRegistry();
				if (registry != null) {
					EPackage ecorePackage = registry.getEPackage(EcorePackage.eNS_URI);
					if (ecorePackage != null) {
						EClassifier eObjectFromRegistry = ecorePackage.getEClassifier(EcorePackage.Literals.EOBJECT.getName());
						if (left == eObjectFromRegistry) {
							return true;
						}
					}
				}
			}
		}
	}
	if (right != null && left.getInstanceClass() != null && right.getInstanceClass() != null) {
		boolean result = left.getInstanceClass().isAssignableFrom(right.getInstanceClass());
		return result;
	}
	return false;
}
 
Example 2
private void register(final EPackage ePackage) {
  final EPackage.Registry registry = ePackage.eResource().getResourceSet().getPackageRegistry();
  Object _get = registry.get(ePackage.getNsURI());
  boolean _tripleEquals = (_get == null);
  if (_tripleEquals) {
    registry.put(ePackage.getNsURI(), ePackage);
  }
}
 
Example 3
public EPackage.Registry bindEPackageRegistry() {
	return EPackage.Registry.INSTANCE;
}
 
Example 4
/**
 * Default constructor.
 *
 * @param delegate
 *            Registry to which method calls are delegated
 */
public PackageRegistry(EPackage.Registry delegate) {
	this.delegate = delegate;
}