/******************************************************************************* * Copyright (c) 2012 VMware, Inc. * 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: * VMware, Inc. - initial API and implementation *******************************************************************************/ package org.springframework.ide.eclipse.config.graph.policies; import org.eclipse.gef.commands.Command; import org.eclipse.gef.editpolicies.ComponentEditPolicy; import org.eclipse.gef.requests.GroupRequest; import org.springframework.ide.eclipse.config.graph.model.Activity; import org.springframework.ide.eclipse.config.graph.model.StructuredActivity; import org.springframework.ide.eclipse.config.graph.model.commands.DeleteCommand; /** * @author Leo Dos Santos * @author Christian Dupuis */ public class ActivityEditPolicy extends ComponentEditPolicy { /** * @see ComponentEditPolicy#createDeleteCommand(org.eclipse.gef.requests.GroupRequest) */ @Override protected Command createDeleteCommand(GroupRequest deleteRequest) { StructuredActivity parent = (StructuredActivity) (getHost().getParent().getModel()); DeleteCommand deleteCmd = new DeleteCommand(parent.getDiagram().getTextEditor()); deleteCmd.setParent(parent); deleteCmd.setChild((Activity) (getHost().getModel())); return deleteCmd; } }