Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2008-12-29 07:41:38 -0500
committerashatalin2008-12-29 07:41:38 -0500
commitfc1dfb3b462e159eec1b6031bb41ab79c762474b (patch)
tree66acb7873f68640147106dcd919a5041ecbc918b /plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt
parent7f3bb1960b122d5d9c4edae8dc1c330032c9cf60 (diff)
downloadorg.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.tar.gz
org.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.tar.xz
org.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.zip
QVTO-based xpand implementation was merged to HEAD
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt72
1 files changed, 72 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt
new file mode 100644
index 000000000..c0590c364
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2006, 2008 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE GraphicalNodeEditPolicy FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «graphicalNodeEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy {
+
+ «EXPAND xpt::Common::generatedClassComment»
+ protected org.eclipse.gef.commands.Command getConnectionCompleteCommand(
+ org.eclipse.gef.requests.CreateConnectionRequest request) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getElementType(request);
+ «FOREACH reorientedIncomingLinks->asSequence() AS link-»
+ if («EXPAND xpt::providers::ElementTypes::accessElementType FOR link» == elementType) {
+ «IF link.outgoingCreationAllowed-»
+ if (request.getSourceEditPart() != getHost()) {
+ «ENDIF-»
+ return getConnectionWithReorientedViewCompleteCommand(request);
+ «IF link.outgoingCreationAllowed-»
+ }
+ «ENDIF-»
+ }
+ «ENDFOREACH-»
+ return super.getConnectionCompleteCommand(request);
+ }
+
+ «EXPAND xpt::Common::generatedClassComment»
+ protected org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(
+ org.eclipse.gef.requests.CreateConnectionRequest request) {
+ if (request instanceof org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest) {
+ org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter requestAdapter =
+ ((org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest) request)
+ .getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
+ return (org.eclipse.gmf.runtime.emf.type.core.IElementType) requestAdapter.getAdapter(
+ org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
+ }
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedClassComment»
+ protected org.eclipse.gef.commands.Command getConnectionWithReorientedViewCompleteCommand(
+ org.eclipse.gef.requests.CreateConnectionRequest request) {
+ org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy c =
+ (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) super.getConnectionCompleteCommand(request);
+ org.eclipse.gmf.runtime.common.core.command.CompositeCommand cc =
+ (org.eclipse.gmf.runtime.common.core.command.CompositeCommand) c.getICommand();
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
+ ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
+ «getDiagram().getReorientConnectionViewCommandQualifiedClassName()» rcvCommand =
+ new «getDiagram().getReorientConnectionViewCommandQualifiedClassName()»(editingDomain, null);
+ rcvCommand.setEdgeAdaptor(getViewAdapter());
+ cc.compose(rcvCommand);
+ return c;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»

Back to the top