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

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperationRequiredRole2ItemSemanticEditPolicy0%   (0/1)0%   (0/6)0%   (0/215)0%   (0/53)
OperationRequiredRole2ItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/23)0%   (0/8)
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/2)0%   (0/1)

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.RequiredDelegationConnectorCreateCommand;
22import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.RequiredDelegationConnectorReorientCommand;
23import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyConnectorEditPart;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.RequiredDelegationConnectorEditPart;
25import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
26import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
27 
28/**
29 * The semantic edit policy for outer system operation required roles.
30 * 
31 * 
32 * @generated
33 */
34public class OperationRequiredRole2ItemSemanticEditPolicy extends
35                PalladioComponentModelBaseItemSemanticEditPolicy {
36 
37        /**
38         * @generated
39         */
40        public OperationRequiredRole2ItemSemanticEditPolicy() {
41                super(PalladioComponentModelElementTypes.OperationRequiredRole_3012);
42        }
43 
44        /**
45         * @generated
46         */
47        protected Command getDestroyElementCommand(DestroyElementRequest req) {
48                View view = (View) getHost().getModel();
49                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
50                                getEditingDomain(), null);
51                cmd.setTransactionNestingEnabled(false);
52                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
53                        Edge incomingLink = (Edge) it.next();
54                        if (PalladioComponentModelVisualIDRegistry
55                                        .getVisualID(incomingLink) == RequiredDelegationConnectorEditPart.VISUAL_ID) {
56                                DestroyElementRequest r = new DestroyElementRequest(
57                                                incomingLink.getElement(), false);
58                                cmd.add(new DestroyElementCommand(r));
59                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
60                                continue;
61                        }
62                }
63                for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
64                        Edge outgoingLink = (Edge) it.next();
65                        if (PalladioComponentModelVisualIDRegistry
66                                        .getVisualID(outgoingLink) == AssemblyConnectorEditPart.VISUAL_ID) {
67                                DestroyElementRequest r = new DestroyElementRequest(
68                                                outgoingLink.getElement(), false);
69                                cmd.add(new DestroyElementCommand(r));
70                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
71                                continue;
72                        }
73                        if (PalladioComponentModelVisualIDRegistry
74                                        .getVisualID(outgoingLink) == RequiredDelegationConnectorEditPart.VISUAL_ID) {
75                                DestroyElementRequest r = new DestroyElementRequest(
76                                                outgoingLink.getElement(), false);
77                                cmd.add(new DestroyElementCommand(r));
78                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
79                                continue;
80                        }
81                }
82                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
83                if (annotation == null) {
84                        // there are indirectly referenced children, need extra commands: false
85                        addDestroyShortcutsCommand(cmd, view);
86                        // delete host element
87                        cmd.add(new DestroyElementCommand(req));
88                } else {
89                        cmd.add(new DeleteCommand(getEditingDomain(), view));
90                }
91                return getGEFWrapper(cmd.reduce());
92        }
93 
94        /**
95         * @generated
96         */
97        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
98                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
99                                : getCompleteCreateRelationshipCommand(req);
100                return command != null ? command : super
101                                .getCreateRelationshipCommand(req);
102        }
103 
104        /**
105         * Get the create relation ship start command.
106         * 
107         * This method has manually adopted to disallow any connectors to be started at the 
108         * system required role. AssemblyConnectors are not allowed anyway and delegation connectors
109         * should be started at the inner operation required role. 
110         * 
111         * @generated not
112         */
113        protected Command getStartCreateRelationshipCommand(
114                        CreateRelationshipRequest req) {
115                return null;
116        }
117 
118        /**
119         * @generated
120         */
121        protected Command getCompleteCreateRelationshipCommand(
122                        CreateRelationshipRequest req) {
123                if (PalladioComponentModelElementTypes.AssemblyConnector_4004 == req
124                                .getElementType()) {
125                        return null;
126                }
127                if (PalladioComponentModelElementTypes.RequiredDelegationConnector_4005 == req
128                                .getElementType()) {
129                        return getGEFWrapper(new RequiredDelegationConnectorCreateCommand(
130                                        req, req.getSource(), req.getTarget()));
131                }
132                return null;
133        }
134 
135        /**
136         * Returns command to reorient EClass based link. New link target or source
137         * should be the domain model element associated with this node.
138         * 
139         * @generated
140         */
141        protected Command getReorientRelationshipCommand(
142                        ReorientRelationshipRequest req) {
143                switch (getVisualID(req)) {
144                case AssemblyConnectorEditPart.VISUAL_ID:
145                        return getGEFWrapper(new AssemblyConnectorReorientCommand(req));
146                case RequiredDelegationConnectorEditPart.VISUAL_ID:
147                        return getGEFWrapper(new RequiredDelegationConnectorReorientCommand(
148                                        req));
149                }
150                return super.getReorientRelationshipCommand(req);
151        }
152 
153}

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