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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelEditPartProvider.java]

nameclass, %method, %block, %line, %
PalladioComponentModelEditPartProvider.java0%   (0/1)0%   (0/9)0%   (0/131)0%   (0/42)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelEditPartProvider0%   (0/1)0%   (0/9)0%   (0/131)0%   (0/42)
PalladioComponentModelEditPartProvider (): void 0%   (0/1)0%   (0/11)0%   (0/4)
createEditPart (View): IGraphicalEditPart 0%   (0/1)0%   (0/14)0%   (0/4)
createGraphicEditPart (View): IGraphicalEditPart 0%   (0/1)0%   (0/21)0%   (0/7)
getCachedPart (View): IGraphicalEditPart 0%   (0/1)0%   (0/15)0%   (0/3)
getFactory (): EditPartFactory 0%   (0/1)0%   (0/3)0%   (0/1)
isAllowCaching (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
provides (IOperation): boolean 0%   (0/1)0%   (0/48)0%   (0/15)
setAllowCaching (boolean): void 0%   (0/1)0%   (0/12)0%   (0/5)
setFactory (EditPartFactory): void 0%   (0/1)0%   (0/4)0%   (0/2)

1/*
2 *Copyright 2006 SDQ Research Group, University of Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.seff.providers;
5 
6import java.lang.ref.WeakReference;
7 
8import org.eclipse.gef.EditPart;
9import org.eclipse.gef.EditPartFactory;
10import org.eclipse.gmf.runtime.common.core.service.IOperation;
11import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
12import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider;
13import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;
14import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;
15import org.eclipse.gmf.runtime.notation.View;
16 
17import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.PalladioComponentModelEditPartFactory;
18import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingSEFFEditPart;
19import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry;
20 
21/**
22 * @generated
23 */
24public class PalladioComponentModelEditPartProvider extends
25                AbstractEditPartProvider {
26 
27        /**
28         * @generated
29         */
30        private EditPartFactory factory;
31 
32        /**
33         * @generated
34         */
35        private boolean allowCaching;
36 
37        /**
38         * @generated
39         */
40        private WeakReference cachedPart;
41 
42        /**
43         * @generated
44         */
45        private WeakReference cachedView;
46 
47        /**
48         * @generated
49         */
50        public PalladioComponentModelEditPartProvider() {
51                setFactory(new PalladioComponentModelEditPartFactory());
52                setAllowCaching(true);
53        }
54 
55        /**
56         * @generated
57         */
58        public final EditPartFactory getFactory() {
59                return factory;
60        }
61 
62        /**
63         * @generated
64         */
65        protected void setFactory(EditPartFactory factory) {
66                this.factory = factory;
67        }
68 
69        /**
70         * @generated
71         */
72        public final boolean isAllowCaching() {
73                return allowCaching;
74        }
75 
76        /**
77         * @generated
78         */
79        protected synchronized void setAllowCaching(boolean allowCaching) {
80                this.allowCaching = allowCaching;
81                if (!allowCaching) {
82                        cachedPart = null;
83                        cachedView = null;
84                }
85        }
86 
87        /**
88         * @generated
89         */
90        protected IGraphicalEditPart createEditPart(View view) {
91                EditPart part = factory.createEditPart(null, view);
92                if (part instanceof IGraphicalEditPart) {
93                        return (IGraphicalEditPart) part;
94                }
95                return null;
96        }
97 
98        /**
99         * @generated
100         */
101        protected IGraphicalEditPart getCachedPart(View view) {
102                if (cachedView != null && cachedView.get() == view) {
103                        return (IGraphicalEditPart) cachedPart.get();
104                }
105                return null;
106        }
107 
108        /**
109         * @generated
110         */
111        public synchronized IGraphicalEditPart createGraphicEditPart(View view) {
112                if (isAllowCaching()) {
113                        IGraphicalEditPart part = getCachedPart(view);
114                        cachedPart = null;
115                        cachedView = null;
116                        if (part != null) {
117                                return part;
118                        }
119                }
120                return createEditPart(view);
121        }
122 
123        /**
124         * @generated
125         */
126        public synchronized boolean provides(IOperation operation) {
127                if (operation instanceof CreateGraphicEditPartOperation) {
128                        View view = ((IEditPartOperation) operation).getView();
129                        if (!ResourceDemandingSEFFEditPart.MODEL_ID
130                                        .equals(PalladioComponentModelVisualIDRegistry
131                                                        .getModelID(view))) {
132                                return false;
133                        }
134                        if (isAllowCaching() && getCachedPart(view) != null) {
135                                return true;
136                        }
137                        IGraphicalEditPart part = createEditPart(view);
138                        if (part != null) {
139                                if (isAllowCaching()) {
140                                        cachedPart = new WeakReference(part);
141                                        cachedView = new WeakReference(view);
142                                }
143                                return true;
144                        }
145                }
146                return false;
147        }
148}

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