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

nameclass, %method, %block, %line, %
RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourCreateCommand.java0%   (0/1)0%   (0/6)0%   (0/85)0%   (0/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourCreateCommand0%   (0/1)0%   (0/6)0%   (0/85)0%   (0/28)
RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourCr... 0%   (0/1)0%   (0/13)0%   (0/4)
canExecute (): boolean 0%   (0/1)0%   (0/37)0%   (0/13)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/23)0%   (0/8)
getSource (): RecoveryActionBehaviour 0%   (0/1)0%   (0/4)0%   (0/1)
getTarget (): RecoveryActionBehaviour 0%   (0/1)0%   (0/4)0%   (0/1)
setElementToEdit (EObject): void 0%   (0/1)0%   (0/4)0%   (0/1)

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.CreateRelationshipRequest;
13 
14import de.uka.ipd.sdq.pcm.gmf.seff.edit.policies.PalladioComponentModelBaseItemSemanticEditPolicy;
15 
16/**
17 * @generated
18 */
19public class RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourCreateCommand
20                extends EditElementCommand {
21 
22        /**
23         * @generated
24         */
25        private final EObject source;
26 
27        /**
28         * @generated
29         */
30        private final EObject target;
31 
32        /**
33         * @generated
34         */
35        public RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourCreateCommand(
36                        CreateRelationshipRequest request, EObject source, EObject target) {
37                super(request.getLabel(), null, request);
38                this.source = source;
39                this.target = target;
40        }
41 
42        /**
43         * @generated
44         */
45        public boolean canExecute() {
46                if (source == null && target == null) {
47                        return false;
48                }
49                if (source != null
50                                && false == source instanceof de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) {
51                        return false;
52                }
53                if (target != null
54                                && false == target instanceof de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) {
55                        return false;
56                }
57                if (getSource() == null) {
58                        return true; // link creation is in progress; source is not defined yet
59                }
60                // target may be null here but it's possible to check constraint
61                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
62                                .canCreateRecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviour_4004(
63                                                getSource(), getTarget());
64        }
65 
66        /**
67         * @generated
68         */
69        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
70                        IAdaptable info) throws ExecutionException {
71                if (!canExecute()) {
72                        throw new ExecutionException(
73                                        "Invalid arguments in create link command"); //$NON-NLS-1$
74                }
75 
76                if (getSource() != null && getTarget() != null) {
77                        getSource()
78                                        .getFailureHandlingAlternatives__RecoveryActionBehaviour()
79                                        .add(getTarget());
80                }
81                return CommandResult.newOKCommandResult();
82 
83        }
84 
85        /**
86         * @generated
87         */
88        protected void setElementToEdit(EObject element) {
89                throw new UnsupportedOperationException();
90        }
91 
92        /**
93         * @generated
94         */
95        protected de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour getSource() {
96                return (de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) source;
97        }
98 
99        /**
100         * @generated
101         */
102        protected de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour getTarget() {
103                return (de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) target;
104        }
105}

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