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

nameclass, %method, %block, %line, %
OperationProvidedRole2ItemSemanticEditPolicy.java0%   (0/1)0%   (0/6)0%   (0/215)0%   (0/53)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperationProvidedRole2ItemSemanticEditPolicy0%   (0/1)0%   (0/6)0%   (0/215)0%   (0/53)
OperationProvidedRole2ItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/2)0%   (0/1)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/19)0%   (0/4)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/145)0%   (0/33)
getReorientRelationshipCommand (ReorientRelationshipRequest): Command 0%   (0/1)0%   (0/22)0%   (0/5)
getStartCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/23)0%   (0/8)

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;
7 
8import org.eclipse.emf.ecore.EAnnotation;
9import org.eclipse.gef.commands.Command;
10import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
11import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
12import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
13import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
14import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
15import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
16import org.eclipse.gmf.runtime.notation.Edge;
17import org.eclipse.gmf.runtime.notation.View;
18 
19import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyConnectorCreateCommand;
20import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyConnectorReorientCommand;
21import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.ProvidedDelegationConnectorCreateCommand;
22import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.ProvidedDelegationConnectorReorientCommand;
23import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyConnectorEditPart;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ProvidedDelegationConnectorEditPart;
25import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
26import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
27 
28/**
29 * Semantic Edit Policy for Operation Provided Role Delegation connectors.
30 * 
31 * This edit policy has to ensure that operation provided delegation connectors
32 * can not connect system provided roles with system provided roles again.
33 * 
34 * @generated
35 */
36public class OperationProvidedRole2ItemSemanticEditPolicy extends
37                PalladioComponentModelBaseItemSemanticEditPolicy {
38 
39        /**
40         * @generated
41         */
42        public OperationProvidedRole2ItemSemanticEditPolicy() {
43                super(PalladioComponentModelElementTypes.OperationProvidedRole_3011);
44        }
45 
46        /**
47         * @generated
48         */
49        protected Command getDestroyElementCommand(DestroyElementRequest req) {
50                View view = (View) getHost().getModel();
51                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
52                                getEditingDomain(), null);
53                cmd.setTransactionNestingEnabled(false);
54                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
55                        Edge incomingLink = (Edge) it.next();
56                        if (PalladioComponentModelVisualIDRegistry
57                                        .getVisualID(incomingLink) == AssemblyConnectorEditPart.VISUAL_ID) {
58                                DestroyElementRequest r = new DestroyElementRequest(
59                                                incomingLink.getElement(), false);
60                                cmd.add(new DestroyElementCommand(r));
61                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
62                                continue;
63                        }
64                        if (PalladioComponentModelVisualIDRegistry
65                                        .getVisualID(incomingLink) == ProvidedDelegationConnectorEditPart.VISUAL_ID) {
66                                DestroyElementRequest r = new DestroyElementRequest(
67                                                incomingLink.getElement(), false);
68                                cmd.add(new DestroyElementCommand(r));
69                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
70                                continue;
71                        }
72                }
73                for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
74                        Edge outgoingLink = (Edge) it.next();
75                        if (PalladioComponentModelVisualIDRegistry
76                                        .getVisualID(outgoingLink) == ProvidedDelegationConnectorEditPart.VISUAL_ID) {
77                                DestroyElementRequest r = new DestroyElementRequest(
78                                                outgoingLink.getElement(), false);
79                                cmd.add(new DestroyElementCommand(r));
80                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
81                                continue;
82                        }
83                }
84                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
85                if (annotation == null) {
86                        // there are indirectly referenced children, need extra commands: false
87                        addDestroyShortcutsCommand(cmd, view);
88                        // delete host element
89                        cmd.add(new DestroyElementCommand(req));
90                } else {
91                        cmd.add(new DeleteCommand(getEditingDomain(), view));
92                }
93                return getGEFWrapper(cmd.reduce());
94        }
95 
96        /**
97         * @generated
98         */
99        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
100                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
101                                : getCompleteCreateRelationshipCommand(req);
102                return command != null ? command : super
103                                .getCreateRelationshipCommand(req);
104        }
105 
106        /**
107         * @generated
108         */
109        protected Command getStartCreateRelationshipCommand(
110                        CreateRelationshipRequest req) {
111                if (PalladioComponentModelElementTypes.AssemblyConnector_4004 == req
112                                .getElementType()) {
113                        return null;
114                }
115                if (PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006 == req
116                                .getElementType()) {
117                        return getGEFWrapper(new ProvidedDelegationConnectorCreateCommand(
118                                        req, req.getSource(), req.getTarget()));
119                }
120                return null;
121        }
122 
123        /**
124         * @generated not
125         */
126        protected Command getCompleteCreateRelationshipCommand(
127                        CreateRelationshipRequest req) {
128                return null;
129                //                if (PalladioComponentModelElementTypes.AssemblyConnector_4004 == req
130                //                                .getElementType()) {
131                //                        return getGEFWrapper(new AssemblyConnectorCreateCommand(req, req
132                //                                        .getSource(), req.getTarget()));
133                //                }
134                //                if (PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006 == req
135                //                                .getElementType()) {
136                //                        return getGEFWrapper(new ProvidedDelegationConnectorCreateCommand(
137                //                                        req, req.getSource(), req.getTarget()));
138                //                }
139                //                return null;
140        }
141 
142        /**
143         * Returns command to reorient EClass based link. New link target or source
144         * should be the domain model element associated with this node.
145         * 
146         * @generated
147         */
148        protected Command getReorientRelationshipCommand(
149                        ReorientRelationshipRequest req) {
150                switch (getVisualID(req)) {
151                case AssemblyConnectorEditPart.VISUAL_ID:
152                        return getGEFWrapper(new AssemblyConnectorReorientCommand(req));
153                case ProvidedDelegationConnectorEditPart.VISUAL_ID:
154                        return getGEFWrapper(new ProvidedDelegationConnectorReorientCommand(
155                                        req));
156                }
157                return super.getReorientRelationshipCommand(req);
158        }
159 
160}

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