carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/LinkNotationModelRefresher.ext
changeset 422 033392511bf7
equal deleted inserted replaced
421:631a44165bcf 422:033392511bf7
       
     1 /*
       
     2  * Copyright (c) 2007 Borland Software Corp.
       
     3  * 
       
     4  * All rights reserved. This program and the accompanying materials
       
     5  * are made available under the terms of the Eclipse Public License v1.0
       
     6  * which accompanies this distribution, and is available at
       
     7  * http://www.eclipse.org/legal/epl-v10.html
       
     8  *
       
     9  * Contributors:
       
    10  *    bblajer (Borland) - initial API and implementation
       
    11  */
       
    12 
       
    13 import "http://www.eclipse.org/emf/2002/Ecore";
       
    14 import "http://www.eclipse.org/emf/2002/GenModel";
       
    15 import "http://www.eclipse.org/gmf/2008/GenModel";
       
    16 extension xpt::diagram::LinkFinder;
       
    17 
       
    18 boolean needsLinkNotationModelRefresher(gmfgen::GenCommonBase gcb) :
       
    19 	gcb.primNeedsLinkNotationModelRefresher()
       
    20 ;
       
    21 
       
    22 boolean needsLinkNotationModelRefresher(gmfgen::GenDiagram diagram) :
       
    23 	true	//due to uncontained links
       
    24 ;
       
    25 
       
    26 boolean primNeedsLinkNotationModelRefresher(gmfgen::GenCommonBase gcb) :
       
    27 	gcb.containedLinks().size() > 0
       
    28 ;
       
    29 
       
    30 cached Collection[genmodel::GenFeature] getAffectingFeatures(gmfgen::GenCommonBase gcb) :
       
    31 	{}.union(gcb.containedLinks().modelFacet.collect(e| e.getAffectingFeatures()).flatten())
       
    32 ;
       
    33 
       
    34 private Collection[genmodel::GenFeature] getAffectingFeatures(gmfgen::LinkModelFacet facet) :
       
    35 	{}
       
    36 ;
       
    37 
       
    38 private Collection[genmodel::GenFeature] getAffectingFeatures(gmfgen::TypeLinkModelFacet facet) :
       
    39 	{facet.childMetaFeature, facet.sourceMetaFeature, facet.targetMetaFeature}.select(e| e != null)
       
    40 ;
       
    41 
       
    42 private Collection[genmodel::GenFeature] getAffectingFeatures(gmfgen::FeatureLinkModelFacet facet) :
       
    43 	{facet.metaFeature}
       
    44 ;
       
    45 
       
    46 Collection[genmodel::GenFeature] getLinkChildFeatures(gmfgen::GenCommonBase gcb) :
       
    47 	getLinkChildFeatures(gcb, containedLinks(gcb))
       
    48 ;
       
    49 
       
    50 Collection[genmodel::GenFeature] getLinkChildFeatures(gmfgen::GenCommonBase gcb, Collection[gmfgen::GenLink] someOfContainedLinks) :
       
    51 	{}.union(someOfContainedLinks.collect(e| e.modelFacet.getLinkChildFeature())).select(e| e != null)
       
    52 ;
       
    53 
       
    54 private genmodel::GenFeature getLinkChildFeature(gmfgen::LinkModelFacet facet) :
       
    55 	null
       
    56 ;
       
    57 
       
    58 private genmodel::GenFeature getLinkChildFeature(gmfgen::TypeLinkModelFacet facet) :
       
    59 	facet.childMetaFeature
       
    60 ;
       
    61 
       
    62 private genmodel::GenFeature getLinkChildFeature(gmfgen::FeatureLinkModelFacet facet) :
       
    63 	facet.metaFeature
       
    64 ;
       
    65 
       
    66 Collection[gmfgen::GenNode] getTypeGenLinksForFeature(gmfgen::GenCommonBase gcb, genmodel::GenFeature genFeature, Collection[gmfgen::GenLink] containedLinks) :
       
    67 JAVA org.eclipse.gmf.internal.codegen.lite.utils.SemanticSyncUtils.getTypeGenLinks(org.eclipse.gmf.codegen.gmfgen.GenCommonBase, org.eclipse.emf.codegen.ecore.genmodel.GenFeature, java.util.Collection)
       
    68 ;
       
    69 
       
    70 Collection[gmfgen::GenNode] getFeatureGenLinksForFeature(gmfgen::GenCommonBase gcb, genmodel::GenFeature genFeature, Collection[gmfgen::GenLink] containedLinks) :
       
    71 JAVA org.eclipse.gmf.internal.codegen.lite.utils.SemanticSyncUtils.getFeatureGenLinks(org.eclipse.gmf.codegen.gmfgen.GenCommonBase, org.eclipse.emf.codegen.ecore.genmodel.GenFeature, java.util.Collection)
       
    72 ;
       
    73 
       
    74 cached Collection[gmfgen::GenCommonBase] getLinkContainersWithAncestors(gmfgen::GenDiagram diagram) :
       
    75 	buildAncestorClosure((Collection[gmfgen::GenCommonBase]) diagram.links.collect(e| e.getPossibleContainers()).flatten())
       
    76 ;
       
    77 
       
    78 private Collection[gmfgen::GenCommonBase] buildAncestorClosure(Collection[gmfgen::GenCommonBase] elements) :
       
    79 JAVA org.eclipse.gmf.internal.codegen.lite.utils.SemanticSyncUtils.buildAncestorClosure(java.util.Collection)
       
    80 ;
       
    81 
       
    82 Collection[gmfgen::GenCommonBase] getContainedContainers(gmfgen::GenCommonBase gcb) :
       
    83 	{}
       
    84 ;
       
    85 
       
    86 Collection[gmfgen::GenCommonBase] getContainedContainers(gmfgen::GenContainerBase gcb) :
       
    87 	gcb.containedNodes
       
    88 ;
       
    89 
       
    90 Collection[gmfgen::GenCommonBase] getContainedContainers(gmfgen::GenNode node) :
       
    91 	{}.addAll(node.containedNodes).addAll(node.compartments).addAll(node.containedLinks())
       
    92 ;
       
    93 
       
    94 Collection[gmfgen::GenCommonBase] getContainedContainers(gmfgen::GenLink link) :
       
    95 	link.containedLinks()
       
    96 ;
       
    97