當前位置: 首頁>>代碼示例>>Java>>正文


Java EcoreUtil.getRootContainer方法代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.util.EcoreUtil.getRootContainer方法的典型用法代碼示例。如果您正苦於以下問題:Java EcoreUtil.getRootContainer方法的具體用法?Java EcoreUtil.getRootContainer怎麽用?Java EcoreUtil.getRootContainer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.ecore.util.EcoreUtil的用法示例。


在下文中一共展示了EcoreUtil.getRootContainer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: contentTypeMustBeDefined

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
private List<Diagnostic> contentTypeMustBeDefined(Body body) {
    final List<Diagnostic> validationErrors = new ArrayList<>();
    final EObject rootContainer = EcoreUtil.getRootContainer(body);

    final boolean contentTypesDefined;
    if (rootContainer instanceof Api) {
        final Api api = (Api) rootContainer;
        contentTypesDefined = api.getMediaType().size() > 0 || body.getContentTypes().size() > 0;
    } else {
        contentTypesDefined = body.getContentTypes().size() > 0;
    }
    if (!contentTypesDefined) {
        validationErrors.add(error("Content type undefined", body));
    }
    return validationErrors;
}
 
開發者ID:vrapio,項目名稱:rest-modeling-framework,代碼行數:17,代碼來源:ResponsesValidator.java

示例2: getSingleElement

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
/**
 * Enhanced query-Method marking the originating import as used.
 *
 * @see org.eclipse.xtext.scoping.IScope#getSingleElement(org.eclipse.xtext.naming.QualifiedName)
 */
@Override
public IEObjectDescription getSingleElement(QualifiedName name) {
	IEObjectDescription ret = delegatee.getSingleElement(name);
	if (ret == null)
		return null;

	ImportSpecifier origin = origins.get(ret);
	if (origin != null) {
		EObject script = EcoreUtil.getRootContainer(origin);
		if ((script instanceof Script) && ((Script) script).isFlaggedUsageMarkingFinished()) {
			// do nothing as linking phase is over
		} else {
			markAsUsed(origin);

			// TODO: Mark Twin-Ambiguous as well as used.
			if (ret instanceof AmbiguousImportDescription) {
				AmbiguousImportDescription ambiguousImportDescription = (AmbiguousImportDescription) ret;
				for (ImportSpecifier ispec : ambiguousImportDescription.getOriginatingImports()) {
					markAsUsed(ispec);
				}
			} else if (ret instanceof PlainAccessOfAliasedImportDescription) {
				PlainAccessOfAliasedImportDescription plainAccess = (PlainAccessOfAliasedImportDescription) ret;
				ImportSpecifier plainImport = origins.get(plainAccess.getDelegate());
				if (plainImport != null)
					markAsUsed(plainImport);
			}
		}
	}
	return ret;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:36,代碼來源:OriginAwareScope.java

示例3: getExtendedPackage

import org.eclipse.emf.ecore.util.EcoreUtil; //導入方法依賴的package包/類
public String getExtendedPackage(EObject eObject) {
	Extension extension = (Extension) EcoreUtil.getRootContainer(eObject);
	String extensionFile = OcciRegistry.getInstance().getFileURI(extension.getScheme());
	String[] args = extensionFile.split("\\/");
	return args[args.length-3];
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:7,代碼來源:GenUtils.java


注:本文中的org.eclipse.emf.ecore.util.EcoreUtil.getRootContainer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。