Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/ChildNodeLabelEditPart.xpt43
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/CompartmentEditPart.xpt128
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/DiagramEditPart.xpt96
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt68
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkEditPart.xpt145
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkLabelEditPart.xpt61
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt581
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeLabelEditPart.xpt70
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/TextAware.xpt537
9 files changed, 1729 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/ChildNodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/ChildNodeLabelEditPart.xpt
new file mode 100644
index 000000000..a1c0d643f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/ChildNodeLabelEditPart.xpt
@@ -0,0 +1,43 @@
+/*
+ * 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 contsructor FOR gmfgen::GenChildLabelNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE getDragTrackerBody FOR gmfgen::GenChildLabelNode-»
+ if (request instanceof org.eclipse.gef.requests.SelectionRequest && ((org.eclipse.gef.requests.SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx(this);
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenChildLabelNode-»
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «getItemSemanticEditPolicyQualifiedClassName()»());
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new «getDiagram().getTextNonResizableEditPolicyQualifiedClassName()»());
+ installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy());
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenChildLabelNode-»
+ Object feature = event.getFeature();
+ «EXPAND xpt::diagram::editparts::Common::handleText FOR self-»
+ super.handleNotificationEvent(event);
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/CompartmentEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/CompartmentEditPart.xpt
new file mode 100644
index 000000000..e1bec33bb
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/CompartmentEditPart.xpt
@@ -0,0 +1,128 @@
+/*
+ * 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'»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE contsructor FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE hasModelChildrenChanged FOR gmfgen::GenCompartment-»
+ «IF listLayout-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean hasModelChildrenChanged(org.eclipse.emf.common.notify.Notification evt) {
+ return false;
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getCompartmentName FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getCompartmentName() {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCompartmentTitle(self)) FOR getDiagram().editorGen»;
+ }
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenCompartment-»
+ «IF not needsTitle-»
+ «REM»By default titles are shown even if there are no TitleStyle, we need to switch it off«ENDREM»«-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure result = (org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenCompartment-»
+ super.createDefaultEditPolicies();
+ «IF canCollapse-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy());
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
+ «IF childNodes->size() > 0-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy());
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
+ «EXPAND xpt::diagram::editparts::Common::behaviour-»
+«ENDDEFINE»
+
+«DEFINE refreshVisuals FOR gmfgen::GenCompartment-»
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenCompartment-»
+ super.handleNotificationEvent(notification);
+ Object feature = notification.getFeature();
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+«ENDDEFINE»
+
+«DEFINE refreshBounds FOR gmfgen::GenCompartment-»
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshBounds() {
+ int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setRatio FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setRatio(Double ratio) {
+ «IF gmfgen::ViewmapLayoutType::UNKNOWN = node.getLayoutType()-»
+ if (getFigure().getParent().getLayoutManager() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ «ELSE-»
+ // nothing to do -- parent layout does not accept Double constraints as ratio
+ // super.setRatio(ratio);
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND internal_i18nAccessors FOREACH compartments»
+«ENDDEFINE»
+
+«DEFINE internal_i18nAccessors FOR gmfgen::GenCompartment-»
+«IF null <> title»«EXPAND xpt::Externalizer::accessorField(i18nKeyForCompartmentTitle(self))»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND internal_i18nValues FOREACH compartments»
+«ENDDEFINE»
+
+«DEFINE internal_i18nValues FOR gmfgen::GenCompartment-»
+«IF null <> title»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCompartmentTitle(self), title)»«ENDIF-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/DiagramEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/DiagramEditPart.xpt
new file mode 100644
index 000000000..f3db47549
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/DiagramEditPart.xpt
@@ -0,0 +1,96 @@
+/*
+ * 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'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE _constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenDiagram-»
+ super.createDefaultEditPolicies();
+ «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
+ «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
+ «IF generateCreateShortcutAction() and null = editorGen.application-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy() {
+ public org.eclipse.gef.commands.Command getDropObjectsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest) {
+ java.util.List viewDescriptors = new java.util.ArrayList();
+ for (java.util.Iterator it = dropRequest.getObjects().iterator(); it.hasNext();) {
+ Object nextObject = it.next();
+ if (false == nextObject instanceof org.eclipse.emf.ecore.EObject) {
+ continue;
+ }
+ viewDescriptors.add(new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter((org.eclipse.emf.ecore.EObject) nextObject), org.eclipse.gmf.runtime.notation.Node.class, null, getDiagramPreferencesHint()));
+ }
+ return createShortcutsCommand(dropRequest, viewDescriptors);
+ }
+
+ private org.eclipse.gef.commands.Command createShortcutsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest, java.util.List viewDescriptors) {
+ org.eclipse.gef.commands.Command command = createViewsAndArrangeCommand(dropRequest, viewDescriptors);
+ if (command != null) {
+ return command.chain(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new «getCreateShortcutDecorationsCommandQualifiedClassName()»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors)));
+ }
+ return null;
+ }
+ });
+ «ENDIF-»
+ «IF shouldGenerateDiagramViewmap(self)-»
+ // diagram figure does layout; need to install child editpolicy to show selection feedback
+ installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new org.eclipse.gef.editpolicies.LayoutEditPolicy() {
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ final org.eclipse.gef.editpolicies.NonResizableEditPolicy p = new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
+ p.setDragAllowed(false);
+ return p;
+ }
+ protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
+ return null;
+ }
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+ return null;
+ }
+ });
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenDiagram-»
+ «IF shouldGenerateDiagramViewmap(self)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.draw2d.FreeformLayer l = new org.eclipse.draw2d.FreeformLayer();
+ l.setBorder(new org.eclipse.draw2d.MarginBorder(50));
+ «EXPAND initLayout('lm') FOR viewmap.layoutType-»
+ l.setLayoutManager(lm);
+ return l;
+ }
+ «ENDIF»
+«ENDDEFINE»
+
+«DEFINE initLayout(varName : String) FOR gmfgen::ViewmapLayoutType-»
+ «IF self = gmfgen::ViewmapLayoutType::TOOLBAR_LAYOUT-»
+ org.eclipse.draw2d.ToolbarLayout «varName» = new org.eclipse.draw2d.ToolbarLayout();
+ «varName».setSpacing(10);
+ «ELSEIF self = gmfgen::ViewmapLayoutType::FLOW_LAYOUT-»
+ org.eclipse.draw2d.FlowLayout «varName» = new org.eclipse.draw2d.FlowLayout();
+ «varName».setMajorSpacing(10);
+ «varName».setMinorSpacing(10);
+ «ELSE-»
+ org.eclipse.draw2d.LayoutManager «varName» = null; /*FIXME - unknown layout type*/
+ «ENDIF-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt
new file mode 100644
index 000000000..e11749519
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt
@@ -0,0 +1,68 @@
+/*
+ * 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
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE initializer FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static {
+ registerSnapBackPosition(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall», new org.eclipse.draw2d.geometry.Point(0, 0));
+ }
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenExternalNodeLabel-»
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»());
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
+«ENDDEFINE»
+
+«DEFINE getBorderItemLocator FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator getBorderItemLocator() {
+ org.eclipse.draw2d.IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE refreshBounds FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void refreshBounds() {
+ int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenExternalNodeLabel-»
+ Object feature = event.getFeature();
+ «EXPAND xpt::diagram::editparts::Common::handleText FOR self-»
+ super.handleNotificationEvent(event);
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
+«ENDDEFINE» \ No newline at end of file
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
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkLabelEditPart.xpt
new file mode 100644
index 000000000..a5502e08e
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/LinkLabelEditPart.xpt
@@ -0,0 +1,61 @@
+/*
+ * 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
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE initializer FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static {
+ registerSnapBackPosition(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»,
+ new org.eclipse.draw2d.geometry.Point(«labelOffsetX(viewmap, 0)», «labelOffsetY(viewmap, 0)»));
+ }
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenLinkLabel-»
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE,
+ new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE,
+ new «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»());
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE,
+ new org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy() {
+
+ protected java.util.List createSelectionHandles() {
+ org.eclipse.gef.handles.MoveHandle mh = new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return java.util.Collections.singletonList(mh);
+ }
+ });
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
+«ENDDEFINE»
+
+«DEFINE getKeyPoint FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public int getKeyPoint() {
+ return org.eclipse.draw2d.ConnectionLocator.«alignment»;
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenLinkLabel-»
+ Object feature = event.getFeature();
+ «EXPAND xpt::diagram::editparts::Common::handleText FOR self-»
+ super.handleNotificationEvent(event);
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt
new file mode 100644
index 000000000..a204dfc6b
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt
@@ -0,0 +1,581 @@
+/*
+ * 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
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE extendsListContents FOR gmfgen::GenNode-»
+«IF hasBorderItems(self)»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE extendsListContents FOR gmfgen::GenChildSideAffixedNode-»
+«IF hasBorderItems(self)»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenNode-»
+ «EXPAND installCreationRolePolicy-»
+ super.createDefaultEditPolicies();
+ «EXPAND installPrimaryDragEditPolicy-»
+ «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
+ «IF needsGraphicalNodeEditPolicy(self)-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new «getGraphicalNodeEditPolicyQualifiedClassName()»());
+ «ENDIF-»
+ «IF not childNodes->isEmpty()-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+«ENDDEFINE»
+
+«DEFINE installCreationRolePolicy FOR gmfgen::GenNode-»
+«IF hasChildren(self) or hasChildrenInListCompartments(self)-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, «EXPAND _creationEditPolicyNewInstance»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE _creationEditPolicyNewInstance FOR gmfgen::GenNode»new org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy()«ENDDEFINE»
+
+«DEFINE installPrimaryDragEditPolicy FOR gmfgen::GenNode»«ENDDEFINE»
+
+«DEFINE installPrimaryDragEditPolicy FOR gmfgen::GenChildSideAffixedNode-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
+«ENDDEFINE»
+
+«DEFINE createLayoutEditPolicy FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gef.editpolicies.LayoutEditPolicy createLayoutEditPolicy() {
+ «EXPAND createLayoutEditPolicyBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE createLayoutEditPolicyBody FOR gmfgen::GenNode-»
+ «IF gmfgen::ViewmapLayoutType::XY_LAYOUT = getLayoutType()-»
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy() {
+
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «EXPAND borderItemSelectionEditPolicy-»
+ org.eclipse.gef.EditPolicy result = super.createChildEditPolicy(child);
+ if (result == null) {
+ return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy();
+ }
+ return result;
+ }
+ };
+ return lep;
+ «ELSEIF gmfgen::ViewmapLayoutType::TOOLBAR_LAYOUT = getLayoutType()»
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy() {
+
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «EXPAND borderItemSelectionEditPolicy-»
+ if (child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart) {
+ return new «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ «ELSEIF gmfgen::ViewmapLayoutType::FLOW_LAYOUT = getLayoutType()»
+ org.eclipse.gef.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gef.editpolicies.FlowLayoutEditPolicy() {
+
+ «IF hasBorderItems(self)-»
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «EXPAND borderItemSelectionEditPolicy-»
+ return super.createChildEditPolicy(child);
+ }
+ «ENDIF-»
+
+ protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
+ return null;
+ }
+
+ protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
+ return null;
+ }
+
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ «ELSE-»
+ org.eclipse.gef.editpolicies.LayoutEditPolicy lep = new org.eclipse.gef.editpolicies.LayoutEditPolicy() {
+
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «EXPAND borderItemSelectionEditPolicy-»
+ org.eclipse.gef.EditPolicy result = child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
+ return null;
+ }
+
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE borderItemSelectionEditPolicy FOR gmfgen::GenNode-»
+«IF hasBorderItems(self)-»
+org.eclipse.gmf.runtime.notation.View childView = (org.eclipse.gmf.runtime.notation.View) child.getModel();
+switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(childView)) {
+«IF getExternalLabels(self)->size() > 0-»
+«FOREACH getExternalLabels(self) AS nextLabel-»
+«EXPAND xpt::Common::caseVisualID FOR nextLabel-»
+«ENDFOREACH-»
+ return «EXPAND borderItemSelectionEP»;
+«ENDIF-»
+«IF getSideAffixedChildren(self)->size() > 0-»
+«FOREACH getSideAffixedChildren(self) AS nextBorderItem-»
+«EXPAND xpt::Common::caseVisualID FOR nextBorderItem-»
+«ENDFOREACH-»
+ return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy();
+«ENDIF-»
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE borderItemSelectionEP FOR gmfgen::GenNode-»
+new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy() {
+
+ protected java.util.List createSelectionHandles() {
+ org.eclipse.gef.handles.MoveHandle mh = new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
+ mh.setBorder(null);
+ return java.util.Collections.singletonList(mh);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE createNodeShape(node : gmfgen::GenNode) FOR gmfgen::Viewmap-»
+ «ERROR 'Unknown viewmap: ' + self.repr()-»
+«ENDDEFINE»
+
+«DEFINE createNodeShape(node : gmfgen::GenNode) FOR gmfgen::FigureViewmap-»
+ «LET (if figureQualifiedClassName = null then 'org.eclipse.draw2d.RectangleFigure' else figureQualifiedClassName endif) AS fqn-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createNodeShape() {
+ return primaryShape = new «fqn»()«IF node.getLayoutType() = gmfgen::ViewmapLayoutType::XY_LAYOUT»{
+ protected boolean useLocalCoordinates() {
+ return true;
+ }
+ }«ENDIF»;
+ }
+
+ «EXPAND getPrimaryShapeMethod FOR fqn-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE createNodeShape(node : gmfgen::GenNode) FOR gmfgen::SnippetViewmap-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createNodeShape() {
+ return «body»;
+ }
+«ENDDEFINE»
+
+«DEFINE createNodeShape(node : gmfgen::GenNode) FOR gmfgen::InnerClassViewmap-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createNodeShape() {
+ «className» figure = new «className»();
+ «IF node.childNodes->size() > 0 and node.getLayoutType() = gmfgen::ViewmapLayoutType::XY_LAYOUT-»
+ figure.setUseLocalCoordinates(true);
+ «ENDIF-»
+ return primaryShape = figure;
+ }
+
+ «EXPAND getPrimaryShapeMethod FOR className-»
+«ENDDEFINE»
+
+«DEFINE getPrimaryShapeMethod FOR String-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «self» getPrimaryShape() {
+ return («self») primaryShape;
+ }
+«ENDDEFINE»
+
+«DEFINE addFixedChild FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
+«FOREACH getInnerFixedLabels(self) AS label»«LET label.viewmap.oclAsType(gmfgen::ParentAssignedViewmap) AS childViewmap-»
+ if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
+ ((«label.getEditPartQualifiedClassName()») childEditPart).«EXPAND impl::diagram::editparts::TextAware::labelSetterName FOR childViewmap»(getPrimaryShape().«childViewmap.getterName»());
+ return true;
+ }
+«ENDLET»«ENDFOREACH-»
+«FOREACH getPinnedCompartments(self) AS compartment»«LET compartment.viewmap.oclAsType(gmfgen::ParentAssignedViewmap) AS childViewmap-»
+ if (childEditPart instanceof «compartment.getEditPartQualifiedClassName()») {
+ org.eclipse.draw2d.IFigure pane = getPrimaryShape().«childViewmap.getterName»();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure());
+ return true;
+ }
+«ENDLET»«ENDFOREACH-»
+«FOREACH getSideAffixedChildren(self) AS child-»
+ if (childEditPart instanceof «child.getEditPartQualifiedClassName()») {
+ org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»);
+ getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator);
+ return true;
+ }
+«ENDFOREACH-»
+ return false;
+ }
+«ENDDEFINE»
+
+«DEFINE removeFixedChild FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
+«FOREACH getInnerFixedLabels(self) AS label»«LET label.viewmap.oclAsType(gmfgen::ParentAssignedViewmap) AS childViewmap-»
+ if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
+ return true;
+ }
+«ENDLET»«ENDFOREACH-»
+«FOREACH getPinnedCompartments(self) AS compartment»«LET compartment.viewmap.oclAsType(gmfgen::ParentAssignedViewmap) AS childViewmap-»
+ if (childEditPart instanceof «compartment.getEditPartQualifiedClassName()») {
+ org.eclipse.draw2d.IFigure pane = getPrimaryShape().«childViewmap.getterName»();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure());
+ return true;
+ }
+«ENDLET»«ENDFOREACH-»
+«FOREACH getSideAffixedChildren(self) AS child-»
+ if (childEditPart instanceof «child.getEditPartQualifiedClassName()») {
+ getBorderedFigure().getBorderItemContainer().remove(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure());
+ return true;
+ }
+«ENDFOREACH-»
+ return false;
+ }
+«ENDDEFINE»
+
+«DEFINE addChildVisual FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+«ENDDEFINE»
+
+«DEFINE removeChildVisual FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)){
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+«ENDDEFINE»
+
+«DEFINE getContentPaneFor FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure getContentPaneFor(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart) {
+ «REM»it is unclear what we should return for labels here«ENDREM-»
+«FOREACH getPinnedCompartments(self) AS compartment»«LET compartment.viewmap.oclAsType(gmfgen::ParentAssignedViewmap) AS childViewmap-»
+ if (editPart instanceof «compartment.getEditPartQualifiedClassName()») {
+ return getPrimaryShape().«childViewmap.getterName»();
+ }
+«ENDLET»«ENDFOREACH-»
+«IF hasBorderItems(self)-»
+ if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+«ENDIF-»
+ return getContentPane();
+ }
+«ENDDEFINE»
+
+«DEFINE addBorderItem FOR gmfgen::GenNode-»
+ «IF getExternalLabels(self)->size() > 0-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addBorderItem(org.eclipse.draw2d.IFigure borderItemContainer, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart borderItemEditPart) {
+ if («FOREACH getExternalLabels(self) AS label SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOREACH») {
+ org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new org.eclipse.draw2d.geometry.Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createNodePlate FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
+ org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result =
+ new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»));
+ «EXPAND setupNodePlate-»
+ return result;
+ }
+«ENDDEFINE»
+
+«DEFINE setupNodePlate FOR gmfgen::GenNode»«ENDDEFINE»
+
+«DEFINE setupNodePlate FOR gmfgen::GenChildSideAffixedNode»
+ //FIXME: workaround for #154536
+ result.getBounds().setSize(result.getPreferredSize());
+«ENDDEFINE»
+
+«DEFINE getPrimaryDragEditPolicy FOR gmfgen::GenNode-»
+ «LET getResizeConstraints(viewmap) AS rc-»
+ «IF null <> primaryDragEditPolicyQualifiedClassName or null <> rc-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.EditPolicy getPrimaryDragEditPolicy() {
+ «IF null <> primaryDragEditPolicyQualifiedClassName-»
+ return new «primaryDragEditPolicyQualifiedClassName»();
+ «ELSE-»
+ org.eclipse.gef.EditPolicy result = super.getPrimaryDragEditPolicy();
+ if (result instanceof org.eclipse.gef.editpolicies.ResizableEditPolicy) {
+ org.eclipse.gef.editpolicies.ResizableEditPolicy ep = (org.eclipse.gef.editpolicies.ResizableEditPolicy) result;
+ ep.setResizeDirections(
+ «IF rc.resizeHandleNames->size() > 0-»
+ «FOREACH rc.resizeHandleNames->asSequence() AS name SEPARATOR ' | '»org.eclipse.draw2d.PositionConstants.«name»«ENDFOREACH-»
+ «ELSE»org.eclipse.draw2d.PositionConstants.NONE«ENDIF»);
+ }
+ return result;
+ «ENDIF-»
+ }
+ «ENDIF-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenNode-»
+ «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.
+'
+ )»
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure create«IF hasBorderItems(self)»Main«ELSE»Node«ENDIF»Figure() {
+ org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new org.eclipse.draw2d.StackLayout());
+ org.eclipse.draw2d.IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+«ENDDEFINE»
+
+«DEFINE setupContentPane FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment(
+ 'Default implementation treats passed figure as content pane.
+Respects layout one may have set for generated figure.
+@param nodeShape instance of generated figure class'
+ )»
+ protected org.eclipse.draw2d.IFigure setupContentPane(org.eclipse.draw2d.IFigure nodeShape) {
+ «IF not childNodes->isEmpty() or (not compartments->isEmpty() or not labels->-((labels)[gmfgen::GenExternalNodeLabel])->isEmpty())-»
+ if (nodeShape.getLayoutManager() == null) {
+ «IF getLayoutType() = gmfgen::ViewmapLayoutType::XY_LAYOUT-»
+ nodeShape.setLayoutManager(new org.eclipse.draw2d.FreeformLayout() {
+
+ public Object getConstraint(org.eclipse.draw2d.IFigure figure) {
+ Object result = constraints.get(figure);
+ if (result == null) {
+ result = new org.eclipse.draw2d.geometry.Rectangle(0, 0, -1, -1);
+ }
+ return result;
+ }
+ });
+ «ELSE-»
+ org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout layout =new org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ «ENDIF-»
+ }
+ «ENDIF-»
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+«ENDDEFINE»
+
+«DEFINE getContentPane FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.draw2d.IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+«ENDDEFINE»
+
+«DEFINE setForegroundColor FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setForegroundColor(org.eclipse.swt.graphics.Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setBackgroundColor FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setBackgroundColor(org.eclipse.swt.graphics.Color color) {
+ if (primaryShape != null) {
+ primaryShape.setBackgroundColor(color);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setLineWidth FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setLineWidth(int width) {
+ if (primaryShape instanceof org.eclipse.draw2d.Shape) {
+ ((org.eclipse.draw2d.Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setLineStyle FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setLineType(int style) {
+ if (primaryShape instanceof org.eclipse.draw2d.Shape) {
+ ((org.eclipse.draw2d.Shape) primaryShape).setLineStyle(style);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getPrimaryChildEditPart FOR gmfgen::GenNode-»
+ «IF not labels->isEmpty()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR labels->first().oclAsType(gmfgen::GenLabel)»);
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+// pre: getAssistantOutgoingLinks(this).size() > 0
+«DEFINE getMARelTypesOnSource FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMARelTypesOnSource() {
+ java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
+ «FOREACH getAssistantOutgoingLinks(self) AS link-»
+ types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
+ «ENDFOREACH-»
+ return types;
+ }
+«ENDDEFINE»
+
+// pre: getAssistantIncomingLinks(this).size() > 0
+«DEFINE getMARelTypesOnTarget FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMARelTypesOnTarget() {
+ java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
+ «FOREACH getAssistantIncomingLinks(self) AS link-»
+ types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
+ «ENDFOREACH-»
+ return types;
+ }
+«ENDDEFINE»
+
+// pre: getAssistantOutgoingLinks(this).size() > 0
+«DEFINE getMARelTypesOnSourceAndTarget FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMARelTypesOnSourceAndTarget(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart) {
+ java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
+ «FOREACH getAssistantOutgoingLinks(self) AS link-»
+ «FOREACH selectGenNodes(link.targets->asSequence()) AS target-»
+ if (targetEditPart instanceof «target.getEditPartQualifiedClassName()») {
+ types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
+ }
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ return types;
+ }
+«ENDDEFINE»
+
+// pre: getAssistantIncomingLinks(this).size() > 0
+«DEFINE getMATypesForSource FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMATypesForSource(org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
+ java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
+ «FOREACH getAssistantIncomingLinks(self) AS link-»
+ «FOREACH selectGenNodes(link.sources->asSequence()) AS source-»
+ if (relationshipType == «EXPAND xpt::providers::ElementTypes::accessElementType FOR link») {
+ types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR source»);
+ }
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ return types;
+ }
+«ENDDEFINE»
+
+// pre: getAssistantOutgoingLinks(this).size() > 0
+«DEFINE getMATypesForTarget FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMATypesForTarget(org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
+ java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
+ «FOREACH getAssistantOutgoingLinks(self) AS link-»
+ «FOREACH (link.targets)[gmfgen::GenNode]->asSequence() AS target-»
+ if (relationshipType == «EXPAND xpt::providers::ElementTypes::accessElementType FOR link») {
+ types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR target»);
+ }
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ return types;
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenTopLevelNode-»
+ if (event.getNotifier() == getModel() && org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
+ handleMajorSemanticChange();
+ } else {
+ super.handleNotificationEvent(event);
+ }
+«ENDDEFINE»
+
+«DEFINE innerClassDeclaration FOR gmfgen::Viewmap»
+«ENDDEFINE»
+
+«DEFINE innerClassDeclaration FOR gmfgen::InnerClassViewmap»
+ «classBody»
+«ENDDEFINE»
+
+«DEFINE getTargetEditPartMethod FOR gmfgen::GenNode»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.EditPart getTargetEditPart(org.eclipse.gef.Request request) {
+ if (request instanceof org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) {
+ org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter adapter = ((org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ org.eclipse.gmf.runtime.emf.type.core.IElementType type = (org.eclipse.gmf.runtime.emf.type.core.IElementType) adapter.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
+«FOREACH compartments->asSequence() AS compartment-»
+ «IF listCompartmentHasChildren(compartment)-»
+ «FOREACH compartment.childNodes->asSequence() AS childNode-»
+ if (type == «EXPAND xpt::providers::ElementTypes::accessElementType FOR childNode») {
+ return getChildBySemanticHint(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR compartment»);
+ }
+ «ENDFOREACH-»
+ «ENDIF-»
+«ENDFOREACH-»
+ }
+ return super.getTargetEditPart(request);
+ }
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeLabelEditPart.xpt
new file mode 100644
index 000000000..1fa3d0160
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeLabelEditPart.xpt
@@ -0,0 +1,70 @@
+/*
+ * 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
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE _constructor FOR gmfgen::GenNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenNodeLabel-»
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»());
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gef.editpolicies.NonResizableEditPolicy() {
+
+ protected java.util.List createSelectionHandles() {
+ java.util.List handles = new java.util.ArrayList();
+ org.eclipse.gef.handles.NonResizableHandleKit.addMoveHandle((org.eclipse.gef.GraphicalEditPart) getHost(), handles);
+ ((org.eclipse.gef.handles.MoveHandle) handles.get(0)).setBorder(null);
+ return handles;
+ }
+
+ public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(org.eclipse.gef.Request request) {
+ return false;
+ }
+ });
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
+«ENDDEFINE»
+
+«DEFINE refreshBounds FOR gmfgen::GenNodeLabel-»
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshBounds() {
+ int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ org.eclipse.draw2d.geometry.Dimension size = new org.eclipse.draw2d.geometry.Dimension(width, height);
+ int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ org.eclipse.draw2d.geometry.Point loc = new org.eclipse.draw2d.geometry.Point(x, y);
+ ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new org.eclipse.draw2d.geometry.Rectangle(loc, size));
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenNodeLabel-»
+ Object feature = event.getFeature();
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::diagram::editparts::Common::handleBounds FOR self-»
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::handleText FOR self-»
+ super.handleNotificationEvent(event);
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/TextAware.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/TextAware.xpt
new file mode 100644
index 000000000..ce1172f91
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/TextAware.xpt
@@ -0,0 +1,537 @@
+/*
+ * 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
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE fields FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gef.tools.DirectEditManager manager;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.util.List parserElements;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String defaultText;
+«ENDDEFINE»
+
+«DEFINE methods(needsRefreshBounds : Boolean, readOnly : Boolean, useElementIcon : Boolean, viewmap : gmfgen::Viewmap,
+ modelFacet : gmfgen::LabelModelFacet, host : gmfgen::GenCommonBase, diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND getLabelTextHelper-»
+
+ «EXPAND setLabelTextHelper-»
+
+ «EXPAND getLabelIconHelper-»
+
+ «EXPAND setLabelIconHelper-»
+
+ «EXPAND labelSetter-»
+
+ «EXPAND getModelChildren-»
+
+ «EXPAND getChildBySemanticHint-»
+
+ «EXPAND getParserElement(modelFacet)-»
+
+ «EXPAND getLabelIcon(useElementIcon, diagram)-»
+
+ «EXPAND getLabelText-»
+
+ «EXPAND setLabelText(diagram)-»
+
+ «EXPAND getEditText-»
+
+ «EXPAND isEditable(readOnly)-»
+
+ «EXPAND getEditTextValidator-»
+
+ «EXPAND getCompletionProcessor-»
+
+ «EXPAND getParserOptions-»
+
+ «EXPAND getParser(modelFacet, diagram, host)-»
+
+ «EXPAND getManager(diagram)-»
+
+ «EXPAND setManager-»
+
+ «EXPAND performDirectEdit-»
+
+ «EXPAND performDirectEditAtPoint-»
+
+ «EXPAND performDirectEditWithInitialChar-»
+
+ «EXPAND performDirectEditRequest-»
+
+ «EXPAND refreshVisuals(needsRefreshBounds)-»
+
+ «EXPAND refreshLabel(diagram)-»
+
+ «EXPAND refreshUnderline-»
+
+ «EXPAND refreshStrikeThrough-»
+
+ «EXPAND refreshFont-»
+
+ «EXPAND setFontColor-»
+
+ «EXPAND addSemanticListeners-»
+
+ «EXPAND removeSemanticListeners-»
+
+ «EXPAND getAccessibleEditPart-»
+
+ «EXPAND getFontStyleOwnerView(viewmap)-»
+«ENDDEFINE»
+
+«DEFINE labelSetterName FOR gmfgen::ParentAssignedViewmap-»
+«IF setterName <> null»«setterName»«ELSE»setLabel«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE labelSetterName FOR gmfgen::Viewmap»setLabel«ENDDEFINE»
+
+«DEFINE getLabelTextHelper FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText();
+ } else {
+ return ((org.eclipse.draw2d.Label) figure).getText();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setLabelTextHelper FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text);
+ } else {
+ ((org.eclipse.draw2d.Label) figure).setText(text);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getLabelIconHelper FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon();
+ } else {
+ return ((org.eclipse.draw2d.Label) figure).getIcon();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setLabelIconHelper FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((org.eclipse.draw2d.Label) figure).setIcon(icon);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE labelSetter FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void «EXPAND labelSetterName FOR viewmap»(«EXPAND labelSetterFigureClassName FOR viewmap» figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+«ENDDEFINE»
+
+«DEFINE labelSetterFigureClassName FOR gmfgen::ParentAssignedViewmap-»
+ «IF figureQualifiedClassName <> null-»
+ «figureQualifiedClassName»
+ «ELSE-»
+ org.eclipse.draw2d.IFigure
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE labelSetterFigureClassName FOR gmfgen::Viewmap-»
+ org.eclipse.draw2d.IFigure
+«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List getModelChildren() {
+ return java.util.Collections.EMPTY_LIST;
+ }
+«ENDDEFINE»
+
+«DEFINE getChildBySemanticHint FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE getParserElement(modelFacet : gmfgen::LabelModelFacet) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.EObject getParserElement() {
+«IF modelFacet = null»
+ org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
+ return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel();
+«ELSE»«EXPAND getParserElement FOR modelFacet»«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE getParserElement FOR gmfgen::LabelModelFacet-»
+ return resolveSemanticElement();
+«ENDDEFINE»
+
+«DEFINE getParserElement FOR gmfgen::DesignLabelModelFacet-»
+ return (org.eclipse.gmf.runtime.notation.View) getModel();
+«ENDDEFINE»
+
+«DEFINE getLabelIcon(useElementIcon : Boolean, diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.swt.graphics.Image getLabelIcon() {
+ «IF useElementIcon-»
+ org.eclipse.emf.ecore.EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return «diagram.getElementTypesQualifiedClassName()».getImage(parserElement.eClass());
+ «ELSE-»
+ return null;
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE getLabelText FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getLabelText() {
+ String text = null;
+ org.eclipse.emf.ecore.EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(parserElement),
+ getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+«ENDDEFINE»
+
+«DEFINE setLabelText(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getEditText FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; «EXPAND xpt::Common::nonNLS»
+ }
+ return getParser().getEditString(
+ new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+«ENDDEFINE»
+
+«DEFINE isEditable(readOnly : Boolean) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean isEditable() {
+ «IF readOnly-»
+ return false;
+ «ELSE-»
+ return getParser() != null;
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE getEditTextValidator FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
+ return new org.eclipse.jface.viewers.ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final org.eclipse.emf.ecore.EObject element = getParserElement();
+ final org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = getParser();
+ try {
+ org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus valid =
+ (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive(
+ new org.eclipse.emf.transaction.RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+«ENDDEFINE»
+
+«DEFINE getCompletionProcessor FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()));
+ }
+«ENDDEFINE»
+
+«DEFINE getParserOptions FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() {
+ return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE;
+ }
+«ENDDEFINE»
+
+«DEFINE getParser(modelFacet : gmfgen::LabelModelFacet, diagram : gmfgen::GenDiagram, host : gmfgen::GenCommonBase) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() {
+ if (parser == null) {
+ parser = «EXPAND parsers::ParserProvider::accessorCall(host, modelFacet, 'getParserElement()')»;
+ }
+ return parser;
+ }
+«ENDDEFINE»
+
+«DEFINE getManager(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gef.tools.DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager(this,
+ org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.getTextCellEditorClass(this),
+ «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+«ENDDEFINE»
+
+«DEFINE setManager FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) {
+ this.manager = manager;
+ }
+«ENDDEFINE»
+
+«DEFINE performDirectEdit FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+«ENDDEFINE»
+
+«DEFINE performDirectEditAtPoint FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) {
+ if (getManager().getClass() == org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.class) {
+ ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE performDirectEditWithInitialChar FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
+ ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE performDirectEditRequest FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void performDirectEditRequest(org.eclipse.gef.Request request) {
+ final org.eclipse.gef.Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE refreshVisuals(needsRefreshBounds : Boolean) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ «IF needsRefreshBounds-»
+ refreshBounds();
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE refreshLabel(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE refreshUnderline FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshUnderline() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE refreshStrikeThrough FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshStrikeThrough() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE refreshFont FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshFont() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) |
+ (style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setFontColor FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setFontColor(org.eclipse.swt.graphics.Color color) {
+ getFigure().setForegroundColor(color);
+ }
+«ENDDEFINE»
+
+«DEFINE addSemanticListeners FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addSemanticListeners() {
+ if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
+ org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
+ parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «EXPAND xpt::Common::nonNLS»
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE removeSemanticListeners FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); «EXPAND xpt::Common::nonNLS»
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getAccessibleEditPart FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+«ENDDEFINE»
+
+«DEFINE getFontStyleOwnerView(viewmap : gmfgen::Viewmap) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() {
+ «IF isFixedFont(viewmap)-»
+ return (org.eclipse.gmf.runtime.notation.View) getModel();
+ «ELSE-»
+ return getPrimaryView();
+ «ENDIF-»
+ }
+«ENDDEFINE» \ No newline at end of file

Back to the top