Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkEditPart.xpt')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkEditPart.xpt145
1 files changed, 145 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkEditPart.xpt
new file mode 100644
index 000000000..38c9fdd8e
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkEditPart.xpt
@@ -0,0 +1,145 @@
+/*
+ * 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
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE _constructor FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenLink-»
+ super.createDefaultEditPolicies();
+ «IF null = modelFacet-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy());
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
+«ENDDEFINE»
+
+«DEFINE addFixedChild FOR gmfgen::GenLink-»
+ «IF labels->size() > 0-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
+ «FOREACH labels->asSequence() AS label-»
+ «EXPAND addLabel(label) FOR label.viewmap-»
+ «ENDFOREACH-»
+ return false;
+ }
+ «ENDIF»
+«ENDDEFINE»
+
+«DEFINE addLabel(label : gmfgen::GenLinkLabel) FOR gmfgen::Viewmap-»
+«ENDDEFINE»
+
+«DEFINE addLabel(label : gmfgen::GenLinkLabel) FOR gmfgen::ParentAssignedViewmap-»
+ if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
+ ((«label.getEditPartQualifiedClassName()») childEditPart).«EXPAND impl::diagram::editparts::TextAware::labelSetterName»(
+ getPrimaryShape().«getterName»());
+ return true;
+ }
+«ENDDEFINE»
+
+«DEFINE removeFixedChild FOR gmfgen::GenLink-»
+ «IF labels->size() > 0-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
+ «FOREACH labels->asSequence() AS label-»
+ «EXPAND removeLabel(label) FOR label.viewmap-»
+ «ENDFOREACH-»
+ return false;
+ }
+ «ENDIF»
+«ENDDEFINE»
+
+«DEFINE removeLabel(label : gmfgen::GenLinkLabel) FOR gmfgen::Viewmap-»
+«ENDDEFINE»
+
+«DEFINE removeLabel(label : gmfgen::GenLinkLabel) FOR gmfgen::ParentAssignedViewmap-»
+ if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
+ return true;
+ }
+«ENDDEFINE»
+
+«DEFINE addChildVisual FOR gmfgen::GenLink-»
+ «IF labels->size() > 0-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+ «ENDIF»
+«ENDDEFINE»
+
+«DEFINE removeChildVisual FOR gmfgen::GenLink-»
+ «IF labels->size() > 0-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+ «ENDIF»
+«ENDDEFINE»
+
+«DEFINE createLinkFigure FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment(
+ 'Creates figure for this edit part.
+
+Body of this method does not depend on settings in generation model
+so you may safely remove <i>generated</i> tag and modify it.
+'
+ )»
+ «EXPAND createLinkFigure(self) FOR viewmap-»
+«ENDDEFINE»
+
+«DEFINE createLinkFigure(link : gmfgen::GenLink) FOR gmfgen::Viewmap-»
+ «ERROR 'Unknown viewmap: ' + self.repr()-»
+«ENDDEFINE»
+
+«DEFINE createLinkFigure(link : gmfgen::GenLink) FOR gmfgen::FigureViewmap-»
+ «LET (if figureQualifiedClassName = null then 'org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx' else figureQualifiedClassName endif) AS fqn-»
+ protected org.eclipse.draw2d.Connection createConnectionFigure() {
+ return new «fqn»();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «fqn» getPrimaryShape() {
+ return («fqn») getFigure();
+ }
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE createLinkFigure(link : gmfgen::GenLink) FOR gmfgen::SnippetViewmap»
+ protected org.eclipse.draw2d.Connection createConnectionFigure() {
+ return «body»;
+ }
+«ENDDEFINE»
+
+«DEFINE createLinkFigure(link : gmfgen::GenLink) FOR gmfgen::InnerClassViewmap»
+ protected org.eclipse.draw2d.Connection createConnectionFigure() {
+ return new «className»();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «className» getPrimaryShape() {
+ return («className») getFigure();
+ }
+
+ «classBody»
+«ENDDEFINE» \ No newline at end of file

Back to the top