diff options
Diffstat (limited to 'examples/gmf/org.eclipse.gmf.examples.mindmap.diagram/src/org/eclipse/gmf/examples/mindmap/diagram/edit/commands/TopicSubtopicsCreateCommand.java')
-rw-r--r-- | examples/gmf/org.eclipse.gmf.examples.mindmap.diagram/src/org/eclipse/gmf/examples/mindmap/diagram/edit/commands/TopicSubtopicsCreateCommand.java | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/examples/gmf/org.eclipse.gmf.examples.mindmap.diagram/src/org/eclipse/gmf/examples/mindmap/diagram/edit/commands/TopicSubtopicsCreateCommand.java b/examples/gmf/org.eclipse.gmf.examples.mindmap.diagram/src/org/eclipse/gmf/examples/mindmap/diagram/edit/commands/TopicSubtopicsCreateCommand.java deleted file mode 100644 index 383e99d17..000000000 --- a/examples/gmf/org.eclipse.gmf.examples.mindmap.diagram/src/org/eclipse/gmf/examples/mindmap/diagram/edit/commands/TopicSubtopicsCreateCommand.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.eclipse.gmf.examples.mindmap.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.ecore.EObject; -import org.eclipse.gmf.examples.mindmap.Topic; -import org.eclipse.gmf.examples.mindmap.diagram.edit.policies.MindmapBaseItemSemanticEditPolicy; -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 TopicSubtopicsCreateCommand extends EditElementCommand { - - /** - * @generated - */ - private final EObject source; - - /** - * @generated - */ - private final EObject target; - - /** - * @generated - */ - public TopicSubtopicsCreateCommand(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 && !(source instanceof Topic)) { - return false; - } - if (target != null && !(target instanceof Topic)) { - 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 MindmapBaseItemSemanticEditPolicy.LinkConstraints - .canCreateTopicSubtopics_3001(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().getSubtopics().add(getTarget()); - } - return CommandResult.newOKCommandResult(); - } - - /** - * @generated - */ - protected Topic getSource() { - return (Topic) source; - } - - /** - * @generated - */ - protected Topic getTarget() { - return (Topic) target; - } -} |