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

nameclass, %method, %block, %line, %
StartCreateCommand.java0%   (0/1)0%   (0/5)0%   (0/87)0%   (0/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StartCreateCommand0%   (0/1)0%   (0/5)0%   (0/87)0%   (0/26)
StartCreateCommand (CreateElementRequest): void 0%   (0/1)0%   (0/7)0%   (0/2)
canExecute (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
doConfigure (Start, IProgressMonitor, IAdaptable): void 0%   (0/1)0%   (0/39)0%   (0/12)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/25)0%   (0/6)
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.ScenarioBehaviour;
19import de.uka.ipd.sdq.pcm.usagemodel.Start;
20import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelFactory;
21 
22/**
23 * @generated
24 */
25public class StartCreateCommand extends EditElementCommand {
26 
27        /**
28         * @generated
29         */
30        public StartCreateCommand(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                return true;
51 
52        }
53 
54        /**
55         * @generated
56         */
57        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
58                        IAdaptable info) throws ExecutionException {
59                Start newElement = UsagemodelFactory.eINSTANCE.createStart();
60 
61                ScenarioBehaviour owner = (ScenarioBehaviour) getElementToEdit();
62                owner.getActions_ScenarioBehaviour().add(newElement);
63 
64                doConfigure(newElement, monitor, info);
65 
66                ((CreateElementRequest) getRequest()).setNewElement(newElement);
67                return CommandResult.newOKCommandResult(newElement);
68        }
69 
70        /**
71         * @generated
72         */
73        protected void doConfigure(Start newElement, IProgressMonitor monitor,
74                        IAdaptable info) throws ExecutionException {
75                IElementType elementType = ((CreateElementRequest) getRequest())
76                                .getElementType();
77                ConfigureRequest configureRequest = new ConfigureRequest(
78                                getEditingDomain(), newElement, elementType);
79                configureRequest.setClientContext(((CreateElementRequest) getRequest())
80                                .getClientContext());
81                configureRequest.addParameters(getRequest().getParameters());
82                ICommand configureCommand = elementType
83                                .getEditCommand(configureRequest);
84                if (configureCommand != null && configureCommand.canExecute()) {
85                        configureCommand.execute(monitor, info);
86                }
87        }
88 
89}

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