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

nameclass, %method, %block, %line, %
CompleteComponentTypeParentProvidesComponentTypesCreateCommand.java0%   (0/1)0%   (0/6)0%   (0/85)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompleteComponentTypeParentProvidesComponentTypesCreateCommand0%   (0/1)0%   (0/6)0%   (0/85)0%   (0/24)
CompleteComponentTypeParentProvidesComponentTypesCreateCommand (CreateRelatio... 0%   (0/1)0%   (0/13)0%   (0/4)
canExecute (): boolean 0%   (0/1)0%   (0/37)0%   (0/11)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/23)0%   (0/6)
getSource (): CompleteComponentType 0%   (0/1)0%   (0/4)0%   (0/1)
getTarget (): ProvidesComponentType 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.ProvidesComponentType;
17 
18/**
19 * @generated
20 */
21public class CompleteComponentTypeParentProvidesComponentTypesCreateCommand
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 CompleteComponentTypeParentProvidesComponentTypesCreateCommand(
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 && false == source instanceof CompleteComponentType) {
52                        return false;
53                }
54                if (target != null && false == target instanceof ProvidesComponentType) {
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                                .canCreateCompleteComponentTypeParentProvidesComponentTypes_4104(
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().getParentProvidesComponentTypes().add(getTarget());
78                }
79                return CommandResult.newOKCommandResult();
80 
81        }
82 
83        /**
84         * @generated
85         */
86        protected void setElementToEdit(EObject element) {
87                throw new UnsupportedOperationException();
88        }
89 
90        /**
91         * @generated
92         */
93        protected CompleteComponentType getSource() {
94                return (CompleteComponentType) source;
95        }
96 
97        /**
98         * @generated
99         */
100        protected ProvidesComponentType getTarget() {
101                return (ProvidesComponentType) target;
102        }
103}

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