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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractActionSuccessor_AbstractActionReorientCommand.java]

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractActionSuccessor_AbstractActionReorientCommand0%   (0/1)0%   (0/11)0%   (0/141)0%   (0/40)
AbstractActionSuccessor_AbstractActionReorientCommand (ReorientReferenceRelat... 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 (): AbstractAction 0%   (0/1)0%   (0/4)0%   (0/1)
getNewTarget (): AbstractAction 0%   (0/1)0%   (0/4)0%   (0/1)
getOldSource (): AbstractAction 0%   (0/1)0%   (0/4)0%   (0/1)
getOldTarget (): AbstractAction 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 2006 SDQ Research Group, University of Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.seff.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.seff.edit.policies.PalladioComponentModelBaseItemSemanticEditPolicy;
16import de.uka.ipd.sdq.pcm.seff.AbstractAction;
17 
18/**
19 * @generated
20 */
21public class AbstractActionSuccessor_AbstractActionReorientCommand 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 AbstractActionSuccessor_AbstractActionReorientCommand(
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 AbstractAction) {
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 AbstractAction && newEnd instanceof AbstractAction)) {
77                        return false;
78                }
79                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
80                                .canExistAbstractActionSuccessor_AbstractAction_4001(
81                                                getNewSource(), getOldTarget());
82        }
83 
84        /**
85         * @generated
86         */
87        protected boolean canReorientTarget() {
88                if (!(oldEnd instanceof AbstractAction && newEnd instanceof AbstractAction)) {
89                        return false;
90                }
91                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
92                                .canExistAbstractActionSuccessor_AbstractAction_4001(
93                                                getOldSource(), 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_AbstractAction(null);
119                getNewSource().setSuccessor_AbstractAction(getOldTarget());
120                return CommandResult.newOKCommandResult(referenceOwner);
121        }
122 
123        /**
124         * @generated
125         */
126        protected CommandResult reorientTarget() throws ExecutionException {
127                getOldSource().setSuccessor_AbstractAction(getNewTarget());
128                return CommandResult.newOKCommandResult(referenceOwner);
129        }
130 
131        /**
132         * @generated
133         */
134        protected AbstractAction getOldSource() {
135                return (AbstractAction) referenceOwner;
136        }
137 
138        /**
139         * @generated
140         */
141        protected AbstractAction getNewSource() {
142                return (AbstractAction) newEnd;
143        }
144 
145        /**
146         * @generated
147         */
148        protected AbstractAction getOldTarget() {
149                return (AbstractAction) oldEnd;
150        }
151 
152        /**
153         * @generated
154         */
155        protected AbstractAction getNewTarget() {
156                return (AbstractAction) newEnd;
157        }
158}

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