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

COVERAGE SUMMARY FOR SOURCE FILE [AllocationCanonicalEditPolicy.java]

nameclass, %method, %block, %line, %
AllocationCanonicalEditPolicy.java0%   (0/1)0%   (0/11)0%   (0/133)0%   (0/37)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AllocationCanonicalEditPolicy0%   (0/1)0%   (0/11)0%   (0/133)0%   (0/37)
AllocationCanonicalEditPolicy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getDefaultFactoryHint (): String 0%   (0/1)0%   (0/2)0%   (0/1)
getDiagram (): Diagram 0%   (0/1)0%   (0/6)0%   (0/1)
getSemanticChildrenList (): List 0%   (0/1)0%   (0/20)0%   (0/6)
getSemanticConnectionsList (): List 0%   (0/1)0%   (0/2)0%   (0/1)
getSourceElement (EObject): EObject 0%   (0/1)0%   (0/2)0%   (0/1)
getTargetElement (EObject): EObject 0%   (0/1)0%   (0/2)0%   (0/1)
isOrphaned (Collection, View): boolean 0%   (0/1)0%   (0/25)0%   (0/7)
refreshSemantic (): void 0%   (0/1)0%   (0/46)0%   (0/11)
shouldDeleteView (View): boolean 0%   (0/1)0%   (0/23)0%   (0/6)
shouldIncludeConnection (Edge, Collection): boolean 0%   (0/1)0%   (0/2)0%   (0/1)

1/*
2 *Copyright 2007, SDQ, IPD, U KA
3 */
4package de.uka.ipd.sdq.pcm.gmf.allocation.edit.policies;
5 
6import java.util.List;
7import java.util.Collection;
8import org.eclipse.gmf.runtime.notation.Edge;
9import org.eclipse.emf.ecore.EObject;
10import de.uka.ipd.sdq.pcm.allocation.Allocation;
11import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.AllocationContextEditPart;
12import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.AllocationEditPart;
13import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.ResourceContainerEditPart;
14 
15import de.uka.ipd.sdq.pcm.gmf.allocation.part.PalladioComponentModelDiagramUpdater;
16import de.uka.ipd.sdq.pcm.gmf.allocation.part.PalladioComponentModelNodeDescriptor;
17import de.uka.ipd.sdq.pcm.gmf.allocation.part.PalladioComponentModelVisualIDRegistry;
18import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceEnvironment;
19 
20import java.util.ArrayList;
21import java.util.Collections;
22import java.util.HashMap;
23import java.util.Iterator;
24import java.util.LinkedList;
25import java.util.Map;
26 
27import org.eclipse.core.runtime.IAdaptable;
28 
29import org.eclipse.emf.ecore.EClass;
30 
31import org.eclipse.emf.ecore.resource.Resource;
32 
33import org.eclipse.gef.EditPart;
34 
35import org.eclipse.gef.commands.Command;
36 
37import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
38import org.eclipse.gmf.runtime.common.core.command.ICommand;
39 
40import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
41 
42import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
43import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
44import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
45import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
46 
47import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
48 
49import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy;
50 
51import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
52 
53import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
54import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
55import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
56 
57import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
58 
59import org.eclipse.gmf.runtime.emf.type.core.IElementType;
60 
61import org.eclipse.gmf.runtime.notation.Diagram;
62import org.eclipse.gmf.runtime.notation.View;
63 
64/**
65 * @generated
66 */
67public class AllocationCanonicalEditPolicy extends
68                CanonicalConnectionEditPolicy {
69 
70        /**
71         * @generated not
72         */
73        protected List getSemanticChildrenList() {
74                List result = new LinkedList();
75                EObject modelObject = ((View) getHost().getModel()).getElement();
76                View viewObject = (View) getHost().getModel();
77                ResourceEnvironment re = ((Allocation) modelObject)
78                                .getTargetResourceEnvironment_Allocation();
79 
80                return re.getResourceContainer_ResourceEnvironment();
81        }
82 
83        /**
84         * @generated not
85         */
86        protected boolean shouldDeleteView(View view) {
87                if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
88                        return view.isSetElement()
89                                        && (view.getElement() == null || view.getElement()
90                                                        .eIsProxy());
91                }
92                int nodeVID = PalladioComponentModelVisualIDRegistry.getVisualID(view);
93                return false;
94        }
95 
96        /**
97         * @generated
98         */
99        protected boolean isOrphaned(Collection semanticChildren, final View view) {
100                int visualID = PalladioComponentModelVisualIDRegistry.getVisualID(view);
101                switch (visualID) {
102                case ResourceContainerEditPart.VISUAL_ID:
103                        return !semanticChildren.contains(view.getElement())
104                                        || visualID != PalladioComponentModelVisualIDRegistry
105                                                        .getNodeVisualID((View) getHost().getModel(), view
106                                                                        .getElement());
107                }
108                return false;
109        }
110 
111        /**
112         * @generated
113         */
114        protected String getDefaultFactoryHint() {
115                return null;
116        }
117 
118        /**
119         * @generated
120         */
121        protected List getSemanticConnectionsList() {
122                return Collections.EMPTY_LIST;
123        }
124 
125        /**
126         * @generated
127         */
128        protected EObject getSourceElement(EObject relationship) {
129                return null;
130        }
131 
132        /**
133         * @generated
134         */
135        protected EObject getTargetElement(EObject relationship) {
136                return null;
137        }
138 
139        /**
140         * @generated
141         */
142        protected boolean shouldIncludeConnection(Edge connector,
143                        Collection children) {
144                return false;
145        }
146 
147        /**
148         * @generated
149         */
150        protected void refreshSemantic() {
151                List createdViews = new LinkedList();
152                createdViews.addAll(refreshSemanticChildren());
153                List createdConnectionViews = new LinkedList();
154                createdConnectionViews.addAll(refreshSemanticConnections());
155 
156                if (createdViews.size() > 1) {
157                        // perform a layout of the container
158                        DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host()
159                                        .getEditingDomain(), createdViews, host());
160                        executeCommand(new ICommandProxy(layoutCmd));
161                }
162 
163                createdViews.addAll(createdConnectionViews);
164                makeViewsImmutable(createdViews);
165        }
166 
167        /**
168         * @generated
169         */
170        private Diagram getDiagram() {
171                return ((View) getHost().getModel()).getDiagram();
172        }
173 
174}

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