blob: 280de5e4b3c5bdc05aa15e71c3957295f757ecc4 [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 2007 IBM Corporation and others.
// 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:
// IBM Corporation - initial implementation
//------------------------------------------------------------------------------
package org.eclipse.epf.diagram.wpdd.edit.policies;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.epf.diagram.model.Diagram;
import org.eclipse.epf.diagram.model.ModelPackage;
import org.eclipse.epf.diagram.model.NamedNode;
import org.eclipse.epf.diagram.wpdd.edit.commands.WorkProductNodeCreateCommand;
import org.eclipse.epf.diagram.wpdd.providers.DiagramElementTypes;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
public class WorkProductDependencyDiagramItemSemanticEditPolicy extends
DiagramBaseItemSemanticEditPolicy {
/**
* @generated
*/
protected Command getCreateCommand(CreateElementRequest req) {
if (DiagramElementTypes.WorkProductNode_1001 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(ModelPackage.eINSTANCE
.getNodeContainer_Nodes());
}
return getMSLWrapper(new WorkProductNodeCreateCommand(req));
}
return super.getCreateCommand(req);
}
/**
* @modified
*/
protected Command getDuplicateCommand(DuplicateElementsRequest req) {
// TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
// .getEditingDomain();
// return getMSLWrapper(new DuplicateAnythingCommand(editingDomain, req));
return null;
}
/**
* @generated
*/
private static class DuplicateAnythingCommand extends
DuplicateEObjectsCommand {
/**
* @generated
*/
public DuplicateAnythingCommand(
TransactionalEditingDomain editingDomain,
DuplicateElementsRequest req) {
super(editingDomain, req.getLabel(), req
.getElementsToBeDuplicated(), req
.getAllDuplicatedElementsMap());
}
}
}