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

nameclass, %method, %block, %line, %
InfrastructureCallCreateCommand.java0%   (0/1)0%   (0/5)0%   (0/96)0%   (0/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InfrastructureCallCreateCommand0%   (0/1)0%   (0/5)0%   (0/96)0%   (0/31)
InfrastructureCallCreateCommand (CreateElementRequest): void 0%   (0/1)0%   (0/7)0%   (0/2)
canExecute (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
doConfigure (InfrastructureCall, IProgressMonitor, IAdaptable): void 0%   (0/1)0%   (0/39)0%   (0/12)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/34)0%   (0/11)
getElementToEdit (): EObject 0%   (0/1)0%   (0/14)0%   (0/5)

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.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.core.CoreFactory;
19import de.uka.ipd.sdq.pcm.core.PCMRandomVariable;
20import de.uka.ipd.sdq.pcm.seff.AbstractInternalControlFlowAction;
21 
22/**
23 * @generated
24 */
25public class InfrastructureCallCreateCommand extends EditElementCommand {
26 
27        /**Default number of calls to use for a infrastructure call.
28         * @generated not
29         */
30        private static final String DEFAULT_NUMBER_OF_CALLS = "1";
31 
32        /**
33         * @generated
34         */
35        public InfrastructureCallCreateCommand(CreateElementRequest req) {
36                super(req.getLabel(), null, req);
37        }
38 
39        /**
40         * FIXME: replace with setElementToEdit()
41         * @generated
42         */
43        protected EObject getElementToEdit() {
44                EObject container = ((CreateElementRequest) getRequest())
45                                .getContainer();
46                if (container instanceof View) {
47                        container = ((View) container).getElement();
48                }
49                return container;
50        }
51 
52        /**
53         * @generated
54         */
55        public boolean canExecute() {
56                return true;
57 
58        }
59 
60        /** Additionally adds number of calls to the element.
61         * @generated not
62         */
63        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
64                        IAdaptable info) throws ExecutionException {
65                de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall newElement = de.uka.ipd.sdq.pcm.seff.seff_performance.Seff_performanceFactory.eINSTANCE
66                                .createInfrastructureCall();
67                // add empty random variable
68                PCMRandomVariable numberOfCalls = CoreFactory.eINSTANCE
69                                .createPCMRandomVariable();
70                numberOfCalls.setSpecification(DEFAULT_NUMBER_OF_CALLS);
71                newElement.setNumberOfCalls__InfrastructureCall(numberOfCalls);
72 
73                AbstractInternalControlFlowAction owner = (AbstractInternalControlFlowAction) getElementToEdit();
74                owner.getInfrastructureCall__Action().add(newElement);
75 
76                doConfigure(newElement, monitor, info);
77 
78                ((CreateElementRequest) getRequest()).setNewElement(newElement);
79                return CommandResult.newOKCommandResult(newElement);
80        }
81 
82        /**
83         * @generated
84         */
85        protected void doConfigure(
86                        de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall newElement,
87                        IProgressMonitor monitor, IAdaptable info)
88                        throws ExecutionException {
89                IElementType elementType = ((CreateElementRequest) getRequest())
90                                .getElementType();
91                ConfigureRequest configureRequest = new ConfigureRequest(
92                                getEditingDomain(), newElement, elementType);
93                configureRequest.setClientContext(((CreateElementRequest) getRequest())
94                                .getClientContext());
95                configureRequest.addParameters(getRequest().getParameters());
96                ICommand configureCommand = elementType
97                                .getEditCommand(configureRequest);
98                if (configureCommand != null && configureCommand.canExecute()) {
99                        configureCommand.execute(monitor, info);
100                }
101        }
102 
103}

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