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

nameclass, %method, %block, %line, %
ProvidedRoleItemSemanticEditPolicy.java0%   (0/1)0%   (0/5)0%   (0/211)0%   (0/66)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProvidedRoleItemSemanticEditPolicy0%   (0/1)0%   (0/5)0%   (0/211)0%   (0/66)
ProvidedRoleItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCreateCompleteIncomingAssemblyConnector_4001Command (CreateRelationshipReq... 0%   (0/1)0%   (0/66)0%   (0/22)
getCreateCompleteIncomingProvidedDelegationConnector_4003Command (CreateRelat... 0%   (0/1)0%   (0/66)0%   (0/23)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/30)0%   (0/9)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/45)0%   (0/10)

1/*
2 * Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.edit.policies;
5 
6import org.eclipse.emf.ecore.EAnnotation;
7import org.eclipse.emf.ecore.EObject;
8import org.eclipse.gef.commands.Command;
9import org.eclipse.gef.commands.UnexecutableCommand;
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.notation.View;
16 
17import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure;
18import de.uka.ipd.sdq.pcm.core.composition.CompositionPackage;
19import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyConnectorTypeLinkCreateCommand;
20import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.ProvidedDelegationConnectorTypeLinkCreateCommand;
21import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
22import de.uka.ipd.sdq.pcm.repository.OperationProvidedRole;
23import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole;
24 
25/**
26 * @generated
27 */
28public class ProvidedRoleItemSemanticEditPolicy extends
29                PalladioComponentModelBaseItemSemanticEditPolicy {
30 
31        /**
32         * @generated
33         */
34        public ProvidedRoleItemSemanticEditPolicy() {
35// TODO: model changed
36//                super(PalladioComponentModelElementTypes.ProvidedRole_3009);
37                super(PalladioComponentModelElementTypes.OperationProvidedRole_3011);
38        }
39 
40        /**
41         * @generated
42         */
43        protected Command getDestroyElementCommand(DestroyElementRequest req) {
44                View view = (View) getHost().getModel();
45                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
46                                getEditingDomain(), null);
47                cmd.setTransactionNestingEnabled(false);
48                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
49                if (annotation == null) {
50                        // there are indirectly referenced children, need extra commands: false
51                        addDestroyShortcutsCommand(cmd, view);
52                        // delete host element
53                        cmd.add(new DestroyElementCommand(req));
54                } else {
55                        cmd.add(new DeleteCommand(getEditingDomain(), view));
56                }
57                return getGEFWrapper(cmd.reduce());
58        }
59 
60        // TODO: write javadoc and annotations
61        /**
62         * @generated not
63         */
64        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
65                if (PalladioComponentModelElementTypes.AssemblyConnector_4004 == req
66                                .getElementType()) {
67                        return req.getTarget() == null ? null
68                                        : getCreateCompleteIncomingAssemblyConnector_4001Command(req);
69                }
70                if (PalladioComponentModelElementTypes.ProvidedDelegationConnector_4006 == req
71                                .getElementType()) {
72                        return req.getTarget() == null ? null
73                                        : getCreateCompleteIncomingProvidedDelegationConnector_4003Command(req);
74                }
75                return super.getCreateRelationshipCommand(req);
76        }
77 
78        // TODO: write javadoc and annotations
79        /**
80         * @generated not
81         */
82        protected Command getCreateCompleteIncomingAssemblyConnector_4001Command(
83                        CreateRelationshipRequest req) {
84                EObject sourceEObject = req.getSource();
85                EObject targetEObject = req.getTarget();
86                if (false == sourceEObject instanceof OperationRequiredRole
87                                || false == targetEObject instanceof OperationProvidedRole) {
88                        return UnexecutableCommand.INSTANCE;
89                }
90                OperationRequiredRole source = (OperationRequiredRole) sourceEObject;
91                OperationProvidedRole target = (OperationProvidedRole) targetEObject;
92                ComposedStructure container = (ComposedStructure) getRelationshipContainer(
93                                source, CompositionPackage.eINSTANCE.getComposedStructure(),
94                                req.getElementType());
95                if (container == null) {
96                        return UnexecutableCommand.INSTANCE;
97                }
98                if (!PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
99                                .canCreateAssemblyConnector_4004(container, source, target)) {
100                        return UnexecutableCommand.INSTANCE;
101                }
102                if (req.getContainmentFeature() == null) {
103                        req
104                                        .setContainmentFeature(CompositionPackage.eINSTANCE
105                                                        .getComposedStructure_Connectors__ComposedStructure());
106                }
107                req.setParameter("PROV_CHILD_CONTEXT", ((View) getHost().getParent()
108                                .getModel()).getElement());
109                return getGEFWrapper(new AssemblyConnectorTypeLinkCreateCommand(req,
110                                container, source, target));
111        }
112 
113        // TODO: write javadoc and annotations
114        /**
115         * @generated not
116         */
117        protected Command getCreateCompleteIncomingProvidedDelegationConnector_4003Command(
118                        CreateRelationshipRequest req) {
119                EObject sourceEObject = req.getSource();
120                EObject targetEObject = req.getTarget();
121                if (false == sourceEObject instanceof OperationProvidedRole
122                                || false == targetEObject instanceof OperationProvidedRole) {
123                        return UnexecutableCommand.INSTANCE;
124                }
125                OperationProvidedRole source = (OperationProvidedRole) sourceEObject;
126                OperationProvidedRole target = (OperationProvidedRole) targetEObject;
127                ComposedStructure container = (ComposedStructure) getRelationshipContainer(
128                                source, CompositionPackage.eINSTANCE.getComposedStructure(),
129                                req.getElementType());
130                if (container == null) {
131                        return UnexecutableCommand.INSTANCE;
132                }
133                if (!PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
134                                .canCreateProvidedDelegationConnector_4006(container, source,
135                                                target)) {
136                        return UnexecutableCommand.INSTANCE;
137                }
138                if (req.getContainmentFeature() == null) {
139                        req
140                                        .setContainmentFeature(CompositionPackage.eINSTANCE
141                                                        .getComposedStructure_Connectors__ComposedStructure());
142                }
143                req.setParameter("CHILD_CONTEXT", ((View) getHost().getParent()
144                                .getModel()).getElement());
145                return getGEFWrapper(new ProvidedDelegationConnectorTypeLinkCreateCommand(
146                                req, container, source, target));
147        }
148 
149}

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