diff options
author | bblajer | 2006-12-12 12:54:50 +0000 |
---|---|---|
committer | bblajer | 2006-12-12 12:54:50 +0000 |
commit | 2e681d6288877b5a097571b9a4d6380467d41448 (patch) | |
tree | c6ee1996c528970108726d0eea112ec9a0e61e0c /plugins/org.eclipse.gmf.runtime.lite/src/org | |
parent | 7dfab9d847cd73ace4842e6284c46826f6035faf (diff) | |
download | org.eclipse.gmf-tooling-2e681d6288877b5a097571b9a4d6380467d41448.tar.gz org.eclipse.gmf-tooling-2e681d6288877b5a097571b9a4d6380467d41448.tar.xz org.eclipse.gmf-tooling-2e681d6288877b5a097571b9a4d6380467d41448.zip |
[164018]: Command generation separated from editparts for link commands (createStart, complete, reconnectSource, reconnectTarget) and nodes (create)
Diffstat (limited to 'plugins/org.eclipse.gmf.runtime.lite/src/org')
2 files changed, 73 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/commands/VetoCommand.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/commands/VetoCommand.java new file mode 100644 index 000000000..74df5355c --- /dev/null +++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/commands/VetoCommand.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2006 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: + * bblajer - initial API and implementation + */ +package org.eclipse.gmf.runtime.lite.commands; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandWrapper; +import org.eclipse.emf.common.command.IdentityCommand; +import org.eclipse.emf.common.command.UnexecutableCommand; + +/** + * Command that, if can be executed, does nothing. + * @author bblajer + */ +public abstract class VetoCommand extends CommandWrapper { + public VetoCommand() { + super(); + } + + public VetoCommand(String label) { + super(label); + } + + public VetoCommand(String label, String description) { + super(label, description); + } + + @Override + protected Command createCommand() { + return shouldExecute() ? IdentityCommand.INSTANCE : UnexecutableCommand.INSTANCE; + } + + protected abstract boolean shouldExecute(); +} diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/policies/DelegatingDirectEditPolicy.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/policies/DelegatingDirectEditPolicy.java new file mode 100644 index 000000000..464b0a2b9 --- /dev/null +++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/policies/DelegatingDirectEditPolicy.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2006 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: + * bblajer - initial API and implementation + */ +package org.eclipse.gmf.runtime.lite.edit.policies; + +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.DirectEditPolicy; +import org.eclipse.gef.requests.DirectEditRequest; + +/** + * Edit policy that understands direct edit requests, but does nothing in response to it. + * This may used by edit parts that delegate direct edit request to child edit parts. + */ +public class DelegatingDirectEditPolicy extends DirectEditPolicy { + @Override + protected Command getDirectEditCommand(DirectEditRequest request) { + return null; + } + + @Override + protected void showCurrentEditValue(DirectEditRequest request) { + } +} |