Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 71eeb0382710264497651eee334dfa3e908ef96f (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
/*
 * Copyright (c) 2006 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:
 *    Dmitry Stadnik (Borland) - initial API and implementation
 */

«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»

«DEFINE BaseEditHelper FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::copyright FOR editorGen-»
package «editHelpersPackageName»;

«EXPAND xpt::Common::generatedClassComment»
public class «baseEditHelperClassName» extends org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper {

	«EXPAND attributes-»
	
	«EXPAND getEditHelperAdvice-»

	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gmf.runtime.common.core.command.ICommand getInsteadCommand(
			org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
		org.eclipse.gmf.runtime.common.core.command.ICommand epCommand =
				(org.eclipse.gmf.runtime.common.core.command.ICommand) req.getParameter(«EXPAND editPolicyCommand»);
		req.setParameter(«EXPAND editPolicyCommand», null);
		org.eclipse.gmf.runtime.common.core.command.ICommand ehCommand = super.getInsteadCommand(req);
		if (epCommand == null) {
			return ehCommand;
		}
		if (ehCommand == null) {
			return epCommand;
		}
		org.eclipse.gmf.runtime.common.core.command.CompositeCommand command =
				new org.eclipse.gmf.runtime.common.core.command.CompositeCommand(null);
		command.add(epCommand);
		command.add(ehCommand);
		return command;
	}

	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gmf.runtime.common.core.command.ICommand getCreateCommand(
			org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
		return null;
	}

	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gmf.runtime.common.core.command.ICommand getCreateRelationshipCommand(
			org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
		return null;
	}

	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gmf.runtime.common.core.command.ICommand getDestroyElementCommand(
			org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
		return null;
	}

	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gmf.runtime.common.core.command.ICommand getDestroyReferenceCommand(
			org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
		return null;
	}
	«EXPAND additions-»
}
«ENDDEFINE»

«DEFINE attributes FOR gmfgen::GenDiagram-»
	«EXPAND xpt::Common::generatedMemberComment»
	public static final String «EXPAND editPolicyCommand» = "edit policy command"; //$NON-NLS-1$
	
	«EXPAND xpt::Common::generatedMemberComment»
	public static final String «EXPAND contextElementType» = "context element type"; //$NON-NLS-1$
«ENDDEFINE»

«DEFINE editPolicyCommand FOR gmfgen::GenDiagram»EDIT_POLICY_COMMAND«ENDDEFINE»

«DEFINE contextElementType FOR gmfgen::GenDiagram»CONTEXT_ELEMENT_TYPE«ENDDEFINE»

«DEFINE editPolicyCommandConstant FOR gmfgen::GenDiagram»«getBaseEditHelperQualifiedClassName()».«EXPAND editPolicyCommand»«ENDDEFINE»

«DEFINE contextElementTypeConstant FOR gmfgen::GenDiagram»«getBaseEditHelperQualifiedClassName()».«EXPAND contextElementType»«ENDDEFINE»

«DEFINE getEditHelperAdvice FOR gmfgen::GenDiagram-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice[] getEditHelperAdvice(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
		if (req.getParameter(«EXPAND contextElementType») instanceof org.eclipse.gmf.runtime.emf.type.core.IElementType) {
			return org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getEditHelperAdvice((org.eclipse.gmf.runtime.emf.type.core.IElementType) req.getParameter(«EXPAND contextElementType»));
		}
		return super.getEditHelperAdvice(req);
	}
«ENDDEFINE»

«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»

Back to the top