Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8c23e636b93fc9abd3047242bd65c725af5d31a2 (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
/*
 * Copyright (c) 2005 Borland Software Corporation
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Dmitri Stadnik (Borland) - initial API and implementation
 */
package org.eclipse.gmf.dev;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;

/**
 * @author dstadnik
 */
public aspect EditPartTracer {

	pointcut makingCommandInEditPart(EditPart editPart, Request request) : execution(Command EditPart.getCommand(Request)) && target(editPart) && args(request);

	Command around(EditPart editPart, Request request) : makingCommandInEditPart(editPart, request) {
		EditPartTraceUtil.fireCommandRequested(editPart, request);
		Command command = null;
		try {
			command = proceed(editPart, request);
		} finally {
			EditPartTraceUtil.fireCommandCreated(editPart, request, command);
		}
		return command;
	}

	pointcut makingCommandInEditPolicy(EditPolicy editPolicy, Request request) : execution(Command EditPolicy.getCommand(Request)) && target(editPolicy) && args(request);

	Command around(EditPolicy editPolicy, Request request) : makingCommandInEditPolicy(editPolicy, request) {
		Command command = proceed(editPolicy, request);
		if (command != null) {
			EditPartTraceUtil.addSource(command, editPolicy);
		}
		return command;
	}
}

Back to the top