|
1 /* |
|
2 * Copyright (c) 2007 Borland Software Corporation |
|
3 * |
|
4 * All rights reserved. This program and the accompanying materials |
|
5 * are made available under the terms of the Eclipse Public License v1.0 |
|
6 * which accompanies this distribution, and is available at |
|
7 * http://www.eclipse.org/legal/epl-v10.html |
|
8 * |
|
9 * Contributors: |
|
10 * Alexander Shatalin (Borland) - initial API and implementation |
|
11 */ |
|
12 |
|
13 «IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» |
|
14 «EXTENSION xpt::GenModelUtils» |
|
15 |
|
16 «DEFINE LinkItemSemanticEditPolicy FOR gmfgen::GenLink-» |
|
17 «EXPAND xpt::Common::copyright FOR diagram.editorGen-» |
|
18 package «getDiagram().editPoliciesPackageName»; |
|
19 |
|
20 «EXPAND xpt::Common::generatedClassComment» |
|
21 public class «itemSemanticEditPolicyClassName» extends «diagram.getBaseItemSemanticEditPolicyQualifiedClassName()» { |
|
22 |
|
23 «EXPAND classBody(getDiagram()) FOR modelFacet-» |
|
24 |
|
25 «EXPAND additions-» |
|
26 } |
|
27 «ENDDEFINE» |
|
28 |
|
29 «DEFINE classBody(gmfgen::GenDiagram diagram) FOR gmfgen::FeatureLinkModelFacet-» |
|
30 «EXPAND getDestroyReferenceCommand-» |
|
31 «ENDDEFINE» |
|
32 |
|
33 «DEFINE classBody(gmfgen::GenDiagram diagram) FOR gmfgen::TypeLinkModelFacet-» |
|
34 «EXPAND getDestroyElementCommand-» |
|
35 «EXPAND xpt::diagram::editpolicies::linkCommands::linkCommands(diagram)-» |
|
36 «ENDDEFINE» |
|
37 |
|
38 «DEFINE classBody(gmfgen::GenDiagram diagram) FOR gmfgen::LinkModelFacet-» |
|
39 «ERROR "Unsupported model facet: " + this-» |
|
40 «ENDDEFINE» |
|
41 |
|
42 «DEFINE getDestroyReferenceCommand FOR gmfgen::FeatureLinkModelFacet-» |
|
43 «EXPAND xpt::Common::generatedMemberComment» |
|
44 protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) { |
|
45 return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(req)«IF isContains(metaFeature)» { |
|
46 |
|
47 protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor progressMonitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { |
|
48 org.eclipse.emf.ecore.EObject referencedObject = getReferencedObject(); |
|
49 org.eclipse.emf.ecore.resource.Resource resource = referencedObject.eResource(); |
|
50 org.eclipse.gmf.runtime.common.core.command.CommandResult result = super.doExecuteWithResult(progressMonitor, info); |
|
51 resource.getContents().add(referencedObject); |
|
52 return result; |
|
53 } |
|
54 |
|
55 }«ENDIF»); |
|
56 } |
|
57 «ENDDEFINE» |
|
58 |
|
59 «DEFINE getDestroyElementCommand FOR gmfgen::TypeLinkModelFacet-» |
|
60 «EXPAND xpt::Common::generatedMemberComment» |
|
61 protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) { |
|
62 return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)); |
|
63 } |
|
64 «ENDDEFINE» |
|
65 |
|
66 «DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE» |