Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordstadnik2007-04-17 08:43:39 -0400
committerdstadnik2007-04-17 08:43:39 -0400
commitba8cb5fc8543052dda5334702a60a34120b08b9b (patch)
treec859bd13f00634eea2f19c05eaef29d93bd645be
parentacf539507bdbb4aad82e59b0134bec09f6baf646 (diff)
downloadorg.eclipse.gmf-tooling-ba8cb5fc8543052dda5334702a60a34120b08b9b.tar.gz
org.eclipse.gmf-tooling-ba8cb5fc8543052dda5334702a60a34120b08b9b.tar.xz
org.eclipse.gmf-tooling-ba8cb5fc8543052dda5334702a60a34120b08b9b.zip
regenerated
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/PortRegisterCreateCommand.java85
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ShipDestinationCreateCommand.java85
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java26
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java26
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java26
5 files changed, 182 insertions, 66 deletions
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/PortRegisterCreateCommand.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/PortRegisterCreateCommand.java
new file mode 100644
index 000000000..d1aa7cb9b
--- /dev/null
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/PortRegisterCreateCommand.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2006, 2007 Borland Software Corporation
+ *
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.examples.taipan.Port;
+import org.eclipse.gmf.examples.taipan.Ship;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.TaiPanBaseItemSemanticEditPolicy;
+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 PortRegisterCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public PortRegisterCreateCommand(CreateRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ source = request.getSource();
+ target = request.getTarget();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (!(source instanceof Port && (target == null || target instanceof Ship))) {
+ return false;
+ }
+ return TaiPanBaseItemSemanticEditPolicy.LinkConstraints.canCreatePortRegister_4007(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 (getTarget() != null) {
+ getSource().getRegister().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult(getSource());
+ }
+
+ /**
+ * @generated
+ */
+ protected Port getSource() {
+ return (Port) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Ship getTarget() {
+ return (Ship) target;
+ }
+}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ShipDestinationCreateCommand.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ShipDestinationCreateCommand.java
new file mode 100644
index 000000000..76678b88a
--- /dev/null
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ShipDestinationCreateCommand.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2006, 2007 Borland Software Corporation
+ *
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.examples.taipan.Port;
+import org.eclipse.gmf.examples.taipan.Ship;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.TaiPanBaseItemSemanticEditPolicy;
+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 ShipDestinationCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public ShipDestinationCreateCommand(CreateRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ source = request.getSource();
+ target = request.getTarget();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (!(source instanceof Ship && (target == null || target instanceof Port))) {
+ return false;
+ }
+ return TaiPanBaseItemSemanticEditPolicy.LinkConstraints.canCreateShipDestination_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 (getTarget() != null) {
+ getSource().setDestination(getTarget());
+ }
+ return CommandResult.newOKCommandResult(getSource());
+ }
+
+ /**
+ * @generated
+ */
+ protected Ship getSource() {
+ return (Ship) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected Port getTarget() {
+ return (Port) target;
+ }
+}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java
index 15591e200..bdedb38af 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java
@@ -22,9 +22,11 @@ import org.eclipse.gmf.examples.taipan.TaiPanPackage;
import org.eclipse.gmf.examples.taipan.Warship;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.BesiegePortOrderCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.BesiegePortOrderReorientCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.PortRegisterCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.PortRegisterReorientCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.ReliableRouteCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.ReliableRouteReorientCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.ShipDestinationCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.ShipDestinationReorientCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.UnreliableRouteCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.UnreliableRouteReorientCommand;
@@ -87,18 +89,7 @@ public class PortItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPolicy
* @generated
*/
protected Command getCreateCompleteIncomingShipDestination_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof Ship || false == targetEObject instanceof Port) {
- return UnexecutableCommand.INSTANCE;
- }
- Ship source = (Ship) sourceEObject;
- Port target = (Port) targetEObject;
- if (!TaiPanBaseItemSemanticEditPolicy.LinkConstraints.canCreateShipDestination_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, TaiPanPackage.eINSTANCE.getShip_Destination(), target);
- return getGEFWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new ShipDestinationCreateCommand(req));
}
/**
@@ -213,16 +204,7 @@ public class PortItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPolicy
* @generated
*/
protected Command getCreateStartOutgoingPortRegister_4007Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- if (false == sourceEObject instanceof Port) {
- return UnexecutableCommand.INSTANCE;
- }
- Port source = (Port) sourceEObject;
- if (!TaiPanBaseItemSemanticEditPolicy.LinkConstraints.canCreatePortRegister_4007(source, null)) {
- return UnexecutableCommand.INSTANCE;
- }
- return new Command() {
- };
+ return getGEFWrapper(new PortRegisterCreateCommand(req));
}
/**
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java
index bcce384e8..84c9a5cb6 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java
@@ -24,7 +24,9 @@ import org.eclipse.gmf.examples.taipan.TaiPanPackage;
import org.eclipse.gmf.examples.taipan.Warship;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.EscortShipsOrderCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.EscortShipsOrderReorientCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.PortRegisterCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.PortRegisterReorientCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.ShipDestinationCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.ShipDestinationReorientCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.EmptyBoxEditPart;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.EscortShipsOrderEditPart;
@@ -124,16 +126,7 @@ public class ShipItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPolicy
* @generated
*/
protected Command getCreateStartOutgoingShipDestination_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- if (false == sourceEObject instanceof Ship) {
- return UnexecutableCommand.INSTANCE;
- }
- Ship source = (Ship) sourceEObject;
- if (!TaiPanBaseItemSemanticEditPolicy.LinkConstraints.canCreateShipDestination_4001(source, null)) {
- return UnexecutableCommand.INSTANCE;
- }
- return new Command() {
- };
+ return getGEFWrapper(new ShipDestinationCreateCommand(req));
}
/**
@@ -160,18 +153,7 @@ public class ShipItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPolicy
* @generated
*/
protected Command getCreateCompleteIncomingPortRegister_4007Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof Port || false == targetEObject instanceof Ship) {
- return UnexecutableCommand.INSTANCE;
- }
- Port source = (Port) sourceEObject;
- Ship target = (Ship) targetEObject;
- if (!TaiPanBaseItemSemanticEditPolicy.LinkConstraints.canCreatePortRegister_4007(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, TaiPanPackage.eINSTANCE.getPort_Register(), target);
- return getGEFWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new PortRegisterCreateCommand(req));
}
/**
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java
index 97b7b95ae..c9d75a3c4 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java
@@ -22,7 +22,9 @@ import org.eclipse.gmf.examples.taipan.Warship;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.BesiegePortOrderReorientCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.EscortShipsOrderCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.EscortShipsOrderReorientCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.PortRegisterCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.PortRegisterReorientCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.ShipDestinationCreateCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.commands.ShipDestinationReorientCommand;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.BesiegePortOrderEditPart;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.EscortShipsOrderEditPart;
@@ -79,16 +81,7 @@ public class WarshipItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPol
* @generated
*/
protected Command getCreateStartOutgoingShipDestination_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- if (false == sourceEObject instanceof Ship) {
- return UnexecutableCommand.INSTANCE;
- }
- Ship source = (Ship) sourceEObject;
- if (!TaiPanBaseItemSemanticEditPolicy.LinkConstraints.canCreateShipDestination_4001(source, null)) {
- return UnexecutableCommand.INSTANCE;
- }
- return new Command() {
- };
+ return getGEFWrapper(new ShipDestinationCreateCommand(req));
}
/**
@@ -147,18 +140,7 @@ public class WarshipItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPol
* @generated
*/
protected Command getCreateCompleteIncomingPortRegister_4007Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof Port || false == targetEObject instanceof Ship) {
- return UnexecutableCommand.INSTANCE;
- }
- Port source = (Port) sourceEObject;
- Ship target = (Ship) targetEObject;
- if (!TaiPanBaseItemSemanticEditPolicy.LinkConstraints.canCreatePortRegister_4007(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, TaiPanPackage.eINSTANCE.getPort_Register(), target);
- return getGEFWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new PortRegisterCreateCommand(req));
}
/**

Back to the top