blob: fe6f7f83dabc7ae3161f89110f42d1ae50ec7d4b [file] [log] [blame]
/*
* Copyright (c) 2007, 2009 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/2009/GenModel'»
«EXTENSION xpt::GenModelUtils»
/**
* EMF command to remove a link. Used by Reconnect*Commands and by ComponentEditPolicies.
*/
«DEFINE domainModelRemoveCommand(edgeVar : String) 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(domainVar : String, edgeVar : String) FOR gmfgen::LinkModelFacet
return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
«ENDDEFINE»
«DEFINE domainModelRemoveCommand(domainVar : String, edgeVar : String) FOR gmfgen::TypeLinkModelFacet
«EXPAND deleteCommand(domainVar, edgeVar)-»
«ENDDEFINE»
«DEFINE domainModelRemoveCommand(domainVar : String, nodeVar : String) FOR gmfgen::TypeModelFacet
«EXPAND deleteCommand(domainVar, nodeVar)-»
«ENDDEFINE»
«DEFINE deleteCommand(domainVar : String, elementVar : String) FOR gmfgen::TypeModelFacet
return org.eclipse.gmf.runtime.lite.commands.DestroyElementCommand.createdomainVar», «elementVar».getElement());
«ENDDEFINE»
«DEFINE domainModelRemoveCommand(domainVar : String, edgeVar : String) FOR gmfgen::FeatureLinkModelFacet
«IF isContains(metaFeature)-»
org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
result.appendEXPAND xpt::commands::Common::unplugFeatureCommand(domainVar, edgeVar + '.getSource().getElement()', edgeVar + '.getTarget().getElement()') FOR metaFeature»);
result.append(new org.eclipse.emf.edit.command.AddCommanddomainVar», «EXPAND xpt::commands::Common::getPhantomContainmentResource FOR edgeVar».getContents(), «edgeVar».getTarget().getElement()));
return result;
«ELSE
return «EXPAND xpt::commands::Common::unplugFeatureCommand(domainVar, edgeVar + '.getSource().getElement()', edgeVar + '.getTarget().getElement()') FOR metaFeature»;
«ENDIF
«ENDDEFINE»
«DEFINE domainModelRemoveCommand(nodeVar : String) 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»