public List<EPackage> getNestedPackages(EPackage pkg) { return pkg.getESubpackages(); }
@SuppressWarnings("unchecked") @Override protected Iterator<EPackage> getChildren(Object object) { return object instanceof Collection ? ((Collection<EPackage>)object).iterator() : ((EPackage)object).getESubpackages().iterator(); } };
private static void addPackage(Set<EPackage> result, EPackage p) { result.add(p); for (EPackage subPackage : p.getESubpackages()) { addPackage(result, subPackage); } } }
private static void getAllPackages(EPackage ePackage, List<EPackage> result) { result.add(ePackage); for (EPackage subPackage : ePackage.getESubpackages()) { getAllPackages(subPackage, result); } }
/** * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. * <p> * The generated implementation is extended by adding me as a child of * the empty root <tt>OCL</tt> package. * </p> */ public void initializePackageContents() { if (!isInitialized) { // create my own resource first, before adding me to my parent // package. Otherwise, I will already be in a resource when // createResource() is called, and it will not create a new one initializePackageContentsGen(); ExpressionsPackageImpl.OCL_ROOT_PACKAGE.getESubpackages().add(this); } }
/** * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. * <p> * The generated implementation is extended by adding me as a child of * the empty root <tt>OCL</tt> package. * </p> */ public void initializePackageContents() { if (!isInitialized) { // create my own resource first, before adding me to my parent // package. Otherwise, I will already be in a resource when // createResource() is called, and it will not create a new one initializePackageContentsGen(); OCL_ROOT_PACKAGE.getESubpackages().add(this); } }
/** * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. * <p> * The generated implementation is extended by adding me as a child of * the empty root <tt>OCL</tt> package. * </p> */ public void initializePackageContents() { if (!isInitialized) { // create my own resource first, before adding me to my parent // package. Otherwise, I will already be in a resource when // createResource() is called, and it will not create a new one initializePackageContentsGen(); ExpressionsPackageImpl.OCL_ROOT_PACKAGE.getESubpackages().add(this); } }
/** * @param ePackage * @return all EClassifiers contained in the ePackage, and in the subpackages as well */ private static Set<EClassifier> getAllEClassifiers(EPackage ePackage) { Set<EClassifier> resultSet = new HashSet<EClassifier>(); resultSet.addAll(ePackage.getEClassifiers()); for (EPackage subEPackage : ePackage.getESubpackages()) { resultSet.addAll(subEPackage.getEClassifiers()); } return resultSet; }
protected void installPackages(EPackage.Registry packageRegistry, List<? extends EObject> contents) { for (EObject eObject : contents) { if (eObject instanceof EPackage) { EPackage ePackage = (EPackage)eObject; packageRegistry.put(ePackage.getNsURI(), ePackage); installPackages(packageRegistry, ePackage.getESubpackages()); } } }
/** * @since 2.0 */ public static boolean prepareDynamicEPackage(EPackage startPackage) { if (CDOFactoryImpl.prepareDynamicEPackage(startPackage)) { for (EPackage subPackage : startPackage.getESubpackages()) { prepareDynamicEPackage(subPackage); } return true; } return false; }
/** * @since 2.0 */ public static boolean prepareDynamicEPackage(EPackage startPackage) { if (CDOFactoryImpl.prepareDynamicEPackage(startPackage)) { for (EPackage subPackage : startPackage.getESubpackages()) { prepareDynamicEPackage(subPackage); } return true; } return false; }
protected void initializeFromLoadedEPackage(EPackage target, EPackage source) { target.setName(source.getName()); target.setNsPrefix(source.getNsPrefix()); target.setNsURI(source.getNsURI()); target.getEClassifiers().addAll(source.getEClassifiers()); target.getEAnnotations().addAll(source.getEAnnotations()); for (EPackage sourceSubpackage : source.getESubpackages()) { EPackage targetSubpackage = EPackage.Registry.INSTANCE.getEPackage(sourceSubpackage.getNsURI()); initializeFromLoadedEPackage(targetSubpackage, sourceSubpackage); target.getESubpackages().add(targetSubpackage); } }
private void attachPackageInfos(EPackage ePackage) { InternalCDOPackageInfo packageInfo = getPackageInfo(ePackage.getNsURI()); if (packageInfo != null) { packageRegistry.registerPackageInfo(ePackage, packageInfo); } for (EPackage subPackage : ePackage.getESubpackages()) { attachPackageInfos(subPackage); } }
protected void initializeFromLoadedEPackage(EPackage target, EPackage source) { target.setName(source.getName()); target.setNsPrefix(source.getNsPrefix()); target.setNsURI(source.getNsURI()); target.getEClassifiers().addAll(source.getEClassifiers()); target.getEAnnotations().addAll(source.getEAnnotations()); for (EPackage sourceSubpackage : source.getESubpackages()) { EPackage targetSubpackage = EPackage.Registry.INSTANCE.getEPackage(sourceSubpackage.getNsURI()); initializeFromLoadedEPackage(targetSubpackage, sourceSubpackage); target.getESubpackages().add(targetSubpackage); } }
public static EClass getEClassRecursive(final EPackage rootEPackage, final String className) { checkNotNull(rootEPackage, "Precondition violation - argument 'rootEPackage' must not be NULL!"); checkNotNull(className, "Precondition violation - argument 'className' must not be NULL!"); EClass eClass = (EClass) rootEPackage.getEClassifier(className); if (eClass != null) { return eClass; } for (EPackage ePackage : rootEPackage.getESubpackages()) { eClass = getEClassRecursive(ePackage, className); if (eClass != null) { return eClass; } } return null; }
public static EClassifier getEClassifierRecursive(final EPackage rootEPackage, final String classifierName) { checkNotNull(rootEPackage, "Precondition violation - argument 'rootEPackage' must not be NULL!"); checkNotNull(classifierName, "Precondition violation - argument 'classifierName' must not be NULL!"); EClassifier eClassifier = rootEPackage.getEClassifier(classifierName); if (eClassifier != null) { return eClassifier; } for (EPackage ePackage : rootEPackage.getESubpackages()) { eClassifier = getEClassifierRecursive(ePackage, classifierName); if (eClassifier != null) { return eClassifier; } } return null; }
private void doCollectContents(EPackage ePackage, Set<EPackage> visited) { if (TRACER.isEnabled()) { TRACER.trace("Package closure for " + ePackage.getNsURI()); //$NON-NLS-1$ } handleEPackage(ePackage, visited); for (EPackage subPackage : ePackage.getESubpackages()) { doCollectContents(subPackage, visited); } }
private void doCollectContents(EPackage ePackage, Set<EPackage> visited) { if (TRACER.isEnabled()) { TRACER.trace("Package closure for " + ePackage.getNsURI()); //$NON-NLS-1$ } handleEPackage(ePackage, visited); for (EPackage subPackage : ePackage.getESubpackages()) { doCollectContents(subPackage, visited); } }
/** * @since 3.2 */ protected void unloadDelegate(EObject eObject) { if (eObject instanceof EPackage) { EPackage ePackage = (EPackage)eObject; DelegateEPackageAdapter adapter = DelegateEPackageAdapter.findAdapter(ePackage); if (adapter != null) { adapter.unloadDelegates(); } unloadDelegates(ePackage.getESubpackages()); } Resource resource = getTarget(); if (resource != null) { resource.eAdapters().remove(this); } }
private void initPackageInfos(EPackage ePackage, List<InternalCDOPackageInfo> result) { InternalCDOPackageInfo packageInfo = (InternalCDOPackageInfo)CDOModelUtil.createPackageInfo(); packageInfo.setPackageUnit(this); packageInfo.setPackageURI(ePackage.getNsURI()); packageInfo.setParentURI(ePackage.getESuperPackage() == null ? null : ePackage.getESuperPackage().getNsURI()); packageRegistry.basicPut(ePackage.getNsURI(), ePackage); packageRegistry.registerPackageInfo(ePackage, packageInfo); result.add(packageInfo); for (EPackage subPackage : ePackage.getESubpackages()) { initPackageInfos(subPackage, result); } }