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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractUserActionSuccessorReorientCommand.java]

nameclass, %method, %block, %line, %
AbstractUserActionSuccessorReorientCommand.java0%   (0/1)0%   (0/11)0%   (0/141)0%   (0/40)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractUserActionSuccessorReorientCommand0%   (0/1)0%   (0/11)0%   (0/141)0%   (0/40)
AbstractUserActionSuccessorReorientCommand (ReorientReferenceRelationshipRequ... 0%   (0/1)0%   (0/23)0%   (0/6)
canExecute (): boolean 0%   (0/1)0%   (0/22)0%   (0/7)
canReorientSource (): boolean 0%   (0/1)0%   (0/16)0%   (0/5)
canReorientTarget (): boolean 0%   (0/1)0%   (0/16)0%   (0/5)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/26)0%   (0/8)
getNewSource (): AbstractUserAction 0%   (0/1)0%   (0/4)0%   (0/1)
getNewTarget (): AbstractUserAction 0%   (0/1)0%   (0/4)0%   (0/1)
getOldSource (): AbstractUserAction 0%   (0/1)0%   (0/4)0%   (0/1)
getOldTarget (): AbstractUserAction 0%   (0/1)0%   (0/4)0%   (0/1)
reorientSource (): CommandResult 0%   (0/1)0%   (0/13)0%   (0/3)
reorientTarget (): CommandResult 0%   (0/1)0%   (0/9)0%   (0/2)

1/*
2 * Copyright 2007, SDQ, IPD, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.usage.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.ReorientReferenceRelationshipRequest;
13import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
14 
15import de.uka.ipd.sdq.pcm.gmf.usage.edit.policies.PalladioComponentModelBaseItemSemanticEditPolicy;
16import de.uka.ipd.sdq.pcm.usagemodel.AbstractUserAction;
17 
18/**
19 * @generated
20 */
21public class AbstractUserActionSuccessorReorientCommand extends
22                EditElementCommand {
23 
24        /**
25         * @generated
26         */
27        private final int reorientDirection;
28 
29        /**
30         * @generated
31         */
32        private final EObject referenceOwner;
33 
34        /**
35         * @generated
36         */
37        private final EObject oldEnd;
38 
39        /**
40         * @generated
41         */
42        private final EObject newEnd;
43 
44        /**
45         * @generated
46         */
47        public AbstractUserActionSuccessorReorientCommand(
48                        ReorientReferenceRelationshipRequest request) {
49                super(request.getLabel(), null, request);
50                reorientDirection = request.getDirection();
51                referenceOwner = request.getReferenceOwner();
52                oldEnd = request.getOldRelationshipEnd();
53                newEnd = request.getNewRelationshipEnd();
54        }
55 
56        /**
57         * @generated
58         */
59        public boolean canExecute() {
60                if (false == referenceOwner instanceof AbstractUserAction) {
61                        return false;
62                }
63                if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
64                        return canReorientSource();
65                }
66                if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
67                        return canReorientTarget();
68                }
69                return false;
70        }
71 
72        /**
73         * @generated
74         */
75        protected boolean canReorientSource() {
76                if (!(oldEnd instanceof AbstractUserAction && newEnd instanceof AbstractUserAction)) {
77                        return false;
78                }
79                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
80                                .canExistAbstractUserActionSuccessor_4002(getNewSource(),
81                                                getOldTarget());
82        }
83 
84        /**
85         * @generated
86         */
87        protected boolean canReorientTarget() {
88                if (!(oldEnd instanceof AbstractUserAction && newEnd instanceof AbstractUserAction)) {
89                        return false;
90                }
91                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
92                                .canExistAbstractUserActionSuccessor_4002(getOldSource(),
93                                                getNewTarget());
94        }
95 
96        /**
97         * @generated
98         */
99        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
100                        IAdaptable info) throws ExecutionException {
101                if (!canExecute()) {
102                        throw new ExecutionException(
103                                        "Invalid arguments in reorient link command"); //$NON-NLS-1$
104                }
105                if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
106                        return reorientSource();
107                }
108                if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
109                        return reorientTarget();
110                }
111                throw new IllegalStateException();
112        }
113 
114        /**
115         * @generated
116         */
117        protected CommandResult reorientSource() throws ExecutionException {
118                getOldSource().setSuccessor(null);
119                getNewSource().setSuccessor(getOldTarget());
120                return CommandResult.newOKCommandResult(referenceOwner);
121        }
122 
123        /**
124         * @generated
125         */
126        protected CommandResult reorientTarget() throws ExecutionException {
127                getOldSource().setSuccessor(getNewTarget());
128                return CommandResult.newOKCommandResult(referenceOwner);
129        }
130 
131        /**
132         * @generated
133         */
134        protected AbstractUserAction getOldSource() {
135                return (AbstractUserAction) referenceOwner;
136        }
137 
138        /**
139         * @generated
140         */
141        protected AbstractUserAction getNewSource() {
142                return (AbstractUserAction) newEnd;
143        }
144 
145        /**
146         * @generated
147         */
148        protected AbstractUserAction getOldTarget() {
149                return (AbstractUserAction) oldEnd;
150        }
151 
152        /**
153         * @generated
154         */
155        protected AbstractUserAction getNewTarget() {
156                return (AbstractUserAction) newEnd;
157        }
158}

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