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

COVERAGE SUMMARY FOR SOURCE FILE [InfrastructureInterfaceItemSemanticEditPolicy.java]

nameclass, %method, %block, %line, %
InfrastructureInterfaceItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/251)0%   (0/66)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InfrastructureInterfaceItemSemanticEditPolicy0%   (0/1)0%   (0/7)0%   (0/251)0%   (0/66)
InfrastructureInterfaceItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
addDestroyChildNodesCommand (ICompositeCommand): void 0%   (0/1)0%   (0/49)0%   (0/12)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/32)0%   (0/9)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/19)0%   (0/4)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/111)0%   (0/26)
getReorientRelationshipCommand (ReorientRelationshipRequest): Command 0%   (0/1)0%   (0/22)0%   (0/6)
getStartCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/14)0%   (0/7)

1/*
2 * Copyright 2007, IPD, SDQ, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.repository.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.common.core.command.ICompositeCommand;
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.Node;
19import org.eclipse.gmf.runtime.notation.View;
20 
21import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.InfrastructureProvidedRoleCreateCommand;
22import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.InfrastructureProvidedRoleReorientCommand;
23import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.InfrastructureRequiredRoleCreateCommand;
24import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.InfrastructureRequiredRoleReorientCommand;
25import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureInterfaceInfrastructureSignatureListEditPart;
26import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureProvidedRoleEditPart;
27import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureRequiredRoleEditPart;
28import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureSignatureEditPart;
29import de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry;
30import de.uka.ipd.sdq.pcm.gmf.repository.providers.PalladioComponentModelElementTypes;
31 
32/**
33 * @generated
34 */
35public class InfrastructureInterfaceItemSemanticEditPolicy extends
36                PalladioComponentModelBaseItemSemanticEditPolicy {
37 
38        /**
39         * @generated
40         */
41        public InfrastructureInterfaceItemSemanticEditPolicy() {
42                super(PalladioComponentModelElementTypes.InfrastructureInterface_2109);
43        }
44 
45        /**
46         * @generated
47         */
48        protected Command getDestroyElementCommand(DestroyElementRequest req) {
49                View view = (View) getHost().getModel();
50                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
51                                getEditingDomain(), null);
52                cmd.setTransactionNestingEnabled(false);
53                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
54                        Edge incomingLink = (Edge) it.next();
55                        if (PalladioComponentModelVisualIDRegistry
56                                        .getVisualID(incomingLink) == InfrastructureProvidedRoleEditPart.VISUAL_ID) {
57                                DestroyElementRequest r = new DestroyElementRequest(
58                                                incomingLink.getElement(), false);
59                                cmd.add(new DestroyElementCommand(r));
60                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
61                                continue;
62                        }
63                        if (PalladioComponentModelVisualIDRegistry
64                                        .getVisualID(incomingLink) == InfrastructureRequiredRoleEditPart.VISUAL_ID) {
65                                DestroyElementRequest r = new DestroyElementRequest(
66                                                incomingLink.getElement(), false);
67                                cmd.add(new DestroyElementCommand(r));
68                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
69                                continue;
70                        }
71                }
72                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
73                if (annotation == null) {
74                        // there are indirectly referenced children, need extra commands: false
75                        addDestroyChildNodesCommand(cmd);
76                        addDestroyShortcutsCommand(cmd, view);
77                        // delete host element
78                        cmd.add(new DestroyElementCommand(req));
79                } else {
80                        cmd.add(new DeleteCommand(getEditingDomain(), view));
81                }
82                return getGEFWrapper(cmd.reduce());
83        }
84 
85        /**
86         * @generated
87         */
88        private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
89                View view = (View) getHost().getModel();
90                for (Iterator nit = view.getChildren().iterator(); nit.hasNext();) {
91                        Node node = (Node) nit.next();
92                        switch (PalladioComponentModelVisualIDRegistry.getVisualID(node)) {
93                        case InfrastructureInterfaceInfrastructureSignatureListEditPart.VISUAL_ID:
94                                for (Iterator cit = node.getChildren().iterator(); cit
95                                                .hasNext();) {
96                                        Node cnode = (Node) cit.next();
97                                        switch (PalladioComponentModelVisualIDRegistry
98                                                        .getVisualID(cnode)) {
99                                        case InfrastructureSignatureEditPart.VISUAL_ID:
100                                                cmd.add(new DestroyElementCommand(
101                                                                new DestroyElementRequest(getEditingDomain(),
102                                                                                cnode.getElement(), false))); // directlyOwned: true
103                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
104                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
105                                                break;
106                                        }
107                                }
108                                break;
109                        }
110                }
111        }
112 
113        /**
114         * @generated
115         */
116        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
117                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
118                                : getCompleteCreateRelationshipCommand(req);
119                return command != null ? command : super
120                                .getCreateRelationshipCommand(req);
121        }
122 
123        /**
124         * @generated
125         */
126        protected Command getStartCreateRelationshipCommand(
127                        CreateRelationshipRequest req) {
128                if (PalladioComponentModelElementTypes.InfrastructureProvidedRole_4111 == req
129                                .getElementType()) {
130                        return null;
131                }
132                if (PalladioComponentModelElementTypes.InfrastructureRequiredRole_4112 == req
133                                .getElementType()) {
134                        return null;
135                }
136                return null;
137        }
138 
139        /**
140         * @generated
141         */
142        protected Command getCompleteCreateRelationshipCommand(
143                        CreateRelationshipRequest req) {
144                if (PalladioComponentModelElementTypes.InfrastructureProvidedRole_4111 == req
145                                .getElementType()) {
146                        return getGEFWrapper(new InfrastructureProvidedRoleCreateCommand(
147                                        req, req.getSource(), req.getTarget()));
148                }
149                if (PalladioComponentModelElementTypes.InfrastructureRequiredRole_4112 == req
150                                .getElementType()) {
151                        return getGEFWrapper(new InfrastructureRequiredRoleCreateCommand(
152                                        req, req.getSource(), req.getTarget()));
153                }
154                return null;
155        }
156 
157        /**
158         * Returns command to reorient EClass based link. New link target or source
159         * should be the domain model element associated with this node.
160         * 
161         * @generated
162         */
163        protected Command getReorientRelationshipCommand(
164                        ReorientRelationshipRequest req) {
165                switch (getVisualID(req)) {
166                case InfrastructureProvidedRoleEditPart.VISUAL_ID:
167                        return getGEFWrapper(new InfrastructureProvidedRoleReorientCommand(
168                                        req));
169                case InfrastructureRequiredRoleEditPart.VISUAL_ID:
170                        return getGEFWrapper(new InfrastructureRequiredRoleReorientCommand(
171                                        req));
172                }
173                return super.getReorientRelationshipCommand(req);
174        }
175 
176}

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