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 [SinkRoleItemSemanticEditPolicy.java]

nameclass, %method, %block, %line, %
SinkRoleItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/176)0%   (0/45)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SinkRoleItemSemanticEditPolicy0%   (0/1)0%   (0/7)0%   (0/176)0%   (0/45)
SinkRoleItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/10)0%   (0/4)
getCompleteCreateRelationshipCommandAssemblyEventConnector (CreateRelationshi... 0%   (0/1)0%   (0/38)0%   (0/10)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/19)0%   (0/4)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/82)0%   (0/18)
getReorientRelationshipCommand (ReorientRelationshipRequest): Command 0%   (0/1)0%   (0/15)0%   (0/3)
getStartCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/8)0%   (0/4)

1/*
2 * Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.edit.policies;
5 
6import java.util.Iterator;
7import org.eclipse.emf.ecore.EAnnotation;
8import org.eclipse.emf.ecore.EObject;
9import org.eclipse.gef.commands.Command;
10import org.eclipse.gef.commands.UnexecutableCommand;
11import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
12import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
13import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
14import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
15import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
16import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
17import org.eclipse.gmf.runtime.notation.Edge;
18import org.eclipse.gmf.runtime.notation.View;
19 
20import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext;
21import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure;
22import de.uka.ipd.sdq.pcm.core.composition.CompositionPackage;
23import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyConnectorTypeLinkCreateCommand;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyEventConnectorCreateCommand;
25import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyEventConnectorReorientCommand;
26import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyEventConnectorEditPart;
27import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
28import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
29import de.uka.ipd.sdq.pcm.repository.OperationProvidedRole;
30import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole;
31import de.uka.ipd.sdq.pcm.repository.SinkRole;
32import de.uka.ipd.sdq.pcm.repository.SourceRole;
33 
34/**
35 * @generated
36 */
37public class SinkRoleItemSemanticEditPolicy extends
38                PalladioComponentModelBaseItemSemanticEditPolicy {
39 
40        /**
41         * @generated
42         */
43        public SinkRoleItemSemanticEditPolicy() {
44                super(PalladioComponentModelElementTypes.SinkRole_3014);
45        }
46 
47        /**
48         * @generated
49         */
50        protected Command getDestroyElementCommand(DestroyElementRequest req) {
51                View view = (View) getHost().getModel();
52                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
53                                getEditingDomain(), null);
54                cmd.setTransactionNestingEnabled(false);
55                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
56                        Edge incomingLink = (Edge) it.next();
57                        if (PalladioComponentModelVisualIDRegistry
58                                        .getVisualID(incomingLink) == AssemblyEventConnectorEditPart.VISUAL_ID) {
59                                DestroyElementRequest r = new DestroyElementRequest(
60                                                incomingLink.getElement(), false);
61                                cmd.add(new DestroyElementCommand(r));
62                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
63                                continue;
64                        }
65                }
66                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
67                if (annotation == null) {
68                        // there are indirectly referenced children, need extra commands: false
69                        addDestroyShortcutsCommand(cmd, view);
70                        // delete host element
71                        cmd.add(new DestroyElementCommand(req));
72                } else {
73                        cmd.add(new DeleteCommand(getEditingDomain(), view));
74                }
75                return getGEFWrapper(cmd.reduce());
76        }
77 
78        /**
79         * Get the create relationship command or null / UnexecutableCommand instance
80         * if this is not an valid end for the connector creation.
81         * 
82         * This has been manually adopted to fix this connection for AssemblyEventConnectors
83         *  
84         * @generated
85         */
86        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
87                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
88                                : getCompleteCreateRelationshipCommand(req);
89                return command != null ? command : super
90                                .getCreateRelationshipCommand(req);
91        }
92 
93        /**
94         * @generated
95         */
96        protected Command getStartCreateRelationshipCommand(
97                        CreateRelationshipRequest req) {
98                if (PalladioComponentModelElementTypes.AssemblyEventConnector_4007 == req
99                                .getElementType()) {
100                        return null;
101                }
102                return null;
103        }
104 
105        /**
106         * Create the command to complete the relationship.
107         * 
108         * This has manually be adopted to set the container and contexts in the request.
109         * 
110         * @generated not
111         */
112        protected Command getCompleteCreateRelationshipCommand(
113                        CreateRelationshipRequest req) {
114                if (PalladioComponentModelElementTypes.AssemblyEventConnector_4007 == req
115                                .getElementType()) {
116 
117                        return getCompleteCreateRelationshipCommandAssemblyEventConnector(req);
118                }
119                return null;
120        }
121 
122        /**
123         * Create the command to complete the relationship.
124         * 
125         * This has manually be adopted to set the container and contexts in the request.
126         * 
127         * @param req The request object for this command request
128         * @return The prepared command.
129         *  
130         * @generated not
131         */
132        protected Command getCompleteCreateRelationshipCommandAssemblyEventConnector(
133                        CreateRelationshipRequest req) {
134 
135                // set the container
136                ComposedStructure container = (ComposedStructure) getRelationshipContainer(
137                                req.getSource(), CompositionPackage.eINSTANCE
138                                                .getComposedStructure(), req.getElementType());
139                if (container == null) {
140                        return UnexecutableCommand.INSTANCE;
141                }
142                req.setParameter("CONTAINER", container);
143 
144                // set the contexts
145                req.setParameter("SINK_CONTEXT", ((View) getHost().getParent()
146                                .getModel()).getElement());
147 
148                return getGEFWrapper(new AssemblyEventConnectorCreateCommand(req, req
149                                .getSource(), req.getTarget()));
150        }
151 
152        /**
153         * Returns command to reorient EClass based link. New link target or source
154         * should be the domain model element associated with this node.
155         * 
156         * @generated
157         */
158        protected Command getReorientRelationshipCommand(
159                        ReorientRelationshipRequest req) {
160                switch (getVisualID(req)) {
161                case AssemblyEventConnectorEditPart.VISUAL_ID:
162                        return getGEFWrapper(new AssemblyEventConnectorReorientCommand(req));
163                }
164                return super.getReorientRelationshipCommand(req);
165        }
166 
167}

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