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

COVERAGE SUMMARY FOR SOURCE FILE [ComposedProvidingRequiringEntityCreateCommand.java]

nameclass, %method, %block, %line, %
ComposedProvidingRequiringEntityCreateCommand.java0%   (0/1)0%   (0/5)0%   (0/87)0%   (0/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComposedProvidingRequiringEntityCreateCommand0%   (0/1)0%   (0/5)0%   (0/87)0%   (0/27)
ComposedProvidingRequiringEntityCreateCommand (CreateElementRequest): void 0%   (0/1)0%   (0/7)0%   (0/2)
canExecute (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
doConfigure (ComposedProvidingRequiringEntity, IProgressMonitor, IAdaptable):... 0%   (0/1)0%   (0/39)0%   (0/12)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/25)0%   (0/7)
getElementToEdit (): EObject 0%   (0/1)0%   (0/14)0%   (0/5)

1/*
2 * Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.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.emf.ecore.resource.Resource;
11import org.eclipse.gmf.runtime.common.core.command.CommandResult;
12import org.eclipse.gmf.runtime.common.core.command.ICommand;
13import org.eclipse.gmf.runtime.emf.type.core.IElementType;
14import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
15import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
16import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
17import org.eclipse.gmf.runtime.notation.View;
18 
19import de.uka.ipd.sdq.pcm.core.entity.ComposedProvidingRequiringEntity;
20import de.uka.ipd.sdq.pcm.core.entity.EntityFactory;
21import de.uka.ipd.sdq.pcm.system.SystemFactory;
22 
23/**
24 * @generated
25 */
26public class ComposedProvidingRequiringEntityCreateCommand extends
27                EditElementCommand {
28 
29        /**
30         * @generated
31         */
32        public ComposedProvidingRequiringEntityCreateCommand(
33                        CreateElementRequest req) {
34                super(req.getLabel(), null, req);
35        }
36 
37        /**
38         * FIXME: replace with setElementToEdit()
39         * @generated
40         */
41        protected EObject getElementToEdit() {
42                EObject container = ((CreateElementRequest) getRequest())
43                                .getContainer();
44                if (container instanceof View) {
45                        container = ((View) container).getElement();
46                }
47                return container;
48        }
49 
50        /**
51         * @generated
52         */
53        public boolean canExecute() {
54                return true;
55        }
56 
57        /**
58         * @generated NOT
59         */
60        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
61                        IAdaptable info) throws ExecutionException {
62                // Uncomment to put "phantom" objects into the diagram file.                
63                // org.eclipse.emf.ecore.resource.Resource resource = 
64                //                 ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer().eResource();
65                // if (resource == null) {
66                //         return null;
67                // }
68                Resource resource = getElementToEdit().eResource();
69                ComposedProvidingRequiringEntity newElement = SystemFactory.eINSTANCE
70                                .createSystem();
71 
72                resource.getContents().add(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(ComposedProvidingRequiringEntity newElement,
84                        IProgressMonitor monitor, IAdaptable info)
85                        throws ExecutionException {
86                IElementType elementType = ((CreateElementRequest) getRequest())
87                                .getElementType();
88                ConfigureRequest configureRequest = new ConfigureRequest(
89                                getEditingDomain(), newElement, elementType);
90                configureRequest.setClientContext(((CreateElementRequest) getRequest())
91                                .getClientContext());
92                configureRequest.addParameters(getRequest().getParameters());
93                ICommand configureCommand = elementType
94                                .getEditCommand(configureRequest);
95                if (configureCommand != null && configureCommand.canExecute()) {
96                        configureCommand.execute(monitor, info);
97                }
98        }
99 
100}

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