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

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RequiredDelegationConnectorReorientCommand0%   (0/1)0%   (0/12)0%   (0/170)0%   (0/53)
RequiredDelegationConnectorReorientCommand (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 (): RequiredDelegationConnector 0%   (0/1)0%   (0/4)0%   (0/1)
getNewSource (): OperationRequiredRole 0%   (0/1)0%   (0/4)0%   (0/1)
getNewTarget (): OperationRequiredRole 0%   (0/1)0%   (0/4)0%   (0/1)
getOldSource (): OperationRequiredRole 0%   (0/1)0%   (0/4)0%   (0/1)
getOldTarget (): OperationRequiredRole 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.RequiredDelegationConnector;
16import de.uka.ipd.sdq.pcm.gmf.composite.edit.policies.PalladioComponentModelBaseItemSemanticEditPolicy;
17import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole;
18 
19/**
20 * @generated
21 */
22public class RequiredDelegationConnectorReorientCommand 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 RequiredDelegationConnectorReorientCommand(
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 RequiredDelegationConnector) {
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 OperationRequiredRole && newEnd instanceof OperationRequiredRole)) {
72                        return false;
73                }
74                OperationRequiredRole target = getLink()
75                                .getOuterRequiredRole_RequiredDelegationConnector();
76                if (!(getLink().eContainer() instanceof ComposedStructure)) {
77                        return false;
78                }
79                ComposedStructure container = (ComposedStructure) getLink()
80                                .eContainer();
81                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
82                                .canExistRequiredDelegationConnector_4005(container,
83                                                getNewSource(), target);
84        }
85 
86        /**
87         * @generated
88         */
89        protected boolean canReorientTarget() {
90                if (!(oldEnd instanceof OperationRequiredRole && newEnd instanceof OperationRequiredRole)) {
91                        return false;
92                }
93                OperationRequiredRole source = getLink()
94                                .getInnerRequiredRole_RequiredDelegationConnector();
95                if (!(getLink().eContainer() instanceof ComposedStructure)) {
96                        return false;
97                }
98                ComposedStructure container = (ComposedStructure) getLink()
99                                .eContainer();
100                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
101                                .canExistRequiredDelegationConnector_4005(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().setInnerRequiredRole_RequiredDelegationConnector(
128                                getNewSource());
129                return CommandResult.newOKCommandResult(getLink());
130        }
131 
132        /**
133         * @generated
134         */
135        protected CommandResult reorientTarget() throws ExecutionException {
136                getLink().setOuterRequiredRole_RequiredDelegationConnector(
137                                getNewTarget());
138                return CommandResult.newOKCommandResult(getLink());
139        }
140 
141        /**
142         * @generated
143         */
144        protected RequiredDelegationConnector getLink() {
145                return (RequiredDelegationConnector) getElementToEdit();
146        }
147 
148        /**
149         * @generated
150         */
151        protected OperationRequiredRole getOldSource() {
152                return (OperationRequiredRole) oldEnd;
153        }
154 
155        /**
156         * @generated
157         */
158        protected OperationRequiredRole getNewSource() {
159                return (OperationRequiredRole) newEnd;
160        }
161 
162        /**
163         * @generated
164         */
165        protected OperationRequiredRole getOldTarget() {
166                return (OperationRequiredRole) oldEnd;
167        }
168 
169        /**
170         * @generated
171         */
172        protected OperationRequiredRole getNewTarget() {
173                return (OperationRequiredRole) newEnd;
174        }
175}

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