EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.composite.edit.policies]

COVERAGE SUMMARY FOR SOURCE FILE [AssemblyContextCanonicalEditPolicy.java]

nameclass, %method, %block, %line, %
AssemblyContextCanonicalEditPolicy.java0%   (0/1)0%   (0/5)0%   (0/109)0%   (0/37)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AssemblyContextCanonicalEditPolicy0%   (0/1)0%   (0/5)0%   (0/109)0%   (0/37)
AssemblyContextCanonicalEditPolicy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getDefaultFactoryHint (): String 0%   (0/1)0%   (0/2)0%   (0/1)
getFeaturesToSynchronize (): Set 0%   (0/1)0%   (0/23)0%   (0/9)
getSemanticChildrenList (): List 0%   (0/1)0%   (0/67)0%   (0/21)
isOrphaned (Collection, View): boolean 0%   (0/1)0%   (0/14)0%   (0/5)

1/*
2 *Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.edit.policies;
5 
6import java.util.Collection;
7import java.util.HashSet;
8import java.util.Iterator;
9import java.util.LinkedList;
10import java.util.List;
11import java.util.Set;
12 
13import org.eclipse.emf.ecore.EObject;
14import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
15import org.eclipse.gmf.runtime.notation.View;
16 
17import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext;
18import de.uka.ipd.sdq.pcm.core.entity.EntityPackage;
19import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingEntity;
20import de.uka.ipd.sdq.pcm.core.entity.InterfaceRequiringEntity;
21import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.InfrastructureProvidedRoleEditPart;
22import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.InfrastructureRequiredRoleEditPart;
23import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.OperationProvidedRoleEditPart;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.OperationRequiredRoleEditPart;
25import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.SinkRoleEditPart;
26import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.SourceRoleEditPart;
27import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelDiagramUpdater;
28import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelNodeDescriptor;
29import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
30 
31/**
32 * @generated
33 */
34public class AssemblyContextCanonicalEditPolicy extends CanonicalEditPolicy {
35 
36        /**
37         * @generated
38         */
39        Set myFeaturesToSynchronize;
40 
41        /**
42         * Get the semantic children of an assembly context.
43         * 
44         * This has been adopted manually for the composite editor diagram.
45         * The direct semantic child of an assembly context is the encapsulated component. 
46         * In case of the composite diagram we present the provided and required roles of the 
47         * component to the user instead. For this, the getSemanticChildrenList method collects all roles
48         * from the encapsulated component.
49         * 
50         * @return The list of prov. and req. roles of the encapsulated component
51         * 
52         * @generated not
53         */
54        protected List getSemanticChildrenList() {
55                List result = new LinkedList();
56                EObject modelObject = ((View) getHost().getModel()).getElement();
57                AssemblyContext ctx = (AssemblyContext) modelObject;
58                modelObject = ctx.getEncapsulatedComponent__AssemblyContext();
59                View viewObject = (View) getHost().getModel();
60                EObject nextValue;
61                int nodeVID;
62                if (modelObject != null) {
63                        for (Iterator values = ((InterfaceProvidingEntity) modelObject)
64                                        .getProvidedRoles_InterfaceProvidingEntity().iterator(); values
65                                        .hasNext();) {
66                                nextValue = (EObject) values.next();
67                                nodeVID = PalladioComponentModelVisualIDRegistry
68                                                .getNodeVisualID(viewObject, nextValue);
69                                // if (OperationProvidedRoleEditPart.VISUAL_ID == nodeVID) {
70                                result.add(nextValue);
71                                // }
72                        }
73                        for (Iterator values = ((InterfaceRequiringEntity) modelObject)
74                                        .getRequiredRoles_InterfaceRequiringEntity().iterator(); values
75                                        .hasNext();) {
76                                nextValue = (EObject) values.next();
77                                nodeVID = PalladioComponentModelVisualIDRegistry
78                                                .getNodeVisualID(viewObject, nextValue);
79                                // if (OperationRequiredRoleEditPart.VISUAL_ID == nodeVID) {
80                                result.add(nextValue);
81                                // }
82                        }
83                }
84                return result;
85        }
86 
87        /**
88         * @generated
89         */
90        protected boolean isOrphaned(Collection semanticChildren, final View view) {
91                int visualID = PalladioComponentModelVisualIDRegistry.getVisualID(view);
92                switch (visualID) {
93                case OperationProvidedRoleEditPart.VISUAL_ID:
94                case OperationRequiredRoleEditPart.VISUAL_ID:
95                case SourceRoleEditPart.VISUAL_ID:
96                case SinkRoleEditPart.VISUAL_ID:
97                case InfrastructureProvidedRoleEditPart.VISUAL_ID:
98                case InfrastructureRequiredRoleEditPart.VISUAL_ID:
99                        if (!semanticChildren.contains(view.getElement())) {
100                                return true;
101                        }
102                }
103                return false;
104        }
105 
106        /**
107         * @generated
108         */
109        protected String getDefaultFactoryHint() {
110                return null;
111        }
112 
113        /**
114         * @generated
115         */
116        protected Set getFeaturesToSynchronize() {
117                if (myFeaturesToSynchronize == null) {
118                        myFeaturesToSynchronize = new HashSet();
119                        myFeaturesToSynchronize
120                                        .add(EntityPackage.eINSTANCE
121                                                        .getInterfaceProvidingEntity_ProvidedRoles_InterfaceProvidingEntity());
122                        myFeaturesToSynchronize
123                                        .add(EntityPackage.eINSTANCE
124                                                        .getInterfaceRequiringEntity_RequiredRoles_InterfaceRequiringEntity());
125                }
126                return myFeaturesToSynchronize;
127        }
128 
129}

[all classes][de.uka.ipd.sdq.pcm.gmf.composite.edit.policies]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov