当前位置: 首页>>代码示例>>Java>>正文


Java EObject.eContainingFeature方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:31,代码来源:N4JSPostProcessor.java


注:本文中的org.eclipse.emf.ecore.EObject.eContainingFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。