Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d8fcb84adac62e77b2b1856ad16a7cdc83f3071c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/META-INF/MANIFEST.MF,v
retrieving revision 1.5
diff -u -r1.5 MANIFEST.MF
--- META-INF/MANIFEST.MF	8 Sep 2005 18:58:40 -0000	1.5
+++ META-INF/MANIFEST.MF	10 Nov 2005 15:13:06 -0000
@@ -42,7 +42,6 @@
  org.eclipse.gmf.runtime.diagram.ui.internal.tools,
  org.eclipse.gmf.runtime.diagram.ui.internal.type,
  org.eclipse.gmf.runtime.diagram.ui.internal.util,
- org.eclipse.gmf.runtime.diagram.ui.internal.view,
  org.eclipse.gmf.runtime.diagram.ui.internal.view.factories,
  org.eclipse.gmf.runtime.diagram.ui.l10n,
  org.eclipse.gmf.runtime.diagram.ui.menus,
@@ -75,5 +74,6 @@
  org.eclipse.gmf.runtime.notation;visibility:=reexport,
  org.eclipse.emf.common,
  org.eclipse.emf.ecore,
- org.eclipse.gmf.runtime.diagram.core;visibility:=reexport
+ org.eclipse.gmf.runtime.diagram.core;visibility:=reexport,
+ org.eclipse.gmf.dev.hook
 Eclipse-AutoStart: true
Index: src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/SemanticEditPolicy.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/SemanticEditPolicy.java,v
retrieving revision 1.4
diff -u -r1.4 SemanticEditPolicy.java
--- src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/SemanticEditPolicy.java	2 Nov 2005 23:30:16 -0000	1.4
+++ src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/SemanticEditPolicy.java	10 Nov 2005 15:13:10 -0000
@@ -11,6 +11,8 @@
 
 package org.eclipse.gmf.runtime.diagram.ui.editpolicies;
 
+import java.util.Map;
+
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.gef.EditPart;
 import org.eclipse.gef.Request;
