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

COVERAGE SUMMARY FOR SOURCE FILE [LinkingResourceConnectedResourceContainers_LinkingResourceCreateCommand.java]

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LinkingResourceConnectedResourceContainers_LinkingResourceCreateCommand0%   (0/1)0%   (0/6)0%   (0/85)0%   (0/25)
LinkingResourceConnectedResourceContainers_LinkingResourceCreateCommand (Crea... 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/7)
getSource (): LinkingResource 0%   (0/1)0%   (0/4)0%   (0/1)
getTarget (): ResourceContainer 0%   (0/1)0%   (0/4)0%   (0/1)
setElementToEdit (EObject): void 0%   (0/1)0%   (0/4)0%   (0/1)

1/*
2 * Copyright 2009, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.resource.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.resource.edit.policies.PalladioComponentModelBaseItemSemanticEditPolicy;
15import de.uka.ipd.sdq.pcm.resourceenvironment.LinkingResource;
16import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceContainer;
17 
18/**
19 * @generated
20 */
21public class LinkingResourceConnectedResourceContainers_LinkingResourceCreateCommand
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 LinkingResourceConnectedResourceContainers_LinkingResourceCreateCommand(
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 LinkingResource) {
52                        return false;
53                }
54                if (target != null && false == target instanceof ResourceContainer) {
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                                .canCreateLinkingResourceConnectedResourceContainers_LinkingResource_4002(
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().getConnectedResourceContainers_LinkingResource().add(
78                                        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 LinkingResource getSource() {
95                return (LinkingResource) source;
96        }
97 
98        /**
99         * @generated
100         */
101        protected ResourceContainer getTarget() {
102                return (ResourceContainer) target;
103        }
104}

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