diff options
26 files changed, 0 insertions, 4297 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/build.properties b/plugins/developer/org.eclipse.papyrus.def/build.properties index 9858577ebf9..ddc4670e7f4 100644 --- a/plugins/developer/org.eclipse.papyrus.def/build.properties +++ b/plugins/developer/org.eclipse.papyrus.def/build.properties @@ -1,16 +1,11 @@ -source.. = src-gen/,src/ bin.includes = META-INF/,\ .,\ about.html,\ - dynamic-templates3.4/,\ - model/,\ dynamic-templates3.5/,\ - tmp/,\ bin/,\ build.properties src.includes = dynamic-templates3.4/,\ dynamic-templates3.5/,\ - tmp/,\ META-INF/,\ build.properties,\ bin/ diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/diagram/editparts/DiagramEditPart.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/diagram/editparts/DiagramEditPart.xpt deleted file mode 100644 index 2b10807bf0a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/diagram/editparts/DiagramEditPart.xpt +++ /dev/null @@ -1,75 +0,0 @@ -/*
- * 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"»
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»This template has been modify to allow the drag and drop«ENDREM»
-«REM»and install the mecanism of "filters views..." view for subelements«ENDREM»
-
-«AROUND Main FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::DiagramEditPart::constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::DiagramEditPart::createFigure-»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Call the good define additions«ENDREM»
- «EXPAND impl::diagram::editparts::DiagramEditPart::additions-»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-}
-«ENDAROUND»
-
-«DEFINE extendsList FOR gmfgen::GenDiagram»extends org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public final static String MODEL_ID = "«editorGen.modelID»"; «EXPAND xpt::Common::nonNLS»
-
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
-
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM»Call the template to generate means to run the popup menu "Filters views"«ENDREM»
- «EXPAND impl::diagram::editparts::DiagramEditPart::viewResolver FOR this-»
- «REM»END: PapyrusGenCode«ENDREM»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::DiagramEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/diagram/editparts/NodeEditPart.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/diagram/editparts/NodeEditPart.xpt deleted file mode 100644 index fbd883ce56c..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/diagram/editparts/NodeEditPart.xpt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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 - */ - -«REM»DOCUMENTATION: PapyrusGenCode«ENDREM» -«REM»add call template in order to generate handlenotification in order to refresh figure by taking account event«ENDREM» -«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» - -«DEFINE Main FOR gmfgen::GenNode-» -«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-» -package «getDiagram().editPartsPackageName»; - -«EXPAND xpt::Common::generatedClassComment» -public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» { - - «EXPAND attributes-» - - «EXPAND impl::diagram::editparts::NodeEditPart::constructor-» - - «EXPAND createDefaultEditPolicies-» - - «REM»BEGIN: PapyrusGenCode«ENDREM» - «REM»call tamplate to paste code for refresh figure by taking account event«ENDREM» - «EXPAND impl::diagram::editparts::NodeEditPart::specificHandleNotificationEvent-» - «REM»BEGIN: PapyrusGenCode«ENDREM» - - - «EXPAND impl::diagram::editparts::NodeEditPart::createLayoutEditPolicy-» - - «EXPAND impl::diagram::editparts::NodeEditPart::createNodeShape(this) FOR viewmap-» - - «EXPAND impl::diagram::editparts::NodeEditPart::addFixedChild-» - - «EXPAND impl::diagram::editparts::NodeEditPart::removeFixedChild-» - - «EXPAND impl::diagram::editparts::NodeEditPart::addChildVisual-» - - «EXPAND impl::diagram::editparts::NodeEditPart::removeChildVisual-» - - «EXPAND impl::diagram::editparts::NodeEditPart::getContentPaneFor-» - - «EXPAND impl::diagram::editparts::NodeEditPart::addBorderItem-» - - «EXPAND impl::diagram::editparts::NodeEditPart::createNodePlate-» - - «EXPAND impl::diagram::editparts::NodeEditPart::getPrimaryDragEditPolicy-» - - «EXPAND impl::diagram::editparts::NodeEditPart::createFigure-» - - «EXPAND impl::diagram::editparts::NodeEditPart::setupContentPane-» - - «EXPAND impl::diagram::editparts::NodeEditPart::getContentPane-» - - «EXPAND impl::diagram::editparts::NodeEditPart::getPrimaryChildEditPart-» - - «EXPAND handleNotificationEvent-» - - «EXPAND impl::diagram::editparts::NodeEditPart::innerClassDeclaration FOR viewmap-» - - «EXPAND additions-» -} -«ENDDEFINE» - -«DEFINE extendsList FOR gmfgen::GenNode»extends «EXPAND impl::diagram::editparts::NodeEditPart::extendsListContents»«ENDDEFINE» - -«DEFINE implementsList FOR gmfgen::GenNode»«ENDDEFINE» - -«DEFINE attributes FOR gmfgen::GenNode-» - «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-» - - «EXPAND xpt::Common::generatedMemberComment» - protected org.eclipse.draw2d.IFigure contentPane; - - «EXPAND xpt::Common::generatedMemberComment» - protected org.eclipse.draw2d.IFigure primaryShape; -«ENDDEFINE» - -«DEFINE createDefaultEditPolicies FOR gmfgen::GenNode-» - «EXPAND xpt::Common::generatedMemberComment» - protected void createDefaultEditPolicies() { - «EXPAND impl::diagram::editparts::NodeEditPart::createDefaultEditPoliciesBody-» - } -«ENDDEFINE» - -«DEFINE handleNotificationEvent FOR gmfgen::GenNode-» -«ENDDEFINE» - -«DEFINE handleNotificationEvent FOR gmfgen::GenTopLevelNode-» - «REM»This code is important for refreshing shortcut decoration - on adding corresponding annotation to the View instance.«ENDREM» - «IF getDiagram().generateShortcutIcon()-» - «EXPAND xpt::Common::generatedMemberComment» - protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) { - «EXPAND impl::diagram::editparts::NodeEditPart::handleNotificationEventBody-» - } - «ENDIF-» -«ENDDEFINE» - -«DEFINE additions FOR gmfgen::GenNode-» -«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/impl/diagram/editparts/DiagramEditPart.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/impl/diagram/editparts/DiagramEditPart.xpt deleted file mode 100644 index 522c27e355b..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/impl/diagram/editparts/DiagramEditPart.xpt +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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 - */ - - -«REM»DOCUMENTATION: PapyrusGencode«ENDREM» -«REM»This template has been modify to allow the drag and drop«ENDREM» -«REM»and install the mecanism of "filters views..." view for subelements«ENDREM» - -«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-» - «REM»BEGIN: PapyrusGenCode«ENDREM» - «REM»Code to install editpolicy in chage of drag and drop «ENDREM» - installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.papyrus.diagram.common.edit.policies.DiagramDragDropEditPolicy(resolver)); - «REM»END: PapyrusGenCode«ENDREM» - «IF shouldGenerateDiagramViewmap()-» - // 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 this-» - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE); -«ENDDEFINE» - -«DEFINE createFigure FOR gmfgen::GenDiagram-» - «IF shouldGenerateDiagramViewmap()-» - «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(String varName) FOR gmfgen::ViewmapLayoutType-» - «IF value == gmfgen::ViewmapLayoutType::TOOLBAR_LAYOUT.value-» - org.eclipse.draw2d.ToolbarLayout «varName» = new org.eclipse.draw2d.ToolbarLayout(); - «varName».setSpacing(10); - «ELSEIF value == gmfgen::ViewmapLayoutType::FLOW_LAYOUT.value-» - 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» - -«REM»BEGIN: PapyrusGenCode«ENDREM» -«REM»Code to define the adapter to view Info«ENDREM» -«DEFINE viewResolver FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment-» - private org.eclipse.papyrus.diagram.common.edit.policies.ViewAndFeatureResolver resolver = new org.eclipse.papyrus.diagram.common.edit.policies.ViewAndFeatureResolver() { - - public boolean isEObjectNode(org.eclipse.emf.ecore.EObject element) { - if («editorGen.editor.packageName».«visualIDRegistryClassName».getNodeVisualID(getNotationView(), - element) > -1) { - return true; - } - return false; - } - - public boolean isEObjectLink(org.eclipse.emf.ecore.EObject element) { - if («editorGen.editor.packageName».«visualIDRegistryClassName».getLinkWithClassVisualID(element) > -1) { - return true; - } - return false; - } - - public int getEObjectSemanticHint(org.eclipse.emf.ecore.EObject element) { - if (element != null) { - return «editorGen.editor.packageName».«visualIDRegistryClassName».getNodeVisualID(getNotationView(), - element); - } - return -1; - } - - public org.eclipse.emf.ecore.EStructuralFeature getEStructuralFeatureForEClass(org.eclipse.emf.ecore.EClass class1) { - «FOREACH topLevelNodes AS childNode-» - «EXPAND featureForMetaclass FOR childNode-» - «ENDFOREACH-» - return null; - } - }; -«ENDDEFINE» - -«DEFINE getAdapter FOR gmfgen::GenDiagram» -«EXPAND xpt::Common::generatedMemberComment» - public Object getAdapter(Class adapter) { - if (adapter != null && adapter.equals(org.eclipse.papyrus.diagram.common.edit.policies.ViewAndFeatureResolver.class)) { - return this.resolver; - } - «REM» [ViewInfo] return a ViewInfo with info about the views in this diagram «ENDREM» - if (adapter != null && adapter.equals(org.eclipse.papyrus.diagram.common.providers.ViewInfo.class)) { - return «editorGen.editor.packageName».«visualIDRegistryClassName».getDiagramViewInfo(); - } - return super.getAdapter(adapter); - } -«ENDDEFINE» - -«DEFINE featureForMetaclass FOR gmfgen::GenNode-» - if («EXPAND MetaModel::MetaClass FOR modelFacet.metaClass».equals(class1)) { - return «EXPAND MetaModel::MetaFeature FOR modelFacet.containmentMetaFeature»; - } -«ENDDEFINE» - -«DEFINE additions FOR gmfgen::GenDiagram» -«EXPAND xpt::Common::generatedMemberComment-» - protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) { - «REM»[ViewInfo] to update the diagram when filtering Views by type «ENDREM» - super.handleNotificationEvent(event); - if (event.getNotifier() instanceof org.eclipse.emf.ecore.EAnnotation) { - org.eclipse.emf.ecore.EAnnotation eAnnotation = (org.eclipse.emf.ecore.EAnnotation) event.getNotifier(); - if (eAnnotation.getSource() != null - && eAnnotation.getSource().equals( - org.eclipse.papyrus.diagram.common.util.MDTUtil.FilterViewAndLabelsSource)) { - //modification form MOSKitt approach, canonical policies are not called - org.eclipse.papyrus.diagram.common.util.MDTUtil.filterDiagramViews(this.getDiagramView()); - } - } - } - - «EXPAND getAdapter FOR this» - -«ENDDEFINE» -«REM»END: PapyrusGenCode«ENDREM» diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/impl/diagram/editparts/NodeEditPart.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/impl/diagram/editparts/NodeEditPart.xpt deleted file mode 100644 index f3f2e1fc285..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/impl/diagram/editparts/NodeEditPart.xpt +++ /dev/null @@ -1,668 +0,0 @@ -/*
- * 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
- */
-
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»This template has been modified to take in account the possibility to manage BorderItem«ENDREM»
-«REM»Modifications have been done to: - take in account a specific locator (line 256 and 604)«ENDREM»
-«REM» - add resiable editpolicy on itemBorder element (line 169)«ENDREM»
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-«EXTENSION xpt::diagram::editparts::Utils»
-«EXTENSION xpt::EMFUtils»
-
-
-«DEFINE extendsListContents FOR gmfgen::GenNode-»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Add own eextension«ENDREM»
-«IF getReferencingObjects(this).typeSelect(papyrusgmfgenextension::ExtendedGenNode).select(v | v.superOwnedEditPart!=null).size()!=0»
- «FOREACH getReferencingObjects(this).typeSelect(papyrusgmfgenextension::ExtendedGenNode).select(v | v.superOwnedEditPart!=null) AS extendedObject»
- «EXPAND specifyInheritance FOR extendedObject»
- «ENDFOREACH-»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-«ELSE»
- «IF hasBorderItems()»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart«ENDIF-»
-«ENDIF»
-«ENDDEFINE»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»definition of the inheritance «ENDREM»
-«DEFINE specifyInheritance FOR papyrusgmfgenextension::ExtendedGenNode-»
- «superOwnedEditPart»
-«ENDDEFINE»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-«DEFINE extendsListContents FOR gmfgen::GenChildSideAffixedNode-»
-«IF hasBorderItems()»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»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»CreateGenerator to refresh figure by taking account of event of UML element or graphical element «ENDREM»
-«DEFINE specificHandleNotificationEvent FOR gmfgen::GenNode-»
- «IF getReferencingObjects(this).typeSelect(papyrusgmfgenextension::ExtendedGenNode).size()!=0»
-/**
-*Papyrus codeGen
-*@generated
-**/
-protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- super.handleNotificationEvent(event);
- «FOREACH getReferencingObjects(this).typeSelect(papyrusgmfgenextension::ExtendedGenNode) AS extendedObject»
- «EXPAND specificHandleNotificationEventBody FOR extendedObject.propRefreshHook-»
- «ENDFOREACH-»
- }
- «ENDIF»
-
-«ENDDEFINE»
-
-«DEFINE specificHandleNotificationEventBody FOR papyrusgmfgenextension::PropertyRefreshHook-»
-//«this.comment»
-if (resolveSemanticElement() != null) {
-if(«this.triggeringCondition»){
- «this.action»;
- refreshVisuals();
-}
-}
-«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenNode-»
- «EXPAND installCreationRolePolicy-»
- super.createDefaultEditPolicies();
- «EXPAND installPrimaryDragEditPolicy-»
- «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
- «IF needsGraphicalNodeEditPolicy()-»
- installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new «getGraphicalNodeEditPolicyQualifiedClassName()»());
- «ENDIF-»
- «IF !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 this-»
- // 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() || hasChildrenInListCompartments()-»
- 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.value == getLayoutType().value-»
- 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.value == getLayoutType().value»
- 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.value == getLayoutType().value»
- org.eclipse.gef.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gef.editpolicies.FlowLayoutEditPolicy() {
-
- «IF hasBorderItems()-»
- 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()-»
-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().size() > 0-»
-«FOREACH getExternalLabels() AS nextLabel-»
-«EXPAND xpt::Common::caseVisualID FOR nextLabel-»
-«ENDFOREACH-»
- return «EXPAND borderItemSelectionEP»;
-«ENDIF-»
-«IF getSideAffixedChildren().size() > 0-»
-«FOREACH getSideAffixedChildren() AS nextBorderItem-»
-«EXPAND xpt::Common::caseVisualID FOR nextBorderItem-»
-«ENDFOREACH-»
- «REM»BEGIN PapyrusGenCode«ENDREM»
- «REM»The puprose is to add replace GMF edit prolicy by an new editPolicy that allows to resize BorderItem«ENDREM»
- //done in GMF gen code
- //return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy();
- //done in papyrus gencode to have borderItem resizeable
- return new org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy();
- «REM»END PapyrusGenCode«ENDREM»
-«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(gmfgen::GenNode node) FOR gmfgen::Viewmap-»
- «ERROR "Unknown viewmap: " + this-»
-«ENDDEFINE»
-
-«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::FigureViewmap-»
- «LET figureQualifiedClassName == null ? "org.eclipse.draw2d.RectangleFigure" : figureQualifiedClassName AS fqn-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createNodeShape() {
- return primaryShape = new «fqn»()«IF node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value»{
- protected boolean useLocalCoordinates() {
- return true;
- }
- }«ENDIF»;
- }
-
- «EXPAND getPrimaryShapeMethod FOR fqn-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::SnippetViewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createNodeShape() {
- return «body»;
- }
-«ENDDEFINE»
-
-«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::InnerClassViewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createNodeShape() {
- «className» figure = new «className»();
- «IF node.childNodes.size() > 0 && node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value-»
- figure.setUseLocalCoordinates(true);
- «ENDIF-»
- return primaryShape = figure;
- }
-
- «EXPAND getPrimaryShapeMethod FOR className-»
-«ENDDEFINE»
-
-«DEFINE getPrimaryShapeMethod FOR String-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «this» getPrimaryShape() {
- return («this») primaryShape;
- }
-«ENDDEFINE»
-
-«DEFINE addFixedChild FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
-«FOREACH getInnerFixedLabels() AS label»«LET (gmfgen::ParentAssignedViewmap) label.viewmap 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() AS compartment»«LET (gmfgen::ParentAssignedViewmap) compartment.viewmap 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() AS child-»
- «REM»BEGIN PapyrusGencode«ENDREM»
- «REM»adding IF else end in order to take in account the case where a specific locator is added«ENDREM»
- «IF getReferencingObjects(child).typeSelect(papyrusgmfgenextension::SpecificLocator).size()!=0»
- «FOREACH getReferencingObjects(child) AS extendedObject»
- «EXPAND genSpecificLocator(child) FOR extendedObject-»
- «ENDFOREACH-»
- «REM»END PapyrusGencode«ENDREM»
- «ELSE»
- 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;
- }
- «ENDIF»
-«ENDFOREACH-»
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE removeFixedChild FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
-«FOREACH getInnerFixedLabels() AS label»«LET (gmfgen::ParentAssignedViewmap) label.viewmap AS childViewmap-»
- if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
- return true;
- }
-«ENDLET»«ENDFOREACH-»
-«FOREACH getPinnedCompartments() AS compartment»«LET (gmfgen::ParentAssignedViewmap) compartment.viewmap 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() 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() AS compartment»«LET (gmfgen::ParentAssignedViewmap) compartment.viewmap AS childViewmap-»
- if (editPart instanceof «compartment.getEditPartQualifiedClassName()») {
- return getPrimaryShape().«childViewmap.getterName»();
- }
-«ENDLET»«ENDFOREACH-»
-«IF hasBorderItems()-»
- 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().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() 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 || 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 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.\n" +
- "\n" +
- "Body of this method does not depend on settings in generation model\n" +
- "so you may safely remove <i>generated</i> tag and modify it.\n"
- )»
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure create«IF hasBorderItems()»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.\n" +
- "Respects layout one may have set for generated figure.\n" +
- "@param nodeShape instance of generated figure class"
- )»
- protected org.eclipse.draw2d.IFigure setupContentPane(org.eclipse.draw2d.IFigure nodeShape) {
- «IF !childNodes.isEmpty() || !compartments.isEmpty() || !labels.without(labels.typeSelect(GenExternalNodeLabel)).isEmpty()-»
- if (nodeShape.getLayoutManager() == null) {
- «IF getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value-»
- 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 !labels.isEmpty()-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR (GenLabel) labels.first()»);
- }
- «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(this) 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(this) 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(this) AS link-»
- «FOREACH selectGenNodes(link.targets) 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(this) AS link-»
- «FOREACH selectGenNodes(link.sources) 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(this) AS link-»
- «FOREACH link.targets.typeSelect(gmfgen::GenNode) 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 AS compartment-»
- «IF listCompartmentHasChildren(compartment)-»
- «FOREACH compartment.childNodes 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»
-«REM»BEGIN PapyrusGencode «ENDREM»
-«REM» Adding line of template to manange code thanks to a spcific locator«ENDREM»
-«DEFINE genSpecificLocator(gmfgen::GenChildSideAffixedNode child) FOR gmfgen::GenCommonBase-»
-«ENDDEFINE»
-
-«DEFINE genSpecificLocator(gmfgen::GenChildSideAffixedNode child) FOR gmfgen::ToolEntry-»
-«ENDDEFINE»
-
-«DEFINE genSpecificLocator(gmfgen::GenChildSideAffixedNode child) FOR gmfgen::GenNavigatorChildReference-»
-«ENDDEFINE»
-
-«DEFINE genSpecificLocator(gmfgen::GenChildSideAffixedNode child) FOR papyrusgmfgenextension::SpecificLocator-»
-//Papyrus Gencode :«this.comment»
- if (childEditPart instanceof «child.getEditPartQualifiedClassName()») {
- org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new «this.classpath»(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»);
- getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator);
- return true;
- }
-
-«ENDDEFINE»
-«REM»END PapyrusGencode «ENDREM»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/editparts/Common.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/editparts/Common.xpt deleted file mode 100644 index 0c05c1403e4..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/editparts/Common.xpt +++ /dev/null @@ -1,160 +0,0 @@ -/*
- * 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Modified by Patrick Tessier (CEA)
- */
-«REM»Documentation: PapyrusGenCode«ENDREM»
-«REM»This tamplate has been modified in order to remove canonical ediPolicies«ENDREM»
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE visualIDConstant FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static final int VISUAL_ID = «visualID»;
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::GenCommonBase-»
- «EXPAND behaviour FOREACH behaviour-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::Behaviour-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::CustomBehaviour-»
-«IF editPolicyQualifiedClassName == null || editPolicyQualifiedClassName.trim().length() == 0-»
- removeEditPolicy(«key»); «IF key.startsWith('\"') && key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ELSE-»
- installEditPolicy(«key», new «getEditPolicyQualifiedClassName()»()); «IF key.startsWith('\"') && key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::OpenDiagramBehaviour-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.OPEN_ROLE,
- new «getEditPolicyQualifiedClassName()»());
-«ENDDEFINE»
-
-«DEFINE labelFigure FOR gmfgen::ParentAssignedViewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- // Parent should assign one using «EXPAND impl::diagram::editparts::TextAware::labelSetterName»() method
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE labelFigure FOR gmfgen::Viewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- org.eclipse.draw2d.IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigurePrim() {
- «EXPAND labelFigurePrim FOR this-»
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::FigureViewmap-»
-«IF figureQualifiedClassName == null-»
- return new org.eclipse.draw2d.Label();
-«ELSE-»
- return new «figureQualifiedClassName»();
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::SnippetViewmap-»
- return «body»;
- }
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::InnerClassViewmap-»
- return new «className»();
- }
-
- «classBody»
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::Viewmap-»
- «ERROR "Unknown viewmap: " + this-»
- }
-«ENDDEFINE»
-
-«DEFINE notationalListeners FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); «EXPAND xpt::Common::nonNLS»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); «EXPAND xpt::Common::nonNLS»
- }
-«ENDDEFINE»
-
-«DEFINE handleBounds FOR gmfgen::GenCommonBase-»
- 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 handleText FOR gmfgen::GenCommonBase-»
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry.getInstance().getColor(c));
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
- org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser modelParser =
- (org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE installSemanticEditPolicy FOR gmfgen::GenCommonBase-»
- «IF sansDomain-»
-removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE);
- «ELSE-»
-installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «getItemSemanticEditPolicyQualifiedClassName()»());
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE installCanonicalEditPolicy FOR gmfgen::GenContainerBase-»
- «IF needsCanonicalEditPolicy()-»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM»Used to remove at each time canonical editpolicies«ENDREM»
-//in Papyrus diagrams are not strongly synchronised
-//installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»());
- «REM»END: PapyrusGenCode«ENDREM»
- «ENDIF-»
-«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/preferences/PreferenceInitializer.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/preferences/PreferenceInitializer.xpt deleted file mode 100644 index a32ca29421c..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/preferences/PreferenceInitializer.xpt +++ /dev/null @@ -1,51 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«DEFINE className FOR gmfgen::GenDiagram»DiagramPreferenceInitializer«ENDDEFINE»
-
-«AROUND PreferenceInitializer FOR gmfgen::GenDiagram-»
-
-package «preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void initializeDefaultPreferences() {
- org.eclipse.jface.preference.IPreferenceStore store = getPreferenceStore();
- «FOREACH topLevelNodes AS node -»
- «this.preferencesPackageName».«node.getUniqueIdentifier()»«getPreferencePageSuffix()».initDefaults(store);
- «ENDFOREACH»
-
- «FOREACH links AS link -»
- «EXPAND linkInitDefaults(this) FOR link.elementType-»
- «ENDFOREACH»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() {
- return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore();
- }
-} -«ENDAROUND»
-
-«DEFINE linkInitDefaults(gmfgen::GenDiagram diagram) FOR gmfgen::MetamodelType-»
- «diagram.preferencesPackageName».«displayName»«getPreferencePageSuffix()».initDefaults(store); -«ENDDEFINE»
-
-«DEFINE linkInitDefaults(gmfgen::GenDiagram diagram) FOR gmfgen::ElementType-»«ENDDEFINE»
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/views/LinkViewFactory.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/views/LinkViewFactory.xpt deleted file mode 100644 index c0ba789fabd..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/views/LinkViewFactory.xpt +++ /dev/null @@ -1,54 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-
- «IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
- «EXTENSION xpt::preferences::PrefsConstant»
-
- «AROUND additions FOR gmfgen::GenLink»
- «EXPAND filterInitializer(this) FOR elementType»
- «ENDAROUND»
-
- «DEFINE filterInitializer(gmfgen::GenLink link) FOR gmfgen::MetamodelType»
- «EXPAND initializer FOR link» - «ENDDEFINE»
-
- «DEFINE filterInitializer(gmfgen::GenLink link) FOR gmfgen::ElementType» - «ENDDEFINE»
-
- «DEFINE initializer FOR gmfgen::GenLink»
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected void initializeFromPreferences(org.eclipse.gmf.runtime.notation.View view) {
-
- org.eclipse.jface.preference.IPreferenceStore store = (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore();
-
- if (store == null) {
- return;
- }
-
- org.eclipse.papyrus.preferences.initializer.LinkViewInitializer viewInitializer = new org.eclipse.papyrus.preferences.initializer.LinkViewInitializer(view, store);
- viewInitializer.initFont(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceFontConstant(elementType.displayName.toUpperCase())»);
- viewInitializer.initFontColor(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceFontColorConstant(elementType.displayName.toUpperCase())»);
- viewInitializer.initLineColor(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceLineColorConstant(elementType.displayName.toUpperCase())»);
-
- viewInitializer.initAvoidObstructions(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceRoutingObstructionPolicyConstant(elementType.displayName.toUpperCase())»);
- viewInitializer.initClosestDistance(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceRoutingDistancePolicyConstant(elementType.displayName.toUpperCase())»);
- viewInitializer.initJumpLinkReverse(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceJumpLinkReverseConstant(elementType.displayName.toUpperCase())»);
- viewInitializer.initJumpLinkStatus(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceJumpLinkStatusConstant(elementType.displayName.toUpperCase())»);
- viewInitializer.initJumpLinkType(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceJumpLinkTypeConstant(elementType.displayName.toUpperCase())»);
- viewInitializer.initRouting(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceRoutingStyleConstant(elementType.displayName.toUpperCase())»);
- viewInitializer.initSmoothness(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceSmoothnessConstant(elementType.displayName.toUpperCase())»);
- } - «ENDDEFINE»
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/views/NodeViewFactory.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/views/NodeViewFactory.xpt deleted file mode 100644 index 5f1924a11e2..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/diagram/views/NodeViewFactory.xpt +++ /dev/null @@ -1,43 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
- «IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
- «EXTENSION xpt::preferences::PrefsConstant»
-
-
- «AROUND additions FOR gmfgen::GenNode»
- «EXPAND initializer» - «ENDAROUND»
-
- «DEFINE initializer FOR gmfgen::GenTopLevelNode»
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected void initializeFromPreferences(org.eclipse.gmf.runtime.notation.View view) {
-
- org.eclipse.jface.preference.IPreferenceStore store = (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore();
-
- if (store == null) {
- return;
- }
-
- org.eclipse.papyrus.preferences.initializer.NodeViewInitializer viewInitializer = new org.eclipse.papyrus.preferences.initializer.NodeViewInitializer(view, store);
- viewInitializer.initFillColor(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceFillColorConstant(getUniqueIdentifier().toUpperCase())»);
- viewInitializer.initFont(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceFontConstant(getUniqueIdentifier().toUpperCase())»);
- viewInitializer.initFontColor(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceFontColorConstant(getUniqueIdentifier().toUpperCase())»);
- viewInitializer.initLineColor(«getDiagram().preferencesPackageName».«getPreferenceConstantFileName()».«getPreferenceLineColorConstant(getUniqueIdentifier().toUpperCase())»);
-
- }
- «ENDDEFINE»
-
- «DEFINE initializer FOR gmfgen::GenNode» - «ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/plugin/manifest.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/plugin/manifest.xpt deleted file mode 100644 index 167a4dbdfd5..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/plugin/manifest.xpt +++ /dev/null @@ -1,76 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - add Papyrus dependencies to Papyrus GMF diagram
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::Utils»
-
-«DEFINE manifest FOR gmfgen::GenPlugin-»
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: «iD»; singleton:=true
-Bundle-Version: «version»
-Bundle-ClassPath: .
-Bundle-Activator: «getActivatorQualifiedClassName()»
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: «editorGen.diagram.editPartsPackageName»,
- «editorGen.editor.packageName»,
- «editorGen.diagram.providersPackageName»
-Require-Bundle: org.eclipse.core.runtime,
-«IF editorGen.application == null-»
- org.eclipse.core.resources,
-«ENDIF-»
-«IF editorGen.diagram.generateShortcutIcon() ||
- (editorGen.navigator != null && editorGen.navigator.generateDomainModelNavigator)-»
- org.eclipse.core.expressions,
-«ENDIF-»
- org.eclipse.jface,
-«IF editorGen.application == null-»
- org.eclipse.ui.ide,
-«ENDIF-»
- org.eclipse.ui.views,
-«IF editorGen.navigator != null-»
- org.eclipse.ui.navigator,
- org.eclipse.ui.navigator.resources,
-«ENDIF-»
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
-«IF printingEnabled-»
- org.eclipse.gmf.runtime.diagram.ui.printing,
- org.eclipse.gmf.runtime.diagram.ui.printing.render,
-«ENDIF-»
-«IF editorGen.propertySheet != null-»
- org.eclipse.gmf.runtime.diagram.ui.properties,
-«ENDIF-»
- org.eclipse.gmf.runtime.diagram.ui.providers,
-«IF editorGen.application == null-»
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
-«ENDIF-»
- org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
-«IF editorGen.application == null-»
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
-«ENDIF-»
-«FOREACH getAllRequiredPlugins() AS id-»
- «id»;visibility:=reexport,
-«ENDFOREACH-»
- org.eclipse.gef;visibility:=reexport,
- org.eclipse.papyrus.preferences
-Eclipse-LazyStart: true
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/plugin/plugin.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/plugin/plugin.xpt deleted file mode 100644 index 5d2f7bab70c..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/aspects/xpt/plugin/plugin.xpt +++ /dev/null @@ -1,103 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«DEFINE category FOR gmfgen::GenDiagram»«getDiagramPreferencePageCategory()».«editorGen.modelID.toLowerCase()»«ENDDEFINE»
-
- «AROUND plugin FOR gmfgen::GenPlugin-»
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-«EXPAND xpt::Common::xcopyright FOR editorGen-»
-<plugin>
-
- <extension point="org.eclipse.team.core.fileTypes">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <fileTypes
- type="text"
- extension="«editorGen.diagramFileExtension»">
- </fileTypes>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.extension_parser">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <parser
- type="«editorGen.diagramFileExtension»"
- class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
- </parser>
- </extension>
-
-«EXPAND xpt::editor::extensions::extensions FOR editorGen-»
-«EXPAND xpt::plugin::plugin::menu-»
-«EXPAND xpt::plugin::plugin::validation FOR editorGen.diagram-»
-«EXPAND xpt::plugin::plugin::metrics FOR editorGen.metrics-»
-«EXPAND xpt::propsheet::extensions::extensions FOR editorGen.propertySheet-»
-«EXPAND preferencePages FOR editorGen.diagram-»
-«EXPAND preferencePageInitializer FOR editorGen.diagram-»
-«EXPAND xpt::providers::extensions::extensions FOR editorGen.diagram-»
-«EXPAND xpt::navigator::extensions::extensions FOR editorGen.navigator-»
-«EXPAND xpt::application::extensions::extensions FOR editorGen.application-»
-«EXPAND xpt::ConstraintProviders::extensions FOR editorGen-»
-«EXPAND xpt::diagram::updater::extensions::extensions FOR editorGen.diagramUpdater-»
-«EXPAND xpt::plugin::plugin::additions-»
-</plugin>
-«ENDAROUND»
-
-«DEFINE preferencePageInitializer FOR gmfgen::GenDiagram»
- <extension point="org.eclipse.core.runtime.preferences">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <initializer class="«preferencesPackageName».DiagramPreferenceInitializer"/>
- </extension> -«ENDDEFINE»
-
-«DEFINE preferencePages FOR gmfgen::GenDiagram»
-«EXPAND xpt::Common::xmlGeneratedTag»
-<extension point="org.eclipse.ui.preferencePages">
-«REM»Generate Diagram Preference Page«ENDREM»
- <page
- category="«getDiagramPreferencePageCategory()»"
- class="«preferencesPackageName».«getDiagramPreferencePageFileName(editorGen.modelID)»"
- id="«EXPAND category»"
- name="«editorGen.modelID» Diagram"/>
-
-«REM»Generate Nodes Preference Pages«ENDREM»
-«FOREACH topLevelNodes AS node -»
- «EXPAND preferenceExtensionNode FOR node-» -«ENDFOREACH»
-«REM»Generate Links Preference Pages«ENDREM»
-«FOREACH links AS link -»
- «EXPAND preferenceExtensionLink(this) FOR link.elementType-»
-«ENDFOREACH»
-
-</extension> -«ENDDEFINE»
-
-
-«DEFINE preferenceExtensionNode FOR gmfgen::GenNode»
- <page
- category="«EXPAND category FOR getDiagram()»"
- class="«getDiagram().preferencesPackageName».«getUniqueIdentifier()»«getPreferencePageSuffix()»"
- id="«getDiagram().preferencesPackageName».«getUniqueIdentifier()»«getPreferencePageSuffix()»"
- name="«elementType.displayName»"/>«ENDDEFINE»
-
-«DEFINE preferenceExtensionLink(gmfgen::GenDiagram diagram) FOR gmfgen::MetamodelType»
- <page
- category="«EXPAND category FOR diagram»"
- class="«diagram.preferencesPackageName».«displayName»«getPreferencePageSuffix()»"
- id="«diagram.preferencesPackageName».«displayName»«getPreferencePageSuffix()»"
- name="«displayName»"/>«ENDDEFINE»
-
- «DEFINE preferenceExtensionLink(gmfgen::GenDiagram diagram) FOR gmfgen::ElementType»«ENDDEFINE»
-
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/MetaModel.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/MetaModel.xpt deleted file mode 100644 index b42ee8d6040..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/MetaModel.xpt +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 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: - * Artem Tikhomirov (Borland) - initial API and implementation - */ - -«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» -«IMPORT "http://www.eclipse.org/emf/2002/Ecore"» -«IMPORT "http://www.eclipse.org/emf/2002/GenModel"» - -«EXTENSION MetaModel» - -/* - * Does instanceof check. - */ -«DEFINE IsInstance(String accessor) FOR GenClass-» -«accessor» instanceof «getQualifiedInterfaceName()»«ENDDEFINE» - -// Shorthand, negates IsInstance - handy if you consider -// different approaches for generated and dynamic models: false == instanceof -// vs. !MetaModelFacility.isInstance -«DEFINE NotInstance(String accessor) FOR GenClass-» -false == «EXPAND IsInstance(accessor)»«ENDDEFINE» - -/** - * Special kind of instanceof check, that compares eContainer() of the object. - * Since metaClass may be an external interface, eContainer() might need cast to EObject - */ -«DEFINE IsContainerInstance(String object, GenClass metaClass) FOR GenClass-» -«EXPAND _getEObjectFeature(object, "eContainer()") FOR metaClass» instanceof «getQualifiedInterfaceName()»«ENDDEFINE» - -«DEFINE _getEObjectFeature(String object, String feature) FOR GenClass-» -«IF isExternalInterface()»((org.eclipse.emf.ecore.EObject) «object»).«feature»«ELSE»«object».«feature»«ENDIF-» -«ENDDEFINE» - -// Public/API-sort templates are named with first letter capitalized. -// FIXME getFeatureValue* and setFeatureValue start with lowercase to indicate pending refactoring - -«DEFINE getFeatureValue(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-» -«IF isExternalInterface(containerClass)-» -((«EXPAND featureTargetType») ((org.eclipse.emf.ecore.EObject) «containerVar»).eGet(«EXPAND MetaFeature»))«-» -«ELSE-» -«containerVar».«getGetAccessor()»()«-» -«ENDIF-» -«ENDDEFINE» - -«DEFINE featureTargetType FOR GenFeature»«IF isListType()»java.util.List«ELSE»«EXPAND QualifiedClassName FOR findGenClassifier(genClass.genPackage.genModel, ecoreFeature.eType)»«ENDIF»«ENDDEFINE» - -/* - * FIXME leave only one version of these two getFeatureValue - * - * A slightly more sophisticated version of getFeatureValue(). - * @param containerName the name of the container - * @param feature the feature whose value is in interest - * @param containerMetaClass the <code>GenClass</code> of the container, or <code>null</code>, if the container is declared as an <code>org.eclipse.emf.ecore.EObject</code>. - * @param needsCastToResultType whether the cast to the result type is required (this parameter is only used if the <code>org.eclipse.emf.ecore.EClass</code> this feature belongs to is an external interface). - */ -«DEFINE getFeatureValue(String containerVar, genmodel::GenClass container, boolean needsCastToResultType) FOR genmodel::GenFeature-» -«IF isExternalInterface(genClass)-» -«IF needsCastToResultType»((«EXPAND featureTargetType») «ENDIF»«containerVar.parenthesizedCast(container, null)».eGet(«EXPAND MetaFeature»)«IF needsCastToResultType»)«ENDIF-» -«ELSE-» -«containerVar.parenthesizedCast(container, genClass)».«getGetAccessor()»()«-» -«ENDIF-» -«ENDDEFINE» - -«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerGenClass, String valueVar) FOR genmodel::GenFeature-» -«EXPAND setFeatureValue(containerVar, containerGenClass, valueVar, false)»«ENDDEFINE» - -// FIXME support list features as well, i.e. do .add() instead of eSet -«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerGenClass, String valueVar, boolean isPlainObjectValue) FOR genmodel::GenFeature-» -«IF isExternalInterface(containerGenClass)-» -((org.eclipse.emf.ecore.EObject) «containerVar»).eSet(«EXPAND MetaFeature», «valueVar»)«-» -«ELSE-» -«containerVar».set«getAccessorName(this)»(«IF !isPlainObjectValue»«valueVar»«ELSE»«IF isPrimitiveType()»«EXPAND _unwrapObjectToPrimitiveValue(valueVar)»«ELSE»(«EXPAND featureTargetType») «valueVar»«ENDIF»«ENDIF»)«-» -«ENDIF-» -«ENDDEFINE» - -«DEFINE _unwrapObjectToPrimitiveValue(String valueVar) FOR GenFeature-» -((«EXPAND featureTargetType») «valueVar»).«ecoreFeature.eType.instanceClassName»Value()«ENDDEFINE» - -«DEFINE MetaClass FOR genmodel::GenClassifier»«getQualifiedPackageInterfaceName(genPackage)».eINSTANCE.get«getClassifierAccessorName(this)»()«ENDDEFINE» - -«DEFINE MetaFeature FOR genmodel::GenFeature»«getQualifiedPackageInterfaceName(genClass.genPackage)».eINSTANCE.get«getFeatureAccessorName(this)»()«ENDDEFINE» - -// SomeFactory.eINSTANCE.createBlaBla(); -//NB: for map entries, the resulting type is EObject, not the qualified interface name. If cast is needed, use (un)parenthesizedCast() extension. -//see GenClassImpl#hasFactoryInterfaceCreateMethod() for details why map entries should be treated differently -«DEFINE NewInstance FOR genmodel::GenClass-» -«IF isMapEntry()-» -«genPackage.getQualifiedFactoryInterfaceName()».«genPackage.getFactoryInstanceName()».create(«EXPAND MetaClass»)«ELSE-» -«genPackage.getQualifiedFactoryInterfaceName()».«genPackage.getFactoryInstanceName()».create«ecoreClass.name»()«ENDIF-» -«ENDDEFINE» - -// XXX Need to take into account possible GenClass from generated and always available code -// e.g. Notation or Ecore - -«DEFINE NewInstance(String varName) FOR genmodel::GenClass-» -«getQualifiedInterfaceName()» «varName» = «IF isMapEntry()»(«getQualifiedInterfaceName()») «ENDIF»«EXPAND NewInstance»; -«ENDDEFINE» - -/* - * Ensures value is of type EObject, may be no-op if context GenClass is compatible with EObject. - * Note, injected value is not surrounded with parenthesis, may need to introduce another - * template to accomplish that if needed. - */ -«DEFINE DowncastToEObject(String value) FOR genmodel::GenClass»«IF isExternalInterface()»(org.eclipse.emf.ecore.EObject) «ENDIF»«value»«ENDDEFINE» - -/* - * Declares new variable of appropriate type and assigns casted value to it. - */ -«DEFINE DeclareAndAssign(String assignee, String value) FOR GenClass-» -«getQualifiedInterfaceName()» «assignee» = («getQualifiedInterfaceName()») «value»;«ENDDEFINE» - -/* - * third boolean parameter is to indicate the value is not EObject, so may - * need extra cast in case dynamic model instances are in use. - */ -«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClass-» -«EXPAND DeclareAndAssign(assignee, value)»«ENDDEFINE» - -«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClassifier-» -«getQualifiedClassName()» «assignee» = («getQualifiedClassName()») «value»;«ENDDEFINE» - -// @see IsContainerInstance -«DEFINE DeclareAndAssignContainer(String assignee, String object, GenClass metaClass) FOR GenClass-» -«getQualifiedInterfaceName()» «assignee» = («getQualifiedInterfaceName()») «EXPAND _getEObjectFeature(object, "eContainer()") FOR metaClass»;«ENDDEFINE» - -/* - * Declares new variable of context type and assignes a value obtained from 'src', - * which is of type 'srcMetaClass', via 'srcFeature' - * - * XXX in certain scenarions may need extra cast of the feature value - */ -«DEFINE DeclareAndAssign(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature) FOR GenClass-» -«getQualifiedInterfaceName()» «assignee» = «EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature»;«ENDDEFINE» - -/* - * Same as DeclareAndAssign, with extra operation applied to source object - */ -«DEFINE DeclareAndAssign2(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) FOR GenClass-» -«getQualifiedInterfaceName()» «assignee» = «IF needCast»(«getQualifiedInterfaceName()») «ENDIF»«EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature».«srcExt»;«ENDDEFINE» - -/* - * Cast value of type EObject to specific type. Would be no-op with dynamic model instances, - * therefore, the fact eObjectValue is actually EObject is essential - */ -«DEFINE CastEObject(String eObjectValue) FOR GenClass»(«getQualifiedInterfaceName()») «eObjectValue»«ENDDEFINE» - -/** - * Qualified interface name of the generated EClass, or EObject for dynamic models. - * Use whenever class name is inevitable (e.g. method arguments) - * SHOULD NEVER APPEAR in instanceof or any other similar comparison operation - */ -«DEFINE QualifiedClassName FOR GenClass»«getQualifiedInterfaceName()»«ENDDEFINE» -«DEFINE QualifiedClassName FOR GenClassifier»«getQualifiedClassName()»«ENDDEFINE» - -«DEFINE PopulateItemProviderFactories(String factoryListVar) FOR GenEditorGenerator-» -«FOREACH getAllDomainGenPackages(true) AS genPackage-» - «factoryListVar».add(new «genPackage.getQualifiedItemProviderAdapterFactoryClassName()»()); -«ENDFOREACH-» -«ENDDEFINE» diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/commands/CreateNodeCommand.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/commands/CreateNodeCommand.xpt deleted file mode 100644 index 636ea19225d..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/commands/CreateNodeCommand.xpt +++ /dev/null @@ -1,225 +0,0 @@ -/*
- * Copyright (c) 2007, 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"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::Utils»
-«EXTENSION MetaModel»
-
-«DEFINE CreateNodeCommand FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editCommandsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «createCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand {
-
- «REM» Mutating canvas auxiliary «ENDREM»
- «EXPAND xpt::Common::generatedMemberComment-»
- private org.eclipse.emf.ecore.EClass eClass = null;
- «EXPAND xpt::Common::generatedMemberComment-»
- private org.eclipse.emf.ecore.EObject eObject = null;
-
- «REM» Mutating canvas auxiliary constructor «ENDREM»
- «EXPAND xpt::Common::generatedMemberComment-»
- public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) {
- super(req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- «REM» Mutating canvas auxiliary builder «ENDREM»
- «EXPAND xpt::Common::generatedMemberComment-»
- public static «createCommandClassName» create(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) {
- return new «createCommandClassName»(req, eObject);
- }
-
- «EXPAND constructor-»
- «IF modelFacet.isPhantomElement() || modelFacet.containmentMetaFeature != null || modelFacet.childMetaFeature != null-»
-
- «EXPAND getElementToEdit-»
- «IF modelFacet.isPhantomElement()-»
-
- «EXPAND canExecute_Phantom-»
-
- «EXPAND getContainmentFeature-»
-
- «EXPAND doDefaultElementCreation_Phantom(this) FOR modelFacet-»
- «ELSE-»
- «EXPAND canExecute_Normal FOR modelFacet-»
-
- «EXPAND getEClassToEdit FOR modelFacet-»
- «EXPAND doDefaultElementCreation_Normal(this) FOR modelFacet-»
- «ENDIF-»
- «ENDIF-»
-
-}
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- super(req);
-}
-«ENDDEFINE»
-
-«DEFINE getElementToEdit FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EObject getElementToEdit() {
- «REM» Mutating canvas helper «ENDREM»
- org.eclipse.emf.ecore.EObject container =
- ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer();
- if (container instanceof org.eclipse.gmf.runtime.notation.View) {
- container = ((org.eclipse.gmf.runtime.notation.View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
-}
-«ENDDEFINE»
-
-«REM»
- TODO: Shouldn't this method just return true?
-«ENDREM»
-«DEFINE canExecute_Phantom FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean canExecute() {
- if (getEClass() != null) {
- return getEClass().isSuperTypeOf(getEClassToEdit());
- }
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE canExecute_Normal FOR gmfgen::TypeModelFacet-»
- «IF containmentMetaFeature.ecoreFeature.upperBound > 0 || (childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0)-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean canExecute() {
- «EXPAND MetaModel::DeclareAndAssign("container", "getElementToEdit()") FOR containmentMetaFeature.genClass-»
- «IF containmentMetaFeature.ecoreFeature.upperBound > 0-»
- «IF containmentMetaFeature.ecoreFeature.upperBound == 1»
- if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR containmentMetaFeature» != null) {
- «ELSE-»
- if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR containmentMetaFeature».size() >= «containmentMetaFeature.ecoreFeature.upperBound») {
- «ENDIF-»
- return false;
- }
- «ENDIF-»
- «IF childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0-»
- «IF childMetaFeature.ecoreFeature.upperBound == 1-»
- if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR childMetaFeature» != null) {
- «ELSE-»
- if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR childMetaFeature».size() >= «childMetaFeature.ecoreFeature.upperBound») {
- «ENDIF-»
- return false;
- }
- «ENDIF-»
- return true;
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getContainmentFeature FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EReference getContainmentFeature() {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getEClassToEdit FOR gmfgen::TypeModelFacet-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EClass getEClassToEdit() {
- «REM» Mutating canvas helper «ENDREM»
- org.eclipse.emf.ecore.EObject eObject = getElementToEdit();
- if (eObject != null) {
- return eObject.eClass();
- }
- if (eClass != null) {
- return eClass;
- }
- return «EXPAND MetaModel::MetaClass FOR containmentMetaFeature.genClass»;
-}
-«ENDDEFINE»
-
-«DEFINE doDefaultElementCreation_Phantom(gmfgen::GenNode node) FOR TypeModelFacet-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EObject doDefaultElementCreation() {
- // Uncomment to put "phantom" objects into the diagram file.
- // org.eclipse.emf.ecore.resource.Resource resource =
- // ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer().eResource();
- // if (resource == null) {
- // return null;
- // }
- org.eclipse.emf.ecore.resource.Resource resource = getElementToEdit().eResource();
- «EXPAND MetaModel::NewInstance("newElement") FOR metaClass»
- resource.getContents().add(«EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass»);
- «EXPAND initialize(node, "newElement")-»
- return «EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass»;
-}
-«ENDDEFINE»
-
-«DEFINE doDefaultElementCreation_Normal(gmfgen::GenNode node) FOR gmfgen::TypeModelFacet-»
- «IF modelElementInitializer != null || hasExplicitChildFeature(this)-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EObject doDefaultElementCreation() {
- «EXPAND MetaModel::NewInstance("newElement") FOR metaClass»
-«IF containmentMetaFeature != null-»
- «EXPAND MetaModel::DeclareAndAssign("owner", "getElementToEdit()") FOR containmentMetaFeature.genClass»
- «EXPAND xpt::diagram::commands::CreateLinkUtils::addValue("owner", containmentMetaFeature.genClass, "newElement") FOR containmentMetaFeature-»
-«ENDIF»
-«IF hasExplicitChildFeature(this)-»
- «EXPAND MetaModel::DeclareAndAssign("childHolder", "getElementToEdit()") FOR childMetaFeature.genClass»
- «EXPAND xpt::diagram::commands::CreateLinkUtils::addValue("childHolder", childMetaFeature.genClass, "newElement") FOR childMetaFeature»
-«ENDIF-»
- «EXPAND initialize(node, "newElement")-»
- «REM»fjcano:: the Diagram may have been passed as a paremeter in the request «ENDREM»
- //code used in MOSKitt approach in order to manage "delete from diagram"
- //org.eclipse.gmf.runtime.notation.Diagram diagram = es.cv.gvcase.mdt.common.util.MDTUtil.getDiagramFromRequest(getRequest());
- //if (diagram != null) {
- // es.cv.gvcase.mdt.common.util.MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, newElement);
- //}
- //else {
- // es.cv.gvcase.mdt.common.util.MultiDiagramUtil.
- // addEAnnotationReferenceToDiagram(
- // «node.getDiagram().editorGen.editor.packageName».«node.getDiagram().editorGen.plugin.activatorClassName».getInstance(), newElement);
- //}
- return «EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass»;
-}
-«ELSE-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.emf.ecore.EObject doDefaultElementCreation() {
- «EXPAND MetaModel::QualifiedClassName FOR metaClass» newElement = («EXPAND MetaModel::QualifiedClassName FOR metaClass») super.doDefaultElementCreation();
- //code used in MOSKitt approach in order to manage "delete from diagram"
- //if (newElement != null) {
- // «REM»fjcano:: the Diagram may have been passed as a paremeter in the request «ENDREM»
- //org.eclipse.gmf.runtime.notation.Diagram diagram = es.cv.gvcase.mdt.common.util.MDTUtil.getDiagramFromRequest(getRequest());
- //if (diagram != null) {
- // es.cv.gvcase.mdt.common.util.MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, newElement);
- //}
- //else {
- // es.cv.gvcase.mdt.common.util.MultiDiagramUtil.
- // addEAnnotationReferenceToDiagram(
- // «node.getDiagram().editorGen.editor.packageName».«node.getDiagram().editorGen.plugin.activatorClassName».getInstance(), newElement);
- //}
- //}
- return newElement;
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE initialize(gmfgen::GenNode node, String newElementVar) FOR gmfgen::TypeModelFacet»«IF modelElementInitializer != null-»
-«node.getDiagram().getElementTypesQualifiedClassName()».init_«node.getUniqueIdentifier()»(«newElementVar»);
-«ENDIF»«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt deleted file mode 100644 index 103e34f5a23..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (c) 2007, 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: - * Alexander Shatalin (Borland) - initial API and implementation - */ - -«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» -«IMPORT "http://www.eclipse.org/emf/2002/Ecore"» -«IMPORT "http://www.eclipse.org/emf/2002/GenModel"» - -«EXTENSION xpt::diagram::editpolicies::Utils» -«EXTENSION xpt::GenModelUtils» -«EXTENSION xpt::expressions::ValueExpression» - -«DEFINE BaseItemSemanticEditPolicy FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::copyright FOR editorGen-» -package «getDiagram().editPoliciesPackageName»; - -«EXPAND xpt::Common::generatedClassComment» -public class «baseItemSemanticEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy { - - «EXPAND xpt::Common::generatedMemberComment("Extended request data key to hold editpart visual id.\n")» - public static final String VISUAL_ID_KEY = "visual_id"; «EXPAND xpt::Common::nonNLS» - - «EXPAND xpt::Common::generatedMemberComment( - "Extended request data key to hold editpart visual id.\n" + - "Add visual id of edited editpart to extended data of the request\n" + - "so command switch can decide what kind of diagram element is being edited.\n" + - "It is done in those cases when it\'s not possible to deduce diagram\n" + - "element kind from domain element.\n" - )» - public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) { - if (request instanceof org.eclipse.gef.requests.ReconnectRequest) { - Object view = ((org.eclipse.gef.requests.ReconnectRequest) request).getConnectionEditPart().getModel(); - if (view instanceof org.eclipse.gmf.runtime.notation.View) { - Integer id = new Integer(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»((org.eclipse.gmf.runtime.notation.View) view)); - request.getExtendedData().put(VISUAL_ID_KEY, id); - } - } - return super.getCommand(request); - } - - «EXPAND xpt::Common::generatedMemberComment("Returns visual id from request parameters.\n")» - protected int getVisualID(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) { - Object id = request.getParameter(VISUAL_ID_KEY); - return id instanceof Integer ? ((Integer) id).intValue() : -1; - } - - «EXPAND semanticPart-» - - «EXPAND xpt::Common::generatedMemberComment("Returns editing domain from the host edit part.\n")» - protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() { - return ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain(); - } - - «EXPAND xpt::Common::generatedMemberComment("Creates command to destroy the link.\n")» - protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.notation.View view) { - org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view); - org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest request = - new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(getEditingDomain(), false); - return editPart.getCommand( - new org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper(request, java.util.Collections.EMPTY_MAP)); - } - - «EXPAND xpt::Common::generatedMemberComment("Creates commands to destroy all host incoming and outgoing links.\n")» - protected org.eclipse.gef.commands.CompoundCommand getDestroyEdgesCommand() { - org.eclipse.gef.commands.CompoundCommand cmd = new org.eclipse.gef.commands.CompoundCommand(); - org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel(); - for (java.util.Iterator it = view.getSourceEdges().iterator(); it.hasNext();) { - cmd.add(getDestroyElementCommand((org.eclipse.gmf.runtime.notation.Edge) it.next())); - } - for (java.util.Iterator it = view.getTargetEdges().iterator(); it.hasNext();) { - cmd.add(getDestroyElementCommand((org.eclipse.gmf.runtime.notation.Edge) it.next())); - } - return cmd; - } - - «EXPAND addDestroyShortcutsCommand-» - - «EXPAND linkConstraints-» - - «EXPAND additions-» -} -«ENDDEFINE» - -«DEFINE addDestroyShortcutsCommand FOR gmfgen::GenDiagram-» - «EXPAND xpt::Common::generatedMemberComment» -protected void addDestroyShortcutsCommand(org.eclipse.gef.commands.CompoundCommand command) { - org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel(); - if (view.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS» - return; - } - for (java.util.Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next(); - if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { «EXPAND xpt::Common::nonNLS» - continue; - } - command.add(getDestroyElementCommand(nextView)); - } -} -«ENDDEFINE» - -«DEFINE semanticPart FOR gmfgen::GenDiagram-» - «EXPAND getSemanticCommand-» - - «EXPAND getSemanticCommandSwitch-» - - «EXPAND getConfigureCommand-» - - «EXPAND getCreateRelationshipCommand-» - - «EXPAND getCreateCommand-» - - «EXPAND getSetCommand-» - - «EXPAND getEditContextCommand-» - - «EXPAND getDestroyElementCommand-» - - «EXPAND getDestroyReferenceCommand-» - - «EXPAND getDuplicateCommand-» - - «EXPAND getMoveCommand-» - - «EXPAND getReorientReferenceRelationshipCommand-» - - «EXPAND getReorientRelationshipCommand-» - - «EXPAND getGEFWrapper-» - «EXPAND getMSLWrapper-» - - «EXPAND getSemanticElement-» -«ENDDEFINE» - -«DEFINE getSemanticCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getSemanticCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) { - org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest completedRequest = completeRequest(request); - Object editHelperContext = completedRequest.getEditHelperContext(); - if (editHelperContext instanceof org.eclipse.gmf.runtime.notation.View || (editHelperContext instanceof org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext && ((org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext) editHelperContext).getEObject() instanceof org.eclipse.gmf.runtime.notation.View)) { - // no semantic commands are provided for pure design elements - return null; - } - if (editHelperContext == null) { - editHelperContext = org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.resolveSemanticElement((org.eclipse.gmf.runtime.notation.View) getHost().getModel()); - } - org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getElementType(editHelperContext); - if (elementType == org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getType("org.eclipse.gmf.runtime.emf.type.core.default")) { «EXPAND xpt::Common::nonNLS» - «REM»< % = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()) % >.getInstance().logInfo("Failed to get element type for " + editHelperContext); / / $NON-NLS-1$«ENDREM»«-» - elementType = null; - } - org.eclipse.gef.commands.Command semanticCommand = getSemanticCommandSwitch(completedRequest); - if (elementType != null) { - if (semanticCommand != null) { - org.eclipse.gmf.runtime.common.core.command.ICommand command = semanticCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) semanticCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(semanticCommand); - completedRequest.setParameter(«getBaseEditHelperQualifiedClassName()».EDIT_POLICY_COMMAND, command); - } - org.eclipse.gmf.runtime.common.core.command.ICommand command = elementType.getEditCommand(completedRequest); - if (command != null) { - if (!(command instanceof org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)) { - org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain(); - command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(editingDomain, command.getLabel()).compose(command); - } - semanticCommand = new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command); - } - } - boolean shouldProceed = true; - if (completedRequest instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) { - shouldProceed = shouldProceed((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) completedRequest); - } - if (shouldProceed) { - if (completedRequest instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) { - org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain(); - org.eclipse.gef.commands.Command deleteViewCommand = new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(editingDomain, (org.eclipse.gmf.runtime.notation.View) getHost().getModel())); - semanticCommand = semanticCommand == null ? deleteViewCommand : semanticCommand.chain(deleteViewCommand); - } - return semanticCommand; - } - return null; -} -«ENDDEFINE» - -«DEFINE getSemanticCommandSwitch FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getSemanticCommandSwitch(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) { - if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest) { - return getCreateRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) { - return getCreateCommand((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) { - return getConfigureCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) { - return getDestroyElementCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest) { - return getDestroyReferenceCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest) { - return getDuplicateCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) { - return getEditContextCommand((org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) { - return getMoveCommand((org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest) { - return getReorientReferenceRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) { - return getReorientRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) req); - } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) { - return getSetCommand((org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) req); - } - return null; -} -«ENDDEFINE» - -«DEFINE getConfigureCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest req) { - return null; -} -«ENDDEFINE» - -«DEFINE getCreateRelationshipCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { - return null; -} -«ENDDEFINE» - -«DEFINE getCreateCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) { - return null; -} -«ENDDEFINE» - -«DEFINE getSetCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest req) { - return null; -} -«ENDDEFINE» - -«DEFINE getEditContextCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getEditContextCommand(org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest req) { - return null; -} -«ENDDEFINE» - -«DEFINE getDestroyElementCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) { - return null; -} -«ENDDEFINE» - -«DEFINE getDestroyReferenceCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) { - return null; -} -«ENDDEFINE» - -«DEFINE getDuplicateCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) { - return null; -} -«ENDDEFINE» - -«DEFINE getMoveCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest req) { - return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand(req)); -} -«ENDDEFINE» - -«DEFINE getReorientReferenceRelationshipCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getReorientReferenceRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest req) { - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; -} -«ENDDEFINE» - -«DEFINE getReorientRelationshipCommand FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) { - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; -} -«ENDDEFINE» - -«DEFINE getGEFWrapper FOR gmfgen::GenDiagram-» - «EXPAND xpt::Common::generatedMemberComment» - protected final org.eclipse.gef.commands.Command getGEFWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) { - return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(cmd); - } -«ENDDEFINE» - -«DEFINE getMSLWrapper FOR gmfgen::GenDiagram-» - «EXPAND xpt::Common::generatedMemberComment("@deprecated use getGEFWrapper() instead")» - protected final org.eclipse.gef.commands.Command getMSLWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) { - // XXX deprecated: use getGEFWrapper() instead - return getGEFWrapper(cmd); - } -«ENDDEFINE» - -«DEFINE getSemanticElement FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedMemberComment» -protected org.eclipse.emf.ecore.EObject getSemanticElement() { - return org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.resolveSemanticElement((org.eclipse.gmf.runtime.notation.View) getHost().getModel()); -} -«ENDDEFINE» - - - -«DEFINE linkConstraints FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::generatedClassComment» -public static class «getLinkCreationConstraintsClassName()» { - -«IF null != editorGen.expressionProviders-» - «EXPAND xpt::Common::generatedMemberComment» - private static final String OPPOSITE_END_VAR = "oppositeEnd"; «EXPAND xpt::Common::nonNLS» - -«FOREACH getValidLinkConstraints(this) AS lc-» -«IF lc.sourceEnd != null-» - «EXPAND xpt::Common::generatedMemberComment» - private static «editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()» «sourceConstraintFieldName(lc.link)»; -«ENDIF-» -«IF lc.targetEnd != null-» - «EXPAND xpt::Common::generatedMemberComment» - private static «editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()» «targetConstraintFieldName(lc.link)»; -«ENDIF-» -«ENDFOREACH» -«ENDIF-» - - «EXPAND canCreate FOREACH links-» - «EXPAND canExist FOREACH links-» -} -«ENDDEFINE» - -«DEFINE canCreate FOR gmfgen::GenLink» - -«EXPAND xpt::Common::generatedMemberComment» -public static boolean canCreate«getUniqueIdentifier()»(«EXPAND canCreateParameters FOR modelFacet») { - «EXPAND checkEMFConstraints FOR modelFacet-» - return canExist«getUniqueIdentifier()»(«EXPAND canCreateValues FOR modelFacet»); -} -«ENDDEFINE» - -«REM» - XXX for now, both constraints are injected into single method - which may nob be suitable for modification especially when mixing - java and ocl constraints (former requires manual code). - Better approach would be: - if either is non-null and providers are not the same - introduce two methods, - to check source and target separately. Otherwize, do it inplace. -«ENDREM» -«DEFINE canExist FOR gmfgen::GenLink» - - «EXPAND xpt::Common::generatedMemberComment» - public static boolean canExist«getUniqueIdentifier()»(«EXPAND canCreateParameters FOR modelFacet») { -«IF creationConstraints != null && creationConstraints.isValid() && null != getDiagram().editorGen.expressionProviders-» - try { -«IF null != creationConstraints.sourceEnd-» - «EXPAND checkAdditionalConstraint(creationConstraints.sourceEnd, sourceConstraintFieldName(this), "source", "target", creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass()) FOR creationConstraints.sourceEnd.provider-» -«ENDIF-» -«IF null != creationConstraints.targetEnd-» - «EXPAND checkAdditionalConstraint(creationConstraints.targetEnd, targetConstraintFieldName(this), "target", "source", creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass()) FOR creationConstraints.targetEnd.provider-» -«ENDIF-» - return true; - } catch(Exception e) { - «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Link constraint evaluation error", e); «EXPAND xpt::Common::nonNLS» - return false; - } -«ELSE» - return true; -«ENDIF-» - } -«ENDDEFINE» - -«DEFINE canCreateParameters FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE» -«DEFINE canCreateParameters FOR gmfgen::TypeLinkModelFacet»«IF null != sourceMetaFeature»«EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container, «ENDIF»«EXPAND sourceTargetParameters»«ENDDEFINE» -«DEFINE canCreateParameters FOR gmfgen::FeatureLinkModelFacet»«EXPAND sourceTargetParameters»«ENDDEFINE» - -«DEFINE sourceTargetParameters FOR gmfgen::LinkModelFacet»«EXPAND MetaModel::QualifiedClassName FOR getSourceType()» source, «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» target«ENDDEFINE» - -«DEFINE canCreateValues FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE» -«DEFINE canCreateValues FOR gmfgen::TypeLinkModelFacet»«IF null != sourceMetaFeature»container, «ENDIF»source, target«ENDDEFINE» -«DEFINE canCreateValues FOR gmfgen::FeatureLinkModelFacet»source, target«ENDDEFINE» - - - -«DEFINE checkEMFConstraints FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE» - -«DEFINE checkEMFConstraints FOR gmfgen::TypeLinkModelFacet-» - «LET childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0 AS checkChildFeatureUpperBound-» - «IF containmentMetaFeature.ecoreFeature.upperBound > 0 || checkChildFeatureUpperBound-» -if («getContainerVariable()» != null) { - «EXPAND checkEMFConstraints(this) FOR containmentMetaFeature-» - «IF checkChildFeatureUpperBound-» - «EXPAND checkEMFConstraints(this) FOR childMetaFeature-» - «ENDIF-» -} - «ENDIF-» - «ENDLET-» -«ENDDEFINE» - -«DEFINE checkEMFConstraints(gmfgen::TypeLinkModelFacet modelFacet) FOR genmodel::GenFeature-» -«IF ecoreFeature.upperBound > 0-» -if («EXPAND featureBoundComparator(getContainerVariable(modelFacet), modelFacet.getSourceType())») { - return false; -} -«ENDIF-» -«ENDDEFINE» - -«DEFINE checkEMFConstraints FOR gmfgen::FeatureLinkModelFacet-» - «LET "source" AS sourceVar-» -if («sourceVar» != null) { - if ( - «REM»Checking uper bounds if was specified in MM«ENDREM»«-» - «IF metaFeature.ecoreFeature.upperBound > 0»«EXPAND featureBoundComparator(sourceVar, getSourceType()) FOR metaFeature»«ENDIF-» - «REM»Checking uniqueness in addition if uper bounds > 1«ENDREM»«-» - «IF metaFeature.ecoreFeature.upperBound > 1» || «ENDIF-» - «REM»Checking uniqueness in if uper bounds > 1 or < 0«ENDREM»«-» - «IF metaFeature.ecoreFeature.upperBound != 1»«EXPAND featureUniquenessComparator(sourceVar, getSourceType()) FOR metaFeature»«ENDIF») { - return false; - } - «IF metaFeature.isContains()-» - if (source == target) { - return false; - } - «ENDIF-» -} - «ENDLET-» -«ENDDEFINE» - -«DEFINE featureBoundComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass)»«IF ecoreFeature.upperBound == 1» != null«ELSE».size() >= «ecoreFeature.upperBound»«ENDIF»«ENDDEFINE» -«DEFINE featureUniquenessComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass) FOR this».contains(target)«ENDDEFINE» - - -«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenExpressionProviderBase» -«ERROR "Have no idea what extra constraints to check for " + this» -«ENDDEFINE» - -«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenExpressionInterpreter-» - if («sourceEndVar» == null) { - return true; - } - if («constraintFieldName» == null) { - java.util.Map env = java.util.Collections.singletonMap(OPPOSITE_END_VAR, «EXPAND MetaModel::MetaClass FOR oppositeEndContext»); - «constraintFieldName» = «getQualifiedClassName()».«getExpressionAccessor(valueExpr)»(«valueExpr.getBodyString()», «EXPAND MetaModel::MetaClass FOR context», env); «EXPAND xpt::Common::nonNLS» - } - Object «sourceEndVar»Val = «constraintFieldName».evaluate(«sourceEndVar», java.util.Collections.singletonMap(OPPOSITE_END_VAR, «targetEndVar»)); - if (false == «sourceEndVar»Val instanceof Boolean || !((Boolean) «sourceEndVar»Val).booleanValue()) { - return false; - } // else fall-through -«ENDDEFINE» - -«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenJavaExpressionProvider-» -«IF injectExpressionBody && valueExpr.body != null && valueExpr.body.length() != 0-» - «valueExpr.body» -«ELSEIF throwException || (injectExpressionBody && (valueExpr.body == null || valueExpr.body.length() == 0))-» - // TODO: implement this method, using «sourceEndVar» and «targetEndVar» - // to access link source and target, respectively - // Ensure that you remove @generated or mark it @generated NOT - if (Boolean.TRUE.booleanValue()) { - throw new java.lang.UnsupportedOperationException("No java implementation provided");«EXPAND xpt::Common::nonNLS» - } -«ELSE-» - if (Boolean.TRUE.booleanValue()) {«REM»just in case there are two consecutive java expression with neither throw nor inject - avoid unreachable code.«ENDREM» - return false; - } -«ENDIF-» -«ENDDEFINE» - - -«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet»«ERROR "Unrecognized link model facet: " + this»«ENDDEFINE» - -«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt deleted file mode 100644 index ef0781ee0fe..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt +++ /dev/null @@ -1,169 +0,0 @@ -/*
- * 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension"»
-
-«EXTENSION MetaModel»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::EMFUtils»
-«EXTENSION xpt::mutatingUtils»
-
-«REM» [Mutating] new getCreatecommand with an element switch «ENDREM»
-«AROUND DiagramItemSemanticEditPolicy FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «editPoliciesPackageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «getBaseItemSemanticEditPolicyQualifiedClassName()» {
- «EXPAND childMutatingContainerCreateCommand FOR this-»
-
- «EXPAND xpt::diagram::editpolicies::DiagramItemSemanticEditPolicy::getDuplicateCommand-»
-
- «EXPAND xpt::diagram::editpolicies::DiagramItemSemanticEditPolicy::DuplicateAnythingCommand-»
-
- «EXPAND xpt::diagram::editpolicies::DiagramItemSemanticEditPolicy::additions-»
-}
-«ENDAROUND»
-
-«REM» Mutating canvas create commands «ENDREM»
-«DEFINE childMutatingContainerCreateCommand FOR gmfgen::GenDiagram»
- «IF !topLevelNodes.isEmpty()-»
-
- «EXPAND createMutatingSwitch FOR this»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- «REM»fjcano:: we set a parameter in the request to pass the Diagram «ENDREM»
- org.eclipse.gmf.runtime.notation.Diagram diagram = es.cv.gvcase.mdt.common.util.DiagramEditPartsUtil.findDiagramFromEditPart(getHost());
- if (diagram != null) {
- req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, diagram);
- }
- org.eclipse.emf.ecore.EObject canvasElement = es.cv.gvcase.mdt.common.part.DiagramCanvasSwitch.getCanvasElement(this);
- if (canvasElement == null) {
- return null;
- }
- aSwitch.setInfo(req.getElementType());
- req.setContainmentFeature(aSwitch.doSwitch(canvasElement));
- «EXPAND childNodeCreateCommand FOREACH topLevelNodes-»
- return super.getCreateCommand(req);
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE childNodeCreateCommand FOR gmfgen::GenNode-»
- «EXPAND childNodeCreateCommand(this) FOR modelFacet-»
-«ENDDEFINE»
-
-«DEFINE childNodeCreateCommand(gmfgen::GenNode node) FOR gmfgen::TypeModelFacet-»
- if («node.getDiagram().getElementTypesQualifiedClassName()».«node.getUniqueIdentifier()» == req.getElementType()) {
- return getGEFWrapper(«node.getCreateCommandQualifiedClassName()».create(req, canvasElement));
- }
-«ENDDEFINE»
-
-«REM» Mutating canvas Switch to create command «ENDREM»
-«DEFINE createMutatingSwitch FOR gmfgen::GenDiagram»
-
- «EXPAND xpt::Common::generatedMemberComment»
- static class EReferenceDiagramSwitch extends es.cv.gvcase.mdt.common.util.BasicEcoreSwitch<org.eclipse.emf.ecore.EReference, org.eclipse.gmf.runtime.emf.type.core.IElementType> {
- @Override
- public org.eclipse.emf.ecore.EReference doSwitch(org.eclipse.emf.ecore.EObject modelElement) {
- «REM»getInfo provides the View«ENDREM»
- final org.eclipse.gmf.runtime.emf.type.core.IElementType type = getInfo();
- if (type == null) {
- return null;
- }
- «getModelSwitchQualifiedName(domainDiagramElement)»<org.eclipse.emf.ecore.EReference> aSwitch = new «getModelSwitchQualifiedName(domainDiagramElement)»<org.eclipse.emf.ecore.EReference>() {
- @Override
- public org.eclipse.emf.ecore.EReference case«domainDiagramElement.ecoreClass.name»(«getQualifiedInterfaceName(domainDiagramElement)» modelElement) {
- org.eclipse.emf.ecore.EReference reference = null;
- «FOREACH topLevelNodes AS node-»
- if (type.equals(«node.getDiagram().getElementTypesQualifiedClassName()».«node.getUniqueIdentifier()»)) {
- reference = «EXPAND MetaModel::MetaFeature FOR node.modelFacet.containmentMetaFeature»;
- }
- «ENDFOREACH-»
- return reference;
- }
- «FOREACH getReferencingObjects().typeSelect(AlternateCanvas) AS referencer»
- @Override
- public org.eclipse.emf.ecore.EReference case«referencer.domainDiagramElement.ecoreClass.name»(«getQualifiedInterfaceName(referencer.domainDiagramElement)» modelElement) {
- org.eclipse.emf.ecore.EReference reference = null;
- «FOREACH referencer.alternateTopLevelNodes AS node-»
- if (type.equals(«node.genTopLevelNode.getDiagram().getElementTypesQualifiedClassName()».«node.genTopLevelNode.getUniqueIdentifier()»)) {
- reference = «EXPAND MetaModel::MetaFeature FOR node.typeModelFacet.containmentMetaFeature-»;
- }
- «ENDFOREACH-»
- return reference;
- }
- «ENDFOREACH-»
- };
-
- return aSwitch.doSwitch(modelElement);
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private EReferenceDiagramSwitch aSwitch = new EReferenceDiagramSwitch();
-«ENDDEFINE»
-
-«DEFINE getDuplicateCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- org.eclipse.gmf.runtime.notation.Diagram currentDiagram = null;
- if(getHost()instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) {
- currentDiagram = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)getHost()).getNotationView().getDiagram();
- }
- return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req, currentDiagram));
-}
-«ENDDEFINE»
-
-«DEFINE DuplicateAnythingCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private static class DuplicateAnythingCommand extends org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand {
-
- private org.eclipse.gmf.runtime.notation.Diagram diagram;
-
- «EXPAND DAC_constructor-»
-
- «EXPAND DAC_additions-»
-}
-«ENDDEFINE»
-
-«DEFINE DAC_constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public DuplicateAnythingCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req, org.eclipse.gmf.runtime.notation.Diagram currentDiagram) {
- super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());
- this.diagram = currentDiagram;
-}
-«ENDDEFINE»
-
-«DEFINE DAC_additions FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-//code used in MOSKitt approach in order to manage "delete from diagram"
-//@Override
-//protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor progressMonitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
-// org.eclipse.gmf.runtime.common.core.command.CommandResult result = super.doExecuteWithResult(progressMonitor, info);
-// java.util.List objectsToBeShown = new java.util.ArrayList();
-// for(java.lang.Object duplicatedObject: this.getAllDuplicatedObjectsMap().keySet()) {
-// if(duplicatedObject instanceof org.eclipse.emf.ecore.EObject) {
-// if(es.cv.gvcase.mdt.common.util.MultiDiagramUtil.findEObjectReferencedInEAnnotation(diagram, (org.eclipse.emf.ecore.EObject)duplicatedObject)) {
-// es.cv.gvcase.mdt.common.util.MultiDiagramUtil.AddEAnnotationReferenceToDiagram(diagram, (org.eclipse.emf.ecore.EObject)this.getAllDuplicatedObjectsMap().get(duplicatedObject));
-// }
-// }
-// }
-// return result;
-//}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/updater/DiagramUpdater.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/updater/DiagramUpdater.xpt deleted file mode 100644 index c81312f1aaf..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/diagram/updater/DiagramUpdater.xpt +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2007, 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: - * Alexander Shatalin (Borland) - initial API and implementation - */ - -«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» -«IMPORT "http://www.eclipse.org/emf/2002/GenModel"» -«IMPORT "http://www.eclipse.org/emf/2002/Ecore"» -«IMPORT "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension"» - -«EXTENSION MetaModel» -«EXTENSION xpt::EMFUtils» -«EXTENSION xpt::diagram::updater::Utils» -«EXTENSION xpt::diagram::editpolicies::LinkUtils» -«EXTENSION xpt::GenModelUtils» -«EXTENSION xpt::mutatingUtils» - -«REM»Mutating Canvas :: semantic children of diagram must select the correct features depending on the element that is the actual canvas«ENDREM» -«REM»@author :: fjcano (C) 2008«ENDREM» -«AROUND getSemanticChildrenOfView FOR gmfgen::GenContainerBase-» - «IF GenDiagram.isInstance(this) && getReferencingObjects().typeSelect(AlternateCanvas).size() > 0» -«REM» - The switch that performs the correct job according to the canvas' EObject -«ENDREM» - «EXPAND createUpdaterSwitch FOR this» - «REM»The canvas get method that depends on the Switch«ENDREM» - «EXPAND xpt::Common::generatedMemberComment» - public static java.util.List «EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodName»(org.eclipse.gmf.runtime.notation.View view) { - «IF getSemanticChildrenChildFeatures(this).size() > 0 || getPhantomNodes(this).size() > 0-» - «EXPAND defineModelElement-» - aSwitch.setInfo(view); - java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> result = aSwitch.doSwitch(modelElement); - if (result == null || result.size() <= 0) { - return java.util.Collections.EMPTY_LIST; - } - «IF !getPhantomNodes(this).isEmpty()-» - org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource(); - for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) { - org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next(); - if (childElement == modelElement) { - continue; - } - «EXPAND addNextIfPhantom FOREACH getPhantomNodes(this)-» - } - «ENDIF-» - return result; - «ELSE-» - return java.util.Collections.EMPTY_LIST; - «ENDIF-» - } - «ELSE» - «targetDef.proceed()-» - «ENDIF» -«ENDAROUND» - - -«DEFINE checkChildElementVisualID(boolean inLoop) FOR gmfgen::GenNode-» -if (visualID == «EXPAND xpt::editor::VisualIDRegistry::visualID») { - result.add(new «getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(«IF null != modelFacet.childMetaFeature»«EXPAND MetaModel::DowncastToEObject("childElement") FOR getTypeGenClassX(modelFacet.childMetaFeature)»«ENDIF», visualID)); -«IF inLoop-» - continue; -«ENDIF-» -} -«ENDDEFINE» - - -«REM»The EcoreSwitch that will navigate the proper features according to the canvas' EObject«ENDREM» -«DEFINE createUpdaterSwitch FOR gmfgen::GenDiagram» -«EXPAND xpt::Common::generatedMemberComment» - static class ThisDiagramUpdaterSwitch extends es.cv.gvcase.mdt.common.util.BasicEcoreSwitch<java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>, org.eclipse.gmf.runtime.notation.View> { - @Override - public java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> doSwitch(org.eclipse.emf.ecore.EObject modelElement) { - «REM»getInfo provides the View«ENDREM» - final org.eclipse.gmf.runtime.notation.View view = getInfo(); - if (view == null) { - return java.util.Collections.EMPTY_LIST; - } - - «getModelSwitchQualifiedName(domainDiagramElement)»<java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>> aSwitch = new «getModelSwitchQualifiedName(domainDiagramElement)»<java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>>() { - «REM»Start of cases«ENDREM» - @Override - public java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> case«domainDiagramElement.ecoreClass.name»(«EXPAND MetaModel::MetaClass FOR domainDiagramElement» modelElement) { - java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> result = new java.util.LinkedList<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>(); - «FOREACH getSemanticChildrenChildFeatures(this) AS childMetaFeature-» - «IF null == childMetaFeature-» - { /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify Class here manually*/ childElement = /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/; - «ELSEIF isListType(childMetaFeature)-» - for (java.util.Iterator it = «EXPAND xpt::Common::getFeatureValue("modelElement", getModelElementType()) FOR childMetaFeature».iterator(); it.hasNext();) { - «EXPAND MetaModel::MetaClass FOR getTypeGenClassX(childMetaFeature)» childElement = («getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))») it.next(); - «ELSE-» - { «getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))» childElement = «EXPAND xpt::Common::getFeatureValue("modelElement", getModelElementType()) FOR childMetaFeature»; - «ENDIF-» - int visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, «EXPAND xpt::Common::castToEObject FOR getTypeGenClassX(childMetaFeature)»childElement); - «EXPAND checkChildElementVisualID(null != childMetaFeature && isListType(childMetaFeature)) FOREACH getSemanticChildren(this, childMetaFeature)-» - } - «ENDFOREACH-» - «IF !getPhantomNodes(this).isEmpty()-» - org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource(); - for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) { - org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next(); - if (childElement == modelElement) { - continue; - } - «EXPAND addNextIfPhantom FOREACH getPhantomNodes(this)-» - } - «ENDIF-» - return result; - } - - «FOREACH getReferencingObjects().typeSelect(AlternateCanvas) AS referencer» - @Override - public java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> case«referencer.domainDiagramElement.ecoreClass.name»(«getQualifiedInterfaceName(referencer.domainDiagramElement)» modelElement) { - java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> result = new java.util.LinkedList<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>(); - «REM»«FOREACH getSemanticChildrenChildFeatures(this) AS childMetaFeature-»«ENDREM» - «FOREACH getMutatingChildrenFeatures(referencer) AS childMetaFeature-» - «IF null == childMetaFeature-» - { /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify Class here manually*/ childElement = /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/; - «ELSEIF isListType(childMetaFeature)-» - for (java.util.Iterator it = «EXPAND xpt::Common::getFeatureValue("modelElement", referencer.domainDiagramElement) FOR childMetaFeature».iterator(); it.hasNext();) { - «getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))» childElement = («getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))») it.next(); - «ELSE-» - { «getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))» childElement = «EXPAND xpt::Common::getFeatureValue("modelElement", referencer.domainDiagramElement) FOR childMetaFeature»; - «ENDIF-» - int visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, «EXPAND xpt::Common::castToEObject FOR getTypeGenClassX(childMetaFeature)»childElement); - «REM»«EXPAND checkChildElementVisualID(null != childMetaFeature && isListType(childMetaFeature)) FOREACH getSemanticChildren(this, childMetaFeature)-»«ENDREM» - «EXPAND checkMutatingChildElementVisualID(null != childMetaFeature && isListType(childMetaFeature)) FOREACH getMutatingSemanticChildren(referencer, childMetaFeature)-» - } - «ENDFOREACH-» - «REM»«IF !getPhantomNodes(this).isEmpty()-» - org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource(); - for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) { - org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next(); - if (childElement == modelElement) { - continue; - } - «EXPAND addNextIfPhantom FOREACH getPhantomNodes(this)-» - } - «ENDIF-» - «ENDREM» - return result; - } - «ENDFOREACH» - - «REM»End of cases«ENDREM» - }; - return aSwitch.doSwitch(modelElement); - } - }; - - «REM»The global variable for a Switch«ENDREM» - «EXPAND xpt::Common::generatedMemberComment» - private static ThisDiagramUpdaterSwitch aSwitch = new ThisDiagramUpdaterSwitch(); -«ENDDEFINE» - -«REM» Mutating check Visual ID «ENDREM» -«DEFINE checkMutatingChildElementVisualID(boolean inLoop) FOR papyrusgmfgenextension::AlternateGenTopLevelNode-» - if (visualID == «EXPAND visualID») { - result.add(new «genTopLevelNode.getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(«IF null != typeModelFacet.childMetaFeature»«EXPAND xpt::Common::castToEObject FOR getTypeGenClassX(typeModelFacet.childMetaFeature)»«ENDIF»childElement, visualID)); - «IF inLoop-» - continue; - «ENDIF-» - } -«ENDDEFINE» - -«REM» Mutating VisualID espansion «ENDREM» -«DEFINE visualID FOR papyrusgmfgenextension::AlternateGenTopLevelNode» - «EXPAND xpt::editor::VisualIDRegistry::visualID FOR genTopLevelNode» -«ENDDEFINE» - -«DEFINE defineModelElement FOR gmfgen::GenContainerBase-» -if (!view.isSetElement()) { - return java.util.Collections.EMPTY_LIST; -} -«EXPAND MetaModel::DeclareAndAssign("modelElement", "view.getElement()") FOR getModelElementType()» -«ENDDEFINE» - -«DEFINE getContainedLinksByTypeMethodBody(gmfgen::GenLink genLink, boolean sourceVarDefined) FOR gmfgen::TypeLinkModelFacet-» -java.util.Collection result = new java.util.LinkedList(); - «LET childMetaFeature.isListType() AS inLoop-» -«IF inLoop-» -for (java.util.Iterator links = «EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR childMetaFeature».iterator(); links.hasNext();) { - org.eclipse.emf.ecore.EObject linkObject = (org.eclipse.emf.ecore.EObject ) links.next(); - if («EXPAND MetaModel::NotInstance("linkObject") FOR metaClass») { - continue; - } - «EXPAND MetaModel::DeclareAndAssign("link", "linkObject") FOR metaClass» -«ELSE-» - «IF getTypeGenClassX(childMetaFeature) == metaClass-» - «EXPAND MetaModel::DeclareAndAssign("link", "container", getSourceType(), childMetaFeature) FOR metaClass» - «ELSE-» - «EXPAND MetaModel::DeclareAndAssign("linkObject", "container", getSourceType(), childMetaFeature) FOR getTypeGenClassX(childMetaFeature)» - if («EXPAND MetaModel::NotInstance("linkObject") FOR metaClass») { - return result; - } - «EXPAND MetaModel::DeclareAndAssign("link", "linkObject") FOR metaClass» - «ENDIF-» -«ENDIF-» - «EXPAND checkLinkVisualID(genLink, inLoop)-» - - «REM»BEGIN: PapyrusGenCode«ENDREM» - «REM»Test if the source and target reference the same feature, in this case generation with collection«ENDREM» - - «IF this.sourceMetaFeature==this.targetMetaFeature» - //Papyrus GenCode - «EXPAND defineLinkDestinationForSet(inLoop)-» - «IF null != sourceMetaFeature-» - «EXPAND defineLinkSource(inLoop)-» - «IF sourceVarDefined-» - «EXPAND checkLinkSource(inLoop)-» - «ENDIF-» - «EXPAND addLinkDescriptor(genLink, "src", "dst")-» - «ELSE-» - «EXPAND addLinkDescriptor(genLink, "container", "dst")-» - «ENDIF-» - «ELSE» - «REM»END: PapyrusGenCode«ENDREM» - «EXPAND defineLinkDestination(inLoop)-» - «IF null != sourceMetaFeature-» - «EXPAND defineLinkSource(inLoop)-» - «IF sourceVarDefined-» - «EXPAND checkLinkSource(inLoop)-» - «ENDIF-» - «EXPAND addLinkDescriptor(genLink, "src", "dst")-» - «ELSE-» - «EXPAND addLinkDescriptor(genLink, "container", "dst")-» - «ENDIF-» - «REM»BEGIN: PapyrusGenCode«ENDREM» - «ENDIF-» - «REM»END: PapyrusGenCode«ENDREM» -«IF inLoop-» -} -«ENDIF-» - «ENDLET-» -return result; -«ENDDEFINE» - -«DEFINE defineLinkSource(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-» - «IF sourceMetaFeature.isListType()-» -java.util.List sources = «EXPAND MetaModel::getFeatureValue("link", metaClass) FOR sourceMetaFeature»; -«REM»BEGIN: PapyrusGenCode«ENDREM» -«REM»In the case of set greater that 1! not equal«ENDREM» -Object theSource = sources.size() >= 1 ? sources.get(0) : null; -«REM»END: PapyrusGenCode«ENDREM» -if («EXPAND MetaModel::NotInstance("theSource") FOR getSourceType()») { - «EXPAND stopLinkProcessing(inLoop)-» -} -«EXPAND MetaModel::DeclareAndAssign("src", "theSource", true) FOR getSourceType()» - «ELSE-» -«EXPAND MetaModel::DeclareAndAssign("src", "link", metaClass, sourceMetaFeature) FOR getSourceType()» - «ENDIF-» -«ENDDEFINE» - -«DEFINE checkLinkSource(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-» -if (src != source) { - «EXPAND stopLinkProcessing(inLoop)-» -} -«ENDDEFINE» -«REM»BEGIN: PapyrusGenCode«ENDREM» -«REM»Define target and source that can manage set«ENDREM» -«DEFINE defineLinkDestinationForSet(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-» - «IF targetMetaFeature.isListType()-» -java.util.List targets = «EXPAND MetaModel::getFeatureValue("link", metaClass) FOR targetMetaFeature»; -Object theTarget = targets.size() >=2 ? targets.get(1) : null; -if («EXPAND MetaModel::NotInstance("theTarget") FOR getTargetType()») { - «EXPAND stopLinkProcessing(inLoop)-» -} -«EXPAND MetaModel::DeclareAndAssign("dst", "theTarget", true) FOR getTargetType()» - «ELSE-» -«EXPAND MetaModel::DeclareAndAssign("dst", "link", metaClass, targetMetaFeature) FOR getTargetType()» - «ENDIF-» -«ENDDEFINE» -«REM»END: PapyrusGenCode«ENDREM» diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/editor/ViewInfoUtils.ext b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/editor/ViewInfoUtils.ext deleted file mode 100644 index 20835f32dcf..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/editor/ViewInfoUtils.ext +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 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: - * Alexander Shatalin (Borland) - initial API and implementation - */ - -import "http://www.eclipse.org/gmf/2008/GenModel"; -import "http://www.eclipse.org/emf/2002/Ecore"; -import "http://www.eclipse.org/emf/2002/GenModel"; - -String diagramViewInfoGetterName(gmfgen::GenDiagram diagram) : - cleanString("get"+diagram.domainDiagramElement.ecoreClass.name+"_"+diagram.visualID.toString()+"ViewInfo") -; - -String nodeViewInfoGetterName(gmfgen::GenNode node) : - cleanString("get"+node.modelFacet.metaClass.ecoreClass.name+"_"+node.visualID.toString()+"ViewInfo") -; - -String nodeViewInfoGetterName(gmfgen::GenCompartment compartment) : - cleanString("get"+compartment.title+"_"+compartment.visualID.toString()+"ViewInfo") -; - -String linkViewInfoGetterName(gmfgen::GenLink link) : - cleanString("get"+linkEClass(link.modelFacet)+"_"+link.visualID.toString()+"ViewInfo") -; - -String linkEClass(gmfgen::TypeModelFacet facet) : - cleanString(facet.metaClass.ecoreClass.name) -; - -String linkEClass(gmfgen::ModelFacet facet) : - "" -; - - -String featureForLinkGetter(gmfgen::ModelFacet facet) : - "" -; - -String featureForLinkGetter(gmfgen::FeatureLinkModelFacet facet) : - cleanString(facet.metaFeature.ecoreFeature.name) -; - -String cleanString(String string) : - string.replaceAll(" ", "_") -; - -String getContainerVidualID(gmfgen::GenNode node) : - node.visualID.toString() -; - -String getContainerVidualID(gmfgen::GenCompartment compartment) : - compartment.node.visualID.toString() -; diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/editor/VisualIDRegistry.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/editor/VisualIDRegistry.xpt deleted file mode 100644 index 58919d3143f..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/editor/VisualIDRegistry.xpt +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2007, 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: - * Alexander Shatalin (Borland) - initial API and implementation - */ - -«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» -«IMPORT "http://www.eclipse.org/emf/2002/Ecore"» -«IMPORT "http://www.eclipse.org/emf/2002/GenModel"» -«IMPORT "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension"» - -«EXTENSION MetaModel» -«EXTENSION xpt::EMFUtils» -«EXTENSION xpt::editor::Utils» -«EXTENSION xpt::GenModelUtils» -«EXTENSION xpt::diagram::editpolicies::LinkUtils» -«EXTENSION xpt::expressions::ValueExpression» -«EXTENSION xpt::editor::ViewInfoUtils» - -«REM»DOCUMENTATION: PapyrusGencode«ENDREM» -«REM» install the mecanism of "filters views..." view for subelements«ENDREM» -«REM» and [MutatingCanvas] With mutating canvas multiple elements can be the canvas' element «ENDREM» - -«DEFINE VisualIDRegistry FOR gmfgen::GenDiagram-» - «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-» -package «editorGen.editor.packageName»; - - «EXPAND xpt::Common::generatedClassComment( - "This registry is used to determine which type of visual object should be\n" + - "created for the corresponding Diagram, Node, ChildNode or Link represented\n" + - "by a domain model object.\n" - )» -public class «visualIDRegistryClassName» { - - «EXPAND attributes-» - - «EXPAND getViewVisualID-» - - «EXPAND getModelID-» - - «EXPAND getVisualID-» - - «EXPAND getType-» - - «EXPAND getDiagramVisualID-» - - «EXPAND getNodeVisualID-» - - «EXPAND canCreateNode-» - - «EXPAND getLinkWithClassVisualID-» - - «EXPAND isDiagram-» - - «EXPAND _constraintMethods-» - - «EXPAND additions-» - //test - «EXPAND createViewInfo-» -} -«ENDDEFINE» - -«AROUND getDiagramVisualID FOR gmfgen::GenDiagram-» - «EXPAND xpt::Common::generatedMemberComment» -public static int «EXPAND xpt::editor::VisualIDRegistry::getDiagramVisualIDMethodName»(org.eclipse.emf.ecore.EObject domainElement) { - if (domainElement == null) { - «EXPAND xpt::editor::VisualIDRegistry::unrecognizedVID-» - } -«IF null != domainDiagramElement-» - «EXPAND xpt::editor::VisualIDRegistry::returnVisualID-» -«ENDIF-» - «IF getReferencingObjects().typeSelect(AlternateCanvas).size() > 0» - «FOREACH getReferencingObjects().typeSelect(AlternateCanvas) AS referencer» - «EXPAND returnMutatingVisualID FOR referencer» - «ENDFOREACH» - «ENDIF» - «EXPAND xpt::editor::VisualIDRegistry::unrecognizedVID-» -} -«ENDAROUND» - -«AROUND additions FOR gmfgen::GenDiagram» -«REM» [ViewInfo] Added to alow filtering the views by type and/or label «ENDREM» -«EXPAND createViewInfo FOR this» -«ENDAROUND» - -«REM»[MutatingCanvas]«ENDREM» -«DEFINE returnMutatingVisualID FOR papyrusgmfgenextension::AlternateCanvas-» -if («EXPAND checkMutatingSemanticElement») { - return «EXPAND xpt::editor::VisualIDRegistry::visualID FOR diagram»; -} -«ENDDEFINE» - -«REM»[MutatingCanvas]«ENDREM» -«DEFINE checkMutatingSemanticElement FOR papyrusgmfgenextension::AlternateCanvas-» - «EXPAND xpt::editor::VisualIDRegistry::checkDomainElementMetaclass FOR domainDiagramElement» && - «EXPAND xpt::editor::VisualIDRegistry::isDiagramMethodName FOR diagram»((«EXPAND MetaModel::MetaClass FOR domainDiagramElement») domainElement) -«ENDDEFINE» - -«DEFINE isDiagramMethodName FOR gmfgen::GenDiagram»isDiagram«ENDDEFINE» - -«AROUND isDiagram FOR gmfgen::GenDiagram-» - «IF null != domainDiagramElement-» - «EXPAND xpt::Common::generatedMemberComment( - "User can change implementation of this method to handle some specific\n" + - "situations not covered by default logic.\n" - )» -private static boolean «EXPAND xpt::editor::VisualIDRegistry::isDiagramMethodName»(«getQualifiedInterfaceName(domainDiagramElement)» element) { - return true; -} - «REM»[MutatingCanvas]«ENDREM» - «IF getReferencingObjects().typeSelect(AlternateCanvas).size() > 0» - «FOREACH getReferencingObjects().typeSelect(AlternateCanvas) AS referencer» - private static boolean «EXPAND xpt::editor::VisualIDRegistry::isDiagramMethodName»(«getQualifiedInterfaceName(referencer.domainDiagramElement)» element) { - return true; - } - «ENDFOREACH» - «ENDIF» - «ENDIF-» -«ENDAROUND» - -«DEFINE createViewInfo FOR gmfgen::GenDiagram» - «REM» [ViewInfo] Added to alow filtering the views by type and/or label «ENDREM» - - «REM» [ViewInfo] Diagram visual info for filtering dialog «ENDREM» - «EXPAND xpt::Common::generatedMemberComment» - private static org.eclipse.papyrus.diagram.common.providers.ViewInfo diagramViewInfo = null; - - «REM» [ViewInfo] ViewInfo tree construction «ENDREM» - «EXPAND xpt::Common::generatedMemberComment» - public static org.eclipse.papyrus.diagram.common.providers.ViewInfo getDiagramViewInfo() { - if (diagramViewInfo == null) { - diagramViewInfo = «diagramViewInfoGetterName(this)»(); - } - return diagramViewInfo; - } - - «REM» [ViewInfo] Start point to build all ViewInfo tree «ENDREM» - «EXPAND getRootDiagramViewInfo FOR this-» -«ENDDEFINE» - -«REM» [ViewInfo] Start point for all ViewInfo tree «ENDREM» -«DEFINE getRootDiagramViewInfo FOR gmfgen::GenDiagram» - «EXPAND xpt::Common::generatedMemberComment» - protected static org.eclipse.papyrus.diagram.common.providers.ViewInfo «diagramViewInfoGetterName(this)»() { - org.eclipse.papyrus.diagram.common.providers.ViewInfo root = new org.eclipse.papyrus.diagram.common.providers.BaseViewInfo(«visualID», org.eclipse.papyrus.diagram.common.providers.ViewInfo.Head, "", null, null); - org.eclipse.papyrus.diagram.common.providers.ViewInfo viewInfo = null; - org.eclipse.papyrus.diagram.common.providers.ViewInfo labelInfo = null; - «FOREACH topLevelNodes AS node-» - «EXPAND createNodeViewInfo FOR node-» - «ENDFOREACH-» - «FOREACH links AS link-» - «EXPAND createLinkViewInfo FOR link-» - «ENDFOREACH-» - «FOREACH childNodes AS node-» - «EXPAND createNodeViewInfo FOR node-» - «ENDFOREACH-» - return root; - } -«ENDDEFINE» - -«REM» [ViewInfo] Create a node ViewInfo «ENDREM» -«DEFINE createNodeViewInfo FOR gmfgen::GenTopLevelNode» - viewInfo = new org.eclipse.papyrus.diagram.common.providers.BaseViewInfo(«visualID», org.eclipse.papyrus.diagram.common.providers.ViewInfo.Node, "«modelFacet.metaClass.ecoreClass.name»"); - root.addNode(«diagram.visualID.toString()», viewInfo); -«ENDDEFINE» - -«REM» [ViewInfo] Create a node ViewInfo «ENDREM» -«DEFINE createNodeViewInfo FOR gmfgen::GenChildNode» - viewInfo = new org.eclipse.papyrus.diagram.common.providers.BaseViewInfo(«visualID», org.eclipse.papyrus.diagram.common.providers.ViewInfo.Node, "«modelFacet.metaClass.ecoreClass.name»"); - «FOREACH containers AS container» - root.addNode(«getContainerVidualID(container)», viewInfo); - «ENDFOREACH» -«ENDDEFINE» - -«REM» [ViewInfo] Create a node ViewInfo «ENDREM» -«DEFINE createNodeViewInfo FOR gmfgen::GenCompartment» - viewInfo = new org.eclipse.papyrus.diagram.common.providers.BaseViewInfo(«visualID», org.eclipse.papyrus.diagram.common.providers.ViewInfo.Node, "«title»", null, parent); - viewInfos.add(viewInfo); -«ENDDEFINE» - -«REM» [ViewInfo] Create a link ViewInfo «ENDREM» -«DEFINE createLinkViewInfo FOR gmfgen::GenLink» - viewInfo = new org.eclipse.papyrus.diagram.common.providers.BaseViewInfo(«visualID», org.eclipse.papyrus.diagram.common.providers.ViewInfo.Edge, "«linkEClass(modelFacet)»"); - root.addNode(«diagram.visualID.toString()», viewInfo); - «FOREACH labels AS label» - «EXPAND createLabelViewInfo FOR label-» - «ENDFOREACH» -«ENDDEFINE» - -«REM» [ViewInfo] Create a label ViewInfo «ENDREM» -«REM»not used. may be used in the future«ENDREM» -«DEFINE createLabelViewInfo FOR gmfgen::GenLabel» - labelInfo = new org.eclipse.papyrus.diagram.common.providers.BaseViewInfo(«visualID», org.eclipse.papyrus.diagram.common.providers.ViewInfo.Label, "«linkEClass(modelFacet)»", null, viewInfo); - viewInfo.getChildren().add(labelInfo); -«ENDDEFINE» - -«DEFINE getTypeMethodName FOR gmfgen::GenDiagram»getType«ENDDEFINE» - -«DEFINE typeMethodCall(String visualIdVar) FOR gmfgen::GenCommonBase» -«getDiagram().getVisualIDRegistryQualifiedClassName()».«EXPAND getTypeMethodName FOR getDiagram()»(«visualIdVar») -«ENDDEFINE» -«DEFINE typeMethodCall FOR gmfgen::GenCommonBase» -«getDiagram().getVisualIDRegistryQualifiedClassName()».«EXPAND getTypeMethodName FOR getDiagram()»(«EXPAND visualID») -«ENDDEFINE» - diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/mutatingUtils.ext b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/mutatingUtils.ext deleted file mode 100644 index af63a1e465f..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/mutatingUtils.ext +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * - */ - -import "http://www.eclipse.org/gmf/2006/GenModel"; -import "http://www.eclipse.org/emf/2002/GenModel"; -import "http://www.eclipse.org/emf/2002/Ecore"; -import "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension"; - - -String getModelSwitchQualifiedName(genmodel::GenClass gc) : - gc.genPackage.basePackage + "." + gc.genPackage.ecorePackage.name + "." + gc.genPackage.utilityPackageSuffix + "." + gc.genPackage.prefix + "Switch" -; - - -Set[genmodel::GenFeature] getMutatingChildrenFeatures(papyrusgmfgenextension::AlternateCanvas referencer) : - getMutatingNonPhantomSemanticChildren(referencer).collect(node | node.typeModelFacet.childMetaFeature).toSet() -; - -List[papyrusgmfgenextension::AlternateGenNode] getMutatingSemanticChildren(papyrusgmfgenextension::AlternateCanvas referencer, genmodel::GenFeature childMetaFeature) : - getMutatingNonPhantomSemanticChildren(referencer).select(node | node.typeModelFacet.childMetaFeature == childMetaFeature) -; - -List[papyrusgmfgenextension::AlternateGenNode] getMutatingNonPhantomSemanticChildren(papyrusgmfgenextension::AlternateCanvas referencer) : - getMutatingSemanticChildren(referencer).select(node | !node.genTopLevelNode.modelFacet.isPhantomElement()) -; - -List[papyrusgmfgenextension::AlternateGenNode] getMutatingSemanticChildren(papyrusgmfgenextension::AlternateCanvas referencer) : - referencer.alternateTopLevelNodes.select(node | node.genTopLevelNode.modelFacet != null) -; - diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/navigator/NavigatorContentProvider.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/navigator/NavigatorContentProvider.xpt deleted file mode 100644 index f11a8be2d95..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/navigator/NavigatorContentProvider.xpt +++ /dev/null @@ -1,530 +0,0 @@ -/*
- * 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Modified by Patrick Tessier (CEA)
- */
-
-«REM»DOCUMENTATION: PapyrusGenCode«ENDREM»
-«REM» this code has been modified in order to avoid generating method that are greater than 64kb«ENDREM»
-«REM»see lines 275, 428, 491, 498«ENDREM»
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::navigator::Utils»
-
-«DEFINE NavigatorContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «contentProviderClassName» implements org.eclipse.ui.navigator.ICommonContentProvider {
-
- «EXPAND attributes-»
-
- «EXPAND constructor-»
-
- «EXPAND genAllMethodNodeCase-»
-
- «EXPAND iContentProvider-»
-
- «EXPAND iStructuredContentProvider-»
-
- «EXPAND iMementoAware-»
-
- «EXPAND iCommonContentProvider-»
-
- «EXPAND iTreeContentProvider-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private static final Object[] EMPTY_ARRAY = new Object[0];
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.jface.viewers.Viewer myViewer;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain myEditingDomain;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.workspace.util.WorkspaceSynchronizer myWorkspaceSynchronizer;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private Runnable myViewerRefreshRunnable;
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «contentProviderClassName»() {
- «EXPAND initCommonAttributes-»
-}
-«ENDDEFINE»
-
-«DEFINE initCommonAttributes FOR gmfgen::GenNavigator-»
-org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «EXPAND createEditingDomain»;
-myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain;
-myEditingDomain.setResourceToReadOnlyMap(new java.util.HashMap() {
- public Object get(Object key) {
- if (!containsKey(key)) {
- put(key, Boolean.TRUE);
- }
- return super.get(key);
- }
-});
-myViewerRefreshRunnable = new Runnable() {
- public void run() {
- if (myViewer != null) {
- myViewer.refresh();
- }
- }
-};
-myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() {
- public void dispose() {
- }
-
- public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
- «EXPAND processChanges-»
- }
-
- public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
- «EXPAND processChanges-»
- }
-
- public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
- «EXPAND processChanges-»
- }
-});
-«ENDDEFINE»
-
-«DEFINE processChanges FOR gmfgen::GenNavigator-»
-for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- nextResource.unload();
-}
-if (myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
-}
-return true;
-«ENDDEFINE»
-
-«DEFINE iContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND dispose-»
-
- «EXPAND inputChanged-»
-«ENDDEFINE»
-
-«DEFINE dispose FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
- myWorkspaceSynchronizer.dispose();
- myWorkspaceSynchronizer = null;
- myViewerRefreshRunnable = null;
- for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- resource.unload();
- }
- ((org.eclipse.emf.transaction.TransactionalEditingDomain) myEditingDomain).dispose();
- myEditingDomain = null;
-}
-«ENDDEFINE»
-
-«DEFINE inputChanged FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
- myViewer = viewer;
-}
-«ENDDEFINE»
-
-«DEFINE iStructuredContentProvider FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
-}
-«ENDDEFINE»
-
-«DEFINE iMementoAware FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public void restoreState(org.eclipse.ui.IMemento aMemento) {
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-public void saveState(org.eclipse.ui.IMemento aMemento) {
-}
-«ENDDEFINE»
-
-«DEFINE iCommonContentProvider FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
-}
-«ENDDEFINE»
-
-«DEFINE iTreeContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND getChildren-»
-
- «EXPAND getParent-»
-
- «EXPAND hasChildren-»
-«ENDDEFINE»
-
-«DEFINE getChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof org.eclipse.core.resources.IFile) {
- «EXPAND getFileChildren-»
- }
-
- if (parentElement instanceof «getNavigatorGroupQualifiedClassName()») {
- «EXPAND getGroupChildren-»
- }
-
- if (parentElement instanceof «getNavigatorItemQualifiedClassName()») {
- «EXPAND getItemChildren-»
- }
-
- «IF editorGen.diagram.generateShortcutIcon()-»
- «EXPAND getAdaptableChildren»
- «ENDIF-»
- «EXPAND getOtherChildren-»
-}
-
- «EXPAND getViewChildren-»
-
- «EXPAND utilityMethods-»
-«ENDDEFINE»
-
-«DEFINE getParent FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object getParent(Object element) {
- if (element instanceof «getAbstractNavigatorItemQualifiedClassName()») {
- «getAbstractNavigatorItemQualifiedClassName()» abstractNavigatorItem = («getAbstractNavigatorItemQualifiedClassName()») element;
- return abstractNavigatorItem.getParent();
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE hasChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public boolean hasChildren(Object element) {
- return element instanceof org.eclipse.core.resources.IFile || getChildren(element).length > 0;
-}
-«ENDDEFINE»
-
-«DEFINE getFileChildren FOR gmfgen::GenNavigator-»
- «EXPAND getFileResoruce-»
-java.util.Collection result = new java.util.ArrayList();
- «LET getChildReferencesFrom(this, null) AS references-»
- «EXPAND initGroupVariables(this, references, 'file', null) FOREACH getGroupNames(references)-»
- «FOREACH references AS ref-»
- «EXPAND addNavigatorItemsPrefix FOR ref»selectViewsByType(resource.getContents(), «EXPAND getChildViewType FOR ref.child»)«EXPAND addNavigatorItemsSuffix('file', false) FOR ref-»
- «ENDFOREACH-»
- «EXPAND addGroups(references) FOREACH getGroupNames(references)-»
- «ENDLET-»
-return result.toArray();
-«ENDDEFINE»
-
-«DEFINE getFileResoruce FOR gmfgen::GenNavigator-»
-org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) parentElement;
-org.eclipse.emf.common.util.URI fileURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
-org.eclipse.emf.ecore.resource.Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
-«ENDDEFINE»
-
-«DEFINE getGroupChildren FOR gmfgen::GenNavigator-»
-«getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») parentElement;
-return group.getChildren();
-«ENDDEFINE»
-
-«DEFINE getItemChildren FOR gmfgen::GenNavigator-»
-«getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») parentElement;
-if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
- return EMPTY_ARRAY;
-}
-return getViewChildren(navigatorItem.getView(), parentElement);
-«ENDDEFINE»
-
-«DEFINE getAdaptableChildren FOR gmfgen::GenNavigator-»
-/*
- * Due to plugin.xml restrictions this code will be called only for views representing
- * shortcuts to this diagram elements created on other diagrams.
-*/
-if (parentElement instanceof org.eclipse.core.runtime.IAdaptable) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) parentElement).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- if (view != null) {
- return getViewChildren(view, parentElement);
- }
-}
-«ENDDEFINE»
-
-«DEFINE getOtherChildren FOR gmfgen::GenNavigator-»
-return EMPTY_ARRAY;
-«ENDDEFINE»
-
-«DEFINE getViewChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) {
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM» Restructuration of the case «ENDREM»
- «EXPAND caseNavigatorNode(this) FOREACH getNavigatorContainerNodes(this)-»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- }
- return EMPTY_ARRAY;
-}
-«ENDDEFINE»
-
-
-
-«DEFINE utilityMethods FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getLinksSourceByType(java.util.Collection edges, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- org.eclipse.gmf.runtime.notation.View nextEdgeSource = nextEdge.getSource();
- if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
- result.add(nextEdgeSource);
- }
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
- private java.util.Collection getLinksTargetByType(java.util.Collection edges, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- org.eclipse.gmf.runtime.notation.View nextEdgeTarget = nextEdge.getTarget();
- if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
- result.add(nextEdgeTarget);
- }
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
- private java.util.Collection getOutgoingLinksByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getIncomingLinksByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getChildrenByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getChildren(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getDiagramLinksByType(java.util.Collection diagrams, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = diagrams.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Diagram nextDiagram = (org.eclipse.gmf.runtime.notation.Diagram) it.next();
- result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection selectViewsByType(java.util.Collection views, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = views.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (type.equals(nextView.getType()) && isOwnView(nextView)) {
- result.add(nextView);
- }
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
- return «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(view));
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection createNavigatorItems(java.util.Collection views, Object parent, boolean isLeafs) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = views.iterator(); it.hasNext();) {
- result.add(new «getNavigatorItemQualifiedClassName()»((org.eclipse.gmf.runtime.notation.View) it.next(), parent, isLeafs));
- }
- return result;
-}
-«EXPAND getForeignShortcuts-»
-«ENDDEFINE»
-
-«DEFINE getForeignShortcuts FOR gmfgen::GenNavigator-»
- «IF editorGen.diagram.generateCreateShortcutAction() && getChildReferencesFrom(this, editorGen.diagram).size() > 0-»
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = diagram.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
- result.add(nextView);
- }
- }
- return createNavigatorItems(result, parent, false);
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE createEditingDomain FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain()«ENDDEFINE»
-
-«DEFINE initGroupVariables(gmfgen::GenNavigator navigator, List[gmfgen::GenNavigatorChildReference] references, String parentVarName, gmfgen::GenCommonBase contextElement) FOR String-»
- «navigator.getNavigatorGroupQualifiedClassName()» «asValidJavaIdentifier(this)» = new «navigator.getNavigatorGroupQualifiedClassName()»(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForGroup(this, contextElement)) FOR navigator.editorGen»,
- "«getNavigatorReference(this, references).groupIcon»", «parentVarName»); «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE addNavigatorItemsPrefix FOR gmfgen::GenNavigatorChildReference»«IF isInsideGroup()»«asValidJavaIdentifier(groupName)».addChildren(«ELSE»result.addAll(«ENDIF»createNavigatorItems(«ENDDEFINE»
-
-«DEFINE addNavigatorItemsSuffix(String parentVarName, Boolean isLeaf) FOR gmfgen::GenNavigatorChildReference-»
-, «IF isInsideGroup()»«asValidJavaIdentifier(groupName)»«ELSE»«parentVarName»«ENDIF», «isLeaf»));
-«ENDDEFINE»
-
-«DEFINE addGroups(List[gmfgen::GenNavigatorChildReference] references) FOR String-»
- «LET getNavigatorReference(this, references) AS ref-»
- «IF ref.hideIfEmpty-»
- if (!«asValidJavaIdentifier(this)».isEmpty()) {«ENDIF-»
- result.add(«asValidJavaIdentifier(this)»);
- «IF ref.hideIfEmpty-»
- }«ENDIF-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE getChildViewType FOR gmfgen::GenDiagram»«EXPAND xpt::editor::VisualIDRegistry::modelID»«ENDDEFINE»
-
-«DEFINE getChildViewType FOR gmfgen::GenCommonBase»«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»«ENDDEFINE»
-
-«DEFINE caseNavigatorNode(gmfgen::GenNavigator navigator) FOR gmfgen::GenCommonBase»
-«EXPAND xpt::Common::caseVisualID» {
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM» this code has been modified to call directly submethods«ENDREM»
-//modification of the template to avoid mistake of 65kb.
-return getViewChildrenFor«this.editPartClassName»(view, parentElement);
-«REM»END: PapyrusGenCode«ENDREM»
-}
-«ENDDEFINE»
-
-«DEFINE addForeignShortcuts FOR gmfgen::GenDiagram-»
- «IF generateCreateShortcutAction()-»
-result.addAll(getForeignShortcuts((org.eclipse.gmf.runtime.notation.Diagram) view, parentElement));
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addForeignShortcuts FOR gmfgen::GenCommonBase»«ENDDEFINE»
-
-«DEFINE childrenMethodName(gmfgen::GenNavigatorReferenceType referenceType, gmfgen::GenNavigatorPathSegment segment) FOR gmfgen::GenLink-»
- «IF referenceType.value == gmfgen::GenNavigatorReferenceType::out_target.value»getLinksTargetByType«ELSE»getLinksSourceByType«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE childrenMethodName(gmfgen::GenNavigatorReferenceType referenceType, gmfgen::GenNavigatorPathSegment segment) FOR gmfgen::GenCommonBase-»
- «IF referenceType.value == gmfgen::GenNavigatorReferenceType::out_target.value-»
- getOutgoingLinksByType«ELSEIF referenceType.value == gmfgen::GenNavigatorReferenceType::in_source.value-»
- getIncomingLinksByType«ELSE-»
- «IF {segment.from}.typeSelect(gmfgen::GenDiagram).size() > 0 && {segment.to}.typeSelect(gmfgen::GenLink).size() > 0-»
- getDiagramLinksByType«ELSE-»
- getChildrenByType«ENDIF-»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenNavigator-»
- «LET getChildReferencesFrom(this, null) AS references-»
- «EXPAND internal_i18nAccessors(null) FOREACH getGroupNames(references)-»
- «ENDLET-»
- «FOREACH getNavigatorContainerNodes(this) AS contextElement-»
- «LET getChildReferencesFrom(this, contextElement) AS references-»
- «EXPAND internal_i18nAccessors(contextElement) FOREACH getGroupNames(references)-»
- «ENDLET-»
- «ENDFOREACH-»
-«ENDDEFINE»
-
-«DEFINE internal_i18nAccessors(gmfgen::GenCommonBase contextElement) FOR String-»
-«IF null != this»«EXPAND xpt::Externalizer::accessorField(i18nKeyForGroup(contextElement))»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenNavigator-»
-«LET getChildReferencesFrom(this, null) AS references-»
-«EXPAND internal_i18nValues(null) FOREACH getGroupNames(references)-»
-«ENDLET-»
-«FOREACH getNavigatorContainerNodes(this) AS contextElement-»
-«LET getChildReferencesFrom(this, contextElement) AS references-»
-«EXPAND internal_i18nValues(contextElement) FOREACH getGroupNames(references)-»
-«ENDLET-»
-«ENDFOREACH-»
-«ENDDEFINE»
-
-«DEFINE internal_i18nValues(gmfgen::GenCommonBase contextElement) FOR String-»
-«IF null != this»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForGroup(contextElement), this)»«ENDIF-»
-«ENDDEFINE»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Loop to call generator of each method«ENDREM»
-«DEFINE genAllMethodNodeCase FOR gmfgen::GenNavigator-»
-«EXPAND caseMethodNodeNode(this) FOREACH getNavigatorContainerNodes(this)-»
-«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»this template has been modified to fixe bug generation by GMF framework.«ENDREM»
-«REM»Is avoid generated method that are greater than 64Kb«ENDREM»
-// generation on one method
-«DEFINE caseMethodNodeNode(gmfgen::GenNavigator navigator) FOR gmfgen::GenCommonBase»
-/**
- *
- *Papyrus Template
- *this method is a modification of gmf code in order to avoid getViewChidreen() method becoming greater than 64kb.
- *@generated
-**/
-private Object[] getViewChildrenFor«this.editPartClassName»(View view, Object parentElement){
- java.util.Collection result = new java.util.ArrayList();
- «EXPAND addForeignShortcuts FOR this-»
- «LET getChildReferencesFrom(navigator, this) AS references-»
- «EXPAND initGroupVariables(navigator, references, 'parentElement', this) FOREACH getGroupNames(references)-»
- «FOREACH references AS reference ITERATOR referencesIterator-»
- «FOREACH reference.findConnectionPaths() AS path ITERATOR pathsIterator-»
- «FOREACH path.segments AS segment ITERATOR segmentsIterator-»
- «IF referencesIterator.isFirstIteration() && pathsIterator.isFirstIteration() && segmentsIterator.isFirstIteration()»java.util.Collection «ENDIF-»
- connectedViews = «EXPAND childrenMethodName(reference.referenceType, segment) FOR segment.from-»
- («IF segmentsIterator.isFirstIteration()»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF-»
- , «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR segment.to»);
- «ENDFOREACH-»
- «EXPAND addNavigatorItemsPrefix FOR reference»connectedViews«EXPAND addNavigatorItemsSuffix('parentElement', reference.referenceType.value != gmfgen::GenNavigatorReferenceType::children.value) FOR reference-»
- «ENDFOREACH-»
- «ENDFOREACH-»
- «EXPAND addGroups(references) FOREACH getGroupNames(references)-»
- «ENDLET-»
- return result.toArray();
-}
-//«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/DiagramPreferencePage.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/DiagramPreferencePage.xpt deleted file mode 100644 index e62061bdeac..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/DiagramPreferencePage.xpt +++ /dev/null @@ -1,46 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/uml2/diagram/gmfgenext/DiagramFigure/1.0"»
-
- «EXTENSION xpt::preferences::PrefsConstant»
-
- «DEFINE DiagramPreferencePage FOR gmfgen::GenDiagram-»
-
- package «preferencesPackageName»;
-
- public class «getDiagramPreferencePageFileName(editorGen.modelID)» extends org.eclipse.papyrus.preferences.pages.AbstractPapyrusPreferencePage {
-
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected void createPageContents(org.eclipse.swt.widgets.Composite parent) {
- // Do nothing
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getBundleId() {
- return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().ID;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public static void initDefaults(org.eclipse.jface.preference.IPreferenceStore store) {
- // Do nothing
- }
-
- }
- - «ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/IDiagramPreferenceConstant.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/IDiagramPreferenceConstant.xpt deleted file mode 100644 index 82d49471dc8..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/IDiagramPreferenceConstant.xpt +++ /dev/null @@ -1,86 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/uml2/diagram/gmfgenext/DiagramFigure/1.0"»
-
-
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«DEFINE IDiagramPreferenceConstant FOR gmfgen::GenDiagram»
-package «preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public interface «getPreferenceConstantFileName()» {
-
-«FOREACH topLevelNodes AS node»
- «EXPAND getNodeConstants FOR node-» -«ENDFOREACH»
-
-«FOREACH links AS link»
- «EXPAND getLinkConstants FOR link.elementType-» -«ENDFOREACH»
-}
-«ENDDEFINE»
-
-«DEFINE getNodeConstants FOR gmfgen::GenNode»
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceFillColorConstant(getUniqueIdentifier().toUpperCase())» = "«getUniqueIdentifier()».fill.color";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceFontColorConstant(getUniqueIdentifier().toUpperCase())» = "«getUniqueIdentifier()».font.color";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceFontConstant(getUniqueIdentifier().toUpperCase())» = "«getUniqueIdentifier()».font";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceLineColorConstant(getUniqueIdentifier().toUpperCase())» = "«getUniqueIdentifier()».line.color";
-«ENDDEFINE»
-
-«DEFINE getLinkConstants FOR MetamodelType»
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceFontColorConstant(displayName.toUpperCase())» = "«displayName».font.color";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceFontConstant(displayName.toUpperCase())» = "«displayName».font";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceLineColorConstant(displayName.toUpperCase())» = "«displayName».line.color";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceJumpLinkReverseConstant(displayName.toUpperCase())» = "«displayName».jumplink.reverse";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceJumpLinkStatusConstant(displayName.toUpperCase())» = "«displayName».jumplink.status";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceJumpLinkTypeConstant(displayName.toUpperCase())» = "«displayName».jumplink.type";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceRoutingDistancePolicyConstant(displayName.toUpperCase())» = "«displayName».routing.distance.policy";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceRoutingObstructionPolicyConstant(displayName.toUpperCase())» = "«displayName».routing.obstruction.policy";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceRoutingStyleConstant(displayName.toUpperCase())» = "«displayName».routing.style";
-
- «EXPAND xpt::Common::generatedClassComment»
- public static final String «getPreferenceSmoothnessConstant(displayName.toUpperCase())» = "«displayName».smoothness";
- -«ENDDEFINE»
-
-«DEFINE getLinkConstants FOR ElementType» -«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/LinkPreferencePage.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/LinkPreferencePage.xpt deleted file mode 100644 index 4f9f58680c4..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/LinkPreferencePage.xpt +++ /dev/null @@ -1,100 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/uml2/diagram/gmfgenext/DiagramFigure/1.0"»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«DEFINE className FOR gmfgen::GenLink»«elementType.displayName»«getPreferencePageSuffix()»«ENDDEFINE»
-
-«DEFINE LinkPreferencePage FOR gmfgen::GenLink»
-package «getDiagram().preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage {
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getBundleId() {
- return «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().ID;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getJumpLinkReversePreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceJumpLinkReverseConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getJumpLinkStatusPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceJumpLinkStatusConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getJumpLinkTypePreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceJumpLinkTypeConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getRoutingDistancePolicyPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceRoutingDistancePolicyConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getRoutingObstructionPolicyPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceRoutingObstructionPolicyConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getRoutingStylePreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceRoutingStyleConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getSmoothnessPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceSmoothnessConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getFontColorPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceSmoothnessConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getFontPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceFontConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getLineColorPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceLineColorConstant(elementType.displayName.toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public static void initDefaults(org.eclipse.jface.preference.IPreferenceStore store) {
-
- }
-
-}
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/NodePreferencePage.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/NodePreferencePage.xpt deleted file mode 100644 index 9490f6ea267..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/NodePreferencePage.xpt +++ /dev/null @@ -1,67 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/uml2/diagram/gmfgenext/DiagramFigure/1.0"»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«DEFINE className FOR gmfgen::GenNode»«getUniqueIdentifier()»«getPreferencePageSuffix()»«ENDDEFINE»
-
-«DEFINE NodePreferencePage FOR gmfgen::GenNode»
-package «getDiagram().preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage {
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getBundleId() {
- return «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().ID;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getFillColorPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceFillColorConstant(getUniqueIdentifier().toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getFontColorPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceFontColorConstant(getUniqueIdentifier().toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getFontPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceFontConstant(getUniqueIdentifier().toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getLineColorPreferenceName() {
- return «getPreferenceConstantFileName()».«getPreferenceLineColorConstant(getUniqueIdentifier().toUpperCase())»;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public static void initDefaults(org.eclipse.jface.preference.IPreferenceStore store) {
- org.eclipse.jface.preference.PreferenceConverter.setDefault(store, «getPreferenceConstantFileName()».«getPreferenceFillColorConstant(getUniqueIdentifier().toUpperCase())», new org.eclipse.swt.graphics.RGB(255, 255, 255));
- org.eclipse.jface.preference.PreferenceConverter.setDefault(store, «getPreferenceConstantFileName()».«getPreferenceLineColorConstant(getUniqueIdentifier().toUpperCase())», new org.eclipse.swt.graphics.RGB(177, 207, 229));
-
-
- }
-
-}
-«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/PrefsConstant.ext b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/PrefsConstant.ext deleted file mode 100644 index 6ba12eed67a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/preferences/PrefsConstant.ext +++ /dev/null @@ -1,84 +0,0 @@ -/*
- * Copyright (c) 2008 Atos Origin
- *
- * 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:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-
-String getPreferenceConstantFileName() :
- JAVA org.eclipse.papyrus.codegen.utils.PapyrusGenConstants.getIDiagramPreferenceConstantJavaClassName()
-;
-
-String getDiagramPreferencePageFileName(String diagramName) :
- JAVA org.eclipse.papyrus.codegen.utils.PapyrusGenConstants.getDiagramPreferencePageJavaClassName(java.lang.String)
-;
-
-String getDiagramPreferencePageCategory() :
- JAVA org.eclipse.papyrus.codegen.utils.PapyrusGenConstants.getDiagramPreferencePageCategory()
-;
-
-String getPreferenceConstant() :
-"_PREF_"
-;
-
-String getPreferenceFillColorConstant(String element) :
-element + getPreferenceConstant() + "FILL_COLOR"
-;
-
-String getPreferenceFontColorConstant(String element) :
-element + getPreferenceConstant() + "FONT_COLOR"
-;
-
-String getPreferenceFontConstant(String element) :
-element + getPreferenceConstant() + "FONT"
-;
-
-String getPreferenceLineColorConstant(String element):
-element + getPreferenceConstant() + "LINE_COLOR"
-;
-
-String getPreferenceJumpLinkConstant():
-getPreferenceConstant() + "JUMPLINK_"
-;
-
-String getPreferenceJumpLinkReverseConstant(String element):
-element + getPreferenceJumpLinkConstant() + "REVERSE"
-;
-
-String getPreferenceJumpLinkStatusConstant(String element):
-element + getPreferenceJumpLinkConstant() + "STATUS"
-;
-
-String getPreferenceJumpLinkTypeConstant(String element):
-element + getPreferenceJumpLinkConstant() + "TYPE"
-;
-
-String getPreferenceRoutingConstant():
-getPreferenceConstant() + "ROUTING_"
-;
-
-String getPreferenceRoutingDistancePolicyConstant(String element):
-element + getPreferenceRoutingConstant() + "DISTANCE_POLICY"
-;
-
-String getPreferenceRoutingObstructionPolicyConstant(String element):
-element + getPreferenceRoutingConstant() + "OBSTRUCTION_POLICY"
-;
-
-String getPreferenceRoutingStyleConstant(String element):
-element + getPreferenceRoutingConstant() + "STYLE"
-;
-
-String getPreferenceSmoothnessConstant(String element):
-element + getPreferenceConstant() + "SMOOTHNESS"
-;
-
-String getPreferencePageSuffix():
-"PreferencePage"
-;
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/providers/ParserProvider.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/providers/ParserProvider.xpt deleted file mode 100644 index 29f59ab5f9f..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.4/codegen/xpt/providers/ParserProvider.xpt +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2007, 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 - * Modified by Patrick Tessier (CEA) - */ - -«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» -«IMPORT "http://www.eclipse.org/emf/2002/GenModel"» -«IMPORT "http://www.eclipse.org/emf/2002/Ecore"» -«IMPORT "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension"» -«EXTENSION xpt::providers::ParserUtils» -«EXTENSION xpt::EMFUtils» - -«REM»DOCUMENTATION : PapyrusGencode«ENDREM» -«REM» the purpose of modification is to add directly parsers to take in charge stereotype«ENDREM» -«REM»see lines 117,157«ENDREM» - -«DEFINE ParserProvider FOR gmfgen::GenDiagram-» -«EXPAND xpt::Common::copyright FOR editorGen-» -package «providersPackageName»; - -«EXPAND xpt::Common::generatedClassComment» -public class «parserProviderClassName» extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider - implements org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider { - «EXPAND parsers-» - - «EXPAND xpt::Common::generatedMemberComment» - protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(int visualID) { - switch (visualID) { - «EXPAND getParsers-» - } - return null; - } - - «EXPAND xpt::Common::generatedMemberComment» - public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser( - org.eclipse.core.runtime.IAdaptable hint) { - String vid = (String) hint.getAdapter(String.class); - if (vid != null) { - return getParser(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(vid)); - } - org.eclipse.gmf.runtime.notation.View view = - (org.eclipse.gmf.runtime.notation.View) hint.getAdapter(org.eclipse.gmf.runtime.notation.View.class); - if (view != null) { - return getParser(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view)); - } - return null; - } - - «EXPAND xpt::Common::generatedMemberComment» - public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) { - if (operation instanceof org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation) { - org.eclipse.core.runtime.IAdaptable hint = - ((org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation) operation).getHint(); - if («getElementTypesQualifiedClassName()».getElement(hint) == null) { - return false; - } - return getParser(hint) != null; - } - return false; - } - «EXPAND HintAdapterClass» - «EXPAND additions-» -} -«ENDDEFINE» - -«DEFINE parsers FOR gmfgen::GenDiagram-» - «EXPAND parsers FOREACH topLevelNodes-» - «EXPAND parsers FOREACH childNodes-» - «EXPAND parsers FOREACH links-» -«ENDDEFINE» - -«DEFINE parsers FOR gmfgen::GenNode-» - «EXPAND parser FOREACH labels-» -«ENDDEFINE» - -«DEFINE parsers FOR gmfgen::GenChildLabelNode-» - - «EXPAND parser(this) FOR labelModelFacet-» -«ENDDEFINE» - -«DEFINE parsers FOR gmfgen::GenLink-» - «EXPAND parser FOREACH labels-» -«ENDDEFINE» - -«DEFINE parser FOR gmfgen::GenLabel-» - «EXPAND parser(this) FOR modelFacet-» -«ENDDEFINE» - -«DEFINE parser(gmfgen::GenCommonBase element) FOR gmfgen::LabelModelFacet-» -«ENDDEFINE» - -«DEFINE parser(gmfgen::GenCommonBase element) FOR gmfgen::FeatureLabelModelFacet-» - - «EXPAND xpt::Common::generatedMemberComment» - private org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserFieldName(element)»; - - «EXPAND xpt::Common::generatedMemberComment» - private org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserAccessorName(element)»() { - if («parserFieldName(element)» == null) { - «parserFieldName(element)» = «parserCreatorName(element)»(); - } - return «parserFieldName(element)»; - } - - «EXPAND xpt::Common::generatedMemberComment» - - - - - protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserCreatorName(element)»() { - «REM»BEGIN : PapyrusGencode«ENDREM» - «REM» adding test to lokkfor extendedGenNode with the name StereotypeApplication«ENDREM» - «IF getReferencingObjects(element).typeSelect(papyrusgmfgenextension::ExtendedGenNode).select(i | i.name=='StereotypeApplication').size()!=0» - «FOREACH getReferencingObjects(element).typeSelect(papyrusgmfgenextension::ExtendedGenNode) AS extendedObject» - //Papyrus Gen code - //This code is replaced by a simple parser of apliedstereotype - IParser parser = new org.eclipse.papyrus.diagram.clazz.custom.parsers.AppliedStereotypeParser(); - return parser; - «ENDFOREACH-» - «ELSE» - «REM»END : PapyrusGencode«ENDREM» - org.eclipse.emf.ecore.EAttribute[] features = new org.eclipse.emf.ecore.EAttribute[] { - «FOREACH metaFeatures AS feature-» - «EXPAND MetaModel::MetaFeature FOR feature», - «ENDFOREACH-» - }; - «IF viewMethod.literal == editMethod.literal-» - «EXPAND parserQualifiedClassName(viewMethod) FOR element.getDiagram()» parser = - new «EXPAND parserQualifiedClassName(viewMethod) FOR element.getDiagram()»(features); - «IF viewMethod.literal != gmfgen::LabelTextAccessMethod::NATIVE.literal-» - «EXPAND setReaderPatterns("parser")-» - «EXPAND setWriterPatterns("parser")-» - «ENDIF-» - return parser; - «ELSE-» - «EXPAND parserQualifiedClassName(viewMethod) FOR element.getDiagram()» reader = - new «EXPAND parserQualifiedClassName(viewMethod) FOR element.getDiagram()»(features); - «IF viewMethod.literal != gmfgen::LabelTextAccessMethod::NATIVE.literal-» - «EXPAND setReaderPatterns("reader")-» - «ENDIF-» - «EXPAND parserQualifiedClassName(editMethod) FOR element.getDiagram()» writer = - new «EXPAND parserQualifiedClassName(editMethod) FOR element.getDiagram()»(features); - «IF editMethod.literal != gmfgen::LabelTextAccessMethod::NATIVE.literal-» - «EXPAND setWriterPatterns("writer")-» - «ENDIF-» - return new «EXPAND xpt::parsers::CompositeParser::qualifiedClassName FOR element.getDiagram()»(reader, writer); - «ENDIF-» - «REM»BEGIN : PapyrusGencode«ENDREM» - «ENDIF-» - «REM»END : PapyrusGencode«ENDREM» - } -«ENDDEFINE» - -«DEFINE parserQualifiedClassName(gmfgen::LabelTextAccessMethod method) FOR gmfgen::GenDiagram-» - «IF gmfgen::LabelTextAccessMethod::NATIVE.literal == method.literal-» - «EXPAND xpt::parsers::NativeParser::qualifiedClassName-» - «ELSEIF gmfgen::LabelTextAccessMethod::PRINTF.literal == method.literal-» - «EXPAND xpt::parsers::PrintfParser::qualifiedClassName-» - «ELSEIF gmfgen::LabelTextAccessMethod::REGEXP.literal == method.literal-» - «EXPAND xpt::parsers::RegexpParser::qualifiedClassName-» - «ELSE-» - «EXPAND xpt::parsers::MessageFormatParser::qualifiedClassName-» - «ENDIF-» -«ENDDEFINE» - -«DEFINE setReaderPatterns(String parserVar) FOR gmfgen::FeatureLabelModelFacet-» - «IF isPatternSpecified(viewPattern)-» - «parserVar».setViewPattern("«viewPattern»"); - «ENDIF-» - «IF isPatternSpecified(editorPattern)-» - «parserVar».setEditorPattern("«editorPattern»"); - «ELSE-» - «IF isPatternSpecified(viewPattern)-» - «parserVar».setEditorPattern("«viewPattern»"); - «ENDIF-» - «ENDIF-» -«ENDDEFINE» - -«DEFINE setWriterPatterns(String parserVar) FOR gmfgen::FeatureLabelModelFacet-» - «IF isPatternSpecified(editPattern)-» - «parserVar».setEditPattern("«editPattern»"); - «ELSE-» - «IF isPatternSpecified(viewPattern)-» - «parserVar».setEditPattern("«viewPattern»"); - «ENDIF-» - «ENDIF-» -«ENDDEFINE» - -«DEFINE getParsers FOR gmfgen::GenDiagram-» - «EXPAND getParsers FOREACH topLevelNodes-» - «EXPAND getParsers FOREACH childNodes-» - «EXPAND getParsers FOREACH links-» -«ENDDEFINE» - -«DEFINE getParsers FOR gmfgen::GenNode-» - «EXPAND getParser FOREACH labels-» -«ENDDEFINE» - -«DEFINE getParsers FOR gmfgen::GenChildLabelNode-» - «EXPAND getParser(this) FOR labelModelFacet-» -«ENDDEFINE» - -«DEFINE getParsers FOR gmfgen::GenLink-» - «EXPAND getParser FOREACH labels-» -«ENDDEFINE» - -«DEFINE getParser FOR gmfgen::GenLabel-» - «EXPAND getParser(this) FOR modelFacet-» -«ENDDEFINE» - -«DEFINE getParser(gmfgen::GenCommonBase element) FOR gmfgen::LabelModelFacet-» -«ENDDEFINE» - -«DEFINE getParser(gmfgen::GenCommonBase element) FOR gmfgen::FeatureLabelModelFacet-» - «EXPAND xpt::Common::caseVisualID FOR element» return «parserAccessorName(element)»(); -«ENDDEFINE» - -«DEFINE HintAdapterClass FOR gmfgen::GenDiagram-» - - «EXPAND xpt::Common::generatedMemberComment» - public static class HintAdapter extends org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter { - - «EXPAND xpt::Common::generatedMemberComment» - private final org.eclipse.gmf.runtime.emf.type.core.IElementType elementType; - - «EXPAND xpt::Common::generatedMemberComment» - public HintAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType type, - org.eclipse.emf.ecore.EObject object, String parserHint) { - super(object, parserHint); - assert type != null; - elementType = type; - } - - «EXPAND xpt::Common::generatedMemberComment» - public Object getAdapter(Class adapter) { - if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) { - return elementType; - } - return super.getAdapter(adapter); - } - } -«ENDDEFINE» - -«DEFINE additions FOR gmfgen::GenDiagram-»«ENDDEFINE» |