@@ -68,9 +70,25 @@
 	 * @see org.eclipse.gef.EditPolicy#getCommand(Request)
 	 */
 	public Command getCommand(Request request) {
+		Command cmd = getCommandX(request);
+		Map sources = (Map) request.getExtendedData().get("org.eclipse.gmf.dev.sources");
+		if (cmd != null && sources != null) {
+			sources.put(cmd, this);
+		}
+		return cmd;
+	}
+
+	/**
+	 * @see org.eclipse.gef.EditPolicy#getCommand(Request)
+	 */
+	public Command getCommandX(Request request) {
+		Map sources = (Map) request.getExtendedData().get("org.eclipse.gmf.dev.sources");
 		if (RequestConstants.REQ_SEMANTIC_WRAPPER.equals(request.getType())) {
-			return getSemanticCommand(((EditCommandRequestWrapper) request)
-				.getEditCommandRequest());
+			IEditCommandRequest semRequest = ((EditCommandRequestWrapper) request).getEditCommandRequest();
+			if (sources != null) {
+				semRequest.setParameter("org.eclipse.gmf.dev.sources", sources);
+			}
+			return getSemanticCommand(semRequest);
 		} else if (REQ_RECONNECT_SOURCE.equals(request.getType())
 			&& relationshipSourceHasChanged((ReconnectRequest) request)) {
 			EditPart connectionEP = ((ReconnectRequest) request)
@@ -128,7 +146,11 @@
 	 */
 	protected Command getSemanticCommand(IEditCommandRequest request) {
 
+		Map sources = (Map) request.getParameter("org.eclipse.gmf.dev.sources");
 		IEditCommandRequest completedRequest = completeRequest(request);
+		if (sources != null) {
+			completedRequest.setParameter("org.eclipse.gmf.dev.sources", sources);
+		}
 		
 		IElementType elementType = ElementTypeRegistry.getInstance()
 			.getElementType(completedRequest.getEditHelperContext());
Index: src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java,v
retrieving revision 1.17
diff -u -r1.17 GraphicalEditPart.java
--- src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java	8 Nov 2005 19:38:16 -0000	1.17
+++ src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java	10 Nov 2005 15:13:10 -0000
@@ -17,6 +17,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
@@ -45,6 +46,7 @@
 import org.eclipse.gef.requests.DropRequest;
 import org.eclipse.gef.requests.GroupRequest;
 import org.eclipse.gef.requests.TargetRequest;
+import org.eclipse.gmf.dev.hook.EditPartTracer;
 import org.eclipse.gmf.runtime.common.core.util.IAdaptableSelection;
 import org.eclipse.gmf.runtime.common.ui.services.action.filter.ActionFilterService;
 import org.eclipse.gmf.runtime.common.ui.services.parser.CommonParserHint;
@@ -89,6 +91,7 @@
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IActionFilter;
 
+
 /**
  * @author melaasar,mmostafa
  * 
@@ -331,18 +334,29 @@
 				return UnexecutableCommand.INSTANCE;
 			}			
 		}
-		
+
 		Command cmd = null;
 		try {
 			GETCOMMAND_RECURSIVE_COUNT++;
 			final Request request = _request;
+
+			final Map sources = new IdentityHashMap();
+			request.getExtendedData().put("org.eclipse.gmf.dev.sources", sources);
+			traceCommandRequested(_request);
+			try {
+			
 			cmd =  (Command) MEditingDomainGetter.getMEditingDomain((View)getModel()).runAsRead(new MRunnable() {
 				
 				public Object run() {
-					return GraphicalEditPart.super.getCommand(request);
+					//return GraphicalEditPart.super.getCommand(request);
+					return EditPartTracer.Insider.getCommand(
+							getEditPolicyIterator(), request, sources);
 				}
 			});
 			
+			} finally {
+				traceCommandCreated(_request, cmd, sources);
+			}
 
 			if ( cmd != null ) {
 				_disableCanonicalEditPolicyList.addAll(disableCanonicalFor(_request));
@@ -369,8 +383,25 @@
 			GETCOMMAND_RECURSIVE_COUNT = 0;
 			throw t;
 		}
-		return cmd;
 		
+		return cmd;	
+	}
+
+	protected final void traceCommandRequested(Request request) {
+		EditPartTracer tracer = EditPartTracer.getInstance(getViewer());
+		if (tracer == null) {
+			return;
+		}
+		tracer.fireCommandRequested(this, request);
+	}
+
+	protected final void traceCommandCreated(Request request, Command command,
+			Map sources) {
+		EditPartTracer tracer = EditPartTracer.getInstance(getViewer());
+		if (tracer == null) {
+			return;
+		}
+		tracer.fireCommandCreated(this, request, command, sources);
 	}
 	
 	/**
Index: src/org/eclipse/gmf/runtime/diagram/ui/editparts/ConnectionEditPart.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editparts/ConnectionEditPart.java,v
retrieving revision 1.14
diff -u -r1.14 ConnectionEditPart.java
--- src/org/eclipse/gmf/runtime/diagram/ui/editparts/ConnectionEditPart.java	8 Nov 2005 18:50:25 -0000	1.14
+++ src/org/eclipse/gmf/runtime/diagram/ui/editparts/ConnectionEditPart.java	10 Nov 2005 15:13:09 -0000
@@ -17,6 +17,7 @@
 import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.Hashtable;
+import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
@@ -51,6 +52,7 @@
 import org.eclipse.gef.editparts.AbstractConnectionEditPart;
 import org.eclipse.gef.editpolicies.SnapFeedbackPolicy;
 import org.eclipse.gef.rulers.RulerProvider;
+import org.eclipse.gmf.dev.hook.EditPartTracer;
 import org.eclipse.gmf.runtime.common.ui.services.action.filter.ActionFilterService;
 import org.eclipse.gmf.runtime.diagram.core.internal.util.MEditingDomainGetter;
 import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
@@ -507,17 +509,46 @@
 			return UnexecutableCommand.INSTANCE;
 		}
 
+		Command cmd = null;
+		final Map sources = new IdentityHashMap();
+		_request.getExtendedData().put("org.eclipse.gmf.dev.sources", sources);
+		traceCommandRequested(_request);
+
+		try {
 		final Request request = _request;
-		Command cmd = (Command) MEditingDomainGetter.getMEditingDomain(
+		cmd = (Command) MEditingDomainGetter.getMEditingDomain(
 			(View) getModel()).runAsRead(new MRunnable() {
 
 			public Object run() {
-				return ConnectionEditPart.super.getCommand(request);
+				//return ConnectionEditPart.super.getCommand(request);
+				return EditPartTracer.Insider.getCommand(
+						getEditPolicyIterator(), request, sources);
 			}
 		});
+		} finally {
+			traceCommandCreated(_request, cmd, sources);
+		}
+
 		return cmd;
 	}
 
+	protected final void traceCommandRequested(Request request) {
+		EditPartTracer tracer = EditPartTracer.getInstance(getViewer());
+		if (tracer == null) {
+			return;
+		}
+		tracer.fireCommandRequested(this, request);
+	}
+
+	protected final void traceCommandCreated(Request request, Command command,
+			Map sources) {
+		EditPartTracer tracer = EditPartTracer.getInstance(getViewer());
+		if (tracer == null) {
+			return;
+		}
+		tracer.fireCommandCreated(this, request, command, sources);
+	}
+
 	/**
 	 * Convenience method returning the editpart's Diagram, the Diagam that owns
 	 * the edit part

Back to the top