Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AAttribute2CreateCommand.java99
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AAttributeCreateCommand.java99
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAggregationsCreateCommand.java116
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAggregationsReorientCommand.java180
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAssociationsCreateCommand.java116
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAssociationsReorientCommand.java180
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCompositionsCreateCommand.java116
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCompositionsReorientCommand.java180
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCreateCommand.java98
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassImplementedInterfacesCreateCommand.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassImplementedInterfacesReorientCommand.java181
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassSubClassesCreateCommand.java116
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassSubClassesReorientCommand.java180
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AInterfaceCreateCommand.java99
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AOperation2CreateCommand.java99
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AOperationCreateCommand.java99
16 files changed, 2076 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AAttribute2CreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AAttribute2CreateCommand.java
new file mode 100644
index 0000000000..1b7d24f852
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AAttribute2CreateCommand.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AAttribute;
+import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AAttribute2CreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ public AAttribute2CreateCommand(CreateElementRequest req)
+ {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ * @generated
+ */
+ protected EObject getElementToEdit()
+ {
+ EObject container = ((CreateElementRequest)getRequest()).getContainer();
+ if (container instanceof View)
+ {
+ container = ((View)container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ AAttribute newElement = AcoreFactory.eINSTANCE.createAAttribute();
+
+ ABasicClass owner = (ABasicClass)getElementToEdit();
+ owner.getAttributes().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest)getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(AAttribute newElement, IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException
+ {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute())
+ {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AAttributeCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AAttributeCreateCommand.java
new file mode 100644
index 0000000000..ff60d8441e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AAttributeCreateCommand.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AAttribute;
+import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AAttributeCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ public AAttributeCreateCommand(CreateElementRequest req)
+ {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ * @generated
+ */
+ protected EObject getElementToEdit()
+ {
+ EObject container = ((CreateElementRequest)getRequest()).getContainer();
+ if (container instanceof View)
+ {
+ container = ((View)container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ AAttribute newElement = AcoreFactory.eINSTANCE.createAAttribute();
+
+ ABasicClass owner = (ABasicClass)getElementToEdit();
+ owner.getAttributes().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest)getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(AAttribute newElement, IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException
+ {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute())
+ {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAggregationsCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAggregationsCreateCommand.java
new file mode 100644
index 0000000000..229259b719
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAggregationsCreateCommand.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassAggregationsCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public AClassAggregationsCreateCommand(CreateRelationshipRequest request, EObject source, EObject target)
+ {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (source == null && target == null)
+ {
+ return false;
+ }
+ if (source != null && false == source instanceof AClass)
+ {
+ return false;
+ }
+ if (target != null && false == target instanceof AClass)
+ {
+ return false;
+ }
+ if (getSource() == null)
+ {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateAClassAggregations_4004(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+
+ if (getSource() != null && getTarget() != null)
+ {
+ getSource().getAggregations().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getSource()
+ {
+ return (AClass)source;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getTarget()
+ {
+ return (AClass)target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAggregationsReorientCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAggregationsReorientCommand.java
new file mode 100644
index 0000000000..c0e2177bbb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAggregationsReorientCommand.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassAggregationsReorientCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public AClassAggregationsReorientCommand(ReorientReferenceRelationshipRequest request)
+ {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (false == referenceOwner instanceof AClass)
+ {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource()
+ {
+ if (!(oldEnd instanceof AClass && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistAClassAggregations_4004(getNewSource(),
+ getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget()
+ {
+ if (!(oldEnd instanceof AClass && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistAClassAggregations_4004(getOldSource(),
+ getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException
+ {
+ getOldSource().getAggregations().remove(getOldTarget());
+ getNewSource().getAggregations().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException
+ {
+ getOldSource().getAggregations().remove(getOldTarget());
+ getOldSource().getAggregations().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldSource()
+ {
+ return (AClass)referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewSource()
+ {
+ return (AClass)newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldTarget()
+ {
+ return (AClass)oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewTarget()
+ {
+ return (AClass)newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAssociationsCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAssociationsCreateCommand.java
new file mode 100644
index 0000000000..4f345f37ee
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAssociationsCreateCommand.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassAssociationsCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public AClassAssociationsCreateCommand(CreateRelationshipRequest request, EObject source, EObject target)
+ {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (source == null && target == null)
+ {
+ return false;
+ }
+ if (source != null && false == source instanceof AClass)
+ {
+ return false;
+ }
+ if (target != null && false == target instanceof AClass)
+ {
+ return false;
+ }
+ if (getSource() == null)
+ {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateAClassAssociations_4003(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+
+ if (getSource() != null && getTarget() != null)
+ {
+ getSource().getAssociations().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getSource()
+ {
+ return (AClass)source;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getTarget()
+ {
+ return (AClass)target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAssociationsReorientCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAssociationsReorientCommand.java
new file mode 100644
index 0000000000..a45ad2f9cf
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassAssociationsReorientCommand.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassAssociationsReorientCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public AClassAssociationsReorientCommand(ReorientReferenceRelationshipRequest request)
+ {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (false == referenceOwner instanceof AClass)
+ {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource()
+ {
+ if (!(oldEnd instanceof AClass && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistAClassAssociations_4003(getNewSource(),
+ getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget()
+ {
+ if (!(oldEnd instanceof AClass && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistAClassAssociations_4003(getOldSource(),
+ getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException
+ {
+ getOldSource().getAssociations().remove(getOldTarget());
+ getNewSource().getAssociations().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException
+ {
+ getOldSource().getAssociations().remove(getOldTarget());
+ getOldSource().getAssociations().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldSource()
+ {
+ return (AClass)referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewSource()
+ {
+ return (AClass)newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldTarget()
+ {
+ return (AClass)oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewTarget()
+ {
+ return (AClass)newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCompositionsCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCompositionsCreateCommand.java
new file mode 100644
index 0000000000..484b1b89a7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCompositionsCreateCommand.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassCompositionsCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public AClassCompositionsCreateCommand(CreateRelationshipRequest request, EObject source, EObject target)
+ {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (source == null && target == null)
+ {
+ return false;
+ }
+ if (source != null && false == source instanceof AClass)
+ {
+ return false;
+ }
+ if (target != null && false == target instanceof AClass)
+ {
+ return false;
+ }
+ if (getSource() == null)
+ {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateAClassCompositions_4005(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+
+ if (getSource() != null && getTarget() != null)
+ {
+ getSource().getCompositions().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getSource()
+ {
+ return (AClass)source;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getTarget()
+ {
+ return (AClass)target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCompositionsReorientCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCompositionsReorientCommand.java
new file mode 100644
index 0000000000..3b7295dfc2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCompositionsReorientCommand.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassCompositionsReorientCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public AClassCompositionsReorientCommand(ReorientReferenceRelationshipRequest request)
+ {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (false == referenceOwner instanceof AClass)
+ {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource()
+ {
+ if (!(oldEnd instanceof AClass && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistAClassCompositions_4005(getNewSource(),
+ getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget()
+ {
+ if (!(oldEnd instanceof AClass && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistAClassCompositions_4005(getOldSource(),
+ getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException
+ {
+ getOldSource().getCompositions().remove(getOldTarget());
+ getNewSource().getCompositions().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException
+ {
+ getOldSource().getCompositions().remove(getOldTarget());
+ getOldSource().getCompositions().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldSource()
+ {
+ return (AClass)referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewSource()
+ {
+ return (AClass)newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldTarget()
+ {
+ return (AClass)oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewTarget()
+ {
+ return (AClass)newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCreateCommand.java
new file mode 100644
index 0000000000..5ab6039916
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassCreateCommand.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.ACoreRoot;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AClassCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ public AClassCreateCommand(CreateElementRequest req)
+ {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ * @generated
+ */
+ protected EObject getElementToEdit()
+ {
+ EObject container = ((CreateElementRequest)getRequest()).getContainer();
+ if (container instanceof View)
+ {
+ container = ((View)container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ AClass newElement = AcoreFactory.eINSTANCE.createAClass();
+
+ ACoreRoot owner = (ACoreRoot)getElementToEdit();
+ owner.getClasses().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest)getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(AClass newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute())
+ {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassImplementedInterfacesCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassImplementedInterfacesCreateCommand.java
new file mode 100644
index 0000000000..fe4db5f33f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassImplementedInterfacesCreateCommand.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassImplementedInterfacesCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public AClassImplementedInterfacesCreateCommand(CreateRelationshipRequest request, EObject source, EObject target)
+ {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (source == null && target == null)
+ {
+ return false;
+ }
+ if (source != null && false == source instanceof AClass)
+ {
+ return false;
+ }
+ if (target != null && false == target instanceof AInterface)
+ {
+ return false;
+ }
+ if (getSource() == null)
+ {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateAClassImplementedInterfaces_4002(getSource(),
+ getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+
+ if (getSource() != null && getTarget() != null)
+ {
+ getSource().getImplementedInterfaces().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getSource()
+ {
+ return (AClass)source;
+ }
+
+ /**
+ * @generated
+ */
+ protected AInterface getTarget()
+ {
+ return (AInterface)target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassImplementedInterfacesReorientCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassImplementedInterfacesReorientCommand.java
new file mode 100644
index 0000000000..f31e1300d4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassImplementedInterfacesReorientCommand.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassImplementedInterfacesReorientCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public AClassImplementedInterfacesReorientCommand(ReorientReferenceRelationshipRequest request)
+ {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (false == referenceOwner instanceof AClass)
+ {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource()
+ {
+ if (!(oldEnd instanceof AInterface && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistAClassImplementedInterfaces_4002(getNewSource(),
+ getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget()
+ {
+ if (!(oldEnd instanceof AInterface && newEnd instanceof AInterface))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistAClassImplementedInterfaces_4002(getOldSource(),
+ getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException
+ {
+ getOldSource().getImplementedInterfaces().remove(getOldTarget());
+ getNewSource().getImplementedInterfaces().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException
+ {
+ getOldSource().getImplementedInterfaces().remove(getOldTarget());
+ getOldSource().getImplementedInterfaces().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldSource()
+ {
+ return (AClass)referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewSource()
+ {
+ return (AClass)newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AInterface getOldTarget()
+ {
+ return (AInterface)oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AInterface getNewTarget()
+ {
+ return (AInterface)newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassSubClassesCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassSubClassesCreateCommand.java
new file mode 100644
index 0000000000..72695224fb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassSubClassesCreateCommand.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassSubClassesCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public AClassSubClassesCreateCommand(CreateRelationshipRequest request, EObject source, EObject target)
+ {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (source == null && target == null)
+ {
+ return false;
+ }
+ if (source != null && false == source instanceof AClass)
+ {
+ return false;
+ }
+ if (target != null && false == target instanceof AClass)
+ {
+ return false;
+ }
+ if (getSource() == null)
+ {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateAClassSubClasses_4001(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+
+ if (getSource() != null && getTarget() != null)
+ {
+ getSource().getSubClasses().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getSource()
+ {
+ return (AClass)source;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getTarget()
+ {
+ return (AClass)target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassSubClassesReorientCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassSubClassesReorientCommand.java
new file mode 100644
index 0000000000..cf8a305ad4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AClassSubClassesReorientCommand.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.policies.AcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class AClassSubClassesReorientCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public AClassSubClassesReorientCommand(ReorientReferenceRelationshipRequest request)
+ {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ if (false == referenceOwner instanceof AClass)
+ {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource()
+ {
+ if (!(oldEnd instanceof AClass && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints
+ .canExistAClassSubClasses_4001(getNewSource(), getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget()
+ {
+ if (!(oldEnd instanceof AClass && newEnd instanceof AClass))
+ {
+ return false;
+ }
+ return AcoreBaseItemSemanticEditPolicy.LinkConstraints
+ .canExistAClassSubClasses_4001(getOldSource(), getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ if (!canExecute())
+ {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
+ {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET)
+ {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException
+ {
+ getOldSource().getSubClasses().remove(getOldTarget());
+ getNewSource().getSubClasses().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException
+ {
+ getOldSource().getSubClasses().remove(getOldTarget());
+ getOldSource().getSubClasses().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldSource()
+ {
+ return (AClass)referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewSource()
+ {
+ return (AClass)newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getOldTarget()
+ {
+ return (AClass)oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected AClass getNewTarget()
+ {
+ return (AClass)newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AInterfaceCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AInterfaceCreateCommand.java
new file mode 100644
index 0000000000..ed80a8ede0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AInterfaceCreateCommand.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.ACoreRoot;
+import org.eclipse.emf.cdo.dawn.examples.acore.AInterface;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AInterfaceCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ public AInterfaceCreateCommand(CreateElementRequest req)
+ {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ * @generated
+ */
+ protected EObject getElementToEdit()
+ {
+ EObject container = ((CreateElementRequest)getRequest()).getContainer();
+ if (container instanceof View)
+ {
+ container = ((View)container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ AInterface newElement = AcoreFactory.eINSTANCE.createAInterface();
+
+ ACoreRoot owner = (ACoreRoot)getElementToEdit();
+ owner.getInterfaces().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest)getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(AInterface newElement, IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException
+ {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute())
+ {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AOperation2CreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AOperation2CreateCommand.java
new file mode 100644
index 0000000000..4ce577867b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AOperation2CreateCommand.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AOperation;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AOperation2CreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ public AOperation2CreateCommand(CreateElementRequest req)
+ {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ * @generated
+ */
+ protected EObject getElementToEdit()
+ {
+ EObject container = ((CreateElementRequest)getRequest()).getContainer();
+ if (container instanceof View)
+ {
+ container = ((View)container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ AOperation newElement = AcoreFactory.eINSTANCE.createAOperation();
+
+ ABasicClass owner = (ABasicClass)getElementToEdit();
+ owner.getOperations().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest)getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(AOperation newElement, IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException
+ {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute())
+ {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AOperationCreateCommand.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AOperationCreateCommand.java
new file mode 100644
index 0000000000..76d30326fe
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.diagram/src/org/eclipse/emf/cdo/dawn/examples/acore/diagram/edit/commands/AOperationCreateCommand.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany).
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ *
+ */
+package org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.cdo.dawn.examples.acore.ABasicClass;
+import org.eclipse.emf.cdo.dawn.examples.acore.AOperation;
+import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class AOperationCreateCommand extends EditElementCommand
+{
+
+ /**
+ * @generated
+ */
+ public AOperationCreateCommand(CreateElementRequest req)
+ {
+ super(req.getLabel(), null, req);
+ }
+
+ /**
+ * FIXME: replace with setElementToEdit()
+ * @generated
+ */
+ protected EObject getElementToEdit()
+ {
+ EObject container = ((CreateElementRequest)getRequest()).getContainer();
+ if (container instanceof View)
+ {
+ container = ((View)container).getElement();
+ }
+ return container;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute()
+ {
+ return true;
+
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ AOperation newElement = AcoreFactory.eINSTANCE.createAOperation();
+
+ ABasicClass owner = (ABasicClass)getElementToEdit();
+ owner.getOperations().add(newElement);
+
+ doConfigure(newElement, monitor, info);
+
+ ((CreateElementRequest)getRequest()).setNewElement(newElement);
+ return CommandResult.newOKCommandResult(newElement);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doConfigure(AOperation newElement, IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException
+ {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
+ configureRequest.addParameters(getRequest().getParameters());
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ if (configureCommand != null && configureCommand.canExecute())
+ {
+ configureCommand.execute(monitor, info);
+ }
+ }
+
+}

Back to the top