carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/Utils.ext
author cawthron
Fri, 04 Dec 2009 11:06:59 -0600
changeset 422 033392511bf7
permissions -rw-r--r--
add files for RCL_2_2

/*
 * Copyright (c) 2006 Borland Software Corporation
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Dmitry Stadnik (Borland) - initial API and implementation
 */

import "http://www.eclipse.org/gmf/2008/GenModel";
import "http://www.eclipse.org/emf/2002/Ecore";
import "http://www.eclipse.org/emf/2002/GenModel";

extension xpt::GenModelUtils;

// all diagram nodes
List[gmfgen::GenNode] getNodes(gmfgen::GenDiagram diagram) :
	{}.addAll(diagram.topLevelNodes).addAll(diagram.childNodes)
;

// all elements that may have element type: diagram, nodes and links
List[gmfgen::GenCommonBase] getElements(gmfgen::GenDiagram diagram) :
	{ diagram }.addAll(diagram.topLevelNodes).addAll(diagram.childNodes).addAll(diagram.links)
;

boolean hasExplicitChildFeature(gmfgen::TypeModelFacet facet) :
	!isDerived(facet.childMetaFeature) && facet.childMetaFeature != facet.containmentMetaFeature
;

List[gmfgen::GenLink] getOutgoingLinks(gmfgen::GenNode node) :
	node.getDiagram().links.select(link | link.getAssistantSources().contains(node))
;

List[gmfgen::GenLink] getIncomingLinks(gmfgen::GenNode node) :
	node.getDiagram().links.select(link | link.getAssistantTargets().contains(node))
;