/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
*
* 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:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.clazz.edit.policies;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
/**
* @generated
*/
public class PropertyForComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
/**
* @generated
*/
public PropertyForComponentItemSemanticEditPolicy() {
super(UMLElementTypes.Property_3002);
}
/**
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
EObject selectedEObject = req.getElementToDestroy();
IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
}
return UnexecutableCommand.INSTANCE;
}
}