Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9c98adc358187f338530afe18a89ab6fd15619ad (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
/*
 * Copyright (c) 2007 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:
 *    bblajer (Borland) - initial API and implementation
 */

«IMPORT "http://www.eclipse.org/gmf/2005/GenModel/2.0"»
«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
«EXTENSION xpt::GenModelUtils»

/**
 * EMF command to remove a link. Used by Reconnect*Commands and by ComponentEditPolicies.
 */
«DEFINE domainModelRemoveCommand(String edgeVar) FOR gmfgen::GenLink-»
«EXPAND xpt::Common::generatedMemberComment»
private org.eclipse.emf.common.command.Command createDomainModelRemoveCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
	«EXPAND domainModelRemoveCommand("editingDomain", edgeVar) FOR modelFacet-»
}
«ENDDEFINE»

«DEFINE domainModelRemoveCommand(String domainVar, String edgeVar) FOR gmfgen::LinkModelFacet-»
return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
«ENDDEFINE»

«DEFINE domainModelRemoveCommand(String domainVar, String edgeVar) FOR gmfgen::TypeLinkModelFacet-»
«EXPAND deleteCommand(domainVar, edgeVar)-»
«ENDDEFINE»

«DEFINE domainModelRemoveCommand(String domainVar, String nodeVar) FOR gmfgen::TypeModelFacet-»
«EXPAND deleteCommand(domainVar, nodeVar)-»
«ENDDEFINE»

«DEFINE deleteCommand(String domainVar, String elementVar) FOR gmfgen::TypeModelFacet-»
«IF containmentMetaFeature == null-»
return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
«ELSE-»
return org.eclipse.gmf.runtime.lite.commands.DestroyElementCommand.create(«domainVar», «elementVar».getElement());
«ENDIF-»
«ENDDEFINE»

«DEFINE domainModelRemoveCommand(String domainVar, String edgeVar) FOR gmfgen::FeatureLinkModelFacet-»
return «EXPAND xpt::commands::Common::unplugFeatureCommand(domainVar, edgeVar + ".getSource().getElement()", edgeVar + ".getTarget().getElement()") FOR metaFeature»;
«ENDDEFINE»

«DEFINE domainModelRemoveCommand(String nodeVar) FOR gmfgen::GenNode-»
«EXPAND xpt::Common::generatedMemberComment»
private org.eclipse.emf.common.command.Command createDomainModelRemoveCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
	«EXPAND domainModelRemoveCommand("editingDomain", nodeVar) FOR modelFacet-»
}
«ENDDEFINE»

Back to the top