本文整理匯總了Java中org.eclipse.emf.ecore.EObject.eContainingFeature方法的典型用法代碼示例。如果您正苦於以下問題:Java EObject.eContainingFeature方法的具體用法?Java EObject.eContainingFeature怎麽用?Java EObject.eContainingFeature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.emf.ecore.EObject
的用法示例。
在下文中一共展示了EObject.eContainingFeature方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: exposeType
import org.eclipse.emf.ecore.EObject; //導入方法依賴的package包/類
/**
* If 'object' is a type or a constituent of a type (e.g. field of a class) in 'internalTypes', then move the type
* to 'exposedInternalTypes'.
*/
private static void exposeType(Object object) {
if (!(object instanceof EObject) || ((EObject) object).eIsProxy()) {
return;
}
// object might not be a type but reside inside a type, e.g. field of a class
// --> so search for the root, i.e. the ancestor directly below the TModule
EObject rootTMP = (EObject) object;
while (rootTMP != null && !(rootTMP.eContainer() instanceof TModule)) {
rootTMP = rootTMP.eContainer();
}
final EObject root = rootTMP; // must be final for the lambda below
if (root instanceof Type
&& root.eContainingFeature() == TypesPackage.eINSTANCE.getTModule_InternalTypes()) {
final TModule module = (TModule) root.eContainer();
EcoreUtilN4.doWithDeliver(false, () -> {
module.getExposedInternalTypes().add((Type) root);
}, module, root); // note: root already contained in resource, so suppress notifications also in root!
// everything referenced by the type we just moved to 'exposedInternalTypes' has to be exposed as well
// (this is required, for example, if 'root' is a structural type, see:
// org.eclipse.n4js.xpect.ui.tests/testdata_ui/typesystem/structuralTypeRefWithMembersAcrossFiles/Main.n4js.xt)
exposeTypesReferencedBy(root);
}
}