EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.composite.edit.commands]

COVERAGE SUMMARY FOR SOURCE FILE [ProvidedDelegationConnectorReorientCommand.java]

nameclass, %method, %block, %line, %
ProvidedDelegationConnectorReorientCommand.java0%   (0/1)0%   (0/12)0%   (0/170)0%   (0/53)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProvidedDelegationConnectorReorientCommand0%   (0/1)0%   (0/12)0%   (0/170)0%   (0/53)
ProvidedDelegationConnectorReorientCommand (ReorientRelationshipRequest): void 0%   (0/1)0%   (0/20)0%   (0/5)
canExecute (): boolean 0%   (0/1)0%   (0/22)0%   (0/7)
canReorientSource (): boolean 0%   (0/1)0%   (0/32)0%   (0/11)
canReorientTarget (): boolean 0%   (0/1)0%   (0/32)0%   (0/11)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/26)0%   (0/8)
getLink (): ProvidedDelegationConnector 0%   (0/1)0%   (0/4)0%   (0/1)
getNewSource (): OperationProvidedRole 0%   (0/1)0%   (0/4)0%   (0/1)
getNewTarget (): OperationProvidedRole 0%   (0/1)0%   (0/4)0%   (0/1)
getOldSource (): OperationProvidedRole 0%   (0/1)0%   (0/4)0%   (0/1)
getOldTarget (): OperationProvidedRole 0%   (0/1)0%   (0/4)0%   (0/1)
reorientSource (): CommandResult 0%   (0/1)0%   (0/9)0%   (0/3)
reorientTarget (): CommandResult 0%   (0/1)0%   (0/9)0%   (0/3)

1/*
2 * Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.edit.commands;
5 
6import org.eclipse.core.commands.ExecutionException;
7import org.eclipse.core.runtime.IAdaptable;
8import org.eclipse.core.runtime.IProgressMonitor;
9import org.eclipse.emf.ecore.EObject;
10import org.eclipse.gmf.runtime.common.core.command.CommandResult;
11import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
12import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
13 
14import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure;
15import de.uka.ipd.sdq.pcm.core.composition.ProvidedDelegationConnector;
16import de.uka.ipd.sdq.pcm.gmf.composite.edit.policies.PalladioComponentModelBaseItemSemanticEditPolicy;
17import de.uka.ipd.sdq.pcm.repository.OperationProvidedRole;
18 
19/**
20 * @generated
21 */
22public class ProvidedDelegationConnectorReorientCommand extends
23                EditElementCommand {
24 
25        /**
26         * @generated
27         */
28        private final int reorientDirection;
29 
30        /**
31         * @generated
32         */
33        private final EObject oldEnd;
34 
35        /**
36         * @generated
37         */
38        private final EObject newEnd;
39 
40        /**
41         * @generated
42         */
43        public ProvidedDelegationConnectorReorientCommand(
44                        ReorientRelationshipRequest request) {
45                super(request.getLabel(), request.getRelationship(), request);
46                reorientDirection = request.getDirection();
47                oldEnd = request.getOldRelationshipEnd();
48                newEnd = request.getNewRelationshipEnd();
49        }
50 
51        /**
52         * @generated
53         */
54        public boolean canExecute() {
55                if (false == getElementToEdit() instanceof ProvidedDelegationConnector) {
56                        return false;
57                }
58                if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
59                        return canReorientSource();
60                }
61                if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
62                        return canReorientTarget();
63                }
64                return false;
65        }
66 
67        /**
68         * @generated
69         */
70        protected boolean canReorientSource() {
71                if (!(oldEnd instanceof OperationProvidedRole && newEnd instanceof OperationProvidedRole)) {
72                        return false;
73                }
74                OperationProvidedRole target = getLink()
75                                .getInnerProvidedRole_ProvidedDelegationConnector();
76                if (!(getLink().eContainer() instanceof ComposedStructure)) {
77                        return false;
78                }
79                ComposedStructure container = (ComposedStructure) getLink()
80                                .eContainer();
81                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
82                                .canExistProvidedDelegationConnector_4006(container,
83                                                getNewSource(), target);
84        }
85 
86        /**
87         * @generated
88         */
89        protected boolean canReorientTarget() {
90                if (!(oldEnd instanceof OperationProvidedRole && newEnd instanceof OperationProvidedRole)) {
91                        return false;
92                }
93                OperationProvidedRole source = getLink()
94                                .getOuterProvidedRole_ProvidedDelegationConnector();
95                if (!(getLink().eContainer() instanceof ComposedStructure)) {
96                        return false;
97                }
98                ComposedStructure container = (ComposedStructure) getLink()
99                                .eContainer();
100                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
101                                .canExistProvidedDelegationConnector_4006(container, source,
102                                                getNewTarget());
103        }
104 
105        /**
106         * @generated
107         */
108        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
109                        IAdaptable info) throws ExecutionException {
110                if (!canExecute()) {
111                        throw new ExecutionException(
112                                        "Invalid arguments in reorient link command"); //$NON-NLS-1$
113                }
114                if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
115                        return reorientSource();
116                }
117                if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
118                        return reorientTarget();
119                }
120                throw new IllegalStateException();
121        }
122 
123        /**
124         * @generated
125         */
126        protected CommandResult reorientSource() throws ExecutionException {
127                getLink().setOuterProvidedRole_ProvidedDelegationConnector(
128                                getNewSource());
129                return CommandResult.newOKCommandResult(getLink());
130        }
131 
132        /**
133         * @generated
134         */
135        protected CommandResult reorientTarget() throws ExecutionException {
136                getLink().setInnerProvidedRole_ProvidedDelegationConnector(
137                                getNewTarget());
138                return CommandResult.newOKCommandResult(getLink());
139        }
140 
141        /**
142         * @generated
143         */
144        protected ProvidedDelegationConnector getLink() {
145                return (ProvidedDelegationConnector) getElementToEdit();
146        }
147 
148        /**
149         * @generated
150         */
151        protected OperationProvidedRole getOldSource() {
152                return (OperationProvidedRole) oldEnd;
153        }
154 
155        /**
156         * @generated
157         */
158        protected OperationProvidedRole getNewSource() {
159                return (OperationProvidedRole) newEnd;
160        }
161 
162        /**
163         * @generated
164         */
165        protected OperationProvidedRole getOldTarget() {
166                return (OperationProvidedRole) oldEnd;
167        }
168 
169        /**
170         * @generated
171         */
172        protected OperationProvidedRole getNewTarget() {
173                return (OperationProvidedRole) newEnd;
174        }
175}

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