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

COVERAGE SUMMARY FOR SOURCE FILE [ScenarioBehaviour2CreateCommand.java]

nameclass, %method, %block, %line, %
ScenarioBehaviour2CreateCommand.java0%   (0/1)0%   (0/5)0%   (0/94)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ScenarioBehaviour2CreateCommand0%   (0/1)0%   (0/5)0%   (0/94)0%   (0/30)
ScenarioBehaviour2CreateCommand (CreateElementRequest): void 0%   (0/1)0%   (0/7)0%   (0/2)
canExecute (): boolean 0%   (0/1)0%   (0/11)0%   (0/4)
doConfigure (ScenarioBehaviour, IProgressMonitor, IAdaptable): void 0%   (0/1)0%   (0/39)0%   (0/12)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/23)0%   (0/7)
getElementToEdit (): EObject 0%   (0/1)0%   (0/14)0%   (0/5)

1/*
2 *Copyright 2007, SDQ, IPD, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.usage.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.usagemodel.Loop;
19import de.uka.ipd.sdq.pcm.usagemodel.ScenarioBehaviour;
20import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelFactory;
21 
22/**
23 * @generated
24 */
25public class ScenarioBehaviour2CreateCommand extends EditElementCommand {
26 
27        /**
28         * @generated
29         */
30        public ScenarioBehaviour2CreateCommand(CreateElementRequest req) {
31                super(req.getLabel(), null, req);
32        }
33 
34        /**
35         * @generated
36         */
37        protected EObject getElementToEdit() {
38                EObject container = ((CreateElementRequest) getRequest())
39                                .getContainer();
40                if (container instanceof View) {
41                        container = ((View) container).getElement();
42                }
43                return container;
44        }
45 
46        /**
47         * @generated
48         */
49        public boolean canExecute() {
50                Loop container = (Loop) getElementToEdit();
51                if (container.getBodyBehaviour_Loop() != null) {
52                        return false;
53                }
54                return true;
55 
56        }
57 
58        /**
59         * @generated
60         */
61        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
62                        IAdaptable info) throws ExecutionException {
63                ScenarioBehaviour newElement = UsagemodelFactory.eINSTANCE
64                                .createScenarioBehaviour();
65 
66                Loop owner = (Loop) getElementToEdit();
67                owner.setBodyBehaviour_Loop(newElement);
68 
69                doConfigure(newElement, monitor, info);
70 
71                ((CreateElementRequest) getRequest()).setNewElement(newElement);
72                return CommandResult.newOKCommandResult(newElement);
73        }
74 
75        /**
76         * @generated
77         */
78        protected void doConfigure(ScenarioBehaviour newElement,
79                        IProgressMonitor monitor, IAdaptable info)
80                        throws ExecutionException {
81                IElementType elementType = ((CreateElementRequest) getRequest())
82                                .getElementType();
83                ConfigureRequest configureRequest = new ConfigureRequest(
84                                getEditingDomain(), newElement, elementType);
85                configureRequest.setClientContext(((CreateElementRequest) getRequest())
86                                .getClientContext());
87                configureRequest.addParameters(getRequest().getParameters());
88                ICommand configureCommand = elementType
89                                .getEditCommand(configureRequest);
90                if (configureCommand != null && configureCommand.canExecute()) {
91                        configureCommand.execute(monitor, info);
92                }
93        }
94 
95}

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