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

COVERAGE SUMMARY FOR SOURCE FILE [ImplementationComponentTypeParentCompleteComponentTypesCreateCommand.java]

nameclass, %method, %block, %line, %
ImplementationComponentTypeParentCompleteComponentTypesCreateCommand.java0%   (0/1)0%   (0/6)0%   (0/85)0%   (0/25)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImplementationComponentTypeParentCompleteComponentTypesCreateCommand0%   (0/1)0%   (0/6)0%   (0/85)0%   (0/25)
ImplementationComponentTypeParentCompleteComponentTypesCreateCommand (CreateR... 0%   (0/1)0%   (0/13)0%   (0/4)
canExecute (): boolean 0%   (0/1)0%   (0/37)0%   (0/12)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/23)0%   (0/6)
getSource (): ImplementationComponentType 0%   (0/1)0%   (0/4)0%   (0/1)
getTarget (): CompleteComponentType 0%   (0/1)0%   (0/4)0%   (0/1)
setElementToEdit (EObject): void 0%   (0/1)0%   (0/4)0%   (0/1)

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

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