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

nameclass, %method, %block, %line, %
CommunicationLinkResourceSpecificationCreateCommand.java0%   (0/1)0%   (0/5)0%   (0/94)0%   (0/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CommunicationLinkResourceSpecificationCreateCommand0%   (0/1)0%   (0/5)0%   (0/94)0%   (0/32)
CommunicationLinkResourceSpecificationCreateCommand (CreateElementRequest): void 0%   (0/1)0%   (0/7)0%   (0/2)
canExecute (): boolean 0%   (0/1)0%   (0/11)0%   (0/5)
doConfigure (CommunicationLinkResourceSpecification, IProgressMonitor, IAdapt... 0%   (0/1)0%   (0/39)0%   (0/12)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/23)0%   (0/8)
getElementToEdit (): EObject 0%   (0/1)0%   (0/14)0%   (0/5)

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.common.core.command.ICommand;
12import org.eclipse.gmf.runtime.emf.type.core.IElementType;
13import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
14import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
15import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
16import org.eclipse.gmf.runtime.notation.View;
17 
18import de.uka.ipd.sdq.pcm.resourceenvironment.CommunicationLinkResourceSpecification;
19import de.uka.ipd.sdq.pcm.resourceenvironment.LinkingResource;
20import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceenvironmentFactory;
21 
22/**
23 * @generated
24 */
25public class CommunicationLinkResourceSpecificationCreateCommand extends
26                EditElementCommand {
27 
28        /**
29         * @generated
30         */
31        public CommunicationLinkResourceSpecificationCreateCommand(
32                        CreateElementRequest req) {
33                super(req.getLabel(), null, req);
34        }
35 
36        /**
37         * FIXME: replace with setElementToEdit()
38         * @generated
39         */
40        protected EObject getElementToEdit() {
41                EObject container = ((CreateElementRequest) getRequest())
42                                .getContainer();
43                if (container instanceof View) {
44                        container = ((View) container).getElement();
45                }
46                return container;
47        }
48 
49        /**
50         * @generated
51         */
52        public boolean canExecute() {
53                LinkingResource container = (LinkingResource) getElementToEdit();
54                if (container
55                                .getCommunicationLinkResourceSpecifications_LinkingResource() != null) {
56                        return false;
57                }
58                return true;
59 
60        }
61 
62        /**
63         * @generated
64         */
65        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
66                        IAdaptable info) throws ExecutionException {
67                CommunicationLinkResourceSpecification newElement = ResourceenvironmentFactory.eINSTANCE
68                                .createCommunicationLinkResourceSpecification();
69 
70                LinkingResource owner = (LinkingResource) getElementToEdit();
71                owner
72                                .setCommunicationLinkResourceSpecifications_LinkingResource(newElement);
73 
74                doConfigure(newElement, monitor, info);
75 
76                ((CreateElementRequest) getRequest()).setNewElement(newElement);
77                return CommandResult.newOKCommandResult(newElement);
78        }
79 
80        /**
81         * @generated
82         */
83        protected void doConfigure(
84                        CommunicationLinkResourceSpecification newElement,
85                        IProgressMonitor monitor, IAdaptable info)
86                        throws ExecutionException {
87                IElementType elementType = ((CreateElementRequest) getRequest())
88                                .getElementType();
89                ConfigureRequest configureRequest = new ConfigureRequest(
90                                getEditingDomain(), newElement, elementType);
91                configureRequest.setClientContext(((CreateElementRequest) getRequest())
92                                .getClientContext());
93                configureRequest.addParameters(getRequest().getParameters());
94                ICommand configureCommand = elementType
95                                .getEditCommand(configureRequest);
96                if (configureCommand != null && configureCommand.canExecute()) {
97                        configureCommand.execute(monitor, info);
98                }
99        }
100 
101}

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