本文整理匯總了Java中org.eclipse.emf.ecore.EPackage.eAllContents方法的典型用法代碼示例。如果您正苦於以下問題:Java EPackage.eAllContents方法的具體用法?Java EPackage.eAllContents怎麽用?Java EPackage.eAllContents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.emf.ecore.EPackage
的用法示例。
在下文中一共展示了EPackage.eAllContents方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: persistMetamodel
import org.eclipse.emf.ecore.EPackage; //導入方法依賴的package包/類
public static void persistMetamodel(ResourceSet resourceSet, EPackage generated, String path) throws IOException {
if (new File(path).exists()) {
EPackage existing = (EPackage) OcciHelper.getRootElement(resourceSet, "file:/" + path);
for (Iterator<EObject> iterator = existing.eAllContents(); iterator.hasNext();) {
EObject eo = iterator.next();
if (eo instanceof EAnnotation && isOCLRelated((EAnnotation) eo)) {
EModelElement existingContainer = (EModelElement) eo.eContainer();
EModelElement generatedContainer = (EModelElement) getGeneratedElement(generated,
existingContainer);
if (generatedContainer == null) {
throw new RuntimeException("Unable to find " + existingContainer + " to reattach " + eo + " "
+ ((EAnnotation) eo).getEAnnotations());
} else {
generatedContainer.getEAnnotations().add((EAnnotation) EcoreUtil.copy(eo));
}
}
}
}
ConverterUtils.save(resourceSet, generated, "file:/" + path);
}