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

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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