當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。