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

nameclass, %method, %block, %line, %
InfrastructureRequiredRoleItemSemanticEditPolicy.java0%   (0/2)0%   (0/7)0%   (0/185)0%   (0/51)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InfrastructureRequiredRoleItemSemanticEditPolicy0%   (0/1)0%   (0/6)0%   (0/179)0%   (0/50)
InfrastructureRequiredRoleItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/3)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/8)0%   (0/4)
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/51)0%   (0/17)
     
class InfrastructureRequiredRoleItemSemanticEditPolicy$10%   (0/1)0%   (0/1)0%   (0/6)0%   (0/2)
InfrastructureRequiredRoleItemSemanticEditPolicy$1 (InfrastructureRequiredRol... 0%   (0/1)0%   (0/6)0%   (0/2)

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.emf.ecore.EObject;
10import org.eclipse.gef.commands.Command;
11import org.eclipse.gef.commands.UnexecutableCommand;
12import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
13import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
14import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
15import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
16import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
17import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
18import org.eclipse.gmf.runtime.notation.Edge;
19import org.eclipse.gmf.runtime.notation.View;
20 
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.AssemblyInfrastructureConnectorCreateCommand;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyInfrastructureConnectorReorientCommand;
25import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyInfrastructureConnectorEditPart;
26import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
27import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
28import de.uka.ipd.sdq.pcm.repository.InfrastructureRequiredRole;
29import de.uka.ipd.sdq.pcm.repository.SourceRole;
30 
31/**
32 * @generated
33 */
34public class InfrastructureRequiredRoleItemSemanticEditPolicy extends
35                PalladioComponentModelBaseItemSemanticEditPolicy {
36 
37        /**
38         * @generated
39         */
40        public InfrastructureRequiredRoleItemSemanticEditPolicy() {
41                super(
42                                PalladioComponentModelElementTypes.InfrastructureRequiredRole_3016);
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.getSourceEdges().iterator(); it.hasNext();) {
54                        Edge outgoingLink = (Edge) it.next();
55                        if (PalladioComponentModelVisualIDRegistry
56                                        .getVisualID(outgoingLink) == AssemblyInfrastructureConnectorEditPart.VISUAL_ID) {
57                                DestroyElementRequest r = new DestroyElementRequest(
58                                                outgoingLink.getElement(), false);
59                                cmd.add(new DestroyElementCommand(r));
60                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
61                                continue;
62                        }
63                }
64                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
65                if (annotation == null) {
66                        // there are indirectly referenced children, need extra commands: false
67                        addDestroyShortcutsCommand(cmd, view);
68                        // delete host element
69                        cmd.add(new DestroyElementCommand(req));
70                } else {
71                        cmd.add(new DeleteCommand(getEditingDomain(), view));
72                }
73                return getGEFWrapper(cmd.reduce());
74        }
75 
76        /**
77         * @generated
78         */
79        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
80                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
81                                : getCompleteCreateRelationshipCommand(req);
82                return command != null ? command : super
83                                .getCreateRelationshipCommand(req);
84        }
85 
86        /**
87         * @generated not
88         */
89        protected Command getStartCreateRelationshipCommand(
90                        CreateRelationshipRequest req) {
91                if (PalladioComponentModelElementTypes.AssemblyInfrastructureConnector_4008 == req
92                                .getElementType()) {
93                        EObject sourceEObject = req.getSource();
94                        if (false == sourceEObject instanceof InfrastructureRequiredRole) {
95                                return UnexecutableCommand.INSTANCE;
96                        }
97                        InfrastructureRequiredRole source = (InfrastructureRequiredRole) sourceEObject;
98                        ComposedStructure container = (ComposedStructure) getRelationshipContainer(
99                                        source, CompositionPackage.eINSTANCE.getComposedStructure(),
100                                        req.getElementType());
101                        if (container == null) {
102                                return UnexecutableCommand.INSTANCE;
103                        }
104                        if (!PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
105                                        .canCreateAssemblyInfrastructureConnector_4008(container, source, null)) {
106                                return UnexecutableCommand.INSTANCE;
107                        }
108                        // added to provide assembly context in addition to source and target role
109                        req.setParameter("SOURCE_ASSEMBLY_CONTEXT", ((View) getHost().getParent()
110                                        .getModel()).getElement());
111                        
112                        return new Command() {
113                        }; 
114                }
115                return null;
116        }
117        
118        /**
119         * @generated
120         */
121        protected Command getCompleteCreateRelationshipCommand(
122                        CreateRelationshipRequest req) {
123                if (PalladioComponentModelElementTypes.AssemblyInfrastructureConnector_4008 == req
124                                .getElementType()) {
125                        return null;
126                }
127                return null;
128        }
129 
130        /**
131         * Returns command to reorient EClass based link. New link target or source
132         * should be the domain model element associated with this node.
133         * 
134         * @generated
135         */
136        protected Command getReorientRelationshipCommand(
137                        ReorientRelationshipRequest req) {
138                switch (getVisualID(req)) {
139                case AssemblyInfrastructureConnectorEditPart.VISUAL_ID:
140                        return getGEFWrapper(new AssemblyInfrastructureConnectorReorientCommand(
141                                        req));
142                }
143                return super.getReorientRelationshipCommand(req);
144        }
145 
146}

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