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

nameclass, %method, %block, %line, %
InfrastructureProvidedRoleItemSemanticEditPolicy.java0%   (0/1)0%   (0/6)0%   (0/172)0%   (0/46)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InfrastructureProvidedRoleItemSemanticEditPolicy0%   (0/1)0%   (0/6)0%   (0/172)0%   (0/46)
InfrastructureProvidedRoleItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/3)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/44)0%   (0/13)
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/4)
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;
7 
8import org.eclipse.emf.ecore.EAnnotation;
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.ComposedStructure;
21import de.uka.ipd.sdq.pcm.core.composition.CompositionPackage;
22import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyInfrastructureConnectorCreateCommand;
23import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyInfrastructureConnectorReorientCommand;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyInfrastructureConnectorEditPart;
25import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
26import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
27 
28/**
29 * @generated
30 */
31public class InfrastructureProvidedRoleItemSemanticEditPolicy extends
32                PalladioComponentModelBaseItemSemanticEditPolicy {
33 
34        /**
35         * @generated
36         */
37        public InfrastructureProvidedRoleItemSemanticEditPolicy() {
38                super(
39                                PalladioComponentModelElementTypes.InfrastructureProvidedRole_3015);
40        }
41 
42        /**
43         * @generated
44         */
45        protected Command getDestroyElementCommand(DestroyElementRequest req) {
46                View view = (View) getHost().getModel();
47                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
48                                getEditingDomain(), null);
49                cmd.setTransactionNestingEnabled(false);
50                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
51                        Edge incomingLink = (Edge) it.next();
52                        if (PalladioComponentModelVisualIDRegistry
53                                        .getVisualID(incomingLink) == AssemblyInfrastructureConnectorEditPart.VISUAL_ID) {
54                                DestroyElementRequest r = new DestroyElementRequest(
55                                                incomingLink.getElement(), false);
56                                cmd.add(new DestroyElementCommand(r));
57                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
58                                continue;
59                        }
60                }
61                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
62                if (annotation == null) {
63                        // there are indirectly referenced children, need extra commands: false
64                        addDestroyShortcutsCommand(cmd, view);
65                        // delete host element
66                        cmd.add(new DestroyElementCommand(req));
67                } else {
68                        cmd.add(new DeleteCommand(getEditingDomain(), view));
69                }
70                return getGEFWrapper(cmd.reduce());
71        }
72 
73        /**
74         * @generated
75         */
76        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
77                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
78                                : getCompleteCreateRelationshipCommand(req);
79                return command != null ? command : super
80                                .getCreateRelationshipCommand(req);
81        }
82 
83        /**
84         * @generated
85         */
86        protected Command getStartCreateRelationshipCommand(
87                        CreateRelationshipRequest req) {
88                if (PalladioComponentModelElementTypes.AssemblyInfrastructureConnector_4008 == req
89                                .getElementType()) {
90                        return null;
91                }
92                return null;
93        }
94 
95        /**Adapted to transfer information on containing component and assembly context of target.
96         * @generated not
97         */
98        protected Command getCompleteCreateRelationshipCommand(
99                        CreateRelationshipRequest req) {
100                if (PalladioComponentModelElementTypes.AssemblyInfrastructureConnector_4008 == req
101                                .getElementType()) {
102                        
103                        // set the container
104                        ComposedStructure container = (ComposedStructure) getRelationshipContainer(
105                                        req.getSource(), CompositionPackage.eINSTANCE
106                                                        .getComposedStructure(), req.getElementType());
107                        if (container == null) {
108                                return UnexecutableCommand.INSTANCE;
109                        }
110                        req.setParameter("CONTAINER", container);
111 
112                        // set assembly context
113                        req.setParameter("TARGET_ASSEMBLY_CONTEXT", ((View) getHost().getParent()
114                                .getModel()).getElement());
115                        return getGEFWrapper(new AssemblyInfrastructureConnectorCreateCommand(
116                                        req, req.getSource(), req.getTarget()));
117                }
118                return null;
119        }
120 
121        /**
122         * Returns command to reorient EClass based link. New link target or source
123         * should be the domain model element associated with this node.
124         * 
125         * @generated
126         */
127        protected Command getReorientRelationshipCommand(
128                        ReorientRelationshipRequest req) {
129                switch (getVisualID(req)) {
130                case AssemblyInfrastructureConnectorEditPart.VISUAL_ID:
131                        return getGEFWrapper(new AssemblyInfrastructureConnectorReorientCommand(
132                                        req));
133                }
134                return super.getReorientRelationshipCommand(req);
135        }
136 
137}

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