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

nameclass, %method, %block, %line, %
SourceRoleItemSemanticEditPolicy.java0%   (0/2)0%   (0/8)0%   (0/194)0%   (0/52)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SourceRoleItemSemanticEditPolicy0%   (0/1)0%   (0/7)0%   (0/188)0%   (0/51)
SourceRoleItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/8)0%   (0/4)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/17)0%   (0/5)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/82)0%   (0/18)
getReorientRelationshipCommand (ReorientRelationshipRequest): Command 0%   (0/1)0%   (0/15)0%   (0/3)
getStartCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/17)0%   (0/5)
getStartCreateRelationshipCommandAssemblyEventConnector (CreateRelationshipRe... 0%   (0/1)0%   (0/45)0%   (0/14)
     
class SourceRoleItemSemanticEditPolicy$10%   (0/1)0%   (0/1)0%   (0/6)0%   (0/2)
SourceRoleItemSemanticEditPolicy$1 (SourceRoleItemSemanticEditPolicy): void 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.AssemblyEventConnectorCreateCommand;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyEventConnectorReorientCommand;
25import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyEventConnectorEditPart;
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.SourceRole;
29 
30/**
31 * Semantic edit policy for inner assembly context source roles.
32 * 
33 * @generated
34 */
35public class SourceRoleItemSemanticEditPolicy extends
36                PalladioComponentModelBaseItemSemanticEditPolicy {
37 
38        /**
39         * @generated
40         */
41        public SourceRoleItemSemanticEditPolicy() {
42                super(PalladioComponentModelElementTypes.SourceRole_3013);
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) == AssemblyEventConnectorEditPart.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         * Get the create relationship command or null / UnexecutableCommand instance
78         * if this is not an valid end for the connector creation.
79         * 
80         * @param req The request object to create the command
81         * @return The prepared creation command object
82         * 
83         * @generated not
84         */
85        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
86                if (PalladioComponentModelElementTypes.AssemblyEventConnector_4007 == req
87                                .getElementType()) {
88                        return req.getTarget() == null ? getStartCreateRelationshipCommandAssemblyEventConnector(req)
89                                        : null;
90                }
91                return super.getCreateRelationshipCommand(req);
92        }
93 
94        /**
95         * Helper to create an instance of an outgoing assembly event connector.
96         * 
97         * @param req The request describing the command to be created.
98         * @return The prepared command to create an AssemblyEventConnector
99         * 
100         * @generated not
101         */
102        protected Command getStartCreateRelationshipCommandAssemblyEventConnector(
103                        CreateRelationshipRequest req) {
104                EObject sourceEObject = req.getSource();
105                if (false == sourceEObject instanceof SourceRole) {
106                        return UnexecutableCommand.INSTANCE;
107                }
108                SourceRole source = (SourceRole) sourceEObject;
109                ComposedStructure container = (ComposedStructure) getRelationshipContainer(
110                                source, CompositionPackage.eINSTANCE.getComposedStructure(),
111                                req.getElementType());
112                if (container == null) {
113                        return UnexecutableCommand.INSTANCE;
114                }
115                if (!PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
116                                .canCreateAssemblyEventConnector_4007(container, source, null)) {
117                        return UnexecutableCommand.INSTANCE;
118                }
119                req.setParameter("SOURCE_CONTEXT", ((View) getHost().getParent()
120                                .getModel()).getElement());
121                return new Command() {
122                };
123        }
124 
125        /**
126         * @generated
127         */
128        protected Command getStartCreateRelationshipCommand(
129                        CreateRelationshipRequest req) {
130                if (PalladioComponentModelElementTypes.AssemblyEventConnector_4007 == req
131                                .getElementType()) {
132                        return getGEFWrapper(new AssemblyEventConnectorCreateCommand(req,
133                                        req.getSource(), req.getTarget()));
134                }
135                return null;
136        }
137 
138        /**
139         * @generated
140         */
141        protected Command getCompleteCreateRelationshipCommand(
142                        CreateRelationshipRequest req) {
143                if (PalladioComponentModelElementTypes.AssemblyEventConnector_4007 == req
144                                .getElementType()) {
145                        return null;
146                }
147                return null;
148        }
149 
150        /**
151         * Returns command to reorient EClass based link. New link target or source
152         * should be the domain model element associated with this node.
153         * 
154         * @generated
155         */
156        protected Command getReorientRelationshipCommand(
157                        ReorientRelationshipRequest req) {
158                switch (getVisualID(req)) {
159                case AssemblyEventConnectorEditPart.VISUAL_ID:
160                        return getGEFWrapper(new AssemblyEventConnectorReorientCommand(req));
161                }
162                return super.getReorientRelationshipCommand(req);
163        }
164 
165}

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