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

COVERAGE SUMMARY FOR SOURCE FILE [ResourceContainerCreateCommand.java]

nameclass, %method, %block, %line, %
ResourceContainerCreateCommand.java0%   (0/1)0%   (0/5)0%   (0/52)0%   (0/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ResourceContainerCreateCommand0%   (0/1)0%   (0/5)0%   (0/52)0%   (0/17)
ResourceContainerCreateCommand (CreateElementRequest): void 0%   (0/1)0%   (0/4)0%   (0/2)
canExecute (): boolean 0%   (0/1)0%   (0/11)0%   (0/3)
doDefaultElementCreation (): EObject 0%   (0/1)0%   (0/21)0%   (0/6)
getContainmentFeature (): EReference 0%   (0/1)0%   (0/2)0%   (0/1)
getElementToEdit (): EObject 0%   (0/1)0%   (0/14)0%   (0/5)

1/*
2 *Copyright 2007, SDQ, IPD, U KA
3 */
4package de.uka.ipd.sdq.pcm.gmf.allocation.edit.commands;
5 
6import org.eclipse.emf.ecore.EClass;
7import org.eclipse.emf.ecore.EObject;
8import org.eclipse.emf.ecore.EReference;
9 
10import org.eclipse.emf.ecore.resource.Resource;
11 
12import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
13 
14import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
15 
16import org.eclipse.gmf.runtime.notation.View;
17 
18/**
19 * @generated
20 */
21public class ResourceContainerCreateCommand extends CreateElementCommand {
22 
23        /**
24         * @generated
25         */
26        public ResourceContainerCreateCommand(CreateElementRequest req) {
27                super(req);
28        }
29 
30        /**
31         * @generated
32         */
33        protected EObject getElementToEdit() {
34                EObject container = ((CreateElementRequest) getRequest())
35                                .getContainer();
36                if (container instanceof View) {
37                        container = ((View) container).getElement();
38                }
39                return container;
40        }
41 
42        /**
43         * @generated
44         */
45        public boolean canExecute() {
46                if (getEClass() != null) {
47                        return getEClass().isSuperTypeOf(getEClassToEdit());
48                }
49                return true;
50        }
51 
52        /**
53         * @generated
54         */
55        protected EReference getContainmentFeature() {
56                return null;
57        }
58 
59        /**
60         * @generated
61         */
62        protected EObject doDefaultElementCreation() {
63                // Uncomment to put "phantom" objects into the diagram file.                
64                // org.eclipse.emf.ecore.resource.Resource resource = 
65                //                 ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer().eResource();
66                // if (resource == null) {
67                //         return null;
68                // }
69                Resource resource = getElementToEdit().eResource();
70                EClass eClass = getElementType().getEClass();
71                EObject newElement = eClass.getEPackage().getEFactoryInstance().create(
72                                eClass);
73                resource.getContents().add(newElement);
74                return newElement;
75        }
76 
77}

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