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


Java EReference.isDerived方法代碼示例

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


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

示例1: getConnectedEdgesForEObject

import org.eclipse.emf.ecore.EReference; //導入方法依賴的package包/類
/**
 * Add outgoing references
 */
private void getConnectedEdgesForEObject(Node node, final List<Node> allNodes, final List<Edge> result,
		final EObject eobj) {

	for (EReference currRef : eobj.eClass().getEAllReferences()) {
		if (!currRef.isDerived() && !currRef.isContainer()) {
			if (currRef.isMany()) {
				final Object targets = eobj.eGet(currRef, false);
				if (targets instanceof Collection<?>) {
					getConnectedEdgesForEObjectManyCase(node, allNodes, result, currRef, targets);
				}
			} else {
				final Object target = eobj.eGet(currRef, false);
				if (target instanceof EObject) {
					getConnectedEdgesForEObjectSingleCase(node, allNodes, result, currRef, target);
				}
			}
		}
	}

	// add reference to containing Resource if immediate container is not in graph
	// (required when showing lower-level objects while hiding their ancestors)
	Node nodeForElement = GraphUtils.getNodeForElement(eobj.eContainer(), allNodes);

	if (eobj.eResource() != null && eobj.eContainer() != null && nodeForElement == null) {
		final Node nodeForResource = GraphUtils.getNodeForElement(eobj.eResource(), allNodes);
		if (nodeForResource != null) {
			Edge edge = new Edge(
					"<... containment omitted ...>",
					false, // not a cross-link
					nodeForResource,
					Collections.singletonList(node),
					Collections.emptyList());

			result.add(edge);
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:41,代碼來源:ASTGraphProvider.java


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