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

The following examples show how to use org.eclipse.emf.ecore.EPackage#Registry . 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 check out the related API usage on the sidebar.
Example 1
Source File: EClassifierInfo.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
    * 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
Source File: XtextGeneratorResourceSetInitializer.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
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
Source File: DefaultRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public EPackage.Registry bindEPackageRegistry() {
	return EPackage.Registry.INSTANCE;
}
 
Example 4
Source File: ReleaseUtils.java    From bonita-studio with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Default constructor.
 *
 * @param delegate
 *            Registry to which method calls are delegated
 */
public PackageRegistry(EPackage.Registry delegate) {
	this.delegate = delegate;
}