/*
* (c) 2011 - 2013 University of Mannheim: Software Engineering Group
*/
package de.uni_mannheim.informatik.swt.models.plm.diagram.edit.policies;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.ocl.ParserException;
import org.eclipse.ocl.ecore.Constraint;
import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.helper.OCLHelper;
/**
* @generated
*/
public class Entity2ItemSemanticEditPolicy
extends
de.uni_mannheim.informatik.swt.models.plm.diagram.edit.policies.PLMBaseItemSemanticEditPolicy {
/**
* @generated
*/
public Entity2ItemSemanticEditPolicy() {
super(
de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Entity_3069);
}
/**
* @generated
*/
protected Command getCreateCommand(CreateElementRequest req) {
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.LMLVisualizer_3079 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.LMLVisualizer7CreateCommand(
req));
}
return super.getCreateCommand(req);
}
/**
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
View view = (View) getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
getEditingDomain(), null);
cmd.setTransactionNestingEnabled(false);
for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ClassificationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
incomingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.SetRelationshipBaseEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(), null,
incomingLink.getTarget().getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EqualityEqualEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(), null,
incomingLink.getTarget().getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.InversionInverseEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(), null,
incomingLink.getTarget().getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ComplementComplementEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(), null,
incomingLink.getTarget().getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.GeneralizationSupertypeEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(), null,
incomingLink.getTarget().getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.GeneralizationSubtypeEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(), null,
incomingLink.getTarget().getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ParticipationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
incomingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
continue;
}
}
for (Iterator<?> it = view.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge) it.next();
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(outgoingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ClassificationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
outgoingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
continue;
}
}
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if (annotation == null) {
// there are indirectly referenced children, need extra commands: false
addDestroyChildNodesCommand(cmd);
addDestroyShortcutsCommand(cmd, view);
// delete host element
cmd.add(new DestroyElementCommand(req));
} else {
cmd.add(new DeleteCommand(getEditingDomain(), view));
}
//*****************************************************************
//BEGIN Custom Code
//*****************************************************************
//We need to delete the classification manually when not visible
de.uni_mannheim.informatik.swt.models.plm.PLM.Classification[] classification = null;
org.eclipse.ocl.ecore.OCL ocl = org.eclipse.ocl.ecore.OCL.newInstance();
OCLHelper<EClassifier, ?, ?, Constraint> helper = ocl.createOCLHelper();
helper.setContext(de.uni_mannheim.informatik.swt.models.plm.PLM.PLMPackage.Literals.ONTOLOGY);
try {
OCLExpression<EClassifier> q = helper
.createQuery("Classification.allInstances()->select(i| i.type = self or i.instance = self)");
classification = ((HashSet<de.uni_mannheim.informatik.swt.models.plm.PLM.Classification>) ocl
.evaluate(view.getElement(), q))
.toArray(new de.uni_mannheim.informatik.swt.models.plm.PLM.Classification[] {});
} catch (ParserException e) {
e.printStackTrace();
}
for (de.uni_mannheim.informatik.swt.models.plm.PLM.Classification i : classification) {
DestroyElementRequest r = new DestroyElementRequest(i, false);
cmd.add(new DestroyElementCommand(r));
}
//*****************************************************************
//END Custom Code
//*****************************************************************
return getGEFWrapper(cmd.reduce());
}
/**
* @generated
*/
private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
View view = (View) getHost().getModel();
for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
Node node = (Node) nit.next();
switch (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(node)) {
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.LMLVisualizer7EditPart.VISUAL_ID:
cmd.add(new DestroyElementCommand(new DestroyElementRequest(
getEditingDomain(), node.getElement(), false))); // directlyOwned: true
// don't need explicit deletion of node as parent's view deletion would clean child views as well
// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
break;
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EntityEntityAttributesCompartment2EditPart.VISUAL_ID:
for (Iterator<?> cit = node.getChildren().iterator(); cit
.hasNext();) {
Node cnode = (Node) cit.next();
switch (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(cnode)) {
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Attribute2EditPart.VISUAL_ID:
cmd.add(new DestroyElementCommand(
new DestroyElementRequest(getEditingDomain(),
cnode.getElement(), false))); // directlyOwned: true
// don't need explicit deletion of cnode as parent's view deletion would clean child views as well
// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
}
}
break;
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EntityEntityMethodsCompartment2EditPart.VISUAL_ID:
for (Iterator<?> cit = node.getChildren().iterator(); cit
.hasNext();) {
Node cnode = (Node) cit.next();
switch (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(cnode)) {
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Method2EditPart.VISUAL_ID:
cmd.add(new DestroyElementCommand(
new DestroyElementRequest(getEditingDomain(),
cnode.getElement(), false))); // directlyOwned: true
// don't need explicit deletion of cnode as parent's view deletion would clean child views as well
// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
}
}
break;
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EntityEntityContentsCompartment2EditPart.VISUAL_ID:
for (Iterator<?> cit = node.getChildren().iterator(); cit
.hasNext();) {
Node cnode = (Node) cit.next();
switch (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(cnode)) {
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EntityEditPart.VISUAL_ID:
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it
.hasNext();) {
Edge incomingLink = (Edge) it.next();
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ClassificationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
incomingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.SetRelationshipBaseEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EqualityEqualEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.InversionInverseEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ComplementComplementEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.GeneralizationSupertypeEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.GeneralizationSubtypeEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ParticipationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
incomingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
}
for (Iterator<?> it = cnode.getSourceEdges().iterator(); it
.hasNext();) {
Edge outgoingLink = (Edge) it.next();
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(outgoingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ClassificationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
outgoingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
outgoingLink));
continue;
}
}
cmd.add(new DestroyElementCommand(
new DestroyElementRequest(getEditingDomain(),
cnode.getElement(), false))); // directlyOwned: true
// don't need explicit deletion of cnode as parent's view deletion would clean child views as well
// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Connection2EditPart.VISUAL_ID:
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it
.hasNext();) {
Edge incomingLink = (Edge) it.next();
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ClassificationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
incomingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.SetRelationshipBaseEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EqualityEqualEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.InversionInverseEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ComplementComplementEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.GeneralizationSupertypeEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.GeneralizationSubtypeEditPart.VISUAL_ID) {
DestroyReferenceRequest r = new DestroyReferenceRequest(
incomingLink.getSource().getElement(),
null, incomingLink.getTarget()
.getElement(), false);
cmd.add(new DestroyReferenceCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(incomingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ParticipationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
incomingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
incomingLink));
continue;
}
}
for (Iterator<?> it = cnode.getSourceEdges().iterator(); it
.hasNext();) {
Edge outgoingLink = (Edge) it.next();
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(outgoingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ClassificationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
outgoingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
outgoingLink));
continue;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry
.getVisualID(outgoingLink) == de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ParticipationEditPart.VISUAL_ID) {
DestroyElementRequest r = new DestroyElementRequest(
outgoingLink.getElement(), false);
cmd.add(new DestroyElementCommand(r));
cmd.add(new DeleteCommand(getEditingDomain(),
outgoingLink));
continue;
}
}
cmd.add(new DestroyElementCommand(
new DestroyElementRequest(getEditingDomain(),
cnode.getElement(), false))); // directlyOwned: true
// don't need explicit deletion of cnode as parent's view deletion would clean child views as well
// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
}
}
break;
}
}
}
/**
* @generated
*/
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
: getCompleteCreateRelationshipCommand(req);
return command != null ? command : super
.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
protected Command getStartCreateRelationshipCommand(
CreateRelationshipRequest req) {
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.ClassificationCreateCommand(
req, req.getSource(), req.getTarget()));
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.SetRelationshipBase_4013 == req
.getElementType()) {
return null;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.EqualityEqual_4018 == req
.getElementType()) {
return null;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.InversionInverse_4015 == req
.getElementType()) {
return null;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.ComplementComplement_4016 == req
.getElementType()) {
return null;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.GeneralizationSupertype_4022 == req
.getElementType()) {
return null;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.GeneralizationSubtype_4023 == req
.getElementType()) {
return null;
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.ParticipationCreateCommand(
req, req.getTarget(), req.getSource()));
}
return null;
}
/**
* @generated
*/
protected Command getCompleteCreateRelationshipCommand(
CreateRelationshipRequest req) {
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.ClassificationCreateCommand(
req, req.getSource(), req.getTarget()));
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.SetRelationshipBase_4013 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.SetRelationshipBaseCreateCommand(
req, req.getSource(), req.getTarget()));
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.EqualityEqual_4018 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.EqualityEqualCreateCommand(
req, req.getSource(), req.getTarget()));
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.InversionInverse_4015 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.InversionInverseCreateCommand(
req, req.getSource(), req.getTarget()));
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.ComplementComplement_4016 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.ComplementComplementCreateCommand(
req, req.getSource(), req.getTarget()));
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.GeneralizationSupertype_4022 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.GeneralizationSupertypeCreateCommand(
req, req.getSource(), req.getTarget()));
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.GeneralizationSubtype_4023 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.GeneralizationSubtypeCreateCommand(
req, req.getSource(), req.getTarget()));
}
if (de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025 == req
.getElementType()) {
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.ParticipationCreateCommand(
req, req.getSource(), req.getTarget()));
}
return null;
}
/**
* Returns command to reorient EClass based link. New link target or source
* should be the domain model element associated with this node.
*
* @generated
*/
protected Command getReorientRelationshipCommand(
ReorientRelationshipRequest req) {
switch (getVisualID(req)) {
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ClassificationEditPart.VISUAL_ID:
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.ClassificationReorientCommand(
req));
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ParticipationEditPart.VISUAL_ID:
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.ParticipationReorientCommand(
req));
}
return super.getReorientRelationshipCommand(req);
}
/**
* Returns command to reorient EReference based link. New link target or source
* should be the domain model element associated with this node.
*
* @generated
*/
protected Command getReorientReferenceRelationshipCommand(
ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.SetRelationshipBaseEditPart.VISUAL_ID:
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.SetRelationshipBaseReorientCommand(
req));
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EqualityEqualEditPart.VISUAL_ID:
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.EqualityEqualReorientCommand(
req));
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.InversionInverseEditPart.VISUAL_ID:
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.InversionInverseReorientCommand(
req));
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ComplementComplementEditPart.VISUAL_ID:
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.ComplementComplementReorientCommand(
req));
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.GeneralizationSupertypeEditPart.VISUAL_ID:
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.GeneralizationSupertypeReorientCommand(
req));
case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.GeneralizationSubtypeEditPart.VISUAL_ID:
return getGEFWrapper(new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.commands.GeneralizationSubtypeReorientCommand(
req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
}