Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfeatures/papyrus-toolsmiths-features/org.eclipse.papyrus.diagramgen.feature/feature.xml7
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/plugin.properties1
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/src/org/eclipse/papyrus/gmf/codegen/gmfgen/provider/GenEditorGeneratorItemProvider.java24
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/META-INF/MANIFEST.MF5
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/src/org/eclipse/papyrus/gmf/codegen/util/PapyrusGMFExtensionMigrator.java22
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ChildNodeLabelEditPart.xtend37
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/CompartmentEditPart.xtend74
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/DiagramEditPart.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ExternalNodeLabelEditPart.xtend68
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkEditPart.xtend20
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkLabelEditPart.xtend66
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeEditPart.xtend29
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeLabelEditPart.xtend61
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/actions/LoadResourceAction.xtend21
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChildNodeLabelEditPart.xtend37
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChoiceUtils_qvto.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/CompartmentEditPart.xtend93
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/DiagramEditPart.xtend105
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend27
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkEditPart.xtend77
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkLabelEditPart.xtend36
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeEditPart.xtend388
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeLabelEditPart.xtend29
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/TextAware.xtend1059
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/update/CanonicalUpdate.xtend228
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/AbstractParser.xtend44
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/ParserProvider.xtend106
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/preferences/StandardPage.xtend21
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/metamodel/MetaModel.xtend21
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/parsers/PredefinedParser.xtend70
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/EditHelperUtils_qvto.xtend (renamed from plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/EditHelperUtils_qvto.xtend)3
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/EditPartsUtils_qvto.xtend (renamed from plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/EditPartsUtils_qvto.xtend)3
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/PrefsConstant_qvto.xtend (renamed from plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/PrefsConstant_qvto.xtend)4
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/UtilsItemSemanticEditPolicy.xtend (renamed from plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/UtilsItemSemanticEditPolicy.xtend)4
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/CodeStyle.xtend28
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/Common.xtend44
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenEditorGenerator_qvto.xtend32
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenModelUtils_qvto.xtend26
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/QualifiedClassNameProvider.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateLinkUtils.xtend67
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateNodeCommand.xtend147
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/ReorientLinkUtils.xtend27
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/BaseEditHelper.xtend27
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/EditHelper.xtend22
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/Common.xtend36
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/EditPartFactory.xtend61
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend554
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend101
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend47
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend235
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/OpenDiagram.xtend19
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend41
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/childContainerCreateCommand.xtend57
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/linkCommands.xtend129
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/preferences/extensions.xtend56
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/DiagramUpdater.xtend436
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/LinkDescriptor.xtend27
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/NodeDescriptor.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/extensions.xtend31
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/views/ViewStyles.xtend36
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ActionBarContributor.xtend20
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/CreationWizard.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramContentInitializer.xtend24
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorContextMenuProvider.xtend57
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorUtil.xtend33
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DocumentProvider.xtend59
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/Editor.xtend877
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/InitDiagramFileAction.xtend18
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ModelElementSelectionPage.xtend24
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/NewDiagramFileWizard.xtend37
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetInfo.xtend31
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend24
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ValidateAction.xtend88
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend198
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/extensions.xtend148
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/PaletteConfiguration.xtend (renamed from plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend)2
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/PaletteFactory.xtend127
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/Utils_qvto.xtend204
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/AbstractExpression.xtend51
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/AbstractNavigatorItem.xtend29
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorContentProvider.xtend24
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorContentProvider.xtend343
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorGroup.xtend26
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorItem.xtend31
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLabelProvider.xtend27
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLinkHelper.xtend20
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorSorter.xtend19
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/ActivatorImpl.xtend150
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/manifest.xtend40
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/plugin.xtend300
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/LabelProvider.xtend19
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/PropertySection.xtend23
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/EditPartProvider.xtend24
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers.xtend119
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers_qvto.xtend42
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementTypes.xtend95
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/IconProvider.xtend29
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/MarkerNavigationProvider.xtend30
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ParserUtils_qvto.xtend37
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationDecoratorProvider.xtend347
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationProvider.xtend58
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ViewProvider.xtend788
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/VisualTypeProvider.xtend (renamed from plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend)5
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/extensions.xtend104
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.ecore5
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.genmodel1
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GMFGenPackage.java22
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GenEditorGenerator.java28
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java10
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GenEditorGeneratorImpl.java57
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/CodegenEmitters.java13
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/Generator.java52
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.classpath12
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.project81
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.settings/.api_filters11
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.runtime.prefs2
-rwxr-xr-xplugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.core.prefs319
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.ui.prefs127
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.pde.api.tools.prefs104
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.core.Xtend.prefs6
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.shared.ui.prefs2
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/META-INF/MANIFEST.MF22
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/about.html26
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/build.properties11
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/plugin.properties14
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/pom.xml61
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend-gen/.gitignore2
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend38
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend85
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend31
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend78
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend33
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend76
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend115
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend81
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/actions/LoadResourceAction.xtend24
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend44
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChoiceUtils_qvto.xtend36
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend72
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend105
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend32
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend114
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend50
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend474
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend52
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend829
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend166
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend159
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend61
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend46
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend30
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/parsers/PredefinedParser.xtend68
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend26
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend47
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/QualifiedClassNameProvider.xtend35
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend85
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend230
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend79
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/BaseEditHelper.xtend28
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend40
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend61
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend78
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend389
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend121
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xtend23
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend57
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend256
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend80
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend42
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend59
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/Utils_qvto.xtend45
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend75
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend195
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/PreferenceInitializer.xtend30
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend73
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend357
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend44
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend37
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend57
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend50
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend188
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend32
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend44
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend86
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend109
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend339
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend617
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend95
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ModelElementSelectionPage.xtend24
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend215
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend74
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend69
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend216
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend342
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend108
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend122
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/Utils_qvto.xtend208
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend78
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend58
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend44
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend61
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend394
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend43
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend52
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend66
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend45
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend45
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend177
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend83
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend292
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend69
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/PropertySection.xtend24
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/EditPartProvider.xtend29
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend126
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers_qvto.xtend39
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend176
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/IconProvider.xtend29
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend95
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ParserUtils_qvto.xtend38
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend88
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend207
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend685
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend228
-rwxr-xr-xplugins/toolsmiths/org.eclipse.papyrus.releng.dev.release/release.xml2
-rw-r--r--plugins/toolsmiths/pom.xml1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen4
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/README.txt10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram.gmfgen.prefs1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram1.gmfgen.prefs1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen4
-rw-r--r--tests/junit/framework/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/apireport/excludes.txt1
245 files changed, 6350 insertions, 16475 deletions
diff --git a/features/papyrus-toolsmiths-features/org.eclipse.papyrus.diagramgen.feature/feature.xml b/features/papyrus-toolsmiths-features/org.eclipse.papyrus.diagramgen.feature/feature.xml
index d3a15a36599..700f0e45729 100755
--- a/features/papyrus-toolsmiths-features/org.eclipse.papyrus.diagramgen.feature/feature.xml
+++ b/features/papyrus-toolsmiths-features/org.eclipse.papyrus.diagramgen.feature/feature.xml
@@ -29,13 +29,6 @@
unpack="false"/>
<plugin
- id="org.eclipse.papyrus.def"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
id="org.eclipse.papyrus.gmfgenextension"
download-size="0"
install-size="0"
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/plugin.properties b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/plugin.properties
index b1cc336551b..9f147ad7e41 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/plugin.properties
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/plugin.properties
@@ -1368,3 +1368,4 @@ _UI_GenFloatingLabel_visibleByDefault_feature = Visible By Default
_UI_RefreshHook_refreshCondition_feature = Refresh Condition
_UI_RefreshHook_refreshAction_feature = Refresh Action
_UI_GenNode_refreshHook_feature = Refresh Hook
+_UI_GenEditorGenerator_jdkComplianceLevel_feature = Jdk Compliance Level
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/src/org/eclipse/papyrus/gmf/codegen/gmfgen/provider/GenEditorGeneratorItemProvider.java b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/src/org/eclipse/papyrus/gmf/codegen/gmfgen/provider/GenEditorGeneratorItemProvider.java
index 2c518c2dffb..db529b89a5e 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/src/org/eclipse/papyrus/gmf/codegen/gmfgen/provider/GenEditorGeneratorItemProvider.java
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.edit/src/org/eclipse/papyrus/gmf/codegen/gmfgen/provider/GenEditorGeneratorItemProvider.java
@@ -88,6 +88,7 @@ public class GenEditorGeneratorItemProvider
addTemplateDirectoryPropertyDescriptor(object);
addCopyrightTextPropertyDescriptor(object);
addPluginDirectoryPropertyDescriptor(object);
+ addJdkComplianceLevelPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
@@ -313,6 +314,28 @@ public class GenEditorGeneratorItemProvider
}
/**
+ * This adds a property descriptor for the Jdk Compliance Level feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addJdkComplianceLevelPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_GenEditorGenerator_jdkComplianceLevel_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_GenEditorGenerator_jdkComplianceLevel_feature", "_UI_GenEditorGenerator_type"),
+ GMFGenPackage.eINSTANCE.getGenEditorGenerator_JdkComplianceLevel(),
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
@@ -411,6 +434,7 @@ public class GenEditorGeneratorItemProvider
case GMFGenPackage.GEN_EDITOR_GENERATOR__TEMPLATE_DIRECTORY:
case GMFGenPackage.GEN_EDITOR_GENERATOR__COPYRIGHT_TEXT:
case GMFGenPackage.GEN_EDITOR_GENERATOR__PLUGIN_DIRECTORY:
+ case GMFGenPackage.GEN_EDITOR_GENERATOR__JDK_COMPLIANCE_LEVEL:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case GMFGenPackage.GEN_EDITOR_GENERATOR__AUDITS:
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/META-INF/MANIFEST.MF b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/META-INF/MANIFEST.MF
index 5336cd878cd..dfdc647d3f3 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/META-INF/MANIFEST.MF
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/META-INF/MANIFEST.MF
@@ -19,7 +19,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ocl.ecore,
com.google.guava,
org.eclipse.xtext.xbase.lib,
- org.eclipse.gmf.runtime.notation
+ org.eclipse.gmf.runtime.notation,
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0.0)",
+ org.eclipse.papyrus.infra.types;bundle-version="[5.0.0,6.0.0)",
+ org.eclipse.papyrus.infra.types.core;bundle-version="[5.0.0,6.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: %providerName
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/src/org/eclipse/papyrus/gmf/codegen/util/PapyrusGMFExtensionMigrator.java b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/src/org/eclipse/papyrus/gmf/codegen/util/PapyrusGMFExtensionMigrator.java
index 89c596c776d..b5009eb9ce2 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/src/org/eclipse/papyrus/gmf/codegen/util/PapyrusGMFExtensionMigrator.java
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/src/org/eclipse/papyrus/gmf/codegen/util/PapyrusGMFExtensionMigrator.java
@@ -61,9 +61,9 @@ public class PapyrusGMFExtensionMigrator extends GenExtensionSwitch<Boolean> {
/**
- *
+ *
* Migrates {@link AdditionalEditPartCandies} to {@link GenDiagram}.
- *
+ *
* @param object
* @return
*/
@@ -79,7 +79,7 @@ public class PapyrusGMFExtensionMigrator extends GenExtensionSwitch<Boolean> {
/**
- *
+ *
* Migrates {@link CustomDiagramUpdaterSingleton} to {@link GenDiagramUpdater}.
* Resolve first from whole resource.
*
@@ -233,7 +233,7 @@ public class PapyrusGMFExtensionMigrator extends GenExtensionSwitch<Boolean> {
extendedView.getGenView().forEach(node -> {
if (node instanceof GenNode) {
GenNode extenedNode = (GenNode) node;
-
+
RefreshHook refreshHook = GMFGenFactory.eINSTANCE.createRefreshHook();
// @deprecated
// extenedNode.setRefreshComment(refreshHook.getComment());
@@ -269,7 +269,11 @@ public class PapyrusGMFExtensionMigrator extends GenExtensionSwitch<Boolean> {
@Override
public Boolean caseSpecificLocator(SpecificLocator object) {
object.getGenChildSideAffixedNode().forEach(node -> {
- node.setLocatorClassName(object.getClasspath());
+ if (node.getLocatorClassName() == null) {
+ // keep only the first locator found
+ // multiplicity change
+ node.setLocatorClassName(object.getClasspath());
+ }
});
return true; // delete
}
@@ -283,12 +287,16 @@ public class PapyrusGMFExtensionMigrator extends GenExtensionSwitch<Boolean> {
@Override
public Boolean caseSpecificLocatorExternalLabel(SpecificLocatorExternalLabel object) {
object.getGenExternalNodeLabel().forEach(node -> {
- node.setLocatorClassName(object.getClasspath());
+ if (node.getLocatorClassName() == null) {
+ // keep only the first locator found
+ // multiplicity change
+ node.setLocatorClassName(object.getClasspath());
+ }
});
return true; // delete
}
-
+
/**
* Migrates {@link VisualIDOverride} to {@link GenCommonBase}.
*
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ChildNodeLabelEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ChildNodeLabelEditPart.xtend
index 371129f01b6..eebd6a07fbd 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ChildNodeLabelEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ChildNodeLabelEditPart.xtend
@@ -1,18 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package diagram.editparts
@@ -20,16 +21,11 @@ import com.google.inject.Inject
import impl.diagram.editparts.TextAware
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildLabelNode
import xpt.Common
-import xpt.Common_qvto
-import xpt.diagram.editparts.Utils_qvto
@com.google.inject.Singleton class ChildNodeLabelEditPart {
@Inject extension Common;
- @Inject extension Common_qvto;
- @Inject extension Utils_qvto;
@Inject impl.diagram.editparts.ChildNodeLabelEditPart xptChildNodeLabelEditPart;
- @Inject impl.diagram.editparts.NodeEditPart xptNodeEditPart;
@Inject xpt.diagram.editparts.Common xptEditpartsCommon;
@Inject TextAware xptTextAware;
@@ -66,9 +62,18 @@ public class «xptChildNodeLabelEditPart.className(it)» «extendsList(it)» «i
}
'''
- def extendsList(GenChildLabelNode it) '''extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart'''
+ def extendsList(GenChildLabelNode it) '''
+«««BEGIN: PapyrusGenCode
+«««Add own extension
+«IF superEditPart !== null»
+ extends «superEditPart»
+«««END: PapyrusGenCode
+«ELSE»
+ extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart
+«ENDIF»
+'''
- def implementsList(GenChildLabelNode it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart'''
+ def implementsList(GenChildLabelNode it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit'''
def attributes(GenChildLabelNode it) '''
«xptEditpartsCommon.visualIDConstant(it)»
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/CompartmentEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/CompartmentEditPart.xtend
index b37fea4aeab..3730e48bcd5 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/CompartmentEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/CompartmentEditPart.xtend
@@ -1,27 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package diagram.editparts
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
import xpt.Common
import xpt.diagram.editparts.Utils_qvto
-@com.google.inject.Singleton class CompartmentEditPart {
+@Singleton class CompartmentEditPart {
@Inject extension Common;
@Inject extension Utils_qvto;
@@ -66,7 +67,15 @@ public class «xptCompartmentEditPartImpl.className(it)» «extendsList(it)» «
'''
def extendsList(GenCompartment it) '''
- extends «IF listLayout»org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart«ENDIF»
+
+«««BEGIN: PapyrusGenCode
+«««Add own extension
+«IF superEditPart!== null»
+ extends «superEditPart»
+«««END: BEGIN: PapyrusGenCode
+«ELSE»
+ extends «IF listLayout»org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart«ELSE»org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.linklf.LinkLFShapeCompartmentEditPart«ENDIF»
+«ENDIF»
'''
def implementsList(GenCompartment it) ''''''
@@ -91,6 +100,47 @@ public class «xptCompartmentEditPartImpl.className(it)» «extendsList(it)» «
«ENDIF»
'''
- def additions(GenCompartment it) ''''''
+ def additions(GenCompartment it) '''
+ «handleSize(it)»
+ «refreshbound(it)»
+ «refreshvisual(it)»
+ '''
+
+ def handleSize(GenCompartment it) '''
+ «generatedMemberComment»
+protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification notification) {
+ Object feature = notification.getFeature();
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+ super.handleNotificationEvent(notification);
+ }
+'''
+
+ def refreshbound(GenCompartment it) '''
+ «generatedMemberComment»
+ protected void refreshBounds() {
+ int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ org.eclipse.draw2d.geometry.Dimension size = new org.eclipse.draw2d.geometry.Dimension(width, height);
+ int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ org.eclipse.draw2d.geometry.Point loc = new org.eclipse.draw2d.geometry.Point(x, y);
+ ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new org.eclipse.draw2d.geometry.Rectangle(loc, size));
+ }
+ '''
+ def refreshvisual(GenCompartment it) '''
+ «generatedMemberComment»
+protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+'''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/DiagramEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/DiagramEditPart.xtend
index b2c74d39ab4..846a79b6ad9 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/DiagramEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/DiagramEditPart.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation and others, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package diagram.editparts
@@ -21,8 +21,8 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
import xpt.Common
import xpt.Common_qvto
-
@com.google.inject.Singleton class DiagramEditPart {
+
@Inject extension Common;
@Inject extension Common_qvto;
@@ -61,7 +61,7 @@ public class «xptDiagramEditPart.className(it)» «extendsList(it)» «implemen
}
'''
- def extendsList(GenDiagram it) '''extends org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart'''
+ def extendsList(GenDiagram it) '''extends «xptDiagramEditPart.extendsListContents(it)»'''
def implementsList(GenDiagram it) ''''''
@@ -80,4 +80,5 @@ public class «xptDiagramEditPart.className(it)» «extendsList(it)» «implemen
'''
def additions(GenDiagram it) ''''''
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ExternalNodeLabelEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ExternalNodeLabelEditPart.xtend
index d8f8486df2b..7247b3b3b9b 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ExternalNodeLabelEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/ExternalNodeLabelEditPart.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package diagram.editparts
@@ -61,9 +61,25 @@ public class «xptExternalNodeLabelEditPart.className(it)» «extendsList(it)»
}
'''
- def extendsList(GenExternalNodeLabel it) '''extends org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart'''
+ def extendsList(GenExternalNodeLabel it) '''
+ «««BEGIN: PapyrusGenCode
+ «««specify a java super class for external nodes
+ «IF superEditPart !== null»
+ extends «superEditPart»
+ «««END: PapyrusGenCode
+ «ELSE»
+ extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart
+ «ENDIF»
+ '''
- def implementsList(GenExternalNodeLabel it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart'''
+ def implementsList(GenExternalNodeLabel it) '''
+ implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart
+ ««« BEGIN: PapyrusGenCode
+ «IF labelVisibilityPreference !== null»
+ , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider
+ «ENDIF»
+ ««« END: PapyrusGenCode
+ '''
def attributes(GenExternalNodeLabel it) '''
«xptEditpartsCommon.visualIDConstant(it)»
@@ -85,5 +101,33 @@ public class «xptExternalNodeLabelEditPart.className(it)» «extendsList(it)»
}
'''
- def additions(GenExternalNodeLabel it) ''''''
+ def additions(GenExternalNodeLabel it) '''
+ ««« BEGIN: PapyrusGenCode
+ «IF labelVisibilityPreference !== null»
+ «generatedClassComment»
+ public String getLabelRole(){
+ return "«labelVisibilityPreference.role»";//$NON-NLS-1$
+ }
+
+ «generatedClassComment»
+ public String getIconPathRole(){
+ return "«labelVisibilityPreference.iconPathRole»";//$NON-NLS-1$
+ }
+ «ENDIF»
+ ««« END: PapyrusGenCode
+ '''
+
+ def refreshBounds(GenExternalNodeLabel it) '''
+ ««« BEGIN: PapyrusGenCode
+ public void refreshBounds() {
+ int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
+ getBorderItemLocator().relocate(getFigure());
+ }
+ ««« END: PapyrusGenCode
+ '''
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkEditPart.xtend
index 08a7f0ce2d6..56a8f213e46 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkEditPart.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package diagram.editparts
@@ -57,7 +57,7 @@ import xpt.Common
}
'''
- def extendsList(GenLink it) '''extends org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart'''
+ def extendsList(GenLink it) '''extends «xptLinkEditPart.extendsListContents(it)»'''
def implementsList(GenLink it) '''
«IF treeBranch»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart«ENDIF»
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkLabelEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkLabelEditPart.xtend
index e5c1b869039..9f43034db21 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkLabelEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/LinkLabelEditPart.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package diagram.editparts
@@ -20,6 +20,7 @@ import com.google.inject.Inject
import impl.diagram.editparts.TextAware
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkLabel
import xpt.Common
+import org.eclipse.papyrus.gmf.codegen.gmfgen.CustomBehaviour
@com.google.inject.Singleton class LinkLabelEditPart {
@Inject extension Common;
@@ -59,9 +60,16 @@ import xpt.Common
}
'''
- def extendsList(GenLinkLabel it) '''extends org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart'''
+ def extendsList(GenLinkLabel it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart'''
- def implementsList(GenLinkLabel it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart'''
+ def implementsList(GenLinkLabel it) '''
+ implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit
+ ««« BEGIN: PapyrusGenCode
+ «IF labelVisibilityPreference !== null»
+ , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider
+ «ENDIF»
+ ««« END: PapyrusGenCode
+ '''
def attributes(GenLinkLabel it) '''
«xptEditpartsCommon.visualIDConstant(it)»
@@ -70,10 +78,22 @@ import xpt.Common
'''
def createDefaultEditPolicies(GenLinkLabel it) '''
- «generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «xptLinkLabelEditPart.createDefaultEditPoliciesBody(it)»
- }
+ /**
+ * @generated Papyrus Generation
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new «diagram.getTextSelectionEditPolicyQualifiedClassName()»());
+ ««« BEGIN: PapyrusGenCode
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy());
+ ««« END: PapyrusGenCode
+ ««« Get the added custom behavoir
+ «FOR CustomBehaviour:it.behaviour.filter(typeof (CustomBehaviour))»
+ installEditPolicy(«CustomBehaviour.key», new «CustomBehaviour.editPolicyQualifiedClassName»());
+ «ENDFOR»
+ }
'''
def handleNotificationEvent(GenLinkLabel it) '''
@@ -83,5 +103,19 @@ import xpt.Common
}
'''
- def additions(GenLinkLabel it) ''''''
+ def additions(GenLinkLabel it) '''
+ ««« BEGIN: PapyrusGenCode
+ «IF labelVisibilityPreference !== null»
+ «generatedClassComment»
+ public String getLabelRole(){
+ return "«labelVisibilityPreference.role»";//$NON-NLS-1$
+ }
+
+ «generatedClassComment»
+ public String getIconPathRole(){
+ return "«labelVisibilityPreference.iconPathRole»";//$NON-NLS-1$
+ }
+ «ENDIF»
+ ««« END: PapyrusGenCode
+ '''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeEditPart.xtend
index cf65bb897f3..7a59f63cba5 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeEditPart.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
- *
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package diagram.editparts
@@ -22,6 +22,9 @@ import xpt.diagram.editparts.Utils_qvto
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenTopLevelNode
+//DOCUMENTATION: PapyrusGenCode
+//add call template in order to generate handlenotification in order to refresh figure by taking account event
+
@com.google.inject.Singleton class NodeEditPart {
@Inject extension Common;
@Inject extension Utils_qvto;
@@ -48,6 +51,11 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenTopLevelNode
«xptNodeEditPartImpl.createLayoutEditPolicy(it)»
+««« BEGIN: PapyrusGenCode
+««« call template to paste code for refresh figure by taking account event
+ «xptNodeEditPartImpl.specificHandleNotificationEvent(it)»
+««« END: PapyrusGenCode
+
«xptNodeEditPartImpl.createNodeShape(it.viewmap, it)»
«IF hasFixedChildren(it)»
@@ -76,7 +84,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenTopLevelNode
«xptNodeEditPartImpl.setForegroundColor(it)»
- «xptNodeEditPartImpl.setBackgroundColor(it)»
+««« «xptNodeEditPartImpl.setBackgroundColor(it)»
«xptNodeEditPartImpl.setLineWidth(it)»
@@ -130,6 +138,5 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenTopLevelNode
«ENDIF»
'''
- def additions(GenNode it) ''''''
-
+ def additions(GenNode it) ''''''
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeLabelEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeLabelEditPart.xtend
index 52c3a2b53f5..b3f678792cd 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeLabelEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/diagram/editparts/NodeLabelEditPart.xtend
@@ -1,18 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
- *
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package diagram.editparts
@@ -62,9 +61,9 @@ import xpt.diagram.editparts.Utils_qvto
}
'''
- def extendsList(GenNodeLabel it) '''extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart'''
+ def extendsList(GenNodeLabel it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart'''
- def implementsList(GenNodeLabel it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart'''
+ def implementsList(GenNodeLabel it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit'''
def attributes(GenNodeLabel it) '''
«xptEditpartsCommon.visualIDConstant(it)»
@@ -82,9 +81,45 @@ import xpt.diagram.editparts.Utils_qvto
def handleNotificationEvent(GenNodeLabel it) '''
«generatedMemberComment»
protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
+ refreshLabel();
«xptNodeLabelEditPart.handleNotificationEventBody(it)»
}
'''
- def additions(GenNodeLabel it) ''''''
+
+ def additions(GenNodeLabel it) '''
+ ««« Code to refresh icon
+
+ «generatedMemberComment»
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+
+ «generatedMemberComment»
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ «generatedMemberComment»
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((org.eclipse.gmf.runtime.notation.View) getParent().getModel()));
+
+ }
+
+ «generatedMemberComment»
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+
+ «generatedMemberComment»
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+
+ «««END: PapyrusGenCode
+ '''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/actions/LoadResourceAction.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/actions/LoadResourceAction.xtend
index 1aaa0a460a7..2daedbbb421 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/actions/LoadResourceAction.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/actions/LoadResourceAction.xtend
@@ -1,16 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2013 Montages AG
- *
+/*****************************************************************************
+ * Copyright (c) 2013, 2027, 2021 Montages AG, CEA LIST, Artal and others
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.actions
@@ -44,7 +45,7 @@ import xpt.Common_qvto
'''
def extendsList(org.eclipse.papyrus.gmf.codegen.gmfgen.LoadResourceAction it) //
- ''' extends org.eclipse.gmf.tooling.runtime.actions.DefaultLoadResourceAction'''
+ ''' extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.actions.DefaultLoadResourceAction'''
def implementsList(org.eclipse.papyrus.gmf.codegen.gmfgen.LoadResourceAction it) //
''''''
@@ -56,6 +57,6 @@ import xpt.Common_qvto
}
'''
- def additions(org.eclipse.papyrus.gmf.codegen.gmfgen.LoadResourceAction it) ''''''
+ def additions(org.eclipse.papyrus.gmf.codegen.gmfgen.LoadResourceAction it) ''''''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChildNodeLabelEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChildNodeLabelEditPart.xtend
index 6c4852e0a56..15a2f70760b 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChildNodeLabelEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChildNodeLabelEditPart.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013 , 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
@@ -20,7 +20,8 @@ import com.google.inject.Inject
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildLabelNode
import xpt.Common
import xpt.QualifiedClassNameProvider
-import xpt.diagram.editpolicies.TextNonResizableEditPolicy import xpt.CodeStyle
+import xpt.diagram.editpolicies.TextNonResizableEditPolicy
+import xpt.CodeStyle
/**
* Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class?
@@ -29,7 +30,7 @@ import xpt.diagram.editpolicies.TextNonResizableEditPolicy import xpt.CodeStyle
@Inject extension Common;
@Inject extension QualifiedClassNameProvider
@Inject extension CodeStyle
-
+ @Inject extension xpt.diagram.editparts.Common;
@Inject xpt.diagram.editparts.Common xptEditpartsCommon;
@Inject TextNonResizableEditPolicy xptTextNonResizable;
@@ -64,9 +65,17 @@ import xpt.diagram.editpolicies.TextNonResizableEditPolicy import xpt.CodeStyle
def additionalEditPolicies(GenChildLabelNode it) ''''''
def handleNotificationEventBody(GenChildLabelNode it) '''
- Object feature = event.getFeature();
- «xptEditpartsCommon.handleText(it)»
- super.handleNotificationEvent(event);
+ Object feature = event.getFeature();
+ «handleText(it)»
+ «IF labelElementIcon»
+ if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
+ refreshLabel();
+ }
+ «ENDIF»
+ if (org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) {
+ refreshUnderline();
+ }
+ super.handleNotificationEvent(event);
'''
def isSelectable(GenChildLabelNode it) '''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChoiceUtils_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChoiceUtils_qvto.xtend
index 767fab108ad..1097b7610b2 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChoiceUtils_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ChoiceUtils_qvto.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2011 - 2013 Montages AG
+/*****************************************************************************
+ * Copyright (c) 2011 - 2013, 2021 Montages AG, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Svyatoslav Kovalsky (Montages) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Svyatoslav Kovalsky (Montages) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
@@ -46,7 +46,11 @@ import xpt.Common_qvto
def boolean isChoiceLabel(LabelModelFacet modelFacet) {
var parser = modelFacet.parser;
- return parser.oclIsKindOf(typeof(PredefinedEnumParser)) || parser.oclIsKindOf(typeof(OclChoiceParser));
+ if (parser != null) {
+ return parser.oclIsKindOf(typeof(PredefinedEnumParser)) || parser.oclIsKindOf(typeof(OclChoiceParser));
+ } else {
+ return false;
+ }
}
def String getDirectManagerFQN(LabelModelFacet modelFacet) {
@@ -64,5 +68,4 @@ import xpt.Common_qvto
default: null
}
}
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/CompartmentEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/CompartmentEditPart.xtend
index 7f541f1b2da..71501719b81 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/CompartmentEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/CompartmentEditPart.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2021 Borland Software Corporation, CEA LIST, ARTAL and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
@@ -25,7 +25,8 @@ import xpt.Common
import xpt.Common_qvto
import xpt.Externalizer
import xpt.diagram.editparts.Utils_qvto
-import xpt.providers.ElementTypes import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
+import xpt.providers.ElementTypes
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
@com.google.inject.Singleton class CompartmentEditPart {
@Inject extension Common;
@Inject extension Common_qvto;
@@ -63,16 +64,31 @@ import xpt.providers.ElementTypes import org.eclipse.papyrus.gmf.codegen.gmfgen.
}
'''
- def createFigure(GenCompartment it) '''
- «IF !needsTitle»
- «/*By default titles are shown even if there are no TitleStyle, we need to switch it off*/generatedMemberComment»
- public org.eclipse.draw2d.IFigure createFigure() {
- org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure result = (org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure) super.createFigure();
- result.setTitleVisibility(false);
- return result;
- }
- «ENDIF»
- '''
+ def createFigure(GenCompartment it) {
+ if (hasExternalSuperClass(it,
+ 'org.eclipse.papyrus.uml.diagram.activity.edit.part.ShapeCompartmentWithoutScrollbarsEditPart')) {
+ '''
+ @Override
+ public org.eclipse.draw2d.IFigure createFigure() {
+ return super.createFigure();
+ }
+ '''
+ } else {
+
+ '''
+ «IF !needsTitle»
+ «/*By default titles are shown even if there are no TitleStyle, we need to switch it off*/generatedMemberComment»
+ public org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure result = (org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+ «ENDIF»
+ '''
+ }
+ }
+
+
def createDefaultEditPoliciesBody(GenCompartment it) '''
super.createDefaultEditPolicies();
@@ -80,13 +96,13 @@ import xpt.providers.ElementTypes import org.eclipse.papyrus.gmf.codegen.gmfgen.
installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy());
«ENDIF»
«xptEditpartsCommon.installSemanticEditPolicy(it)»
- «IF childNodes.notEmpty»
- «xptEditpartsCommon.installCreationEditPolicy(it)»
+ «IF ! childNodes.empty»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy());
installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
+ installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy());
«ENDIF»
«xptEditpartsCommon.installCanonicalEditPolicy(it)»
«xptEditpartsCommon.behaviour(it)»
- «additionalEditPolicies(it)»
'''
def additionalEditPolicies(GenCompartment it) ''''''
@@ -142,32 +158,7 @@ import xpt.providers.ElementTypes import org.eclipse.papyrus.gmf.codegen.gmfgen.
def getTargetEditPartMethod(GenCompartment it) '''
«generatedMemberComment»
public org.eclipse.gef.EditPart getTargetEditPart(org.eclipse.gef.Request request) {
- «IF childNodes.notEmpty»
- 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);
- «FOR childNode : it.childNodes»
- if (type == «xptElementTypes.accessElementType(childNode)») {
- return this;
- }
- «ENDFOR»
- return getParent().getTargetEditPart(request);
- }
- if (request instanceof org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest) {
- «IF haveOneOfChildNodesIncomimgLinks(it)»
- if (org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
- for (Object type : ((org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest) request).getElementTypes()) {
- if (type instanceof org.eclipse.gmf.runtime.emf.type.core.IElementType) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = (org.eclipse.gmf.runtime.emf.type.core.IElementType) type;
- if («FOR GenLink link : collectIncomingLinks(it) SEPARATOR " || "»elementType.equals(«xptElementTypes.accessElementType(link)»)«ENDFOR»)
- return super.getTargetEditPart(request);
- }
- }
- }
- «ENDIF»
- return getParent().getTargetEditPart(request);
- }
- «ENDIF»
+
return super.getTargetEditPart(request);
}
'''
@@ -194,6 +185,8 @@ import xpt.providers.ElementTypes import org.eclipse.papyrus.gmf.codegen.gmfgen.
@Localization def String i18nKeyForCompartmentTitle(GenCompartment compartment) {
return className(compartment) + '.title'
}
-
+ def boolean hasExternalSuperClass(GenCompartment it, String className) {
+ superEditPart == className
+ }
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/DiagramEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/DiagramEditPart.xtend
index 8f8a537eb0e..5599f1b8a36 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/DiagramEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/DiagramEditPart.xtend
@@ -1,35 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
import com.google.inject.Inject
+import com.google.inject.Singleton
+import metamodel.MetaModel
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
import org.eclipse.papyrus.gmf.codegen.gmfgen.ViewmapLayoutType
import xpt.Common
-import xpt.diagram.editparts.Utils_qvto
import xpt.diagram.commands.CreateShortcutDecorationsCommand
+import xpt.diagram.editparts.Utils_qvto
/**
* Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class?
*/
-@com.google.inject.Singleton class DiagramEditPart {
+@Singleton class DiagramEditPart {
@Inject extension Common;
@Inject extension Utils_qvto;
-
+ @Inject extension MetaModel;
@Inject xpt.diagram.editparts.Common xptEditpartsCommon;
@Inject CreateShortcutDecorationsCommand createShoutrtcutDecorationCommand;
@@ -45,20 +48,56 @@ import xpt.diagram.commands.CreateShortcutDecorationsCommand
'''
def createDefaultEditPoliciesBody(GenDiagram it) '''
- super.createDefaultEditPolicies();
- «xptEditpartsCommon.installSemanticEditPolicy(it)»
- «xptEditpartsCommon.installCanonicalEditPolicy(it)»
- «xptEditpartsCommon.installCreationEditPolicy(it)»
- «IF generateCreateShortcutAction() && null == editorGen.application»
- «dragDropEditPolicy(it)»
- «ENDIF»
- «IF shouldGenerateDiagramViewmap(it)»
- «layotEditPolicy(it)»
- «ENDIF»
- «xptEditpartsCommon.behaviour(it)»
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
- «additionalEditPolicies(it)»
- '''
+ super.createDefaultEditPolicies();
+
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy());
+ installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy());
+
+ «xptEditpartsCommon.installSemanticEditPolicy(it)»
+ «xptEditpartsCommon.installCanonicalEditPolicy(it)»
+ ««« «xptEditpartsCommon.installCreationEditPolicy(it)»
+ «IF generateCreateShortcutAction() && null == editorGen.application»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy() {
+ public org.eclipse.gef.commands.Command getDropObjectsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest) {
+ java.util.List<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor> viewDescriptors = new java.util.ArrayList<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor>();
+ for (java.util.Iterator<?> it = dropRequest.getObjects().iterator(); it.hasNext();) {
+ Object nextObject = it.next();
+ if (false == nextObject instanceof org.eclipse.emf.ecore.EObject) {
+ continue;
+ }
+ viewDescriptors.add(new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter((org.eclipse.emf.ecore.EObject) nextObject), org.eclipse.gmf.runtime.notation.Node.class, null, getDiagramPreferencesHint()));
+ }
+ return createShortcutsCommand(dropRequest, viewDescriptors);
+ }
+
+ private org.eclipse.gef.commands.Command createShortcutsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest, java.util.List<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor> viewDescriptors) {
+ org.eclipse.gef.commands.Command command = createViewsAndArrangeCommand(dropRequest, viewDescriptors);
+ if (command != null) {
+ return command.chain(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new «createShoutrtcutDecorationCommand.qualifiedClassName(it)»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors)));
+ }
+ return null;
+ }
+ });
+ «ENDIF»
+ «IF shouldGenerateDiagramViewmap(it)»
+ // diagram figure does layout; need to install child editpolicy to show selection feedback
+ installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.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»
+ «xptEditpartsCommon.behaviour(it)»
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
+'''
def dragDropEditPolicy(GenDiagram it) '''
installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy() {
@@ -128,4 +167,18 @@ import xpt.diagram.commands.CreateShortcutDecorationsCommand
org.eclipse.draw2d.LayoutManager «varName» = null; /*FIXME - unknown layout type*/
«ENDIF»
'''
+
+
+//BEGIN: PapyrusGenCode
+//computes super type of the link edit part in case the edit part manages a representation of a UML element
+def extendsListContents(GenDiagram it)'''
+org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart
+'''
+//END: BEGIN: PapyrusGenCode
+
+def featureForMetaclass (GenNode it)'''
+ if (« MetaClass(modelFacet.metaClass)».equals(class1)) {
+ return «MetaFeature(modelFacet.containmentMetaFeature)»;
+ }
+'''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend
index f5c035ca28b..371ee17aa57 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal
+/*****************************************************************************
+ * Copyright (c) 2006, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
@@ -55,7 +55,10 @@ import xpt.diagram.editpolicies.TextSelectionEditPolicy
«additionalEditPolicies(it)»
'''
- def additionalEditPolicies(GenExternalNodeLabel it) ''''''
+ def additionalEditPolicies(GenExternalNodeLabel it)
+ '''
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy());
+ '''
def getBorderItemLocator(GenExternalNodeLabel it) '''
«generatedMemberComment»
@@ -88,5 +91,5 @@ import xpt.diagram.editpolicies.TextSelectionEditPolicy
def createFigure(GenExternalNodeLabel it) '''
«xptEditpartsCommon.labelFigure(viewmap)»
- '''
-}
+ '''
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkEditPart.xtend
index 3316d6a023b..27b8ce26626 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkEditPart.xtend
@@ -1,18 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Remi Schnekenburger (CEA LIST) - modification for Papyrus MDT
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
@@ -27,7 +28,8 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.ParentAssignedViewmap
import org.eclipse.papyrus.gmf.codegen.gmfgen.SnippetViewmap
import org.eclipse.papyrus.gmf.codegen.gmfgen.Viewmap
import xpt.Common
-import xpt.Common_qvto import org.eclipse.papyrus.gmf.gmfgraph.DiagramLabel
+import xpt.Common_qvto
+import org.eclipse.papyrus.gmf.gmfgraph.DiagramLabel
/**
* Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class?
@@ -71,16 +73,16 @@ import xpt.Common_qvto import org.eclipse.papyrus.gmf.gmfgraph.DiagramLabel
* FIXME: [MG] check counterpart for ModeledViewmap,
*/
def addFixedChild(GenLink it) '''
- «IF it.hasFixedLabels»
+ «IF labels.size > 0»
«generatedMemberComment»
protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
«FOR label : labels»
- «addLabel(label.viewmap, label)»
+ «addLabel(label.viewmap,label)»
«ENDFOR»
return false;
}
«ENDIF»
- '''
+'''
// Note, condition in addFixedChild template above should be changed if addLabel support added for Viewmaps other than ParentAssignedViewmap
def dispatch addLabel(Viewmap it, GenLinkLabel label) ''''''
@@ -104,7 +106,7 @@ import xpt.Common_qvto import org.eclipse.papyrus.gmf.gmfgraph.DiagramLabel
'''
def removeFixedChild(GenLink it) '''
- «IF it.hasFixedLabels»
+ «IF ! labels.empty»
«generatedMemberComment»
protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
«FOR label : labels»
@@ -133,19 +135,19 @@ import xpt.Common_qvto import org.eclipse.papyrus.gmf.gmfgraph.DiagramLabel
'''
def addChildVisual(GenLink it) '''
- «IF it.hasFixedLabels»
+ «IF ! labels.empty»
«generatedMemberComment»
protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
if (addFixedChild(childEditPart)) {
return;
}
- super.addChildVisual(childEditPart, index);
+ super.addChildVisual(childEditPart, -1);
}
«ENDIF»
'''
def removeChildVisual(GenLink it) '''
- «IF it.hasFixedLabels»
+ «IF ! labels.empty»
«generatedMemberComment»
protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
if (removeFixedChild(childEditPart)) {
@@ -168,19 +170,22 @@ import xpt.Common_qvto import org.eclipse.papyrus.gmf.gmfgraph.DiagramLabel
def dispatch createLinkFigure(Viewmap it, GenLink link) '''«ERROR('Unknown viewmap: ' + it + ", for link: " + link)»'''
def dispatch createLinkFigure(ModeledViewmap it, GenLink link) '''
- protected org.eclipse.draw2d.Connection createConnectionFigure() {
- return new «modeledViewmapFigureFQN(it)»();
- }
-
- «generatedMemberComment»
- public «modeledViewmapFigureFQN(it)» getPrimaryShape() {
- return («modeledViewmapFigureFQN(it)») getFigure();
- }
-
- «xptModeledViewmapProducer.viewmapClassBody(it)»
+««« «generatedMemberComment»
+««« protected org.eclipse.draw2d.Connection createConnectionFigure() {
+««« return new «modeledViewmapFigureFQN(it)»();
+««« }
+«««
+««« «generatedMemberComment»
+««« public «modeledViewmapFigureFQN(it)» getPrimaryShape() {
+««« return («modeledViewmapFigureFQN(it)») getFigure();
+««« }
+«««
+««« «xptModeledViewmapProducer.viewmapClassBody(it)»
'''
- def modeledViewmapFigureFQN(ModeledViewmap it) '''«xptModeledViewmapProducer.viewmapFigureFQN(it)»'''
+ def modeledViewmapFigureFQN(ModeledViewmap it) '''
+««« «xptModeledViewmapProducer.viewmapFigureFQN(it)»
+ '''
def dispatch createLinkFigure(FigureViewmap it, GenLink link) {
var fqn = if(figureQualifiedClassName == null) 'org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx' else figureQualifiedClassName
@@ -222,4 +227,20 @@ import xpt.Common_qvto import org.eclipse.papyrus.gmf.gmfgraph.DiagramLabel
def boolean hasFixedLabels(GenLink it){
labels.notEmpty && (labels.filter(l | l.viewmap.oclIsKindOf(typeof(ParentAssignedViewmap))).notEmpty || labels.filter(l | l.viewmap.oclIsKindOf(typeof(ModeledViewmap))).notEmpty)
}
+
+
+
+ /**
+ * computes super type of the link edit part in case the edit part manages a representation of a UML element
+ */
+ def extendsListContents(GenLink it)'''
+ «IF superEditPart !== null»
+ «superEditPart»
+ «ELSE»
+ org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart
+ «ENDIF»
+ '''
}
+
+
+
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkLabelEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkLabelEditPart.xtend
index 3cbf4e11eea..75444cef8c8 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkLabelEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/LinkLabelEditPart.xtend
@@ -1,18 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Thibault Landre (Atos Origin) - initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
@@ -28,7 +29,7 @@ import xpt.diagram.editpolicies.TextSelectionEditPolicy
@Inject extension Common;
@Inject extension ViewmapAttributesUtils_qvto;
- @Inject xpt.diagram.editparts.Common xptEditpartsCommon;
+ @Inject extension xpt.diagram.editparts.Common xptEditpartsCommon;
@Inject VisualIDRegistry xptVisualIDRegistry;
@Inject TextSelectionEditPolicy textSelection;
@@ -61,7 +62,9 @@ import xpt.diagram.editpolicies.TextSelectionEditPolicy
'''
- def additionalEditPolicies(GenLinkLabel it) ''''''
+ def additionalEditPolicies(GenLinkLabel it) '''
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy());
+ '''
def getKeyPoint(GenLinkLabel it) '''
«generatedMemberComment»
@@ -72,7 +75,15 @@ import xpt.diagram.editpolicies.TextSelectionEditPolicy
def handleNotificationEventBody(GenLinkLabel it) '''
Object feature = event.getFeature();
- «xptEditpartsCommon.handleText(it)»
+ «handleText (it)»
+
+ ««« START Papyrus Code
+ «IF elementIcon»
+ if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
+ refreshLabel();
+ }
+ «ENDIF»
+ ««« End Papyrus Code
super.handleNotificationEvent(event);
'''
@@ -84,4 +95,5 @@ import xpt.diagram.editpolicies.TextSelectionEditPolicy
def linkLabelDragPolicyQualifiedClassName(GenDiagram it) '''org.eclipse.gmf.tooling.runtime.edit.policies.DefaultLinkLabelDragPolicy'''
def linkLabelDragPolicyClass(GenDiagram it) '''«/*not generated by default anymore */»'''
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeEditPart.xtend
index 828fee0ea8b..f8164434a3c 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeEditPart.xtend
@@ -1,58 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2014, 2021 Borland Software Corporation, Christian W. Damus, CEA LIST, Artal and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Patrick Tessier (CEA) - initial API and implementation
+ * Thibault Landre (Atos Origin) - initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels
+ * Christian W. Damus - bug 451230
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
import com.google.inject.Inject
-import xpt.Common
-import xpt.diagram.ViewmapAttributesUtils_qvto
-import xpt.Common_qvto
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildSideAffixedNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ViewmapLayoutType
-import xpt.editor.VisualIDRegistry
-import org.eclipse.papyrus.gmf.codegen.gmfgen.Viewmap
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ModeledViewmap
+import com.google.inject.Singleton
+import impl.diagram.editparts.viewmaps.modeledViewmapProducer
import org.eclipse.papyrus.gmf.codegen.gmfgen.FigureViewmap
-import org.eclipse.papyrus.gmf.codegen.gmfgen.SnippetViewmap
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildSideAffixedNode
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorChildReference
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenTopLevelNode
import org.eclipse.papyrus.gmf.codegen.gmfgen.InnerClassViewmap
+import org.eclipse.papyrus.gmf.codegen.gmfgen.ModeledViewmap
import org.eclipse.papyrus.gmf.codegen.gmfgen.ParentAssignedViewmap
-import org.eclipse.papyrus.gmf.gmfgraph.DiagramLabel
+import org.eclipse.papyrus.gmf.codegen.gmfgen.RefreshHook
+import org.eclipse.papyrus.gmf.codegen.gmfgen.SnippetViewmap
+import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
+import org.eclipse.papyrus.gmf.codegen.gmfgen.Viewmap
+import org.eclipse.papyrus.gmf.codegen.gmfgen.ViewmapLayoutType
import org.eclipse.papyrus.gmf.gmfgraph.Compartment
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
-import xpt.providers.ElementTypes
-import org.eclipse.papyrus.gmf.codegen.xtend.annotations.MetaDef
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenTopLevelNode
-import xpt.diagram.editpolicies.GraphicalNodeEditPolicy
-import xpt.diagram.editpolicies.TextSelectionEditPolicy
+import utils.EditPartsUtils_qvto
+import xpt.CodeStyle
+import xpt.Common
+import xpt.Common_qvto
+import xpt.diagram.ViewmapAttributesUtils_qvto
import xpt.diagram.editparts.EditPartFactory
+import xpt.diagram.editparts.Utils_qvto
+import xpt.diagram.editpolicies.TextSelectionEditPolicy
+import xpt.editor.VisualIDRegistry
+import xpt.providers.ElementTypes
-@com.google.inject.Singleton class NodeEditPart {
+@Singleton class NodeEditPart {
+ @Inject extension CodeStyle;
@Inject extension Common;
@Inject extension Common_qvto;
@Inject extension ViewmapAttributesUtils_qvto;
- @Inject extension xpt.diagram.editparts.Utils_qvto;
+ @Inject extension Utils_qvto;
@Inject extension xpt.diagram.Utils_qvto;
-
+ @Inject extension VisualIDRegistry
+ @Inject extension EditPartsUtils_qvto;
@Inject xpt.diagram.editparts.Common xptEditpartsCommon;
- @Inject impl.diagram.editparts.viewmaps.modeledViewmapProducer xptModeledViewmapProducer;
+ @Inject modeledViewmapProducer xptModeledViewmapProducer;
@Inject TextAware xptTextAware;
@Inject VisualIDRegistry xptVisualIDRegistry;
@Inject ElementTypes xptElementTypes;
- @Inject GraphicalNodeEditPolicy graphicalEditPolicy;
@Inject TextSelectionEditPolicy textSelection;
@Inject EditPartFactory xptEditPartFactory;
@@ -61,11 +72,25 @@ import xpt.diagram.editparts.EditPartFactory
def packageName(GenNode it) '''«getDiagram().editPartsPackageName»'''
def dispatch extendsListContents(GenNode it) '''
- «IF hasBorderItems(it)»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart«ENDIF»
- '''
+«««BEGIN: PapyrusGenCode
+«««Add own extension
+«IF superEditPart !== null»
+«superEditPart»
+«««END: BEGIN: PapyrusGenCode
+«ELSE»
+ org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart
+«ENDIF»
+'''
def dispatch extendsListContents(GenChildSideAffixedNode it) '''
- «IF hasBorderItems(it)»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF»
+ «««BEGIN: PapyrusGenCode
+ «««Add own extension
+ «IF superEditPart !== null»
+ «superEditPart»
+ «««END: BEGIN: PapyrusGenCode
+ «ELSE»
+ «IF hasBorderItems(it)»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF»
+ «ENDIF»
'''
def constructor(GenNode it) '''
@@ -95,10 +120,10 @@ import xpt.diagram.editparts.EditPartFactory
def additionalEditPolicies(GenNode it) ''''''
def installGraphicalNodeEditPolicy(GenNode it) '''
- «IF needsGraphicalNodeEditPolicy(it)»
- installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new «graphicalEditPolicy.qualifiedClassName(it)»());
- «ENDIF»
- '''
+
+ installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy());
+
+ '''
def installCreationRolePolicy(GenNode it) '''
«IF !childNodes.empty || hasChildrenInListCompartments(it)»
@@ -167,30 +192,36 @@ import xpt.diagram.editparts.EditPartFactory
def createLayoutEditPolicyBody_FLOW_LAYOUT(GenNode it) '''
org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy() {
«IF hasBorderItems(it)»
- «extraLineBreak»
+ «extraLineBreak»
+ «overrideC»
protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
«borderItemSelectionEditPolicy()»
return super.createChildEditPolicy(child);
}
«ENDIF»
+ «overrideC»
protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
return null;
}
+ «overrideC»
protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
return null;
}
+ «overrideC»
protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
return null;
}
};
return lep;
'''
+
def createLayoutEditPolicyBody_DEFAULT(GenNode it) '''
org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
+ «overrideC»
protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
«borderItemSelectionEditPolicy(it)»
org.eclipse.gef.EditPolicy result = child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
@@ -200,10 +231,12 @@ import xpt.diagram.editparts.EditPartFactory
return result;
}
+ «overrideC»
protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
return null;
}
+ «overrideC»
protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
return null;
}
@@ -214,27 +247,34 @@ import xpt.diagram.editparts.EditPartFactory
def borderItemSelectionEditPolicy(GenNode it) '''
«IF hasBorderItems(it)»
org.eclipse.gmf.runtime.notation.View childView = (org.eclipse.gmf.runtime.notation.View) child.getModel();
- switch («xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(childView)) {
- «IF !getExternalLabels(it).empty»
- «FOR nextLabel : getExternalLabels(it)»
- «xptVisualIDRegistry.caseVisualID(nextLabel)»
- «ENDFOR»
- return «borderItemSelectionEP(it)»;
- «ENDIF»
- «IF !getSideAffixedChildren(it).empty»
- «FOR nextBorderItem : getSideAffixedChildren(it)»
- «xptVisualIDRegistry.caseVisualID(nextBorderItem)»
- «ENDFOR»
- return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy();
- «ENDIF»
+ String vid = «getVisualIDMethodCall(getDiagram())»(childView);
+ if (vid != null) {
+ switch (vid) {
+ «IF getExternalLabels(it).size > 0»
+ «FOR nextLabel : getExternalLabels(it) »
+ «caseVisualID(nextLabel)»
+ «ENDFOR»
+ return «borderItemSelectionEP(it)»;
+ «ENDIF»
+ «IF getSideAffixedChildren(it).size > 0»
+ «FOR nextBorderItem : getSideAffixedChildren(it)»
+ «caseVisualID(nextBorderItem)»
+ «ENDFOR»
+ ««« BEGIN PapyrusGenCode
+ ««« The purprose is to add replace GMF edit prolicy by an new editPolicy that allows to resize BorderItem
+ return new org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy();
+ ««« END PapyrusGenCode
+ «ENDIF»
+ }
}
- «ENDIF»
- '''
+«ENDIF»
+'''
- def borderItemSelectionEP(GenNode it) '''
+ def borderItemSelectionEP(GenNode it)'''
new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy() {
- protected java.util.List createSelectionHandles() {
+ «overrideC»
+ 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);
@@ -314,47 +354,41 @@ import xpt.diagram.editparts.EditPartFactory
def addFixedChild(GenNode it) '''
«generatedMemberComment»
protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
- «FOR label : getInnerFixedLabels(it)»
- «var childViewmap = label.viewmap as ParentAssignedViewmap»
+«FOR label:getInnerFixedLabels(it)»«var childViewmap = label.viewmap as ParentAssignedViewmap»
if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(label)») {
((«xptEditPartFactory.getEditPartQualifiedClassName(label)») childEditPart).«xptTextAware.labelSetterName(childViewmap)»(getPrimaryShape().«childViewmap.getterName»());
return true;
}
- «ENDFOR»
- «FOR label : getInnerFixedLabelsWithModeledViewmaps(it)»
- «var childViewmap = label.viewmap as ModeledViewmap»
- «var getterName = (childViewmap.figureModel as DiagramLabel).accessor.accessor»
- if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(label)») {
- ((«xptEditPartFactory.getEditPartQualifiedClassName(label)») childEditPart).«xptTextAware.labelSetterName(childViewmap)»(getPrimaryShape().«getterName»());
- return true;
- }
- «ENDFOR»
- «FOR compartment : getPinnedCompartments(it)»
- «var childViewmap = compartment.viewmap as ParentAssignedViewmap»
- if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(compartment)») {
+«ENDFOR»
+
+«FOR compartment : getPinnedCompartments(it)»«var childViewmap = compartment.viewmap as ParentAssignedViewmap»
+
+ 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(((«xptEditPartFactory.getEditPartQualifiedClassName(compartment)») childEditPart).getFigure());
+ pane.add(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure());
return true;
}
- «ENDFOR»
- «FOR compartment : getPinnedCompartmentsWithModeledViewmaps(it)»
- «var childViewmap = compartment.viewmap as ModeledViewmap»
- «var getterName = (childViewmap.figureModel as Compartment).accessor.accessor»
- if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(compartment)») {
- org.eclipse.draw2d.IFigure pane = getPrimaryShape().«getterName»();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((«xptEditPartFactory.getEditPartQualifiedClassName(compartment)») childEditPart).getFigure());
- return true;
- }
- «ENDFOR»
- «FOR child : getSideAffixedChildren(it)»
- if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(child)») {
+«ENDFOR»
+
+«FOR child:getSideAffixedChildren(it)»
+ ««« BEGIN PapyrusGencode
+ ««« adding IF else end in order to take in account the case where a specific locator is added
+
+
+ «IF child.locatorClassName !== null»
+ «genSpecificLocator(child)»
+ «ELSE»
+ «««END PapyrusGencode«ENDREM
+ 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(((«xptEditPartFactory.getEditPartQualifiedClassName(child)») childEditPart).getFigure(), locator);
+ getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator);
return true;
}
- «ENDFOR»
+ ««« BEGIN PapyrusGencode
+ «ENDIF»
+ «««END PapyrusGencode
+«ENDFOR»
return false;
}
'''
@@ -446,36 +480,62 @@ import xpt.diagram.editparts.EditPartFactory
'''
def addBorderItem(GenNode it) '''
- «IF !getExternalLabels(it).empty»
+ «IF getExternalLabels(it).size > 0»
«generatedMemberComment»
protected void addBorderItem(org.eclipse.draw2d.IFigure borderItemContainer, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart borderItemEditPart) {
- if («FOR label : getExternalLabels(it) SEPARATOR ' || '»borderItemEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(label)»«ENDFOR») {
+ «IF getExternalLabelsWithoutSpecificLocator(it).size > 0»
+ if («FOR label : getExternalLabelsWithoutSpecificLocator(it) SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOR») {
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 {
+ } else
+ «ENDIF»
+ «FOR label : getExternalLabelsWithSpecificLocator(it)»
+ if (borderItemEditPart instanceof «label.getEditPartQualifiedClassName()») {
+ org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «getSpecificLocator(label)»(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else
+ «ENDFOR»
+ {
super.addBorderItem(borderItemContainer, borderItemEditPart);
}
}
«ENDIF»
- '''
+'''
def createNodePlate(GenNode it) '''
«generatedMemberComment»
+ ««« @deprecated
+ ««« «IF nodePlateQualifiedName !== null»
+ ««« protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
+ ««« «nodePlateQualifiedName» result = new «nodePlateQualifiedName»(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»);
+ ««« «setupNodePlate»
+ ««« return result;
+ ««« }
+ ««« «««END: BEGIN: PapyrusGenCode
+ ««« «ELSE»
+ ««« «super.createNodePlate(it)»
+ «««
+ ««« By default node edit part are now RoundedRectangleNodePlateFigure
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(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»);
+ org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure result = new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»);
«setupNodePlate»
return result;
}
+ ««« «ENDIF»
'''
- def dispatch setupNodePlate(GenNode it) ''''''
- def dispatch setupNodePlate(GenChildSideAffixedNode it) '''
- «extraLineBreak»
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
- '''
+
+def setupNodePlate (GenNode it) ''''''
+
+//FIXME EAL dead code no dispatch
+//def setupNodePlate (GenChildSideAffixedNode it)'''
+// //FIXME: workaround for #154536
+// result.getBounds().setSize(result.getPreferredSize());
+//'''
+
+
def getPrimaryDragEditPolicy(GenNode it) '''
«var rc = getResizeConstraints(it.viewmap)»
@@ -509,12 +569,17 @@ import xpt.diagram.editparts.EditPartFactory
'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(it)»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;
+ «IF it instanceof GenChildSideAffixedNode»
+ 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;
+ «ELSE»
+ return new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure(createMainFigureWithSVG());
+ «ENDIF»
+
}
'''
@@ -580,17 +645,18 @@ import xpt.diagram.editparts.EditPartFactory
def setLineWidth(GenNode it) '''
«generatedMemberComment»
protected void setLineWidth(int width) {
- if (primaryShape instanceof org.eclipse.draw2d.Shape) {
- ((org.eclipse.draw2d.Shape) primaryShape).setLineWidth(«IF getDiagram().isPixelMapMode()»width«ELSE»getMapMode().DPtoLP(width)«ENDIF»);
- }
+««« if (primaryShape instanceof org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) {
+««« ((org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) primaryShape).setLineWidth(«IF getDiagram().isPixelMapMode()»width«ELSE»getMapMode().DPtoLP(width)«ENDIF»);
+««« }
+ super.setLineWidth(width);
}
'''
def setLineStyle(GenNode it) '''
«generatedMemberComment»
protected void setLineType(int style) {
- if (primaryShape instanceof org.eclipse.draw2d.Shape) {
- ((org.eclipse.draw2d.Shape) primaryShape).setLineStyle(style);
+ if (primaryShape instanceof org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure) {
+ ((org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure) primaryShape).setLineStyle(style);
}
}
'''
@@ -621,23 +687,99 @@ import xpt.diagram.editparts.EditPartFactory
'''
def getTargetEditPartMethod(GenNode it) '''
- «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);
- «FOR compartment : compartments»
- «IF listCompartmentHasChildren(compartment)»
- «FOR childNode : compartment.childNodes»
- if (type == «xptElementTypes.accessElementType(childNode)») {
- return getChildBySemanticHint(«xptVisualIDRegistry.typeMethodCall(compartment)»);
+ «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);
+ «FOR compartment : compartments»
+ «IF listCompartmentHasChildren(compartment)»
+ «FOR childNode : compartment.childNodes»
+ if («xptElementTypes.className(it.diagram)».isKindOf(type, «xptElementTypes.accessElementType(childNode)»)) {
+ return getChildBySemanticHint(«xptVisualIDRegistry.typeMethodCall(compartment)»);
+ }
+ «ENDFOR»
+ «ENDIF»
+ «ENDFOR»
+ }
+ return super.getTargetEditPart(request);
+ }
+'''
+
+
+//---------
+// GMF
+//---------
+
+
+
+//---------
+// PAPYRUS
+//---------
+
+
+
+def genSpecificLocator(GenCommonBase it, GenChildSideAffixedNode child) ''''''
+
+def genSpecificLocator(ToolEntry it, GenChildSideAffixedNode child) ''''''
+
+def genSpecificLocator(GenNavigatorChildReference it,GenChildSideAffixedNode child)''''''
+
+def genSpecificLocator(GenChildSideAffixedNode it)'''
+ ««« // @depracated Papyrus Gencode :«locatorComment»
+ if (childEditPart instanceof «it.getEditPartQualifiedClassName()») {
+ org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «locatorClassName»(getMainFigure(), org.eclipse.draw2d.PositionConstants.«preferredSideName»);
+ getBorderedFigure().getBorderItemContainer().add(((«it.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator);
+ return true;
+ }
+
+'''
+
+
+
+/**
+ * CreateGenerator to refresh figure by taking account of event of UML element or graphical element
+ */
+def specificHandleNotificationEvent (GenNode it) '''
+ «IF it.specificNotificationEvent »
+ /**
+ *Papyrus codeGen
+ *@generated
+ **/
+ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
+ «IF it.labels.filter(typeof(GenExternalNodeLabel)).size != 0»
+ /*
+ * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
+ * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
+ */
+ if(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ Object notifier = event.getNotifier();
+ java.util.List<?> modelChildren = ((org.eclipse.gmf.runtime.notation.View)getModel()).getChildren();
+ if (false == notifier instanceof org.eclipse.gmf.runtime.notation.Edge
+ ««« see Bug 463769
+ && false == notifier instanceof org.eclipse.gmf.runtime.notation.BasicCompartment) {
+ if(modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
}
- «ENDFOR»
+ «ENDIF»
+ super.handleNotificationEvent(event);
+ «IF refreshHook !== null»
+ «specificHandleNotificationEventBody(refreshHook)»
+ «ENDIF»
+
+ }
«ENDIF»
- «ENDFOR»
+
+'''
+
+def specificHandleNotificationEventBody(RefreshHook it) '''
+ if (resolveSemanticElement() != null) {
+ if(«refreshCondition»){
+ «refreshAction»;
+ refreshVisuals();
}
- return super.getTargetEditPart(request);
}
-'''
-
+'''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeLabelEditPart.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeLabelEditPart.xtend
index bcecade1c20..97b861507fc 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeLabelEditPart.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/NodeLabelEditPart.xtend
@@ -1,18 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Thibault Landre (Atos Origin) - initial API and implementation
+ * Benoit Maggi (CEA LIST) -#510281 change dependency to replace gmft-runtime
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
@@ -75,6 +77,13 @@ import xpt.diagram.editpolicies.TextSelectionEditPolicy
«xptEditpartsCommon.handleBounds(it)»
«ENDIF»
«xptEditpartsCommon.handleText(it)»
+ ««« START Papyrus Code
+ «IF elementIcon»
+ if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
+ refreshLabel();
+ }
+ «ENDIF»
+ ««« End Papyrus Code
super.handleNotificationEvent(event);
'''
@@ -83,7 +92,7 @@ import xpt.diagram.editpolicies.TextSelectionEditPolicy
* see org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy.
* The next 2 DEFINE's are left here as a hook for possible AROUND's
*/
- def nodeLabelDragPolicyQualifiedClassName(GenDiagram it) '''org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy'''
+ def nodeLabelDragPolicyQualifiedClassName(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy'''
def nodeLabelDragPolicyClass(GenDiagram it) '''«/*not generated by default anymore*/»'''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/TextAware.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/TextAware.xtend
index 82c8c30374b..8ca67601502 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/TextAware.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/editparts/TextAware.xtend
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006-2013 Borland Software Corporation and others
+ * Copyright (c) 2006-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -9,67 +9,63 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.editparts
import com.google.inject.Inject
-import impl.diagram.editparts.viewmaps.modeledViewmapProducer
-import impl.parsers.expression_qvto
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.DesignLabelModelFacet
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.gmfgen.LabelModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ModeledViewmap
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ParentAssignedViewmap
import org.eclipse.papyrus.gmf.codegen.gmfgen.Viewmap
-import parsers.ParserProvider
import xpt.CodeStyle
import xpt.Common
import xpt.diagram.ViewmapAttributesUtils_qvto
import xpt.diagram.editparts.EditPartFactory
import xpt.providers.ElementTypes
-@com.google.inject.Singleton class TextAware {
+@Singleton class TextAware {
@Inject extension Common
@Inject extension CodeStyle
@Inject extension ViewmapAttributesUtils_qvto
@Inject extension ChoiceUtils_qvto
@Inject extension RuntimeLabelsSupport_qvto
- @Inject extension expression_qvto
- @Inject modeledViewmapProducer xptModeledViewmapProducer;
- @Inject ParserProvider xptParserProvider;
@Inject EditPartFactory xptEditPartFactory
@Inject ElementTypes xptElementTypes;
def fields(GenCommonBase it) '''
- «generatedMemberComment()»
- private org.eclipse.gef.tools.DirectEditManager manager;
-
- «generatedMemberComment()»
- private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser;
-
- «IF isOclChoiceLabel(it) || isViewExpressionDefinedAndOcl(it)»
- «generatedMemberComment()»
- private org.eclipse.gmf.tooling.runtime.ocl.tracker.OclTracker.Registrator myOclRegistrator;
- «ELSE»
- «generatedMemberComment()»
- private java.util.List<?> parserElements;
- «ENDIF»
-
- «generatedMemberComment()»
- private String defaultText;
-
- «generatedMemberComment()»
- private org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate labelDelegate;
- '''
+ «generatedMemberComment»
+ private org.eclipse.gef.tools.DirectEditManager manager;
+
+ «generatedMemberComment»
+ private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser;
+
+ «generatedMemberComment»
+ private java.util.List<?> parserElements;
+
+ «generatedMemberComment»
+ private String defaultText;
+
+ ««« BEGIN: PapyrusGenCode
+ ««« Add attributes to manage extended editors
+ «generatedMemberComment('direct edition mode (default, undefined, registered editor, etc.)')»
+ protected int directEditionMode = org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ «generatedMemberComment('configuration from a registered edit dialog')»
+ protected org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration configuration;
+ ««« END: BEGIN: PapyrusGenCode
+
+'''
def methods(GenCommonBase it, boolean needsRefreshBounds, boolean readOnly, boolean useElementIcon, Viewmap viewmap,
LabelModelFacet modelFacet, GenCommonBase host, GenDiagram diagram) '''
+
«getLabelTextHelper(it)»
«setLabelTextHelper(it)»
@@ -78,150 +74,139 @@ import xpt.providers.ElementTypes
«setLabelIconHelper(it)»
- «labelSetter(it)»
+ « labelSetter(it)»
- «getModelChildren(it)»
+ « getModelChildren(it)»
- «getChildBySemanticHint(it)»
+ « getChildBySemanticHint(it)»
+««« ITEMIS CHANGES
+ « setParser (it)»
+««« ITEMIS CHANGES END
+ « getParserElement(it,modelFacet)»
- «getParserElement(it, modelFacet)»
+ « getLabelIcon(it,useElementIcon, diagram)»
- «getLabelIcon(it, useElementIcon, diagram)»
+ « getLabelText(it)»
- «getLabelText(it)»
+ « setLabelText(it,diagram)»
- «setLabelText(it, diagram)»
+ « getEditText(it)»
- «getEditText(it)»
+ « isEditable(it,readOnly)»
- «isEditable(it, readOnly)»
+ « getEditTextValidator(it)»
- «getEditTextValidator(it)»
+ « getCompletionProcessor(it)»
- «getCompletionProcessor(it)»
+ « getParserOptions(it)»
- «getParserOptions(it)»
+ « getParser(it,modelFacet, diagram, host)»
- «getParser(it, modelFacet, diagram, host)»
+ « getManager(it,diagram)»
- «getManager(it, diagram, modelFacet)»
+ « setManager(it)»
- «setManager(it)»
+ « performDirectEdit(it)»
- «performDirectEdit(it)»
+ « performDirectEditAtPoint(it)»
- «performDirectEditAtPoint(it, modelFacet)»
-
-«IF !(isChoiceLabel(modelFacet))»
- «performDirectEditWithInitialChar(it)»
-«ENDIF»
+ « performDirectEditWithInitialChar(it)»
- «performDirectEditRequest(it, modelFacet)»
+ « performDirectEditRequest(it,diagram)»
- «refreshVisuals(it, needsRefreshBounds)»
+ « initializeDirectEditManager(it)»
- «refreshLabel(it, diagram)»
+ « refreshVisuals(it,needsRefreshBounds)»
- «refreshUnderline(it)»
+ « refreshLabel(it,diagram)»
- «refreshStrikeThrough(it)»
+ « refreshUnderline(it)»
- «refreshFont(it)»
+ « refreshStrikeThrough(it)»
- «refreshSelectionFeedback(it)»
+ « refreshFont(it)»
- «setFontColor(it)»
+ « setFontColor(it)»
- «addSemanticListeners(it)»
+ « addSemanticListeners(it)»
- «removeSemanticListeners(it)»
+ « removeSemanticListeners(it)»
- «getAccessibleEditPart(it)»
+ « getAccessibleEditPart(it)»
- «getFontStyleOwnerView(it, viewmap)»
-
-«IF isOclChoiceLabelWithShowExpr(it) || isViewExpressionDefinedAndOcl(it)»
- «getOclTracker(it)»
-«ENDIF»
+ « getFontStyleOwnerView(it,viewmap)»
+
+ ««« BEGIN: PapyrusGenCode
+ ««« Add extended editors management for direct edit
+ « getDirectEditionType(it,readOnly)»
-«IF isOclChoiceLabel(it) || isViewExpressionDefinedAndOcl(it)»
- «getOclRegistrator(it)»
-«ENDIF»
+ « checkExtendedEditor(it)»
- «getLabelDelegate(it)»
-
- «getAdapter(it)»
-'''
+ « checkDefaultEdition(it)»
- def dispatch labelSetterName(ParentAssignedViewmap it) '''«IF setterName != null»«setterName»«ELSE»setLabel«ENDIF»'''
+ « initExtendedEditorConfiguration(it)»
+
+ « updateExtendedEditorConfiguration(it)»
+
+ « performDefaultDirectEditorEdit(it)»
+
+ «««END: PapyrusGenCode
+'''
- def dispatch labelSetterName(Viewmap it) '''setLabel'''
+def labelSetterName(Viewmap it)'''setLabel'''
- def dispatch labelSetterName(ModeledViewmap it) '''setLabel'''
def getLabelTextHelper(GenCommonBase it) '''
- «generatedMemberComment()»
- protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText();
- } «IF isVerticalLabel(it)» else if (figure instanceof «getVerticalLabelFQN()») {
- return ((«getVerticalLabelFQN()») figure).getText();
- } «ENDIF» else if (figure instanceof org.eclipse.draw2d.Label) {
- return ((org.eclipse.draw2d.Label) figure).getText();
- } else {
- return getLabelDelegate().getText();
- }
- }
- '''
+ « generatedMemberComment»
+ protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText();
+ } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
+ return ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).getText();
+ } else {
+ return ((org.eclipse.draw2d.Label) figure).getText();
+ }
+ }
+'''
def setLabelTextHelper(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text);
- } «IF isVerticalLabel(it)» else if (figure instanceof «getVerticalLabelFQN()») {
- ((«getVerticalLabelFQN()») figure).setText(text);
- } «ENDIF» else if (figure instanceof org.eclipse.draw2d.Label) {
- ((org.eclipse.draw2d.Label) figure).setText(text);
- } else {
- getLabelDelegate().setText(text);
- }
- }
- '''
+ «generatedMemberComment»
+ protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text);
+ } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
+ ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).setText(text);
+ } else {
+ ((org.eclipse.draw2d.Label) figure).setText(text);
+ }
+ }
+'''
def getLabelIconHelper(GenCommonBase it) '''
- «generatedMemberComment()»
- protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon();
- } «IF isVerticalLabel(it)» else if (figure instanceof «getVerticalLabelFQN()») {
- //icons are not supported for verical labels now
- return null;
- } «ENDIF» else if (figure instanceof org.eclipse.draw2d.Label) {
- return ((org.eclipse.draw2d.Label) figure).getIcon();
- } else {
- return getLabelDelegate().getIcon(0);
- }
- }
- '''
+ «generatedMemberComment»
+ protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon();
+ } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
+ return ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).getIcon();
+ } else {
+ return ((org.eclipse.draw2d.Label) figure).getIcon();
+ }
+ }
+'''
def setLabelIconHelper(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon);
- return;
- } «IF isVerticalLabel(it)» else if (figure instanceof «getVerticalLabelFQN()») {
- //icons are not supported for verical labels now, nothing to do
- return;
- } «ENDIF» else if (figure instanceof org.eclipse.draw2d.Label) {
- ((org.eclipse.draw2d.Label) figure).setIcon(icon);
- return;
- } else {
- getLabelDelegate().setIcon(icon, 0);
- }
- }
- '''
+ «generatedMemberComment»
+ protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
+ ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).setIcon(icon);
+ } else {
+ ((org.eclipse.draw2d.Label) figure).setIcon(icon);
+ }
+ }
+'''
def getLabelDelegate(GenCommonBase it) '''
«generatedMemberComment()»
@@ -252,55 +237,43 @@ import xpt.providers.ElementTypes
'''
def labelSetter(GenCommonBase it) '''
- «generatedMemberComment()»
- public void «labelSetterName(viewmap)»(«labelSetterFigureClassName(viewmap)» figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
- '''
-
- def dispatch labelSetterFigureClassName(ParentAssignedViewmap it) //
- '''
- «IF figureQualifiedClassName != null»«figureQualifiedClassName»«ELSE»org.eclipse.draw2d.IFigure«ENDIF»
- '''
-
- def dispatch labelSetterFigureClassName(ModeledViewmap it) '''
-«xptModeledViewmapProducer.viewmapFigureFQN(it)»
+ «generatedMemberComment»
+ public void « labelSetterName (viewmap)»(« labelSetterFigureClassName(viewmap)» figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
'''
- def dispatch labelSetterFigureClassName(Viewmap it) '''
- org.eclipse.draw2d.IFigure
- '''
+def labelSetterFigureClassName (Viewmap it)'''
+ org.eclipse.draw2d.IFigure
+'''
def getModelChildren(GenCommonBase it) '''
- «generatedMemberComment()»
- «SuppressWarnings('"rawtypes"')»
- protected java.util.List getModelChildren() {
- return java.util.Collections.EMPTY_LIST;
- }
- '''
+ «generatedMemberComment»
+ protected java.util.List<?> getModelChildren() {
+ return java.util.Collections.EMPTY_LIST;
+ }
+'''
def getChildBySemanticHint(GenCommonBase it) '''
- «generatedMemberComment()»
- public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
- '''
+ «generatedMemberComment»
+ public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+'''
def getParserElement(GenCommonBase it, LabelModelFacet modelFacet) '''
- «generatedMemberComment()»
- protected org.eclipse.emf.ecore.EObject getParserElement() {
- «IF modelFacet == null»
- org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
- return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel();
- «ELSE»
- «dispatch_getParserElement(modelFacet)»
- «ENDIF»
- }
- '''
+ «generatedMemberComment»
+ protected org.eclipse.emf.ecore.EObject getParserElement() {
+ «IF modelFacet === null»
+ org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
+ return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel();
+ «ELSE»« getParserElement(modelFacet)»«ENDIF»
+ }
+'''
def dispatch dispatch_getParserElement(LabelModelFacet it) '''
return resolveSemanticElement();
@@ -311,56 +284,61 @@ import xpt.providers.ElementTypes
'''
def getLabelIcon(GenCommonBase it, boolean useElementIcon, GenDiagram diagram) '''
- «generatedMemberComment()»
- protected org.eclipse.swt.graphics.Image getLabelIcon() {
- «IF useElementIcon»
- org.eclipse.emf.ecore.EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- return «xptElementTypes.qualifiedClassName(diagram)».getImage(parserElement.eClass());
- «ELSE»
- return null;
- «ENDIF»
- }
- '''
+ «generatedMemberComment»
+ protected org.eclipse.swt.graphics.Image getLabelIcon() {
+ «IF useElementIcon»
+ ««« START: PapyrusGenCode
+ return org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.getIcon(getParserElement(), getViewer());
+ ««« END: PapyrusGenCode
+ «ELSE»
+ return null;
+ «ENDIF»
+ }
+'''
def getLabelText(GenCommonBase it) '''
- «generatedMemberComment()»
- protected String getLabelText() {
- String text = null;
- org.eclipse.emf.ecore.EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(parserElement),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
+ «generatedMemberComment»
+ protected String getLabelText() {
+ String text = null;
+ org.eclipse.emf.ecore.EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this),
+ getParserOptions().intValue());
}
- '''
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+'''
def setLabelText(GenCommonBase it, GenDiagram diagram) '''
- «generatedMemberComment()»
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- refreshSelectionFeedback();
- }
- '''
+ «generatedMemberComment»
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
+ }
+ }
+'''
def getEditText(GenCommonBase it) '''
- «generatedMemberComment()»
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; «nonNLS()»
- }
- return getParser().getEditString(
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
- '''
+ «generatedMemberComment»
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; «nonNLS»
+ }
+ return getParser().getEditString(
+ org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this),
+ getParserOptions().intValue());
+ }
+'''
def isEditable(GenCommonBase it, Boolean readOnly) '''
«generatedMemberComment()»
@@ -374,10 +352,11 @@ import xpt.providers.ElementTypes
'''
def getEditTextValidator(GenCommonBase it) '''
- «generatedMemberComment()»
- public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
- return new org.eclipse.jface.viewers.ICellEditorValidator() {
-
+ «generatedMemberComment»
+ public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
+ return new org.eclipse.jface.viewers.ICellEditorValidator() {
+
+ «overrideI»
public String isValid(final Object value) {
if (value instanceof String) {
final org.eclipse.emf.ecore.EObject element = getParserElement();
@@ -385,51 +364,53 @@ import xpt.providers.ElementTypes
try {
org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus valid =
(org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive(
- new org.eclipse.emf.transaction.RunnableWithResult.Impl<org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus>() {
-
- public void run() {
- setResult(parser.isValidEditString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
+ new org.eclipse.emf.transaction.RunnableWithResult.Impl<java.lang.Object>() {
+
+ «overrideI»
+ public void run() {
+ setResult(parser.isValidEditString(org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), «editPartClassName».this), (String) value));
+ }
+ });
+ return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
}
-
- // shouldn't get here
- return null;
}
- };
- }
- '''
- def getCompletionProcessor(GenCommonBase it) '''
- «generatedMemberComment()»
- public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
+ // shouldn't get here
return null;
}
- return getParser().getCompletionProcessor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()));
+ };
+ }
+'''
+
+ def getCompletionProcessor(GenCommonBase it) '''
+ «generatedMemberComment»
+ public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
}
- '''
+ return getParser().getCompletionProcessor(org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this));
+ }
+'''
+
def getParserOptions(GenCommonBase it) '''
- «generatedMemberComment()»
- public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() {
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE;
- }
- '''
+ «generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() {
+ return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE;
+ }
+'''
def getParser(GenCommonBase it, LabelModelFacet modelFacet, GenDiagram diagram, GenCommonBase host) '''
- «generatedMemberComment()»
- public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() {
- if (parser == null) {
- parser = «xptParserProvider.accessorCall(it, host, modelFacet, 'getParserElement()')»;
- }
- return parser;
+ «generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() {
+ if (parser == null) {
+ parser = org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParser(«xptElementTypes.accessElementType(host)», getParserElement(), this, VISUAL_ID);
}
- '''
+ return parser;
+ }
+'''
def getManager(GenCommonBase it, GenDiagram diagram, LabelModelFacet modelFacet) '''
«generatedMemberComment()»
@@ -444,18 +425,24 @@ import xpt.providers.ElementTypes
'''
def setManager(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) {
- this.manager = manager;
- }
- '''
+ «generatedMemberComment»
+ protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) {
+ this.manager = manager;
+ }
+'''
def performDirectEdit(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void performDirectEdit() {
- getManager().show();
- }
- '''
+ «generatedMemberComment»
+ protected void performDirectEdit() {
+ org.eclipse.swt.custom.BusyIndicator.showWhile(org.eclipse.swt.widgets.Display.getDefault(), new java.lang.Runnable() {
+
+ «overrideI»
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+'''
def performDirectEditAtPoint(GenCommonBase it, LabelModelFacet modelFacet) '''
«generatedMemberComment()»
@@ -467,16 +454,15 @@ import xpt.providers.ElementTypes
'''
def performDirectEditWithInitialChar(GenCommonBase it) '''
- «generatedMemberComment()»
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
- ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter);
- } else //
- {
- performDirectEdit();
- }
- }
- '''
+ «generatedMemberComment»
+ protected void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
+ ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+'''
def performDirectEditRequest(GenCommonBase it, LabelModelFacet modelFacet) '''
«generatedMemberComment()»
@@ -522,53 +508,79 @@ import xpt.providers.ElementTypes
'''
def refreshLabel(GenCommonBase it, GenDiagram diagram) '''
- «generatedMemberComment()»
- protected void refreshLabel() {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- refreshSelectionFeedback();
+ «generatedMemberComment»
+ protected void refreshLabel() {
+ org.eclipse.gef.EditPolicy maskLabelPolicy = getEditPolicy(org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if(maskLabelPolicy==null){
+ maskLabelPolicy = getEditPolicy(org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View)getModel();
+ if(view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
}
- '''
+ Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
+ }
+ }
+'''
def refreshUnderline(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void refreshUnderline() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ «generatedMemberComment»
+ protected void refreshUnderline() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if(resolveSemanticElement() instanceof org.eclipse.uml2.uml.Feature){
+ if(((org.eclipse.uml2.uml.Feature)resolveSemanticElement()).isStatic()){
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)getFigure()).setTextUnderline(true);
}
+ else{((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)getFigure()).setTextUnderline(false);}
}
- '''
+ }
+'''
def refreshStrikeThrough(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void refreshStrikeThrough() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
- '''
+ «generatedMemberComment»
+ protected void refreshStrikeThrough() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+'''
- def refreshFont(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void refreshFont() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) |
- (style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL));
- setFont(fontData);
- }
- }
- '''
+ def refreshFont(GenCommonBase it)'''
+ «generatedMemberComment»
+ protected void refreshFont() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) |
+ (style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+'''
def refreshSelectionFeedback(GenCommonBase it) '''
«generatedMemberComment()»
@@ -587,89 +599,66 @@ import xpt.providers.ElementTypes
'''
def setFontColor(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void setFontColor(org.eclipse.swt.graphics.Color color) {
- getFigure().setForegroundColor(color);
- }
- '''
+ «generatedMemberComment»
+ protected void setFontColor(org.eclipse.swt.graphics.Color color) {
+ getFigure().setForegroundColor(color);
+ }
+'''
def addSemanticListeners(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void addSemanticListeners() {
- «IF isOclChoiceLabel(it) || isViewExpressionDefinedAndOcl(it)»
- «IF isOclChoiceLabelWithShowExpr(it) || isViewExpressionDefinedAndOcl(it)»
- org.eclipse.gmf.tooling.runtime.ocl.tracker.OclTracker tracker = getTracker();
- tracker.initialize(resolveSemanticElement());
- tracker.installListeners(getEditingDomain(), this, getOclRegistrator());
- «ELSE»
- super.addSemanticListeners();
- «ENDIF»
- «IF isOclChoiceLabel(it)»
- ((org.eclipse.gmf.tooling.runtime.parsers.OclChoiceParser) getParser()).installListeners(this, getOclRegistrator());
- «ENDIF»
- «ELSE»
- if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
- org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
- parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «nonNLS()»
- }
- } else {
- super.addSemanticListeners();
+ «generatedMemberComment»
+ protected void addSemanticListeners() {
+ if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
+ org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
+ parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «nonNLS»
}
- «ENDIF»
+ } else {
+ super.addSemanticListeners();
}
- '''
+ }
+'''
def removeSemanticListeners(GenCommonBase it) '''
- «generatedMemberComment()»
- protected void removeSemanticListeners() {
- «IF isOclChoiceLabel(it) || isViewExpressionDefinedAndOcl(it)»
- «IF isOclChoiceLabel(it)»
- ((org.eclipse.gmf.tooling.runtime.parsers.OclChoiceParser) getParser()).uninstallListeners();
- «ENDIF»
- «IF isOclChoiceLabelWithShowExpr(it) || isViewExpressionDefinedAndOcl(it)»
- getTracker().uninstallListeners();
- «ELSE»
- super.removeSemanticListeners();
- «ENDIF»
- «ELSE»
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); «nonNLS()»
- }
- } else {
- super.removeSemanticListeners();
+ «generatedMemberComment»
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); «nonNLS»
}
- «ENDIF»
+ } else {
+ super.removeSemanticListeners();
}
- '''
+ }
+'''
def getAccessibleEditPart(GenCommonBase it) '''
- «generatedMemberComment()»
- protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
+ «generatedMemberComment»
+ protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ «overrideC»
+ public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
}
- '''
+ return accessibleEP;
+ }
+'''
def getFontStyleOwnerView(GenCommonBase it, Viewmap viewmap) '''
- «generatedMemberComment()»
- private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() {
- «IF viewmap.isFixedFont()»
- return (org.eclipse.gmf.runtime.notation.View) getModel();
- «ELSE»
- return getPrimaryView();
- «ENDIF»
- }
- '''
+ «generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() {
+ «IF isFixedFont(viewmap)»
+ return (org.eclipse.gmf.runtime.notation.View) getModel();
+ «ELSE»
+ return getPrimaryView();
+ «ENDIF»
+ }
+'''
def getOclTracker(GenCommonBase it) '''
«generatedMemberComment()»
@@ -699,4 +688,298 @@ import xpt.providers.ElementTypes
}
'''
+// FIXME eallogo hidden code ??? (dispatch ?)
+//def dispatch labelSetterName(ParentAssignedViewmap it) '''«IF setterName !== null »«setterName»«ELSE»setLabel«ENDIF»'''
+
+// FIXME eallogo hidden code ??? (dispatch ?)
+//def dispatch labelSetterFigureClassName (ParentAssignedViewmap it)'''
+// «IF figureQualifiedClassName !== null»
+// «figureQualifiedClassName»
+// «ELSE»
+// org.eclipse.draw2d.IFigure
+// «ENDIF»
+//'''
+
+
+
+def setParser (GenCommonBase it)'''
+ «generatedMemberComment»
+ public void setParser(org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser) {
+ this.parser = parser;
+ }
+'''
+
+
+def getParserElement (LabelModelFacet it)'''
+ return resolveSemanticElement();
+'''
+
+def getParserElement (DesignLabelModelFacet it)'''
+ return (org.eclipse.gmf.runtime.notation.View) getModel();
+'''
+
+
+def isEditable(GenCommonBase it, boolean readOnly ) '''
+ «generatedMemberComment»
+ protected boolean isEditable() {
+ «IF readOnly»
+ return false;
+ «ELSE»
+ return getParser() != null;
+ «ENDIF»
+ }
+'''
+
+def getManager(GenCommonBase it,GenDiagram diagram) '''
+ «generatedMemberComment»
+ protected org.eclipse.gef.tools.DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this,
+ org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+'''
+
+
+
+def performDirectEditAtPoint (GenCommonBase it)'''
+ «generatedMemberComment»
+ protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) {
+ if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
+ ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+'''
+
+
+def performDirectEditRequest(GenCommonBase it, GenDiagram diagram ) '''
+ «generatedMemberComment»
+ protected void performDirectEditRequest(org.eclipse.gef.Request request) {
+
+ final org.eclipse.gef.Request theRequest = request;
+
+ if (org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+ directEditionMode = getDirectEditionType();
+ }
+ switch (directEditionMode) {
+ case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if (configuration == null || configuration.getLanguage() == null) {
+ // Create default edit manager
+ setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this,
+ org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ org.eclipse.jface.dialogs.Dialog dialog = null;
+ if (configuration instanceof org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) {
+ setManager(((org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if (configuration instanceof org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration) {
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper helper = ((org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration)configuration).createPopupEditorHelper(this) ;
+ helper.showEditor() ;
+ return ;
+ }
+ else if(configuration instanceof org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration) {
+ dialog = ((org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration)configuration).createDialog(org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
+ } else if(configuration instanceof org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration) {
+ dialog = new org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog(org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
+ } else {
+ return;
+ }
+ final org.eclipse.jface.dialogs.Dialog finalDialog = dialog;
+
+ if (org.eclipse.jface.window.Window.OK == dialog.open()) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain domain = getEditingDomain();
+ org.eclipse.emf.transaction.RecordingCommand command = new org.eclipse.emf.transaction.RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(resolveSemanticElement(), ((org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog)finalDialog).getValue());
+
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.DEFAULT_DIRECT_EDITOR:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+'''
+
+def initializeDirectEditManager (GenCommonBase it)'''
+ «generatedMemberComment»
+ protected void initializeDirectEditManager(final org.eclipse.gef.Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ «overrideI»
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ }
+ else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+'''
+
+def refreshVisuals(GenCommonBase it, boolean needsRefreshBounds ) '''
+ «generatedMemberComment»
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ «IF needsRefreshBounds»
+ refreshBounds();
+ «ENDIF»
+ }
+'''
+
+
+//BEGIN: PapyrusGenCode
+//Methods for advanced direct edition
+
+def getDirectEditionType(GenCommonBase it, Boolean readOnly) '''
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ «IF readOnly»
+ // The label is read-only (defined in GMFGen model)
+ return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION;
+ «ELSE»
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION;
+ «ENDIF»
+ }
+'''
+
+def checkExtendedEditor (GenCommonBase it)'''
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(),this);
+ }
+ return false;
+ }
+'''
+
+def checkDefaultEdition (GenCommonBase it)'''
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+'''
+
+def initExtendedEditorConfiguration (GenCommonBase it)'''
+ /**
+ * Initializes the extended editor configuration
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (configuration == null) {
+ final String languagePreferred = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator.getDefault().getPreferenceStore().getString(org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("")) {
+ configuration = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else {
+ configuration = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+'''
+
+def updateExtendedEditorConfiguration (GenCommonBase it)'''
+ /**
+ * Updates the preference configuration
+ * @generated
+ */
+ protected void updateExtendedEditorConfiguration() {
+ String languagePreferred = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator.getDefault().getPreferenceStore().getString(
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
+ configuration = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(),this);
+ } else if (org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+'''
+
+def performDefaultDirectEditorEdit (GenCommonBase it)'''
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ * @param theRequest the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final org.eclipse.gef.Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ «overrideI»
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(
+ org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+'''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/update/CanonicalUpdate.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/update/CanonicalUpdate.xtend
index cb91da6790e..63105b7b2a8 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/update/CanonicalUpdate.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/diagram/update/CanonicalUpdate.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov - refactoring of containerBaseCanonicalMethods.xpt; extraction of API/non-API of CEP templates
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Artem Tikhomirov - refactoring of containerBaseCanonicalMethods.xpt; extraction of API/non-API of CEP templates
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.diagram.update
@@ -92,44 +92,44 @@ def refreshOnActivateMethod(GenContainerBase it) '''
'''
def getFeaturesToSynchronizeMethod(GenContainerBase it) '''
-«IF getSemanticChildrenChildFeatures(it).size == 1»
-
- «generatedMemberComment»
- protected org.eclipse.emf.ecore.EStructuralFeature getFeatureToSynchronize() {
- return «xptMetaModel.MetaFeature(getSemanticChildrenContainmentFeatures(it).head)»;
- }
-«ELSEIF getSemanticChildrenChildFeatures(it).size > 1»
-
- «generatedMemberComment»
- protected java.util.Set getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new java.util.HashSet<org.eclipse.emf.ecore.EStructuralFeature>();
- «FOR f : getSemanticChildrenContainmentFeatures(it)»
- «addContainmentFeature(f)»
- «ENDFOR»
- }
- return myFeaturesToSynchronize;
- }
-«ENDIF»
-'''
+ «IF getSemanticChildrenChildFeatures(it).size == 1»
+
+ «generatedMemberComment»
+ protected org.eclipse.emf.ecore.EStructuralFeature getFeatureToSynchronize() {
+ return «xptMetaModel.MetaFeature(getSemanticChildrenContainmentFeatures(it).head)»;
+ }
+ «ELSEIF getSemanticChildrenChildFeatures(it).size > 1»
+
+ «generatedMemberComment»
+ protected java.util.Set<org.eclipse.emf.ecore.EStructuralFeature> getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new java.util.HashSet<org.eclipse.emf.ecore.EStructuralFeature>();
+ «FOR f : getSemanticChildrenContainmentFeatures(it)»
+ «addContainmentFeature(f)»
+ «ENDFOR»
+ }
+ return myFeaturesToSynchronize;
+ }
+ «ENDIF»
+ '''
def getSemanticChildrenListMethod(GenContainerBase it) '''
-«generatedMemberComment»
-@SuppressWarnings("rawtypes")
-protected java.util.List getSemanticChildrenList() {
- «IF hasSemanticChildren(it) /*REVISIT: is there real need for this check - Generator seems to consult needsCanonicalEP, which in turns ensures there are semantic children?*/»
- org.eclipse.gmf.runtime.notation.View viewObject = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- java.util.LinkedList<org.eclipse.emf.ecore.EObject> result = new java.util.LinkedList<org.eclipse.emf.ecore.EObject>();
- java.util.List<«nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)»> childDescriptors = «xptDiagramUpdater.getSemanticChildrenMethodCall(it)»(viewObject);
- for («nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)» d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- «ELSE»
- return java.util.Collections.EMPTY_LIST;
- «ENDIF»
-}
-'''
+ «generatedMemberComment»
+ protected java.util.List<org.eclipse.emf.ecore.EObject> getSemanticChildrenList() {
+ «IF hasSemanticChildren(it)/*REVISIT: is there real need for this check - Generator seems to consult needsCanonicalEP, which in turns ensures there are semantic children?*/»
+ org.eclipse.gmf.runtime.notation.View viewObject = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
+ java.util.LinkedList<org.eclipse.emf.ecore.EObject> result = new java.util.LinkedList<org.eclipse.emf.ecore.EObject>();
+ java.util.List<«nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)»> childDescriptors = «xptDiagramUpdater.
+ getSemanticChildrenMethodCall(it)»(viewObject);
+ for («nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)» d : childDescriptors) {
+ result.add(d.getModelElement());
+ }
+ return result;
+ «ELSE»
+ return java.util.Collections.EMPTY_LIST;
+ «ENDIF»
+ }
+ '''
def boolean isDiagramThatContainsShortcurs(GenContainerBase it) {
return it.oclIsKindOf(typeof(GenDiagram)) && (it as GenDiagram).containsShortcutsTo.notEmpty;
@@ -327,33 +327,41 @@ def executeLayoutCommand(GenContainerBase it, String createdViewsVar) '''
'''
def refreshConnectionsBody(GenDiagram it) '''
- «Domain2Notation(it)» domain2NotationMap = new «Domain2Notation(it)»();
- java.util.Collection<«linkDescriptor.qualifiedClassName(editorGen.diagramUpdater)»> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
- java.util.Collection existingLinks = new java.util.LinkedList(getDiagram().getEdges());
- for (java.util.Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextDiagramLink = (org.eclipse.gmf.runtime.notation.Edge) linksIterator.next();
- int diagramLinkVisualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(nextDiagramLink);
- if (diagramLinkVisualID == -1«FOR link : links.filter[gl | gl.modelFacet == null]»«compareLinkVisualID(link)»«ENDFOR») {
- if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
- linksIterator.remove();
+ «Domain2Notation(it)» domain2NotationMap = new «Domain2Notation(it)»();
+ java.util.Collection<«linkDescriptor.qualifiedClassName(editorGen.diagramUpdater)»> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
+ java.util.List<org.eclipse.gmf.runtime.notation.View> edges = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>();
+ for (Object edge : getDiagram().getEdges())
+ {
+ if (edge instanceof org.eclipse.gmf.runtime.notation.View)
+ {
+ edges.add((org.eclipse.gmf.runtime.notation.View) edge);
}
- continue;
}
- org.eclipse.emf.ecore.EObject diagramLinkObject = nextDiagramLink.getElement();
- org.eclipse.emf.ecore.EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
- org.eclipse.emf.ecore.EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
- for (java.util.Iterator<«it.editorGen.diagramUpdater.linkDescriptorQualifiedClassName»> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
- «linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)» nextLinkDescriptor = linkDescriptorsIterator.next();
- if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
- linksIterator.remove();
- linkDescriptorsIterator.remove();
- break;
+ java.util.Collection<org.eclipse.gmf.runtime.notation.View> existingLinks = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>(edges);
+ for (java.util.Iterator<org.eclipse.gmf.runtime.notation.View> linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Edge nextDiagramLink = (org.eclipse.gmf.runtime.notation.Edge) linksIterator.next();
+ int diagramLinkVisualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(nextDiagramLink);
+ if (diagramLinkVisualID == -1«FOR link : links.filter[gl|gl.modelFacet == null]»«compareLinkVisualID(link)»«ENDFOR») {
+ if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
+ linksIterator.remove();
+ }
+ continue;
+ }
+ org.eclipse.emf.ecore.EObject diagramLinkObject = nextDiagramLink.getElement();
+ org.eclipse.emf.ecore.EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
+ org.eclipse.emf.ecore.EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
+ for (java.util.Iterator<«it.editorGen.diagramUpdater.linkDescriptorQualifiedClassName»> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
+ «linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)» nextLinkDescriptor = linkDescriptorsIterator.next();
+ if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
+ linksIterator.remove();
+ linkDescriptorsIterator.remove();
+ break;
+ }
}
}
- }
- deleteViews(existingLinks.iterator());
- return createConnections(linkDescriptors, domain2NotationMap);
-'''
+ deleteViews(existingLinks.iterator());
+ return createConnections(linkDescriptors, domain2NotationMap);
+ '''
def refreshConnectionsAuxMethods(GenDiagram it) '''
«collectAllLinksMethod(it)»
@@ -366,26 +374,31 @@ def refreshConnectionsAuxMethods(GenDiagram it) '''
'''
def collectAllLinksMethod(GenDiagram it) '''
-«generatedMemberComment»
-private java.util.Collection<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> collectAllLinks(org.eclipse.gmf.runtime.notation.View view, «Domain2Notation(it)» domain2NotationMap) {
- if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view))) {
- return java.util.Collections.emptyList();
- }
- java.util.LinkedList<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> result = new java.util.LinkedList<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»>();
- switch («xptVisualIDRegistry.getVisualIDMethodCall(it)»(view)) {
- «FOR se : it.allSemanticElements»
- «caseSemanticElement(se)»
- «ENDFOR»
- }
- for (java.util.Iterator children = view.getChildren().iterator(); children.hasNext();) {
- result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) children.next(), domain2NotationMap));
- }
- for (java.util.Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
- result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) edges.next(), domain2NotationMap));
- }
- return result;
-}
-'''
+ «generatedMemberComment»
+ private java.util.Collection<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> collectAllLinks(org.eclipse.gmf.runtime.notation.View view, «Domain2Notation(
+ it)» domain2NotationMap) {
+ if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view))) {
+ return java.util.Collections.emptyList();
+ }
+ java.util.LinkedList<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> result = new java.util.LinkedList<«linkDescriptor.
+ qualifiedClassName(it.editorGen.diagramUpdater)»>();
+ String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(view);
+ if (vid != null) {
+ switch (vid) {
+ «FOR se : it.allSemanticElements»
+ «caseSemanticElement(se)»
+ «ENDFOR»
+ }
+ }
+ for (java.util.Iterator<?> children = view.getChildren().iterator(); children.hasNext();) {
+ result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) children.next(), domain2NotationMap));
+ }
+ for (java.util.Iterator<?> edges = view.getSourceEdges().iterator(); edges.hasNext();) {
+ result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) edges.next(), domain2NotationMap));
+ }
+ return result;
+ }
+ '''
def createConnectionsMethod(GenDiagram it) '''
«generatedMemberComment»
@@ -419,26 +432,26 @@ private java.util.Collection<org.eclipse.core.runtime.IAdaptable> createConnecti
'''
def getEditPartMethod(GenDiagram it) '''
-«generatedMemberComment»
-private org.eclipse.gef.EditPart getEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) domain2NotationMap.get(domainModelElement);
- if (view != null) {
- return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
-}
-'''
+ «generatedMemberComment»
+ private org.eclipse.gef.EditPart getEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap) {
+ org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.get(domainModelElement);
+ if (view != null) {
+ return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
+ }
+ return null;
+ }
+ '''
def getHintedEditPartMethod(GenDiagram it) '''
- «generatedMemberComment»
-protected final org.eclipse.gef.EditPart getHintedEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap, int hintVisualId) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) domain2NotationMap.getHinted(domainModelElement, «xptVisualIDRegistry.typeMethodCall(it, 'hintVisualId')»);
- if (view != null) {
- return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
-}
-'''
+ «generatedMemberComment»
+ protected final org.eclipse.gef.EditPart getHintedEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap, int hintVisualId) {
+ org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.getHinted(domainModelElement, «xptVisualIDRegistry.typeMethodCall(it, 'hintVisualId')»);
+ if (view != null) {
+ return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
+ }
+ return null;
+ }
+ '''
def getSourceEditPartMethod(GenDiagram it) '''
«generatedMemberComment»
@@ -492,5 +505,4 @@ case «VisualIDRegistry::visualID(it)»: {
break;
}
'''
-
-} \ No newline at end of file
+}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/AbstractParser.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/AbstractParser.xtend
deleted file mode 100644
index 0cf47ea06eb..00000000000
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/AbstractParser.xtend
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2020 Montages AG, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Michael Golubev (Montages) - [368169] extract not-generated shared code to GMF-T runtime
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
- *****************************************************************************/
-package impl.parsers
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenParsers
-
-/**
- * Since GMFT 3.1 we don't generate class AbstractParser into every diagram, by extending the
- * org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser.
- * If you want to extend other custom implementation you may change the className and quialifiedClassName DEFINE's
- * which are still used in the extend's clauses for generated PredefinedParser's
- * <p>
- * However, for 3.1 release we still will generate empty file (without any java content),
- * to ensure that the old code, including calls to non existing i18n fields in Messages is cleaned up.
- */
-@com.google.inject.Singleton class AbstractParser {
-
- def className(GenParsers it) '''AbstractAttributeParser'''
-
- def packageName(GenParsers it) '''org.eclipse.gmf.tooling.runtime.parsers'''
-
- def String qualifiedClassName(GenParsers it) '''«packageName(it)».«className(it)»'''
-
- def fullPath(GenParsers it) '''«qualifiedClassName(it)»'''
-
- def deprecatedQualifiedClassName(GenParsers it) '''«implPackageName».AbstractParser'''
-
- def Main(GenParsers it) '''
- //Since GMFT 3.1 we don't generate class AbstractParser into every diagram, instead extend org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser.
- '''
-}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/ParserProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/ParserProvider.xtend
index 40554ed5e12..6ba9b155fde 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/ParserProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/parsers/ParserProvider.xtend
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2007-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [235113] alternative parser access
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - [235113] alternative parser access
* [244419] custom parsers
* [138179] expression-backed labels
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.parsers
@@ -157,43 +157,45 @@ import plugin.Activator
'''
def HintAdapterClass(GenParsers it) '''
- «generatedMemberComment()»
- private static class HintAdapter extends org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter {
-
- «generatedMemberComment()»
- private final org.eclipse.gmf.runtime.emf.type.core.IElementType elementType;
-
«generatedMemberComment()»
- public HintAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType type,
- org.eclipse.emf.ecore.EObject object, String parserHint) {
+ private static class HintAdapter extends org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter {
+
+ «generatedMemberComment()»
+ private final org.eclipse.gmf.runtime.emf.type.core.IElementType elementType;
+
+ «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;
- }
-
- «generatedMemberComment()»
- public Object getAdapter(Class adapter) {
- if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) {
- return elementType;
}
- return super.getAdapter(adapter);
+
+ «generatedMemberComment()»
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) {
+ return elementType;
+ }
+ return super.getAdapter(adapter);
+ }
}
- }
'''
- def getParserByVisualIdMethod(GenParsers it) '''
+ def getParserByVisualIdMethod(GenParsers it) '''
«generatedMemberComment()»
- protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(int visualID) {
- switch (visualID) {
- «FOR node : editorGen.diagram.topLevelNodes»
- «dispatch_getParsers(node)»
- «ENDFOR»
- «FOR node : editorGen.diagram.childNodes»
- «dispatch_getParsers(node)»
- «ENDFOR»
- «FOR link : editorGen.diagram.links»
- «dispatch_getParsers(link)»
- «ENDFOR»
+ protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(String visualID) {
+ if (visualID != null) {
+ switch (visualID) {
+ «FOR node : editorGen.diagram.topLevelNodes»
+ «dispatch_getParsers(node)»
+ «ENDFOR»
+ «FOR node : editorGen.diagram.childNodes»
+ «dispatch_getParsers(node)»
+ «ENDFOR»
+ «FOR link : editorGen.diagram.links»
+ «dispatch_getParsers(link)»
+ «ENDFOR»
+ }
}
return null;
}
@@ -202,21 +204,28 @@ import plugin.Activator
def dispatch dispatch_getParsers(GenNode it) //
'''
«FOR label : it.labels»
- «doGetParser(label.modelFacet.parser, label)»
+ «IF label.modelFacet != null»
+ «doGetParser(label.modelFacet.parser, label)»
+ «ENDIF»
«ENDFOR»
+
'''
- def dispatch dispatch_getParsers(GenLink it) //
+ def dispatch dispatch_getParsers(GenLink it) //
'''
«FOR label : it.labels»
- «doGetParser(label.modelFacet.parser, label)»
+ «IF label.modelFacet != null»
+ «doGetParser(label.modelFacet.parser, label)»
+ «ENDIF»
«ENDFOR»
+
'''
- def dispatch dispatch_getParsers(GenChildLabelNode it) '''
- «doGetParser(it.labelModelFacet.parser, it)»
+ def dispatch dispatch_getParsers(GenChildLabelNode it)'''
+ «IF it.modelFacet != null»
+ «doGetParser(it.labelModelFacet.parser, it)»
+ «ENDIF»
'''
-
def doGetParser(GenParserImplementation parser, GenCommonBase element) '''
«IF parser.oclIsKindOf(typeof(PredefinedEnumParser)) || parser.oclIsKindOf(typeof(OclChoiceParser))»
«extraLineBreak»
@@ -229,16 +238,19 @@ import plugin.Activator
def dispatch dispatch_parsers(GenNode it) '''
«FOR label : it.labels»
- «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)»
+ «IF label.modelFacet != null»
+ «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)»
+ «ENDIF»
«ENDFOR»
'''
def dispatch dispatch_parsers(GenLink it) '''
«FOR label : it.labels»
- «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)»
+ «IF label.modelFacet != null»
+ «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)»
+ «ENDIF»
«ENDFOR»
'''
-
def dispatch dispatch_parsers(GenChildLabelNode it) '''«dispatch_parser(it.labelModelFacet.parser, it.labelModelFacet, it)»'''
def dispatch dispatch_parser(GenParserImplementation it, LabelModelFacet modelFacet, GenCommonBase element) '''«ERROR("Abstract template for " + it + ", element: " + element)»'''
@@ -378,4 +390,4 @@ import plugin.Activator
«ENDIF»
'''
-} \ No newline at end of file
+}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/preferences/StandardPage.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/preferences/StandardPage.xtend
index b71b4bb204b..cfab27b4970 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/preferences/StandardPage.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/impl/preferences/StandardPage.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package impl.preferences
@@ -42,13 +42,16 @@ import xpt.Common
«generatedMemberComment»
public «className(it)»() {
setPreferenceStore(«getDiagram().editorGen.plugin.activatorQualifiedClassName».getInstance().getPreferenceStore());
+ «IF StandardPreferencePages.GENERAL_LITERAL == kind»
+ setPreferenceKey(«getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID);
+ «ENDIF»
}
}
'''
def extendsList(GenStandardPreferencePage it) '''
«IF kind == StandardPreferencePages::GENERAL_LITERAL»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage«»
+ extends org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage«»
«ELSEIF kind == StandardPreferencePages::APPEARANCE_LITERAL»
extends org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage«»
«ELSEIF kind == StandardPreferencePages::CONNECTIONS_LITERAL»
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/metamodel/MetaModel.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/metamodel/MetaModel.xtend
index a0be2736b5c..ca86467e437 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/metamodel/MetaModel.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/metamodel/MetaModel.xtend
@@ -1,17 +1,18 @@
-/******************************************************************************
- * Copyright (c) 2008, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2008, 2015, 2021 Anatoliy Tischenko, Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Anatoliy Tischenko - Initial API and implementation
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package metamodel
@@ -174,7 +175,7 @@ import xpt.GenModelUtils_qvto
* Same as DeclareAndAssign, with extra operation applied to source object
*/
def DeclareAndAssign2(GenClass it, String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) //
- '''«getQualifiedInterfaceName(it)» «assignee» = «IF needCast»(«getQualifiedInterfaceName(it)») «ENDIF»«getFeatureValue(srcFeature, src, srcMetaClass)».«srcExt»;'''
+ '''«getQualifiedInterfaceName(it)» «assignee» = «getFeatureValue(srcFeature, src, srcMetaClass)».«srcExt»;'''
/**
* Cast value of type EObject to specific type. Would be no-op with dynamic model instances,
@@ -193,4 +194,4 @@ import xpt.GenModelUtils_qvto
def dispatch QualifiedClassName(GenClassifier xptSelf) '''«getQualifiedClassName(xptSelf)»'''
-}
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/parsers/PredefinedParser.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/parsers/PredefinedParser.xtend
index 883f8e59099..f41e5e58de2 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/parsers/PredefinedParser.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/parsers/PredefinedParser.xtend
@@ -1,20 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal
- *
+/*****************************************************************************
+ * Copyright (c) 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial implementation
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial implementation
* Artem Tikhomirov (Borland) - [235113] alternative parser access
* [244419] custom parsers
* initial API
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 464625
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package parsers
@@ -41,8 +45,8 @@ import plugin.Activator
def fullPath(org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser it) '''«qualifiedClassName(it)»'''
def extendsList(org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser it) //
- '''extends org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser'''
-
+ '''extends org.eclipse.papyrus.infra.gmfdiag.common.parsers.AbstractElementTypeBasedAttributeParser'''
+
def Main(org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser it) '''
«copyright(it.holder.editorGen)»
package «packageName(it)»;
@@ -64,7 +68,48 @@ import plugin.Activator
}
'''
- def additions(org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser it) ''''''
+ def additions(org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser it) //
+ '''
+ /**
+ * @generated
+ * {@inheritDoc}
+ * @see org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object)
+ */
+ @Override
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getModificationCommand(final org.eclipse.emf.ecore.EObject element, final org.eclipse.emf.ecore.EStructuralFeature feature, final Object value) {
+ org.eclipse.gmf.runtime.common.core.command.ICommand result = null;
+
+ // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name
+ if (feature.equals(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNamedElement_Name())) {
+ if (org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement) element)) {
+ final org.eclipse.papyrus.infra.core.resource.ModelSet modelSet = (org.eclipse.papyrus.infra.core.resource.ModelSet) element.eResource().getResourceSet();
+ if (null != modelSet) {
+ result = new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (org.eclipse.uml2.uml.NamedElement) element, (String) value, null));
+ }
+ }
+ }
+
+ return null != result ? result : super.getModificationCommand(element, feature, value);
+ }
+
+ /**
+ * @generated
+ * {@inheritDoc}
+ * @see org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature)
+ */
+ @Override
+ protected Object getValue(final org.eclipse.emf.ecore.EObject element, final org.eclipse.emf.ecore.EStructuralFeature feature) {
+ Object result = null;
+
+ if(element instanceof org.eclipse.uml2.uml.NamedElement && feature.equals(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNamedElement_Name())){
+ if (org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement)element)) {
+ result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement)element);
+ }
+ }
+
+ return null != result ? result : super.getValue(element, feature);
+ }
+ '''
def fields(org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser it) '''
«IF viewMethod == LabelTextAccessMethod::MESSAGE_FORMAT || viewMethod == LabelTextAccessMethod::PRINTF»
@@ -355,4 +400,5 @@ import plugin.Activator
@Localization protected def String i18nKeyForMessageFormatParserInvalidInputError() {
return 'MessageFormatParser.InvalidInputError'
}
+
}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/EditHelperUtils_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/EditHelperUtils_qvto.xtend
index 50ac850ae6a..75999e6ca6c 100644
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/EditHelperUtils_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/EditHelperUtils_qvto.xtend
@@ -10,8 +10,7 @@
*
* Contributors:
* Florian Noyrit - Initial API and implementation
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package utils
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/EditPartsUtils_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/EditPartsUtils_qvto.xtend
index 8d336094c80..0da798c77dd 100644
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/EditPartsUtils_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/EditPartsUtils_qvto.xtend
@@ -10,8 +10,7 @@
*
* Contributors:
* Yann Tanguy (CEA LIST) - initial API and implementation
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package utils
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/PrefsConstant_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/PrefsConstant_qvto.xtend
index e760a91b7f3..6c37bc51e1c 100644
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/PrefsConstant_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/PrefsConstant_qvto.xtend
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 Atos Origin
+ * Copyright (c) 2008, 2021 Atos Origin, CEA LIST, Artal and others
*
*
* All rights reserved. This program and the accompanying materials
@@ -12,7 +12,7 @@
* Contributors:
* Thibault Landre (Atos Origin) - initial API and implementation
* Patrick Tessier(CEA LIST)
- *
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package utils
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/UtilsItemSemanticEditPolicy.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/UtilsItemSemanticEditPolicy.xtend
index 1365918dfb0..e1fc337442f 100644
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/utils/UtilsItemSemanticEditPolicy.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/utils/UtilsItemSemanticEditPolicy.xtend
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2021 CEA LIST, Artal and others
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,7 +11,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package utils
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/CodeStyle.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/CodeStyle.xtend
index f80a3b123f5..2586c16bda9 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/CodeStyle.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/CodeStyle.xtend
@@ -1,24 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2013-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2015, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Michael Golubev (Montages) - initial API and implementation
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Michael Golubev (Montages) - initial API and implementation
+ * Anatoliy Tischenko - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
-@com.google.inject.Singleton class CodeStyle {
+@Singleton class CodeStyle {
@Inject extension GenEditorGenerator_qvto
@Inject extension Common;
/**
@@ -30,12 +32,8 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
«ENDIF»
'''
- def overrideI(GenCommonBase xptSelf) '''
- «IF xptSelf.jdkComplianceLevel() > 5»
- @Override
- «ELSE»
- «extraLineBreak»
- «ENDIF»
+ def overrideI(GenCommonBase xptSelf)'''
+ @Override
'''
/**
@@ -51,4 +49,4 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
@SuppressWarnings(«warnToken»)
«ENDIF»
'''
-}
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/Common.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/Common.xtend
index 8dd6a3fb936..16632b88779 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/Common.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/Common.xtend
@@ -1,37 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2006-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
-
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
+import com.google.inject.Singleton
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
-import xpt.editor.VisualIDRegistry
import org.eclipse.papyrus.gmf.internal.common.codegen.Conversions
+import xpt.editor.VisualIDRegistry
/**
* XXX: [MG] I don't like dependency from Common -> VisualIdRegistry
*/
-@com.google.inject.Singleton class Common {
+@Singleton class Common {
def copyright(GenEditorGenerator it)
'''
- «IF copyrightText != null»
- /*
+ «IF copyrightText !== null»
+ /**
* «copyrightText.replaceAll('\n', '\n * ')»
*/
«ENDIF»
@@ -132,5 +130,19 @@ import org.eclipse.papyrus.gmf.internal.common.codegen.Conversions
}
return b.toString;
}
+
+ def String stringVisualID(GenCommonBase it) {
+ if (visualIDOverride !== null)
+ visualIDOverride
+ else
+ visualID.toString
+ }
+
+ def String stringUniqueIdentifier(GenCommonBase it) {
+ if (visualIDOverride !== null)
+ visualIDOverride
+ else
+ it.uniqueIdentifier
+ }
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenEditorGenerator_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenEditorGenerator_qvto.xtend
index 6cd75b3a15f..78277901623 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenEditorGenerator_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenEditorGenerator_qvto.xtend
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+ * Copyright (c) 2007, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -7,34 +7,42 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt
-import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
-@com.google.inject.Singleton class GenEditorGenerator_qvto {
- @Inject extension GenModelUtils_qvto;
+@Singleton class GenEditorGenerator_qvto {
/**
* FIXME remove java-only GenEditorGenerator#hasAudits or declare it in metamodel
*/
def boolean hasAudits(GenEditorGenerator editorGen) {
- return editorGen.audits != null && !editorGen.audits.rules.empty
+ return editorGen.audits !== null && !editorGen.audits.rules.empty
}
/**
- * @see GenModelUtils#jdkComplianceLevel
+ * Returns java version number.
+ *
+ * @returns 4 for Java1.4, 5 for JDK 5.0, 6 for JDK6.0 and 7 for JDK7.0, etc.
*/
def int jdkComplianceLevel(GenEditorGenerator xptSelf) {
- //TODO honest field in the GenEditorGenerator instead of hardcoded value
- return xptSelf.diagram.domainDiagramElement.jdkComplianceLevel();
+ var GenJDKLevel l = if (xptSelf === null || xptSelf.jdkComplianceLevel === null)
+ GenJDKLevel::JDK110_LITERAL
+ else
+ xptSelf.jdkComplianceLevel;
+ switch (l) {
+ case GenJDKLevel::JDK14_LITERAL: 4
+ default: Double.valueOf(l.literal).intValue
+ }
}
def int jdkComplianceLevel(GenCommonBase xptSelf) {
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenModelUtils_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenModelUtils_qvto.xtend
index f52b8ee5200..a8b8c3cec12 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenModelUtils_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/GenModelUtils_qvto.xtend
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006-2020 Borland Software Corporation, CEA LIST, Artal and others
+ * Copyright (c) 2006-2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -9,9 +9,9 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt
@@ -19,12 +19,11 @@ import java.util.Set
import org.eclipse.emf.codegen.ecore.genmodel.GenClass
import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier
import org.eclipse.emf.codegen.ecore.genmodel.GenFeature
-import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel
import org.eclipse.emf.codegen.ecore.genmodel.impl.GenFeatureImpl
import org.eclipse.emf.ecore.EDataType
@com.google.inject.Singleton class GenModelUtils_qvto {
- private static final Set<String> PRIMITIVES = newHashSet('boolean', 'byte', 'char', 'double', 'float', 'int', 'long',
+ static final Set<String> PRIMITIVES = newHashSet('boolean', 'byte', 'char', 'double', 'float', 'int', 'long',
'short');
/**
@@ -90,19 +89,4 @@ import org.eclipse.emf.ecore.EDataType
}
return xptSelf.ecoreClass.isSuperTypeOf(subclassCandidate.ecoreClass)
}
-
- /**
- * @returns 4 for Java1.4, 5 for JDK 5.0, 6 for JDK6.0 and 7 for JDK7.0
- */
- def int jdkComplianceLevel(GenClass xptSelf) {
- var GenJDKLevel l = if (xptSelf == null) GenJDKLevel::JDK60_LITERAL else xptSelf.genPackage.genModel.complianceLevel;
- switch (l) {
- case GenJDKLevel::JDK14_LITERAL: 4
- case GenJDKLevel::JDK50_LITERAL: 5
- case GenJDKLevel::JDK60_LITERAL: 6
- case GenJDKLevel::JDK70_LITERAL: 7
- default: 6
- }
- }
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/QualifiedClassNameProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/QualifiedClassNameProvider.xtend
index 643aa8e535b..271e561326e 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/QualifiedClassNameProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/QualifiedClassNameProvider.xtend
@@ -1,16 +1,17 @@
-/******************************************************************************
- * Copyright (c) 2014, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2015, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Svyatoslav Kovalsky (Montages) - initial API and implementation
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Florian Noyrit - Initial API and implementation
+ * Svyatoslav Kovalsky (Montages) - initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt
@@ -38,10 +39,10 @@ import xpt.diagram.commands.CreateLinkCommand
@Inject CreateNodeCommand nodeCommand
def dispatch getItemSemanticEditPolicyQualifiedClassName(GenCommonBase it) ''''''
- def dispatch getItemSemanticEditPolicyQualifiedClassName(GenDiagram it) '''«diagramItemSemantic.qualifiedClassName(it)»'''
- def dispatch getItemSemanticEditPolicyQualifiedClassName(GenCompartment it) '''«compItemSemantic.qualifiedClassName(it)»'''
- def dispatch getItemSemanticEditPolicyQualifiedClassName(GenLink it) '''«linkItemSemantic.qualifiedClassName(it)»'''
- def dispatch getItemSemanticEditPolicyQualifiedClassName(GenNode it) '''«nodeItemSemantic.qualifiedClassName(it)»'''
+ def dispatch getItemSemanticEditPolicyQualifiedClassName(GenDiagram it)'''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy'''
+ def dispatch getItemSemanticEditPolicyQualifiedClassName(GenCompartment it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy'''
+ def dispatch getItemSemanticEditPolicyQualifiedClassName(GenLink it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy'''
+ def dispatch getItemSemanticEditPolicyQualifiedClassName(GenNode it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy'''
def dispatch getItemSemanticEditPolicyClassName(GenCommonBase it) ''''''
def dispatch getItemSemanticEditPolicyClassName(GenDiagram it) '''«diagramItemSemantic.className(it)»'''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateLinkUtils.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateLinkUtils.xtend
index ecdfd5bc0e6..d5e784009dc 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateLinkUtils.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateLinkUtils.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2007-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007-2012, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.commands
@@ -77,23 +77,23 @@ import xpt.diagram.editpolicies.BaseItemSemanticEditPolicy
def dispatch fields(LinkModelFacet it) '''
«extraLineBreak»
«generatedMemberComment()»
- private final org.eclipse.emf.ecore.EObject source;
+ protected final org.eclipse.emf.ecore.EObject source;
«generatedMemberComment()»
- private final org.eclipse.emf.ecore.EObject target;
+ protected final org.eclipse.emf.ecore.EObject target;
'''
def dispatch fields(TypeLinkModelFacet it) '''
«extraLineBreak»
«generatedMemberComment()»
- private final org.eclipse.emf.ecore.EObject source;
+ protected final org.eclipse.emf.ecore.EObject source;
«generatedMemberComment()»
- private final org.eclipse.emf.ecore.EObject target;
+ protected final org.eclipse.emf.ecore.EObject target;
«IF hasContainerOtherThanSource(it)»
«generatedMemberComment()»
- private final «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container;
+ protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container;
«ENDIF»
'''
@@ -117,30 +117,29 @@ import xpt.diagram.editpolicies.BaseItemSemanticEditPolicy
def dispatch containerAccessor(TypeLinkModelFacet it) '''
«IF hasContainerOtherThanSource(it)»
-
- «generatedMemberComment()»
- public «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» getContainer() {
- return container;
- }
-
- «generatedMemberComment(
- 'Default approach is to traverse ancestors of the source to find instance of container.\n' +
- 'Modify with appropriate logic.'
- )»
- private static «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» deduceContainer(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) {
- // Find container element for the new link.
- // Climb up by containment hierarchy starting from the source
- // and return the first element that is instance of the container class.
- for (org.eclipse.emf.ecore.EObject element = source; element != null; element = element.eContainer()) {
- if («xptMetaModel.IsInstance(containmentMetaFeature.genClass, 'element')») {
- return «xptMetaModel.CastEObject(it.containmentMetaFeature.genClass, 'element')»;
+
+ «generatedMemberComment()»
+ public «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» getContainer() {
+ return container;
+ }
+
+ «generatedMemberComment(
+ 'Default approach is to traverse ancestors of the source to find instance of container.\n' + 'Modify with appropriate logic.'
+ )»
+ protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» deduceContainer(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (org.eclipse.emf.ecore.EObject element = source; element != null; element = element.eContainer()) {
+ if («xptMetaModel.IsInstance(containmentMetaFeature.genClass, 'element')») {
+ return «xptMetaModel.CastEObject(it.containmentMetaFeature.genClass, 'element')»;
+ }
}
+ return null;
}
- return null;
- }
«ENDIF»
-
-'''
+
+ '''
/**
* Part of the constructor that performs initialization.
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateNodeCommand.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateNodeCommand.xtend
index dfa58a7e825..c322ff92dd8 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateNodeCommand.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/CreateNodeCommand.xtend
@@ -1,31 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.commands
import com.google.inject.Inject
+import com.google.inject.Singleton
import metamodel.MetaModel
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeModelFacet
import xpt.Common
+import xpt.OclMigrationProblems_qvto
import xpt.diagram.Utils_qvto
import xpt.providers.ElementInitializers
-import xpt.OclMigrationProblems_qvto
-@com.google.inject.Singleton class CreateNodeCommand {
+@Singleton class CreateNodeCommand {
@Inject extension Common;
+ @Inject extension MetaModel
@Inject extension Utils_qvto;
@Inject extension OclMigrationProblems_qvto;
@@ -44,8 +46,15 @@ import xpt.OclMigrationProblems_qvto
«copyright(it.diagram.editorGen)»
package «packageName(it)»;
+
+
«generatedClassComment()»
public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
+
+ «IF ! it.modelFacet.isPhantomElement()»
+ «generatedMemberComment()»
+ private org.eclipse.gmf.runtime.notation.Diagram diagram = null;
+ «ENDIF»
«_constructor(it)»
@@ -61,10 +70,13 @@ import xpt.OclMigrationProblems_qvto
}
'''
- def _constructor(GenNode it) '''
+ def _constructor(GenNode it) '''
«generatedMemberComment()»
- public «className(it)»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
+ public «className(it)»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.gmf.runtime.notation.Diagram diagram) {
super(req.getLabel(), null, req);
+ «IF ! it.modelFacet.isPhantomElement()»
+ this.diagram = diagram;
+ «ENDIF»
}
'''
@@ -85,22 +97,32 @@ import xpt.OclMigrationProblems_qvto
def doExecuteWithResultMethod(GenNode it) '''
«generatedMemberComment()»
protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- «IF it.modelFacet.isPhantomElement()»
- «phantomElementCreation(it.modelFacet, it, 'newElement')»
- «ELSE»
- «normalElementCreation(it.modelFacet, it, 'newElement')»
- «ENDIF»
- «extraLineBreak»
- «initialize(it.modelFacet, it, 'newElement')»
- «IF true/*FIXME boolean needsExternalConfiguration*/»
- «extraLineBreak»
- doConfigure(newElement, monitor, info);
+ ««« [AbstractElement] START
+
+ «IF it.modelFacet.metaClass.ecoreClass.abstract != true»
+ ««« [AbstractElement] END
+ «IF it.modelFacet.isPhantomElement()»
+ «phantomElementCreation(it.modelFacet, it, 'newElement')»
+ «ELSE»
+ «normalElementCreation(it.modelFacet, it, 'newElement')»
+ «ENDIF»
«extraLineBreak»
+ «initialize(it.modelFacet, it, 'newElement')»
+ «IF true/*FIXME boolean needsExternalConfiguration*/»
+ «extraLineBreak»
+ doConfigure(newElement, monitor, info);
+ «extraLineBreak»
+ «ENDIF»
+ ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«xptMetaModel.
+ DowncastToEObject(it.modelFacet.metaClass, 'newElement')»);
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(newElement);
+ }
+ ««« [AbstractElement] START
+ «ELSE»
+ throw new UnsupportedOperationException("Unimplemented operation (abstract domain element).");
+ }
«ENDIF»
- ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«xptMetaModel.
- DowncastToEObject(it.modelFacet.metaClass, 'newElement')»);
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(newElement);
- }
+ ««« [AbstractElement] END
'''
/**
@@ -136,32 +158,37 @@ import xpt.OclMigrationProblems_qvto
'''
def canExecute_Normal(TypeModelFacet it) '''
-«IF !isUnbounded(it.containmentMetaFeature.ecoreFeature) ||
- (childMetaFeature != containmentMetaFeature && !isUnbounded(it.childMetaFeature.ecoreFeature))»
- «xptMetaModel.DeclareAndAssign(it.containmentMetaFeature.genClass, 'container', 'getElementToEdit()')»
- «IF !isUnbounded(it.containmentMetaFeature.ecoreFeature)»
- «IF isSingleValued(containmentMetaFeature.ecoreFeature)»
- if («xptMetaModel.getFeatureValue(containmentMetaFeature, 'container', containmentMetaFeature.genClass)» != null) {
- «ELSE»
- if («xptMetaModel.getFeatureValue(containmentMetaFeature, 'container', containmentMetaFeature.genClass)».size() >= «containmentMetaFeature.
- ecoreFeature.upperBound») {
+ «IF containmentMetaFeature != null»
+ «IF containmentMetaFeature.ecoreFeature != null»
+ «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || (childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature))»
+ «IF ! isUnbounded(containmentMetaFeature.ecoreFeature)»
+ «DeclareAndAssign(containmentMetaFeature.genClass,'container', 'getElementToEdit()') »
+ «IF isSingleValued(containmentMetaFeature.ecoreFeature)»
+ if («getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass) » != null) {
+ «ELSE»
+ if (« getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass)».size() >= «containmentMetaFeature.ecoreFeature.upperBound») {
+ «ENDIF»
+ return false;
+ }
+ «ENDIF»
+ «IF childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature)»
+ «IF isSingleValued(childMetaFeature.ecoreFeature)»
+ if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) » != null) {
+ «ELSE»
+ if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) ».size() >= «childMetaFeature.ecoreFeature.upperBound») {
+ «ENDIF»
+ return false;
+ }
+ «ENDIF»
+ «ENDIF»
«ENDIF»
- return false;
- }
- «ENDIF»
- «IF childMetaFeature != containmentMetaFeature && !isUnbounded(childMetaFeature.ecoreFeature)»
- «IF isSingleValued(childMetaFeature.ecoreFeature)»
- if («xptMetaModel.getFeatureValue(childMetaFeature, 'container', containmentMetaFeature.genClass)» != null) {
- «ELSE»
- if («xptMetaModel.getFeatureValue(childMetaFeature, 'container', containmentMetaFeature.genClass)».size() >= «childMetaFeature.
- ecoreFeature.upperBound») {
- «ENDIF»
- return false;
- }
«ENDIF»
-«ENDIF»
- return true;
-'''
+
+ org.eclipse.emf.ecore.EObject target = getElementToEdit();
+ org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), «MetaClass(metaClass)»);
+ return data.isPermitted();
+
+ '''
def phantomElementCreation(TypeModelFacet it, GenNode node, String varName) '''
// Uncomment to put "phantom" objects into the diagram file.
@@ -177,15 +204,30 @@ import xpt.OclMigrationProblems_qvto
def normalElementCreation(TypeModelFacet it, GenNode node, String varName) '''
«xptMetaModel.NewInstance(it.metaClass, varName)»
+
+ org.eclipse.emf.ecore.EObject target = getElementToEdit();
+ org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target, «varName»);
+ if (data.isPermitted()) {
+ if (data.isPathDefined()) {
+ if (!data.execute(target, «varName»)) {
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ }
+ } else {
«extraLineBreak»
«IF containmentMetaFeature != null»
- «xptMetaModel.DeclareAndAssign(it.containmentMetaFeature.genClass, 'owner', 'getElementToEdit()')»
- «xptMetaModel.modifyFeature(containmentMetaFeature, 'owner', containmentMetaFeature.genClass, varName)»
+ «xptMetaModel.DeclareAndAssign(it.containmentMetaFeature.genClass, 'qualifiedTarget', 'target')»
+ «xptMetaModel.modifyFeature(containmentMetaFeature, 'qualifiedTarget', containmentMetaFeature.genClass, varName)»
«ELSE»
//
// FIXME no containment feature found in the genmodel, toolsmith need to manually write code here to add «varName» to a parent
//
«ENDIF»
+
+ }
+ } else {
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
+
«IF hasExplicitChildFeature(it)»
«xptMetaModel.DeclareAndAssign(it.childMetaFeature.genClass, 'childHolder', 'getElementToEdit()')»
«xptMetaModel.modifyFeature(it.childMetaFeature, 'childHolder', childMetaFeature.genClass, varName)»
@@ -196,5 +238,4 @@ import xpt.OclMigrationProblems_qvto
'''«xptElementInitializers.initMethodCall(node, it, newElementVar)»'''
def additions(GenNode it) ''''''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/ReorientLinkUtils.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/ReorientLinkUtils.xtend
index 513ea835dd6..5e4d60c6065 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/ReorientLinkUtils.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/commands/ReorientLinkUtils.xtend
@@ -1,17 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007-2015, 2021 Borland Software Corporation, Montages, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+* Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Anatolyi Tischenko - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.commands
@@ -102,10 +103,10 @@ import xpt.diagram.editpolicies.BaseItemSemanticEditPolicy
«generatedMemberComment()»
public boolean canExecute() {
«checkLinkValidity(it)»
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_SOURCE) {
+ if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_SOURCE) {
return canReorientSource();
}
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_TARGET) {
+ if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_TARGET) {
return canReorientTarget();
}
return false;
@@ -215,10 +216,10 @@ import xpt.diagram.editpolicies.BaseItemSemanticEditPolicy
if (!canExecute()) {
throw new org.eclipse.core.commands.ExecutionException("Invalid arguments in reorient link command"); «nonNLS()»
}
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_SOURCE) {
+ if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_TARGET) {
+ if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -307,4 +308,4 @@ import xpt.diagram.editpolicies.BaseItemSemanticEditPolicy
«xptMetaModel.moveFeatureValue(it, oldSourceVar, newSourceVar, sourceVarGenClass, targetVar)»
'''
-}
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/BaseEditHelper.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/BaseEditHelper.xtend
index da08d84f74f..0e18f309471 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/BaseEditHelper.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/BaseEditHelper.xtend
@@ -1,18 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
- *
+/*****************************************************************************
+ * Copyright (c) 2006, 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #368169 - extract common code to GMFT-specific runtime
- * - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #368169 - extract common code to GMFT-specific runtime
+ * - #386838 - migrate to Xtend2
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.edithelpers;
@@ -25,7 +26,7 @@ public class BaseEditHelper {
def extendsClause(GenDiagram it) '''extends «superClass(it)»'''
- def superClass(GenDiagram it) '''org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase'''
+ def superClass(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase'''
def className(GenDiagram it) '''«it.baseEditHelperClassName»'''
@@ -60,9 +61,9 @@ public class BaseEditHelper {
}
'''
- def editPolicyCommandConstant(GenDiagram it) '''org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase.EDIT_POLICY_COMMAND'''
+ def editPolicyCommandConstant(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase.EDIT_POLICY_COMMAND'''
- def contextElementTypeConstant(GenDiagram it) '''org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE'''
+ def contextElementTypeConstant(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE'''
def attributes(GenDiagram it) ''''''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/EditHelper.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/EditHelper.xtend
index e1bc9cc03a8..7cc77d81942 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/EditHelper.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/edithelpers/EditHelper.xtend
@@ -1,27 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2006-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.edithelpers;
import com.google.inject.Inject
import org.eclipse.papyrus.gmf.codegen.gmfgen.MetamodelType
import xpt.Common
+import utils.EditHelperUtils_qvto
public class EditHelper {
@Inject extension Common;
- @Inject BaseEditHelper xptBaseEditHelper;
+ @Inject extension EditHelperUtils_qvto
def className(MetamodelType it) '''«it.editHelperClassName»'''
@@ -36,10 +37,11 @@ public class EditHelper {
package «packageName(it)»;
«generatedClassComment»
- public class «className(it)» extends «xptBaseEditHelper.qualifiedClassName(it.diagramElement.diagram)» {
+ public class «editHelperClassName» extends «getBaseEditHelperFullName(diagramElement.getDiagram())» {
«additions(it)»
}
'''
def additions(MetamodelType it) ''''''
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/Common.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/Common.xtend
index 604848ca3fa..c3d75b8d732 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/Common.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/Common.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
- *
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2021 Borland Software Corporation, CEA LIST, Artal and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Patrick Tessier (CEA LIST)
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editparts
@@ -33,19 +33,19 @@ import impl.diagram.editparts.viewmaps.modeledViewmapProducer
import org.eclipse.emf.ecore.EObject
import org.eclipse.papyrus.gmf.gmfgraph.Label
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenContainerBase
-import xpt.editor.VisualIDRegistry
+import xpt.QualifiedClassNameProvider
@com.google.inject.Singleton class Common {
@Inject extension xpt.Common;
@Inject extension Common_qvto;
+ @Inject QualifiedClassNameProvider qualifiedClassNameProvider;
@Inject TextAware xptTextAware;
@Inject modeledViewmapProducer xptModeledViewmapProducer;
- @Inject VisualIDRegistry xptVisualIDRegistry;
def visualIDConstant(GenCommonBase it) '''
«generatedMemberComment»
- public static final int VISUAL_ID = «visualID»;
+ public static final String VISUAL_ID = "«stringVisualID»";
'''
def behaviour(GenCommonBase it) '''
@@ -202,21 +202,25 @@ import xpt.editor.VisualIDRegistry
«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()»());
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «qualifiedClassNameProvider.getItemSemanticEditPolicyQualifiedClassName(it)»());
«ENDIF»
'''
def installCanonicalEditPolicy(GenContainerBase it) '''
«IF it.needsCanonicalEditPolicy»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»());
+ ««« BEGIN: PapyrusGenCode
+ ««« Used to remove at each time canonical editpolicies
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»());
+ ««« END: PapyrusGenCode
+
«ENDIF»
'''
-
def installCreationEditPolicy(GenCommonBase it) '''
installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, «creationEditPolicyNewInstance»);
'''
def creationEditPolicyNewInstance(GenCommonBase it)
- '''new org.eclipse.gmf.tooling.runtime.edit.policies.reparent.CreationEditPolicyWithCustomReparent(«xptVisualIDRegistry.runtimeTypedInstanceCall(it.diagram)»)'''
+ '''new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy()'''
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/EditPartFactory.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/EditPartFactory.xtend
index 4b85259cec7..38c8ef8e7a5 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/EditPartFactory.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editparts/EditPartFactory.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editparts
@@ -119,10 +119,51 @@ import diagram.editparts.DiagramEditPart
'''
def getTextCellEditorLocator(GenDiagram it) '''
- «generatedMemberComment()»
+ «generatedMemberComment»
public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator(
org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart source) {
- return org.eclipse.gmf.tooling.runtime.directedit.locator.CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
+ if (source.getFigure() instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure){
+ return new MultilineCellEditorLocator(
+ (org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure) source.getFigure());
+ }
+ else {
+ return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
+
+ }
+ }
+
+
+ «generatedClassComment»
+ static private class MultilineCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
+
+ «generatedClassComment»
+ private org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure multilineEditableFigure;
+
+ «generatedClassComment»
+ public MultilineCellEditorLocator(org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure figure) {
+ this.multilineEditableFigure = figure;
+ }
+
+ «generatedClassComment»
+ public org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure getMultilineEditableFigure() {
+ return multilineEditableFigure;
+ }
+
+ «generatedClassComment»
+ public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
+ org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl();
+ org.eclipse.draw2d.geometry.Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
+ rect.x=getMultilineEditableFigure().getEditionLocation().x;
+ rect.y=getMultilineEditableFigure().getEditionLocation().y;
+ getMultilineEditableFigure().translateToAbsolute(rect);
+ if (getMultilineEditableFigure().getText().length() > 0) {
+ rect.setSize(new org.eclipse.draw2d.geometry.Dimension(text.computeSize(rect.width,
+ org.eclipse.swt.SWT.DEFAULT)));
+ }
+ if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
}
'''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend
index f9100d7308a..6209b843611 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend
@@ -1,17 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2014, 2021 Borland Software Corporation, Christian W. Damus, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ *
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Christian W. Damus - bug 451230
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
@@ -42,19 +43,20 @@ import xpt.QualifiedClassNameProvider
@com.google.inject.Singleton class BaseItemSemanticEditPolicy {
@Inject extension Common;
+ @Inject extension VisualIDRegistry
+
@Inject extension Common_qvto;
@Inject extension xpt.diagram.Utils_qvto;
@Inject extension OclMigrationProblems_qvto;
@Inject extension Utils_qvto;
@Inject extension QualifiedClassNameProvider;
-
+
@Inject BaseEditHelper xptBaseEditHelper;
@Inject Activator xptPluginActivator;
@Inject MetaModel xptMetaModel;
@Inject getExpression xptGetExpression;
- @Inject VisualIDRegistry xptVisualIDRegistry;
@Inject ElementTypes xptElementTypes;
-
+
def className(GenDiagram it) '''«it.baseItemSemanticEditPolicyClassName»'''
def packageName(GenDiagram it) '''«it.getDiagram().editPoliciesPackageName»'''
@@ -63,7 +65,7 @@ import xpt.QualifiedClassNameProvider
def fullPath(GenDiagram it) '''«qualifiedClassName(it)»'''
-def BaseItemSemanticEditPolicy(GenDiagram it) '''
+ def BaseItemSemanticEditPolicy(GenDiagram it) '''
«copyright(editorGen)»
package «packageName(it)»;
@@ -75,27 +77,25 @@ public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.editpo
«constructor(it)»
«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'
+ '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' + 'Add the reoriented view to the request extended data so that the view\n ' + 'currently edited can be distinguished from other views of the same element\n ' +
+ 'and these latter possibly removed if they become inconsistent after reconnect\n'
+ @SuppressWarnings("unchecked")
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(«xptVisualIDRegistry.getVisualIDMethodCall(it)»((org.eclipse.gmf.runtime.notation.View) view));
+ String id = «getVisualIDMethodCall(it)»((org.eclipse.gmf.runtime.notation.View) view);
request.getExtendedData().put(VISUAL_ID_KEY, id);
+ request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view);
}
}
return super.getCommand(request);
}
«generatedMemberComment('Returns visual id from request parameters.')»
- 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;
+ protected String getVisualID(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
+ return (String) request.getParameter(VISUAL_ID_KEY);
}
«semanticPart(it)»
@@ -107,7 +107,7 @@ public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.editpo
«addDestroyShortcutsCommand(it)»
-«IF links.exists(link | !link.sansDomain)»
+«IF links.exists(link|!link.sansDomain)»
«linkConstraints(it)»
«ENDIF»
@@ -115,102 +115,105 @@ public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.editpo
}
'''
-def attributes(GenDiagram it) '''
- «generatedMemberComment('Extended request data key to hold editpart visual id.')»
- public static final String VISUAL_ID_KEY = "visual_id"; «nonNLS()»
-
- «generatedMemberComment()»
- private final org.eclipse.gmf.runtime.emf.type.core.IElementType myElementType;
-'''
+ def attributes(GenDiagram it) '''
+ «generatedMemberComment('Extended request data key to hold editpart visual id.')»
+ public static final String VISUAL_ID_KEY = "visual_id"; «nonNLS()»
+ «generatedMemberComment('Extended request data key to hold the edge view during a reconnect request.')»
+ public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; «nonNLS»
+ «generatedMemberComment()»
+ private final org.eclipse.gmf.runtime.emf.type.core.IElementType myElementType;
+ '''
-def constructor(GenDiagram it) '''
- «generatedMemberComment()»
- protected «className(it)»(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
- myElementType = elementType;
- }
-'''
+ def constructor(GenDiagram it) '''
+ «generatedMemberComment()»
+ protected «className(it)»(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
+ myElementType = elementType;
+ }
+ '''
-def addDestroyShortcutsCommand(GenDiagram it) '''
- «generatedMemberComment('Clean all shortcuts to the host element from the same diagram')»
- protected void addDestroyShortcutsCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd, org.eclipse.gmf.runtime.notation.View view) {
- «_assert('view.getEAnnotation(\"Shortcut\") == null')»
- 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()) { «nonNLS()»
- continue;
+ def addDestroyShortcutsCommand(GenDiagram it) '''
+ «generatedMemberComment('Clean all shortcuts to the host element from the same diagram')»
+ protected void addDestroyShortcutsCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd, org.eclipse.gmf.runtime.notation.View view) {
+ «_assert('view.getEAnnotation(\"Shortcut\") == null')»
+ 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()) { «nonNLS()»
+ continue;
+ }
+ cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), nextView));
}
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), nextView));
}
- }
-'''
-
-def semanticPart(GenDiagram it) '''
- «getSemanticCommand(it)»
-
- «addDeleteViewCommand(it)»
-
- «getEditHelperCommand(it)»
-
- «getContextElementType(it)»
-
- «getSemanticCommandSwitch(it)»
-
- «getConfigureCommand(it)»
-
- «getCreateRelationshipCommand(it)»
-
- «getCreateCommand(it)»
-
- «getSetCommand(it)»
-
- «getEditContextCommand(it)»
-
- «getDestroyElementCommand(it)»
-
- «getDestroyReferenceCommand(it)»
-
- «getDuplicateCommand(it)»
-
- «getMoveCommand(it)»
-
- «getReorientReferenceRelationshipCommand(it)»
+ '''
- «getReorientRelationshipCommand(it)»
-
- «getGEFWrapper(it)»
-'''
+ def semanticPart(GenDiagram it) '''
+ «getSemanticCommand(it)»
+
+ «addDeleteViewCommand(it)»
+
+ «getEditHelperCommand(it)»
+
+ «getContextElementType(it)»
+
+ «getSemanticCommandSwitch(it)»
+
+ «getConfigureCommand(it)»
+
+ «getCreateRelationshipCommand(it)»
+
+ «getCreateCommand(it)»
+
+ «getCreateSemanticServiceEditCommand(it)»
+
+ «getSetCommand(it)»
+
+ «getEditContextCommand(it)»
+
+ «getDestroyElementCommand(it)»
+
+ «getDestroyReferenceCommand(it)»
+
+ «getDuplicateCommand(it)»
+
+ «getMoveCommand(it)»
+
+ «getReorientReferenceRelationshipCommand(it)»
+
+ «getReorientRelationshipCommand(it)»
+
+ «getGEFWrapper(it)»
+ '''
-def getEditHelperCommand(GenDiagram it) '''
- «generatedMemberComment()»
- private org.eclipse.gef.commands.Command getEditHelperCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request, org.eclipse.gef.commands.Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- org.eclipse.gmf.runtime.common.core.command.ICommand command = editPolicyCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) editPolicyCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(editPolicyCommand);
- request.setParameter(«xptBaseEditHelper.editPolicyCommandConstant(it)», command);
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(«xptBaseEditHelper.contextElementTypeConstant(it)», requestContextElementType);
- org.eclipse.gmf.runtime.common.core.command.ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(«xptBaseEditHelper.editPolicyCommandConstant(it)», null);
- request.setParameter(«xptBaseEditHelper.contextElementTypeConstant(it)», null);
- if (command != null) {
- if (!(command instanceof org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)) {
- command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
+ def getEditHelperCommand(GenDiagram it) '''
+ «generatedMemberComment()»
+ private org.eclipse.gef.commands.Command getEditHelperCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request, org.eclipse.gef.commands.Command editPolicyCommand) {
+ if (editPolicyCommand != null) {
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = editPolicyCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) editPolicyCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(editPolicyCommand);
+ request.setParameter(«xptBaseEditHelper.editPolicyCommandConstant(it)», command);
}
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = getContextElementType(request);
+ request.setParameter(«xptBaseEditHelper.contextElementTypeConstant(it)», requestContextElementType);
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = requestContextElementType.getEditCommand(request);
+ request.setParameter(«xptBaseEditHelper.editPolicyCommandConstant(it)», null);
+ request.setParameter(«xptBaseEditHelper.contextElementTypeConstant(it)», null);
+ if (command != null) {
+ if (!(command instanceof org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)) {
+ command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
+ }
+ return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
+ }
+ return editPolicyCommand;
}
- return editPolicyCommand;
- }
-'''
+ '''
-def getContextElementType(GenDiagram it) '''
- «generatedMemberComment()»
- private org.eclipse.gmf.runtime.emf.type.core.IElementType getContextElementType(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «xptElementTypes.qualifiedClassName(it)».getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
-'''
+ def getContextElementType(GenDiagram it) '''
+ «generatedMemberComment()»
+ protected org.eclipse.gmf.runtime.emf.type.core.IElementType getContextElementType(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «xptElementTypes.qualifiedClassName(it)».getElementType(getVisualID(request));
+ return requestContextElementType != null ? requestContextElementType : myElementType;
+ }
+ '''
-def getSemanticCommand(GenDiagram it) '''
+ def getSemanticCommand(GenDiagram it) '''
«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);
@@ -224,7 +227,7 @@ protected org.eclipse.gef.commands.Command getSemanticCommand(org.eclipse.gmf.ru
}
'''
-def addDeleteViewCommand(GenDiagram it) '''
+ def addDeleteViewCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command addDeleteViewCommand(org.eclipse.gef.commands.Command mainCommand, org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest completedRequest){
org.eclipse.gef.commands.Command deleteViewCommand = getGEFWrapper(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getHost().getModel()));
@@ -232,7 +235,7 @@ protected org.eclipse.gef.commands.Command addDeleteViewCommand(org.eclipse.gef.
}
'''
-def getSemanticCommandSwitch(GenDiagram it) '''
+ def getSemanticCommandSwitch(GenDiagram it) '''
«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) {
@@ -262,95 +265,142 @@ protected org.eclipse.gef.commands.Command getSemanticCommandSwitch(org.eclipse.
}
'''
-def getConfigureCommand(GenDiagram it) '''
+ def getConfigureCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest req) {
return null;
}
'''
-def getCreateRelationshipCommand(GenDiagram it) '''
+ def getCreateRelationshipCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
+ «IF !usingElementTypeCreationCommand»
return null;
+ «ELSE»
+ org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)getHost()).resolveSemanticElement());
+ if(req.getElementType() != null) {
+ commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getElementType(), req.getClientContext());
+ }
+
+ if(commandService == null) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ }
+
+ org.eclipse.gmf.runtime.common.core.command.ICommand semanticCommand = commandService.getEditCommand(req);
+
+ if((semanticCommand != null) && (semanticCommand.canExecute())) {
+ return getGEFWrapper(semanticCommand);
+ }
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ «ENDIF»
}
'''
-def getCreateCommand(GenDiagram it) '''
+ def getCreateCommand(GenDiagram it) '''
«generatedMemberComment()»
-protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- return null;
-}
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
+ if (requestElementType instanceof org.eclipse.gmf.runtime.emf.type.core.IElementType) {
+ org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandProvider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer());
+ if (commandProvider != null) {
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = commandProvider.getEditCommand(req);
+ if (command != null && command.canExecute()) {
+ return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
+ }
+ }
+ }
+ return null;
+ }
'''
-def getSetCommand(GenDiagram it) '''
+ def getSetCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest req) {
return null;
}
'''
-def getEditContextCommand(GenDiagram it) '''
+ def getEditContextCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getEditContextCommand(org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest req) {
return null;
}
'''
-def getDestroyElementCommand(GenDiagram it) '''
+ def getDestroyElementCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
return null;
}
'''
-def getDestroyReferenceCommand(GenDiagram it) '''
+ def getDestroyReferenceCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
return null;
}
'''
-def getDuplicateCommand(GenDiagram it) '''
+ def getDuplicateCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
return null;
}
'''
-def getMoveCommand(GenDiagram it) '''
+ def getMoveCommand(GenDiagram it) '''
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest req) {
- return null;
+ ««« BEGIN: PapyrusGenCode
+ ««« add move command
+ org.eclipse.emf.ecore.EObject targetCEObject = req.getTargetContainer();
+ if(targetCEObject != null) {
+ org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(targetCEObject);
+ if(provider != null) {
+ org.eclipse.gmf.runtime.common.core.command.ICommand moveCommand = provider.getEditCommand(req);
+ if(moveCommand != null) {
+ return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(moveCommand);
+ }
+ }
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ } else {
+ return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand(req));
+ }
+ ««« END: PapyrusGenCode
+
}
'''
-def getReorientReferenceRelationshipCommand(GenDiagram it) '''
+ def getReorientReferenceRelationshipCommand(GenDiagram it) '''
«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;
}
'''
-def getReorientRelationshipCommand(GenDiagram it) '''
+ def getReorientRelationshipCommand(GenDiagram it) '''
«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;
}
'''
-def getGEFWrapper(GenDiagram it) '''
- «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);
- }
-'''
+ def getGEFWrapper(GenDiagram it) '''
+ «generatedMemberComment()»
+ protected final org.eclipse.gef.commands.Command getGEFWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) {
+ return (cmd == null) ? org.eclipse.gef.commands.UnexecutableCommand.INSTANCE : new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(cmd);
+ }
+ '''
-/**
+ /**
* FIXME need to check constraint's provider to ensure we don't generate a field
* for e.g. Java (or Literal, which is unlikely, though) expressions
+ *
+ * [Papyrus Quick Fix] Do not generate field when the expression is provided
+ * by a GenJavaExpressionProvider.
*/
-def linkConstraints(GenDiagram it) '''
+ def linkConstraints(GenDiagram it) '''
«generatedMemberComment()»
public static «getLinkCreationConstraintsClassName()» getLinkConstraints() {
@@ -364,8 +414,8 @@ def linkConstraints(GenDiagram it) '''
«generatedClassComment()»
public static class «getLinkCreationConstraintsClassName()» {
- «generatedMemberComment()»
- «getLinkCreationConstraintsClassName()»() {«/*package-local for the BaseItemSemanticEditPolicy to instantiate. Perhaps, protected is better (i.e. if someone subclasses it?)*/»
+ «generatedMemberComment»
+ public «getLinkCreationConstraintsClassName()»() {«««package-local for the BaseItemSemanticEditPolicy to instantiate. Perhaps, protected is better (i.e. if someone subclasses it?)
// use static method #getLinkConstraints() to access instance
}
@@ -379,90 +429,115 @@ public static class «getLinkCreationConstraintsClassName()» {
}
'''
-def canCreate(GenLink it) '''
+ def canCreate(GenLink it) '''
«generatedMemberComment()»
-public boolean canCreate«getUniqueIdentifier()»(«canCreateParameters(it.modelFacet)») {
+public boolean canCreate«stringUniqueIdentifier()»(
+«IF !it.sansDomain»
+«canCreateParameters(it.modelFacet)»
+«ENDIF»
+) {
+ «IF !it.sansDomain»
«checkEMFConstraints(it.modelFacet)»
- return canExist«getUniqueIdentifier()»(«canCreateValues(it.modelFacet)»);
+ «ENDIF»
+ return canExist«stringUniqueIdentifier()»(
+ «IF !it.sansDomain»
+ «canCreateValues(it.modelFacet)»
+ «ENDIF»
+ );
}
-
'''
-/**
- * XXX for now, both constraints are injected into single method
- * which may not 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.
-*/
-def canExist(GenLink it) '''
- «generatedMemberComment()»
- public boolean canExist«getUniqueIdentifier()»(«canExistParameters(it.modelFacet)») {
- «IF creationConstraints != null && creationConstraints.isValid() && it.diagram.editorGen.expressionProviders != null»
- try {
- «IF creationConstraints.sourceEnd != null»
- «checkAdditionalConstraint(creationConstraints.sourceEnd.provider, creationConstraints.sourceEnd, 'source', 'target', creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass())»
- «ENDIF»
- «IF creationConstraints.targetEnd != null»
- «checkAdditionalConstraint(creationConstraints.targetEnd.provider, creationConstraints.targetEnd, 'target', 'source', creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass())»
- «ENDIF»
+ /**
+ * XXX for now, both constraints are injected into single method
+ * which may not 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.
+ */
+ def canExist(GenLink it) '''
+ «generatedMemberComment()»
+ public boolean canExist«stringUniqueIdentifier()»(
+ «IF !it.sansDomain»
+ «canExistParameters(it.modelFacet)»
+ «ENDIF»
+ ) {
+ «IF creationConstraints != null && creationConstraints.isValid() && it.diagram.editorGen.expressionProviders != null»
+ try {
+ «IF creationConstraints.sourceEnd != null»
+ «checkAdditionalConstraint(creationConstraints.sourceEnd.provider, creationConstraints.sourceEnd, 'source', 'target', creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass())»
+ «ENDIF»
+ «IF creationConstraints.targetEnd != null»
+ «checkAdditionalConstraint(creationConstraints.targetEnd.provider, creationConstraints.targetEnd, 'target', 'source', creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass())»
+ «ENDIF»
+ return true;
+ } catch(Exception e) {
+ «xptPluginActivator.instanceAccess(it.diagram.editorGen)».logError("Link constraint evaluation error", e); «nonNLS()»
+ return false;
+ }
+ «ELSE»
return true;
- } catch(Exception e) {
- «xptPluginActivator.instanceAccess(it.diagram.editorGen)».logError("Link constraint evaluation error", e); «nonNLS()»
- return false;
+ «ENDIF»
}
- «ELSE»
- return true;
- «ENDIF»
- }
-'''
+ '''
-/**
- * FIXME XXX mark as private (_) and move to impl::<find proper place>::LinkConstraints.xpt
- */
-def dispatch canCreateParameters(LinkModelFacet it) '''«sourceTargetParameters(it)»'''// source and target are reasonable defaults
-def dispatch canCreateParameters(TypeLinkModelFacet it) '''«IF hasContainerOtherThanSource(it)»«xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container, «ENDIF»«sourceTargetParameters(it)»'''
+ /**
+ * FIXME XXX mark as private (_) and move to impl::<find proper place>::LinkConstraints.xpt
+ */
+ def dispatch canCreateParameters(LinkModelFacet it) '''«sourceTargetParameters(it)»''' // source and target are reasonable defaults
+
+ def dispatch canCreateParameters(
+ TypeLinkModelFacet it) '''«IF hasContainerOtherThanSource(it)»«xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container, «ENDIF»«sourceTargetParameters(it)»'''
-def dispatch canExistParameters(LinkModelFacet it) '''«sourceTargetParameters(it)»'''// source and target are reasonable defaults
-def dispatch canExistParameters(TypeLinkModelFacet it) '''«IF hasContainerOtherThanSource(it)»«xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container, «ENDIF»«xptMetaModel.QualifiedClassName(metaClass)» linkInstance, «sourceTargetParameters(it)»'''
+ def dispatch canExistParameters(LinkModelFacet it) '''«sourceTargetParameters(it)»''' // source and target are reasonable defaults
-def sourceTargetParameters(LinkModelFacet it) '''«xptMetaModel.QualifiedClassName(it.sourceType)» source, «xptMetaModel.QualifiedClassName(it.targetType)» target'''
+ def dispatch canExistParameters(
+ TypeLinkModelFacet it) '''«IF hasContainerOtherThanSource(it)»«xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container, «ENDIF»«xptMetaModel.QualifiedClassName(metaClass)» linkInstance, «sourceTargetParameters(it)»'''
+
+ def sourceTargetParameters(
+ LinkModelFacet it) '''«xptMetaModel.QualifiedClassName(it.sourceType)» source, «xptMetaModel.QualifiedClassName(it.targetType)» target'''
// these are in fact 'canExist' values
-def dispatch canCreateValues(LinkModelFacet it) '''source, target''' // defaults
-def dispatch canCreateValues(TypeLinkModelFacet it) '''«IF hasContainerOtherThanSource(it)»container, «ENDIF»null, source, target'''
+ def dispatch canCreateValues(LinkModelFacet it) '''source, target''' // defaults
+ def dispatch canCreateValues(
+ TypeLinkModelFacet it) '''«IF hasContainerOtherThanSource(it)»container, «ENDIF»null, source, target'''
-def dispatch checkEMFConstraints(LinkModelFacet it) '''«ERROR('Unrecognized link model facet in checkEMFConstraints: ' + it)»'''
+ def dispatch checkEMFConstraints(
+ LinkModelFacet it) '''«ERROR('Unrecognized link model facet in checkEMFConstraints: ' + it)»'''
-/**
- * [MG] extracted from LET statement, @see checkEMFConstraints(TypeLinkModelFacet)
- */
-private def checkChildFeatureBounds(TypeLinkModelFacet it) {
- childMetaFeature != containmentMetaFeature && !isUnbounded(childMetaFeature.ecoreFeature)
-}
+ /**
+ * [MG] extracted from LET statement, @see checkEMFConstraints(TypeLinkModelFacet)
+ */
+ private def checkChildFeatureBounds(TypeLinkModelFacet it) {
+ childMetaFeature != containmentMetaFeature && !isUnbounded(childMetaFeature.ecoreFeature)
+ }
+
-def dispatch checkEMFConstraints(TypeLinkModelFacet it) '''
- «IF !isUnbounded(containmentMetaFeature.ecoreFeature) || checkChildFeatureBounds(it)»
-if («getContainerVariable(it)» != null) {
- «checkEMFConstraints(it.containmentMetaFeature, it)»
- «IF checkChildFeatureBounds(it)»
- «checkEMFConstraints(it.childMetaFeature, it)»
+ def dispatch checkEMFConstraints(TypeLinkModelFacet it) '''
+«IF containmentMetaFeature.ecoreFeature != null»
+ «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || checkChildFeatureBounds(it)»
+ if («getContainerVariable(it)» != null) {
+ «checkEMFConstraints(containmentMetaFeature, it)»
+ «IF checkChildFeatureBounds(it)»
+ «checkEMFConstraints(childMetaFeature, it)»
+ «ENDIF»
+ }
«ENDIF»
-}
- «ENDIF»
+«ENDIF»
'''
-def checkEMFConstraints(GenFeature it, TypeLinkModelFacet modelFacet) '''
-«IF !isUnbounded(it.ecoreFeature)»
+ def checkEMFConstraints(GenFeature it, TypeLinkModelFacet modelFacet) '''
+«IF modelFacet.containmentMetaFeature.ecoreFeature != null»
+«IF ! isUnbounded(ecoreFeature)»
if («featureBoundComparator(it, getContainerVariable(modelFacet), modelFacet.getSourceType())») {
return false;
}
«ENDIF»
+«ENDIF»
'''
-def dispatch checkEMFConstraints(FeatureLinkModelFacet it) '''
+ def dispatch checkEMFConstraints(FeatureLinkModelFacet it) '''
if (source != null) {
if («featureBoundsConditionClause(it.metaFeature, 'source', getSourceType())») {
return false;
@@ -481,35 +556,49 @@ if (target != null && («featureBoundsConditionClause(metaFeature.reverse, 'targ
«extraLineBreak»
'''
-def featureBoundsConditionClause(GenFeature it, String targetVar, GenClass targetType) '''
-«/*Checking upper bounds if was specified in MM */
-IF !isUnbounded(it.ecoreFeature)»«featureBoundComparator(it, targetVar, targetType)»«ENDIF»
-«/*Checking uniqueness in addition if upper bounds != 1 */
-IF !isSingleValued(it.ecoreFeature) && !isUnbounded(it.ecoreFeature)» || «ENDIF»
-«/*Checking uniqueness in if upper bounds !- 1 */
-IF !isSingleValued(it.ecoreFeature)»«featureUniquenessComparator(it, targetVar, targetType)»«ENDIF»
+ def featureBoundsConditionClause(GenFeature it, String targetVar, GenClass targetType) '''
+«««Checking upper bounds if was specified in MM
+«IF ecoreFeature != null»
+ «IF ! isUnbounded(ecoreFeature)»«featureBoundComparator(it, targetVar, targetType)»«ENDIF»
+ ««« Checking uniqueness in addition if upper bounds != 1
+ «IF ! isSingleValued(ecoreFeature) && ! isUnbounded(ecoreFeature)» || «ENDIF»
+ ««« Checking uniqueness in if upper bounds !- 1
+ «IF ! isSingleValued(ecoreFeature)»«featureUniquenessComparator(it, targetVar, targetType)»«ENDIF»
+«ENDIF»
'''
-def featureBoundComparator(GenFeature it, String featureVar, GenClass featureVarGenClass) '''«xptMetaModel.getFeatureValue(it, featureVar, featureVarGenClass)»«IF isSingleValued(ecoreFeature)» != null«ELSE».size() >= «ecoreFeature.upperBound»«ENDIF»'''
-def featureUniquenessComparator(GenFeature it, String featureVar, GenClass featureVarGenClass) '''«xptMetaModel.getFeatureValue(it, featureVar, featureVarGenClass)».contains(target)'''
+ def featureBoundComparator(GenFeature it, String featureVar, GenClass featureVarGenClass) '''
+ «xptMetaModel.getFeatureValue(it, featureVar, featureVarGenClass)»
+ «IF ecoreFeature.upperBound == 1»
+ != null
+ «ELSE»
+ .size() >= «ecoreFeature.upperBound»
+ «ENDIF»
+ '''
+
+ def featureUniquenessComparator(GenFeature it, String featureVar,
+ GenClass featureVarGenClass) '''«xptMetaModel.getFeatureValue(it, featureVar, featureVarGenClass)».contains(target)'''
-def dispatch checkAdditionalConstraint(GenExpressionProviderBase it, ValueExpression valueExpr, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) '''
+ def dispatch checkAdditionalConstraint(GenExpressionProviderBase it, ValueExpression valueExpr, String sourceEndVar,
+ String targetEndVar, GenClass context, GenClass oppositeEndContext) '''
«ERROR('Have no idea what extra constraints to check for ' + it)»
'''
-def dispatch checkAdditionalConstraint(GenExpressionInterpreter it, ValueExpression valueExpr, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) '''
- if («sourceEndVar» == null) {
- return true;
- } else {«/** else is important here as it gives scope for the env variable */»
- java.util.Map<String, org.eclipse.emf.ecore.EClassifier> env = java.util.Collections.<String, org.eclipse.emf.ecore.EClassifier>singletonMap(«oppositeEndVariableNameValue(it)», «xptMetaModel.MetaClass(oppositeEndContext)»); «nonNLS()»
- Object «sourceEndVar»Val = «xptGetExpression.getExpression(it, valueExpr, context, 'env')».evaluate(«sourceEndVar», java.util.Collections.singletonMap(«oppositeEndVariableNameValue(it)», «targetEndVar»)); «nonNLS()»
- if (false == «sourceEndVar»Val instanceof Boolean || !((Boolean) «sourceEndVar»Val).booleanValue()) {
- return false;
- } // else fall-through
- }
-'''
+ def dispatch checkAdditionalConstraint(GenExpressionInterpreter it, ValueExpression valueExpr, String sourceEndVar,
+ String targetEndVar, GenClass context, GenClass oppositeEndContext) '''
+ if («sourceEndVar» == null) {
+ return true;
+ } else {«/** else is important here as it gives scope for the env variable */»
+ java.util.Map<String, org.eclipse.emf.ecore.EClassifier> env = java.util.Collections.<String, org.eclipse.emf.ecore.EClassifier>singletonMap(«oppositeEndVariableNameValue(it)», «xptMetaModel.MetaClass(oppositeEndContext)»); «nonNLS()»
+ Object «sourceEndVar»Val = «xptGetExpression.getExpression(it, valueExpr, context, 'env')».evaluate(«sourceEndVar», java.util.Collections.singletonMap(«oppositeEndVariableNameValue(it)», «targetEndVar»)); «nonNLS()»
+ if (false == «sourceEndVar»Val instanceof Boolean || !((Boolean) «sourceEndVar»Val).booleanValue()) {
+ return false;
+ } // else fall-through
+ }
+ '''
-def dispatch checkAdditionalConstraint(GenJavaExpressionProvider it, ValueExpression valueExpr, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) '''
+ def dispatch checkAdditionalConstraint(GenJavaExpressionProvider it, ValueExpression valueExpr, String sourceEndVar,
+ String targetEndVar, GenClass context, GenClass oppositeEndContext) '''
«IF injectExpressionBody && valueExpr.body != null && !valueExpr.body.empty»
«valueExpr.body»
«ELSEIF throwException || (injectExpressionBody && (valueExpr.body == null || valueExpr.body.empty))»
@@ -526,7 +615,7 @@ def dispatch checkAdditionalConstraint(GenJavaExpressionProvider it, ValueExpres
«ENDIF»
'''
- @MetaDef def canExistCall(FeatureLinkModelFacet xptSelf, GenLink link, String sourceVar, String targetVar) //
+ @MetaDef def canExistCall(FeatureLinkModelFacet xptSelf, GenLink link, String sourceVar, String targetVar) //
'''«_accessLinkConstraints(link.diagram)».canExist«link.uniqueIdentifier»(«sourceVar», «targetVar»)'''
/**
@@ -547,9 +636,10 @@ def dispatch checkAdditionalConstraint(GenJavaExpressionProvider it, ValueExpres
String targetVar) //
'''«_accessLinkConstraints(link.diagram)».canCreate«link.uniqueIdentifier»(«IF hasContainerOtherThanSource(xptSelf)»«containerVar», «ENDIF»«sourceVar», «targetVar»)'''
- @MetaDef private def _accessLinkConstraints(GenDiagram xptSelf) '''«qualifiedClassName(xptSelf)».getLinkConstraints()'''
+ @MetaDef private def _accessLinkConstraints(
+ GenDiagram xptSelf) '''«qualifiedClassName(xptSelf)».getLinkConstraints()'''
- def oppositeEndVariableNameValue(Object any)'''"oppositeEnd"'''
+ def oppositeEndVariableNameValue(Object any) '''"oppositeEnd"'''
def additions(GenDiagram it) ''''''
@@ -559,14 +649,32 @@ def dispatch checkAdditionalConstraint(GenJavaExpressionProvider it, ValueExpres
«defaultConstructorBody(it)»
}
'''
+
/**
* @param genCommon diagram, node or link, which MUST have an element type (genCommon.elementType != null)
*/
def defaultConstructorBody(GenCommonBase genCommon) '''
- «IF genCommon.elementType == null»
- «ERROR("No element type in the passed node. Only diagram, node or link are supported in this template: " + genCommon)»
- «ENDIF»
- super(«xptElementTypes.accessElementType(genCommon)»);
+ «IF genCommon.elementType == null»
+ «ERROR("No element type in the passed node. Only diagram, node or link are supported in this template: " + genCommon)»
+ «ENDIF»
+ super(«xptElementTypes.accessElementType(genCommon)»);
'''
+
+ /**
+ * Generate generic method if using semantic creation command based on element types framework.
+ *
+ */
+ def getCreateSemanticServiceEditCommand(GenDiagram it) '''
+«IF usingElementTypeCreationCommand»
+ «generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getSemanticCreationCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
+ org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer());
+ if(commandService == null) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+ return commandService.getEditCommand(req);
+ }
+«ENDIF»
+'''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend
index bd626b85bfb..15570eef0b4 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend
@@ -1,26 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2006-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
import com.google.inject.Inject
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
import xpt.Common
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildNode
+import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeModelFacet
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
+import metamodel.MetaModel
+import org.eclipse.emf.common.util.EList
@com.google.inject.Singleton class CompartmentItemSemanticEditPolicy {
@Inject extension Common;
+ @Inject extension MetaModel;
@Inject childContainerCreateCommand xptChildContainerCreateCommand;
@Inject BaseItemSemanticEditPolicy xptBaseItemSemanticEditPolicy;
@@ -33,18 +39,18 @@ import xpt.Common
def fullPath(GenCompartment it) '''«qualifiedClassName(it)»'''
- def CompartmentItemSemanticEditPolicy(GenCompartment it) '''
+ def CompartmentItemSemanticEditPolicy(GenCompartment it) '''
«copyright(getDiagram().editorGen)»
package «packageName(it)»;
«generatedClassComment()»
public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» {
- «_constructor(it)»
+ «_constructor(it)»
+
+ «xptChildContainerCreateCommand.childContainerCreateCommand( it.childNodes)»
- «xptChildContainerCreateCommand.childContainerCreateCommand(it.childNodes)»
-
- «additions(it)»
+ «additions(it)»
}
'''
@@ -56,4 +62,73 @@ import xpt.Common
'''
def additions(GenCompartment it) ''''''
+
+def getChildNodeReference (EList<GenChildNode> it) '''
+ «IF !(it.isEmpty)»
+ «generatedMemberComment»
+ private static Set<EReference> compartmentReferences;
+
+ «generatedMemberComment»
+ static {
+ ««« compartmentReferences = new HashSet<EReference>(«it.modelFacet->size()»);
+ compartmentReferences = new HashSet<EReference>();
+
+ «FOR n : it»
+ «childRef(n.modelFacet,n)»
+ «ENDFOR»
+ }
+ «generatedMemberComment»
+ protected Iterable<EReference> getCompartmentReferences() {
+ return compartmentReferences;
+ }
+«ENDIF»
+
+'''
+
+def childRef(TypeModelFacet it ,GenNode node) '''
+ compartmentReferences.add(«MetaFeature (node.modelFacet.containmentMetaFeature)»);
+'''
+
+
+def isCorrectCompartment (GenCompartment it)'''
+ «generatedMemberComment»
+ protected boolean isMovedIntoCorrectCompartment(MoveRequest req){
+ for(Object entry : req.getElementsToMove().entrySet()) {
+ if(entry instanceof Map.Entry<?, ?>) {
+ Map.Entry<?, ?> mapEntry = (Map.Entry<?, ?>)entry;
+ Object key = mapEntry.getKey();
+ if(key instanceof EObject) {
+ EObject dropppedObject = (EObject)key;
+ EObject semanticHost = ((IGraphicalEditPart)getHost()).resolveSemanticElement();
+ boolean foundERefrences = false;
+ if(semanticHost != null) {
+ for(EReference ref : getCompartmentReferences()) {
+ if(ref.isContainment()) {
+ foundERefrences = PackageUtil.canContain(semanticHost.eClass(), ref, dropppedObject.eClass(), false);
+ } else {
+ foundERefrences = PackageUtil.canReference(semanticHost.eClass(), ref, dropppedObject.eClass());
+ }
+ if(foundERefrences) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+'''
+
+def constraintedMoveCommand (GenCompartment it)'''
+ «generatedMemberComment»
+ @Override
+ protected Command getMoveCommand(MoveRequest req) {
+ if (isMovedIntoCorrectCompartment(req)){
+ return super.getMoveCommand(req);
+ } else {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+'''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend
index e97daf4558a..24da61c3661 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend
@@ -1,18 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2007-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007-2012, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Borland) - [243151] explicit source/target for links
+ * - #386838 - migrate to Xtend2
+ * Vincent Lorenzo (CEA-LIST) -
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
@@ -24,6 +25,8 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.LinkModelFacet
import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeLinkModelFacet
import xpt.Common
import xpt.Common_qvto
+import utils.UtilsItemSemanticEditPolicy
+
@com.google.inject.Singleton class LinkItemSemanticEditPolicy {
@Inject extension Common;
@@ -33,6 +36,9 @@ import xpt.Common_qvto
@Inject BaseItemSemanticEditPolicy xptBaseItemSemanticEditPolicy;
@Inject linkCommands xptLinkCommands;
@Inject DeleteLinkCommand xptDeleteLinkCommand;
+ @Inject extension DeleteLinkCommand
+ @Inject extension UtilsItemSemanticEditPolicy
+
def className(GenLink it) '''«it.itemSemanticEditPolicyClassName»'''
@@ -74,10 +80,25 @@ import xpt.Common_qvto
'''
def dispatch getDestroySemanticCommand(TypeLinkModelFacet it, GenLink genLink) '''
- «generatedMemberComment()»
- protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- return getGEFWrapper(«xptDeleteLinkCommand.newDeleteLinkWithClassCommand(it, genLink, 'req')»);
- }
+ ««« Test to know which delete command should be used in the generated code : "Traditional Delete Command" or the Delete Service
+
+ «IF genLink.usingDeleteService»
+
+ «generatedMemberComment»
+ «getDestroyElementCommandByService(it)»
+ «ELSE»
+ «generatedMemberComment»
+ protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
+ org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null);
+ cmd.setTransactionNestingEnabled(true);
+ java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>();
+ todestroy.add(req.getElementToDestroy());
+ //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
+ cmd.add(new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy )));
+ return getGEFWrapper(cmd.reduce());
+ //return getGEFWrapper(«newDeleteLinkWithClassCommand(it,genLink, 'req')»);
+ }
+ «ENDIF»
'''
def additions(GenLink it) ''''''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend
index 84fa3819cea..dd56592e20e 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend
@@ -1,27 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2007-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257632] do not rely on EditPart presence for element deletion
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - [257632] do not rely on EditPart presence for element deletion
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
import com.google.inject.Inject
-import impl.diagram.commands.DeleteLinkCommand
+import com.google.inject.Singleton
import java.util.List
+import org.eclipse.papyrus.gmf.codegen.gmfgen.FeatureLinkModelFacet
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildNode
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
+import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeLinkModelFacet
+import utils.UtilsItemSemanticEditPolicy
import xpt.Common
+import xpt.diagram.editpolicies.childContainerCreateCommand
+import xpt.diagram.editpolicies.Utils_qvto
import xpt.editor.VisualIDRegistry
/**
@@ -29,15 +34,16 @@ import xpt.editor.VisualIDRegistry
* because *ItemSemanticEditPolicy responsible for dealing with semantic model
* elements and meaningless (should not be generated) for pure design nodes.
*/
-@com.google.inject.Singleton class NodeItemSemanticEditPolicy {
+@Singleton class NodeItemSemanticEditPolicy {
@Inject extension Common;
@Inject extension Utils_qvto;
+ @Inject extension UtilsItemSemanticEditPolicy
+
@Inject BaseItemSemanticEditPolicy xptBaseItemSemanticEditPolicy;
@Inject childContainerCreateCommand xptChildContainerCreateCommand;
@Inject linkCommands xptLinkCommands;
- @Inject DeleteLinkCommand xptDeleteLinkCommand;
@Inject VisualIDRegistry xptVisualIDRegistry;
def className(GenNode it) '''«it.itemSemanticEditPolicyClassName»'''
@@ -59,10 +65,19 @@ import xpt.editor.VisualIDRegistry
«xptChildContainerCreateCommand.childContainerCreateCommand(it.childNodes)»
+ ««« Papyrus REM :
+ ««« Test to know how the delete of this EditPart is done : we used the DeleteService or the "Traditional method"
+
+ «IF usingDeleteService»
+ «generatedMemberComment»
+ «getDestroyElementCommandByService(it)»
+ «ELSE»
«getDestroyElementCommand(it)»
«IF hasChildrenOrCompartments(it)»
«addDestroyChildNodesCommand(it)»
«ENDIF»
+ «ENDIF»
+
«xptLinkCommands.linkCommands(it)»
«additions(it)»
@@ -71,49 +86,58 @@ import xpt.editor.VisualIDRegistry
def getDestroyElementCommand(GenNode it) '''
«generatedMemberComment()»
- protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(false);
- «destroyEdges(it, 'view')»
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «nonNLS()»
- if (annotation == null) {
- // there are indirectly referenced children, need extra commands: «it.childNodes.union(compartments.map(c | c.childNodes).flatten).exists[GenChildNode gcn | !isDirectlyOwned(gcn, it)]»
+protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
+ org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null);
+ cmd.setTransactionNestingEnabled(true);
+ ««« «destroyEdges('view')»
+ org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut");«nonNLS»
+ if (annotation == null) {
+ // there are indirectly referenced children, need extra commands: «it.childNodes.union(compartments.map(c | c.childNodes).flatten).exists[GenChildNode gcn | !isDirectlyOwned(gcn, it)]»
«IF hasChildrenOrCompartments(it)»
addDestroyChildNodesCommand(cmd);
«ENDIF»
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- } else { «/*Here, we may play smart and don't generate else for non-toplevel nodes(which can't be shortcuts). Is it worth doing?*/»
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
+ addDestroyShortcutsCommand(cmd, view);
+ // delete host element
+ java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>();
+ todestroy.add(req.getElementToDestroy());
+ //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
+ cmd.add(new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy )));
+ } else {«««Here, we may play smart and don't generate else for non-toplevel nodes(which can't be shortcuts). Is it worth doing?
+ cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
}
+ return getGEFWrapper(cmd.reduce());
+}
'''
def addDestroyChildNodesCommand(GenNode it) '''
«generatedMemberComment()»
- private void addDestroyChildNodesCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd) {
+ protected void addDestroyChildNodesCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd) {
org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
for (java.util.Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) nit.next();
- switch («xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(node)) {
- «FOR cn : it.childNodes»
- «destroyChildNodes(cn, 'node', it)»
- «ENDFOR»
- «FOR compartment : it.compartments»
- «xptVisualIDRegistry.caseVisualID(compartment)»
- for (java.util.Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- org.eclipse.gmf.runtime.notation.Node cnode = (org.eclipse.gmf.runtime.notation.Node) cit.next();
- switch («xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(cnode)) {
- «FOR cn : compartment.childNodes»
- «destroyChildNodes(cn, 'cnode', it)»
- «ENDFOR»
+ String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(node);
+ if (vid != null) {
+ switch (vid) {
+ «FOR cn : it.childNodes»
+ «destroyChildNodes(cn, 'node', it)»
+ «ENDFOR»
+ «FOR compartment : it.compartments»
+ «xptVisualIDRegistry.caseVisualID(compartment)»
+ for (java.util.Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Node cnode = (org.eclipse.gmf.runtime.notation.Node) cit.next();
+ String cvid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(cnode);
+ if (cvid != null) {
+ switch (cvid) {
+ «FOR cn : compartment.childNodes»
+ «destroyChildNodes(cn, 'cnode', it)»
+ «ENDFOR»
+ }
+ }
}
+ break;
+ «ENDFOR»
}
- break;
- «ENDFOR»
}
}
}
@@ -133,40 +157,105 @@ import xpt.editor.VisualIDRegistry
* assumes 'cmd' to point to composite command
*/
def destroyEdges(GenNode it, String view) '''
- «/*
- * XXX: Though semantic editpolicy is supposed to create commands that operate with semantic elements only,
- * old code used to delegate child/link deletion to respective editparts, which in turn led to semantic commands
- * being combined with notational commands (BaseItemSemanticEditPolicy#addDeleteViewCommand()).
- * ---
- * Use DiagramUpdater.get[Incoming|Outgoing]View instead, to clean links that are not present on a diagram
- * (but don't forget to clean corresponding Edge, if any)
- */
- IF !genIncomingLinks.empty»
- for (java.util.Iterator<?> it = «view».getTargetEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- «FOR il : it.genIncomingLinks»
- if («xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(incomingLink) == «VisualIDRegistry::visualID(il)») {
- «xptDeleteLinkCommand.newRequest(il, 'r', 'incomingLink')»
- cmd.add(«xptDeleteLinkCommand.newInstance(il, 'r')»);
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- continue;
+
+««« XXX: Though semantic editpolicy is supposed to create commands that operate with semantic elements only,
+««« old code used to delegate child/link deletion to respective editparts, which in turn led to semantic commands
+««« being combined with notational commands (BaseItemSemanticEditPolicy#addDeleteViewCommand()).
+««« ---
+««« Use DiagramUpdater.get[Incoming|Outgoing]View instead, to clean links that are not present on a diagram
+««« (but don't forget to clean corresponding Edge, if any)
+
+
+«««// This part is commented for Papyrus
+«««// Some Papyrus diagrams with lots of elements are reaching the 65K Java limit for method size.
+«««// The following change is not supposed to modify the method behavior, just propose a slight more
+«««// compact code to avoid size limit.
+«««
+««««IF genIncomingLinks->notEmpty()-»
+««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getTargetEdges().iterator(); it.hasNext();) {
+««« org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+««««FOREACH genIncomingLinks AS il-»
+««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(incomingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il») {
+««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'incomingLink') FOR il-»
+««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR il»);
+««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
+««« continue;
+««« }
+««««ENDFOREACH-»
+««« }
+««««ENDIF-»
+««««IF genOutgoingLinks->notEmpty()-»
+««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getSourceEdges().iterator(); it.hasNext();) {
+««« org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+««««FOREACH genOutgoingLinks AS ol-»
+««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(outgoingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol») {
+««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'outgoingLink') FOR ol-»
+««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR ol»);
+««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
+««« continue;
+««« }
+««««ENDFOREACH-»
+««« }
+««««ENDIF-»
+
+
+«IF !genIncomingLinks.isEmpty()»
+ for (java.util.Iterator<?> it = «view».getTargetEdges().iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(incomingLink);
+ if (vid != null) {
+ switch(vid) {
+«IF !genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty»
+«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]»
+ case «VisualIDRegistry.visualID(il)»:
+«ENDFOR»
+ org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
+ cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq));
+ cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
+ break;
+«ENDIF»
+«IF !genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty»
+«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]»
+ case «VisualIDRegistry.visualID(il)»:
+«ENDFOR»
+ org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(incomingLink.getElement(), false);
+ cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq));
+ cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
+ break;
+«ENDIF»
}
- «ENDFOR»
}
- «ENDIF»
- «IF !genOutgoingLinks.empty»
- for (java.util.Iterator<?> it = «view».getSourceEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- «FOR ol : it.genOutgoingLinks»
- if («xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(outgoingLink) == «VisualIDRegistry::visualID(ol)») {
- «xptDeleteLinkCommand.newRequest(ol, 'r', 'outgoingLink')»
- cmd.add(«xptDeleteLinkCommand.newInstance(ol, 'r')»);
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
- continue;
+ }
+«ENDIF»
+
+«IF genOutgoingLinks.isEmpty()»
+ for (java.util.Iterator<?> it = «view».getSourceEdges().iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(outgoingLink);
+ if (vid != null) {
+ switch(vid) {
+«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty»
+«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]»
+ case «VisualIDRegistry.visualID(ol)»:
+«ENDFOR»
+ org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(outgoingLink.getSource().getElement(), null, outgoingLink.getTarget().getElement(), false);
+ cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq));
+ cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
+ break;
+«ENDIF»
+«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty»
+«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]»
+ case «VisualIDRegistry.visualID(ol)»:
+«ENDFOR»
+ org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(outgoingLink.getElement(), false);
+ cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq));
+ cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
+ break;
+«ENDIF»
}
- «ENDFOR»
}
- «ENDIF»
+ }
+«ENDIF»
'''
def additions(GenNode it) ''''''
@@ -177,5 +266,5 @@ import xpt.editor.VisualIDRegistry
result.addAll(listB);
return result;
}
-
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/OpenDiagram.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/OpenDiagram.xtend
index 5ffb37ab082..22d676e718a 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/OpenDiagram.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/OpenDiagram.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
@@ -173,7 +173,7 @@ import xpt.editor.DiagramEditorUtil
protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, java.lang.reflect.InvocationTargetException, InterruptedException {
try {
«ENDIF»
- for (java.util.Iterator it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {
+ for (java.util.Iterator<?> it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {
org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) {
nextResource.save(«xptDiagramEditorUtil.qualifiedClassName(subject.diagram)».getSaveOptions());
@@ -199,6 +199,7 @@ import xpt.editor.DiagramEditorUtil
}
'''
+
def openCommandClass_getDiagramDomainElement(OpenDiagramBehaviour it) '''
«generatedMemberComment»
protected org.eclipse.emf.ecore.EObject getDiagramDomainElement() {
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend
index 5e19ee62cd3..a0cd7abfe1c 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend
@@ -1,16 +1,17 @@
-/******************************************************************************
- * Copyright (c) 2013, 2020 Borland Software Corporation, CEA LIST, Artal and others
- *
+/*****************************************************************************
+ * Copyright (c) 2013, 2017 , 2021 Borland Software Corporation, CEA LIST, Artal and others
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Svyatoslav Kovalsky (Montages) - initial API and implementation
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Svyatoslav Kovalsky (Montages) - initial API and implementation
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
@@ -55,11 +56,11 @@ import xpt.Common
def TextNonResizableEditPolicy_extendsClause(GenDiagram it) '''extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx'''
- def TextNonResizableEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy'''
+ def TextNonResizableEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy'''
def TextNonResizableEditPolicy_createSelectionHandles(GenDiagram it) '''
«generatedMemberComment»
- protected java.util.List createSelectionHandles() {
+ protected java.util.List<?> createSelectionHandles() {
org.eclipse.gef.handles.MoveHandle moveHandle =
new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
moveHandle.setBorder(null);
@@ -67,6 +68,6 @@ import xpt.Common
return java.util.Collections.singletonList(moveHandle);
}
'''
-
def TextNonResizableEditPolicy_additions(GenDiagram it) ''''''
+
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend
index 4060af5d4f2..c73e19e6750 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend
@@ -1,16 +1,16 @@
-/******************************************************************************
- * Copyright (c) 2013, 2020 Borland Software Corporation, CEA LIST, Artal and others
- *
+/*****************************************************************************
+ * Copyright (c) 2013, 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Svyatoslav Kovalsky (Montages) - initial API and implementation
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Svyatoslav Kovalsky (Montages) - initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
@@ -26,7 +26,7 @@ import xpt.CodeStyle
@Inject extension Common;
- @Inject CodeStyle xptCodeStyle;
+ @Inject extension CodeStyle xptCodeStyle;
def className(GenDiagram it) '''«it.textSelectionEditPolicyClassName»'''
@@ -38,7 +38,7 @@ import xpt.CodeStyle
def TextSelectionEditPolicy_extendsClause(GenDiagram it) '''extends org.eclipse.gef.editpolicies.SelectionEditPolicy'''
- def TextSelectionEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy'''
+ def TextSelectionEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy'''
def TextSelectionEditPolicy_additions(GenDiagram it) ''''''
@@ -210,6 +210,7 @@ import xpt.CodeStyle
protected org.eclipse.draw2d.IFigure createFocusFeedbackFigure() {
return new org.eclipse.draw2d.Figure() {
+ «overrideC»
protected void paintFigure(org.eclipse.draw2d.Graphics graphics) {
graphics.drawFocus(getBounds().getResized(-1, -1));
}
@@ -264,6 +265,7 @@ import xpt.CodeStyle
private org.eclipse.draw2d.FigureListener getHostPositionListener() {
if (hostPositionListener == null) {
hostPositionListener = new org.eclipse.draw2d.FigureListener() {
+ «overrideI»
public void figureMoved(org.eclipse.draw2d.IFigure source) {
refreshFeedback();
}
@@ -272,4 +274,5 @@ import xpt.CodeStyle
return hostPositionListener;
}
'''
+
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend
index 39336745449..ae95a3737d6 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program && the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, && is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API && implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API && implementation
+ * Michael Golubev (Borland) - [243151] explicit source/target for links
+ * - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
@@ -129,4 +129,27 @@ import xpt.GenModelUtils_qvto
return childFacet.containmentMetaFeature.genClass.isSuperTypeOf(genNode.modelFacet.metaClass)
}
+
+
+def Boolean containsCreateStartLinkCommand(GenLinkEnd it){
+ for (l : getAllPotentialLinks(it)){
+ if(createStartLinkCommand(l, it)){
+ return true;
+ }
+ }
+
+ return false;
+}
+
+def Boolean containsCreateCompleteLinkCommand(GenLinkEnd it){
+ for (l : getAllPotentialLinks(it)){
+ if(createCompleteLinkCommand(l, it)){
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/childContainerCreateCommand.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/childContainerCreateCommand.xtend
index 26d00e0649d..7bf4733af26 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/childContainerCreateCommand.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/childContainerCreateCommand.xtend
@@ -1,40 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
+import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeModelFacet
import xpt.Common
-import xpt.providers.ElementTypes
import xpt.QualifiedClassNameProvider
+import xpt.providers.ElementTypes
+import metamodel.MetaModel
-@com.google.inject.Singleton class childContainerCreateCommand {
+@Singleton class childContainerCreateCommand {
@Inject extension Common;
@Inject extension QualifiedClassNameProvider;
@Inject ElementTypes xptElementTypes;
+ @Inject extension ElementTypes;
+ @Inject extension MetaModel;
def childContainerCreateCommand(Iterable<? extends GenNode> nodes) '''
- «IF !nodes.empty»
+ «IF ! nodes.empty»
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- «FOR n : nodes»
- «childNodeCreateCommand(n)»
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
+ if(requestElementType == null) {
+ return super.getCreateCommand(req);
+ }
+
+
+ «FOR n : nodes»
+ «IF !n.sansDomain»
+ «childNodeCreateCommand(n.modelFacet, n)»
+ «ENDIF»
«ENDFOR»
return super.getCreateCommand(req);
}
@@ -48,4 +62,21 @@ import xpt.QualifiedClassNameProvider
}
'''
+ def childNodeCreateCommand(TypeModelFacet it,GenNode node)'''
+ if («accessElementType(node)» == requestElementType) {
+ «IF it.eResource.allContents.filter(typeof (GenDiagram)).filter[genDiagram | genDiagram.usingElementTypeCreationCommand].size>0»
+ // adjust the containment feature
+ org.eclipse.emf.ecore.EReference containmentFeature = «MetaFeature(it.childMetaFeature)»;
+ req.setContainmentFeature(containmentFeature);
+ «ENDIF»
+
+ «IF it.eResource.allContents.filter(typeof (GenDiagram)).filter[genDiagram | genDiagram.usingElementTypeCreationCommand].size>0»
+ return getGEFWrapper(getSemanticCreationCommand(req));
+ «ELSE»
+ return getGEFWrapper(new «node.getCreateCommandQualifiedClassName()»(req, org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getDiagramFrom(getHost())));
+ «ENDIF»
+
+ }
+ '''
+
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/linkCommands.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/linkCommands.xtend
index 7fdff96e50a..4154d0c244d 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/linkCommands.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/linkCommands.xtend
@@ -1,30 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2007-2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Dmitry Stadnik (Borland) - creation logic was moved in commands
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Dmitry Stadnik (Borland) - creation logic was moved in commands
+ * Michael Golubev (Borland) - [243151] explicit source/target for links
+ * - #386838 - migrate to Xtend2
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.editpolicies
import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkEnd
import xpt.Common
-import xpt.providers.ElementTypes
import xpt.QualifiedClassNameProvider
+import xpt.diagram.commands.CreateLinkCommand
import xpt.diagram.commands.ReorientLinkCommand
import xpt.editor.VisualIDRegistry
+import xpt.providers.ElementTypes
/**
* Start start of link creation.
@@ -47,17 +51,18 @@ import xpt.editor.VisualIDRegistry
* because RefLinks don't have underlying semantic identity
*
*/
-@com.google.inject.Singleton class linkCommands {
- @Inject extension Utils_qvto;
+@Singleton class linkCommands {
+ @Inject extension Utils_qvto;
+
@Inject extension Common;
@Inject extension QualifiedClassNameProvider;
@Inject ElementTypes xptElementTypes;
@Inject ReorientLinkCommand xptReorientLinkCommand;
@Inject VisualIDRegistry xptVisualIDRegistry;
+ @Inject CreateLinkCommand xptCreateLinkCommand;
+
- def aaa() '''aaa'''
-
def linkCommands(GenLinkEnd it) '''
«IF getAllPotentialLinks(it).size > 0»
«createLinkCommands(it)»
@@ -72,6 +77,8 @@ import xpt.editor.VisualIDRegistry
def createLinkCommands(GenLinkEnd it) '''
+ «IF it.eResource.allContents.filter(typeof (GenDiagram)).filter[genDiagram | genDiagram.usingElementTypeCreationCommand].size<1»
+
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(
org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
@@ -79,10 +86,17 @@ import xpt.editor.VisualIDRegistry
getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
+ «ENDIF»
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getStartCreateRelationshipCommand(
org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
+ if(requestElementType == null) {
+ return null;
+ }
+ org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType;
+
«FOR l : getAllPotentialLinks(it)»
«startLinkCommands(l, it)»
«ENDFOR»
@@ -92,6 +106,12 @@ import xpt.editor.VisualIDRegistry
«generatedMemberComment()»
protected org.eclipse.gef.commands.Command getCompleteCreateRelationshipCommand(
org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
+ if(requestElementType == null) {
+ return null;
+ }
+ org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType;
+
«FOR l : getAllPotentialLinks(it)»
«completeLinkCommands(l, it)»
«ENDFOR»
@@ -100,9 +120,10 @@ import xpt.editor.VisualIDRegistry
'''
def startLinkCommands(GenLink it, GenLinkEnd linkEnd) '''
- if («xptElementTypes.accessElementType(it)» == req.getElementType()) {
- «IF createStartLinkCommand(it, linkEnd)»
- return getGEFWrapper(new «getCreateCommandQualifiedClassName(it)»(req,
+ if («xptElementTypes.accessElementType(it)» == baseElementType) {
+ «IF createStartLinkCommand(it, linkEnd)»
+
+ return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req,
«IF createStartIncomingLinkCommand(it, linkEnd)»
req.getTarget(), req.getSource()
«ELSE»
@@ -112,13 +133,13 @@ import xpt.editor.VisualIDRegistry
«ELSE»
return null;
«ENDIF»
- }
'''
def completeLinkCommands(GenLink it, GenLinkEnd linkEnd) '''
- if («xptElementTypes.accessElementType(it)» == req.getElementType()) {
+ if («xptElementTypes.accessElementType(it)» == baseElementType) {
«IF createCompleteLinkCommand(it, linkEnd)»
- return getGEFWrapper(new «getCreateCommandQualifiedClassName(it)»(req,
+
+ return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req,
«IF createCompleteOutgoingLinkCommand(it, linkEnd)»
req.getTarget(), req.getSource()
«ELSE»
@@ -128,25 +149,29 @@ import xpt.editor.VisualIDRegistry
«ELSE»
return null;
«ENDIF»
- }
'''
def reorientTypeLinkCommands(GenLinkEnd it) '''
-
«generatedMemberComment(
- 'Returns command to reorient EClass based link. New link target or source\n' +
- 'should be the domain model element associated with this node.\n'
+ 'Returns command to reorient EClass based link. New link target or source\n' + 'should be the domain model element associated with this node.\n'
- protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- «FOR l : getReroutableTypeLinks(it)»
- «reorientLinkCommand(l)»
- «ENDFOR»
- }
- return super.getReorientRelationshipCommand(req);
- }
- '''
+ protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
+ String vid = getVisualID(req);
+ if (vid != null) {
+ switch (vid) {
+ «FOR link : getReroutableTypeLinks(it)»
+ «reorientLinkCommandWithService(link) »
+ «ENDFOR»
+ «callReorientCommand(it)»
+ «FOR link : getReroutableTypeLinks(it)»
+ «reorientLinkCommandWithoutService(link) »
+ «ENDFOR»
+ }
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+ '''
def reorientRefLinkCommands(GenLinkEnd it) '''
@@ -169,5 +194,39 @@ import xpt.editor.VisualIDRegistry
«xptVisualIDRegistry.caseVisualID(it)»
return getGEFWrapper(new «xptReorientLinkCommand.qualifiedClassName(it)»(req));
'''
+
+ //This function writes only : "case myLinkEditPart.VISUAL_ID:"
+ //for the link which uses the ReorientCommand provided by the EditService
+ def reorientLinkCommandWithService(GenLink it) '''
+ «IF usingReorientService»
+ «xptVisualIDRegistry.caseVisualID(it)»
+ «ENDIF»
+ '''
+
+ // This function writes the code to call the ReorientCommand provided by the ReorientService
+ def callReorientCommand(GenLinkEnd it) '''
+ «var views = getReroutableTypeLinks(it)»
+ «IF views !== null && !views.empty»
+ «IF !views.filter[view| view.usingReorientService].empty»
+ org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getRelationship());
+ if(provider == null) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ }
+ // Retrieve re-orient command from the Element Edit service
+ org.eclipse.gmf.runtime.common.core.command.ICommand reorientCommand = provider.getEditCommand(req);
+ if(reorientCommand == null) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ }
+ return getGEFWrapper(reorientCommand.reduce());
+ «ENDIF»
+ «ENDIF»
+ '''
+
+ // This function writes the code for the Links which uses their own ReorientCommand (the initial code)
+ def reorientLinkCommandWithoutService(GenLink it) '''
+ «IF !usingReorientService»
+ «reorientLinkCommand(it)»
+ «ENDIF»
+ '''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/preferences/extensions.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/preferences/extensions.xtend
index 453c32116c5..99c89a04314 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/preferences/extensions.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/preferences/extensions.xtend
@@ -1,17 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Thibault Landre (Atos Origin) - initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.preferences
@@ -26,11 +27,14 @@ import impl.preferences.CustomPage
import impl.preferences.StandardPage
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCustomPreferencePage
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenStandardPreferencePage
+import utils.PrefsConstant_qvto
+import org.eclipse.papyrus.gmf.codegen.gmfgen.StandardPreferencePages
@com.google.inject.Singleton class extensions {
@Inject extension Common;
@Inject extension Common_qvto;
@Inject extension Utils_qvto;
+ @Inject extension PrefsConstant_qvto;
@Inject PreferenceInitializer xptPreferenceInitializer;
@Inject CustomPage xptCustomPage;
@@ -43,13 +47,15 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenStandardPreferencePage
«tripleSpace(2)»<initializer class="«xptPreferenceInitializer.qualifiedClassName(it)»"/>
«tripleSpace(1)»</extension>
- «IF it.preferencePages.notEmpty»
- «tripleSpace(1)»<extension point="org.eclipse.ui.preferencePages" id="prefpages">
- «tripleSpace(2)»«xmlGeneratedTag»
- «FOR pref : allPreferencePages(it)»
- «preferencePage(pref)»
- «ENDFOR»
- «tripleSpace(1)»</extension>
+ «IF ! it.preferencePages.empty»
+ «tripleSpace(1)»<extension point="org.eclipse.ui.preferencePages" id="prefpages">
+ «tripleSpace(2)»«xmlGeneratedTag»
+ «FOR pref : allPreferencePages(it)»
+ «IF pref instanceof GenStandardPreferencePage»
+ «papyrusPreferencePage(pref as GenStandardPreferencePage)»
+ «ENDIF»
+ «ENDFOR»
+ «tripleSpace(1)»</extension>
«ENDIF»
'''
@@ -76,4 +82,24 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenStandardPreferencePage
def dispatch getQualifiedPageName(GenPreferencePage it) ''''''
def dispatch getQualifiedPageName(GenCustomPreferencePage it) '''«xptCustomPage.qualifiedClassName(it)»'''
def dispatch getQualifiedPageName(GenStandardPreferencePage it) '''«xptStandardPage.qualifiedClassName(it)»'''
+
+ def papyrusPreferencePage(GenStandardPreferencePage it) '''
+ «IF StandardPreferencePages.GENERAL_LITERAL == kind»
+ <page
+ id="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»"
+ name="«getDiagram().editorGen.modelID» Diagram"
+ category="«getDiagramPreferencePageCategory()»"
+ class="«getQualifiedClassName()»">
+ </page>
+ «ELSEIF StandardPreferencePages.PRINTING_LITERAL == kind ||
+ StandardPreferencePages.RULERS_AND_GRID_LITERAL == kind»
+ <page
+ id="«getQualifiedClassName()»"
+ name="%prefpage.«ID»"
+ category="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»"
+ class="«getQualifiedClassName()»">
+ </page>
+ «ENDIF»
+ '''
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/DiagramUpdater.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/DiagramUpdater.xtend
index ec1f253e108..5411e2b36b0 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/DiagramUpdater.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/DiagramUpdater.xtend
@@ -1,18 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2014, 2021 Borland Software Corporation, CEA, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Borland) - [243151] explicit source/target for links
+ * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2
+ * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.updater
@@ -22,6 +23,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.FeatureLinkModelFacet
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenContainerBase
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagramUpdater
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkEnd
@@ -35,6 +37,10 @@ import xpt.Common_qvto
import xpt.GenModelUtils_qvto
import xpt.editor.VisualIDRegistry
import xpt.providers.ElementTypes
+import xpt.diagram.updater.UpdaterLinkType
+import xpt.diagram.updater.Utils_qvto
+import java.util.Set
+import org.eclipse.emf.codegen.ecore.genmodel.GenFeature
@com.google.inject.Singleton class DiagramUpdater {
@Inject extension Common;
@@ -45,14 +51,14 @@ import xpt.providers.ElementTypes
@Inject VisualIDRegistry xptVisualIDRegistry;
@Inject MetaModel xptMetaModel;
@Inject ElementTypes xptElementTypes;
- @Inject CodeStyle xptCodeStyle;
@Inject NodeDescriptor nodeDescriptor;
@Inject LinkDescriptor linkDescriptor;
-
-
- @MetaDef def getSemanticChildrenMethodName(GenContainerBase it) '''get«getUniqueIdentifier()»SemanticChildren'''
- @MetaDef def getSemanticChildrenMethodCall(GenContainerBase it) '''«qualifiedClassName(getDiagram().editorGen.diagramUpdater)».«getSemanticChildrenMethodName(it)»'''
+ @MetaDef def getSemanticChildrenMethodName(GenContainerBase it) '''get«stringUniqueIdentifier()»_SemanticChildren'''
+
+ @MetaDef def getSemanticChildrenMethodCall(GenContainerBase it) '''«diagramUpdaterInstanceToUse(it.diagramUpdater)».«getSemanticChildrenMethodName(
+ it)»'''
+
@MetaDef def getContainedLinksMethodCall(GenCommonBase it) '''«doGetSomeLinksMethodCall(it, UpdaterLinkType::CONTAINED)»'''
@@ -60,9 +66,10 @@ import xpt.providers.ElementTypes
@MetaDef def getOutgoingLinksMethodCall(GenCommonBase it) '''«doGetSomeLinksMethodCall(it, UpdaterLinkType::OUTGOING)»'''
- @MetaDef protected def doGetSomeLinksMethodCall(GenCommonBase it, UpdaterLinkType linkType) '''«qualifiedClassName(it.getDiagram().diagramUpdater)».«linkGetterName(linkType)»'''
+ @MetaDef protected def doGetSomeLinksMethodCall(GenCommonBase it, UpdaterLinkType linkType) '''«diagramUpdaterInstanceToUse(
+ it.getDiagram().diagramUpdater)».«linkGetterName(linkType)»'''
- @MetaDef protected def linkGetterName(GenCommonBase it, UpdaterLinkType linkType) '''get«it.uniqueIdentifier»«linkType.linkMethodSuffix»Links'''
+ @MetaDef protected def linkGetterName(GenCommonBase it, UpdaterLinkType linkType) '''get«stringUniqueIdentifier()»_«linkType.linkMethodSuffix»Links'''
@MetaDef def runtimeTypedInstanceName(GenDiagramUpdater it) '''TYPED_INSTANCE'''
@@ -77,48 +84,50 @@ import xpt.providers.ElementTypes
def fullPath(GenDiagramUpdater it) '''«qualifiedClassName(it)»'''
def DiagramUpdater(GenDiagramUpdater it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» {
- «isShortcutOrphaned(it)»
- «var semanticContainers = it.editorGen.diagram.allContainers.filter[container | hasSemanticChildren(container)]»
- «getGenericSemanticChildrenOfView(it, semanticContainers)»
- «FOR next : semanticContainers»
- «getSemanticChildrenOfView(next)»
- «ENDFOR»
-
- «getPhantomNodesIterator(it)»
-
- «getGenericConnectedLinks(it, getAllSemanticElements(editorGen.diagram), UpdaterLinkType::CONTAINED)»
-
- «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::INCOMING)»
-
- «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::OUTGOING)»
- «FOR e : getAllSemanticElements(editorGen.diagram)»
+ «copyright(editorGen)»
+ package «packageName(it)»;
+
+ «generatedClassComment»
+ public class «className(it)» implements org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater {
+ «classSingleton(it)»
+ «_constructor(it)»
+ «isShortcutOrphaned(it)»
+ «var semanticContainers = it.editorGen.diagram.allContainers.filter[container|hasSemanticChildren(container)]»
+ «getGenericSemanticChildrenOfView(it, semanticContainers)»
+ «FOR next : semanticContainers»
+ «getSemanticChildrenOfView(next)»
+ «ENDFOR»
+
+ «getPhantomNodesIterator(it)»
+
+ «getGenericConnectedLinks(it, getAllSemanticElements(editorGen.diagram), UpdaterLinkType::CONTAINED)»
+
+ «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::INCOMING)»
+
+ «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::OUTGOING)»
+ «FOR e : getAllSemanticElements(editorGen.diagram)»
«getContainedLinks(e)»
- «ENDFOR»
- «FOR e : getAllSemanticDiagramElements(editorGen.diagram)»
+ «ENDFOR»
+ «FOR e : getAllSemanticDiagramElements(editorGen.diagram)»
«getIncomingLinks(e)»
- «ENDFOR»
- «FOR e : getAllSemanticDiagramElements(editorGen.diagram)»
+ «ENDFOR»
+ «FOR e : getAllSemanticDiagramElements(editorGen.diagram)»
«getOutgoingLinks(e)»
- «ENDFOR»
- «FOR link : getAllContainedLinks(editorGen.diagram)»
+ «ENDFOR»
+ «FOR link : getAllContainedLinks(editorGen.diagram)»
«getContainedLinksByTypeMethod(link)»
- «ENDFOR»
- «FOR link : getAllIncomingLinks(editorGen.diagram)»
+ «ENDFOR»
+ «FOR link : getAllIncomingLinks(editorGen.diagram)»
«getIncomingLinksByTypeMethod(link)»
- «ENDFOR»
- «FOR link : getAllOutgoingLinks(editorGen.diagram)»
+ «ENDFOR»
+ «FOR link : getAllOutgoingLinks(editorGen.diagram)»
«getOutgoingLinksByTypeMethod(link)»
- «ENDFOR»
-
- «runtimeTypedInstance(it)»
-
- «additions(it)»
- }
+ «ENDFOR»
+
+ «runtimeTypedInstance(it)»
+
+ «additions(it)»
+ }
'''
/**
@@ -149,18 +158,22 @@ import xpt.providers.ElementTypes
protected def typeOfCrossReferenceMap() '''java.util.Map<org.eclipse.emf.ecore.EObject, java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature.Setting>>'''
def getGenericSemanticChildrenOfView(GenDiagramUpdater it, Iterable<GenContainerBase> semanticContainers) '''
-
- «generatedMemberComment»
- public static «listOfNodeDescriptors» getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) {
- «IF semanticContainers.notEmpty»
- switch («xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(view)) {
- «FOR next : semanticContainers»
- «getSemanticChildrenCase(next)»
- «ENDFOR»
+
+ «generatedMemberComment»
+ ««« remove static modifier
+ public «listOfNodeDescriptors» getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) {
+ «IF semanticContainers.notEmpty»
+ String vid = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(view);
+ if (vid != null) {
+ switch (vid) {
+ «FOR next : semanticContainers»
+ «getSemanticChildrenCase(next)»
+ «ENDFOR»
+ }
+ }
+ «ENDIF»
+ return «newEmptyList()»;
}
- «ENDIF»
- return «newEmptyList()»;
- }
'''
def getSemanticChildrenCase(GenContainerBase it) '''
@@ -169,46 +182,55 @@ import xpt.providers.ElementTypes
'''
def getSemanticChildrenOfView(GenContainerBase it) '''
-
- «generatedMemberComment»
- public static «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
- «IF getSemanticChildrenChildFeatures(it).notEmpty || it.getPhantomNodes().notEmpty»
- «defineModelElement(it)»
- «newLinkedListOfNodeDescriptors(it.diagramUpdater, 'result')»();
- «/* childMetaFeature can be null here! */
- FOR childMetaFeature : getSemanticChildrenChildFeatures(it)»
- «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 childMetaFeature.listType»
- for (java.util.Iterator<?> it = «xptMetaModel.getFeatureValue(childMetaFeature, 'modelElement', it.getModelElementType())».iterator(); it.hasNext();) {
- «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'it.next()', true)»
- «ELSE»
- { «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'modelElement', it.getModelElementType(), childMetaFeature)»
- «ENDIF»
- int visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it.diagram)»(view, «xptMetaModel.DowncastToEObject(childMetaFeature.typeGenClass, 'childElement')»);
- «FOR next : getSemanticChildren(it, childMetaFeature)»
- «checkChildElementVisualID(next, null != childMetaFeature && childMetaFeature.listType)»
- «ENDFOR»
+ «««remove static modifier
+ «IF specificDiagramUpdaterClassName !== null»
+ «generatedMemberComment»
+ public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
+ «getICustomDiagramUpdater(it)» customUpdater = new «specificDiagramUpdaterClassName»();
+ return customUpdater.getSemanticChildren(view);
}
- «ENDFOR»
- «IF it.getPhantomNodes.notEmpty»
- org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
- for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = getPhantomNodesIterator(resource); it.hasNext();) {
- org.eclipse.emf.ecore.EObject childElement = it.next();
- if (childElement == modelElement) {
- continue;
- }
- «FOR phantom : it.phantomNodes»
- «addNextIfPhantom(phantom)»
+ «ELSE»
+ «generatedMemberComment»
+ public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
+ «IF getSemanticChildrenChildFeatures(it).notEmpty || it.getPhantomNodes().notEmpty»
+ «defineModelElement(it)»
+ «newLinkedListOfNodeDescriptors(it.diagramUpdater, 'result')»();
+ «/* childMetaFeature can be null here! */FOR childMetaFeature : getSemanticChildrenChildFeatures(it)»
+ «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 childMetaFeature.listType»
+ for (java.util.Iterator<?> it = «xptMetaModel.getFeatureValue(childMetaFeature, 'modelElement', it.getModelElementType())».iterator(); it.hasNext();) {
+ «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'it.next()', true)»
+ «ELSE»
+ { «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'modelElement',
+ it.getModelElementType(), childMetaFeature)»
+ «ENDIF»
+ String visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it.diagram)»(view, «xptMetaModel.
+ DowncastToEObject(childMetaFeature.typeGenClass, 'childElement')»);
+ «FOR next : getSemanticChildren(it, childMetaFeature)»
+ «checkChildElementVisualID(next, null != childMetaFeature && childMetaFeature.listType)»
+ «ENDFOR»
+ }
«ENDFOR»
- }
- «ENDIF»
- return result;
- «ELSE»
- return «newEmptyList()»;
- «ENDIF»
- }
+ «IF it.getPhantomNodes.notEmpty»
+ org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
+ for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = getPhantomNodesIterator(resource); it.hasNext();) {
+ org.eclipse.emf.ecore.EObject childElement = it.next();
+ if (childElement == modelElement) {
+ continue;
+ }
+ «FOR phantom : it.phantomNodes»
+ «addNextIfPhantom(phantom)»
+ «ENDFOR»
+ }
+ «ENDIF»
+ return result;
+ «ELSE»
+ return «newEmptyList()»;
+ «ENDIF»
+ }
+ «ENDIF»
'''
def dispatch defineModelElement(GenContainerBase it) '''
@@ -235,7 +257,7 @@ import xpt.providers.ElementTypes
* Need to check with case when it.modelFacet.childMetaFeature == null
*/
def checkChildElementVisualID(GenNode it, Boolean inLoop) '''
- if (visualID == «VisualIDRegistry::visualID(it)») {
+ if («VisualIDRegistry::visualID(it)».equals(visualID)) {
result.add(new «nodeDescriptor.qualifiedClassName(it.getDiagram().diagramUpdater)»(«IF null != modelFacet.childMetaFeature»«xptMetaModel.DowncastToEObject(modelFacet.childMetaFeature.typeGenClass, 'childElement')», «ENDIF»visualID));
«IF inLoop»
continue;
@@ -243,6 +265,7 @@ import xpt.providers.ElementTypes
}
'''
+
def addNextIfPhantom(GenNode it) '''
if («xptVisualIDRegistry.getNodeVisualIDMethodCall(it.diagram)»(view, childElement) == «VisualIDRegistry::visualID(it)») {
result.add(new «nodeDescriptor.qualifiedClassName(it.getDiagram().diagramUpdater)»(childElement, «VisualIDRegistry::visualID(it)»));
@@ -262,17 +285,22 @@ import xpt.providers.ElementTypes
'''
def getGenericConnectedLinks(GenDiagramUpdater it, Iterable<? extends GenCommonBase> linkContainers, UpdaterLinkType linkType) '''
- «generatedMemberComment»
- public static «listOfLinkDescriptors» get«linkType.linkMethodSuffix»Links(org.eclipse.gmf.runtime.notation.View view) {
- «IF linkContainers.notEmpty»
- switch («xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view)) {
- «FOR next : linkContainers»
- «getContainedLinksCase(next, linkType)»
- «ENDFOR»
+
+ «generatedMemberComment»
+ ««« remove static modifier
+ public «listOfLinkDescriptors» get«linkType.linkMethodSuffix»Links(org.eclipse.gmf.runtime.notation.View view) {
+ «IF linkContainers.notEmpty»
+ String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view);
+ if (vid != null) {
+ switch (vid) {
+ «FOR next : linkContainers»
+ «getContainedLinksCase(next, linkType)»
+ «ENDFOR»
+ }
+ }
+ «ENDIF»
+ return «newEmptyList»;
}
- «ENDIF»
- return «newEmptyList»;
- }
'''
def getContainedLinksCase(GenCommonBase it, UpdaterLinkType linkType) '''
@@ -297,36 +325,38 @@ import xpt.providers.ElementTypes
'''
def getConnectedLinks(GenCommonBase it, Iterable<GenLink> genLinks, UpdaterLinkType linkType, boolean needCrossReferencer) '''
-
- «generatedMemberComment»
- public static «listOfLinkDescriptors(it)» «linkGetterName(it, linkType)»(org.eclipse.gmf.runtime.notation.View view) {
- «IF genLinks.notEmpty»
- «xptMetaModel.DeclareAndAssign(it.metaClass, 'modelElement', 'view.getElement()')»
- «IF needCrossReferencer»
- «typeOfCrossReferenceMap» crossReferences = org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+
+ «generatedMemberComment»
+ «««remove static modifier
+ public «listOfLinkDescriptors(it)» «linkGetterName(it, linkType)»(org.eclipse.gmf.runtime.notation.View view) {
+ «IF genLinks.notEmpty»
+ «xptMetaModel.DeclareAndAssign(it.metaClass, 'modelElement', 'view.getElement()')»
+ «IF needCrossReferencer»
+ «typeOfCrossReferenceAdapter» crossReferencer = «typeOfCrossReferenceAdapter».getCrossReferenceAdapter(view.eResource().getResourceSet());
+ «ENDIF»
+ «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»();
+ «FOR link : genLinks»
+ «colectConnectedLinks(link, linkType, needCrossReferencer, isExternalInterface(it.metaClass))»
+ «ENDFOR»
+ return result;
+ «ELSE»
+ return «newEmptyList()»;
«ENDIF»
- «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»();
- «FOR link : genLinks»
- «colectConnectedLinks(link, linkType, needCrossReferencer, isExternalInterface(it.metaClass))»
- «ENDFOR»
- return result;
- «ELSE»
- return «newEmptyList()»;
- «ENDIF»
- }
+ }
'''
def colectConnectedLinks(GenLink it, UpdaterLinkType linkType, boolean needCrossReferencer, boolean isExternalInterface) '''
- «IF it.modelFacet != null»
- «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»
- if («xptMetaModel.IsInstance(it.modelFacet.getLinkEndType(linkType), 'modelElement')») {
- «ENDIF»
+ «IF it.modelFacet != null»
+ «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»
+ if («xptMetaModel.IsInstance(it.modelFacet.getLinkEndType(linkType), 'modelElement')») {
+ «ENDIF»
result.addAll(«chooseConnectedLinksByTypeMethodName(it.modelFacet, linkType, it)»(« //
- IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»«xptMetaModel.CastEObject(it.modelFacet.getLinkEndType(linkType), 'modelElement')»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferences«ENDIF»));
- «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»
- }
+ IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»«xptMetaModel.
+ CastEObject(it.modelFacet.getLinkEndType(linkType), 'modelElement')»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferencer«ENDIF»));
+ «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»
+ }
+ «ENDIF»
«ENDIF»
- «ENDIF»
'''
def dispatch chooseConnectedLinksByTypeMethodName(LinkModelFacet it, UpdaterLinkType type, GenLink genLink) '''«incorrectLinkModelFacet(it)»'''
@@ -355,11 +385,11 @@ import xpt.providers.ElementTypes
def getContainedLinksByTypeMethod(GenLink it) '''«getContainedLinksByTypeMethod(it.modelFacet, it)»'''
- def getConnectedLinksByTypeMethodName(GenLink it, UpdaterLinkType linkType) '''get«linkType.linkMethodSuffix»«getConnectedLinksByTypeMethodFragment(modelFacet)»_«visualID»'''
+ def getConnectedLinksByTypeMethodName(GenLink it, UpdaterLinkType linkType) '''get«linkType.linkMethodSuffix»«getConnectedLinksByTypeMethodFragment(modelFacet)»_«stringVisualID»'''
- def dispatch getConnectedLinksByTypeMethodFragment(TypeLinkModelFacet it) '''TypeModelFacetLinks_«metaClass.ecoreClass.name»'''
+ def dispatch getConnectedLinksByTypeMethodFragment(TypeLinkModelFacet it) '''TypeModelFacetLinks'''
- def dispatch getConnectedLinksByTypeMethodFragment(FeatureLinkModelFacet it) '''FeatureModelFacetLinks_«metaFeature.genClass.ecoreClass.name»_«metaFeature.ecoreFeature.name.toFirstUpper()»'''
+ def dispatch getConnectedLinksByTypeMethodFragment(FeatureLinkModelFacet it) '''FeatureModelFacetLinks'''
def dispatch getConnectedLinksByTypeMethodFragment(LinkModelFacet it) '''«incorrectLinkModelFacet(it)»'''
@@ -368,11 +398,13 @@ import xpt.providers.ElementTypes
def dispatch getContainedLinksByTypeMethod(FeatureLinkModelFacet it, GenLink genLink) ''''''
def dispatch getContainedLinksByTypeMethod(TypeLinkModelFacet it, GenLink genLink) '''
-
- «generatedMemberComment»
- private static java.util.Collection<«linkDescriptor.qualifiedClassName(genLink.diagramUpdater)»> «getConnectedLinksByTypeMethodName(genLink, UpdaterLinkType::CONTAINED)»(«xptMetaModel.QualifiedClassName(childMetaFeature.genClass)» container) {
- «getContainedLinksByTypeMethodBody(it, genLink, false)»
- }
+
+ «generatedMemberComment»
+ ««« remove static modifier + private->protected
+ protected java.util.Collection<«linkDescriptor.qualifiedClassName(genLink.diagramUpdater)»> «getConnectedLinksByTypeMethodName(
+ genLink, UpdaterLinkType::CONTAINED)»(«xptMetaModel.QualifiedClassName(childMetaFeature.genClass)» container) {
+ «getContainedLinksByTypeMethodBody(it, genLink, false)»
+ }
'''
def getContainedLinksByTypeMethodBody(TypeLinkModelFacet it, GenLink genLink, boolean sourceVarDefined) '''
@@ -422,21 +454,21 @@ import xpt.providers.ElementTypes
'''
def checkLinkVisualID(TypeLinkModelFacet it, GenLink genLink, boolean inLoop) '''
- if («VisualIDRegistry::visualID(genLink)» != «xptVisualIDRegistry.getLinkWithClassVisualIDMethodCall(genLink.diagram)»(«xptMetaModel.DowncastToEObject(metaClass, 'link')»)) {
+ if (!«VisualIDRegistry::visualID(genLink)».equals(«xptVisualIDRegistry.getLinkWithClassVisualIDMethodCall(genLink.diagram)»(«xptMetaModel.DowncastToEObject(metaClass, 'link')»))) {
«stopLinkProcessing(inLoop)»
}
'''
def defineLinkSource(TypeLinkModelFacet it, boolean inLoop) '''
«IF sourceMetaFeature.listType»
- java.util.List sources = «xptMetaModel.getFeatureValue(sourceMetaFeature, 'link', metaClass)»;
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if («xptMetaModel.NotInstance(it.sourceType, 'theSource')») {
- «stopLinkProcessing(inLoop)»
- }
- «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'theSource', true)»
+ java.util.List<?> sources = «xptMetaModel.getFeatureValue(sourceMetaFeature, 'link', metaClass)»;
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if («xptMetaModel.NotInstance(it.sourceType, 'theSource')») {
+ «stopLinkProcessing(inLoop)»
+ }
+ «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'theSource', true)»
«ELSE»
- «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'link', metaClass, sourceMetaFeature)»
+ «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'link', metaClass, sourceMetaFeature)»
«ENDIF»
'''
@@ -448,17 +480,18 @@ import xpt.providers.ElementTypes
def defineLinkDestination(TypeLinkModelFacet it, Boolean inLoop) '''
«IF targetMetaFeature.listType»
- java.util.List targets = «xptMetaModel.getFeatureValue(it.targetMetaFeature, 'link', metaClass)»;
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if («xptMetaModel.NotInstance(it.targetType, 'theTarget')») {
- «stopLinkProcessing(inLoop)»
- }
- «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'theTarget', true)»
+ java.util.List<?> targets = «xptMetaModel.getFeatureValue(it.targetMetaFeature, 'link', metaClass)»;
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if («xptMetaModel.NotInstance(it.targetType, 'theTarget')») {
+ «stopLinkProcessing(inLoop)»
+ }
+ «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'theTarget', true)»
«ELSE»
- «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'link', metaClass, targetMetaFeature)»
+ «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'link', metaClass, targetMetaFeature)»
«ENDIF»
'''
+
def stopLinkProcessing(boolean inLoop) '''
«IF inLoop»
continue;
@@ -468,16 +501,17 @@ import xpt.providers.ElementTypes
'''
def getIncomingLinksByTypeMethod(GenLink it) '''
-
- «generatedMemberComment»
- private static java.util.Collection<«linkDescriptor.qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(UpdaterLinkType::INCOMING)»(«xptMetaModel.QualifiedClassName(it.modelFacet.targetType)» target, «typeOfCrossReferenceMap» crossReferences) {
- «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»();
- java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature.Setting> settings = crossReferences.get(target);
- for (org.eclipse.emf.ecore.EStructuralFeature.Setting setting : settings) {
- «getIncomingLinksByTypeMethodBody(it.modelFacet, it)»
+ «generatedMemberComment»
+ «««remove static modifier + private->protected
+ protected java.util.Collection<«linkDescriptor.qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(
+ UpdaterLinkType::INCOMING)»(«xptMetaModel.QualifiedClassName(it.modelFacet.targetType)» target, «typeOfCrossReferenceAdapter» crossReferencer) {
+ «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»();
+ java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
+ for (org.eclipse.emf.ecore.EStructuralFeature.Setting setting : settings) {
+ «getIncomingLinksByTypeMethodBody(it.modelFacet, it)»
+ }
+ return result;
}
- return result;
- }
'''
def dispatch getIncomingLinksByTypeMethodBody(TypeLinkModelFacet it, GenLink genLink) '''
@@ -519,8 +553,9 @@ import xpt.providers.ElementTypes
«getOutgoingLinksByTypeMethod(it.modelFacet, it)»
'''
- def getOutgoingLinksByTypeMethodSignature(GenLink it) //
- '''private static java.util.Collection<«linkDescriptor.qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(UpdaterLinkType::OUTGOING)»(«xptMetaModel.QualifiedClassName(it.modelFacet.sourceType)» source)'''
+ def getOutgoingLinksByTypeMethodSignature(GenLink it) '''protected java.util.Collection<«linkDescriptor.
+ qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(UpdaterLinkType::OUTGOING)»(«xptMetaModel.
+ QualifiedClassName(it.modelFacet.sourceType)» source)'''
def dispatch getOutgoingLinksByTypeMethod(FeatureLinkModelFacet it, GenLink genLink) '''
«generatedMemberComment»
@@ -572,33 +607,40 @@ import xpt.providers.ElementTypes
def incorrectLinkModelFacet(LinkModelFacet it) '''«ERROR('Incorrect LinkModelFacet: ' + it)»'''
def runtimeTypedInstance(GenDiagramUpdater it) '''
- «generatedMemberComment»
- public static final org.eclipse.gmf.tooling.runtime.update.DiagramUpdater «runtimeTypedInstanceName(it)» = new org.eclipse.gmf.tooling.runtime.update.DiagramUpdater() {
- «generatedMemberComment»
- «xptCodeStyle.overrideI(it.editorGen.diagram)»
- public java.util.List<«nodeDescriptor.qualifiedClassName(it)»> getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) {
- return «className(it)».getSemanticChildren(view);
- }
-
- «generatedMemberComment»
- «xptCodeStyle.overrideI(it.editorGen.diagram)»
- public java.util.List<«linkDescriptor.qualifiedClassName(it)»> getContainedLinks(org.eclipse.gmf.runtime.notation.View view) {
- return «className(it)».getContainedLinks(view);
- }
-
- «generatedMemberComment»
- «xptCodeStyle.overrideI(it.editorGen.diagram)»
- public java.util.List<«linkDescriptor.qualifiedClassName(it)»> getIncomingLinks(org.eclipse.gmf.runtime.notation.View view) {
- return «className(it)».getIncomingLinks(view);
- }
-
- «generatedMemberComment»
- «xptCodeStyle.overrideI(it.editorGen.diagram)»
- public java.util.List<«linkDescriptor.qualifiedClassName(it)»> getOutgoingLinks(org.eclipse.gmf.runtime.notation.View view) {
- return «className(it)».getOutgoingLinks(view);
- }
- };
- '''
+ '''
def additions(GenDiagramUpdater it) ''''''
+
+ def diagramUpdaterInstanceToUse(GenDiagramUpdater it) '''
+ «IF customDiagramUpdaterSingletonPath !== null»
+ «customDiagramUpdaterSingletonPath»
+ «ELSE»
+ «diagramUpdaterQualifiedClassName».INSTANCE
+ «ENDIF»
+ '''
+
+ def typeOfCrossReferenceAdapter() '''org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter'''
+
+ def _constructor(GenDiagramUpdater it) '''
+ «generatedMemberComment()»
+ protected «diagramUpdaterClassName»(){
+ //to prevent instantiation allowing the override
+ }
+ '''
+
+ //create the singleton using custom class defined in GMFGen
+ def classSingleton(GenDiagramUpdater it) '''
+ «««we create the singleton only in the case where there is no custom diagram updater
+ «IF customDiagramUpdaterSingletonPath === null»
+ «generatedMemberComment()»
+ public static final «diagramUpdaterQualifiedClassName» INSTANCE = new «diagramUpdaterClassName»();
+ «ENDIF»
+ '''
+
+ def CharSequence getICustomDiagramUpdater(GenContainerBase it) '''org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater<«nodeDescriptor.
+ qualifiedClassName(it.diagramUpdater)»>'''
+
+
+ def isDiagram(GenDiagram it) ''''''
+
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/LinkDescriptor.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/LinkDescriptor.xtend
index 5281a327cc0..288a2e302ff 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/LinkDescriptor.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/LinkDescriptor.xtend
@@ -1,18 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime (#372479)
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Borland) - [243151] explicit source/target for links
+ * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2
+ * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter
* - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.updater
@@ -45,21 +47,22 @@ import xpt.Common
}
'''
- def extendsList(GenDiagramUpdater it) '''extends org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor'''
+ def extendsList(GenDiagramUpdater it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterLinkDescriptor'''
def refOnlyLinkConstructor(GenDiagramUpdater it) '''
«generatedMemberComment»
- public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, int linkVID) {
+ public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) {
super(source, destination, elementType, linkVID);
}
'''
def typeLinkConstructor(GenDiagramUpdater it) '''
«generatedMemberComment»
- public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, int linkVID) {
+ public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) {
super(source, destination, linkElement, elementType, linkVID);
}
'''
def additions(GenDiagramUpdater it) ''''''
-}
+
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/NodeDescriptor.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/NodeDescriptor.xtend
index 459aa649bb1..e5b9fe76fd9 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/NodeDescriptor.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/NodeDescriptor.xtend
@@ -1,18 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime (#372479)
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Borland) - [243151] explicit source/target for links
+ * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2
+ * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter
+* Michael Golubev (Montages) - API extracted to gmf.tooling.runtime (#372479)
* - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.updater
@@ -43,11 +46,11 @@ import xpt.Common
}
'''
- def extendsList(GenDiagramUpdater it) '''extends org.eclipse.gmf.tooling.runtime.update.UpdaterNodeDescriptor'''
+ def extendsList(GenDiagramUpdater it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterNodeDescriptor'''
def constructor(GenDiagramUpdater it) '''
«generatedMemberComment»
- public «className(it)»(org.eclipse.emf.ecore.EObject modelElement, int visualID) {
+ public «className(it)»(org.eclipse.emf.ecore.EObject modelElement, String visualID) {
super(modelElement, visualID);
}
'''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/extensions.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/extensions.xtend
index a03b639e9bd..d376c0e7c0d 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/extensions.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/updater/extensions.xtend
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*****************************************************************************
* Copyright (c) 2007, 2020, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
@@ -11,7 +11,7 @@
* Contributors:
* Alexander Shatalin (Borland) - initial API and implementation
* Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Gabriel Pascual (ALL4TEC) - Bug 372322 : [Diagram - Refresh] The refresh action is not correctly binded to F5
* Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
*****************************************************************************/
package xpt.diagram.updater
@@ -21,29 +21,8 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagramUpdater
@Singleton class extensions {
- def extensions(GenDiagramUpdater it) '''
-««« !!! was overriden by papyrus to remove this !!!
-«««
-««« «extraLineBreak»
-««« «extraLineBreak»
-««« «tripleSpace(1)»<extension point="org.eclipse.ui.commands" id="update-cmd">
-««« «tripleSpace(2)»«xmlGeneratedTag»
-««« «tripleSpace(2)»<command
-««« «tripleSpace(3)»categoryId="org.eclipse.ui.category.edit"
-««« «tripleSpace(3)»defaultHandler="«getUpdateCommandQualifiedClassName()»"
-««« «tripleSpace(3)»description="%update.diagram.description"
-««« «tripleSpace(3)»id="«updateCommandID»"
-««« «tripleSpace(3)»name="%update.diagram.name"/>
-««« «tripleSpace(1)»</extension>
-««« «extraLineBreak»«outTab»
-««« «tripleSpace(1)»<extension point="org.eclipse.ui.bindings" id="update-cmd-binding">
-««« «tripleSpace(2)»«xmlGeneratedTag»
-««« «tripleSpace(2)»<key
-««« «tripleSpace(3)»commandId="«updateCommandID»"
-««« «tripleSpace(3)»contextId="«editorGen.editor.contextID»"
-««« «tripleSpace(3)»schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-««« «tripleSpace(3)»sequence="F5"/>
-««« «tripleSpace(1)»</extension>
- '''
+ def extensions(GenDiagramUpdater it) {
+ // Override Refresh contribution
+ }
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/views/ViewStyles.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/views/ViewStyles.xtend
index 5f390764949..ec41a55f582 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/views/ViewStyles.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/views/ViewStyles.xtend
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.diagram.views
@@ -120,20 +120,24 @@ import xpt.diagram.ViewmapAttributesUtils_qvto
'''
def dispatch offset(GenExternalNodeLabel it, String viewVar) '''
- «offset(viewVar, 0, 5)»
+ «IF labelOffsetX(viewmap, 0) != 0 || labelOffsetY(viewmap, 0) != 0»
+ «offset(it,viewVar, labelOffsetX(viewmap, 0), labelOffsetY(viewmap, 0))»
+ «ELSE»
+ «offset(it,viewVar, 0, 15)»
+ «ENDIF»
'''
-
/**
* viewVar must be already inserted into a diagram (view.getDiagram() should be meaningful)
*/
def offset(GenLabel it, String viewVar, int x, int y) '''
- org.eclipse.gmf.runtime.notation.Location location«visualID» = (org.eclipse.gmf.runtime.notation.Location) «viewVar».getLayoutConstraint();
+ «val location = stringUniqueIdentifier.toFirstLower+'_Location'»
+ org.eclipse.gmf.runtime.notation.Location «location» = (org.eclipse.gmf.runtime.notation.Location) «viewVar».getLayoutConstraint();
«IF it.getDiagram().isPixelMapMode()»
- location«visualID».setX(«x»);
- location«visualID».setY(«y»);
+ «location».setX(«x»);
+ «location».setY(«y»);
«ELSE»
- location«visualID».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»));
- location«visualID».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»));
+ «location».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»));
+ «location».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»));
«ENDIF»
'''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ActionBarContributor.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ActionBarContributor.xtend
index 4b7014d5a44..9a7c764f779 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ActionBarContributor.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ActionBarContributor.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
@@ -50,7 +50,8 @@ import xpt.providers.MetricProvider
public class «className(it)» «extendsList(it)» {
«generatedMemberComment»
- protected Class getEditorClass() {
+
+ protected Class<«xptEditor.qualifiedClassName(it)»> getEditorClass() {
return «xptEditor.qualifiedClassName(it)».class;
}
@@ -96,5 +97,4 @@ import xpt.providers.MetricProvider
'''
def additions(GenEditorView it) ''''''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/CreationWizard.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/CreationWizard.xtend
index 30dc3690739..968ffa7e311 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/CreationWizard.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/CreationWizard.xtend
@@ -1,17 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2014, 2021 Borland Software Corporation, Montages, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Anatloyi Tischenko - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
@@ -22,9 +23,11 @@ import xpt.Common
import xpt.Externalizer
import xpt.ExternalizerUtils_qvto
import plugin.Activator
+import xpt.CodeStyle
@com.google.inject.Singleton class CreationWizard {
@Inject extension Common;
+ @Inject extension CodeStyle;
@Inject extension GenDiagram_qvto;
@Inject extension ExternalizerUtils_qvto;
@@ -122,6 +125,7 @@ import plugin.Activator
domainModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»(
"DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$
+ «overrideC»
public void setVisible(boolean visible) {
if (visible) {
String fileName = diagramModelFilePage.getFileName();
@@ -146,6 +150,7 @@ import plugin.Activator
«IF editorGen.application == null»
new org.eclipse.ui.actions.WorkspaceModifyOperation(null) {
+ «overrideC»
protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor)
throws org.eclipse.core.runtime.CoreException, InterruptedException {
«ELSE»
@@ -240,4 +245,4 @@ import plugin.Activator
return '' + className(diagram) + 'CreationError'
}
-}
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramContentInitializer.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramContentInitializer.xtend
index b54f519d9a0..bd77748947c 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramContentInitializer.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramContentInitializer.xtend
@@ -1,17 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2016, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Florian Noyrit - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
@@ -102,7 +103,7 @@ import xpt.diagram.updater.LinkDescriptor
}
'''
- @MetaDef def createChildrenMethodName(GenContainerBase it) '''create«it.uniqueIdentifier»Children'''
+ @MetaDef def createChildrenMethodName(GenContainerBase it) '''create«it.stringUniqueIdentifier»_Children'''
def createChildren(GenContainerBase it) '''
«generatedMemberComment»
@@ -202,7 +203,7 @@ import xpt.diagram.updater.LinkDescriptor
def getCompartment(GenDiagram it) '''
«generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, int visualID) {
+ private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, String visualID) {
String type = «xptVisualIDRegistry.typeMethodCall(it, 'visualID')»;
for (java.util.Iterator it = node.getChildren().iterator(); it.hasNext();) {
org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
@@ -215,5 +216,4 @@ import xpt.diagram.updater.LinkDescriptor
'''
def additions(GenDiagram it) ''''''
-
-}
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorContextMenuProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorContextMenuProvider.xtend
index 64b2f4e2b7e..2e05a24e831 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorContextMenuProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorContextMenuProvider.xtend
@@ -1,31 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2008, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.MetaDef
-import xpt.Common
import plugin.Activator
+import xpt.CodeStyle
+import xpt.Common
-@com.google.inject.Singleton class DiagramEditorContextMenuProvider {
+//We remove the dependency with DeleteElementAction. Now this action is added to the popup menu with the extension point org.eclipse.ui.popup
+//in org.eclipse.papyrus.uml.diagram.common
+@Singleton class DiagramEditorContextMenuProvider {
@Inject extension Common;
+ @Inject extension CodeStyle
@Inject Activator xptActivator;
- @Inject DeleteElementAction xptDeleteElementAction;
@MetaDef def className(GenDiagram it) '''DiagramEditorContextMenuProvider'''
@@ -35,6 +39,7 @@ import plugin.Activator
def fullPath(GenDiagram it) '''«qualifiedClassName(it)»'''
+
def DiagramEditorContextMenuProvider(GenDiagram it) '''
«copyright(editorGen)»
package «packageName(it)»;
@@ -45,25 +50,25 @@ import plugin.Activator
«generatedMemberComment»
private org.eclipse.ui.IWorkbenchPart part;
- «generatedMemberComment»
- private «xptDeleteElementAction.qualifiedClassName(it)» deleteAction;
+ ««« «generatedMemberComment»
+ ««« private «xptDeleteElementAction.qualifiedClassName(it)» deleteAction;
«generatedMemberComment»
public DiagramEditorContextMenuProvider(org.eclipse.ui.IWorkbenchPart part, org.eclipse.gef.EditPartViewer viewer) {
super(part, viewer);
this.part = part;
- deleteAction = new «xptDeleteElementAction.qualifiedClassName(it)»(part);
- deleteAction.init();
+ ««« deleteAction = new «xptDeleteElementAction.qualifiedClassName(it)»(part);
+ ««« deleteAction.init();
}
- «generatedMemberComment»
- public void dispose() {
- if (deleteAction != null) {
- deleteAction.dispose();
- deleteAction = null;
- }
- super.dispose();
- }
+ ««« «generatedMemberComment»
+ ««« public void dispose() {
+ ««« if (deleteAction != null) {
+ ««« deleteAction.dispose();
+ ««« deleteAction = null;
+ ««« }
+ ««« super.dispose();
+ ««« }
«generatedMemberComment»
public void buildContextMenu(final org.eclipse.jface.action.IMenuManager menu) {
@@ -72,11 +77,12 @@ import plugin.Activator
org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(
(org.eclipse.emf.ecore.EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+ «overrideI(it.editorGen.diagram)»
public void run() {
org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService.getInstance().contributeToPopupMenu(
DiagramEditorContextMenuProvider.this, part);
menu.remove(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_DELETE_FROM_MODEL);
- menu.appendToGroup("editGroup", deleteAction);
+ ««« menu.appendToGroup("editGroup", deleteAction);
}
});
} catch (Exception e) {
@@ -86,7 +92,6 @@ import plugin.Activator
«additions(it)»
}
'''
-
def additions(GenDiagram it) ''''''
-
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorUtil.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorUtil.xtend
index f097f959924..cf4e01cf889 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorUtil.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DiagramEditorUtil.xtend
@@ -1,32 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
- *
+/*****************************************************************************
+ * Copyright (c) 2007, 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
import com.google.inject.Inject
+import com.google.inject.Singleton
import metamodel.MetaModel
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.MetaDef
import plugin.Activator
+import xpt.CodeStyle
import xpt.Common
import xpt.Externalizer
import xpt.ExternalizerUtils_qvto
-@com.google.inject.Singleton class DiagramEditorUtil {
+@Singleton class DiagramEditorUtil {
@Inject extension Common;
+ @Inject extension CodeStyle;
@Inject extension GenDiagram_qvto;
@Inject extension ExternalizerUtils_qvto;
@@ -193,8 +197,8 @@ import xpt.ExternalizerUtils_qvto
def getUniqueFileNameMethod(GenDiagram it) '''
«generatedMemberComment»
public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) {
- return org.eclipse.gmf.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «»
- org.eclipse.gmf.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application == null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»);
+ return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «»
+ org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application == null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»);
}
'''
@@ -203,7 +207,7 @@ import xpt.ExternalizerUtils_qvto
(if(editorGen.application == null) 'This method should be called within a workspace modify operation since it creates resources.' else ''))»
public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel(
it)» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
progressMonitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForCreateDiagramProgressTask(it))», 3);
final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
«IF standaloneDomainModel(it)»
@@ -215,6 +219,7 @@ import xpt.ExternalizerUtils_qvto
final String diagramName = diagramURI.lastSegment();
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «xptExternalizer.
accessorCall(editorGen, i18nKeyForCreateDiagramCommandLabel(it))», java.util.Collections.EMPTY_LIST) {
+ «overrideC»
protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
«IF domainDiagramElement != null»
«xptMetaModel.QualifiedClassName(domainDiagramElement)» model = createInitialModel();
@@ -458,4 +463,4 @@ import xpt.ExternalizerUtils_qvto
«xptExternalizer.messageEntry(i18nKeyForCreateDiagramCommandLabel(it), 'Creating diagram and model')»
'''
-}
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DocumentProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DocumentProvider.xtend
index 4fc5385d897..ae173c3ce0e 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DocumentProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/DocumentProvider.xtend
@@ -1,21 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
+import plugin.Activator
+import xpt.Common
+import xpt.Externalizer
+import xpt.CodeStyle
+import xpt.editor.DiagramEditorUtil
+import com.google.inject.Inject
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
import xpt.Common
@@ -24,6 +32,7 @@ import plugin.Activator
@com.google.inject.Singleton class DocumentProvider {
@Inject extension Common;
+ @Inject extension CodeStyle
@Inject Activator xptActivator;
@Inject Externalizer xptExternalizer;
@@ -225,14 +234,17 @@ import plugin.Activator
private org.eclipse.emf.common.notify.Notifier myTarger;
+ «overrideI»
public org.eclipse.emf.common.notify.Notifier getTarget() {
return myTarger;
}
+ «overrideI»
public boolean isAdapterForType(Object type) {
return false;
}
+ «overrideI»
public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
if (diagramResourceModifiedFilter.matches(notification)) {
Object value = notification.getNewValue();
@@ -242,6 +254,7 @@ import plugin.Activator
}
}
+ «overrideI»
public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget) {
myTarger = newTarget;
}
@@ -271,7 +284,8 @@ import plugin.Activator
}
if (!resource.isLoaded()) {
try {
- java.util.Map options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions());
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ java.util.Map<?,?> options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions());
// @see 171060
// options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
resource.load(options);
@@ -283,14 +297,14 @@ import plugin.Activator
if (uri.fragment() != null) {
org.eclipse.emf.ecore.EObject rootElement = resource.getEObject(uri.fragment());
if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);
+ document.setContent(rootElement);
return;
}
} else {
- for (java.util.Iterator it = resource.getContents().iterator(); it.hasNext();) {
+ for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = resource.getContents().iterator(); it.hasNext();) {
Object rootElement = it.next();
if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);
+ document.setContent(rootElement);
return;
}
}
@@ -375,7 +389,7 @@ import plugin.Activator
files2Validate.add(file);
}
}
- org.eclipse.core.resources.ResourcesPlugin.getWorkspace().validateEdit((org.eclipse.core.resources.IFile[]) files2Validate.toArray(new org.eclipse.core.resources.IFile[files2Validate.size()]), computationContext);
+ org.eclipse.core.resources.ResourcesPlugin.getWorkspace().validateEdit(files2Validate.toArray(new org.eclipse.core.resources.IFile[files2Validate.size()]), computationContext);
}
super.doValidateState(element, computationContext);
@@ -470,7 +484,7 @@ import plugin.Activator
}
'''
- def getResetRule(GenDiagram it) '''
+ def getResetRule(GenDiagram it)'''
«generatedMemberComment»
protected org.eclipse.core.runtime.jobs.ISchedulingRule getResetRule(Object element) {
ResourceSetInfo info = getResourceSetInfo(element);
@@ -483,7 +497,7 @@ import plugin.Activator
rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
}
}
- return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
+ return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
}
return null;
}
@@ -502,7 +516,7 @@ import plugin.Activator
rules.add(computeSchedulingRule(file));
}
}
- return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
+ return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
}
return null;
}
@@ -521,7 +535,7 @@ import plugin.Activator
rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
}
}
- return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
+ return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
}
return null;
}
@@ -540,7 +554,7 @@ import plugin.Activator
files.add(file);
}
}
- return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule((org.eclipse.core.resources.IFile[]) files.toArray(new org.eclipse.core.resources.IFile[files.size()]));
+ return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule(files.toArray(new org.eclipse.core.resources.IFile[files.size()]));
}
return null;
}
@@ -549,9 +563,9 @@ import plugin.Activator
def computeSchedulingRule(GenDiagram it) '''
«generatedMemberComment»
private org.eclipse.core.runtime.jobs.ISchedulingRule computeSchedulingRule(org.eclipse.core.resources.IResource toCreateOrModify) {
- if (toCreateOrModify.exists())
+ if (toCreateOrModify.exists()) {
return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
-
+ }
org.eclipse.core.resources.IResource parent = toCreateOrModify;
do {«/*FIXME [MG] the bug is closed long ago, still need? */»
/*
@@ -676,9 +690,10 @@ import plugin.Activator
}
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
final org.eclipse.emf.ecore.resource.Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
- final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = (org.eclipse.gmf.runtime.notation.Diagram) org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram());
+ final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram());
try {
new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveAs(it))», diagramCopy.getName()), affectedFiles) {
+ «overrideC»
protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
newResource.getContents().add(diagramCopy);
return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
@@ -695,7 +710,7 @@ import plugin.Activator
newResource.unload();
}
}
- '''
+ '''
def handleElementMoved(GenDiagram it) '''
«generatedMemberComment»
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/Editor.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/Editor.xtend
index f29487c024f..f73a8e911c2 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/Editor.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/Editor.xtend
@@ -1,36 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Emilien Perico (Atos Origin) - add code to refactor some classes
+ * Christian W. Damus (CEA) - bug 430648
+ * Christian W. Damus (CEA) - bug 431023
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 512343
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
+
package xpt.editor
import com.google.inject.Inject
-import java.util.List
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorView
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
import org.eclipse.papyrus.gmf.codegen.gmfgen.Palette
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
-import plugin.Activator
+import xpt.CodeStyle
import xpt.Common
import xpt.Common_qvto
import xpt.Externalizer
import xpt.ExternalizerUtils_qvto
-import xpt.navigator.NavigatorLinkHelper
import xpt.editor.palette.PaletteFactory
-import xpt.navigator.NavigatorItem import xpt.CodeStyle
+import xpt.navigator.NavigatorItem
+import xpt.navigator.NavigatorLinkHelper
+import xpt.navigator.Utils_qvto
+import plugin.Activator
+import java.util.List
-@com.google.inject.Singleton class Editor {
+@Singleton class Editor {
@Inject extension Common;
@Inject extension Common_qvto;
@Inject extension CodeStyle;
@@ -43,6 +51,8 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
@Inject DiagramEditorContextMenuProvider xptDiagramEditorContextMenuProvider;
@Inject PaletteFactory pallette;
+ @Inject extension Utils_qvto;
+
def className(GenEditorView it) '''«it.className»'''
def packageName(GenEditorView it) '''«it.packageName»'''
@@ -51,111 +61,9 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
def fullPath(GenEditorView it) '''«qualifiedClassName(it)»'''
- def extendsList(GenEditorView it) '''extends org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor'''
def implementsList(GenEditorView it) '''«implementsList(buildImplementsList(it))»'''
- def implementsList(Iterable<String> list) '''«IF list.notEmpty»implements «FOR next : list SEPARATOR ', '»«next»«ENDFOR»«ENDIF»'''
-
- def Editor(GenEditorView it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» «extendsList(it)» «implementsList(it)» {
-
- «attributes(it)»
-
- «constructor(it)»
-
- «getContextID(it)»
-
- «IF editorGen.diagram.palette != null»
- «createPaletteRoot(editorGen.diagram.palette)»
- «ENDIF»
-
- «getPreferencesHint(it)»
-
- «getContributorId(it)»
-
- «getAdapter(it)»
-
- «getDocumentProvider(it)»
-
- «getEditingDomain(it)»
-
- «setDocumentProvider(it)»
- «IF isIDEMode(it)»
-
- «gotoMarker(it)»
-
- «isSaveAsAllowed(it)»
-
- «doSaveAs(it)»
-
- «performSaveAs(it)»
-
- «getShowInContext(it)»
-
- «IF hasNavigator(it)»
- «getNavigatorSelection(it.editorGen.navigator)»
- «ENDIF»
- «ENDIF»
-
- «configureGraphicalViewer(it)»
-
- «IF editorGen.diagram.generateCreateShortcutAction»
-
- «initializeGraphicalViewer(it)»
-
- «controlLastClickPositionProviderService»
-
- «dispose»
-
- «DropTargetListener(it)»
- «ENDIF»
-
- «additions(it)»
- }
- '''
-
- def attributes(GenEditorView it) '''
- «generatedMemberComment»
- public static final String ID = "«ID»"; «nonNLS(1)»
-
- «generatedMemberComment»
- public static final String CONTEXT_ID = "«contextID»"; «nonNLS(1)»
-
- «IF editorGen.diagram.generateCreateShortcutAction()»
- «generatedMemberComment»
- private org.eclipse.gmf.tooling.runtime.part.LastClickPositionProvider myLastClickPositionProvider;
- «ENDIF»
- '''
-
- def constructor(GenEditorView it) '''
- «generatedMemberComment»
- public «className(it)»() {
- super(«null != editorGen.diagram.palette && editorGen.diagram.palette.flyout»);
- }
- '''
-
- def getContextID(GenEditorView it) '''
- «generatedMemberComment»
- protected String getContextID() {
- return CONTEXT_ID;
- }
- '''
-
- def createPaletteRoot(Palette it) '''
-
- «generatedMemberComment»
- protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot(org.eclipse.gef.palette.PaletteRoot existingPaletteRoot) {
- org.eclipse.gef.palette.PaletteRoot root = super.createPaletteRoot(existingPaletteRoot);
- new «pallette.qualifiedClassName(it)»().fillPalette(root);
- return root;
- }
- '''
-
def getPreferencesHint(GenEditorView it) '''
«generatedMemberComment»
protected org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint getPreferencesHint() {
@@ -172,63 +80,7 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
}
'''
- def getAdapter(GenEditorView it) '''
- «IF !hasPropertySheet(it) || hasNavigator(it)»
-
- «generatedMemberComment»
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class type) {
- «IF !hasPropertySheet(it)»
- if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) {
- return null;
- }
- «ENDIF»
- «IF hasNavigator(it)»
- if (type == org.eclipse.ui.part.IShowInTargetList.class) {
- return new org.eclipse.ui.part.IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID };
- }
- };
- }
- «ENDIF»
- return super.getAdapter(type);
- }
- «ENDIF»
- '''
-
- def getDocumentProvider(GenEditorView it) '''
- «generatedMemberComment»
- protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider getDocumentProvider(org.eclipse.ui.IEditorInput input) {
- if («checkEditorInput(it)») {
- return «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().getDocumentProvider();
- }
- return super.getDocumentProvider(input);
- }
- '''
-
- def getEditingDomain(GenEditorView it) '''
- «generatedMemberComment»
- public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document = getEditorInput() != null ? getDocumentProvider().getDocument(getEditorInput()) : null;
- if (document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
- return ((org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document).getEditingDomain();
- }
- return super.getEditingDomain();
- }
- '''
-
- def setDocumentProvider(GenEditorView it) '''
- «generatedMemberComment»
- protected void setDocumentProvider(org.eclipse.ui.IEditorInput input) {
- if («checkEditorInput(it)») {
- setDocumentProvider(«xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().getDocumentProvider());
- } else {
- super.setDocumentProvider(input);
- }
- }
- '''
-
+
def checkEditorInput(GenEditorView it) '''«IF isIDEMode(it)»input instanceof org.eclipse.ui.IFileEditorInput || «ENDIF»input instanceof org.eclipse.emf.common.ui.URIEditorInput'''
def gotoMarker(GenEditorView it) '''
@@ -252,79 +104,7 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
}
'''
- def performSaveAs(GenEditorView it) '''
- «generatedMemberComment»
- protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- org.eclipse.swt.widgets.Shell shell = getSite().getShell();
- org.eclipse.ui.IEditorInput input = getEditorInput();
- org.eclipse.ui.dialogs.SaveAsDialog dialog = new org.eclipse.ui.dialogs.SaveAsDialog(shell);
- org.eclipse.core.resources.IFile original = input instanceof org.eclipse.ui.IFileEditorInput ? ((org.eclipse.ui.IFileEditorInput) input).getFile() : null;
- if (original != null) {
- dialog.setOriginalFile(original);
- }
- dialog.create();
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider provider = getDocumentProvider();
- if (provider == null) {
- // editor has been programmatically closed while the dialog was open
- return;
- }
- if (provider.isDeleted(input) && original != null) {
- String message = org.eclipse.osgi.util.NLS.bind(«xptExternalizer.accessorCall(editorGen,
- i18nKeyForSavingDeletedFile(it))», original.getName());
- dialog.setErrorMessage(null);
- dialog.setMessage(message, org.eclipse.jface.dialogs.IMessageProvider.WARNING);
- }
- if (dialog.open() == org.eclipse.jface.window.Window.CANCEL) {
- if (progressMonitor != null) {
- progressMonitor.setCanceled(true);
- }
- return;
- }
- org.eclipse.core.runtime.IPath filePath = dialog.getResult();
- if (filePath == null) {
- if (progressMonitor != null) {
- progressMonitor.setCanceled(true);
- }
- return;
- }
- org.eclipse.core.resources.IWorkspaceRoot workspaceRoot = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot();
- org.eclipse.core.resources.IFile file = workspaceRoot.getFile(filePath);
- final org.eclipse.ui.IEditorInput newInput = new org.eclipse.ui.part.FileEditorInput(file);
- // Check if the editor is already open
- org.eclipse.ui.IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy();
- org.eclipse.ui.IEditorReference[] editorRefs = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
- for (int i = 0; i < editorRefs.length; i++) {
- if (matchingStrategy.matches(editorRefs[i], newInput)) {
- org.eclipse.jface.dialogs.MessageDialog.openWarning(shell, «xptExternalizer.accessorCall(editorGen,
- titleKey(i18nKeyForSaveAsProblems(it)))», «xptExternalizer.accessorCall(editorGen,
- messageKey(i18nKeyForSaveAsProblems(it)))»);
- return;
- }
- }
- boolean success = false;
- try {
- provider.aboutToChange(newInput);
- getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);
- success = true;
- } catch (org.eclipse.core.runtime.CoreException x) {
- org.eclipse.core.runtime.IStatus status = x.getStatus();
- if (status == null || status.getSeverity() != org.eclipse.core.runtime.IStatus.CANCEL) {
- org.eclipse.jface.dialogs.ErrorDialog.openError(shell, «xptExternalizer.accessorCall(editorGen,
- titleKey(i18nKeyForSaveProblems(it)))», «xptExternalizer.accessorCall(editorGen,
- messageKey(i18nKeyForSaveProblems(it)))», x.getStatus());
- }
- } finally {
- provider.changed(newInput);
- if (success) {
- setInput(newInput);
- }
- }
- if (progressMonitor != null) {
- progressMonitor.setCanceled(!success);
- }
- }
- '''
-
+
def getShowInContext(GenEditorView it) '''
«generatedMemberComment»
public org.eclipse.ui.part.ShowInContext getShowInContext() {
@@ -332,14 +112,6 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
}
'''
- def getNavigatorSelection(GenNavigator it) '''
-
- «generatedMemberComment»
- private org.eclipse.jface.viewers.ISelection getNavigatorSelection() {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument();
- «xptNavigatorLinkHelper.findSelectionBody(it)»
- }
- '''
def configureGraphicalViewer(GenEditorView it) '''
«generatedMemberComment»
@@ -352,16 +124,6 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
}
'''
- def initializeGraphicalViewer(GenEditorView it) '''
- «generatedMemberComment»
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
- «addDropTargetListener('org.eclipse.jface.util.LocalSelectionTransfer.getTransfer()')»
- «addDropTargetListener('org.eclipse.emf.edit.ui.dnd.LocalTransfer.getInstance()')»
- startupLastClickPositionProvider();
- }
- '''
-
def controlLastClickPositionProviderService(GenEditorView it)'''
«generatedMemberComment»
protected void startupLastClickPositionProvider() {
@@ -381,15 +143,6 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
}
'''
- def dispose(GenEditorView it)'''
- «generatedMemberComment»
- «overrideC(editorGen.diagram)»
- public void dispose() {
- shutDownLastClickPositionProvider();
- super.dispose();
- }
- '''
-
def addDropTargetListener(GenEditorView it, String transferAccessor) '''
getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), «transferAccessor») {
@@ -468,7 +221,6 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
def DTL_additions(GenEditorView it) ''''''
- def additions(GenEditorView it) ''''''
@Localization def i18nValues(GenEditorView it) '''
«xptExternalizer.messageEntry(i18nKeyForSavingDeletedFile(it), 'The original file \"{0}\" has been deleted.')»
@@ -526,4 +278,583 @@ import xpt.navigator.NavigatorItem import xpt.CodeStyle
def boolean hasNavigator(GenEditorView it) {
return it.editorGen.navigator != null
}
+
+ def extendsList(GenEditorView it) '''extends org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor'''
+
+ def attributes(GenEditorView it) '''
+ «generatedMemberComment»
+ public static final String ID = "«ID»"; «nonNLS»
+
+ «generatedMemberComment»
+public static final String CONTEXT_ID = "«contextID»"; «nonNLS»
+
+
+ ««« Documentation. adds listener for papyrus editors
+ «generatedMemberComment»
+ private org.eclipse.gef.KeyHandler paletteKeyHandler = null;
+
+ «generatedMemberComment»
+ private org.eclipse.swt.events.MouseListener paletteMouseListener = null;
+
+ ««« Helps to handle correctly the dirty state
+ «generatedMemberComment»
+ private org.eclipse.papyrus.commands.util.OperationHistoryDirtyState dirtyState;
+
+ «generatedMemberComment»
+ private org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain;
+
+ «generatedMemberComment»
+ private org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider documentProvider;
+ '''
+
+ def constructor(GenEditorView it) '''
+ «generatedMemberComment»
+ public «className»(org.eclipse.papyrus.infra.core.services.ServicesRegistry servicesRegistry, org.eclipse.gmf.runtime.notation.Diagram diagram) throws org.eclipse.papyrus.infra.core.services.ServiceException{
+ super(servicesRegistry, diagram);
+
+ ««« Documentation. adds listener for papyrus palette service
+ // adds a listener to the palette service, which reacts to palette customizations
+ org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().addProviderChangeListener(this);
+
+ «««Share the same editing domain
+ // Share the same editing provider
+ editingDomain = servicesRegistry.getService(org.eclipse.emf.transaction.TransactionalEditingDomain.class);
+ documentProvider = new org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider(editingDomain);
+
+ // overrides editing domain created by super constructor
+ setDocumentProvider(documentProvider);
+
+ «««end of listeners addition
+ }
+ '''
+
+ def getNavigatorSelection(GenNavigator it) '''
+
+ «generatedMemberComment»
+ private org.eclipse.jface.viewers.ISelection getNavigatorSelection() {
+ «IF getDiagramTopReference(it) !==null »
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument();
+ «ENDIF»
+ «xptNavigatorLinkHelper.findSelectionBody(it)»
+ }
+ '''
+
+def createPaletteRoot (Palette it)'''
+ «generatedMemberComment»
+ protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot(org.eclipse.gef.palette.PaletteRoot existingPaletteRoot) {
+ org.eclipse.gef.palette.PaletteRoot paletteRoot;
+ if (existingPaletteRoot == null) {
+ paletteRoot = org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent());
+ } else {
+ org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent());
+ paletteRoot = existingPaletteRoot;
+ }
+ applyCustomizationsToPalette(paletteRoot);
+ return paletteRoot;
+ }
+'''
+
+// FIXME - This has been overrided to comment the test on the palette tag in the gmfgen
+ def Editor(GenEditorView it) '''
+ «copyright(editorGen)»
+ package «packageName(it)»;
+
+ «generatedClassComment»
+ public class «className(it)» «extendsList(it)» «implementsList(it)» {
+
+ «attributes(it)»
+
+ «constructor(it)»
+
+ «getContextID(it)»
+
+««« «IF editorGen.diagram.palette != null»
+ «createPaletteRoot(editorGen.diagram.palette)»
+««« «ENDIF»
+
+ «getPreferencesHint(it)»
+
+ «getContributorId(it)»
+
+ «getAdapter(it)»
+
+ «getDocumentProvider(it)»
+
+ «getEditingDomain(it)»
+
+ «setDocumentProvider(it)»
+ «IF isIDEMode(it)»
+
+ «gotoMarker(it)»
+
+ «isSaveAsAllowed(it)»
+
+ «doSaveAs(it)»
+
+ «performSaveAs(it)»
+
+ «getShowInContext(it)»
+
+ «IF hasNavigator(it)»
+ «getNavigatorSelection(it.editorGen.navigator)»
+ «ENDIF»
+ «ENDIF»
+
+ «configureGraphicalViewer(it)»
+
+ «IF editorGen.diagram.generateCreateShortcutAction»
+
+ «initializeGraphicalViewer(it)»
+
+ «controlLastClickPositionProviderService»
+
+ «dispose»
+
+ «DropTargetListener(it)»
+ «ENDIF»
+
+ «additions(it)»
+ }
+ '''
+
+def createPaletteCustomizer (GenEditorView it)'''
+ «generatedMemberComment»
+ protected org.eclipse.gef.ui.palette.PaletteCustomizer createPaletteCustomizer() {
+ return new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteCustomizer(getPreferenceStore());
+ }
+'''
+
+def additions (GenEditorView it)'''
+
+ «createEditingDomain(it)»
+
+ « configureDiagramEditDomain(it)»
+
+ « doSave(it)»
+
+ « getDirtyState(it)»
+
+ « setUndoContext(it)»
+
+ « isDirty(it)»
+
+ «««Documentation. adds method to handle palette changes
+ « handlePaletteChange(it)»
+
+ « dispose(it)»
+
+ « getPaletteViewer(it)»
+
+ ««« Documentation: (RS) advanced customization abilities
+ ««« « createPaletteCustomizer»
+
+ « constructPaletteViewer(it)»
+
+ « createPaletteviewerProvider(it)»
+
+ «getGraphicalViewer(it)»
+
+ «initializeGraphicalViewer(it)»
+
+ «selectionChanged(it)»
+
+'''
+
+def handlePaletteChange (GenEditorView it) '''
+ «generatedMemberComment»
+ public void providerChanged(org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent event) {
+ // update the palette if the palette service has changed
+ if (org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().equals(event.getSource())) {
+ org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this,
+ getDefaultPaletteContent());
+ }
+ }
+'''
+
+def constructPaletteViewer (GenEditorView it) '''
+ «generatedMemberComment»
+ protected org.eclipse.gef.ui.palette.PaletteViewer constructPaletteViewer() {
+ return new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteViewer();
+ }
+'''
+
+def dispose(GenEditorView it)'''
+ «generatedMemberComment»
+ public void dispose() {
+ // remove palette service listener
+ // remove preference listener
+ org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
+
+ if(dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
+ super.dispose();
+ }
+'''
+
+def getPaletteViewer (GenEditorView it)'''
+ «generatedMemberComment»
+ protected org.eclipse.gef.ui.palette.PaletteViewer getPaletteViewer() {
+ return getEditDomain().getPaletteViewer();
+ }
+'''
+
+def implementsList(Iterable<String> it)'''
+ implements org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener
+ «IF ! it.isEmpty»,
+ «FOR string : it SEPARATOR ', '»
+ «implementsListEntry(string)»
+ «ENDFOR»
+ «ENDIF»
+'''
+
+def implementsListEntry (String it)'''«it»'''
+
+def createPaletteviewerProvider (GenEditorView it)'''
+«generatedMemberComment»
+protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerProvider() {
+ getEditDomain().setPaletteRoot(createPaletteRoot(null));
+ return new org.eclipse.gef.ui.palette.PaletteViewerProvider(getEditDomain()) {
+
+ /**
+ * Override to provide the additional behavior for the tools. Will intialize with a
+ * PaletteEditPartFactory that has a TrackDragger that understand how to handle the
+ * mouseDoubleClick event for shape creation tools. Also will initialize the palette
+ * with a defaultTool that is the SelectToolEx that undestands how to handle the enter
+ * key which will result in the creation of the shape also.
+ */
+ «overrideC(it.editorGen.diagram)»
+ protected void configurePaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer viewer) {
+ super.configurePaletteViewer(viewer);
+
+ // customize menu...
+ viewer.setContextMenu(new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteContextMenuProvider(viewer));
+
+ viewer.getKeyHandler().setParent(getPaletteKeyHandler());
+ viewer.getControl().addMouseListener(getPaletteMouseListener());
+
+ // Add a transfer drag target listener that is supported on
+ // palette template entries whose template is a creation tool.
+ // This will enable drag and drop of the palette shape creation
+ // tools.
+ viewer.addDragSourceListener(new org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener(viewer));
+ viewer.setCustomizer(createPaletteCustomizer());
+ }
+
+ «overrideC(it.editorGen.diagram)»
+ public org.eclipse.gef.ui.palette.PaletteViewer createPaletteViewer(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.gef.ui.palette.PaletteViewer pViewer = constructPaletteViewer();
+ pViewer.createControl(parent);
+ configurePaletteViewer(pViewer);
+ hookPaletteViewer(pViewer);
+ return pViewer;
+ }
+
+ /**
+ * @return Palette Key Handler for the palette
+ */
+ private org.eclipse.gef.KeyHandler getPaletteKeyHandler() {
+
+ if (paletteKeyHandler == null) {
+
+ paletteKeyHandler = new org.eclipse.gef.KeyHandler() {
+
+ /**
+ * Processes a <i>key released </i> event. This method is called by the Tool
+ * whenever a key is released, and the Tool is in the proper state. Override
+ * to support pressing the enter key to create a shape or connection
+ * (between two selected shapes)
+ *
+ * @param event
+ * the KeyEvent
+ * @return <code>true</code> if KeyEvent was handled in some way
+ */
+ «overrideC(it.editorGen.diagram)»
+ public boolean keyReleased(org.eclipse.swt.events.KeyEvent event) {
+
+ if (event.keyCode == org.eclipse.swt.SWT.Selection) {
+
+ org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool();
+
+ if (toolSupportsAccessibility(tool)) {
+
+ tool.keyUp(event, getDiagramGraphicalViewer());
+
+ // deactivate current selection
+ getPaletteViewer().setActiveTool(null);
+
+ return true;
+ }
+
+ }
+ return super.keyReleased(event);
+ }
+
+ };
+
+ }
+ return paletteKeyHandler;
+ }
+
+ /**
+ * @return Palette Mouse listener for the palette
+ */
+ private org.eclipse.swt.events.MouseListener getPaletteMouseListener() {
+
+ if (paletteMouseListener == null) {
+
+ paletteMouseListener = new org.eclipse.swt.events.MouseListener() {
+
+ /**
+ * Flag to indicate that the current active tool should be cleared after a
+ * mouse double-click event.
+ */
+ private boolean clearActiveTool = false;
+
+ /**
+ * Override to support double-clicking a palette tool entry to create a
+ * shape or connection (between two selected shapes).
+ *
+ * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
+ */
+ «overrideI(it.editorGen.diagram)»
+ public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) {
+ org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool();
+
+ if (toolSupportsAccessibility(tool)) {
+
+ tool.setViewer(getDiagramGraphicalViewer());
+ tool.setEditDomain(getDiagramGraphicalViewer().getEditDomain());
+ tool.mouseDoubleClick(e, getDiagramGraphicalViewer());
+
+ // Current active tool should be deactivated,
+ // but if it is down here it will get
+ // reactivated deep in GEF palette code after
+ // receiving mouse up events.
+ clearActiveTool = true;
+ }
+ }
+
+ «overrideI(it.editorGen.diagram)»
+ public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
+ // do nothing
+ }
+
+ «overrideI(it.editorGen.diagram)»
+ public void mouseUp(org.eclipse.swt.events.MouseEvent e) {
+ // Deactivate current active tool here if a
+ // double-click was handled.
+ if (clearActiveTool) {
+ getPaletteViewer().setActiveTool(null);
+ clearActiveTool = false;
+ }
+
+ }
+ };
+
+ }
+ return paletteMouseListener;
+ }
+
+ };
+ }
+'''
+
+//Not used
+def performSaveAs (GenEditorView it)'''
+ «generatedMemberComment»
+protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
+ // Nothing
+}
+'''
+
+//Share the same editing domain
+def getEditingDomain (GenEditorView it)'''
+ «generatedMemberComment»
+ public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
+ return editingDomain;
+ }
+'''
+
+def createEditingDomain (GenEditorView it)'''
+«generatedMemberComment»
+ protected org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() {
+ // Already configured
+ return editingDomain;
+ }
+'''
+
+
+def configureDiagramEditDomain (GenEditorView it)'''
+«generatedMemberComment»
+ protected void configureDiagramEditDomain() {
+ super.configureDiagramEditDomain();
+ getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new org.eclipse.gef.commands.CommandStackListener() {
+
+ «overrideI(it.editorGen.diagram)»
+ public void commandStackChanged(java.util.EventObject event) {
+ if (org.eclipse.swt.widgets.Display.getCurrent() == null) {
+ org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ firePropertyChange(org.eclipse.ui.IEditorPart.PROP_DIRTY);
+ }
+ });
+ } else {
+ firePropertyChange(org.eclipse.ui.IEditorPart.PROP_DIRTY);
+ }
+ }
+ });
+ }
+'''
+
+def doSave (GenEditorView it)'''
+«generatedMemberComment»
+ public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
+ // The saving of the resource is done by the CoreMultiDiagramEditor
+ getDirtyState().saved();
+ }
+'''
+
+def getDirtyState (GenEditorView it)'''
+«generatedMemberComment»
+ protected org.eclipse.papyrus.commands.util.OperationHistoryDirtyState getDirtyState() {
+ if(dirtyState == null) {
+ dirtyState = org.eclipse.papyrus.commands.util.OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory());
+ }
+ return dirtyState;
+ }
+'''
+
+def setUndoContext (GenEditorView it)'''
+«generatedMemberComment»
+ protected void setUndoContext(org.eclipse.core.commands.operations.IUndoContext context) {
+ if(dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
+ super.setUndoContext(context);
+ }
+'''
+
+//Fix the dirty state
+def isDirty (GenEditorView it)'''
+«generatedMemberComment»
+ public boolean isDirty() {
+ return getDirtyState().isDirty();
+ }
+'''
+
+//Code refactoring moved in UMLDiagramEditor
+def getDocumentProvider (GenEditorView it)'''
+ «generatedMemberComment»
+ protected final org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider getDocumentProvider(org.eclipse.ui.IEditorInput input) {
+ return documentProvider;
+ }
+'''
+
+def setDocumentProvider (GenEditorView it)'''
+ «generatedMemberComment»
+ protected final void setDocumentProvider(org.eclipse.ui.IEditorInput input) {
+ // Already set in the constructor
+ }
+'''
+
+def getGraphicalViewer (GenEditorView it)'''
+«generatedMemberComment»
+ @Override
+ public org.eclipse.gef.GraphicalViewer getGraphicalViewer() {
+ return super.getGraphicalViewer();
+ }
+'''
+
+
+def initializeGraphicalViewer (GenEditorView it)'''
+«generatedMemberComment»
+ @Override
+ protected void initializeGraphicalViewer() {
+ super.initializeGraphicalViewer();
+
+ // Enable Drop
+ getDiagramGraphicalViewer().addDropTargetListener(
+ new org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener(getDiagramGraphicalViewer(), org.eclipse.jface.util.LocalSelectionTransfer.getTransfer()) {
+
+ @Override
+ protected Object getJavaObject(org.eclipse.swt.dnd.TransferData data) {
+ // It is usual for the transfer data not to be set because it is available locally
+ return LocalSelectionTransfer.getTransfer().getSelection();
+ }
+
+ @Override
+ protected org.eclipse.emf.transaction.TransactionalEditingDomain getTransactionalEditingDomain() {
+ return getEditingDomain();
+ }
+ });
+
+ }
+'''
+
+def selectionChanged (GenEditorView it)'''
+«generatedMemberComment»
+ @Override
+ public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) {
+ if (getSite().getPage().getActiveEditor() instanceof org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) {
+ org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor editor = (org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) getSite().getPage().getActiveEditor();
+ // If not the active editor, ignore selection changed.
+ if (this.equals(editor.getActiveEditor())) {
+ updateActions(getSelectionActions());
+ super.selectionChanged(part, selection);
+ } else {
+ super.selectionChanged(part, selection);
+ }
+ } else {
+ super.selectionChanged(part, selection);
+ }
+ // from
+ // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart,
+ // ISelection)
+ if (part == this) {
+ rebuildStatusLine();
+ }
+ }
+'''
+
+def getContextID (GenEditorView it)'''
+ «generatedMemberComment»
+protected String getContextID() {
+ return CONTEXT_ID;
+}
+'''
+
+ def getAdapter(GenEditorView it) '''
+ «IF !hasPropertySheet(it) || hasNavigator(it)»
+
+ «generatedMemberComment»
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class type) {
+ «IF !hasPropertySheet(it)»
+ if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) {
+ return null;
+ }
+ «ENDIF»
+ «IF hasNavigator(it)»
+ if (type == org.eclipse.ui.part.IShowInTargetList.class) {
+ return new org.eclipse.ui.part.IShowInTargetList() {
+
+ «overrideI(it.editorGen.diagram)»
+ public String[] getShowInTargetIds() {
+ return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID };
+ }
+ };
+ }
+ «ENDIF»
+ return super.getAdapter(type);
+ }
+ «ENDIF»
+ '''
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/InitDiagramFileAction.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/InitDiagramFileAction.xtend
index ea94a0d51bb..7f6f22f228f 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/InitDiagramFileAction.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/InitDiagramFileAction.xtend
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+ * Copyright (c) 2007, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -9,10 +9,10 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Dmitry Stadnik (Borland) - rewritten in xpand
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Dmitry Stadnik (Borland) - rewritten in xpand
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
@@ -158,7 +158,7 @@ import plugin.Activator
«generatedMemberComment»
public void run(org.eclipse.jface.action.IAction action) {
org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
- org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
«IF editorGen.sameFileForDiagramAndModel»
org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl();
«ELSE»
@@ -167,7 +167,7 @@ import plugin.Activator
org.eclipse.emf.ecore.EObject diagramRoot = null;
try {
org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(domainModelURI, true);
- diagramRoot = (org.eclipse.emf.ecore.EObject) resource.getContents().get(0);
+ diagramRoot = resource.getContents().get(0);
} catch (org.eclipse.emf.common.util.WrappedException ex) {
«xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
"Unable to load resource: " + domainModelURI, ex); «nonNLS(1)»
@@ -186,7 +186,6 @@ import plugin.Activator
1)»
}
'''
-
def i18nAccessors(GenDiagram it) '''
«xptExternalizer.accessorField(titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»
«xptExternalizer.accessorField(messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»
@@ -212,5 +211,4 @@ import plugin.Activator
@Localization def String i18nKeyForInitDiagramOpenFileDialogTitle() {
return 'InitDiagramFile.OpenModelFileDialogTitle'
}
-
-}
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ModelElementSelectionPage.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ModelElementSelectionPage.xtend
index 1aeaf16ff40..d1110c97959 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ModelElementSelectionPage.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ModelElementSelectionPage.xtend
@@ -1,18 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
- *
+/*****************************************************************************
+ * Copyright (c) 2007, 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Svyatoslav Kovalsky (Montages) - #410477 "same-generated" code extracted to GMFT-runtime
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Svyatoslav Kovalsky (Montages) - #410477 "same-generated" code extracted to GMFT-runtime
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
@@ -39,7 +40,7 @@ import plugin.Activator
def fullPath(GenDiagram it) '''«qualifiedClassName(it)»'''
- def extendsList(GenDiagram it) '''extends org.eclipse.gmf.tooling.runtime.part.DefaultModelElementSelectionPage'''
+ def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultModelElementSelectionPage'''
def ModelElementSelectionPage(GenDiagram it) '''
«copyright(editorGen)»
@@ -130,5 +131,4 @@ import plugin.Activator
@Localization def String i18nKeyForModelElementSelectionPage(GenDiagram diagram) {
return className(diagram).toString
}
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/NewDiagramFileWizard.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/NewDiagramFileWizard.xtend
index e5f2858c680..a6152f12e85 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/NewDiagramFileWizard.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/NewDiagramFileWizard.xtend
@@ -1,31 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
-import plugin.Activator
-import xpt.Common
import xpt.Externalizer
import xpt.ExternalizerUtils_qvto
+import xpt.Common
+import xpt.editor.ModelElementSelectionPage
+import plugin.Activator
+import xpt.editor.DiagramContentInitializer
+import xpt.CodeStyle
-@com.google.inject.Singleton class NewDiagramFileWizard {
+@Singleton class NewDiagramFileWizard {
@Inject extension Common;
-
+ @Inject extension CodeStyle;
@Inject extension ExternalizerUtils_qvto;
@Inject Externalizer xptExternalizer;
@Inject Activator xptActivator;
@@ -123,11 +128,12 @@ import xpt.ExternalizerUtils_qvto
new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(
myEditingDomain, «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardInitDiagramCommand(it))», affectedFiles) {
+ «overrideC»
protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info)
throws org.eclipse.core.commands.ExecutionException {
- int diagramVID = «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(diagramRootElementSelectionPage.getModelElement());
- if (diagramVID != «VisualIDRegistry::visualID(it)») {
+ String diagramVID = «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(diagramRootElementSelectionPage.getModelElement());
+ if (diagramVID.equals(«VisualIDRegistry::visualID(it)»)) {
return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult(
«xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardIncorrectRootError(it))»);
}
@@ -224,7 +230,7 @@ import xpt.ExternalizerUtils_qvto
'Select diagram root element')»
«xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), 'Diagram root element')»
«xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)),
- 'Select semantic model element to be depicted on diagram')»"Select diagram root element:"
+ 'Select semantic model element to be depicted on diagram')»
«xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it),
'Select diagram root element:')»
«xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it),
@@ -236,6 +242,7 @@ import xpt.ExternalizerUtils_qvto
'Incorrect model object stored as a root resource object')»
'''
+
@Localization def String i18nKeyForNewDiagramFileWizard(GenDiagram diagram) {
return '' + className(diagram)
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetInfo.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetInfo.xtend
index 1595d0a1754..7df8b8c5e4c 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetInfo.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetInfo.xtend
@@ -1,26 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2015, 2021 Borland Software Corporation, Montages, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Anatoliy Tischenko - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
import com.google.inject.Inject
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import xpt.Common
+import xpt.CodeStyle
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
+import com.google.inject.Singleton
-@com.google.inject.Singleton class ResourceSetInfo {
+@Singleton class ResourceSetInfo {
+
@Inject extension Common;
+ @Inject extension CodeStyle
/**
* Inner class of DocumentProvider
@@ -293,6 +298,7 @@ import xpt.Common
public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
«updateSynchStateSD(it)»
org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ «overrideI»
public void run() {
handleElementChanged(ResourceSetInfo.this, resource, null);
}
@@ -301,11 +307,13 @@ import xpt.Common
}
'''
+
def handleResourceDeletedSD(GenDiagram it) '''
«generatedMemberComment»
public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
«updateSynchStateSD(it)»
org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ «overrideI»
public void run() {
fireElementDeleted(ResourceSetInfo.this.getEditorInput());
}
@@ -320,6 +328,7 @@ import xpt.Common
«updateSynchStateSD(it)»
if (myDocument.getDiagram().eResource() == resource) {
org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ «overrideI»
public void run() {
handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
}
@@ -343,5 +352,5 @@ import xpt.Common
def additionsSD(GenDiagram it) ''''''
def additions(GenDiagram it) ''''''
-
+
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend
index 3bf0dc48853..24f142ec028 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend
@@ -1,25 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import xpt.Common
-@com.google.inject.Singleton class ResourceSetModificationListener {
+@Singleton class ResourceSetModificationListener {
+
@Inject extension Common;
def extendsList(GenDiagram it) '''extends org.eclipse.emf.ecore.util.EContentAdapter'''
@@ -68,8 +70,8 @@ import xpt.Common
org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) notification.getNotifier();
if (resource.isLoaded()) {
boolean modified = false;
- for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
if (nextResource.isLoaded()) {
modified = nextResource.isModified();
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ValidateAction.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ValidateAction.xtend
index 54e9d4ee56f..df9e7c2f708 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ValidateAction.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ValidateAction.xtend
@@ -1,21 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
+import xpt.Common
+import xpt.editor.DiagramEditorUtil
+import xpt.CodeStyle
+import plugin.Activator
+import xpt.providers.ValidationProvider
+
+import com.google.inject.Inject
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.MetaDef
@@ -28,16 +37,19 @@ import xpt.providers.ValidationProvider
import xpt.providers.MarkerNavigationProvider
import xpt.providers.ValidationDecoratorProvider
-@com.google.inject.Singleton class ValidateAction {
+@Singleton class ValidateAction {
@Inject extension Common;
+ @Inject extension CodeStyle
+
+ @Inject DiagramEditorUtil xptDiagramEditorUtil;
+ @Inject Activator xptActivator
+ @Inject ValidationProvider xptValidationProvider
+
@Inject extension GenAuditRoot_qvto;
@Inject extension ExternalizerUtils_qvto;
- @Inject Activator xptActivator;
@Inject ValidationMarker xptValidationMarker;
@Inject Externalizer xptExternalizer;
- @Inject DiagramEditorUtil xptDiagramEditorUtil;
- @Inject ValidationProvider xptValidationProvider;
@Inject MarkerNavigationProvider xptMarkerNavigationProvider;
@Inject ValidationDecoratorProvider xptValidationDecoratorProvider;
@@ -101,6 +113,7 @@ import xpt.providers.ValidationDecoratorProvider
«ENDIF»
new org.eclipse.jface.operation.IRunnableWithProgress() {
+ «overrideI»
public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
throws InterruptedException, java.lang.reflect.InvocationTargetException {
runValidation(part.getDiagramEditPart(), part.getDiagram());
@@ -115,7 +128,7 @@ import xpt.providers.ValidationDecoratorProvider
}
}
}
- '''
+ '''
def runValidation(GenDiagram it) '''
@@ -139,17 +152,23 @@ import xpt.providers.ValidationDecoratorProvider
}
'''
- def runNonUIValidation(GenDiagram it) '''
+ def runNonUIValidation(GenDiagram it)'''
«generatedMemberComment»
public static void runNonUIValidation(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.swt.widgets.Shell shell = org.eclipse.swt.widgets.Display.getCurrent().getActiveShell();
+ if (shell == null) {
+ shell = new org.eclipse.swt.widgets.Shell();
+ }
+
org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart =
org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory.getInstance().createDiagramEditPart(
- view.getDiagram());
+ view.getDiagram(),shell);
runValidation(diagramEditPart, view);
}
'''
+
def runValidationWithEP(GenDiagram it) '''
«generatedMemberComment»
@@ -159,6 +178,7 @@ import xpt.providers.ValidationDecoratorProvider
org.eclipse.emf.transaction.TransactionalEditingDomain txDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view);
«xptValidationProvider.qualifiedClassName(it)».runWithConstraints(txDomain, new Runnable() {
+ «overrideI»
public void run() {
validate(fpart, fview);
}
@@ -174,6 +194,7 @@ import xpt.providers.ValidationDecoratorProvider
if (target.isSetElement() && target.getElement() != null) {
return new org.eclipse.emf.ecore.util.Diagnostician() {
+ «overrideC»
public String getObjectLabel(org.eclipse.emf.ecore.EObject eObject) {
return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(eObject, true);
}
@@ -242,9 +263,10 @@ import xpt.providers.ValidationDecoratorProvider
}
final org.eclipse.core.runtime.IStatus rootStatus = validationStatus;
java.util.List allStatuses = new java.util.ArrayList();
- «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = new «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap(
- diagramEditPart.getDiagramView(),
- collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allStatuses));
+ «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = new «xptDiagramEditorUtil.
+ qualifiedClassName(it)».LazyElement2ViewMap(
+ diagramEditPart.getDiagramView(),
+ collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allStatuses));
for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) {
org.eclipse.emf.validation.model.IConstraintStatus nextStatus =
(org.eclipse.emf.validation.model.IConstraintStatus) it.next();
@@ -269,14 +291,14 @@ import xpt.providers.ValidationDecoratorProvider
return;
}
final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus;
- java.util.List allDiagnostics = new java.util.ArrayList();
+ java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics = new java.util.ArrayList<org.eclipse.emf.common.util.Diagnostic>();
«xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap =
new «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap(
diagramEditPart.getDiagramView(),
collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allDiagnostics));
- for (java.util.Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
- org.eclipse.emf.common.util.Diagnostic nextDiagnostic = (org.eclipse.emf.common.util.Diagnostic) it.next();
- java.util.List data = nextDiagnostic.getData();
+ for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.emf.common.util.Diagnostic nextDiagnostic = it.next();
+ java.util.List<?> data = nextDiagnostic.getData();
if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0);
org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView(
@@ -331,10 +353,10 @@ import xpt.providers.ValidationDecoratorProvider
«generatedMemberComment»
private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.core.runtime.IStatus status,
- java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List allConstraintStatuses) {
+ java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.validation.model.IConstraintStatus> allConstraintStatuses) {
if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) {
targetElementCollector.add(((org.eclipse.emf.validation.model.IConstraintStatus) status).getTarget());
- allConstraintStatuses.add(status);
+ allConstraintStatuses.add((org.eclipse.emf.validation.model.IConstraintStatus)status);
}
if (status.isMultiStatus()) {
org.eclipse.core.runtime.IStatus[] children = status.getChildren();
@@ -350,19 +372,18 @@ import xpt.providers.ValidationDecoratorProvider
«generatedMemberComment»
private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic,
- java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List allDiagnostics) {
- java.util.List data = diagnostic.getData();
+ java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics) {
+ java.util.List<?> data = diagnostic.getData();
org.eclipse.emf.ecore.EObject target = null;
if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
- target = (org.eclipse.emf.ecore.EObject) data.get(0);
- targetElementCollector.add(target);
- allDiagnostics.add(diagnostic);
+ target = (org.eclipse.emf.ecore.EObject) data.get(0);
+ targetElementCollector.add(target);
+ allDiagnostics.add(diagnostic);
}
if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
- for (java.util.Iterator it = diagnostic.getChildren().iterator(); it.hasNext();) {
- collectTargetElements((org.eclipse.emf.common.util.Diagnostic) it.next(),
- targetElementCollector, allDiagnostics);
- }
+ for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) {
+ collectTargetElements(it.next(), targetElementCollector, allDiagnostics);
+ }
}
return targetElementCollector;
}
@@ -381,5 +402,4 @@ import xpt.providers.ValidationDecoratorProvider
@Localization def String i18nKeyForValidateAction(GenDiagram diagram) {
return className(diagram).toString
}
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend
index 73991678caf..c10c66c8865 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #372479, #386838
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #372479, #386838
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
@@ -36,7 +36,6 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExpressionInterpreter
import xpt.diagram.updater.Utils_qvto
import xpt.CodeStyle
import xpt.diagram.editpolicies.LinkUtils_qvto
-import plugin.Activator
//XXX: [MG] decide what to do with @MetaDef methods
@com.google.inject.Singleton class VisualIDRegistry {
@@ -44,8 +43,8 @@ import plugin.Activator
@Inject extension Common_qvto;
@Inject extension Utils_qvto;
@Inject extension LinkUtils_qvto;
+ @Inject extension MetaModel;
- @Inject Activator xptActivator
@Inject CodeStyle xptCodeStyle;
@Inject MetaModel xptMetaModel;
@Inject xpt.expressions.getExpression xptGetExpression;
@@ -99,7 +98,7 @@ import plugin.Activator
@MetaDef def getLinkWithClassVisualIDMethodName(GenDiagram it) '''getLinkWithClassVisualID'''
- @MetaDef def domainElementConstraintMethodName(GenCommonBase it) '''is«getUniqueIdentifier()»'''
+ @MetaDef def domainElementConstraintMethodName(GenCommonBase it) '''is«stringUniqueIdentifier()»'''
@MetaDef def checkNodeVisualIDMethodName(GenDiagram it) '''checkNodeVisualID'''
@@ -210,7 +209,7 @@ import plugin.Activator
def getViewVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
+ public static String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
if (view instanceof org.eclipse.gmf.runtime.notation.Diagram) {
if («modelID(it)».equals(view.getType())) {
return «visualID(it)»;
@@ -229,7 +228,7 @@ import plugin.Activator
while (view != diagram) {
org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «nonNLS(1)»
if (annotation != null) {
- return (String) annotation.getDetails().get("modelID"); «nonNLS(1)»
+ return annotation.getDetails().get("modelID"); «nonNLS(1)»
}
view = (org.eclipse.gmf.runtime.notation.View) view.eContainer();
}
@@ -239,35 +238,25 @@ import plugin.Activator
def getVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getVisualIdMethodName(it)»(String type) {
- try {
- return Integer.parseInt(type);
- } catch (NumberFormatException e) {
- if (Boolean.TRUE.toString().equalsIgnoreCase(org.eclipse.core.runtime.Platform.getDebugOption(DEBUG_KEY))) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to parse view type as a visualID number: " + type);
- }
- }
- «unrecognizedVID(it)»
+ public static String «getVisualIdMethodName(it)»(String type) {
+ return type;
}
'''
def getType(GenDiagram it) '''
«generatedMemberComment()»
- public static String «getTypeMethodName(it)»(int visualID) {
- return Integer.toString(visualID);
+ public static String «getTypeMethodName(it)»(String visualID) {
+ return visualID;
}
'''
def getDiagramVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
+ public static String «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
if (domainElement == null) {
«unrecognizedVID(it)»
}
- «IF null != domainDiagramElement»
- «returnVisualID(it)»
- «ENDIF»
- «unrecognizedVID(it)»
+ return «visualID(it)»;
}
'''
@@ -288,7 +277,23 @@ import plugin.Activator
def checkDomainElementMetaclass(GenClass it) '''«xptMetaModel.MetaClass(it)».isSuperTypeOf(domainElement.eClass())'''
def checkDomainElementConstraints(TypeModelFacet it, GenCommonBase commonBase)
- '''«IF null != modelElementSelector» && «domainElementConstraintMethodName(commonBase)»(«xptMetaModel.CastEObject(metaClass, 'domainElement')»)«ENDIF»'''
+ '''
+««« «IF null != modelElementSelector»
+««« //«it.eContainer»
+««« //->«modelElementSelector»
+««« «ENDIF»
+ ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
+ «IF null != modelElementSelector»
+ «IF commonBase instanceof GenLink || !(modelElementSelector.provider instanceof GenJavaExpressionProvider)»
+ ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
+ && «domainElementConstraintMethodName(commonBase)»(«CastEObject(metaClass,'domainElement')»)
+ ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
+ «ELSE»
+ && «domainElementConstraintMethodName(commonBase)»(containerView, «CastEObject(metaClass, 'domainElement')»)
+ «ENDIF»
+ «ENDIF»
+ ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
+ '''
def dispatch checkSemanticElement(LinkModelFacet it, GenLink genLink) '''«ERROR('checkSemanticElement is supported only for TypeLinkModelFacet: ' + it)»'''
def dispatch checkSemanticElement(TypeLinkModelFacet it, GenLink genLink) '''«checkDomainElementMetaclass(metaClass)»«checkDomainElementConstraints(it, genLink)»'''
@@ -296,7 +301,7 @@ import plugin.Activator
def getNodeVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
+ public static String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
if (domainElement == null) {
«unrecognizedVID(it)»
}
@@ -304,7 +309,7 @@ import plugin.Activator
if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)»
«unrecognizedVID(it)»
}
- int containerVisualID;
+ String containerVisualID;
if («modelID(it)».equals(containerModelID)) {
containerVisualID = «getVisualIDMethodCall(it)»(containerView);
} else {
@@ -314,10 +319,12 @@ import plugin.Activator
«unrecognizedVID(it)»
}
}
- switch (containerVisualID) {
- «FOR container : allContainers»
- «caseDomainContainerVisualID(container)»
- «ENDFOR»
+ if (containerVisualID != null) {
+ switch (containerVisualID) {
+ «FOR container : allContainers»
+ «caseDomainContainerVisualID(container)»
+ «ENDFOR»
+ }
}
«unrecognizedVID(it)»
}
@@ -333,12 +340,12 @@ import plugin.Activator
def canCreateNode(GenDiagram it) '''
«generatedMemberComment()»
- public static boolean «canCreateNodeMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, int nodeVisualID) {
+ public static boolean «canCreateNodeMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, String nodeVisualID) {
String containerModelID = «getModelIDMethodCall(it)»(containerView);
if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)»
return false;
}
- int containerVisualID;
+ String containerVisualID;
if («modelID(it)».equals(containerModelID)) {
containerVisualID = «getVisualIDMethodCall(it)»(containerView);
} else {
@@ -348,9 +355,11 @@ import plugin.Activator
return false;
}
}
- switch (containerVisualID) {
- «FOR container : allContainers.filter[e|getEssentialVisualChildren(e).notEmpty]»«checkEssentialChildren(container)»«ENDFOR»
- «FOR link : links.filter[l|getEssentialVisualChildren(l).notEmpty]»«checkEssentialChildren(link)»«ENDFOR»
+ if (containerVisualID != null) {
+ switch (containerVisualID) {
+ «FOR container : allContainers.filter[e|getEssentialVisualChildren(e).notEmpty]»«checkEssentialChildren(container)»«ENDFOR»
+ «FOR link : links.filter[l|getEssentialVisualChildren(l).notEmpty]»«checkEssentialChildren(link)»«ENDFOR»
+ }
}
return false;
}
@@ -365,14 +374,14 @@ import plugin.Activator
'''
def checkEssentialChild(GenCommonBase it) '''
- if («visualID(it)» == nodeVisualID) {
+ if («visualID(it)».equals(nodeVisualID)) {
return true;
}
'''
def getLinkWithClassVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getLinkWithClassVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
+ public static String «getLinkWithClassVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
if (domainElement == null) {
«unrecognizedVID(it)»
}
@@ -402,12 +411,14 @@ import plugin.Activator
* FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator)
*/
def constraintMethods(GenDiagram it) '''
- «IF null != editorGen.expressionProviders»
- «FOR topNode : topLevelNodes.filter[n | n.modelFacet.modelElementSelector != null]»«constraintMethod(topNode)»«ENDFOR»
- «FOR childNode : childNodes.filter[n | n.modelFacet.modelElementSelector != null]»«constraintMethod(childNode)»«ENDFOR»
- «FOR link : links»«constraintMethod(link.modelFacet, link)»«ENDFOR»
- «ENDIF»
- '''
+ «IF null != editorGen.expressionProviders»
+ «FOR topNode : topLevelNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod(
+ topNode)»«ENDFOR»
+ «FOR childNode : childNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod(
+ childNode)»«ENDFOR»
+ «FOR link : links.filter[n|!n.sansDomain]»«constraintMethod(link.modelFacet, link)»«ENDFOR»
+ «ENDIF»
+ '''
def constraintMethod(GenNode it)
'''«domainElementConstraintMethod(modelFacet.modelElementSelector.provider, it, modelFacet.modelElementSelector, modelFacet.metaClass)»'''
@@ -421,18 +432,27 @@ import plugin.Activator
'''«ERROR('Constraint method is not supported for ' + it)»'''
def dispatch domainElementConstraintMethod(GenJavaExpressionProvider it, GenCommonBase diagramElement, ValueExpression expression, GenClass context) '''
- «generatedMemberComment()»
- private static boolean «domainElementConstraintMethodName(diagramElement)»(«xptMetaModel.QualifiedClassName(context)» domainElement) {
- «IF injectExpressionBody && (expression.body != null && !expression.body.empty)»
+ «generatedMemberComment»
+ ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
+ «IF diagramElement instanceof GenLink»
+ ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
+ private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) {
+ ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
+ «ELSE»
+ private static boolean «domainElementConstraintMethodName(diagramElement)»(org.eclipse.gmf.runtime.notation.View containerView, «QualifiedClassName(
+ context)» domainElement) {
+ «ENDIF»
+ ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
+ «IF injectExpressionBody && (expression.body != null && expression.body.length() != 0)»
«expression.body»
- «ELSEIF throwException || (injectExpressionBody && (expression.body == null || expression.body.empty))»
+ «ELSEIF throwException || (injectExpressionBody && (expression.body == null || expression.body.length() == 0))»
// FIXME: implement this method
// Ensure that you remove @generated or mark it @generated NOT
- throw new java.lang.UnsupportedOperationException("No java implementation provided in '«domainElementConstraintMethodName(diagramElement)»' operation");«nonNLS(1)»
+ throw new java.lang.UnsupportedOperationException("No java implementation provided in '« domainElementConstraintMethodName(diagramElement)»' operation");«nonNLS»
«ELSE»
return false;
«ENDIF»
- }
+ }
'''
// FIXME move these methods to ElementInitializers or any other more suitable place
@@ -447,31 +467,31 @@ import plugin.Activator
def unrecognizedVID(GenDiagram it) '''
- return -1;
+ return "";
'''
def checkNodeVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, int candidate) {
- if (candidate == -1){
+ public static boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) {
+ if (candidate == null){
//unrecognized id is always bad
return false;
}
- int basic = «getNodeVisualIDMethodName(it)»(containerView, domainElement);
- return basic == candidate;
+ String basic = «getNodeVisualIDMethodName(it)»(containerView, domainElement);
+ return candidate.equals(basic);
}
'''
def isCompartmentVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static boolean «isCompartmentVisualIDMethodName(it)»(int visualID) {
+ public static boolean «isCompartmentVisualIDMethodName(it)»(String visualID) {
«IF compartments.notEmpty»
- switch (visualID) {
- «FOR compartment : compartments»«caseVisualID(compartment)»«ENDFOR»
- return true;
- default:
- break;
+ if (visualID != null) {
+ switch (visualID) {
+ «FOR compartment : compartments»«caseVisualID(compartment)»«ENDFOR»
+ return true;
+ }
}
«ENDIF»
return false;
@@ -482,17 +502,17 @@ import plugin.Activator
var leafs = it.allNodes.filter[n | getSemanticChildren(n).empty && n.compartments.forall[c | getSemanticChildren(c).empty]].sortBy[n|n.visualID]
return '''
«generatedMemberComment()»
- public static boolean «isSemanticLeafVisualIDMethodName(it)»(int visualID) {
- switch (visualID) {
- «/*We need to ensure at last one case, this is legitimate way*/
- caseVisualID(it)»
- return false;
- «IF leafs.notEmpty»
- «FOR leaf : leafs»«caseVisualID(leaf)»«ENDFOR»
- return true;
- «ENDIF»
- default:
- break;
+ public static boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) {
+ if (visualID != null) {
+ switch (visualID) {
+ «/*We need to ensure at last one case, this is legitimate way*/
+ caseVisualID(it)»
+ return false;
+ «IF leafs.notEmpty»
+ «FOR leaf : leafs»«caseVisualID(leaf)»«ENDFOR»
+ return true;
+ «ENDIF»
+ }
}
return false;
}
@@ -501,40 +521,40 @@ import plugin.Activator
def runtimeTypedInstance(GenDiagram it) '''
«generatedClassComment()»
- public static final org.eclipse.gmf.tooling.runtime.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.gmf.tooling.runtime.structure.DiagramStructure() {
+ public static final org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure() {
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public int «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
+ «xptCodeStyle.overrideC(it)»
+ public String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
return «getVisualIDMethodCall(it)»(view);
}
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
+ «xptCodeStyle.overrideC(it)»
public String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
return «getModelIDMethodCall(it)»(view);
}
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public int «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
+ «xptCodeStyle.overrideC(it)»
+ public String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
return «getNodeVisualIDMethodCall(it)»(containerView, domainElement);
}
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, int candidate) {
+ «xptCodeStyle.overrideC(it)»
+ public boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) {
return «checkNodeVisualIDMethodCall(it)»(containerView, domainElement, candidate);
}
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public boolean «isCompartmentVisualIDMethodName(it)»(int visualID) {
+ «xptCodeStyle.overrideC(it)»
+ public boolean «isCompartmentVisualIDMethodName(it)»(String visualID) {
return «isCompartmentVisualIDMethodCall(it)»(visualID);
}
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public boolean «isSemanticLeafVisualIDMethodName(it)»(int visualID) {
+ «xptCodeStyle.overrideC(it)»
+ public boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) {
return «isSemanticLeafVisualIDMethodCall(it)»(visualID);
}
};
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/extensions.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/extensions.xtend
index d5085124717..4774b89bb3b 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/extensions.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/extensions.xtend
@@ -1,48 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
import xpt.Common
-@com.google.inject.Singleton class extensions {
+@Singleton class extensions {
@Inject extension Common;
- @Inject MatchingStrategy xptMatching;
- @Inject ActionBarContributor xptActionBarContributor;
- @Inject Editor xptEditor;
- @Inject CreationWizard xptCreationWizard;
- @Inject InitDiagramFileAction xptInitDiagramFileAction;
def extensions(GenEditorGenerator it) '''
«extraLineBreak»
- «tripleSpace(1)»<extension point="org.eclipse.ui.editors" id="gmf-editor">
- «tripleSpace(2)»«xmlGeneratedTag()»
- «tripleSpace(2)»<editor
- «tripleSpace(3)»id="«editor.ID»"
- «tripleSpace(3)»name="%editorName"
- «tripleSpace(3)»icon="«editor.iconPathX»"
- «tripleSpace(3)»extensions="«diagramFileExtension»"
- «tripleSpace(3)»default="true"
- «tripleSpace(3)»class="«xptEditor.qualifiedClassName(editor)»"
- «tripleSpace(3)»matchingStrategy="«xptMatching.qualifiedClassName(diagram)»"
- «tripleSpace(3)»contributorClass="«xptActionBarContributor.qualifiedClassName(editor)»">
- «tripleSpace(2)»</editor>
- «tripleSpace(1)»</extension>
+ ««« YT (not used):
+ ««« «tripleSpace(1)»<extension point="org.eclipse.ui.editors" id="gmf-editor">
+ ««« «tripleSpace(2)»«xmlGeneratedTag()»
+ ««« «tripleSpace(2)»<editor
+ ««« «tripleSpace(3)»id="«editor.ID»"
+ ««« «tripleSpace(3)»name="%editorName"
+ ««« «tripleSpace(3)»icon="«editor.iconPathX»"
+ ««« «tripleSpace(3)»extensions="«diagramFileExtension»"
+ ««« «tripleSpace(3)»default="true"
+ ««« «tripleSpace(3)»class="«xptEditor.qualifiedClassName(editor)»"
+ ««« «tripleSpace(3)»matchingStrategy="«xptMatching.qualifiedClassName(diagram)»"
+ ««« «tripleSpace(3)»contributorClass="«xptActionBarContributor.qualifiedClassName(editor)»">
+ ««« «tripleSpace(2)»</editor>
+ ««« «tripleSpace(1)»</extension>
+
«extraLineBreak»«outTab»
«tripleSpace(1)»<extension point="org.eclipse.ui.contexts" id="ui-context">
«tripleSpace(2)»«xmlGeneratedTag()»
@@ -54,53 +52,55 @@ import xpt.Common
«tripleSpace(2)»</context>
«tripleSpace(1)»</extension>
- «tripleSpace(1)»<extension point="org.eclipse.ui.newWizards" id="creation-wizard">
- «tripleSpace(2)»«xmlGeneratedTag()»
- «tripleSpace(2)»<wizard
- «tripleSpace(3)»name="%newWizardName"
- «tripleSpace(3)»icon="«diagram.creationWizardIconPathX»"
- «tripleSpace(3)»category="«diagram.creationWizardCategoryID»"
- «tripleSpace(3)»class="«xptCreationWizard.qualifiedClassName(diagram)»"
- «tripleSpace(3)»id="«xptCreationWizard.qualifiedClassName(diagram)»ID">
- «tripleSpace(3)»<description>%newWizardDesc</description>
- «tripleSpace(2)»</wizard>
- «tripleSpace(1)»</extension>
-
- «IF diagram.generateInitDiagramAction()»
- «IF null == application»
- «tripleSpace(1)»<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action">
- «tripleSpace(2)»«xmlGeneratedTag()»
- «tripleSpace(2)»<objectContribution
- «tripleSpace(4)»id="«plugin.ID».InitDiagram"
- «tripleSpace(4)»nameFilter="*.«domainFileExtension»"
- «tripleSpace(4)»objectClass="org.eclipse.core.resources.IFile">
- «tripleSpace(3)»<action
- «tripleSpace(5)»label="%initDiagramActionLabel"
- «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»"
- «tripleSpace(5)»menubarPath="additions"
- «tripleSpace(5)»enablesFor="1"
- «tripleSpace(5)»id="«plugin.ID».InitDiagramAction">
- «tripleSpace(3)»</action>
- «tripleSpace(2)»</objectContribution>
- «tripleSpace(1)»</extension>
- «ELSE»
- «tripleSpace(1)»<extension point="org.eclipse.ui.actionSets" id="init-diagram-action">
- «tripleSpace(2)»«xmlGeneratedTag()»
- «tripleSpace(2)»<actionSet
- «tripleSpace(4)»label="%initDiagramActionLabel"
- «tripleSpace(4)»visible="true"
- «tripleSpace(4)»id="«plugin.ID».InitDiagram">
- «tripleSpace(3)»<action
- «tripleSpace(5)»label="%initDiagramActionLabel"
- «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»"
- «tripleSpace(5)»menubarPath="file/additions"
- «tripleSpace(5)»id="«plugin.ID».InitDiagramAction">
- «tripleSpace(3)»</action>
- «tripleSpace(2)»</actionSet>
- «tripleSpace(1)»</extension>
- «ENDIF»
- «extraLineBreak» «tripleSpace(1)»
- «ENDIF»
+ ««« YT (not used):
+ ««« «tripleSpace(1)»<extension point="org.eclipse.ui.newWizards" id="creation-wizard">
+ ««« «tripleSpace(2)»«xmlGeneratedTag()»
+ ««« «tripleSpace(2)»<wizard
+ ««« «tripleSpace(3)»name="%newWizardName"
+ ««« «tripleSpace(3)»icon="«diagram.creationWizardIconPathX»"
+ ««« «tripleSpace(3)»category="«diagram.creationWizardCategoryID»"
+ ««« «tripleSpace(3)»class="«xptCreationWizard.qualifiedClassName(diagram)»"
+ ««« «tripleSpace(3)»id="«xptCreationWizard.qualifiedClassName(diagram)»ID">
+ ««« «tripleSpace(3)»<description>%newWizardDesc</description>
+ ««« «tripleSpace(2)»</wizard>
+ ««« «tripleSpace(1)»</extension>
+ «««
+ ««« «IF diagram.generateInitDiagramAction()»
+ ««« «IF null == application»
+ ««« «tripleSpace(1)»<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action">
+ ««« «tripleSpace(2)»«xmlGeneratedTag()»
+ ««« «tripleSpace(2)»<objectContribution
+ ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram"
+ ««« «tripleSpace(4)»nameFilter="*.«domainFileExtension»"
+ ««« «tripleSpace(4)»objectClass="org.eclipse.core.resources.IFile">
+ ««« «tripleSpace(3)»<action
+ ««« «tripleSpace(5)»label="%initDiagramActionLabel"
+ ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»"
+ ««« «tripleSpace(5)»menubarPath="additions"
+ ««« «tripleSpace(5)»enablesFor="1"
+ ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction">
+ ««« «tripleSpace(3)»</action>
+ ««« «tripleSpace(2)»</objectContribution>
+ ««« «tripleSpace(1)»</extension>
+ ««« «ELSE»
+ ««« «tripleSpace(1)»<extension point="org.eclipse.ui.actionSets" id="init-diagram-action">
+ ««« «tripleSpace(2)»«xmlGeneratedTag()»
+ ««« «tripleSpace(2)»<actionSet
+ ««« «tripleSpace(4)»label="%initDiagramActionLabel"
+ ««« «tripleSpace(4)»visible="true"
+ ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram">
+ ««« «tripleSpace(3)»<action
+ ««« «tripleSpace(5)»label="%initDiagramActionLabel"
+ ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»"
+ ««« «tripleSpace(5)»menubarPath="file/additions"
+ ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction">
+ ««« «tripleSpace(3)»</action>
+ ««« «tripleSpace(2)»</actionSet>
+ ««« «tripleSpace(1)»</extension>
+ ««« «ENDIF»
+ ««« «extraLineBreak» «tripleSpace(1)»
+ ««« «ENDIF»
+ «««
'''
def outTab() {
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/PaletteConfiguration.xtend
index cc990d637bc..5c5163696c4 100644
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/PaletteConfiguration.xtend
@@ -12,7 +12,7 @@
* Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation
*
*****************************************************************************/
-package aspects.xpt.editor.palette
+package xpt.editor.palette
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/PaletteFactory.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/PaletteFactory.xtend
index 6e5c8bc5def..98d09ce5605 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/PaletteFactory.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/PaletteFactory.xtend
@@ -1,42 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor.palette
import com.google.inject.Inject
-import java.util.Map
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.AbstractToolEntry
-import org.eclipse.papyrus.gmf.codegen.gmfgen.EntryBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.Palette
+import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
+import xpt.Common
+import xpt.Common_qvto
+import xpt.providers.ElementTypes
+import java.util.Map
+import org.eclipse.papyrus.gmf.codegen.gmfgen.EntryBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.Separator
import org.eclipse.papyrus.gmf.codegen.gmfgen.StandardEntry
import org.eclipse.papyrus.gmf.codegen.gmfgen.StandardEntryKind
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolGroup
import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolGroupItem
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
-import xpt.Common
-import xpt.Common_qvto
import xpt.Externalizer
-import xpt.providers.ElementTypes
-
-@com.google.inject.Singleton class PaletteFactory {
+@Singleton class PaletteFactory {
@Inject extension Common;
@Inject extension Common_qvto;
@Inject extension Utils_qvto;
-
@Inject ElementTypes xptElementTypes;
@Inject Externalizer xptExternalizer;
@@ -53,35 +52,36 @@ import xpt.providers.ElementTypes
def PaletteFactory(Palette it) '''
«copyright(diagram.editorGen)»
- package «packageName(it)»;
+ package «packageName»;
«generatedClassComment»
- public class «className(it)» {
+ public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter {
+ //RS: New Palette generation
- «generatedMemberComment»
- public void fillPalette(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
- «IF definesStandardTools()»
- cleanStandardTools(paletteRoot);
- «ENDIF»
- «FOR group : it.groups»
- «addEntry(group, 'paletteRoot')»
- «ENDFOR»
+ //Generates the ID for the tool elements
+ //Generate the tool factory (if(ID) createtool...)
+ «FOR tool : collectTools(it)»
+ «generateIDAttribute(tool)»
+ «ENDFOR»
+
+ «««Generates the default constructor
+ «generatedMemberComment»
+ public «factoryClassName»() {
+
}
+
+ «««Generates the main method to create tool
+ «generateCreateTool(it)»
- «IF it.definesStandardTools»
- «cleanStandardToolsHack(it)»
- «ENDIF»
+ «««Generates the main method to create template
+ «generateGetTemplate(it)»
+
+ «««Generates each method for tool creation
- «FOR group : collectGroups(it)»
- «createGroup(group)»
- «ENDFOR»
«FOR tool : collectTools(it)»
- «createEntry(tool)»
+ «createTool(tool)»
«ENDFOR»
- «IF needsNodeToolEntryClass(it) && shouldGenerateToolEntryClasses()»«nodeToolEntry(it)»«ENDIF»
- «IF needsLinkToolEntryClass(it) && shouldGenerateToolEntryClasses()»«linkToolEntry(it)»«ENDIF»
- «additions(it)»
}
'''
@@ -363,4 +363,57 @@ import xpt.providers.ElementTypes
def additions(Palette it) ''''''
+
+ def generateCreateTool(Palette it) '''
+ «generatedMemberComment»
+ public org.eclipse.gef.Tool createTool(String toolId) {
+ «FOR tool : collectTools(it)»
+ «checkToolID(tool)»
+ «ENDFOR»
+ // default return: null
+ return null;
+ }
+ '''
+
+ def checkToolID(AbstractToolEntry it) '''
+ if (toolId.equals(«getConstantIDName(id)»)) {
+ return «createMethodName»();
+ }
+ '''
+
+ def generateGetTemplate(Palette it) '''
+ «generatedMemberComment»
+ public Object getTemplate(String templateId) {
+
+ // default return: null
+ return null;
+ }
+ '''
+
+ def generateIDAttribute(AbstractToolEntry it) '''
+ «generatedMemberComment»
+ private final static String «getConstantIDName(id)» = «id»;«IF isQuoted(id,'"')»«nonNLS»«ENDIF»
+ '''
+
+ def createTool(AbstractToolEntry it) '''
+ «generatedMemberComment»
+ private org.eclipse.gef.Tool «createMethodName»() {
+ «newTool(it as ToolEntry, 'entry')»
+ }
+ '''
+
+ def newTool(ToolEntry it, String toolVarName) '''
+ «IF elements.isEmpty()»
+ «ERROR('no elements for tool generation (Palette)')»
+ «ELSE»
+ java.util.List<org.eclipse.gmf.runtime.emf.type.core.IElementType> types = new java.util.ArrayList<org.eclipse.gmf.runtime.emf.type.core.IElementType>(«elements.size»);
+ «FOR e : elements»
+ types.add(«xptElementTypes.accessElementType(e)»);
+ «ENDFOR»
+ ««« RS: modified tool creation to have stereotypes-aware tools
+ org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF it.genNodes.isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types);
+ return tool;
+ «ENDIF»
+ '''
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/Utils_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/Utils_qvto.xtend
index 48a5f72f460..86d9a51d84b 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/Utils_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/palette/Utils_qvto.xtend
@@ -1,31 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
+ * https://www.eclipse.org/legal/epl-2.0/
*
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Mickael ADAM (ALL4TEC) - mickael.adam@all4tec.net - Bug 510587
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.editor.palette
-import com.google.inject.Inject
-import java.util.Collection
+import com.google.inject.Singleton
+import org.eclipse.core.runtime.IPath
+import org.eclipse.core.runtime.Path
+import org.eclipse.emf.common.util.URI
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.emf.ecore.xmi.XMLResource
+import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl
import org.eclipse.papyrus.gmf.codegen.gmfgen.AbstractToolEntry
import org.eclipse.papyrus.gmf.codegen.gmfgen.Palette
import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry
+import org.eclipse.papyrus.infra.types.ExternallyRegisteredType
+import org.eclipse.papyrus.infra.types.MetamodelTypeConfiguration
+import org.eclipse.papyrus.infra.types.SpecializationTypeConfiguration
+import org.eclipse.papyrus.infra.types.core.IConfiguredHintedElementType
+import java.util.HashMap
+import org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl
+import com.google.inject.Inject
+import java.util.Collection
import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolGroup
import xpt.Common_qvto
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
import org.eclipse.papyrus.gmf.codegen.gmfgen.EntryBase
-@com.google.inject.Singleton class Utils_qvto {
+@Singleton class Utils_qvto {
@Inject extension Common_qvto;
def dispatch String activatorFQN(Palette palette) {
@@ -84,7 +99,9 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.EntryBase
}
def Iterable<AbstractToolEntry> collectTools(Palette palette) {
- return collectGroups(palette).map[g|g.entries.filter(typeof(AbstractToolEntry))].flatten
+ return collectGroups(palette).map[g|g.entries.filter(typeof(AbstractToolEntry))].flatten.filter [ tool |
+ isValidTool(tool)
+ ]
}
def boolean needsNodeToolEntryClass(Palette palette) {
@@ -95,4 +112,165 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.EntryBase
return collectTools(palette).filter(typeof(ToolEntry)).exists[e|e.genLinks.notEmpty]
}
+
+ def boolean isValidTool(AbstractToolEntry entry) {
+
+ if (entry instanceof ToolEntry) {
+ if (null != entry.qualifiedToolName && !entry.qualifiedToolName.empty) {
+ return true;
+ }
+
+ val links = (entry as ToolEntry).genLinks.size;
+ val nodes = (entry as ToolEntry).genNodes.size;
+ return nodes + links != 0;
+ } else {
+ return true;
+ }
+ }
+
+ def String getToolPath(String it) {
+ var String result = null
+
+ /** returns the '/' separator and then the id of the parent group path */
+ if (isQuoted(it, '"')) {
+ result = it.substring(1, it.length - 1)
+ } else {
+ result = it
+ }
+
+ return "/" + result;
+ }
+
+ def boolean isQuoted(String source, String quoteStr) {
+
+ if (quoteStr == null) {
+ return false;
+ }
+
+ return source.length() >= (quoteStr.length() * 2) && source.startsWith(quoteStr) && source.endsWith(quoteStr);
+
+ }
+
+ def getConstantIDName(String it) {
+ if (isQuoted(it, '"')) {
+ return getUpperAndUnderscoreString(it.substring(1, it.length() - 1))
+ } else {
+ return getUpperAndUnderscoreString(it)
+ }
+ }
+
+ def String getUpperAndUnderscoreString(String value) {
+ return value.toUpperCase.replace(".", "_")
+ }
+
+ /**
+ * The plateform protocol prefix.
+ */
+ var static String PLUGIN_PROTOCOL = "platform:/plugin/"
+
+ /**
+ * Retrieve the bundle id of a platform/plug-in path.
+ *
+ * @param initialValue
+ * The initial value from which the bundle has to be retrieved
+ * @param defaultValue
+ * The default bundle id value if bundle id not found
+ * @return the bundle id
+ */
+ def String retrieveBundleId(String initialValue, String defaultValue) {
+ var String result = null
+ if (initialValue.startsWith(PLUGIN_PROTOCOL)) {
+ var String tmp = initialValue.substring(PLUGIN_PROTOCOL.length())
+ var int bundleIdEndIndex = tmp.indexOf("/")
+ result = tmp.substring(0, bundleIdEndIndex)
+ } else {
+ result = defaultValue
+ }
+ return result
+ }
+
+ /**
+ * Retrieve the local path of a platform/plug-in path.
+ *
+ * @param initialValue
+ * the initial value from which the local path has to be retrieved
+ * @return the local path
+ */
+ def String retrieveLocalPath(String initialValue) {
+ var String result = ""
+ if (initialValue.startsWith(PLUGIN_PROTOCOL)) {
+ var String tmp = initialValue.substring(PLUGIN_PROTOCOL.length())
+ var int bundleIdEndIndex = tmp.indexOf("/")
+ result = tmp.substring(bundleIdEndIndex)
+ } else {
+ result = initialValue
+ }
+ return result
+ }
+
+ /**
+ * @return The relative path of the model's resource
+ *
+ * @param it
+ * the EObject to get the relative path
+
+ */
+ def String getRelativePath(EObject it) {
+ var String path = null;
+ var URI resourceURI = eResource().getURI()
+ if (resourceURI.isPlatformResource()) {
+ var String platformString = resourceURI.toPlatformString(true)
+ var IPath workspacePath = new Path(platformString)
+ workspacePath = workspacePath.removeFirstSegments(1)
+ workspacePath = workspacePath.removeLastSegments(1)
+ path = workspacePath.toString()
+ } else {
+ path = "model"
+ }
+ return path;
+ }
+
+ /**
+ * Get the href string for the elementTypeConfiguration model of the unique identifier.
+ */
+ def String getElementTypeConfHRef(String uniqueIdentifier, XMLResource resource) {
+
+ //Load element type registry
+ org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry.getInstance().getClass()
+
+ var String href = null
+ val type = ElementTypeRegistry.getInstance().getType(uniqueIdentifier)
+
+ if (type instanceof IConfiguredHintedElementType) {
+ val xmlHelper = new XMLHelperImpl(resource)
+ val options = new HashMap<Object, Object>()
+ //Set option to have platform:/ sheme instead of ../../..
+ options.put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware())
+ xmlHelper.options = options;
+ href = xmlHelper.getHREF(type.configuration as EObject)
+ }
+ return href;
+
+ }
+
+ /**
+ * Get the href string for the elementTypeConfiguration model of the unique identifier.
+ */
+ def String getConfigurationXsiType(String uniqueIdentifier, XMLResource resource) {
+ var String type = null
+ val eltype = ElementTypeRegistry.getInstance().getType(uniqueIdentifier)
+ if (eltype instanceof IConfiguredHintedElementType) {
+ var configuration = eltype.configuration
+ if (configuration instanceof SpecializationTypeConfiguration) {
+ type = "elementtypesconfigurations:SpecializationTypeConfiguration"
+ } else if (configuration instanceof MetamodelTypeConfiguration) {
+ type = "elementtypesconfigurations:MetamodelTypeConfiguration"
+ } else if (configuration instanceof ExternallyRegisteredType) {
+ type = "elementtypesconfigurations:ExternallyRegisteredType"
+ }
+ }
+ return type;
+
+ }
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/AbstractExpression.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/AbstractExpression.xtend
index 2ceacb9e9ca..9831ef48eb3 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/AbstractExpression.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/AbstractExpression.xtend
@@ -1,17 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2014 , 2021 Borland Software Corporation, Montages, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - API extracted to GMF-T runtime, migrated to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - API extracted to GMF-T runtime, migrated to Xtend2
+ * Anatoliy Tischenko - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.expressions
@@ -158,17 +159,33 @@ import plugin.Activator
return value;
}
if (Number.class.isAssignableFrom(targetWrapperClass)) {
- if (targetWrapperClass.equals(Byte.class)) return new Byte(num.byteValue());
- if (targetWrapperClass.equals(Integer.class)) return new Integer(num.intValue());
- if (targetWrapperClass.equals(Short.class)) return new Short(num.shortValue());
- if (targetWrapperClass.equals(Long.class)) return new Long(num.longValue());
- if (targetWrapperClass.equals(java.math.BigInteger.class)) return java.math.BigInteger.valueOf(num.longValue());
- if (targetWrapperClass.equals(Float.class)) return new Float(num.floatValue());
- if (targetWrapperClass.equals(Double.class)) return new Double(num.doubleValue());
- if (targetWrapperClass.equals(java.math.BigDecimal.class)) return new java.math.BigDecimal(num.doubleValue());
+ if (targetWrapperClass.equals(Byte.class)) {
+ return new Byte(num.byteValue());
+ }
+ if (targetWrapperClass.equals(Integer.class)) {
+ return new Integer(num.intValue());
+ }
+ if (targetWrapperClass.equals(Short.class)) {
+ return new Short(num.shortValue());
+ }
+ if (targetWrapperClass.equals(Long.class)) {
+ return new Long(num.longValue());
+ }
+ if (targetWrapperClass.equals(java.math.BigInteger.class)) {
+ return java.math.BigInteger.valueOf(num.longValue());
+ }
+ if (targetWrapperClass.equals(Float.class)) {
+ return new Float(num.floatValue());
+ }
+ if (targetWrapperClass.equals(Double.class)) {
+ return new Double(num.doubleValue());
+ }
+ if (targetWrapperClass.equals(java.math.BigDecimal.class)) {
+ return new java.math.BigDecimal(num.doubleValue());
+ }
}
return value;
}
'''
-}
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/AbstractNavigatorItem.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/AbstractNavigatorItem.xtend
index a16a94ec115..315fbf03ff4 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/AbstractNavigatorItem.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/AbstractNavigatorItem.xtend
@@ -1,26 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
+import xpt.Common import xpt.CodeStyle
-@com.google.inject.Singleton class AbstractNavigatorItem {
+@Singleton class AbstractNavigatorItem {
@Inject extension Common;
+ @Inject extension CodeStyle
def className(GenNavigator it) '''«it.abstractNavigatorItemClassName»'''
@@ -54,14 +56,18 @@ import xpt.Common
def registerAdapterFactory(GenNavigator it) '''
«generatedMemberComment()»
static {
+ @SuppressWarnings("rawtypes")
final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class };
final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() {
+ «overrideI(it.editorGen.diagram)»
public String getContributorId() {
return "«editorGen.plugin.ID»"; «nonNLS(1)»
}
};
org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+ «overrideI(it.editorGen.diagram)»
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof «qualifiedClassName(it)» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) {
return propertySheetPageContributor;
@@ -69,6 +75,8 @@ import xpt.Common
return null;
}
+ «overrideI(it.editorGen.diagram)»
+ @SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
return supportedTypes;
}
@@ -76,6 +84,7 @@ import xpt.Common
}
'''
+
def attributes(GenNavigator it) '''
«generatedMemberComment()»
private Object myParent;
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorContentProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorContentProvider.xtend
index 43b27ce617f..649c0fa5f0e 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorContentProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorContentProvider.xtend
@@ -1,26 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
import plugin.Activator
+import xpt.Common
-@com.google.inject.Singleton class DomainNavigatorContentProvider {
+@Singleton class DomainNavigatorContentProvider {
@Inject extension Common;
@Inject Activator xptActivator
@@ -108,7 +109,7 @@ import plugin.Activator
def wrapEObjects(GenNavigator it) '''
«generatedMemberComment()»
public Object[] wrapEObjects(Object[] objects, Object parentElement) {
- java.util.Collection result = new java.util.ArrayList();
+ java.util.Collection<«xptDomainNavigatorItem.qualifiedClassName(it)»> result = new java.util.ArrayList<«xptDomainNavigatorItem.qualifiedClassName(it)»>();
for (int i = 0; i < objects.length; i++) {
if (objects[i] instanceof org.eclipse.emf.ecore.EObject) {
result.add(new «xptDomainNavigatorItem.qualifiedClassName(it)»((org.eclipse.emf.ecore.EObject) objects[i], parentElement, myAdapterFctoryContentProvier));
@@ -119,5 +120,4 @@ import plugin.Activator
'''
def additions(GenNavigator it) ''''''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend
index 963f80d112b..e591cc8f8c4 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend
@@ -1,28 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
import com.google.inject.Inject
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
import xpt.Common
+import xpt.CodeStyle
@com.google.inject.Singleton class DomainNavigatorItem {
@Inject extension Common;
@Inject AbstractNavigatorItem xptAbstractNavigatorItem;
+ @Inject extension CodeStyle
def className(GenNavigator it) '''«it.domainNavigatorItemClassName»'''
@@ -64,9 +66,12 @@ import xpt.Common
def registerAdapterFactory(GenNavigator it) '''
«generatedMemberComment()»
static {
+ @SuppressWarnings("rawtypes")
final Class[] supportedTypes = new Class[] { org.eclipse.emf.ecore.EObject.class, org.eclipse.ui.views.properties.IPropertySource.class };
org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+ «overrideI(it.editorGen.diagram)»
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof «qualifiedClassName(it)») {
«qualifiedClassName(it)» domainNavigatorItem = («qualifiedClassName(it)») adaptableObject;
@@ -82,6 +87,8 @@ import xpt.Common
return null;
}
+ «overrideI(it.editorGen.diagram)»
+ @SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
return supportedTypes;
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorContentProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorContentProvider.xtend
index 00fbc36505a..8b351fe3813 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorContentProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorContentProvider.xtend
@@ -1,39 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Modified by Patrick Tessier (CEA LIST)
+ * Emilien Perico (Atos Origin) - update template for GMF 2.2 compliance
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.editor.VisualIDRegistry
import com.google.inject.Inject
-import xpt.Externalizer
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorChildReference
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
+import com.google.inject.Singleton
import org.eclipse.emf.codegen.util.CodeGenUtil
-import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorReferenceType
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorChildReference
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorReferenceType
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
+import org.eclipse.papyrus.gmf.codegen.xtend.annotations.Localization
+import xpt.CodeStyle
+import xpt.Common
+import xpt.Common_qvto
+import xpt.Externalizer
+import xpt.editor.VisualIDRegistry
-@com.google.inject.Singleton class NavigatorContentProvider {
- @Inject extension xpt.Common;
- @Inject extension xpt.Common_qvto;
- @Inject extension xpt.navigator.Utils_qvto;
-
+@Singleton class NavigatorContentProvider {
+ @Inject extension Common;
+ @Inject extension Common_qvto;
+ @Inject extension Utils_qvto;
+ @Inject extension CodeStyle
+
@Inject VisualIDRegistry xptVisualIDRegistry;
@Inject Externalizer xptExternalizer;
@Inject NavigatorGroup navigatorGroup;
@@ -58,6 +65,8 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
«attributes(it)»
«constructor(it)»
+
+ «genAllMethodNodeCase»
«iContentProvider(it)»
@@ -72,7 +81,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
«additions(it)»
}
'''
-
+
def attributes(GenNavigator it) '''
«generatedMemberComment()»
private static final Object[] EMPTY_ARRAY = new Object[0];
@@ -92,7 +101,6 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
def constructor(GenNavigator it) '''
«generatedMemberComment()»
- @SuppressWarnings({ "unchecked", "serial", "rawtypes" })
public «className(it)»() {
«initCommonAttributes(it)»
}
@@ -101,15 +109,23 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
def initCommonAttributes(GenNavigator it) '''
org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «createEditingDomain(it)»;
myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain;
- myEditingDomain.setResourceToReadOnlyMap(new java.util.HashMap() {
- public Object get(Object key) {
+ @SuppressWarnings("serial")
+ java.util.Map<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean> map = new java.util.HashMap<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean>() {
+
+ «overrideI(it.editorGen.diagram)»
+ public java.lang.Boolean get(java.lang.Object key) {
if (!containsKey(key)) {
- put(key, Boolean.TRUE);
+ if (key instanceof org.eclipse.emf.ecore.resource.Resource) {
+ put((org.eclipse.emf.ecore.resource.Resource) key, java.lang.Boolean.TRUE);
+ }
}
return super.get(key);
}
- });
+ };
+ myEditingDomain.setResourceToReadOnlyMap(map);
myViewerRefreshRunnable = new Runnable() {
+
+ «overrideI(it.editorGen.diagram)»
public void run() {
if (myViewer != null) {
myViewer.refresh();
@@ -117,17 +133,22 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
}
};
myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() {
+
+ «overrideC(it.editorGen.diagram)»
public void dispose() {
}
+ «overrideC(it.editorGen.diagram)»
public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
«processChanges(it)»
}
+ «overrideC(it.editorGen.diagram)»
public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
«processChanges(it)»
}
+ «overrideC(it.editorGen.diagram)»
public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
«processChanges(it)»
}
@@ -135,8 +156,13 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
'''
def processChanges(GenNavigator it) '''
- unloadAllResources();
- asyncRefresh();
+ for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
return true;
'''
@@ -166,8 +192,12 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
myWorkspaceSynchronizer.dispose();
myWorkspaceSynchronizer = null;
myViewerRefreshRunnable = null;
- myViewer = null;
- unloadAllResources();
+
+ for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource resource = it.next();
+ resource.unload();
+ }
+
((org.eclipse.emf.transaction.TransactionalEditingDomain) myEditingDomain).dispose();
myEditingDomain = null;
}
@@ -258,19 +288,18 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
def getFileChildren(GenNavigator it) '''
«var references = getChildReferencesFrom(it, null)»
«getFileResource(it)»
- java.util.ArrayList<«xptNavigatorItem.qualifiedClassName(it)»> result = new java.util.ArrayList<«xptNavigatorItem.qualifiedClassName(it)»>();
+ java.util.Collection<Object> result = new java.util.ArrayList<Object>();
«FOR groupName : getGroupNames(references)»
«initGroupVariables(groupName, it, references, 'file', null)»
«ENDFOR»
- java.util.ArrayList<org.eclipse.gmf.runtime.notation.View> topViews = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>(resource.getContents().size());
+ java.util.List<org.eclipse.gmf.runtime.notation.View> topViews = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>(resource.getContents().size());
for (org.eclipse.emf.ecore.EObject o : resource.getContents()) {
if (o instanceof org.eclipse.gmf.runtime.notation.View) {
topViews.add((org.eclipse.gmf.runtime.notation.View) o);
}
}
«FOR ref : references»
- «addNavigatorItemsPrefix(ref)»selectViewsByType(topViews, «getChildViewType(ref.child)»)«addNavigatorItemsSuffix(ref,
- 'file', false)»
+ «addNavigatorItemsPrefix(ref)»selectViewsByType(resource.getContents(), «getChildViewType(ref.child)»)«addNavigatorItemsSuffix(ref, 'file', false)»
«ENDFOR»
«FOR groupName : getGroupNames(references)»
«addGroups(groupName, references)»
@@ -317,32 +346,41 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
def getViewChildren(GenNavigator it) '''
«generatedMemberComment()»
private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) {
- switch («xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view)) {
- «FOR node : getNavigatorContainerNodes(it)»
- «caseNavigatorNode(node, it)»
- «ENDFOR»
+ String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view);
+ if (vid != null) {
+ switch (vid) {
+ ««« BEGIN: PapyrusGenCode
+ ««« Restructuration of the case
+ «FOR node : getNavigatorContainerNodes(it)»
+ «caseNavigatorNode(node, it)»
+ «ENDFOR»
+ «««BEGIN: PapyrusGenCode
+ }
}
return EMPTY_ARRAY;
}
'''
def utilityMethods(GenNavigator it) '''
- «generatedMemberComment()»
- private java.util.Collection<org.eclipse.gmf.runtime.notation.View> getLinksSourceByType(java.util.Collection<org.eclipse.gmf.runtime.notation.Edge> edges, String type) {
- java.util.LinkedList<org.eclipse.gmf.runtime.notation.View> result = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>();
- for (org.eclipse.gmf.runtime.notation.Edge nextEdge : edges) {
- org.eclipse.gmf.runtime.notation.View nextEdgeSource = nextEdge.getSource();
- if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
- result.add(nextEdgeSource);
- }
- }
- return result;
+ «IF getNavigatorContainerNodes(it).notEmpty»
+ «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;
}
- «generatedMemberComment()»
- private java.util.Collection<org.eclipse.gmf.runtime.notation.View> getLinksTargetByType(java.util.Collection<org.eclipse.gmf.runtime.notation.Edge> edges, String type) {
- java.util.LinkedList<org.eclipse.gmf.runtime.notation.View> result = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>();
- for (org.eclipse.gmf.runtime.notation.Edge nextEdge : edges) {
+ «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);
@@ -350,48 +388,50 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
}
return result;
}
-
- «generatedMemberComment()»
- private java.util.Collection<org.eclipse.gmf.runtime.notation.View> getOutgoingLinksByType(java.util.Collection<? extends org.eclipse.gmf.runtime.notation.View> nodes, String type) {
- java.util.LinkedList<org.eclipse.gmf.runtime.notation.View> result = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>();
- for (org.eclipse.gmf.runtime.notation.View nextNode : nodes) {
- result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
+ «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;
+ return result;
}
- «generatedMemberComment()»
- private java.util.Collection<org.eclipse.gmf.runtime.notation.View> getIncomingLinksByType(java.util.Collection<? extends org.eclipse.gmf.runtime.notation.View> nodes, String type) {
- java.util.LinkedList<org.eclipse.gmf.runtime.notation.View> result = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>();
- for (org.eclipse.gmf.runtime.notation.View nextNode : nodes) {
+ «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;
+ }
+ return result;
}
-
- «generatedMemberComment()»
- private java.util.Collection<org.eclipse.gmf.runtime.notation.View> getChildrenByType(java.util.Collection<? extends org.eclipse.gmf.runtime.notation.View> nodes, String type) {
- java.util.LinkedList<org.eclipse.gmf.runtime.notation.View> result = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>();
- for (org.eclipse.gmf.runtime.notation.View nextNode : nodes) {
+«««
+ «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;
}
- «generatedMemberComment()»
- private java.util.Collection<org.eclipse.gmf.runtime.notation.View> getDiagramLinksByType(java.util.Collection<org.eclipse.gmf.runtime.notation.Diagram> diagrams, String type) {
- java.util.ArrayList<org.eclipse.gmf.runtime.notation.View> result = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>();
- for (org.eclipse.gmf.runtime.notation.Diagram nextDiagram : diagrams) {
+ «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;
}
-
- // TODO refactor as static method
- «generatedMemberComment()»
- private java.util.Collection<org.eclipse.gmf.runtime.notation.View> selectViewsByType(java.util.Collection<org.eclipse.gmf.runtime.notation.View> views, String type) {
- java.util.ArrayList<org.eclipse.gmf.runtime.notation.View> result = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>();
- for (org.eclipse.gmf.runtime.notation.View nextView : views) {
+ «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);
}
@@ -399,20 +439,23 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
return result;
}
- «generatedMemberComment()»
- private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
- return «VisualIDRegistry::modelID(editorGen.diagram)».equals(«xptVisualIDRegistry.
- getModelIDMethodCall(editorGen.diagram)»(view));
- }
-
- «generatedMemberComment()»
- private java.util.Collection<«xptNavigatorItem.qualifiedClassName(it)»> createNavigatorItems(java.util.Collection<org.eclipse.gmf.runtime.notation.View> views, Object parent, boolean isLeafs) {
- java.util.ArrayList<«xptNavigatorItem.qualifiedClassName(it)»> result = new java.util.ArrayList<«xptNavigatorItem.qualifiedClassName(it)»>(views.size());
- for (org.eclipse.gmf.runtime.notation.View nextView : views) {
- result.add(new «xptNavigatorItem.qualifiedClassName(it)»(nextView, parent, isLeafs));
+ «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;
}
+ «ENDIF»
+
+ «generatedMemberComment()»
+ private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
+ return «VisualIDRegistry::modelID(editorGen.diagram)».equals(«xptVisualIDRegistry.
+ getModelIDMethodCall(editorGen.diagram)»(view));
+ }
+
+
«getForeignShortcuts(it)»
'''
@@ -420,11 +463,11 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
«IF editorGen.diagram.generateCreateShortcutAction() && getChildReferencesFrom(it, editorGen.diagram).notEmpty»
«generatedMemberComment()»
- private java.util.Collection<«xptNavigatorItem.qualifiedClassName(it)»> getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) {
- java.util.LinkedList<org.eclipse.gmf.runtime.notation.View> result = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>();
- for (java.util.Iterator<org.eclipse.gmf.runtime.notation.View> it = diagram.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = it.next();
- if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «nonNLS(1)»
+ 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) { «nonNLS»
result.add(nextView);
}
}
@@ -433,7 +476,16 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
«ENDIF»
'''
- def createEditingDomain(GenNavigator it) '''org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain()'''
+ def createEditingDomain(GenNavigator it) '''org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain()'''
+
+//BEGIN: PapyrusGenCode
+//Loop to call generator of each method
+def genAllMethodNodeCase(GenNavigator it)'''
+«FOR container :getNavigatorContainerNodes(it)»
+« caseMethodNodeNode(container,it) »
+«ENDFOR»
+
+'''
def initGroupVariables(String groupName, GenNavigator navigator, Iterable<GenNavigatorChildReference> references,
String parentVarName, GenCommonBase contextElement) '''
@@ -443,9 +495,9 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
'''
@Localization def String i18nKeyForGroup(String groupName, GenCommonBase contextElement) {
- return 'NavigatorGroupName.' + (if(null != contextElement) contextElement.uniqueIdentifier else 'File') + '.' +
- CodeGenUtil::validJavaIdentifier(groupName)
- }
+ return 'NavigatorGroupName.' + (if(null != contextElement) contextElement.stringUniqueIdentifier else 'File') + '.' +
+ CodeGenUtil::validJavaIdentifier(groupName)
+}
def addNavigatorItemsPrefix(GenNavigatorChildReference it) '''«IF isInsideGroup()»«CodeGenUtil::validJavaIdentifier(
groupName)».addChildren(«ELSE»result.addAll(«ENDIF»createNavigatorItems('''
@@ -469,36 +521,14 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
def dispatch getChildViewType(GenCommonBase it) '''«xptVisualIDRegistry.typeMethodCall(it)»'''
def caseNavigatorNode(GenCommonBase it, GenNavigator navigator) '''
-
- case «VisualIDRegistry::visualID(it)»: {
- java.util.LinkedList<«abstractNavigatorItem.qualifiedClassName(navigator)»> result = new java.util.LinkedList<«abstractNavigatorItem.
- qualifiedClassName(navigator)»>();
- «addForeignShortcuts(it)»
- «nailedDownVariable(it, 'sv', 'view')»
- «var references = getChildReferencesFrom(navigator, it)»
- «FOR groupName : getGroupNames(references)»
- «initGroupVariables(groupName, navigator, references, 'parentElement', it)»
- «ENDFOR»
- «IF references.notEmpty && references.map[r|r.findConnectionPaths()].flatten.notEmpty»
- java.util.Collection<org.eclipse.gmf.runtime.notation.View> connectedViews;
- «FOR reference : references»
- «FOR path : reference.findConnectionPaths()»
- «IF path.segments.notEmpty»
- connectedViews = «childrenMethodName(path.segments.head.from, reference.referenceType, path.segments.head)»(java.util.Collections.singleton(sv), «xptVisualIDRegistry.typeMethodCall(path.segments.head.to)»);
- «FOR segment : path.segments.drop(1)»
- connectedViews = «childrenMethodName(segment.from, reference.referenceType, segment)»(connectedViews, «xptVisualIDRegistry.typeMethodCall(segment.to)»);
- «ENDFOR»
- «ENDIF»
- «addNavigatorItemsPrefix(reference)»connectedViews«addNavigatorItemsSuffix(reference, 'parentElement',
- reference.referenceType != GenNavigatorReferenceType::CHILDREN_LITERAL)»
- «ENDFOR»
- «ENDFOR»
- «ENDIF»
- «FOR groupName : getGroupNames(references)»
- «addGroups(groupName, references)»
- «ENDFOR»
- return result.toArray();
- }
+
+ case «VisualIDRegistry::visualID(it)»: {
+ «««BEGIN: PapyrusGenCode
+ ««« this code has been modified to call directly submethods
+ //modification of the template to avoid mistake of 65kb.
+ return getViewChildrenFor«it.editPartClassName»(view, parentElement);
+ «««END: PapyrusGenCode
+ }
'''
def dispatch nailedDownVariable(GenCommonBase it, String varName, String expressionToCast) '''«/* NO-OP, all specific subclasses should be handled */»'''
@@ -564,4 +594,55 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorPathSegment
@Localization def internal_i18nValues(String groupName, GenCommonBase contextElement) '''«IF null != groupName»«xptExternalizer.
messageEntry(i18nKeyForGroup(groupName, contextElement), groupName)»«ENDIF»'''
+//END: PapyrusGenCode
+//BEGIN: PapyrusGenCode
+//this template has been modified to fixe bug generation by GMF framework.
+//Is avoid generated method that are greater than 64Kb
+def caseMethodNodeNode(GenCommonBase it, GenNavigator navigator) '''
+/**
+ *
+ *Papyrus Template
+ *this method is a modification of gmf code in order to avoid getViewChidreen() method becoming greater than 64kb.
+ *@generated
+**/
+private Object[] getViewChildrenFor«it.editPartClassName»(org.eclipse.gmf.runtime.notation.View view, Object parentElement){
+ java.util.Collection result = new java.util.ArrayList();
+ «addForeignShortcuts(it)»
+ «var _references = getChildReferencesFrom(navigator, it)»
+ «FOR groupNames : getGroupNames(_references)»
+ «initGroupVariables(groupNames,navigator, _references, 'parentElement', it)»
+ «ENDFOR»
+
+
+
+ «IF ! _references.empty»
+ «FOR referencesIterator : 1.._references.size»
+ «var reference = _references.get(referencesIterator-1)»
+ «IF ! reference.findConnectionPaths.empty»
+ «FOR pathsIterator : 1..reference.findConnectionPaths.size»
+ «var path = reference.findConnectionPaths.get(pathsIterator-1)»
+ «IF ! path.segments.empty»
+ «FOR segmentsIterator : 1..path.segments.size»
+ «var segment = path.segments.get(segmentsIterator-1)»
+ «IF referencesIterator==1 && pathsIterator==1 && segmentsIterator==1»java.util.Collection «ENDIF»
+ connectedViews = «childrenMethodName(segment.from,reference.referenceType, segment) »
+ («IF segmentsIterator==1»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF»
+ , «xptVisualIDRegistry.typeMethodCall(segment.to)»);
+
+ «ENDFOR»
+ «ENDIF»
+ «addNavigatorItemsPrefix(reference)»connectedViews«addNavigatorItemsSuffix(reference,'parentElement', reference.referenceType != GenNavigatorReferenceType.CHILDREN_LITERAL) »
+ «ENDFOR»
+ «ENDIF»
+ «ENDFOR»
+ «ENDIF»
+
+ «FOR groupNames : getGroupNames(_references)»
+ « addGroups(groupNames,_references) »
+ «ENDFOR»
+
+
+ return result.toArray();
+}
+'''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorGroup.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorGroup.xtend
index 1998481c826..508011021f5 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorGroup.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorGroup.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
@@ -19,7 +19,8 @@ import com.google.inject.Inject
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
import xpt.Common
-@com.google.inject.Singleton class NavigatorGroup {
+@com.google.inject.Singleton class NavigatorGroup{
+
@Inject extension Common;
def className(GenNavigator it) '''«it.navigatorGroupClassName»'''
@@ -71,7 +72,7 @@ import xpt.Common
private String myIcon;
«generatedMemberComment()»
- private java.util.Collection myChildren = new java.util.LinkedList();
+ private java.util.Collection<java.lang.Object> myChildren = new java.util.LinkedList<java.lang.Object>();
'''
def constructor(GenNavigator it) '''
@@ -104,9 +105,9 @@ import xpt.Common
}
'''
- def addChildren(GenNavigator it) '''
+ def addChildren(GenNavigator it) '''
«generatedMemberComment()»
- public void addChildren(java.util.Collection children) {
+ public void addChildren(java.util.Collection<java.lang.Object> children) {
myChildren.addAll(children);
}
'''
@@ -146,5 +147,4 @@ import xpt.Common
'''
def additions(GenNavigator it) ''''''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorItem.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorItem.xtend
index 31231570ee1..d608940264e 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorItem.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorItem.xtend
@@ -1,26 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
+import xpt.Common import xpt.CodeStyle
-@com.google.inject.Singleton class NavigatorItem {
+@Singleton class NavigatorItem {
+
@Inject extension Common;
+ @Inject extension CodeStyle
+
def className(GenNavigator it) '''«it.navigatorItemClassName»'''
@@ -60,16 +64,21 @@ import xpt.Common
def registerAdapterFactory(GenNavigator it) '''
«generatedMemberComment()»
static {
+ @SuppressWarnings("rawtypes")
final Class[] supportedTypes = new Class[] { org.eclipse.gmf.runtime.notation.View.class, org.eclipse.emf.ecore.EObject.class };
org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+ «overrideI(it.editorGen.diagram)»
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof «qualifiedClassName(it)» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) {
return ((«qualifiedClassName(it)») adaptableObject).getView();
}
return null;
}
-
+
+ «overrideI(it.editorGen.diagram)»
+ @SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
return supportedTypes;
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLabelProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLabelProvider.xtend
index d3c68988fe7..ea6a5568627 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLabelProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLabelProvider.xtend
@@ -1,17 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Modified by Patrick Tessier (CEA LIST)
+ * Emilien Perico (Atos Origin) - update template for GMF 2.2 compliance
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
@@ -284,7 +286,7 @@ import plugin.Activator
return «getTextMethodName(it)»(view);
'''
- @MetaDef def getTextMethodName(GenCommonBase it) '''get«getUniqueIdentifier()»Text'''
+ @MetaDef def getTextMethodName(GenCommonBase it) '''get«stringUniqueIdentifier»Text'''
def getTextMethod(GenCommonBase it) '''
«generatedMemberComment()»
@@ -361,7 +363,7 @@ import plugin.Activator
if (parser != null) {
return parser.getPrintString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(view.getElement() != null ? view.getElement() : view), org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE.intValue());
} else {
- «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("Parser was not found for label " + «visualID»); «nonNLS(1)»
+ «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("Parser was not found for label «stringVisualID»"); «nonNLS(1)»
«returnEmptyString()»
}
'''
@@ -371,9 +373,9 @@ import plugin.Activator
«IF null != genClass && null != genClass.labelFeature»
«xptMetaModel.DeclareAndAssign(genClass, 'domainModelElement', 'view.getElement()')»
if (domainModelElement != null) {
- return «IF !isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»«xptMetaModel.getFeatureValue(genClass.labelFeature, 'domainModelElement', genClass)»«IF !isStringFeature(genClass.labelFeature)»)«ENDIF»;
+ return «IF !isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»UMLLabelInternationalization.getInstance().getLabel(domainModelElement)«IF !isStringFeature(genClass.labelFeature)»)«ENDIF»;
} else {
- «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("No domain element for view with visualID = " + «visualID»); «nonNLS(1)»
+ «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("No domain element for view with visualID = «stringVisualID»"); «nonNLS(1)»
«returnEmptyString()»
}
«ELSE»
@@ -485,5 +487,4 @@ import plugin.Activator
def additions(GenNavigator it) ''''''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLinkHelper.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLinkHelper.xtend
index d24e36fd030..a3ec0778ff4 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLinkHelper.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorLinkHelper.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
@@ -63,7 +63,9 @@ import plugin.Activator
def findSelection(GenNavigator it) '''
«generatedMemberComment()»
public org.eclipse.jface.viewers.IStructuredSelection findSelection(org.eclipse.ui.IEditorInput anInput) {
+ «IF getDiagramTopReference(it) !=null»
«defineDiagramDocument(editorGen.plugin)»
+ «ENDIF»
«findSelectionBody(it)»
}
'''
@@ -73,7 +75,9 @@ import plugin.Activator
'''
def findSelectionBody(GenNavigator it) '''
+ «IF getDiagramTopReference(it) !=null»
«getDiagramSelection(getDiagramTopReference(it))»
+ «ENDIF»
return org.eclipse.jface.viewers.StructuredSelection.EMPTY;
'''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorSorter.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorSorter.xtend
index 67640cf5647..d0d15894c20 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorSorter.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/NavigatorSorter.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.navigator
@@ -70,12 +70,11 @@ import xpt.editor.VisualIDRegistry
return SHORTCUTS_CATEGORY;
}
«ENDIF»
- return «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(item.getView());
+ return «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(item.getView()).hashCode();
}
return GROUP_CATEGORY;
}
'''
def additions(GenNavigator it) ''''''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/ActivatorImpl.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/ActivatorImpl.xtend
index c36387ce6d3..0bcd2d81485 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/ActivatorImpl.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/ActivatorImpl.xtend
@@ -1,16 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2013, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Michael Golubev (Montages) - initial API and implementation
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Michael Golubev (Montages) - initial API and implementation
+ * Florian Noyrit - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.plugin
@@ -42,37 +43,39 @@ import xpt.providers.ElementInitializers
«generatedClassComment»
public class «xptActivator.className(it)» extends org.eclipse.ui.plugin.AbstractUIPlugin {
- «attrs»
- «constructor»
- «start»
+ «attrs(it)»
+ «constructor(it)»
+ «start(it)»
«stop(editorGen)»
- «getInstance»
- «createAdapterFactory(editorGen.diagram)»
- «fillItemProviderFactories(editorGen)»
- «getItemProvidersAdaptorFactory»
- «getItemImageDescriptor»
- «getBundleDescriptorImage»
- «findImageDescriptor»
- «getBundleImage»
- «getString»
+ «getInstance(it)»
+
+ «getPreferenceStore»
+
+ «getItemProvidersAdaptorFactory(it)»
+ «getItemImageDescriptor(it)»
+ «getBundleDescriptorImage(it)»
+ «findImageDescriptor(it)»
+ «getBundleImage(it)»
+ «getString(it)»
«documentProviderGetter(editorGen.diagram)»
«linkConstraint(editorGen.diagram)»
«initializerGetter(editorGen.diagram)»
«initializerSetter(editorGen.diagram)»
- «providersAccessMethods»
+ «providersAccessMethods(it)»
«logError(it)»
- «logInfo»
+ «logInfo(it)»
«getLogError(it)»
- «additions»
+ «additions(it)»
}
'''
+
def attrs(GenPlugin it)'''
«generatedMemberComment»
public static final String ID = "«ID»"; //$NON-NLS-1$
«generatedMemberComment»
- private org.eclipse.gmf.tooling.runtime.LogHelper myLogHelper;
+ private org.eclipse.papyrus.infra.core.log.LogHelper myLogHelper;
«generatedMemberComment»
public static final org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint DIAGRAM_PREFERENCES_HINT =
@@ -82,7 +85,7 @@ def attrs(GenPlugin it)'''
private static «xptActivator.className(it)» instance;
«generatedMemberComment»
- private org.eclipse.emf.edit.provider.ComposedAdapterFactory adapterFactory;
+ private org.eclipse.emf.common.notify.AdapterFactory adapterFactory;
«generatedMemberComment»
private «xptDocProvider.qualifiedClassName(editorGen.diagram)» documentProvider;
@@ -114,29 +117,31 @@ def start(GenPlugin it)'''
public void start(org.osgi.framework.BundleContext context) throws Exception {
super.start(context);
instance = this;
- myLogHelper = new org.eclipse.gmf.tooling.runtime.LogHelper(this);
+ myLogHelper = new org.eclipse.papyrus.infra.core.log.LogHelper(this);
org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
- adapterFactory = createAdapterFactory();
+ adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory();
+ «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer diagramPreferenceInitializer = new «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer();
+ diagramPreferenceInitializer.initializeDefaultPreferences();
+
}
'''
def stop(GenEditorGenerator it)'''
- «generatedMemberComment»
- public void stop(org.osgi.framework.BundleContext context) throws Exception {
- adapterFactory.dispose();
- adapterFactory = null;
- «IF diagram.links.exists(l| !l.sansDomain)»
- linkConstraints = null;
- «ENDIF»
- initializers = null;
- «IF expressionProviders != null»
- «FOR p : expressionProviders.providers.filter(typeof(GenExpressionInterpreter))»
- «p.language»Factory = null;
- «ENDFOR»
- «ENDIF»
- instance = null;
- super.stop(context);
- }
+ «generatedMemberComment»
+ public void stop(org.osgi.framework.BundleContext context) throws Exception {
+ adapterFactory = null;
+ «IF diagram.links.exists(l| !l.sansDomain)»
+ linkConstraints = null;
+ «ENDIF»
+ initializers = null;
+ «IF expressionProviders != null»
+ «FOR p : expressionProviders.providers.filter(typeof(GenExpressionInterpreter))»
+ «p.language»Factory = null;
+ «ENDFOR»
+ «ENDIF»
+ instance = null;
+ super.stop(context);
+ }
'''
def getInstance(GenPlugin it)'''
@@ -316,35 +321,35 @@ def providerSetter(GenExpressionInterpreter it)'''
'''
def logError(GenPlugin it)'''
- «generatedMemberComment»
- public void logError(String error) {
- getLogHelper().logError(error, null);
- }
+ «generatedMemberComment»
+ public void logError(String error) {
+ getLogHelper().warn(error);
+ }
+
+ «generatedMemberComment»
+ public void logError(String error, Throwable throwable) {
+ getLogHelper().error(error, throwable);
+ }
+ '''
- «generatedMemberComment»
- public void logError(String error, Throwable throwable) {
- getLogHelper().logError(error, throwable);
- }
-'''
-
def logInfo(GenPlugin it)'''
- «generatedMemberComment»
- public void logInfo(String message) {
- getLogHelper().logInfo(message, null);
- }
-
- «generatedMemberComment»
- public void logInfo(String message, Throwable throwable) {
- getLogHelper().logInfo(message, throwable);
- }
-'''
+ «generatedMemberComment»
+ public void logInfo(String message) {
+ getLogHelper().info(message);
+ }
+
+ «generatedMemberComment»
+ public void logInfo(String message, Throwable throwable) {
+ getLogHelper().error(message, throwable);
+ }
+ '''
def getLogError(GenPlugin it) '''
- «generatedMemberComment»
- public org.eclipse.gmf.tooling.runtime.LogHelper getLogHelper() {
- return myLogHelper;
- }
-'''
+ «generatedMemberComment»
+ public org.eclipse.papyrus.infra.core.log.LogHelper getLogHelper() {
+ return myLogHelper;
+ }
+ '''
// Perhaps, xpt:editor::Editor or some xpt::CommonCode would be better place for
// this accessor.
@@ -352,4 +357,15 @@ def getLogError(GenPlugin it) '''
def preferenceHintAccess(GenEditorGenerator it)'''«xptActivator.qualifiedClassName(plugin)».DIAGRAM_PREFERENCES_HINT'''
def additions(GenPlugin it)''''''
+
+def getPreferenceStore()'''
+ «generatedMemberComment»
+ public org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() {
+ org.eclipse.jface.preference.IPreferenceStore store=org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
+ return store;
+ }
+
+'''
+
+
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/manifest.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/manifest.xtend
index dc58cb43a6d..894af892993 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/manifest.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/manifest.xtend
@@ -1,16 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2013, 2015, 2021 Borland Software Corporation, Christian W. Damus, CEA LIST, Artal and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Michael Golubev (Montages) - initial API and implementation
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Michael Golubev (Montages) - initial API and implementation
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Thibault Landre (Atos Origin) - add Papyrus dependencies to Papyrus GMF diagram
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr : add the dependencyorg.eclipse.papyrus.infra.services.edit
+ * Christian W. Damus - bug 477384
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.plugin
@@ -18,6 +22,7 @@ import com.google.inject.Inject
import xpt.GenEditorGenerator_qvto
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenPlugin
import xpt.Common
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
@com.google.inject.Singleton class manifest {
@@ -79,6 +84,12 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.gmf.runtime.emf.commands.core,
org.eclipse.gmf.runtime.emf.ui.properties,
org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.papyrus.uml.diagram.common,
+ org.eclipse.papyrus.infra.gmfdiag.common,
+ org.eclipse.papyrus.uml.service.types,
+ org.eclipse.papyrus.infra.widgets,
+ org.eclipse.papyrus.infra.ui,
+ org.eclipse.papyrus.infra.core.sashwindows.di,
«IF printingEnabled» org.eclipse.gmf.runtime.diagram.ui.printing,
org.eclipse.gmf.runtime.diagram.ui.printing.render,
«ENDIF»
@@ -90,14 +101,21 @@ Require-Bundle: org.eclipse.core.runtime,
«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
«ENDIF»
«var reqPlugins = getAllRequiredPlugins()»
-«IF !reqPlugins.contains('org.eclipse.gmf.tooling.runtime')»
-«var notUsetBooleanVar = reqPlugins.add('org.eclipse.gmf.tooling.runtime')»
+«IF !reqPlugins.contains('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')»
+«var notUsetBooleanVar = reqPlugins.add('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')»
«ENDIF»
«FOR reqId : reqPlugins» «reqId»;visibility:=reexport,«extraLineBreak»
-«ENDFOR» org.eclipse.gef;visibility:=reexport
+«ENDFOR» org.eclipse.gef,
+ org.eclipse.papyrus.infra.gmfdiag.preferences,
+ «IF it.eResource.allContents.filter(typeof (GenCommonBase)).filter[node | node.usingDeleteService || node.usingReorientService].size != 0»
+ org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors,
+ org.eclipse.papyrus.infra.services.edit
+ «ELSE»
+ org.eclipse.papyrus.extensionpoints.editors
+«ENDIF»
'''
def executionEnvironment(GenPlugin it) '''
-Bundle-RequiredExecutionEnvironment: «IF editorGen.jdkComplianceLevel() > 5»JavaSE-1.6«ELSE»J2SE-1.«editorGen.jdkComplianceLevel()»«ENDIF»
+Bundle-RequiredExecutionEnvironment: «IF editorGen.jdkComplianceLevel() > 8»JavaSE-«editorGen.jdkComplianceLevel()»«ELSE»J2SE-1.«editorGen.jdkComplianceLevel()»«ENDIF»
'''
} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/plugin.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/plugin.xtend
index c85cec62ce1..182d1057fbe 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/plugin.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/plugin/plugin.xtend
@@ -1,33 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2013, 2017, 2021 Borland Software Corporation, CEA LIST, ALL4TEC, Artal and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Michael Golubev (Montages) - initial API and implementation
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Michael Golubev (Montages) - initial API and implementation
+ * CEA LIST - initial API and implementation
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 510587: the palette must not be generated by using GMF gen
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.plugin
import com.google.inject.Inject
-import xpt.GenEditorGenerator_qvto
+import com.google.inject.Singleton
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.papyrus.gmf.codegen.gmfgen.AbstractToolEntry
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkLabel
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenMetricContainer
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenPlugin
+import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
+import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolGroup
import xpt.Common
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenMetricContainer
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
+import xpt.GenEditorGenerator_qvto
+import xpt.editor.extensions
+import xpt.editor.palette.Utils_qvto
-@com.google.inject.Singleton class plugin {
+@Singleton class plugin {
@Inject extension GenEditorGenerator_qvto
@Inject extension Common
- @Inject extension xpt.plugin.pluginUtils
-
- @Inject xpt.editor.extensions xptEditorExtension
+ @Inject extension pluginUtils
+ @Inject extension Utils_qvto
+
+ @Inject extensions xptEditorExtension
@Inject xpt.diagram.preferences.extensions xptPreferencesExtension
@Inject xpt.propsheet.extensions xptPropsheetExtension
@Inject xpt.navigator.extensions xptNavigatorExtension
@@ -41,27 +56,33 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
def fullPath(GenPlugin it) '''«qualifiedClassName(it)»'''
def plugin(GenPlugin it) '''
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-«it.editorGen.xcopyright»
-<plugin>
-«fileTypes()»
-«extension_parser()»
-«xptEditorExtension.extensions(it.editorGen)»
-«pluginMenu()»
-«validation(it.editorGen.diagram)»
-«IF it.editorGen.metrics != null»«metrics(it.editorGen.metrics)»«ENDIF»
-«xptPreferencesExtension.extensions(it.editorGen.diagram)»
-«IF it.editorGen.propertySheet != null»«xptPropsheetExtension.extensions(it.editorGen.propertySheet)»«ENDIF»
-«xptProvidersExtension.extensions(it.editorGen.diagram)»
-«IF it.editorGen.navigator != null»«xptNavigatorExtension.extensions(it.editorGen.navigator)»«ENDIF»
-«IF it.editorGen.application != null»«xptApplicationExtension.extensions(it.editorGen.application)»«ENDIF»
-«extensionsConstraintProviders(it.editorGen)»
-«xptUpdaterExtension.extensions(it.editorGen.diagramUpdater)»
-«xptActionExtension.Main(it.editorGen)»
-«additions»
-</plugin>
-'''
+ <?xml version="1.0" encoding="UTF-8"?>
+ <?eclipse version="3.0"?>
+ «xcopyright(it.editorGen)»
+ <plugin>
+ ««««fileTypes()»
+ ««««extension_parser()»
+ «xptEditorExtension.extensions(it.editorGen)»
+ «««global actions handled in the diagram.common plugin
+ ««««pluginMenu()»
+ «validation(it.editorGen.diagram)»
+ «IF it.editorGen.metrics != null»«metrics(it.editorGen.metrics)»«ENDIF»
+ «««RS: redefine palette generation
+««« «palettePredefinedEntries(editorGen)»
+««« «paletteEntries(editorGen)»
+ «xptPreferencesExtension.extensions(it.editorGen.diagram)»
+ «IF it.editorGen.propertySheet != null»«xptPropsheetExtension.extensions(it.editorGen.propertySheet)»«ENDIF»
+ «xptProvidersExtension.extensions(it.editorGen.diagram)»
+ «IF it.editorGen.navigator != null»«xptNavigatorExtension.extensions(it.editorGen.navigator)»«ENDIF»
+ «IF it.editorGen.application != null»«xptApplicationExtension.extensions(it.editorGen.application)»«ENDIF»
+ «extensionsConstraintProviders(it.editorGen)»
+ «xptUpdaterExtension.extensions(it.editorGen.diagramUpdater)»
+ «xptActionExtension.Main(it.editorGen)»
+ «additions(it)»
+ «notationTypesMap(editorGen)»
+««« «paletteConfiguration(editorGen)»
+ </plugin>
+ '''
def fileTypes(GenPlugin it) '''
«extraLineBreak»
@@ -189,8 +210,217 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
'''
def additions(GenPlugin it) ''''''
+
+ // def category(GenDiagram it) '''«getDiagramPreferencePageCategory()».«editorGen.modelID»'''
+
+ //RS: redefine palette generation, using predefined entries
+ def palettePredefinedEntries(GenEditorGenerator it) '''
+ «xmlGeneratedTag»
+ <extension
+ id="«plugin.name».palettedefinition"
+ name="«plugin.name» Predefined Entries"
+ point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
+
+ «xmlGeneratedTag»
+ <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
+ <Priority name="Lowest"/>
+ <contribution
+ factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»">
+ <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
+ <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
+ <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
+
+ «FOR tool : collectTools(diagram.palette)»
+ «predefinedEntryDefinition(tool)»
+ «ENDFOR»
+
+ </contribution>
+ </paletteProvider>
+
+ </extension>
+ '''
+
def outTab() {
return ' ';
}
+
+
+ /**
+ * deprecated: palette configuration are now declared through architecture model.
+ */
+ def paletteConfiguration(GenEditorGenerator it) '''
+<extension point="org.eclipse.papyrus.infra.gmfdiag.common.paletteDefinition">
+ «xmlGeneratedTag»
+ <paletteDefinition
+ ID="«plugin.ID».paletteconfiguration"
+ class="org.eclipse.papyrus.infra.gmfdiag.common.service.palette.ExtendedPluginPaletteProvider"
+ name="«plugin.name» Palette"
+ path="«relativePath»/«modelID».paletteconfiguration"
+ provider="Eclipse Modeling Project">
+ <Priority
+ name="Lowest">
+ </Priority>
+ <!-- Specify diagram to which this palette tool relates -->
+ <editor
+ id="«plugin.ID»">
+ </editor>
+ </paletteDefinition>
+</extension>
+ '''
+
+ //RS: redefine palette generation, using predefined entries
+ def paletteEntries(GenEditorGenerator it) '''
+ «xmlGeneratedTag»
+ <extension
+ id="«plugin.name».standard"
+ name="«plugin.name» Standard Palette"
+ point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
+
+ «xmlGeneratedTag»
+ <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
+ <Priority name="Low"/>
+ <contribution
+ factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»">
+ <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
+ <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
+ <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
+
+ «FOR tool : diagram.palette.groups»
+ «groupUsage(tool)»
+ «ENDFOR»
+ </contribution>
+ <editor id="«plugin.ID»"/>
+ </paletteProvider>
+
+ </extension>
+ '''
+
+ def groupUsage(ToolGroup it) '''
+ <entry
+ description="«it.description»"
+ id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF»
+ kind="«IF it.stack && it.toolsOnly»stack«ELSE»drawer«ENDIF»"
+ label="«it.title»"
+ large_icon="«largeIconPath»"
+ path="«getPath(it)»"
+ small_icon="«smallIconPath»">
+ <expand
+ force="true">
+ </expand>
+ </entry>
+ ««« TODO: call sub entries...
+ «FOR entry : it.entries.filter[e| e instanceof ToolEntry]»
+ «toolUsage(entry, it)»
+ «ENDFOR»
+ «FOR entry : it.entries.filter[e| e instanceof ToolGroup]»
+ «toolUsage(entry, it)»
+ «ENDFOR»
+ '''
+
+ private def getPath(ToolEntry it) {
+ return buildPath(it.eContainer);
+ }
+
+ private def getPath(ToolGroup it) {
+ return buildPath(it.eContainer);
+ }
+
+ private def buildPath(EObject it) {
+ var path = new StringBuilder();
+ var container = it;
+ while (container instanceof ToolGroup) {
+ path.insert(0, getToolPath((container as ToolGroup).id));
+ container = container.eContainer;
+ }
+ return if(path.length() != 0) path.toString else "/" ;
+ }
+
+ def dispatch toolUsage(ToolEntry it, ToolGroup group) '''
+ <predefinedEntry
+ id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF»
+ path="«getPath(it)»">
+ </predefinedEntry>
+ '''
+
+ def dispatch toolUsage(ToolGroup it, ToolGroup group) '''
+ «groupUsage(it)»
+ '''
+
+ def predefinedEntryDefinition(AbstractToolEntry it) '''
+ <entry
+ defineOnly="true"
+ description="«it.description»"
+ id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF»
+ kind="tool"
+ label="«it.title»"
+ large_icon="«largeIconPath»"
+ path=""
+ small_icon="«smallIconPath»">
+ </entry>
+ '''
+
+ // set notation type mapping extension point
+ def notationTypesMap(GenEditorGenerator it) '''
+«tripleSpace(0)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+«tripleSpace(1)»«xmlGeneratedTag»
+«tripleSpace(1)»<diagramMappings diagramID="«modelID»">
+«tripleSpace(1)» <mapping type="«modelID»" humanReadableType="«modelID.replaceAll('Papyrus|UML|Diagram', '')»Diagram"/>
+ «FOR compartment : diagram.compartments»
+ «compartmentToTypeMap(compartment)»
+ «ENDFOR»
+ «FOR link : diagram.links»
+ «linksToTypeMap(link)»
+ «ENDFOR»
+ «FOR externalLabel : diagram.eResource.allContents.filter(typeof (GenExternalNodeLabel)).toIterable»
+ «floatingLabelToTypeMap(externalLabel)»
+ «externalNodeLabelToTypeMap(externalLabel)»
+ «ENDFOR»
+«tripleSpace(1)»</diagramMappings>
+«tripleSpace(0)»</extension>
+ '''
+ def compartmentToTypeMap(GenCompartment it) '''
+ <mapping
+ humanReadableType="«title.replaceAll('Compartment', '')»"
+ type="«stringVisualID»">
+ </mapping>
+ '''
+
+ def linksToTypeMap(GenLink it) '''
+ «FOR label : labels»
+ «linkLabelToTypeMap(label)»
+ «ENDFOR»
+ '''
+
+ def linkLabelToTypeMap(GenLinkLabel it)'''
+ ««« it is used on a LabelVisibilityPreference...
+ «IF labelVisibilityPreference !== null »
+ <mapping
+ humanReadableType="«labelVisibilityPreference.role»"
+ type="«stringVisualID»">
+ </mapping>
+ «ENDIF»
+ '''
+
+ def externalNodeLabelToTypeMap(GenExternalNodeLabel it)'''
+ «IF labelVisibilityPreference !== null »
+ <mapping
+ humanReadableType="«labelVisibilityPreference.role»"
+ type="«stringVisualID»">
+ </mapping>
+ «ENDIF»
+ '''
+
+ def floatingLabelToTypeMap(GenExternalNodeLabel it)'''
+ ««« it is used on a ExtensionGenView...
+ «IF superEditPart !== null»
+ «««...to be extended as floatingLabel
+ «IF "FloatingLabelEditPart".equals(name) »
+ <mapping
+ humanReadableType="Floating Label"
+ type="«stringVisualID»">
+ </mapping>
+ «ENDIF»
+ «ENDIF»
+ '''
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/LabelProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/LabelProvider.xtend
index a19cf81a844..60225716c3c 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/LabelProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/LabelProvider.xtend
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.propsheet
@@ -103,7 +103,7 @@ import xpt.providers.ElementTypes
private org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(org.eclipse.gmf.runtime.notation.View view) {
// For intermediate views climb up the containment hierarchy to find the one associated with an element type.
while (view != null) {
- int vid = «visualId.qualifiedClassName(editorGen.diagram)».getVisualID(view);
+ String vid = «visualId.qualifiedClassName(editorGen.diagram)».getVisualID(view);
org.eclipse.gmf.runtime.emf.type.core.IElementType etype =
«xptElementTypes.qualifiedClassName(editorGen.diagram)».getElementType(vid);
if (etype != null) {
@@ -117,5 +117,4 @@ import xpt.providers.ElementTypes
'''
def additions(GenPropertySheet it) ''''''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/PropertySection.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/PropertySection.xtend
index 0a602a6c288..41e0912915c 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/PropertySection.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/propsheet/PropertySection.xtend
@@ -1,18 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
- *
+/*****************************************************************************
+ * Copyright (c) 2007, 2017, 2021 Borland Software Corporation, Montages, CEA LIST, Artal and others
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - [407242] - common code extracted to gmft.runtime,
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - [407242] - common code extracted to gmft.runtime,
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
package xpt.propsheet
@@ -50,7 +51,7 @@ import xpt.Common
}
'''
- def extendsList(GenCustomPropertyTab it) '''extends org.eclipse.gmf.tooling.runtime.sheet.DefaultPropertySection'''
+ def extendsList(GenCustomPropertyTab it) '''extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.sheet.DefaultPropertySection'''
def implementsClause(GenCustomPropertyTab it) '''implements org.eclipse.ui.views.properties.IPropertySourceProvider'''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/EditPartProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/EditPartProvider.xtend
index f8456119b43..3f002f89d12 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/EditPartProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/EditPartProvider.xtend
@@ -1,17 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, Montages, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - API extracted to GMF-T runtime, migrated to Xtend2
- */
+ * Contributors:
+ * Alexander Shatalin/Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - API extracted to GMF-T runtime, migrated to Xtend2
+ * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Thibault Landre (Atos Origin) - initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) Add a line to initialize the display of the compartments to true
+ * Vincent Lorenzo (CEA-LIST) - Add lines to initialize the display of the labels - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import com.google.inject.Inject
@@ -47,7 +53,7 @@ import xpt.diagram.editparts.EditPartFactory
}
'''
- def extendsList(GenDiagram it) '''extends org.eclipse.gmf.tooling.runtime.providers.DefaultEditPartProvider'''
+ def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.providers.DefaultEditPartProvider'''
def implementsList(GenDiagram it) ''''''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers.xtend
index 0cec4411d9e..2a49e11f771 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers.xtend
@@ -1,20 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
* [221347] Got rid of generated interfaces
* (IObjectInitializer, IFeatureInitializer) and implementation thereof
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Christian W. Damus (CEA) - bug 440263
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import com.google.inject.Inject
@@ -58,7 +60,7 @@ import xpt.expressions.AbstractExpression
@MetaDef def initMethodCall(GenCommonBase linkOrNode, TypeModelFacet modelFacet, String newElementVar) '''
«IF modelFacet.modelElementInitializer != null»
- «elementInitializersInstanceCall(linkOrNode)».init_«linkOrNode.uniqueIdentifier»(«newElementVar»);
+ «elementInitializersInstanceCall(linkOrNode)».init_«linkOrNode.stringUniqueIdentifier»(«newElementVar»);
«ENDIF»
'''
@@ -139,13 +141,13 @@ import xpt.expressions.AbstractExpression
def dispatch CharSequence initMethod(GenFeatureSeqInitializer it, GenCommonBase diagramElement) '''
«generatedMemberComment»
- public void init_«diagramElement.getUniqueIdentifier()»(«xptMetaModel.QualifiedClassName(elementClass)» instance) {
+ public void init_«diagramElement.stringUniqueIdentifier()»(«xptMetaModel.QualifiedClassName(elementClass)» instance) {
try {
«FOR i : it.initializers»
«performInit(i, diagramElement, 'instance', elementClass, <Integer>newLinkedList(initializers.indexOf(i)))»
«ENDFOR»
} catch(RuntimeException e) {
- «xptActivator.qualifiedClassName(diagramElement.getDiagram().editorGen.plugin)».getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ «xptActivator.qualifiedClassName(diagramElement.getDiagram().editorGen.plugin)».getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
}
}
'''
@@ -158,45 +160,47 @@ import xpt.expressions.AbstractExpression
*/
def dispatch CharSequence performInit(GenFeatureValueSpec it, GenCommonBase diagramElement, String instanceVar,
GenClass instanceClass, List<Integer> counters) '''
- «IF it.value.provider.getLanguage() == GenLanguage::LITERAL_LITERAL»
- «xptMetaModel.modifyFeature(feature, instanceVar, instanceClass, value.body)»
- «extraLineBreak»
- «ELSE»
- «var expressionVarName = getVariableName('value', counters)»
- Object «expressionVarName» = «evaluateExpr(value.provider, diagramElement, it, instanceVar)»;
- «IF feature.listType»
- if («expressionVarName» instanceof java.util.Collection) {
- «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».clear();
- «IF feature.typeGenClassifier.expressionResultNeedsCast()»
- for (java.util.Iterator it = ((java.util.Collection) «expressionVarName»).iterator(); it.hasNext(); ) {
- Object next = «xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(it.next(), «xptMetaModel.
- MetaClass(feature.typeGenClassifier)»);
- «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel.
- QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») next);
- }
- «ELSE»
- «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».addAll(((java.util.Collection) «expressionVarName»));
- «ENDIF»
- } else {
- «IF feature.typeGenClassifier.expressionResultNeedsCast()»
- «expressionVarName» = «xptAbstractExpression
- .qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass(
- feature.typeGenClassifier)»);
- «ENDIF»
- «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel.
- QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») «expressionVarName»);
- }
- «ELSE»
- «IF feature.typeGenClassifier.expressionResultNeedsCast()»
- «extraLineBreak»
- «expressionVarName» = «
- xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass(
- feature.typeGenClassifier)»);
- «ENDIF»
- «xptMetaModel.setFeatureValue(feature, instanceVar, instanceClass, expressionVarName, true)»;
- «ENDIF/*isListType*/»
- «ENDIF/*is literal expression*/»
- '''
+ «IF it.value.provider.getLanguage() == GenLanguage::LITERAL_LITERAL»
+ «xptMetaModel.modifyFeature(feature, instanceVar, instanceClass, value.body)»
+ «extraLineBreak»
+ «ELSE»
+ «var expressionVarName = getVariableName('value', counters)»
+ Object «expressionVarName» = «evaluateExpr(value.provider, diagramElement, it, instanceVar)»;
+ «IF feature.listType»
+ if («expressionVarName» instanceof java.util.Collection) {
+ «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».clear();
+ «IF feature.typeGenClassifier.expressionResultNeedsCast()»
+ for (java.util.Iterator it = ((java.util.Collection) «expressionVarName»).iterator(); it.hasNext(); ) {
+ Object next = «xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(it.next(), «xptMetaModel.
+ MetaClass(feature.typeGenClassifier)»);
+ «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel.
+ QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») next);
+ }
+ «ELSE»
+ «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».addAll(((java.util.Collection) «expressionVarName»));
+ «ENDIF»
+ } else if(«expressionVarName» != null) {
+ «IF feature.typeGenClassifier.expressionResultNeedsCast()»
+ «expressionVarName» = «xptAbstractExpression
+ .qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass(
+ feature.typeGenClassifier)»);
+ «ENDIF»
+ «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel.
+ QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») «expressionVarName»);
+ }
+ «ELSE»
+ if(«expressionVarName» != null) {
+ «IF feature.typeGenClassifier.expressionResultNeedsCast()»
+ «extraLineBreak»
+ «expressionVarName» = «
+ xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass(
+ feature.typeGenClassifier)»);
+ «ENDIF»
+ «xptMetaModel.setFeatureValue(feature, instanceVar, instanceClass, expressionVarName, true)»;
+ }
+ «ENDIF/*isListType*/»
+ «ENDIF/*is literal expression*/»
+ '''
def dispatch CharSequence performInit(GenReferenceNewElementSpec it, GenCommonBase diagramElement,
String instanceVar, GenClass instanceClass, List<Integer> counters) '''
@@ -233,9 +237,17 @@ import xpt.expressions.AbstractExpression
'''
/////////////////////////////////
- def dispatch CharSequence javaMethod(GenNode it) '''«javaMethod(it.modelFacet, it)»'''
+ def dispatch CharSequence javaMethod(GenNode it) '''
+ «IF !it.sansDomain»
+ «javaMethod(it.modelFacet, it)»
+ «ENDIF»
+ '''
- def dispatch CharSequence javaMethod(GenLink it) '''«javaMethod(it.modelFacet, it)»'''
+ def dispatch CharSequence javaMethod(GenLink it) '''
+ «IF !it.sansDomain»
+ «javaMethod(it.modelFacet, it)»
+ «ENDIF»
+ '''
def dispatch CharSequence javaMethod(ModelFacet it, GenCommonBase diagramElement) ''''''
@@ -274,5 +286,4 @@ import xpt.expressions.AbstractExpression
«ENDIF»
}
'''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers_qvto.xtend
index 1dd40dc8c7f..2bd28c122f9 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementInitializers_qvto.xtend
@@ -1,35 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2008, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - API extracted to GMF-T runtime, migrated to Xtend2
- */
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
+ * [221347] Got rid of generated interfaces
+ * (IObjectInitializer, IFeatureInitializer) and implementation thereof
+ * Michael Golubev (Montages) - API extracted to GMF-T runtime, #386838 migrate to Xtend2
+ * Christian W. Damus (CEA) - bug 440263
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
-import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import java.util.Collection
+import java.util.List
import org.eclipse.emf.codegen.ecore.genmodel.GenClass
+import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier
import org.eclipse.emf.codegen.ecore.genmodel.GenDataType
import org.eclipse.emf.codegen.ecore.genmodel.GenEnum
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenFeatureValueSpec
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenFeatureSeqInitializer
-import java.util.Collection
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenFeatureValueSpec
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenReferenceNewElementSpec
-import java.util.List
+import xpt.Common
-/**
- * FIXME: [MG] commented getSuffixes below
- */
-@com.google.inject.Singleton class ElementInitializers_qvto { //
+@Singleton class ElementInitializers_qvto { //
+ @Inject extension Common
+
def List<Integer> newListAppending(List<Integer> list, int toAppend) {
var result = <Integer>newLinkedList()
result.addAll(list)
@@ -74,7 +81,7 @@ import java.util.List
if (valueSpec.featureSeqInitializer.creatingInitializer != null) {
middlePart = valueSpec.featureSeqInitializer.creatingInitializer.feature.ecoreFeature.name + '_'
}
- return valueSpec.feature.ecoreFeature.name + '_' + middlePart + de.uniqueIdentifier
+ return valueSpec.feature.ecoreFeature.name + '_' + middlePart + de.stringUniqueIdentifier
}
def Iterable<GenFeatureValueSpec> recurseCollectValueSpec(GenFeatureSeqInitializer si) {
@@ -149,5 +156,4 @@ import java.util.List
def String combinedSuffix(Iterable<Integer> suffixes) {
return '_' + suffixes.join('_')
}
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementTypes.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementTypes.xtend
index c5a4c29ca06..44fdb721f16 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementTypes.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ElementTypes.xtend
@@ -1,17 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2006, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Christian W. Damus - bug 451230
+ * Benoit Maggi (CEA LIST) -#510281 change dependency to replace gmft-runtime
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
@@ -41,7 +44,7 @@ import xpt.editor.VisualIDRegistry
@Inject MetaModel xptMetaModel;
@Inject VisualIDRegistry xptVisualIDRegistry;
- @MetaDef def accessElementType(GenCommonBase it) '''«it.diagram.elementTypesQualifiedClassName».«it.uniqueIdentifier»'''
+ @MetaDef def accessElementType(GenCommonBase it) '''«it.diagram.elementTypesQualifiedClassName».«stringUniqueIdentifier»'''
def className(GenDiagram it) '''«it.elementTypesClassName»'''
@@ -99,7 +102,7 @@ import xpt.editor.VisualIDRegistry
private static java.util.Map<org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.ENamedElement> elements;
«generatedMemberComment»
- private static org.eclipse.gmf.tooling.runtime.providers.DiagramElementTypeImages elementTypeImages = new org.eclipse.gmf.tooling.runtime.providers.DiagramElementTypeImages(« //
+ private static org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages elementTypeImages = new org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages(« //
xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().getItemProvidersAdapterFactory());
«generatedMemberComment»
@@ -145,19 +148,19 @@ import xpt.editor.VisualIDRegistry
def getElement(GenDiagram it) '''
«generatedMemberComment('Returns \'type\' of the ecore object associated with the hint.\n')»
- public static org.eclipse.emf.ecore.ENamedElement getElement(org.eclipse.core.runtime.IAdaptable hint) {
+ public static synchronized org.eclipse.emf.ecore.ENamedElement getElement(org.eclipse.core.runtime.IAdaptable hint) {
Object type = hint.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
if (elements == null) {
elements = new java.util.IdentityHashMap<org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.ENamedElement>();
- «IF domainDiagramElement != null»«bindUniqueIdentifierToNamedElement(domainDiagramElement, getUniqueIdentifier())»«ENDIF»
+ «IF domainDiagramElement != null»«bindUniqueIdentifierToNamedElement(domainDiagramElement, stringUniqueIdentifier())»«ENDIF»
«FOR node : getAllNodes()»
- «IF node.modelFacet != null»«bindUniqueIdentifierToNamedElement(node.modelFacet, node.getUniqueIdentifier())»«ENDIF»
+ «IF node.modelFacet != null»«bindUniqueIdentifierToNamedElement(node.modelFacet, node.stringUniqueIdentifier())»«ENDIF»
«ENDFOR»
«FOR link : it.links»
- «IF link.modelFacet != null»«bindUniqueIdentifierToNamedElement(link.modelFacet, link.getUniqueIdentifier())»«ENDIF»
+ «IF link.modelFacet != null»«bindUniqueIdentifierToNamedElement(link.modelFacet, link.stringUniqueIdentifier())»«ENDIF»
«ENDFOR»
}
- return (org.eclipse.emf.ecore.ENamedElement) elements.get(type);
+ return elements.get(type);
}
'''
@@ -183,44 +186,55 @@ import xpt.editor.VisualIDRegistry
def elementTypeField(GenCommonBase it) '''
«IF null != elementType»
«generatedMemberComment»
- public static final org.eclipse.gmf.runtime.emf.type.core.IElementType «getUniqueIdentifier()» = getElementType("«elementType.
+ public static final org.eclipse.gmf.runtime.emf.type.core.IElementType «stringUniqueIdentifier» = getElementTypeByUniqueId("«elementType.
uniqueIdentifier»"); «nonNLS(1)»
«ENDIF»
'''
- def getElementType(GenDiagram it) '''
+ def getElementType(GenDiagram it)'''
«generatedMemberComment»
- private static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(String id) {
+ private static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeByUniqueId(String id) {
return org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getType(id);
}
'''
-
- def isKnownElementType(GenDiagram it) '''
+ def isKnownElementType(GenDiagram it) '''
«generatedMemberComment»
- public static boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
+ public static synchronized boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
if (KNOWN_ELEMENT_TYPES == null) {
KNOWN_ELEMENT_TYPES = new java.util.HashSet<org.eclipse.gmf.runtime.emf.type.core.IElementType>();
«FOR e : it.getAllTypedElements()»
«addKnownElementType(e)»
«ENDFOR»
}
- return KNOWN_ELEMENT_TYPES.contains(elementType);
+
+ boolean result = KNOWN_ELEMENT_TYPES.contains(elementType);
+
+ if (!result) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType[] supertypes = elementType.getAllSuperTypes();
+ for (int i = 0; !result && (i < supertypes.length); i++) {
+ result = KNOWN_ELEMENT_TYPES.contains(supertypes[i]);
+ }
+ }
+
+ return result;
}
'''
def addKnownElementType(GenCommonBase it) '''
«IF null != elementType»
- KNOWN_ELEMENT_TYPES.add(«getUniqueIdentifier()»);
+ KNOWN_ELEMENT_TYPES.add(«stringUniqueIdentifier()»);
«ENDIF»
'''
def getElementTypeByVisualID(GenDiagram it) '''
«generatedMemberComment»
- public static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(int visualID) {
- switch (visualID) {
- «FOR e : it.getAllTypedElements().filter[el|el.elementType != null]»
- «caseElementType(e)»
- «ENDFOR»
+ public static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(String visualID) {
+ if (visualID != null) {
+ switch (visualID) {
+ «FOR e : it.getAllTypedElements().filter[el|el.elementType != null]»
+ «caseElementType(e)»
+ «ENDFOR»
+ }
}
return null;
}
@@ -228,7 +242,7 @@ import xpt.editor.VisualIDRegistry
def caseElementType(GenCommonBase it) '''
«xptVisualIDRegistry.caseVisualID(it)»
- return «getUniqueIdentifier()»;
+ return «stringUniqueIdentifier()»;
'''
@MetaDef def typedInstanceName(GenDiagram it) '''TYPED_INSTANCE'''
@@ -237,8 +251,8 @@ import xpt.editor.VisualIDRegistry
def typedInstance(GenDiagram it) '''
«generatedClassComment»
- public static final org.eclipse.gmf.tooling.runtime.providers.DiagramElementTypes TYPED_INSTANCE
- = new org.eclipse.gmf.tooling.runtime.providers.DiagramElementTypes(elementTypeImages) {
+ public static final org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramElementTypes TYPED_INSTANCE
+ = new org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramElementTypes(elementTypeImages) {
«generatedMemberComment»
«xptCodeStyle.overrideC(it)»
@@ -248,7 +262,7 @@ import xpt.editor.VisualIDRegistry
«generatedMemberComment»
«xptCodeStyle.overrideC(it)»
- public org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeForVisualId(int visualID) {
+ public org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeForVisualId(String visualID) {
return «qualifiedClassName(it)».getElementType(visualID);
}
@@ -260,6 +274,19 @@ import xpt.editor.VisualIDRegistry
};
'''
- def additions(GenDiagram it) ''''''
+ def additions(GenDiagram it) '''
+ «generatedMemberComment»
+ public static boolean isKindOf(org.eclipse.gmf.runtime.emf.type.core.IElementType subtype, org.eclipse.gmf.runtime.emf.type.core.IElementType supertype) {
+ boolean result = subtype == supertype;
+
+ if (!result) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType[] supertypes = subtype.getAllSuperTypes();
+ for (int i = 0; !result && (i < supertypes.length); i++) {
+ result = supertype == supertypes[i];
+ }
+ }
-}
+ return result;
+ }
+ '''
+} \ No newline at end of file
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/IconProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/IconProvider.xtend
index 74dbd7f90ea..47c714f685b 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/IconProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/IconProvider.xtend
@@ -1,25 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - [407332] common API for XXXElementTypes extracted to GMFT-runtime
- * - [386838] migration to Xtend2
- */
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
+ * [221347] Got rid of generated interfaces
+ * (IObjectInitializer, IFeatureInitializer) and implementation thereof
+ * Michael Golubev (Montages) - [407332] common API for XXXElementTypes extracted to GMFT-runtime
+ * - [386838] migration to Xtend2
+ * Christian W. Damus (CEA) - bug 440263
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import xpt.Common
-@com.google.inject.Singleton class IconProvider {
+@Singleton class IconProvider {
@Inject extension Common;
@Inject ElementTypes xptElementTypes;
@@ -45,7 +51,7 @@ import xpt.Common
}
'''
- def extendsList(GenDiagram it) '''extends org.eclipse.gmf.tooling.runtime.providers.DefaultElementTypeIconProvider'''
+ def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.providers.DefaultElementTypeIconProvider'''
def implementsList(GenDiagram it) '''implements org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider'''
@@ -57,4 +63,5 @@ import xpt.Common
'''
def additions(GenDiagram it) ''''''
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/MarkerNavigationProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/MarkerNavigationProvider.xtend
index 0693636e2a6..795f4bdb200 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/MarkerNavigationProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/MarkerNavigationProvider.xtend
@@ -1,27 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
import xpt.Common
-@com.google.inject.Singleton class MarkerNavigationProvider {
+@Singleton class MarkerNavigationProvider {
@Inject extension Common;
-
- def className(GenDiagram it) '''«it.markerNavigationProviderClassName»'''
+def className(GenDiagram it) '''«it.markerNavigationProviderClassName»'''
def packageName(GenDiagram it) '''«it.providersPackageName»'''
@@ -29,7 +30,7 @@ import xpt.Common
def fullPath(GenDiagram it) '''«qualifiedClassName(it)»'''
- def MarkerNavigationProvider(GenDiagram it) '''
+ def MarkerNavigationProvider(GenDiagram it) '''
«copyright(editorGen)»
package «packageName(it)»;
@@ -49,7 +50,7 @@ import xpt.Common
}
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor editor =
(org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) getEditor();
- java.util.Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
+ java.util.Map<?, ?> editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
org.eclipse.emf.ecore.EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
if (targetView == null) {
return;
@@ -79,7 +80,7 @@ import xpt.Common
marker = file.createMarker(MARKER_TYPE);
marker.setAttribute(org.eclipse.core.resources.IMarker.MESSAGE, message);
marker.setAttribute(org.eclipse.core.resources.IMarker.LOCATION, location);
- marker.setAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, elementId);
+ marker.setAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, elementId);
int markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_INFO;
if (statusSeverity == org.eclipse.core.runtime.IStatus.WARNING) {
markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_WARNING;
@@ -99,5 +100,4 @@ import xpt.Common
'''
def additions(GenDiagram it) ''''''
-
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ParserUtils_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ParserUtils_qvto.xtend
index d098b8d966c..4fd4fd057d3 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ParserUtils_qvto.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ParserUtils_qvto.xtend
@@ -1,30 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2014, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
+ * [221347] Got rid of generated interfaces
+ * (IObjectInitializer, IFeatureInitializer) and implementation thereof
+ * Christian W. Damus (CEA) - bug 440263
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
+import xpt.Common
+import com.google.inject.Inject
+import com.google.inject.Singleton
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.xtend.annotations.MetaDef
-@com.google.inject.Singleton class ParserUtils_qvto {
+@Singleton class ParserUtils_qvto {
+ @Inject extension Common
- @MetaDef def String parserFieldName(GenCommonBase element) {
- return element.uniqueIdentifier.toFirstLower + 'Parser'
+ @MetaDef def String parserFieldName(GenCommonBase element) {
+ return element.stringUniqueIdentifier.toFirstLower + '_Parser'
}
- @MetaDef def String parserAccessorName(GenCommonBase element) {
- return 'get' + element.uniqueIdentifier.toFirstUpper + 'Parser'
+ @MetaDef def String parserAccessorName(GenCommonBase element) {
+ return 'get' + element.stringUniqueIdentifier.toFirstUpper + '_Parser'
}
-
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationDecoratorProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationDecoratorProvider.xtend
index c8892885ad3..1a54114f63a 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationDecoratorProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationDecoratorProvider.xtend
@@ -1,17 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Ansgar Radermacher (CEA LIST) - added support for EMF validation
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import com.google.inject.Inject
@@ -47,25 +49,10 @@ package «packageName(it)»;
«generatedClassComment»
public class «className(it)»
- extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider
+ extends org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider
implements org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider {
«generatedMemberComment»
- private static final String KEY = "validationStatus"; «nonNLS(1)»
- «IF editorGen.application == null»
-
- «generatedMemberComment»
- private static final String MARKER_TYPE = «xptActivator.qualifiedClassName(editorGen.plugin)».ID +
- ".«getValidationDiagnosticMarkerType()»"; «nonNLS(1)»
-
- «generatedMemberComment»
- private static MarkerObserver fileObserver;
- «ENDIF»
-
- «generatedMemberComment»
- private static java.util.Map/*<String, List<IDecorator>>*/ allDecorators = new java.util.HashMap();
-
- «generatedMemberComment»
public void createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) {
org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) decoratorTarget.getAdapter(org.eclipse.gef.EditPart.class);
if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart ||
@@ -100,319 +87,7 @@ public class «className(it)»
return view != null && «VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view));
}
- «generatedMemberComment»
- public static void refreshDecorators(org.eclipse.gmf.runtime.notation.View view) {
- refreshDecorators(org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.getIdStr(view), view.getDiagram());
- }
-
- «generatedMemberComment»
- private static void refreshDecorators(String viewId, org.eclipse.gmf.runtime.notation.Diagram diagram) {
- final java.util.List decorators = viewId != null ? (java.util.List) allDecorators.get(viewId) : null;
- if (decorators == null || decorators.isEmpty() || diagram == null) {
- return;
- }
- final org.eclipse.gmf.runtime.notation.Diagram fdiagram = diagram;
- org.eclipse.ui.PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- try {
- org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(fdiagram).runExclusive(new Runnable() {
-
- public void run() {
- for (java.util.Iterator it = decorators.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator decorator =
- (org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator) it.next();
- decorator.refresh();
- }
- }
- });
- } catch (Exception e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Decorator refresh failure", e); «nonNLS(1)»
- }
- }
- });
- }
-
- «generatedMemberComment»
- public static class StatusDecorator extends org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator {
-
- «generatedMemberComment»
- private String viewId;
-
- «generatedMemberComment»
- public StatusDecorator(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) {
- super(decoratorTarget);
- try {
- final org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getDecoratorTarget().getAdapter(
- org.eclipse.gmf.runtime.notation.View.class);
- org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view).runExclusive(new Runnable() {
- public void run() {
- StatusDecorator.this.viewId = view != null ?
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.getIdStr(view) : null;
- }
- });
- } catch (Exception e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "ViewID access failure", e); «nonNLS(1)»
- }
- }
-
- «generatedMemberComment»
- public void refresh() {
- removeDecoration();
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getDecoratorTarget().getAdapter(
- org.eclipse.gmf.runtime.notation.View.class);
- if (view == null || view.eResource() == null) {
- return;
- }
- org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) getDecoratorTarget().getAdapter(org.eclipse.gef.EditPart.class);
- if (editPart == null || editPart.getViewer() == null) {
- return;
- }
-
- // query for all the validation markers of the current resource
- «IF editorGen.application == null»
- String elementId = org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.getIdStr(view);
- if (elementId == null) {
- return;
- }
- int severity = org.eclipse.core.resources.IMarker.SEVERITY_INFO;
- org.eclipse.core.resources.IMarker foundMarker = null;
- org.eclipse.core.resources.IResource resource = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(view.eResource());
- if (resource == null || !resource.exists()) {
- return;
- }
- org.eclipse.core.resources.IMarker[] markers = null;
- try {
- markers = resource.findMarkers(MARKER_TYPE, true, org.eclipse.core.resources.IResource.DEPTH_INFINITE);
- } catch (org.eclipse.core.runtime.CoreException e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Validation markers refresh failure", e); «nonNLS(1)»
- }
- «ELSE»
- int severity = org.eclipse.core.runtime.IStatus.INFO;
- «xptValidationMarker.qualifiedClassName(it)» foundMarker = null;
- «xptValidationMarker.qualifiedClassName(it)»[] markers =
- «xptValidationMarker.qualifiedClassName(it)».getMarkers(editPart.getViewer(), viewId);
- «ENDIF»
- if (markers == null || markers.length == 0) {
- return;
- }
- org.eclipse.draw2d.Label toolTip = null;
- for (int i = 0; i < markers.length; i++) {
- «IF editorGen.application == null»
- org.eclipse.core.resources.IMarker marker = markers[i];
- String attribute = marker.getAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, ""); «nonNLS(1)»
- if (attribute.equals(elementId)) {
- int nextSeverity = marker.getAttribute(org.eclipse.core.resources.IMarker.SEVERITY,
- org.eclipse.core.resources.IMarker.SEVERITY_INFO);
- «ELSE»
- «xptValidationMarker.qualifiedClassName(it)» marker = markers[i];
- int nextSeverity = marker.getStatusSeverity();
- «ENDIF»
- org.eclipse.swt.graphics.Image nextImage = getImage(nextSeverity);
- if (foundMarker == null) {
- foundMarker = marker;
- toolTip = new org.eclipse.draw2d.Label(
- «IF editorGen.application == null»
- marker.getAttribute(org.eclipse.core.resources.IMarker.MESSAGE, ""), «nonNLS(1)»
- «ELSE»
- marker.getMessage(),
- «ENDIF»
- nextImage);
- } else {
- if (toolTip.getChildren().isEmpty()) {
- org.eclipse.draw2d.Label comositeLabel = new org.eclipse.draw2d.Label();
- org.eclipse.draw2d.FlowLayout fl = new org.eclipse.draw2d.FlowLayout(false);
- fl.setMinorSpacing(0);
- comositeLabel.setLayoutManager(fl);
- comositeLabel.add(toolTip);
- toolTip = comositeLabel;
- }
- toolTip.add(new org.eclipse.draw2d.Label(
- «IF editorGen.application == null»
- marker.getAttribute(org.eclipse.core.resources.IMarker.MESSAGE, ""), «nonNLS(1)»
- «ELSE»
- marker.getMessage(),
- «ENDIF»
- nextImage));
- }
- severity = (nextSeverity > severity) ? nextSeverity : severity;
- «IF editorGen.application == null»
- }
- «ENDIF»
- }
- if (foundMarker == null) {
- return;
- }
-
- // add decoration
- if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
- if (view instanceof org.eclipse.gmf.runtime.notation.Edge) {
- setDecoration(getDecoratorTarget().addConnectionDecoration(getImage(severity), 50, true));
- } else {
- int margin = -1;
- if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
- margin = org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil.getMapMode(
- ((org.eclipse.gef.GraphicalEditPart) editPart).getFigure()).DPtoLP(margin);
- }
- setDecoration(getDecoratorTarget().addShapeDecoration(getImage(severity),
- org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget.Direction.NORTH_EAST, margin, true));
- }
- getDecoration().setToolTip(toolTip);
- }
- }
-
- «generatedMemberComment»
- private org.eclipse.swt.graphics.Image getImage(int severity) {
- String imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_ERROR_TSK;
- switch (severity) {
- «IF editorGen.application == null»
- case org.eclipse.core.resources.IMarker.SEVERITY_ERROR:
- imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_ERROR_TSK;
- break;
- case org.eclipse.core.resources.IMarker.SEVERITY_WARNING:
- imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_WARN_TSK;
- break;
- «ELSE»
- case org.eclipse.core.runtime.IStatus.ERROR:
- imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_ERROR_TSK;
- break;
- case org.eclipse.core.runtime.IStatus.WARNING:
- imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_WARN_TSK;
- break;
- «ENDIF»
- default:
- imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_INFO_TSK;
- }
- return org.eclipse.ui.PlatformUI.getWorkbench().getSharedImages().getImage(imageName);
- }
-
- «generatedMemberComment»
- public void activate() {
- if (viewId == null) {
- return;
- }
-
- // add self to global decorators registry
- java.util.List list = (java.util.List) allDecorators.get(viewId);
- if (list == null) {
- list = new java.util.ArrayList(2);
- list.add(this);
- allDecorators.put(viewId, list);
- } else if (!list.contains(this)) {
- list.add(this);
- }
- «IF editorGen.application == null»
-
- // start listening to changes in resources
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getDecoratorTarget().getAdapter(
- org.eclipse.gmf.runtime.notation.View.class);
- if (view == null) {
- return;
- }
- org.eclipse.gmf.runtime.notation.Diagram diagramView = view.getDiagram();
- if (diagramView == null) {
- return;
- }
- if (fileObserver == null) {
- org.eclipse.gmf.runtime.common.ui.resources.FileChangeManager.getInstance().addFileObserver(
- fileObserver = new MarkerObserver(diagramView));
- }
- «ENDIF»
- }
-
- «generatedMemberComment»
- public void deactivate() {
- if (viewId == null) {
- return;
- }
-
- // remove self from global decorators registry
- java.util.List list = (java.util.List) allDecorators.get(viewId);
- if (list != null) {
- list.remove(this);
- if (list.isEmpty()) {
- allDecorators.remove(viewId);
- }
- }
- «IF editorGen.application == null»
-
- // stop listening to changes in resources if there are no more decorators
- if (fileObserver != null && allDecorators.isEmpty()) {
- org.eclipse.gmf.runtime.common.ui.resources.FileChangeManager.getInstance().removeFileObserver(fileObserver);
- fileObserver = null;
- }
- «ENDIF»
- super.deactivate();
- }
- }
- «IF editorGen.application == null»
-
- «generatedMemberComment»
- static class MarkerObserver implements org.eclipse.gmf.runtime.common.ui.resources.IFileObserver {
-
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.Diagram diagram;
-
- «generatedMemberComment»
- private MarkerObserver(org.eclipse.gmf.runtime.notation.Diagram diagram) {
- this.diagram = diagram;
- }
-
- «generatedMemberComment»
- public void handleFileRenamed(org.eclipse.core.resources.IFile oldFile, org.eclipse.core.resources.IFile file) {
- }
-
- «generatedMemberComment»
- public void handleFileMoved(org.eclipse.core.resources.IFile oldFile, org.eclipse.core.resources.IFile file) {
- }
-
- «generatedMemberComment»
- public void handleFileDeleted(org.eclipse.core.resources.IFile file) {
- }
-
- «generatedMemberComment»
- public void handleFileChanged(org.eclipse.core.resources.IFile file) {
- }
-
- «generatedMemberComment»
- public void handleMarkerAdded(org.eclipse.core.resources.IMarker marker) {
- if (marker.getAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, null) != null) {
- handleMarkerChanged(marker);
- }
- }
-
- «generatedMemberComment»
- public void handleMarkerDeleted(org.eclipse.core.resources.IMarker marker, java.util.Map attributes) {
- String viewId = (String) attributes.get(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID);
- refreshDecorators(viewId, diagram);
- }
-
- «generatedMemberComment»
- public void handleMarkerChanged(org.eclipse.core.resources.IMarker marker) {
- if (!MARKER_TYPE.equals(getType(marker))) {
- return;
- }
- String viewId = marker.getAttribute(
- org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, ""); «nonNLS(1)»
- refreshDecorators(viewId, diagram);
- }
-
- «generatedMemberComment»
- private String getType(org.eclipse.core.resources.IMarker marker) {
- try {
- return marker.getType();
- } catch (org.eclipse.core.runtime.CoreException e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Validation marker refresh failure", e); «nonNLS(1)»
- return ""; «nonNLS(1)»
- }
- }
- }
- «ENDIF»
«additions(it)»
}
'''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationProvider.xtend
index efcf5484774..9cf01ae5974 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ValidationProvider.xtend
@@ -1,22 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - introduced GenAuditContext entity
- * straightforward and simple #validate() implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - introduced GenAuditContext entity
+ * straightforward and simple #validate() implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import com.google.inject.Inject
+import com.google.inject.Singleton
import metamodel.MetaModel
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenAuditRoot
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenAuditRule
@@ -29,14 +31,15 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExpressionInterpreter
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExpressionProviderBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExpressionProviderContainer
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenJavaExpressionProvider
+import plugin.Activator
+import xpt.CodeStyle
import xpt.Common
import xpt.Common_qvto
import xpt.GenAuditRoot_qvto
import xpt.editor.VisualIDRegistry
import xpt.expressions.getExpression
-import plugin.Activator
-@com.google.inject.Singleton class ValidationProvider {
+@Singleton class ValidationProvider {
@Inject extension Common;
@Inject extension Common_qvto;
@Inject extension GenAuditRoot_qvto;
@@ -46,6 +49,8 @@ import plugin.Activator
@Inject getExpression xptGetExpression;
@Inject MetricProvider xptMetricProvider;
@Inject VisualIDRegistry xptVisualIDRegistry;
+ @Inject extension CodeStyle
+
def className(GenDiagram it) '''«it.validationProviderClassName»'''
@@ -97,6 +102,7 @@ import plugin.Activator
public static void runWithConstraints(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, Runnable operation) {
final Runnable op = operation;
Runnable task = new Runnable() {
+ «overrideI»
public void run() {
try {
constraintsActive = true;
@@ -121,6 +127,8 @@ import plugin.Activator
def additions(GenDiagram it) ''''''
def selectors(GenAuditRoot it) '''
+ «IF it !=null»
+ «IF it.clientContexts !=null»
«FOR ctx : it.clientContexts»
«generatedMemberComment»
public static class «ctx.className» implements org.eclipse.emf.validation.model.IClientSelector {
@@ -129,10 +137,10 @@ import plugin.Activator
public boolean selects(Object object) {
«IF ctx.ruleTargets.filter(typeof(GenDiagramElementTarget)).notEmpty»
if (isInDefaultEditorContext(object) && object instanceof org.eclipse.gmf.runtime.notation.View) {
- final int id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) object);
+ final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) object);
boolean result = false;
«FOR e : getTargetDiagramElements(ctx)»
- result = result || id == «VisualIDRegistry::visualID(e)»;
+ result = result || «VisualIDRegistry::visualID(e)».equals(id);
«ENDFOR»
return result;
}
@@ -143,6 +151,8 @@ import plugin.Activator
}
}
«ENDFOR»
+ «ENDIF»
+ «ENDIF»
'''
def isInDefaultEditorContext(GenDiagram it) '''
@@ -174,7 +184,7 @@ import plugin.Activator
private org.eclipse.emf.validation.service.ITraversalStrategy defaultStrategy;
«generatedMemberComment»
- private int currentSemanticCtxId = -1;
+ private String currentSemanticCtxId;
«generatedMemberComment»
private boolean ctxChanged = true;
@@ -186,12 +196,12 @@ import plugin.Activator
private org.eclipse.emf.ecore.EObject preFetchedNextTarget;
«generatedMemberComment»
- private final int[] contextSwitchingIdentifiers;
+ private final String[] contextSwitchingIdentifiers;
«generatedMemberComment»
CtxSwitchStrategy(org.eclipse.emf.validation.service.IBatchValidator validator) {
this.defaultStrategy = validator.getDefaultTraversalStrategy();
- this.contextSwitchingIdentifiers = new int[] {
+ this.contextSwitchingIdentifiers = new String[] {
«FOR e : getAllTargetDiagramElements(editorGen.audits) SEPARATOR ','»«VisualIDRegistry::visualID(e)»«ENDFOR»
};
java.util.Arrays.sort(this.contextSwitchingIdentifiers);
@@ -236,17 +246,17 @@ import plugin.Activator
private void prepareNextClientContext(org.eclipse.emf.ecore.EObject nextTarget) {
if (nextTarget != null && currentTarget != null) {
if (nextTarget instanceof org.eclipse.gmf.runtime.notation.View) {
- final int id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) nextTarget);
- int nextSemanticId = (id != -1 && java.util.Arrays.binarySearch(contextSwitchingIdentifiers, id) >= 0) ? id : -1;
- if ((currentSemanticCtxId != -1 && currentSemanticCtxId != nextSemanticId)
- || (nextSemanticId != -1 && nextSemanticId != currentSemanticCtxId)) {
+ final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) nextTarget);
+ String nextSemanticId = (id != null && java.util.Arrays.binarySearch(contextSwitchingIdentifiers, id) >= 0) ? id : null;
+ if ((currentSemanticCtxId != null && currentSemanticCtxId != nextSemanticId)
+ || (nextSemanticId != null && nextSemanticId != currentSemanticCtxId)) {
this.ctxChanged = true;
}«/*[artem] not sure why not ctxChanged = <expr>, is it intentional not to reset ctxChanged if condition did not match? I doubt. FIXME?*/»
currentSemanticCtxId = nextSemanticId;
} else {
// context of domain model
- this.ctxChanged = currentSemanticCtxId != -1;
- currentSemanticCtxId = -1;
+ this.ctxChanged = currentSemanticCtxId != null;
+ currentSemanticCtxId = null;
}
} else {
this.ctxChanged = false;
@@ -257,6 +267,7 @@ import plugin.Activator
'''
def constraintAdapters(GenAuditRoot it, GenDiagram diagram) '''
+ «IF it !=null»
«IF diagram.editorGen.expressionProviders != null»
«FOR next : it.rules.filter[a | a.requiresConstraintAdapter]»
«constraintAdapter(next, diagram.editorGen.expressionProviders)»
@@ -266,6 +277,7 @@ import plugin.Activator
«constraintAdapters_formatMethod(it)»
«ENDIF»
«ENDIF»
+ «ENDIF»
'''
def constraintAdapter(GenAuditRule it, GenExpressionProviderContainer container) '''
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ViewProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ViewProvider.xtend
index 61008af7af8..310ae5bd46b 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ViewProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/ViewProvider.xtend
@@ -1,24 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Thibault Landre (Atos Origin) - initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) Add a line to initialize the display of the compartments to true
+ * Vincent Lorenzo (CEA-LIST) - Add lines to initialize the display of the labels - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels
+ * Vincent Lorenzo (CEA-LIST) - Bug 520733
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.gmf.runtime.notation.FillStyle
+import org.eclipse.gmf.runtime.notation.FontStyle
+import org.eclipse.gmf.runtime.notation.LineStyle
+import org.eclipse.gmf.runtime.notation.Style
import org.eclipse.papyrus.gmf.codegen.gmfgen.ColorAttributes
import org.eclipse.papyrus.gmf.codegen.gmfgen.ElementType
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildLabelNode
+import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildNode
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
@@ -38,21 +49,16 @@ import xpt.diagram.ViewmapAttributesUtils_qvto
import xpt.diagram.editpolicies.LinkUtils_qvto
import xpt.diagram.views.ViewStyles
import xpt.editor.VisualIDRegistry
-import org.eclipse.gmf.runtime.notation.FontStyle
-import org.eclipse.gmf.runtime.notation.LineStyle
-import org.eclipse.gmf.runtime.notation.FillStyle
-import org.eclipse.gmf.runtime.notation.Style
-@com.google.inject.Singleton class ViewProvider {
+@Singleton class ViewProvider {
@Inject extension Common;
@Inject extension Common_qvto;
@Inject extension Utils_qvto;
@Inject extension LinkUtils_qvto;
@Inject extension ViewmapAttributesUtils_qvto;
+ @Inject extension VisualIDRegistry xptVisualIDRegistry;
- @Inject ElementTypes xptElementTypes
- @Inject VisualIDRegistry xptVisualIDRegistry;
@Inject ViewStyles xptViewStyles;
def className(GenDiagram it) '''«it.notationViewProviderClassName»'''
@@ -68,293 +74,346 @@ import org.eclipse.gmf.runtime.notation.Style
def ViewProvider(GenDiagram it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» «extendsList(it)»«implementsList(it)» {
-
- «generatedMemberComment»
- public final boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
- if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) operation);
+ «copyright(editorGen)»
+ package «packageName(it)»;
+
+ «generatedClassComment»
+ public class «className(it)» «extendsList(it)»«implementsList(it)» {
+
+ «generatedMemberComment»
+ public final boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
+ if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) {
+ return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) operation);
+ }
+ «_assert('operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation')»
+
+ /* we check this view provider is the good one for the currently edited diagram */
+ if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateChildViewOperation) {
+ View container = ((org.eclipse.gmf.runtime.diagram.core.services.view.CreateChildViewOperation) operation).getContainerView();
+ Diagram diagram = container.getDiagram();
+ if(!getDiagramProvidedId().equals(diagram.getType())) {
+ return false;
+ }
+ }
+
+ if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) {
+ return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) operation);
+ } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) {
+ return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) operation);
+ } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) {
+ return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) operation);
+ }
+ return false;
}
- «_assert('operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation')»
- if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) operation);
- } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) operation);
- } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) operation);
+
+ «generatedMemberComment»
+ protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation op) {
+ /*
+ if (op.getViewKind() == Node.class)
+ return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
+ if (op.getViewKind() == Edge.class)
+ return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
+ */
+
+ // check Diagram Type should be the class diagram
+ String modelID = «getModelIDMethodCall(it)»(op.getContainerView());
+ if(!getDiagramProvidedId().equals(modelID)) {
+ return false;
+ }
+
+ String visualID = «getVisualIDMethodCall(it)»(op.getSemanticHint());
+ if(org.eclipse.gmf.runtime.notation.Node.class.isAssignableFrom(op.getViewKind())) {
+ return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID);
+ }
+
+ return true;
}
- return false;
- }
-
- «generatedMemberComment»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation op) {
- /*
- if (op.getViewKind() == Node.class)
- return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- if (op.getViewKind() == Edge.class)
- return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- */
- return true;
- }
-
- «generatedMemberComment»«/* When diagram domain element is null only diagram kind is checked */»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation op) {
- return «VisualIDRegistry::modelID(it)».equals(op.getSemanticHint())«IF domainDiagramElement != null» && «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())) != -1«ENDIF»;
- }
-
+
«generatedMemberComment»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation op) {
- if (op.getContainerView() == null) {
- return false;
+ protected String getDiagramProvidedId() {
+ /*
+ * Indicates for which diagram this provider works for.
+ * <p>
+ * This method can be overloaded when diagram editor inherits from another one, but should never be <code>null</code>
+ * </p>
+ *
+ * @return the unique identifier of the diagram for which views are provided.
+ */
+ return «VisualIDRegistry::modelID(it)»;
+ }
+
+ «generatedMemberComment»«/* When diagram domain element is null only diagram kind is checked */»
+ protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation op) {
+ return «VisualIDRegistry::modelID(it)».equals(op.getSemanticHint())«IF domainDiagramElement != null» && «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())) != null && !«xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())).isEmpty()«ENDIF»;
}
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- int visualID;
- if (op.getSemanticHint() == null) {
- // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
- // In this situation there should be NO elementType, visualID will be determined
- // by VisualIDRegistry.getNodeVisualID() for domainElement.
- if (elementType != null || domainElement == null) {«/* XXX Perhaps, better to fix CanonicalEP instead of this hack? */»
+
+ «generatedMemberComment»
+ protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation op) {
+ if (op.getContainerView() == null) {
return false;
}
- visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement);
- } else {
- visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(op.getSemanticHint());
- if (elementType != null) {«/*
+ org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
+ org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
+ String visualID;
+ if (op.getSemanticHint() == null) {
+ // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
+ // In this situation there should be NO elementType, visualID will be determined
+ // by VisualIDRegistry.getNodeVisualID() for domainElement.
+ if (elementType != null || domainElement == null) {«/* XXX Perhaps, better to fix CanonicalEP instead of this hack? */»
+ return false;
+ }
+ visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement);
+ } else {
+ visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(op.getSemanticHint());
+ if (elementType != null) {«/*
Semantic hint is specified together with element type.
Both parameters should describe exactly the same diagram element.
In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for
domainElement (if specified) is the same as in element type. */»
- if (!«xptElementTypes.qualifiedClassName(it)».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
+
+ if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
return false; // foreign element type
}
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- if (!op.getSemanticHint().equals(elementTypeHint)) {
- return false; // if semantic hint is specified it should be the same as in element type
- }
- if (domainElement != null && visualID != «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement)) {
- return false; // visual id for node EClass should match visual id from element type
- }
- } else {«/*
+
+ String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
+ if (!op.getSemanticHint().equals(elementTypeHint)) {
+ return false; // if semantic hint is specified it should be the same as in element type
+ }
+ //if (domainElement != null && !visualID.equals(«getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) {
+ // return false; // visual id for node EClass should match visual id from element type
+ //}
+ } else {«/*
Element type is not specified. Domain element should be present (except pure design elements).
This method is called with EObjectAdapter as parameter from:
- ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint)
- generated ViewFactory.decorateView() for parent element */»
- «IF getAllTypedElements().filter[e | e.elementType != null].notEmpty»
+ «IF ! getAllTypedElements(it).filter[e|e.elementType != null].empty»
if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(op.getContainerView()))) {
return false; // foreign diagram
}
- switch (visualID) {
- «IF getAllNodes().exists[e|e.elementType.oclIsKindOf(typeof(NotationType))]»
- «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(NotationType))»
- «localCaseVisualID(e)»
- «ENDFOR»
- break; // pure design element
- «ENDIF»
- «IF getAllNodes().exists[e|e.elementType.oclIsKindOf(typeof(MetamodelType)) || e.elementType.oclIsKindOf(typeof(SpecializationType))]»
- «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(MetamodelType))»
- «localCaseVisualID(e)»
- «ENDFOR»
- «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(SpecializationType))»
- «localCaseVisualID(e)»
- «ENDFOR»
- if (domainElement == null || visualID != «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement)) {
- return false; // visual id in semantic hint should match visual id for domain element
+ if (visualID != null) {
+ switch (visualID) {
+ «IF getAllNodes().exists[e|e.elementType instanceof NotationType]»
+ «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(NotationType))»
+ «localCaseVisualID(e)»
+ «ENDFOR»
+ break; // pure design element
+ «ENDIF»
+ «IF getAllNodes().exists[e|e.elementType instanceof MetamodelType || e.elementType instanceof SpecializationType]»
+ «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(MetamodelType))»
+ «localCaseVisualID(e)»
+ «ENDFOR»
+ «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(SpecializationType))»
+ «localCaseVisualID(e)»
+ «ENDFOR»
+ if (domainElement == null || !visualID.equals(«xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) {
+ return false; // visual id in semantic hint should match visual id for domain element
+ }
+ break;«/*FIXME: Perhaps, can return true or false right away, without any further check?*/»
+ «ENDIF»
+ default:
+ return false;
}
- break;«/*FIXME: Perhaps, can return true or false right away, without any further check?*/»
- «ENDIF»
- default:
- return false;
}
- «ELSE»
+ «ELSE»
return false;
- «ENDIF»
+ «ENDIF»
}
+ }
+
+ return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID);
}
- return «FOR n : getAllNodes() SEPARATOR '||'»«VisualIDRegistry::visualID(n)» == visualID«ENDFOR»;
+
+ «generatedMemberComment»«/* XXX: unlike createNode, we don't check op.containerView() for null here. On purpose? */»
+ protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation op) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
+
+ if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
+ return false; // foreign element type
}
-
- «generatedMemberComment»«/* XXX: unlike createNode, we don't check op.containerView() for null here. On purpose? */»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation op) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- if (!«xptElementTypes.qualifiedClassName(it)».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- return false; // foreign element type
- }
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
- return false; // our hint is visual id and must be specified, and it should be the same as in element type
- }
- int visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(elementTypeHint);
- org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- if (domainElement != null && visualID != «xptVisualIDRegistry.getLinkWithClassVisualIDMethodCall(it)»(domainElement)) {
- return false; // visual id for link EClass should match visual id from element type
- }
- return true; «/* Does it make sense to check visualID here, like we did for nodes? */»
+
+ String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
+ if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
+ return false; // our hint is visual id and must be specified, and it should be the same as in element type
}
-
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Diagram createDiagram(org.eclipse.core.runtime.IAdaptable semanticAdapter, String diagramKind, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();«/* FIXME instantiate diagramRunTimeClass instead */»
- diagram.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle());
- «xptViewStyles.addCustomStyles(it, 'diagram.getStyles()')»
- diagram.setType(«VisualIDRegistry::modelID(it)»);
- diagram.setElement(«IF domainDiagramElement != null»getSemanticElement(semanticAdapter)«ELSE»null«ENDIF»);
- «IF units != null»
- diagram.setMeasurementUnit(org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpperCase»_LITERAL);
- «ENDIF»
- «IF styles.notEmpty»
- // initializeFromPreferences
- org.eclipse.jface.preferences.IPreferenceStore store = (org.eclipse.jface.preferences.IPreferenceStore) preferencesHint.getPreferenceStore();
- «initializeStyles(it, 'diagram', 'store', false, false, false)»
- «ENDIF»
+ //String visualID = «getVisualIDMethodCall(it)»(elementTypeHint);
+ //org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
+ //if (domainElement != null && !visualID.equals(«getLinkWithClassVisualIDMethodCall(it)»(domainElement))) {
+ // return false; // visual id for link EClass should match visual id from element type
+ //}
+ return true; «««Does it make sense to check visualID here, like we did for nodes?
+ }
+
+
+ «generatedMemberComment»
+ @SuppressWarnings("unchecked")
+ public org.eclipse.gmf.runtime.notation.Diagram createDiagram(org.eclipse.core.runtime.IAdaptable semanticAdapter, String diagramKind, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
+ org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();«/* FIXME instantiate diagramRunTimeClass instead */»
+ org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils.stampCurrentVersion(diagram);«/* Papyrus specific diagram versioning */»
+ diagram.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle());
+ «xptViewStyles.addCustomStyles(it, 'diagram.getStyles()')»
+ diagram.setType(«VisualIDRegistry::modelID(it)»);
+ diagram.setElement(«IF domainDiagramElement != null»getSemanticElement(semanticAdapter)«ELSE»null«ENDIF»);
+ «IF units != null»
+ diagram.setMeasurementUnit(org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpperCase»_LITERAL);
+ «ENDIF»
+ «IF ! styles.empty»
+ // initializeFromPreferences
+ org.eclipse.jface.preferences.IPreferenceStore store = (org.eclipse.jface.preferences.IPreferenceStore) preferencesHint.getPreferenceStore();
+ «initializeStyles(it, 'diagram', 'store', false, false, false)»
+ «ENDIF»
return diagram;
- }
-
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node createNode(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- final org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(semanticAdapter);
- final int visualID;
- if (semanticHint == null) {
- visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(containerView, domainElement);
- } else {
- visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(semanticHint);
- }
- switch(visualID) {
- «FOR n : getAllNodes()»
- «xptVisualIDRegistry.caseVisualID(n)»
- return create«n.uniqueIdentifier»(domainElement, containerView, index, persisted, preferencesHint);
- «ENDFOR»
- }
- // can't happen, provided #provides(CreateNodeViewOperation) is correct
- return null;
- }
-
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Edge createEdge(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(semanticAdapter);
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- switch («xptVisualIDRegistry.getVisualIDMethodCall(it)»(elementTypeHint)) {
- «FOR link : links»
- «xptVisualIDRegistry.caseVisualID(link)»
- return create«link.uniqueIdentifier»(«IF link.isTypeLink()» getSemanticElement(semanticAdapter), «ENDIF»containerView, index, persisted, preferencesHint);
- «ENDFOR»
}
- // can never happen, provided #provides(CreateEdgeViewOperation) is correct
- return null;
- }
-
- «FOR next : getAllNodes()»
- «createNodeMethod(next)»
- «ENDFOR»
- «FOR next : links»
- «createEdgeMethod(next)»
- «ENDFOR»
-
- «IF topLevelNodes.notEmpty»
+
«generatedMemberComment»
- private void stampShortcut(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.Node target) {
- if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(containerView))) {
- «addShortcutAnnotation(it, 'target')»
+ public org.eclipse.gmf.runtime.notation.Node createNode(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
+ final org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(semanticAdapter);
+ final String visualID;
+ if (semanticHint == null) {
+ visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(containerView, domainElement);
+ } else {
+ visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(semanticHint);
}
+ if (visualID != null) {
+ switch(visualID) {
+ «FOR n : getAllNodes()»
+ «xptVisualIDRegistry.caseVisualID(n)»
+ return create«n.stringUniqueIdentifier»(domainElement, containerView, index, persisted, preferencesHint);
+ «ENDFOR»
+ }
+ }
+ // can't happen, provided #provides(CreateNodeViewOperation) is correct
+ return null;
}
- «ENDIF»
-
- «IF links.map[l|l.labels].flatten.notEmpty || topLevelNodes.map[n|n.labels].flatten.notEmpty || childNodes.map[n|n.labels].flatten.notEmpty»
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.Node createLabel(org.eclipse.gmf.runtime.notation.View owner, String hint) {
- org.eclipse.gmf.runtime.notation.DecorationNode rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDecorationNode();
- rv.setType(hint);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true);
- return rv;
- }
- «ENDIF»
-
- «IF getAllNodes().map[n|n.compartments].flatten.notEmpty»
+
«generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.Node createCompartment(org.eclipse.gmf.runtime.notation.View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) {
- //SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
- //rv.setShowTitle(showTitle);
- //rv.setCollapsed(isCollapsed);
- org.eclipse.gmf.runtime.notation.Node rv;
- if (canCollapse) {
- rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBasicCompartment();
- } else {
- rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDecorationNode();
+ public org.eclipse.gmf.runtime.notation.Edge createEdge(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(semanticAdapter);
+ String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
+ String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(elementTypeHint);
+ if (vid != null) {
+ switch (vid) {
+ «FOR link : links»
+ «xptVisualIDRegistry.caseVisualID(link)»
+ return create«link.stringUniqueIdentifier»(«IF isTypeLink(link)» getSemanticElement(semanticAdapter), «ENDIF»containerView, index, persisted, preferencesHint);
+ «ENDFOR»
+ }
}
- if (hasTitle) {
- org.eclipse.gmf.runtime.notation.TitleStyle ts = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle();
- ts.setShowTitle(true);
- rv.getStyles().add(ts);
+ // can never happen, provided #provides(CreateEdgeViewOperation) is correct
+ return null;
+ }
+
+ «FOR next : getAllNodes()»
+ «createNodeMethod(next)»
+ «ENDFOR»
+ «FOR next : links»
+ «createEdgeMethod(next)»
+ «ENDFOR»
+
+ «IF ! topLevelNodes.empty»
+ «generatedMemberComment»
+ protected void stampShortcut(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.Node target) {
+ if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(containerView))) {
+ «addShortcutAnnotation(it, 'target')»
+ }
}
- if (canSort) {
- rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createSortingStyle());
+ «ENDIF»
+
+ «IF links.map[l|l.labels].flatten.notEmpty || topLevelNodes.map[n|n.labels].flatten.notEmpty || childNodes.map[n|n.labels].flatten.notEmpty»
+ «generatedMemberComment»
+ protected org.eclipse.gmf.runtime.notation.Node createLabel(org.eclipse.gmf.runtime.notation.View owner, String hint) {
+ org.eclipse.gmf.runtime.notation.DecorationNode rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDecorationNode();
+ rv.setType(hint);
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true);
+ return rv;
}
- if (canFilter) {
- rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFilteringStyle());
+ «ENDIF»
+
+ «IF getAllNodes().map[n|n.compartments].flatten.notEmpty»
+ «generatedMemberComment»
+ protected org.eclipse.gmf.runtime.notation.Node createCompartment(org.eclipse.gmf.runtime.notation.View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) {
+ //SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
+ //rv.setShowTitle(showTitle);
+ //rv.setCollapsed(isCollapsed);
+ org.eclipse.gmf.runtime.notation.Node rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBasicCompartment();
+
+ rv.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
+
+ if (hasTitle) {
+ org.eclipse.gmf.runtime.notation.TitleStyle ts = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle();
+ rv.getStyles().add(ts);
+ }
+ if (canSort) {
+ rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createSortingStyle());
+ }
+ if (canFilter) {
+ rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFilteringStyle());
+ }
+ rv.setType(hint);
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true);
+ return rv;
}
- rv.setType(hint);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true);
- return rv;
- }
- «ENDIF»
-
- «getSemanticElementMethod(it)»
- «getSemanticElementTypeMethod(it)»
- «additions(it)»
- }
+ «ENDIF»
+
+ «getSemanticElementMethod(it)»
+ «getSemanticElementTypeMethod(it)»
+ «additions(it)»
+ }
'''
def dispatch createNodeMethod(GenNode it) '''
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node create«uniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- «IF viewmap.canUseShapeStyle()»
- org.eclipse.gmf.runtime.notation.Shape node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape();
- «ELSE»
- org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createNode();
- node.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());«/* FIXME Contionally add this style, whether toolsmith needs Notes or not */»
- «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, 'node.getStyles()')»
- «ENDIF»
- «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')»
- «xptViewStyles.addCustomStyles(it, 'node.getStyles()')»
- node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
- node.setType(«xptVisualIDRegistry.typeMethodCall(it)»);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- «IF it.oclIsKindOf(typeof(GenTopLevelNode))»
- stampShortcut(containerView, node);
- «ENDIF»
- // initializeFromPreferences «/* XXX Perhaps, do init only once, for complete figure? */»
- final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «initializeStyles(it, 'node', 'prefStore', !viewmap.isFixedForeground(), !viewmap.isFixedBackground(), !viewmap.isFixedFont())»
- «FOR label : it.labels»
- «initLabel(label, 'node', 'prefStore')»
- «ENDFOR»
- «FOR comp : it.compartments»
- «initCompartment(comp, 'node', 'prefStore')»
- «ENDFOR»
- return node;
- }
+ «generatedMemberComment»
+ public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
+ «IF canUseShapeStyle(viewmap)»
+ org.eclipse.gmf.runtime.notation.Shape node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape();
+ «ELSE»
+ org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createNode();
+ node.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());«/* FIXME Contionally add this style, whether toolsmith needs Notes or not */»
+ «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, 'node.getStyles()')»
+ «ENDIF»
+ «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')»
+ «xptViewStyles.addCustomStyles(it, 'node.getStyles()')»
+ node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
+ node.setType(«xptVisualIDRegistry.typeMethodCall(it)»);
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ «IF it instanceof GenTopLevelNode»
+ stampShortcut(containerView, node);
+ «ENDIF»
+ // initializeFromPreferences «/* XXX Perhaps, do init only once, for complete figure? */»
+ final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
+ «initializeStyles(it, 'node', 'prefStore', !isFixedForeground(viewmap), !isFixedBackground(viewmap), !isFixedFont(viewmap))»
+ «FOR label : it.labels»
+ «initLabel(label, 'node', 'prefStore')»
+ «ENDFOR»
+ «FOR comp : it.compartments»
+ «initCompartment(comp, 'node', 'prefStore')»
+ «ENDFOR»
+ ««« BEGIN Papyrus Modification
+ «IF compartments.size != 0»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(«'node'», «'prefStore'», "«elementType.displayName»");
+ «ENDIF»
+ ««« END Papyrus Modification
+ «initLabelVisibility(it,'node', 'prefStore')»
+ return node;
+ }
'''
// Location as layoutConstraint, no children
def dispatch createNodeMethod(GenChildLabelNode it) '''
«generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node create«uniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createNode();
+ public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
+ org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());«/* [artem] XXX not sure, why LabelNode needs location */»
«xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')»
«xptViewStyles.addCustomStyles(it, 'node.getStyles()')»
node.setType(«xptVisualIDRegistry.typeMethodCall(it)»);
org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
- «IF styles.notEmpty»
- final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «initializeStyles(it, 'node', 'prefStore', false, false, false)»
- «ENDIF»
+
+ final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
+ «initFontFromPrefs(it,'node', 'prefStore')»
+ «initForegroundFromPrefs(it,'node', 'prefStore')»
return node;
}
'''
@@ -386,9 +445,11 @@ import org.eclipse.gmf.runtime.notation.Style
* FIXME check if there's need for a variable name, see initCompartment for a hint
*/
def initLabel(GenLabel it, String nodeVar, String prefStoreVar) '''
- «var String labelVar = 'label' + it.visualID»
+ «var String labelVar = it.stringUniqueIdentifier.toFirstLower»
org.eclipse.gmf.runtime.notation.Node «labelVar» = createLabel(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)»);
+ «IF it.modelFacet !=null»
«xptViewStyles.addTextStyle(it.modelFacet, labelVar + '.getStyles()')»
+ «ENDIF»
«xptViewStyles.addCustomStyles(it, labelVar + '.getStyles()')»
«IF it.oclIsKindOf(typeof(GenExternalNodeLabel)) || it.oclIsKindOf(typeof(GenLinkLabel))»
«labelVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());
@@ -398,7 +459,7 @@ import org.eclipse.gmf.runtime.notation.Style
'''
def initCompartment(GenCompartment it, String nodeVar, String prefStoreVar) '''
- «var String compartmentVar= 'compartment' + it.visualID»
+ «var String compartmentVar= it.stringUniqueIdentifier.toFirstLower»
«IF it.styles.notEmpty || isStoringChildPositions(it.layoutType)»org.eclipse.gmf.runtime.notation.Node «compartmentVar» = «ENDIF»createCompartment(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)», «canCollapse», «needsTitle», «listLayout», «listLayout»);
«xptViewStyles.addCustomStyles(it, compartmentVar + '.getStyles()')»
«IF isStoringChildPositions(it.layoutType)»
@@ -415,68 +476,59 @@ import org.eclipse.gmf.runtime.notation.Style
'''
def initForegroundFromPrefs(GenCommonBase it, String viewVar, String prefStoreVar) '''
- org.eclipse.swt.graphics.RGB lineRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(«prefStoreVar», org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_COLOR);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar», org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(lineRGB));
- '''
+ «specificInitForegroundFromPrefs(it,viewVar, prefStoreVar)»
+'''
def initBackgroundFromPrefs(GenCommonBase it, String viewVar, String prefStoreVar) '''
- org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(«prefStoreVar», org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_FILL_COLOR);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar», org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB));
- '''
+ «specificInitForegroundFromPrefs(it,viewVar, prefStoreVar)»
+'''
def initFontFromPrefs(GenCommonBase it, String viewVar, String prefStoreVar) '''
- org.eclipse.gmf.runtime.notation.FontStyle «viewVar»FontStyle = (org.eclipse.gmf.runtime.notation.FontStyle) «viewVar».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FONT_STYLE);
- if («viewVar»FontStyle != null) {«/* Given this template is invoked only when FontStyle is present, no need to check fontStyle for null, but at least this gives a scope for fontData var */»
- org.eclipse.swt.graphics.FontData fontData = org.eclipse.jface.preference.PreferenceConverter.getFontData(«prefStoreVar», org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_DEFAULT_FONT);
- «viewVar»FontStyle.setFontName(fontData.getName());
- «viewVar»FontStyle.setFontHeight(fontData.getHeight());
- «viewVar»FontStyle.setBold((fontData.getStyle() & org.eclipse.swt.SWT.BOLD) != 0);
- «viewVar»FontStyle.setItalic((fontData.getStyle() & org.eclipse.swt.SWT.ITALIC) != 0);
- org.eclipse.swt.graphics.RGB fontRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(«prefStoreVar», org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_FONT_COLOR);
- «viewVar»FontStyle.setFontColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
- '''
+ «specificInitFontFromPrefs(it,viewVar, prefStoreVar)»
+'''
def createEdgeMethod(GenLink it) '''
«generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Edge create«uniqueIdentifier»(«IF it.isTypeLink()»org.eclipse.emf.ecore.EObject domainElement, «ENDIF»org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- «IF viewmap.isFixedForeground()»
+ public org.eclipse.gmf.runtime.notation.Edge create«stringUniqueIdentifier»(«IF isTypeLink(it)»org.eclipse.emf.ecore.EObject domainElement, «ENDIF»org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
+ «IF isFixedForeground(viewmap)»
org.eclipse.gmf.runtime.notation.Edge edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createEdge();
edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRoutingStyle());
«ELSE»
org.eclipse.gmf.runtime.notation.Connector edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createConnector();
«ENDIF»
- «IF !viewmap.isFixedFont()»
+ «IF !isFixedFont(viewmap)»
edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle());
«ENDIF»
«xptViewStyles.addCustomStyles(it, 'edge.getStyles()')»
org.eclipse.gmf.runtime.notation.RelativeBendpoints bendpoints = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRelativeBendpoints();
- java.util.ArrayList<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint> points = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint>(2);
+ java.util.List<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint> points = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint>(2);
points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint());
points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint());
bendpoints.setPoints(points);
edge.setBendpoints(bendpoints);
org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, edge, index, persisted);
edge.setType(«xptVisualIDRegistry.typeMethodCall(it)»);
- edge.setElement(«IF it.isTypeLink()»domainElement«ELSE»null«ENDIF»);
+ edge.setElement(«IF isTypeLink(it)»domainElement«ELSE»null«ENDIF»);
// initializePreferences
final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «initializeStyles(it, 'edge', 'prefStore', !viewmap.isFixedForeground(), false, !viewmap.isFixedFont())»
- org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- if (routing != null) {
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- }
+ «initializeStyles(it, 'edge', 'prefStore', !isFixedForeground(viewmap), false, !isFixedFont(viewmap))»
+ //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
+ //if (routing != null) {
+ // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
+ //}
+ «initRountingFromPrefs(it,'edge', 'prefStore')»
«FOR label : it.labels»
«initLabel(label, 'edge', 'prefStore')»
«ENDFOR»
+ «initLabelVisibility(it,'edge', 'prefStore')»
return edge;
}
'''
def getSemanticElementMethod(GenDiagram it) '''
«generatedMemberComment»
- private org.eclipse.emf.ecore.EObject getSemanticElement(org.eclipse.core.runtime.IAdaptable semanticAdapter) {
+ protected org.eclipse.emf.ecore.EObject getSemanticElement(org.eclipse.core.runtime.IAdaptable semanticAdapter) {
if (semanticAdapter == null) {
return null;
}
@@ -490,7 +542,7 @@ import org.eclipse.gmf.runtime.notation.Style
def getSemanticElementTypeMethod(GenDiagram it) '''
«generatedMemberComment»
- private org.eclipse.gmf.runtime.emf.type.core.IElementType getSemanticElementType(org.eclipse.core.runtime.IAdaptable semanticAdapter) {
+ protected org.eclipse.gmf.runtime.emf.type.core.IElementType getSemanticElementType(org.eclipse.core.runtime.IAdaptable semanticAdapter) {
if (semanticAdapter == null) {
return null;
}
@@ -504,7 +556,65 @@ import org.eclipse.gmf.runtime.notation.Style
«ENDIF»
'''
- def additions(GenDiagram it) ''''''
+ def additions(GenDiagram it) '''
+
+ «generatedMemberComment»
+ private void initFontStyleFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
+ {
+ String fontConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.FONT);
+ String fontColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FONT);
+
+ org.eclipse.gmf.runtime.notation.FontStyle viewFontStyle = (org.eclipse.gmf.runtime.notation.FontStyle) view.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FONT_STYLE);
+ if (viewFontStyle != null)
+ {
+ org.eclipse.swt.graphics.FontData fontData = org.eclipse.jface.preference.PreferenceConverter.getFontData(store, fontConstant);
+ viewFontStyle.setFontName(fontData.getName());
+ viewFontStyle.setFontHeight(fontData.getHeight());
+ viewFontStyle.setBold((fontData.getStyle() & org.eclipse.swt.SWT.BOLD) != 0);
+ viewFontStyle.setItalic((fontData.getStyle() & org.eclipse.swt.SWT.ITALIC) != 0);
+
+ org.eclipse.swt.graphics.RGB fontRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, fontColorConstant);
+ viewFontStyle.setFontColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fontRGB).intValue());
+ }
+ }
+
+ «generatedMemberComment»
+ private void initForegroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
+ {
+ String lineColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE);
+ org.eclipse.swt.graphics.RGB lineRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, lineColorConstant);
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(lineRGB));
+ }
+
+ «generatedMemberComment»
+ private void initBackgroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
+ {
+ String fillColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL);
+ String gradientColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName,org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT);
+ String gradientPolicyConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName,org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.GRADIENT_POLICY);
+
+
+ org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, fillColorConstant);
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB));
+
+
+ org.eclipse.gmf.runtime.notation.FillStyle fillStyle = (org.eclipse.gmf.runtime.notation.FillStyle) view
+ .getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FILL_STYLE);
+ fillStyle
+ .setFillColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB).intValue());
+
+ ;
+ if (store.getBoolean(gradientPolicyConstant)) {
+ org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
+ store.getString(gradientColorConstant));
+ fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
+ fillStyle
+ .setTransparency(gradientPreferenceConverter.getTransparency());
+ }
+ }
+
+
+'''
def boolean hasFontStyleInCustom(GenCommonBase it) {
return hasNotationStyleInCustomStyles(it, typeof(FontStyle));
@@ -524,6 +634,112 @@ import org.eclipse.gmf.runtime.notation.Style
def boolean hasNotationStyleInCustomStyles(GenCommonBase it, Class<? extends Style> styleType) {
return it.styles.exists[s|s.ecoreClass.oclIsKindOf(styleType)];
}
-
+
+def specificInitFontFromPrefs(GenNode it,String viewVar, String prefStoreVar)'''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitFontFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) '''
+«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitFontFromPrefs(GenLink it,String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitFontFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
+«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitForegroundFromPrefs(GenNode it,String viewVar, String prefStoreVar)'''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitForegroundFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitForegroundFromPrefs(GenLink it,String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitForegroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
+'''
+
+def specificInitBackgroundFromPrefs(GenNode it,String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitBackgroundFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitBackgroundFromPrefs(GenLink it, String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitBackgroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
+'''
+
+
+def initRountingFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
+ « specificInitRountingFromPrefs(it,viewVar, prefStoreVar)»
+'''
+
+def specificInitRountingFromPrefs(GenNode it,String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitRountingFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitRountingFromPrefs(GenLink it, String viewVar, String prefStoreVar) '''
+ «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+def specificInitRountingFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
+'''
+
+//write the line to initialize the property isVisible for the label of the link
+def initLabelVisibility(GenLink it,String viewVar, String prefStoreVar) '''
+
+ «IF it.labels.filter(typeof (GenLinkLabel)).exists[lbl | lbl.labelVisibilityPreference !== null]»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
+
+//write the line to initialize the property isVisible for the label of the link
+def initLabelVisibility(GenNode it,String viewVar, String prefStoreVar) '''
+ «IF it.labels.filter(typeof (GenExternalNodeLabel)).exists[lbl | lbl.labelVisibilityPreference !== null]»
+ org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
+ «ENDIF»
+'''
}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/VisualTypeProvider.xtend
index 91983fca962..e275137e029 100644
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/VisualTypeProvider.xtend
@@ -10,10 +10,9 @@
*
* Contributors:
* Christian W. Damus - Initial API and implementation
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
*****************************************************************************/
-package aspects.xpt.providers
+package xpt.providers
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/extensions.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/extensions.xtend
index 934eacfbb15..68012f0bb9b 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/extensions.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/providers/extensions.xtend
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+ * Copyright (c) 2007, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -9,9 +9,10 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- */
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #386838 - migrate to Xtend2
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ *****************************************************************************/
package xpt.providers
import com.google.inject.Inject
@@ -43,6 +44,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
@Inject EditPartModelingAssistantProvider xptEditPartModelingAssistant;
@Inject ParserProvider labelParsers;
@Inject ShortcutsDecoratorProvider shorcutProvider;
+ @Inject VisualTypeProvider visualTypeProvider;
@Inject EditHelper editHelper;
@Inject EditHelperAdvice editHelperAdvice;
@@ -52,7 +54,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
«tripleSpace(2)»«xmlGeneratedTag»
«tripleSpace(2)»<viewProvider class="«viewProvider.qualifiedClassName(it)»">
«tripleSpace(3)»<Priority name="«notationViewProviderPriority»"/>
- «IF shortcutsProvidedFor.notEmpty/*allow provider activation when another diagram tries to create a node, perhaps ours*/»
+ «IF ! shortcutsProvidedFor.empty/*allow provider activation when another diagram tries to create a node, perhaps ours*/»
«tripleSpace(3)»<object id="referencing-diagrams" class="org.eclipse.gmf.runtime.notation.Diagram">
«tripleSpace(4)»<method name="getType()" value="«FOR s : shortcutsProvidedFor SEPARATOR ','»«s»«ENDFOR»"/>
«tripleSpace(3)»</object>
@@ -60,7 +62,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
«ENDIF»
«tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="«editorGen.modelID»"/>
«tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="«commaSeparatedVisualIDs(allNodes)»"/>
- «IF links.notEmpty/*it is unlikely there would be a diagram without a node, but a diagram without links deemed possible */»
+ «IF ! links.empty/*it is unlikely there would be a diagram without a node, but a diagram without links deemed possible */»
«tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="«commaSeparatedVisualIDs(links)»"/>
«ENDIF»
«tripleSpace(2)»</viewProvider>
@@ -87,9 +89,9 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
«tripleSpace(3)»</object>
«tripleSpace(3)»<context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/>
«tripleSpace(2)»</editpartProvider>
- «tripleSpace(1)»</extension>
+ «tripleSpace(1)»</extension>
- «modelingAssistantProvider(it)»
+««« «modelingAssistantProvider(it)»
«tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider">
«tripleSpace(2)»«xmlGeneratedTag»
@@ -113,35 +115,53 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
«tripleSpace(2)»<decoratorProvider class="«shorcutProvider.qualifiedClassName(it)»">
«tripleSpace(3)»<Priority name="«shortcutsDecoratorProviderPriority»"/>
«tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)" id="generated-top-nodes">
- «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(topLevelNodes)/*generated code supports shortcuts only to top-level nodes*/»"/>
+ «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(it.topLevelNodes)/*generated code supports shortcuts only to top-level nodes*/»"/>
«tripleSpace(3)»</object>
«tripleSpace(3)»<context decoratorTargets="generated-top-nodes"/>
«tripleSpace(2)»</decoratorProvider>
«tripleSpace(1)»</extension>
«ENDIF»
-
- «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
- «tripleSpace(2)»«xmlGeneratedTag»
- «FOR e : getAllTypedElements()»
- «elementTypeSafe(e.elementType)»
- «ENDFOR»
- «tripleSpace(1)»</extension>
-
- «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings">
+
+««« commented for bug 520882
+««« «IF !getLocalDefineTypedElements(it).empty»
+««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
+««« «tripleSpace(2)»«xmlGeneratedTag»
+««« «FOR e : getLocalDefineTypedElements(it)»
+««« «elementTypeSafe(e.elementType)»
+««« «ENDFOR»
+««« «tripleSpace(1)»</extension>
+««« «ENDIF»
+«««
+««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings">
+««« «tripleSpace(2)»«xmlGeneratedTag»
+««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size<1»
+««« «tripleSpace(2)»<clientContext id="«editorGen.plugin.ID».TypeContext">
+««« «tripleSpace(3)»<enablement>
+««« «tripleSpace(4)»<test
+««« «tripleSpace(5)»property="org.eclipse.gmf.runtime.emf.core.editingDomain"
+««« «tripleSpace(5)»value="«editingDomainID»"/>
+««« «tripleSpace(3)»</enablement>
+««« «tripleSpace(2)»</clientContext>
+««« «tripleSpace(2)»<binding context="«editorGen.plugin.ID».TypeContext">
+««« «ENDIF»
+««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0»
+«««
+««« <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
+««« «ENDIF»
+««« «FOR e : getLocalDefineTypedElements(it)»
+««« «tripleSpace(3)»<elementType ref="«e.elementType.uniqueIdentifier»"/>
+««« «ENDFOR»
+««« «tripleSpace(3)»<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+««« «tripleSpace(2)»</binding>
+««« «tripleSpace(1)»</extension>
+
+ «extraLineBreak»
+ «tripleSpace(1)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders">
«tripleSpace(2)»«xmlGeneratedTag»
- «tripleSpace(2)»<clientContext id="«editorGen.plugin.ID».TypeContext">
- «tripleSpace(3)»<enablement>
- «tripleSpace(4)»<test
- «tripleSpace(5)»property="org.eclipse.gmf.runtime.emf.core.editingDomain"
- «tripleSpace(5)»value="«editingDomainID»"/>
- «tripleSpace(3)»</enablement>
- «tripleSpace(2)»</clientContext>
- «tripleSpace(2)»<binding context="«editorGen.plugin.ID».TypeContext">
- «FOR e : getAllTypedElements()»
- «tripleSpace(3)»<elementType ref="«e.elementType.uniqueIdentifier»"/>
- «ENDFOR»
- «tripleSpace(3)»<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
- «tripleSpace(2)»</binding>
+ «tripleSpace(2)»<visualTypeProvider
+ «tripleSpace(4)»class="«visualTypeProvider.qualifiedClassName(it)»"
+ «tripleSpace(4)»diagramType="«editorGen.modelID»">
+ «tripleSpace(3)»</visualTypeProvider>
«tripleSpace(1)»</extension>
'''
@@ -153,17 +173,17 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
def dispatch elementType(ElementType it) '''«ERROR('Unknown element type: ' + it)»'''
- def dispatch elementType(MetamodelType it) '''
+ def dispatch elementType(MetamodelType it)'''
«tripleSpace(2)»<metamodel nsURI="«getMetaClass().genPackage.getEcorePackage.nsURI»">
«tripleSpace(3)»<metamodelType
«tripleSpace(5)»id="«uniqueIdentifier»"
«IF null != displayName»
- «tripleSpace(5)»name="%metatype.name.«diagramElement.uniqueIdentifier»"
+ «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»"
«ENDIF»
«tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
«tripleSpace(5)»eclass="«getMetaClass().ecoreClass.name»"
«tripleSpace(5)»edithelper="«editHelper.qualifiedClassName(it)»">
- «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.visualID»"/>
+ «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/>
«tripleSpace(3)»</metamodelType>
«tripleSpace(2)»</metamodel>
'''
@@ -182,13 +202,13 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
«tripleSpace(3)»<specializationType
«tripleSpace(5)»id="«uniqueIdentifier»"
«IF null != displayName»
- «tripleSpace(5)»name="%metatype.name.«diagramElement.uniqueIdentifier»"
+ «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»"
«ENDIF»
«tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"«IF editHelperAdviceClassName != null»
«tripleSpace(5)»edithelperadvice="«editHelperAdvice.qualifiedClassName(it)»"«ENDIF»>
«tripleSpace(4)»<specializes id="«IF (null == metamodelType)»org.eclipse.gmf.runtime.emf.type.core.null«ELSE»«metamodelType.
uniqueIdentifier»«ENDIF»"/>
- «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.visualID»"/>
+ «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/>
«tripleSpace(3)»</specializationType>
'''
@@ -196,11 +216,11 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
«tripleSpace(2)»<specializationType
«tripleSpace(4)»id="«uniqueIdentifier»"
«IF null != displayName»
- «tripleSpace(4)»name="%metatype.name.«diagramElement.uniqueIdentifier»"
+ «tripleSpace(4)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»"
«ENDIF»
«tripleSpace(4)»kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
«tripleSpace(3)»<specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- «tripleSpace(3)»<param name="semanticHint" value="«diagramElement.visualID»"/>
+ «tripleSpace(3)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/>
«tripleSpace(2)»</specializationType>
'''
@@ -228,7 +248,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
@MetaDef def dispatch modelingAssistantProviderQualifiedClassName(GenNode it)'''«xptEditPartModelingAssistant.qualifiedClassName(it)»'''
- def commaSeparatedVisualIDs(Iterable<? extends GenCommonBase> list) '''«FOR gcb : list SEPARATOR ','»«gcb.visualID»«ENDFOR»'''
+ def commaSeparatedVisualIDs(Iterable<? extends GenCommonBase> list) '''«FOR gcb : list SEPARATOR ','»«gcb.stringUniqueIdentifier»«ENDFOR»'''
@Localization def i18n(GenDiagram it) '''
@@ -241,4 +261,10 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
«IF null != displayName && !definedExternally»metatype.name.«diagramElement.uniqueIdentifier»=«displayName»«ENDIF»
'''
+
+
+ def getLocalDefineTypedElements(GenDiagram it) {
+ getAllTypedElements(it).filter[et| false == et.elementType.definedExternally]
+ }
+
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.ecore b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.ecore
index 68af8f78ee8..2b35f8fba43 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.ecore
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.ecore
@@ -102,6 +102,8 @@
<details key="documentation" value="Custom extensions for this generator"/>
</eAnnotations>
</eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="jdkComplianceLevel" eType="ecore:EEnum platform:/plugin/org.eclipse.emf.codegen.ecore/model/GenModel.ecore#//GenJDKLevel"
+ defaultValueLiteral="11.0"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GenDiagram" eSuperTypes="#//GenContainerBase #//PackageNames #//ProviderClassNames #//LinkConstraints #//EditPartCandies #//EditorCandies #//Shortcuts #//BatchValidation #//MeasurementUnit">
<eAnnotations source="http://www.eclipse.org/gmf/2005/constraints">
@@ -1092,8 +1094,7 @@
<details key="documentation" value="Bug 569174 : from ExtendedGenView"/>
</eAnnotations>
</eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="locatorClassName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="locatorClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Bug 569174 : from SpecificLocatorExternalLabel"/>
</eAnnotations>
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.genmodel b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.genmodel
index f6406786b8b..2ea1c24bf0f 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.genmodel
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/models/gmfgen.genmodel
@@ -173,6 +173,7 @@
<genFeatures createChild="false" propertyDescription="The target directory for generated editor code"
ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenEditorGenerator/pluginDirectory"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgen.ecore#//GenEditorGenerator/extensions"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//GenEditorGenerator/jdkComplianceLevel"/>
<genOperations ecoreOperation="gmfgen.ecore#//GenEditorGenerator/getAllDomainGenPackages">
<genParameters ecoreParameter="gmfgen.ecore#//GenEditorGenerator/getAllDomainGenPackages/withUsed"/>
</genOperations>
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GMFGenPackage.java b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GMFGenPackage.java
index f19dc77b106..08756435f96 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GMFGenPackage.java
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GMFGenPackage.java
@@ -303,13 +303,22 @@ public interface GMFGenPackage extends EPackage {
int GEN_EDITOR_GENERATOR__EXTENSIONS = 23;
/**
+ * The feature id for the '<em><b>Jdk Compliance Level</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GEN_EDITOR_GENERATOR__JDK_COMPLIANCE_LEVEL = 24;
+
+ /**
* The number of structural features of the '<em>Gen Editor Generator</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int GEN_EDITOR_GENERATOR_FEATURE_COUNT = 24;
+ int GEN_EDITOR_GENERATOR_FEATURE_COUNT = 25;
/**
* The meta object id for the '{@link org.eclipse.papyrus.gmf.codegen.gmfgen.impl.GenCommonBaseImpl <em>Gen Common Base</em>}' class.
@@ -12768,6 +12777,17 @@ public interface GMFGenPackage extends EPackage {
EReference getGenEditorGenerator_Extensions();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator#getJdkComplianceLevel <em>Jdk Compliance Level</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Jdk Compliance Level</em>'.
+ * @see org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator#getJdkComplianceLevel()
+ * @see #getGenEditorGenerator()
+ * @generated
+ */
+ EAttribute getGenEditorGenerator_JdkComplianceLevel();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram <em>Gen Diagram</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GenEditorGenerator.java b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GenEditorGenerator.java
index a7e12b1c7fd..acc6bd76c45 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GenEditorGenerator.java
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/GenEditorGenerator.java
@@ -20,6 +20,7 @@
*/
package org.eclipse.papyrus.gmf.codegen.gmfgen;
+import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
import org.eclipse.emf.common.util.EList;
@@ -73,6 +74,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenPropertySheet;
* <li>{@link org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator#getContextMenus <em>Context Menus</em>}</li>
* <li>{@link org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator#getPluginDirectory <em>Plugin Directory</em>}</li>
* <li>{@link org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator#getExtensions <em>Extensions</em>}</li>
+ * <li>{@link org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator#getJdkComplianceLevel <em>Jdk Compliance Level</em>}</li>
* </ul>
*
* @see org.eclipse.papyrus.gmf.codegen.gmfgen.GMFGenPackage#getGenEditorGenerator()
@@ -707,6 +709,32 @@ public interface GenEditorGenerator extends EObject {
EList<GenCustomGeneratorExtension> getExtensions();
/**
+ * Returns the value of the '<em><b>Jdk Compliance Level</b></em>' attribute.
+ * The default value is <code>"11.0"</code>.
+ * The literals are from the enumeration {@link org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Jdk Compliance Level</em>' attribute.
+ * @see org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel
+ * @see #setJdkComplianceLevel(GenJDKLevel)
+ * @see org.eclipse.papyrus.gmf.codegen.gmfgen.GMFGenPackage#getGenEditorGenerator_JdkComplianceLevel()
+ * @model default="11.0"
+ * @generated
+ */
+ GenJDKLevel getJdkComplianceLevel();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator#getJdkComplianceLevel <em>Jdk Compliance Level</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Jdk Compliance Level</em>' attribute.
+ * @see org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel
+ * @see #getJdkComplianceLevel()
+ * @generated
+ */
+ void setJdkComplianceLevel(GenJDKLevel value);
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
index b9c7639dc90..85d3224f07d 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
@@ -1594,6 +1594,16 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
* @generated
*/
@Override
+ public EAttribute getGenEditorGenerator_JdkComplianceLevel() {
+ return (EAttribute)getGenEditorGenerator().getEStructuralFeatures().get(24);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
public EClass getGenDiagram() {
if (genDiagramEClass == null) {
genDiagramEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(GMFGenPackage.eNS_URI).getEClassifiers().get(1);
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GenEditorGeneratorImpl.java b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GenEditorGeneratorImpl.java
index ddf0d7eccc9..9b35134bab1 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GenEditorGeneratorImpl.java
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/gmfgen/impl/GenEditorGeneratorImpl.java
@@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
import org.eclipse.emf.codegen.util.CodeGenUtil;
@@ -88,6 +89,7 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenPropertySheet;
* <li>{@link org.eclipse.papyrus.gmf.codegen.gmfgen.impl.GenEditorGeneratorImpl#getContextMenus <em>Context Menus</em>}</li>
* <li>{@link org.eclipse.papyrus.gmf.codegen.gmfgen.impl.GenEditorGeneratorImpl#getPluginDirectory <em>Plugin Directory</em>}</li>
* <li>{@link org.eclipse.papyrus.gmf.codegen.gmfgen.impl.GenEditorGeneratorImpl#getExtensions <em>Extensions</em>}</li>
+ * <li>{@link org.eclipse.papyrus.gmf.codegen.gmfgen.impl.GenEditorGeneratorImpl#getJdkComplianceLevel <em>Jdk Compliance Level</em>}</li>
* </ul>
*
* @generated
@@ -424,6 +426,26 @@ public class GenEditorGeneratorImpl extends EObjectImpl implements GenEditorGene
protected EList<GenCustomGeneratorExtension> extensions;
/**
+ * The default value of the '{@link #getJdkComplianceLevel() <em>Jdk Compliance Level</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJdkComplianceLevel()
+ * @generated
+ * @ordered
+ */
+ protected static final GenJDKLevel JDK_COMPLIANCE_LEVEL_EDEFAULT = GenJDKLevel.JDK110_LITERAL;
+
+ /**
+ * The cached value of the '{@link #getJdkComplianceLevel() <em>Jdk Compliance Level</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJdkComplianceLevel()
+ * @generated
+ * @ordered
+ */
+ protected GenJDKLevel jdkComplianceLevel = JDK_COMPLIANCE_LEVEL_EDEFAULT;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -1306,6 +1328,29 @@ public class GenEditorGeneratorImpl extends EObjectImpl implements GenEditorGene
return extensions;
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public GenJDKLevel getJdkComplianceLevel() {
+ return jdkComplianceLevel;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setJdkComplianceLevel(GenJDKLevel newJdkComplianceLevel) {
+ GenJDKLevel oldJdkComplianceLevel = jdkComplianceLevel;
+ jdkComplianceLevel = newJdkComplianceLevel == null ? JDK_COMPLIANCE_LEVEL_EDEFAULT : newJdkComplianceLevel;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, GMFGenPackage.GEN_EDITOR_GENERATOR__JDK_COMPLIANCE_LEVEL, oldJdkComplianceLevel, jdkComplianceLevel));
+ }
+
public String getPluginDirectory() {
String value = getPluginDirectoryGen();
if (GenCommonBaseImpl.isEmpty(value)) {
@@ -1515,6 +1560,8 @@ public class GenEditorGeneratorImpl extends EObjectImpl implements GenEditorGene
return getPluginDirectory();
case GMFGenPackage.GEN_EDITOR_GENERATOR__EXTENSIONS:
return getExtensions();
+ case GMFGenPackage.GEN_EDITOR_GENERATOR__JDK_COMPLIANCE_LEVEL:
+ return getJdkComplianceLevel();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -1602,6 +1649,9 @@ public class GenEditorGeneratorImpl extends EObjectImpl implements GenEditorGene
getExtensions().clear();
getExtensions().addAll((Collection<? extends GenCustomGeneratorExtension>)newValue);
return;
+ case GMFGenPackage.GEN_EDITOR_GENERATOR__JDK_COMPLIANCE_LEVEL:
+ setJdkComplianceLevel((GenJDKLevel)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -1686,6 +1736,9 @@ public class GenEditorGeneratorImpl extends EObjectImpl implements GenEditorGene
case GMFGenPackage.GEN_EDITOR_GENERATOR__EXTENSIONS:
getExtensions().clear();
return;
+ case GMFGenPackage.GEN_EDITOR_GENERATOR__JDK_COMPLIANCE_LEVEL:
+ setJdkComplianceLevel(JDK_COMPLIANCE_LEVEL_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -1746,6 +1799,8 @@ public class GenEditorGeneratorImpl extends EObjectImpl implements GenEditorGene
return PLUGIN_DIRECTORY_EDEFAULT == null ? pluginDirectory != null : !PLUGIN_DIRECTORY_EDEFAULT.equals(pluginDirectory);
case GMFGenPackage.GEN_EDITOR_GENERATOR__EXTENSIONS:
return extensions != null && !extensions.isEmpty();
+ case GMFGenPackage.GEN_EDITOR_GENERATOR__JDK_COMPLIANCE_LEVEL:
+ return jdkComplianceLevel != JDK_COMPLIANCE_LEVEL_EDEFAULT;
}
return super.eIsSet(featureID);
}
@@ -1778,6 +1833,8 @@ public class GenEditorGeneratorImpl extends EObjectImpl implements GenEditorGene
result.append(copyrightText);
result.append(", pluginDirectory: ");
result.append(pluginDirectory);
+ result.append(", jdkComplianceLevel: ");
+ result.append(jdkComplianceLevel);
result.append(')');
return result.toString();
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/CodegenEmitters.java b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/CodegenEmitters.java
index 30091330e30..6a52d008742 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/CodegenEmitters.java
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/CodegenEmitters.java
@@ -233,19 +233,6 @@ public class CodegenEmitters {
}
// parsers
-
- public JavaClassEmitter getAbstractParserEmitter() throws UnexpectedBehaviourException {
- return createJavaClassEmitter("impl::parsers::AbstractParser", "Main"); //$NON-NLS-1$
- }
-
- /**
- * @deprecated we don't want to generate this class anymore, but the changes in i18n may create compilation errors if we don't explicitly clear the contents of generated file.
- * @see comments in template impl::parsers::AbstractParser for details
- */
- public String getAbstractParserName(Object... input) throws UnexpectedBehaviourException {
- return createPrimaryJavaClassEmitter("impl::parsers::AbstractParser").getQualifiedClassName("deprecatedQualifiedClassName", input); //$NON-NLS-1$
- }
-
public JavaClassEmitter getPredefinedParserEmitter() throws UnexpectedBehaviourException {
return createJavaClassEmitter("parsers::PredefinedParser", "Main"); //$NON-NLS-1$
}
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/Generator.java b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/Generator.java
index d5f658272bb..0a07fbac3d3 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/Generator.java
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen/src/org/eclipse/papyrus/gmf/codegen/util/Generator.java
@@ -90,7 +90,6 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenVisualEffect;
import org.eclipse.papyrus.gmf.codegen.gmfgen.InitDiagramAction;
import org.eclipse.papyrus.gmf.codegen.gmfgen.MetamodelType;
import org.eclipse.papyrus.gmf.codegen.gmfgen.OpenDiagramBehaviour;
-import org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedEnumParser;
import org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser;
import org.eclipse.papyrus.gmf.codegen.gmfgen.SpecializationType;
import org.eclipse.papyrus.gmf.codegen.gmfgen.StandardPreferencePages;
@@ -117,7 +116,7 @@ public class Generator extends GeneratorBase implements Runnable {
private final CodegenEmitters myEmitters;
private final BinaryEmitters myBinaryEmmiters;
-
+
public Generator(GenEditorGenerator genModel, CodegenEmitters emitters) {
this(genModel, emitters, new BinaryEmitters());
}
@@ -126,7 +125,7 @@ public class Generator extends GeneratorBase implements Runnable {
this(genModel, emitters, new BinaryEmitters(), codeFormatterFactory);
}
- public Generator(GenEditorGenerator genModel, CodegenEmitters emitters, BinaryEmitters binaryEmitters) {
+ public Generator(GenEditorGenerator genModel, CodegenEmitters emitters, BinaryEmitters binaryEmitters) {
this(genModel, emitters, binaryEmitters, CodeFormatterFactory.DEFAULT);
}
@@ -141,7 +140,7 @@ public class Generator extends GeneratorBase implements Runnable {
@Override
protected TextMerger createMergeService() {
- // Bug 569174 - Use project or worksapce preference as new line characters
+ // Bug 569174 - Use project or worksapce preference as new line characters
// don't delegate to emitter the merger configuration
URL controlFile = myEmitters.getJMergeControlFile();
if (controlFile != null) {
@@ -270,17 +269,17 @@ public class Generator extends GeneratorBase implements Runnable {
generateActionBarContributor();
generateMatchingStrategy();
generateDocumentProvider();
- if (myDiagram.generateInitDiagramAction() || myDiagram.generateCreateShortcutAction() /*FIXME use another condition here*/) {
+ if (myDiagram.generateInitDiagramAction() || myDiagram.generateCreateShortcutAction() /* FIXME use another condition here */) {
generateModelElementSelectionPage();
}
- if (myDiagram.generateInitDiagramAction() /*FIXME use another condition here*/) {
+ if (myDiagram.generateInitDiagramAction() /* FIXME use another condition here */) {
// FIXME HACK!!! until I decide how to contribute action against IFile
InitDiagramAction fakeAction = GMFGenFactory.eINSTANCE.createInitDiagramAction();
fakeAction.setQualifiedClassName(myDiagram.getInitDiagramFileActionQualifiedClassName());
doGenerateJavaClass(myEmitters.getPredefinedActionEmitter(), fakeAction.getQualifiedClassName(), fakeAction, myEditorGen);
generateNewDiagramFileWizard();
}
- if (myDiagram.generateCreateShortcutAction() /*FIXME use another condition here*/) {
+ if (myDiagram.generateCreateShortcutAction() /* FIXME use another condition here */) {
generateCreateShortcutDecorationsCommand();
if (myEditorGen.getApplication() == null) {
generateElementChooser();
@@ -530,7 +529,7 @@ public class Generator extends GeneratorBase implements Runnable {
}
/**
- * Generate classes for behaviours specified for the diagram element.
+ * Generate classes for behaviours specified for the diagram element.
* As part of its job, this method tries not to generate shared policies more than once.
*/
private void generateBehaviours(GenCommonBase commonBase) throws UnexpectedBehaviourException, InterruptedException {
@@ -621,23 +620,31 @@ public class Generator extends GeneratorBase implements Runnable {
if (myEditorGen.getLabelParsers() == null) {
return;
}
- boolean needsAbstractParser = false;
+ // BEGIN : don't generate AbstractParser
+ // boolean needsAbstractParser = false;
for (GenParserImplementation pi : myEditorGen.getLabelParsers().getImplementations()) {
if (pi instanceof PredefinedParser) {
- needsAbstractParser = true;
+ // needsAbstractParser = true;
doGenerateJavaClass(myEmitters.getPredefinedParserEmitter(), ((PredefinedParser) pi).getQualifiedClassName(), pi);
- } else if (pi instanceof PredefinedEnumParser) {
- needsAbstractParser = true;
- } else if (pi instanceof CustomParser && ((CustomParser) pi).isGenerateBoilerplate()) {
+ }
+ // else if (pi instanceof PredefinedEnumParser) {
+ // needsAbstractParser = true;
+ // }
+ else if (pi instanceof CustomParser && ((CustomParser) pi).isGenerateBoilerplate()) {
doGenerateJavaClass(myEmitters.getCustomParserEmitter(), ((CustomParser) pi).getQualifiedName(), pi);
} else if (pi instanceof ExpressionLabelParser) {
doGenerateJavaClass(myEmitters.getExpressionLabelParserEmitter(), ((ExpressionLabelParser) pi).getQualifiedClassName(), pi);
}
}
- if (needsAbstractParser) {
- JavaClassEmitter emitter = myEmitters.getAbstractParserEmitter();
- doGenerateJavaClass(emitter, myEmitters.getAbstractParserName(myEditorGen.getLabelParsers()), myEditorGen.getLabelParsers());
- }
+ // The generated AbstractParser.java class is empty (Only contains comment "Since GMFT 3.1 we don't generate class ...".
+ // - So template 'xtend/impl/parsers/AbstractParser.xtend' is deleted
+ // - so the call is deactivated too
+ //
+ // if (needsAbstractParser) {
+ // JavaClassEmitter emitter = myEmitters.getAbstractParserEmitter();
+ // doGenerateJavaClass(emitter, myEmitters.getAbstractParserName(myEditorGen.getLabelParsers()), myEditorGen.getLabelParsers());
+ // }
+ // END : don't generate AbstractParser
}
// providers
@@ -648,7 +655,7 @@ public class Generator extends GeneratorBase implements Runnable {
}
}
- // if there's no other parser than external, and provider is not contributed as a Service -
+ // if there's no other parser than external, and provider is not contributed as a Service -
// no need to generate class (only get() method would be there)
// XXX although adopters might want to change the logic - what if they generate smth reasonable?
// or if I add sort of getDescriptionParser common access method there?
@@ -777,7 +784,7 @@ public class Generator extends GeneratorBase implements Runnable {
}
private void generateShortcutCreationWizard() throws UnexpectedBehaviourException, InterruptedException {
- JavaClassEmitter emitter = myEmitters.getShortcutCreationWizardEmitter();
+ JavaClassEmitter emitter = myEmitters.getShortcutCreationWizardEmitter();
doGenerate(emitter, myDiagram);
}
@@ -870,7 +877,7 @@ public class Generator extends GeneratorBase implements Runnable {
}
}
- // property sheet
+ // property sheet
protected void generatePropertySheetSections() throws UnexpectedBehaviourException, InterruptedException {
if (myEditorGen.getPropertySheet().isNeedsCaption()) {
@@ -924,7 +931,7 @@ public class Generator extends GeneratorBase implements Runnable {
private void generateDiagramIcon(String path) throws UnexpectedBehaviourException, InterruptedException {
// use genModel.prefix if available to match colors of model icons and diagram icons
- // @see GenPackageImpl#generateEditor - it passes prefix to ModelGIFEmitter
+ // @see GenPackageImpl#generateEditor - it passes prefix to ModelGIFEmitter
Object[] args = new Object[] { myDiagram.getDomainDiagramElement() == null ? myEditorGen.getDiagramFileExtension() : myDiagram.getDomainDiagramElement().getGenPackage().getPrefix() };
doGenerateBinaryFile(myBinaryEmmiters.getDiagramIconEmitter(), new Path(path), args);
}
@@ -1084,7 +1091,8 @@ public class Generator extends GeneratorBase implements Runnable {
} catch (Exception e) {
handleException(new UnexpectedBehaviourException(//
"Error computing FQN for invocation " + invocation + //
- " on " + nextTemplateInput, e));
+ " on " + nextTemplateInput,
+ e));
continue;
}
if (nextFqn != null) {
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.classpath b/plugins/toolsmiths/org.eclipse.papyrus.def/.classpath
deleted file mode 100644
index 45051717aca..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
- <attributes>
- <attribute name="module" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="xtend"/>
- <classpathentry kind="src" path="xtend-gen"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.project b/plugins/toolsmiths/org.eclipse.papyrus.def/.project
deleted file mode 100644
index 2d16d0466af..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.project
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.def</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.openarchitectureware.base.oawBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.gmf.xpand.oawBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.gmf.xpand.xpandBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.xtend.shared.ui.xtendBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.oomph.version.VersionBuilder</name>
- <arguments>
- <dictionary>
- <key>check.maven.pom</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>ignore.lower.bound.dependency.ranges</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>release.path</key>
- <value>/org.eclipse.papyrus.releng.dev.release/release.xml</value>
- </dictionary>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.openarchitectureware.base.oawNature</nature>
- <nature>org.eclipse.xtend.shared.ui.xtendXPandNature</nature>
- <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
- <nature>org.eclipse.oomph.version.VersionNature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/.api_filters b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/.api_filters
deleted file mode 100644
index f764b1e208b..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/.api_filters
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.papyrus.def" version="2">
- <resource path="META-INF/MANIFEST.MF">
- <filter comment="we force the change to 2.1.0" id="926941240">
- <message_arguments>
- <message_argument value="2.1.0"/>
- <message_argument value="2.0.0"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 25790d4daea..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
-encoding/xtend=UTF-8
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.runtime.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.runtime.prefs
deleted file mode 100644
index 5a0ad22d2a7..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.runtime.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-line.separator=\n
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.core.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100755
index 037f04a07c2..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,319 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=11
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
-org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=11
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=260
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=false
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=260
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.ui.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index ba7542ef658..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,127 +0,0 @@
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_functional_interfaces=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=false
-cleanup.format_source_code=false
-cleanup.format_source_code_changes_only=false
-cleanup.insert_inferred_type_arguments=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=false
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_redundant_type_arguments=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_anonymous_class_creation=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_lambda=true
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=false
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup.use_type_arguments=false
-cleanup_profile=_Papyrus
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Papyrus
-formatter_settings_version=12
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;org;com;
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License 2.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.insert_inferred_type_arguments=false
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_redundant_modifiers=false
-sp_cleanup.remove_redundant_type_arguments=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_anonymous_class_creation=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_lambda=true
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.m2e.core.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index f897a7f1cb2..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.pde.api.tools.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.pde.api.tools.prefs
deleted file mode 100644
index b2260f87129..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.pde.api.tools.prefs
+++ /dev/null
@@ -1,104 +0,0 @@
-ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Warning
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Warning
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_FIELD=Warning
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Warning
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Warning
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_ANNOTATION=Ignore
-INVALID_JAVADOC_TAG=Ignore
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=Enabled
-changed_execution_env=Warning
-eclipse.preferences.version=1
-incompatible_api_component_version=Warning
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-incompatible_api_component_version_report_major_without_breaking_change=Error
-incompatible_api_component_version_report_minor_without_api_change=Error
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.core.Xtend.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.core.Xtend.prefs
deleted file mode 100644
index df3c3c49d40..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.core.Xtend.prefs
+++ /dev/null
@@ -1,6 +0,0 @@
-//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/java.directory=xtend-gen
-BuilderConfiguration.is_project_specific=true
-eclipse.preferences.version=1
-outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
-outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
-outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.shared.ui.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.shared.ui.prefs
deleted file mode 100644
index 89103792688..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.shared.ui.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-metamodelContributor=org.eclipse.xtend.typesystem.emf.ui.EmfMetamodelContributor,org.eclipse.xtend.typesystem.uml2.ui.Uml2MetamodelContributor
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/META-INF/MANIFEST.MF b/plugins/toolsmiths/org.eclipse.papyrus.def/META-INF/MANIFEST.MF
deleted file mode 100644
index 7c2b483e989..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0.0)",
- org.eclipse.gmf.runtime.notation;bundle-version="[1.10.0,2.0.0)",
- org.eclipse.papyrus.infra.types;bundle-version="[5.0.0,6.0.0)",
- org.eclipse.papyrus.infra.types.core;bundle-version="[5.0.0,6.0.0)",
- org.eclipse.uml2.types;bundle-version="[2.5.0,3.0.0)",
- org.eclipse.xtend.lib;bundle-version="[2.22.0,3.0.0)",
- org.eclipse.xtext;bundle-version="[2.22.0,3.0.0)",
- org.eclipse.xtext.builder;bundle-version="[2.22.0,3.0.0)",
- org.eclipse.papyrus.codegen;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.gmf.codegen.xtend;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.gmf.codegen;bundle-version="[2.11.0,3.0.0)"
-Bundle-Vendor: %providerName
-Bundle-ClassPath: ., bin/
-Bundle-Version: 2.1.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-Activator: org.eclipse.papyrus.gmf.codegen.util.DefaultActivator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.def;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-11
-Automatic-Module-Name: org.eclipse.papyrus.def
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/about.html b/plugins/toolsmiths/org.eclipse.papyrus.def/about.html
deleted file mode 100644
index ba32bad959c..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/about.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"><head>
-
-
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>About</title>
-</head><body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>November 30, 2017</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 2.0 ("EPL"). A copy of the EPL is available
-at <a href="https://www.eclipse.org/legal/epl-2.0/">https://www.eclipse.org/legal/epl-2.0/</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body></html> \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/build.properties b/plugins/toolsmiths/org.eclipse.papyrus.def/build.properties
deleted file mode 100644
index 057f0ec72ef..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/build.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-jars.compile.order=.
-source.. = xtend/,\
- xtend-gen/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties,\
- xtend/,\
- xtend-gen/
-src.includes = about.html
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/plugin.properties b/plugins/toolsmiths/org.eclipse.papyrus.def/plugin.properties
deleted file mode 100644
index 18ed6e7244a..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/plugin.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-#################################################################################
-# Copyright (c) 2008 CEA LIST.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License 2.0
-# which accompanies this distribution, and is available at
-# https://www.eclipse.org/legal/epl-2.0/
-#
-# SPDX-License-Identifier: EPL-2.0
-#
-# Contributors:
-# Patrick Tessier patrick.tessier@cea.fr - Initial API and implementation
-##################################################################################
-pluginName=Papyrus Templates Extension for GMF tooling
-providerName=Eclipse Modeling Project
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/pom.xml b/plugins/toolsmiths/org.eclipse.papyrus.def/pom.xml
deleted file mode 100644
index ae2a6911854..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>org.eclipse.papyrus-toolsmiths</artifactId>
- <groupId>org.eclipse.papyrus</groupId>
- <version>0.0.1-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.papyrus.def</artifactId>
- <version>2.1.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>xtend-gen</directory>
- <includes>
- <include>**/*</include>
- </includes>
- <excludes>
- <exclude>.gitignore</exclude>
- </excludes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.eclipse.xtend</groupId>
- <artifactId>xtend-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <outputDirectory>xtend-gen</outputDirectory>
- <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory>
- <encoding>${project.build.sourceEncoding}</encoding>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project> \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend-gen/.gitignore b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend-gen/.gitignore
deleted file mode 100644
index c96a04f008e..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend-gen/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend
deleted file mode 100644
index e3a63b46f24..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.diagram.editparts
-
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildLabelNode
-
-@Singleton class ChildNodeLabelEditPart extends diagram.editparts.ChildNodeLabelEditPart {
-
-
-
- override extendsList(GenChildLabelNode it) '''
-«««BEGIN: PapyrusGenCode
-«««Add own extension
-«IF superEditPart !== null»
- extends «superEditPart»
-«««END: PapyrusGenCode
-«ELSE»
- extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart
-«ENDIF»
-'''
-
-override implementsList(GenChildLabelNode it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit'''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend
deleted file mode 100644
index 47ea609fd9a..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend
+++ /dev/null
@@ -1,85 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
-import xpt.Common
-
-@Singleton class CompartmentEditPart extends diagram.editparts.CompartmentEditPart {
- @Inject extension Common;
-
- override extendsList(GenCompartment it) '''
-
-«««BEGIN: PapyrusGenCode
-«««Add own extension
-«IF superEditPart!== null»
- extends «superEditPart»
-«««END: BEGIN: PapyrusGenCode
-«ELSE»
- extends «IF listLayout»org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart«ELSE»org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.linklf.LinkLFShapeCompartmentEditPart«ENDIF»
-«ENDIF»
- '''
-
-
- //END: PapyrusGenCode
- override additions(GenCompartment it) '''
- «handleSize(it)»
- «refreshbound(it)»
- «refreshvisual(it)»
- '''
-
- def handleSize(GenCompartment it) '''
- «generatedMemberComment»
-protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification notification) {
- Object feature = notification.getFeature();
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
- refreshBounds();
- }
- super.handleNotificationEvent(notification);
- }
-'''
-
- def refreshbound(GenCompartment it) '''
- «generatedMemberComment»
- protected void refreshBounds() {
- int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
- org.eclipse.draw2d.geometry.Dimension size = new org.eclipse.draw2d.geometry.Dimension(width, height);
- int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- org.eclipse.draw2d.geometry.Point loc = new org.eclipse.draw2d.geometry.Point(x, y);
- ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(
- this,
- getFigure(),
- new org.eclipse.draw2d.geometry.Rectangle(loc, size));
- }
- '''
-
- def refreshvisual(GenCompartment it) '''
- «generatedMemberComment»
-protected void refreshVisuals() {
- super.refreshVisuals();
- refreshBounds();
- }
-'''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend
deleted file mode 100644
index 761b0b1229a..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-@Singleton class DiagramEditPart extends diagram.editparts.DiagramEditPart {
-
- @Inject aspects.impl.diagram.editparts.DiagramEditPart aspectDiagramEditPart;
-
- //BEGIN: PapyrusGenCode
- //patches the super type of the diagram edit part in case the controlled object represents a UML element
- override extendsList(GenDiagram it) '''extends «aspectDiagramEditPart.extendsListContents(it)»'''
- //END: PapyrusGenCode
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend
deleted file mode 100644
index 2573417e9f2..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
-import xpt.Common
-
-@Singleton class ExternalNodeLabelEditPart extends diagram.editparts.ExternalNodeLabelEditPart {
- @Inject extension Common;
-
- override extendsList(GenExternalNodeLabel it) '''
- «««BEGIN: PapyrusGenCode
- «««specify a java super class for external nodes
- «IF superEditPart !== null»
- extends «superEditPart»
- «««END: PapyrusGenCode
- «ELSE»
- extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart
- «ENDIF»
- '''
-
- //we add the interface ILabelRoleProvider
- override implementsList(GenExternalNodeLabel it) '''
- implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart
- ««« BEGIN: PapyrusGenCode
- «IF labelVisibilityPreference !== null»
- , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider
- «ENDIF»
- ««« END: PapyrusGenCode
- '''
-
- override additions(GenExternalNodeLabel it) '''
- ««« BEGIN: PapyrusGenCode
- «IF labelVisibilityPreference !== null»
- «generatedClassComment»
- public String getLabelRole(){
- return "«labelVisibilityPreference.role»";//$NON-NLS-1$
- }
-
- «generatedClassComment»
- public String getIconPathRole(){
- return "«labelVisibilityPreference.iconPathRole»";//$NON-NLS-1$
- }
- «ENDIF»
- ««« END: PapyrusGenCode
- '''
-
- def refreshBounds(GenExternalNodeLabel it) '''
- ««« BEGIN: PapyrusGenCode
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
- getBorderItemLocator().relocate(getFigure());
- }
- ««« END: PapyrusGenCode
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend
deleted file mode 100644
index 2346c18a575..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-
-@Singleton class LinkEditPart extends diagram.editparts.LinkEditPart {
- @Inject aspects.impl.diagram.editparts.LinkEditPart aspectsLinkEditPart;
-
-
-
-//BEGIN: PapyrusGenCode
-//patches the super type of the link edit part in case the controlled object represents a UML element
-override extendsList(GenLink it) '''extends «aspectsLinkEditPart.extendsListContents(it)»'''
-//END: PapyrusGenCode
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend
deleted file mode 100644
index 848dcda60b2..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend
+++ /dev/null
@@ -1,76 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.CustomBehaviour
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkLabel
-import xpt.Common
-
-@Singleton class LinkLabelEditPart extends diagram.editparts.LinkLabelEditPart{
- @Inject extension Common;
-
-
- override implementsList(GenLinkLabel it) '''
- implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit
- ««« BEGIN: PapyrusGenCode
- «IF labelVisibilityPreference !== null»
- , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider
- «ENDIF»
- ««« END: PapyrusGenCode
- '''
-
-
- override additions(GenLinkLabel it) '''
- ««« BEGIN: PapyrusGenCode
- «IF labelVisibilityPreference !== null»
- «generatedClassComment»
- public String getLabelRole(){
- return "«labelVisibilityPreference.role»";//$NON-NLS-1$
- }
-
- «generatedClassComment»
- public String getIconPathRole(){
- return "«labelVisibilityPreference.iconPathRole»";//$NON-NLS-1$
- }
- «ENDIF»
- ««« END: PapyrusGenCode
- '''
-
- override extendsList(GenLinkLabel it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart'''
-
- override createDefaultEditPolicies(GenLinkLabel it) '''
- /**
- * @generated Papyrus Generation
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
- installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new «diagram.getTextSelectionEditPolicyQualifiedClassName()»());
- ««« BEGIN: PapyrusGenCode
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy());
- ««« END: PapyrusGenCode
- ««« Get the added custom behavoir
- «FOR CustomBehaviour:it.behaviour.filter(typeof (CustomBehaviour))»
- installEditPolicy(«CustomBehaviour.key», new «CustomBehaviour.editPolicyQualifiedClassName»());
- «ENDFOR»
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend
deleted file mode 100644
index 756e4526031..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend
+++ /dev/null
@@ -1,115 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import xpt.Common
-import xpt.diagram.editparts.Utils_qvto
-
-//DOCUMENTATION: PapyrusGenCode
-//add call template in order to generate handlenotification in order to refresh figure by taking account event
-
-@Singleton class NodeEditPart extends diagram.editparts.NodeEditPart {
- @Inject extension Common;
- @Inject extension Utils_qvto;
-
- @Inject impl.diagram.editparts.NodeEditPart xptNodeEditPartImpl;
- @Inject aspects.impl.diagram.editparts.NodeEditPart aspectsNodeEditPartImpl;
-
-
-
- override Main(GenNode it) '''
- «copyright(diagram.editorGen)»
- package «xptNodeEditPartImpl.packageName(it)»;
-
- «generatedClassComment»
- public class «xptNodeEditPartImpl.className(it)» «extendsList(it)» «implementsList(it)» {
-
- «attributes(it)»
-
- «xptNodeEditPartImpl.constructor(it)»
-
- «createDefaultEditPolicies(it)»
-
- «xptNodeEditPartImpl.createLayoutEditPolicy(it)»
-
-««« BEGIN: PapyrusGenCode
-««« call tamplate to paste code for refresh figure by taking account event
- «aspectsNodeEditPartImpl.specificHandleNotificationEvent(it)»
-««« END: PapyrusGenCode
-
- «xptNodeEditPartImpl.createNodeShape(it.viewmap, it)»
-
- «IF hasFixedChildren(it)»
- «xptNodeEditPartImpl.addFixedChild(it)»
-
- «xptNodeEditPartImpl.removeFixedChild(it)»
-
- «xptNodeEditPartImpl.addChildVisual(it)»
-
- «xptNodeEditPartImpl.removeChildVisual(it)»
-
- «xptNodeEditPartImpl.getContentPaneFor(it)»
- «ENDIF»
-
- «xptNodeEditPartImpl.addBorderItem(it)»
-
- «xptNodeEditPartImpl.createNodePlate(it)»
-
- «xptNodeEditPartImpl.getPrimaryDragEditPolicy(it)»
-
- «xptNodeEditPartImpl.createFigure(it)»
-
- «xptNodeEditPartImpl.setupContentPane(it)»
-
- «xptNodeEditPartImpl.getContentPane(it)»
-
- «xptNodeEditPartImpl.setForegroundColor(it)»
-
-««« «xptNodeEditPartImpl.setBackgroundColor(it)»
-
- «xptNodeEditPartImpl.setLineWidth(it)»
-
- «xptNodeEditPartImpl.setLineStyle(it)»
-
- «xptNodeEditPartImpl.getPrimaryChildEditPart(it)»
-
-
-
- «IF hasChildrenInListCompartments(it)»
- «xptNodeEditPartImpl.getTargetEditPartMethod(it)»
- «ENDIF»
-
- «handleNotificationEvent(it)»
-
- «xptNodeEditPartImpl.innerClassDeclaration(viewmap)»
-
- «additions(it)»
- }
- '''
-
- //BEGIN: PapyrusGenCode
- //patches the super type of the node edit part in case the controlled object represents a UML element
- override extendsList (GenNode it)''' extends «aspectsNodeEditPartImpl.extendsListContents(it)»'''
- //END: PapyrusGenCode
-
- // override additions(GenNode it) '''
- // «aspectsNodeEditPartImpl.genPreferredValue(it)»
- // '''
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend
deleted file mode 100644
index e7bb5969d29..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend
+++ /dev/null
@@ -1,81 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNodeLabel
-import xpt.Common
-
-//DOCUMENTATION: PapyrusGenCode
-//add in the addition codes in order to refresh the labels
-@Singleton class NodeLabelEditPart extends diagram.editparts.NodeLabelEditPart {
- @Inject extension Common;
-
- @Inject impl.diagram.editparts.NodeLabelEditPart xptNodeLabelEditPart;
-
-override implementsList(GenNodeLabel it)'''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit'''
-
-//BEGIN: PapyrusGenCode
-//Definition of the inheritance
-override extendsList (GenNodeLabel it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart'''
-//END: PapyrusGenCode
-
- override handleNotificationEvent(GenNodeLabel it) '''
- «generatedMemberComment»
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- refreshLabel();
- «xptNodeLabelEditPart.handleNotificationEventBody(it)»
- }
- '''
-
- override additions(GenNodeLabel it) '''
- ««« Code to refresh icon
-
- «generatedMemberComment»
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
-
- «generatedMemberComment»
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- «generatedMemberComment»
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((org.eclipse.gmf.runtime.notation.View) getParent().getModel()));
-
- }
-
- «generatedMemberComment»
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
-
- «generatedMemberComment»
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
- «««END: PapyrusGenCode
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/actions/LoadResourceAction.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/actions/LoadResourceAction.xtend
deleted file mode 100644
index 8b45882b7a5..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/actions/LoadResourceAction.xtend
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.impl.actions
-
-import com.google.inject.Singleton
-
-@Singleton class LoadResourceAction extends impl.actions.LoadResourceAction{
-
- override def extendsList(org.eclipse.papyrus.gmf.codegen.gmfgen.LoadResourceAction it) //
- ''' extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.actions.DefaultLoadResourceAction'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend
deleted file mode 100644
index 28e50b01e4e..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildLabelNode
-import xpt.diagram.editparts.Common
-
-/**
- * Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class?
- */
-@Singleton class ChildNodeLabelEditPart extends impl.diagram.editparts.ChildNodeLabelEditPart {
- @Inject extension Common;
-
-
- override handleNotificationEventBody(GenChildLabelNode it) '''
- Object feature = event.getFeature();
- «handleText(it)»
- «IF labelElementIcon»
- if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
- refreshLabel();
- }
- «ENDIF»
- if (org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) {
- refreshUnderline();
- }
- super.handleNotificationEvent(event);
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChoiceUtils_qvto.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChoiceUtils_qvto.xtend
deleted file mode 100644
index bb362243408..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChoiceUtils_qvto.xtend
+++ /dev/null
@@ -1,36 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 - 2013 Montages AG
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Svyatoslav Kovalsky (Montages) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.LabelModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.OclChoiceParser
-import org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedEnumParser
-import xpt.Common_qvto
-
-@Singleton class ChoiceUtils_qvto extends impl.diagram.editparts.ChoiceUtils_qvto {
- @Inject extension Common_qvto
-
- override boolean isChoiceLabel(LabelModelFacet modelFacet) {
- var parser = modelFacet.parser;
- if (parser != null) {
- return parser.oclIsKindOf(typeof(PredefinedEnumParser)) || parser.oclIsKindOf(typeof(OclChoiceParser));
- } else {
- return false;
- }
- }
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend
deleted file mode 100644
index e58e7eee0bb..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend
+++ /dev/null
@@ -1,72 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2021 Borland Software Corporation, CEA LIST, ARTAL and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
-import xpt.diagram.editparts.Common
-
-//DOCUMENTATION: PapyrusGenCode
-//Overload only the creation of editPolicies in order to add the paste edit policy
-@Singleton class CompartmentEditPart extends impl.diagram.editparts.CompartmentEditPart {
- @Inject extension xpt.Common;
- @Inject Common xptEditpartsCommon;
-
-
-
- override createDefaultEditPoliciesBody(GenCompartment it) '''
- super.createDefaultEditPolicies();
- «IF canCollapse»
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy());
- «ENDIF»
- «xptEditpartsCommon.installSemanticEditPolicy(it)»
- «IF ! childNodes.empty»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy());
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
- installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy());
- «ENDIF»
- «xptEditpartsCommon.installCanonicalEditPolicy(it)»
- «xptEditpartsCommon.behaviour(it)»
- '''
-
- override getTargetEditPartMethod(GenCompartment it) '''
- «generatedMemberComment»
- public org.eclipse.gef.EditPart getTargetEditPart(org.eclipse.gef.Request request) {
-
- return super.getTargetEditPart(request);
- }
- '''
-
- override createFigure(GenCompartment it) {
- if (hasExternalSuperClass(it,'org.eclipse.papyrus.uml.diagram.activity.edit.part.ShapeCompartmentWithoutScrollbarsEditPart')) {
- '''
- @Override
- public org.eclipse.draw2d.IFigure createFigure() {
- return super.createFigure();
- }
- '''
- } else {
- super.createFigure(it);
- }
- }
-
- def boolean hasExternalSuperClass(GenCompartment it, String className) {
- superEditPart == className
- }
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend
deleted file mode 100644
index 9fe0e674e26..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import xpt.diagram.commands.CreateShortcutDecorationsCommand
-import xpt.diagram.editparts.Common
-import xpt.diagram.editparts.Utils_qvto
-
-/**
- * Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class?
- */
-//DOCUMENTATION: PapyrusGencode
-//This template has been modify to allow the drag and drop
-@Singleton class DiagramEditPart extends impl.diagram.editparts.DiagramEditPart {
- @Inject extension MetaModel;
- @Inject extension Utils_qvto;
-
- @Inject Common xptEditpartsCommon;
- @Inject CreateShortcutDecorationsCommand createShoutrtcutDecorationCommand;
-
-//BEGIN: PapyrusGenCode
-//computes super type of the link edit part in case the edit part manages a representation of a UML element
-def extendsListContents(GenDiagram it)'''
-org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart
-'''
-//END: BEGIN: PapyrusGenCode
-
-override createDefaultEditPoliciesBody(GenDiagram it) '''
- super.createDefaultEditPolicies();
-
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy());
- installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy());
-
- «xptEditpartsCommon.installSemanticEditPolicy(it)»
- «xptEditpartsCommon.installCanonicalEditPolicy(it)»
- ««« «xptEditpartsCommon.installCreationEditPolicy(it)»
- «IF generateCreateShortcutAction() && null == editorGen.application»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy() {
- public org.eclipse.gef.commands.Command getDropObjectsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest) {
- java.util.List<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor> viewDescriptors = new java.util.ArrayList<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor>();
- for (java.util.Iterator<?> it = dropRequest.getObjects().iterator(); it.hasNext();) {
- Object nextObject = it.next();
- if (false == nextObject instanceof org.eclipse.emf.ecore.EObject) {
- continue;
- }
- viewDescriptors.add(new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter((org.eclipse.emf.ecore.EObject) nextObject), org.eclipse.gmf.runtime.notation.Node.class, null, getDiagramPreferencesHint()));
- }
- return createShortcutsCommand(dropRequest, viewDescriptors);
- }
-
- private org.eclipse.gef.commands.Command createShortcutsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest, java.util.List<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor> viewDescriptors) {
- org.eclipse.gef.commands.Command command = createViewsAndArrangeCommand(dropRequest, viewDescriptors);
- if (command != null) {
- return command.chain(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new «createShoutrtcutDecorationCommand.qualifiedClassName(it)»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors)));
- }
- return null;
- }
- });
- «ENDIF»
- «IF shouldGenerateDiagramViewmap(it)»
- // diagram figure does layout; need to install child editpolicy to show selection feedback
- installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.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»
- «xptEditpartsCommon.behaviour(it)»
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
-'''
-
-def featureForMetaclass (GenNode it)'''
- if (« MetaClass(modelFacet.metaClass)».equals(class1)) {
- return «MetaFeature(modelFacet.containmentMetaFeature)»;
- }
-'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend
deleted file mode 100644
index 225c132703c..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package aspects.impl.diagram.editparts
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
-
-/**
- * @author Mickael ADAM
- *
- */
-class ExternalNodeLabelEditPart extends impl.diagram.editparts.ExternalNodeLabelEditPart {
-
- override additionalEditPolicies(GenExternalNodeLabel it){
- '''
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy());
- '''
- }
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend
deleted file mode 100644
index 6fb48b92faa..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend
+++ /dev/null
@@ -1,114 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Remi Schnekenburger (CEA LIST) - modification for Papyrus MDT
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ModeledViewmap
-import xpt.Common
-
-/**
- * Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class?
- */
-@Singleton class LinkEditPart extends impl.diagram.editparts.LinkEditPart {
- @Inject extension Common;
-
-
- //BEGIN: PapyrusGenCode
- //computes super type of the link edit part in case the edit part manages a representation of a UML element
- def extendsListContents(GenLink it)'''
- «IF superEditPart !== null»
- «superEditPart»
- «ELSE»
- org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart
- «ENDIF»
- '''
- //END: BEGIN: PapyrusGenCode
-
- override addFixedChild (GenLink it)'''
- «IF labels.size > 0»
- «generatedMemberComment»
- protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
- «FOR label : labels»
- «addLabel(label.viewmap,label)»
- «ENDFOR»
- return false;
- }
- «ENDIF»
-'''
-
- override removeFixedChild(GenLink it) '''
- «IF ! labels.empty»
- «generatedMemberComment»
- protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
- «FOR label : labels»
- «removeLabel(label.viewmap, label)»
- «ENDFOR»
- return false;
- }
- «ENDIF»
- '''
-
- override addChildVisual(GenLink it) '''
- «IF ! labels.empty»
- «generatedMemberComment»
- protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
- «ENDIF»
- '''
-
- override removeChildVisual(GenLink it) '''
- «IF ! labels.empty»
- «generatedMemberComment»
- protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
- «ENDIF»
- '''
-
- override dispatch createLinkFigure(ModeledViewmap it, GenLink link) '''
-««« «generatedMemberComment»
-««« protected org.eclipse.draw2d.Connection createConnectionFigure() {
-««« return new «modeledViewmapFigureFQN(it)»();
-««« }
-«««
-««« «generatedMemberComment»
-««« public «modeledViewmapFigureFQN(it)» getPrimaryShape() {
-««« return («modeledViewmapFigureFQN(it)») getFigure();
-««« }
-«««
-««« «xptModeledViewmapProducer.viewmapClassBody(it)»
- '''
-
- override modeledViewmapFigureFQN(ModeledViewmap it) '''
-««« «xptModeledViewmapProducer.viewmapFigureFQN(it)»
- '''
-
-}
-
-
-
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend
deleted file mode 100644
index dac47ddce4b..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend
+++ /dev/null
@@ -1,50 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Thibault Landre (Atos Origin) - initial API and implementation
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkLabel
-import xpt.diagram.editparts.Common
-
-//DOCUMENTATION: PapyrusGencode
-//Overlaod only the method handlenotificationEventBody
-
-@Singleton class LinkLabelEditPart extends impl.diagram.editparts.LinkLabelEditPart {
- @Inject extension Common;
-
- override handleNotificationEventBody(GenLinkLabel it) '''
- Object feature = event.getFeature();
- «handleText (it)»
-
- ««« START Papyrus Code
- «IF elementIcon»
- if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
- refreshLabel();
- }
- «ENDIF»
- ««« End Papyrus Code
- super.handleNotificationEvent(event);
- '''
-
- override additionalEditPolicies(GenLinkLabel it)
- '''
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy());
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend
deleted file mode 100644
index 48e441690e2..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend
+++ /dev/null
@@ -1,474 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2014, 2021 Borland Software Corporation, Christian W. Damus, CEA LIST, Artal and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Patrick Tessier (CEA) - initial API and implementation
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Vincent Lorenzo (CEA-LIST) - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels
- * Christian W. Damus - bug 451230
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import aspects.xpt.editor.VisualIDRegistry
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildSideAffixedNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorChildReference
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ParentAssignedViewmap
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
-import utils.EditPartsUtils_qvto
-import xpt.Common
-import xpt.diagram.editparts.EditPartFactory
-import xpt.diagram.editparts.Utils_qvto
-import xpt.CodeStyle
-import xpt.diagram.ViewmapAttributesUtils_qvto
-import xpt.providers.ElementTypes
-import org.eclipse.papyrus.gmf.codegen.gmfgen.RefreshHook
-
-@Singleton class NodeEditPart extends impl.diagram.editparts.NodeEditPart {
- @Inject extension Common;
- @Inject extension CodeStyle
-
- @Inject extension EditPartsUtils_qvto;
- @Inject extension VisualIDRegistry;
-
- @Inject extension ViewmapAttributesUtils_qvto;
-
- @Inject extension Utils_qvto;
- @Inject extension xpt.diagram.Utils_qvto;
- @Inject EditPartFactory xptEditPartFactory;
- @Inject impl.diagram.editparts.TextAware xptTextAware;
-
- @Inject VisualIDRegistry xptVisualIDRegistry;
- @Inject ElementTypes xptElementTypes;
-
-//---------
-// GMF
-//---------
-
- override dispatch extendsListContents (GenNode it)'''
-«««BEGIN: PapyrusGenCode
-«««Add own extension
-«IF superEditPart !== null»
-«superEditPart»
-«««END: BEGIN: PapyrusGenCode
-«ELSE»
- org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart
-«ENDIF»
-'''
-
-override dispatch extendsListContents (GenChildSideAffixedNode it)'''
-«««BEGIN: PapyrusGenCode
-«««Add own extension
-«IF superEditPart !== null»
-«superEditPart»
-«««END: BEGIN: PapyrusGenCode
-«ELSE»
- «IF hasBorderItems(it)»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF»
-«ENDIF»
-'''
-override addFixedChild (GenNode it)'''
- «generatedMemberComment»
- protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
-«FOR label:getInnerFixedLabels(it)»«var childViewmap = label.viewmap as ParentAssignedViewmap»
- if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(label)») {
- ((«xptEditPartFactory.getEditPartQualifiedClassName(label)») childEditPart).«xptTextAware.labelSetterName(childViewmap)»(getPrimaryShape().«childViewmap.getterName»());
- return true;
- }
-«ENDFOR»
-
-«FOR compartment : getPinnedCompartments(it)»«var childViewmap = compartment.viewmap as ParentAssignedViewmap»
-
- 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;
- }
-«ENDFOR»
-
-«FOR child:getSideAffixedChildren(it)»
- ««« BEGIN PapyrusGencode
- ««« adding IF else end in order to take in account the case where a specific locator is added
-
-
- «IF child.locatorClassName !== null»
- «genSpecificLocator(child)»
- «ELSE»
- «««END PapyrusGencode«ENDREM
- 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;
- }
- ««« BEGIN PapyrusGencode
- «ENDIF»
- «««END PapyrusGencode
-«ENDFOR»
- return false;
- }
-'''
-
- override installGraphicalNodeEditPolicy(GenNode it) '''
-
- installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy());
-
- '''
-
- override def setLineWidth(GenNode it) '''
- «generatedMemberComment»
- protected void setLineWidth(int width) {
-««« if (primaryShape instanceof org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) {
-««« ((org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) primaryShape).setLineWidth(«IF getDiagram().isPixelMapMode()»width«ELSE»getMapMode().DPtoLP(width)«ENDIF»);
-««« }
- super.setLineWidth(width);
- }
- '''
-
- override def setLineStyle(GenNode it) '''
- «generatedMemberComment»
- protected void setLineType(int style) {
- if (primaryShape instanceof org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure) {
- ((org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
- '''
-
- override createFigure(GenNode it) '''
- «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(it)»Main«ELSE»Node«ENDIF»Figure() {
- «IF it instanceof GenChildSideAffixedNode»
- 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;
- «ELSE»
- return new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure(createMainFigureWithSVG());
- «ENDIF»
-
- }
- '''
-
-// override createNodePlate (GenNode it)'''
-// «generatedMemberComment»
-// protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
-// String prefElementId="«elementType.displayName»";
-// org.eclipse.jface.preference.IPreferenceStore store =«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore();
-// String preferenceConstantWitdh=org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.WIDTH);
-// String preferenceConstantHeight=org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.HEIGHT);
-// org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result = new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-//
-// «setupNodePlate(it)»
-// return result;
-// }
-// '''
-
- override createNodePlate(GenNode it) '''
- «generatedMemberComment»
- ««« @deprecated
- ««« «IF nodePlateQualifiedName !== null»
- ««« protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
- ««« «nodePlateQualifiedName» result = new «nodePlateQualifiedName»(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»);
- ««« «setupNodePlate»
- ««« return result;
- ««« }
- ««« «««END: BEGIN: PapyrusGenCode
- ««« «ELSE»
- ««« «super.createNodePlate(it)»
- «««
- ««« By default node edit part are now RoundedRectangleNodePlateFigure
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
- org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure result = new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»);
- «setupNodePlate»
- return result;
- }
- ««« «ENDIF»
- '''
-
-override borderItemSelectionEditPolicy(GenNode it)'''
- «IF hasBorderItems(it)»
- org.eclipse.gmf.runtime.notation.View childView = (org.eclipse.gmf.runtime.notation.View) child.getModel();
- String vid = «getVisualIDMethodCall(getDiagram())»(childView);
- if (vid != null) {
- switch (vid) {
- «IF getExternalLabels(it).size > 0»
- «FOR nextLabel : getExternalLabels(it) »
- «caseVisualID(nextLabel)»
- «ENDFOR»
- return «borderItemSelectionEP(it)»;
- «ENDIF»
- «IF getSideAffixedChildren(it).size > 0»
- «FOR nextBorderItem : getSideAffixedChildren(it)»
- «caseVisualID(nextBorderItem)»
- «ENDFOR»
- ««« BEGIN PapyrusGenCode
- ««« The purprose is to add replace GMF edit prolicy by an new editPolicy that allows to resize BorderItem
- return new org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy();
- ««« END PapyrusGenCode
- «ENDIF»
- }
- }
-«ENDIF»
-'''
-
- override createLayoutEditPolicyBody_FLOW_LAYOUT(GenNode it) '''
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy() {
- «IF hasBorderItems(it)»
- «extraLineBreak»
- «overrideC»
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
- «borderItemSelectionEditPolicy()»
- return super.createChildEditPolicy(child);
- }
- «ENDIF»
-
- «overrideC»
- protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
- return null;
- }
-
- «overrideC»
- protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
- return null;
- }
-
- «overrideC»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
- return null;
- }
- };
- return lep;
- '''
-
- override createLayoutEditPolicyBody_DEFAULT(GenNode it) '''
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- «overrideC»
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
- «borderItemSelectionEditPolicy(it)»
- 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;
- }
-
- «overrideC»
- protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
- return null;
- }
-
- «overrideC»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
- return null;
- }
- };
- return lep;
- '''
-
-//---------
-// PAPYRUS
-//---------
-
-
-
-def genSpecificLocator(GenCommonBase it, GenChildSideAffixedNode child) ''''''
-
-def genSpecificLocator(ToolEntry it, GenChildSideAffixedNode child) ''''''
-
-def genSpecificLocator(GenNavigatorChildReference it,GenChildSideAffixedNode child)''''''
-
-def genSpecificLocator(GenChildSideAffixedNode it)'''
- ««« // @depracated Papyrus Gencode :«locatorComment»
- if (childEditPart instanceof «it.getEditPartQualifiedClassName()») {
- org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «locatorClassName»(getMainFigure(), org.eclipse.draw2d.PositionConstants.«preferredSideName»);
- getBorderedFigure().getBorderItemContainer().add(((«it.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator);
- return true;
- }
-
-'''
-
- override def borderItemSelectionEP(GenNode it) '''
- new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy() {
-
- «overrideC»
- 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);
- }
- }
- '''
-
-//BEGIN PapyrusGencode
-//Overwrite an existing method to set the preference value in the editpart
-//def genPreferredValue (GenNode it)'''
-//
-// «generatedMemberComment»
-// @Override
-// public Object getPreferredValue(org.eclipse.emf.ecore.EStructuralFeature feature) {
-// org.eclipse.jface.preference.IPreferenceStore preferenceStore = (org.eclipse.jface.preference.IPreferenceStore) getDiagramPreferencesHint()
-// .getPreferenceStore();
-// Object result = null;
-//
-// if(feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
-// .getFontStyle_FontColor() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
-// .getFillStyle_FillColor()){
-// String prefColor = null;
-// if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
-// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE);
-// } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
-// .getFontStyle_FontColor()) {
-// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FONT);
-// } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
-// .getFillStyle_FillColor()) {
-// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL);
-// }
-// result = org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities
-// .RGBToInteger(org.eclipse.jface.preference.PreferenceConverter
-// .getColor(
-// (org.eclipse.jface.preference.IPreferenceStore) preferenceStore, prefColor));
-// } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
-// .getFillStyle_Transparency() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
-// .getFillStyle_Gradient()) {
-// String prefGradient = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT);
-// org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
-// preferenceStore.getString(prefGradient));
-// if(feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
-// .getFillStyle_Transparency()){
-// result = new Integer(gradientPreferenceConverter
-// .getTransparency());
-// } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
-// .getFillStyle_Gradient()){
-// result = gradientPreferenceConverter.getGradientData();
-// }
-// }
-//
-// if(result == null){
-// result = getStructuralFeatureValue(feature);
-// }
-// return result;
-// }
-//'''
-//END PapyrusGencode
-
-//BEGIN: PapyrusGenCode
-//CreateGenerator to refresh figure by taking account of event of UML element or graphical element
-def specificHandleNotificationEvent (GenNode it) '''
- «IF it.specificNotificationEvent »
- /**
- *Papyrus codeGen
- *@generated
- **/
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- «IF it.labels.filter(typeof(GenExternalNodeLabel)).size != 0»
- /*
- * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
- * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
- */
- if(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
- Object notifier = event.getNotifier();
- java.util.List<?> modelChildren = ((org.eclipse.gmf.runtime.notation.View)getModel()).getChildren();
- if (false == notifier instanceof org.eclipse.gmf.runtime.notation.Edge
- ««« see Bug 463769
- && false == notifier instanceof org.eclipse.gmf.runtime.notation.BasicCompartment) {
- if(modelChildren.contains(event.getNotifier())) {
- return;
- }
- }
- }
- «ENDIF»
- super.handleNotificationEvent(event);
- «IF refreshHook !== null»
- «specificHandleNotificationEventBody(refreshHook)»
- «ENDIF»
-
- }
- «ENDIF»
-
-'''
-
-def specificHandleNotificationEventBody(RefreshHook it) '''
- if (resolveSemanticElement() != null) {
- if(«refreshCondition»){
- «refreshAction»;
- refreshVisuals();
- }
- }
-'''
-//END: PapyrusGenCode
-
-override addBorderItem (GenNode it)'''
- «IF getExternalLabels(it).size > 0»
- «generatedMemberComment»
- protected void addBorderItem(org.eclipse.draw2d.IFigure borderItemContainer, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart borderItemEditPart) {
- «IF getExternalLabelsWithoutSpecificLocator(it).size > 0»
- if («FOR label : getExternalLabelsWithoutSpecificLocator(it) SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOR») {
- 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
- «ENDIF»
- «FOR label : getExternalLabelsWithSpecificLocator(it)»
- if (borderItemEditPart instanceof «label.getEditPartQualifiedClassName()») {
- org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «getSpecificLocator(label)»(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else
- «ENDFOR»
- {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
- «ENDIF»
-'''
-
-override setupNodePlate (GenNode it) ''''''
-
-def setupNodePlate (GenChildSideAffixedNode it)'''
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
-'''
-
-override def getTargetEditPartMethod(GenNode it) '''
- «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);
- «FOR compartment : compartments»
- «IF listCompartmentHasChildren(compartment)»
- «FOR childNode : compartment.childNodes»
- if («xptElementTypes.className(it.diagram)».isKindOf(type, «xptElementTypes.accessElementType(childNode)»)) {
- return getChildBySemanticHint(«xptVisualIDRegistry.typeMethodCall(compartment)»);
- }
- «ENDFOR»
- «ENDIF»
- «ENDFOR»
- }
- return super.getTargetEditPart(request);
- }
-'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend
deleted file mode 100644
index 4f6f09b2040..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Benoit Maggi (CEA LIST) -#510281 change dependency to replace gmft-runtime
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNodeLabel
-import xpt.diagram.editparts.Common
-import xpt.diagram.editparts.Utils_qvto
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-@Singleton class NodeLabelEditPart extends impl.diagram.editparts.NodeLabelEditPart {
- @Inject extension Utils_qvto;
-
- @Inject Common xptEditpartsCommon;
-
- override def nodeLabelDragPolicyQualifiedClassName(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy'''
-
-
- override handleNotificationEventBody(GenNodeLabel it) '''
- Object feature = event.getFeature();
- «IF isStoringChildPositions(node)»
- «xptEditpartsCommon.handleBounds(it)»
- «ENDIF»
- «xptEditpartsCommon.handleText(it)»
- ««« START Papyrus Code
- «IF elementIcon»
- if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
- refreshLabel();
- }
- «ENDIF»
- ««« End Papyrus Code
- super.handleNotificationEvent(event);
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend
deleted file mode 100644
index d62289c314e..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend
+++ /dev/null
@@ -1,829 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006-2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.impl.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.DesignLabelModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.LabelModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ParentAssignedViewmap
-import org.eclipse.papyrus.gmf.codegen.gmfgen.Viewmap
-import xpt.CodeStyle
-import xpt.Common
-import xpt.Common_qvto
-import xpt.diagram.ViewmapAttributesUtils_qvto
-import xpt.providers.ElementTypes
-
-//DOCUMENTATION: PapyrusGencode
-//This template has been modified to take in account the possibility to have extended direct editors
-
-@Singleton class TextAware extends impl.diagram.editparts.TextAware {
- @Inject extension Common
-
- @Inject extension CodeStyle
-
- @Inject extension ViewmapAttributesUtils_qvto
-
- @Inject extension Common_qvto
-
- @Inject ElementTypes xptElementTypes;
-
- override fields(GenCommonBase it)'''
- «generatedMemberComment»
- private org.eclipse.gef.tools.DirectEditManager manager;
-
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser;
-
- «generatedMemberComment»
- private java.util.List<?> parserElements;
-
- «generatedMemberComment»
- private String defaultText;
-
- ««« BEGIN: PapyrusGenCode
- ««« Add attributes to manage extended editors
- «generatedMemberComment('direct edition mode (default, undefined, registered editor, etc.)')»
- protected int directEditionMode = org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- «generatedMemberComment('configuration from a registered edit dialog')»
- protected org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration configuration;
- ««« END: BEGIN: PapyrusGenCode
-
-'''
- override methods(GenCommonBase it, boolean needsRefreshBounds, boolean readOnly, boolean useElementIcon, Viewmap viewmap,
- LabelModelFacet modelFacet, GenCommonBase host, GenDiagram diagram) '''
-
- «getLabelTextHelper(it)»
-
- «setLabelTextHelper(it)»
-
- «getLabelIconHelper(it)»
-
- «setLabelIconHelper(it)»
-
- « labelSetter(it)»
-
- « getModelChildren(it)»
-
- « getChildBySemanticHint(it)»
-««« ITEMIS CHANGES
- « setParser (it)»
-««« ITEMIS CHANGES END
- « getParserElement(it,modelFacet)»
-
- « getLabelIcon(it,useElementIcon, diagram)»
-
- « getLabelText(it)»
-
- « setLabelText(it,diagram)»
-
- « getEditText(it)»
-
- « isEditable(it,readOnly)»
-
- « getEditTextValidator(it)»
-
- « getCompletionProcessor(it)»
-
- « getParserOptions(it)»
-
- « getParser(it,modelFacet, diagram, host)»
-
- « getManager(it,diagram)»
-
- « setManager(it)»
-
- « performDirectEdit(it)»
-
- « performDirectEditAtPoint(it)»
-
- « performDirectEditWithInitialChar(it)»
-
- « performDirectEditRequest(it,diagram)»
-
- « initializeDirectEditManager(it)»
-
- « refreshVisuals(it,needsRefreshBounds)»
-
- « refreshLabel(it,diagram)»
-
- « refreshUnderline(it)»
-
- « refreshStrikeThrough(it)»
-
- « refreshFont(it)»
-
- « setFontColor(it)»
-
- « addSemanticListeners(it)»
-
- « removeSemanticListeners(it)»
-
- « getAccessibleEditPart(it)»
-
- « getFontStyleOwnerView(it,viewmap)»
-
- ««« BEGIN: PapyrusGenCode
- ««« Add extended editors management for direct edit
- « getDirectEditionType(it,readOnly)»
-
- « checkExtendedEditor(it)»
-
- « checkDefaultEdition(it)»
-
- « initExtendedEditorConfiguration(it)»
-
- « updateExtendedEditorConfiguration(it)»
-
- « performDefaultDirectEditorEdit(it)»
-
- «««END: PapyrusGenCode
-'''
-
-def labelSetterName(ParentAssignedViewmap it) '''
-«IF setterName != null»«setterName»«ELSE»setLabel«ENDIF»
-'''
-
-override labelSetterName(Viewmap it)'''setLabel'''
-
-override getLabelTextHelper (GenCommonBase it)'''
- « generatedMemberComment»
- protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText();
- } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
- return ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).getText();
- } else {
- return ((org.eclipse.draw2d.Label) figure).getText();
- }
- }
-'''
-
-override setLabelTextHelper (GenCommonBase it)'''
- «generatedMemberComment»
- protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text);
- } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
- ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).setText(text);
- } else {
- ((org.eclipse.draw2d.Label) figure).setText(text);
- }
- }
-'''
-
-override getLabelIconHelper (GenCommonBase it)'''
- «generatedMemberComment»
- protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon();
- } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
- return ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).getIcon();
- } else {
- return ((org.eclipse.draw2d.Label) figure).getIcon();
- }
- }
-'''
-
-override setLabelIconHelper (GenCommonBase it)'''
- «generatedMemberComment»
- protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
- ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).setIcon(icon);
- } else {
- ((org.eclipse.draw2d.Label) figure).setIcon(icon);
- }
- }
-'''
-
-override labelSetter (GenCommonBase it)'''
- «generatedMemberComment»
- public void « labelSetterName (viewmap)»(« labelSetterFigureClassName(viewmap)» figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-'''
-
-def labelSetterFigureClassName (ParentAssignedViewmap it)'''
- «IF figureQualifiedClassName != null»
- «figureQualifiedClassName»
- «ELSE»
- org.eclipse.draw2d.IFigure
- «ENDIF»
-'''
-
-override labelSetterFigureClassName (Viewmap it)'''
- org.eclipse.draw2d.IFigure
-'''
-
-override getModelChildren (GenCommonBase it)'''
- «generatedMemberComment»
- protected java.util.List<?> getModelChildren() {
- return java.util.Collections.EMPTY_LIST;
- }
-'''
-
-override getChildBySemanticHint (GenCommonBase it)'''
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-'''
-
-def setParser (GenCommonBase it)'''
- «generatedMemberComment»
- public void setParser(org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser) {
- this.parser = parser;
- }
-'''
-
-override getParserElement(GenCommonBase it, LabelModelFacet modelFacet) '''
- «generatedMemberComment»
- protected org.eclipse.emf.ecore.EObject getParserElement() {
- «IF modelFacet == null»
- org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
- return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel();
- «ELSE»« getParserElement(modelFacet)»«ENDIF»
- }
-'''
-
-def getParserElement (LabelModelFacet it)'''
- return resolveSemanticElement();
-'''
-
-def getParserElement (DesignLabelModelFacet it)'''
- return (org.eclipse.gmf.runtime.notation.View) getModel();
-'''
-
-override getLabelIcon(GenCommonBase it,boolean useElementIcon, GenDiagram diagram ) '''
- «generatedMemberComment»
- protected org.eclipse.swt.graphics.Image getLabelIcon() {
- «IF useElementIcon»
- ««« START: PapyrusGenCode
- return org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.getIcon(getParserElement(), getViewer());
- ««« END: PapyrusGenCode
- «ELSE»
- return null;
- «ENDIF»
- }
-'''
-
-override getLabelText (GenCommonBase it)'''
- «generatedMemberComment»
- protected String getLabelText() {
- String text = null;
- org.eclipse.emf.ecore.EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-'''
-
-override setLabelText(GenCommonBase it, GenDiagram diagram) '''
- «generatedMemberComment»
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
- }
- }
-'''
-
-override getEditText (GenCommonBase it)'''
- «generatedMemberComment»
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; «nonNLS»
- }
- return getParser().getEditString(
- org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-'''
-
-def isEditable(GenCommonBase it, boolean readOnly ) '''
- «generatedMemberComment»
- protected boolean isEditable() {
- «IF readOnly»
- return false;
- «ELSE»
- return getParser() != null;
- «ENDIF»
- }
-'''
-
-override getEditTextValidator (GenCommonBase it)'''
- «generatedMemberComment»
- public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
- return new org.eclipse.jface.viewers.ICellEditorValidator() {
-
- «overrideI»
- public String isValid(final Object value) {
- if (value instanceof String) {
- final org.eclipse.emf.ecore.EObject element = getParserElement();
- final org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = getParser();
- try {
- org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus valid =
- (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive(
- new org.eclipse.emf.transaction.RunnableWithResult.Impl<java.lang.Object>() {
-
- «overrideI»
- public void run() {
- setResult(parser.isValidEditString(org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), «editPartClassName».this), (String) value));
- }
- });
- return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-'''
-
-override getCompletionProcessor (GenCommonBase it)'''
- «generatedMemberComment»
- public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this));
- }
-'''
-
-override getParserOptions (GenCommonBase it)'''
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() {
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE;
- }
-'''
-
-override getParser(GenCommonBase it, LabelModelFacet modelFacet, GenDiagram diagram , GenCommonBase host ) '''
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() {
- if (parser == null) {
- parser = org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParser(«xptElementTypes.accessElementType(host)», getParserElement(), this, VISUAL_ID);
- }
- return parser;
- }
-'''
-
-def getManager(GenCommonBase it,GenDiagram diagram) '''
- «generatedMemberComment»
- protected org.eclipse.gef.tools.DirectEditManager getManager() {
- if (manager == null) {
- setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this,
- org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
- }
- return manager;
- }
-'''
-
-override setManager (GenCommonBase it)'''
- «generatedMemberComment»
- protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) {
- this.manager = manager;
- }
-'''
-
-override performDirectEdit (GenCommonBase it)'''
- «generatedMemberComment»
- protected void performDirectEdit() {
- org.eclipse.swt.custom.BusyIndicator.showWhile(org.eclipse.swt.widgets.Display.getDefault(), new java.lang.Runnable() {
-
- «overrideI»
- public void run() {
- getManager().show();
- }
- });
- }
-'''
-
-def performDirectEditAtPoint (GenCommonBase it)'''
- «generatedMemberComment»
- protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) {
- if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
- ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-'''
-
-override performDirectEditWithInitialChar (GenCommonBase it)'''
- «generatedMemberComment»
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
- ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-'''
-
-def performDirectEditRequest(GenCommonBase it, GenDiagram diagram ) '''
- «generatedMemberComment»
- protected void performDirectEditRequest(org.eclipse.gef.Request request) {
-
- final org.eclipse.gef.Request theRequest = request;
-
- if (org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this,
- org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- org.eclipse.jface.dialogs.Dialog dialog = null;
- if (configuration instanceof org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) {
- setManager(((org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else if (configuration instanceof org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration) {
- org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper helper = ((org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration)configuration).createPopupEditorHelper(this) ;
- helper.showEditor() ;
- return ;
- }
- else if(configuration instanceof org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration) {
- dialog = ((org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration)configuration).createDialog(org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration) {
- dialog = new org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog(org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final org.eclipse.jface.dialogs.Dialog finalDialog = dialog;
-
- if (org.eclipse.jface.window.Window.OK == dialog.open()) {
- org.eclipse.emf.transaction.TransactionalEditingDomain domain = getEditingDomain();
- org.eclipse.emf.transaction.RecordingCommand command = new org.eclipse.emf.transaction.RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-'''
-
-def initializeDirectEditManager (GenCommonBase it)'''
- «generatedMemberComment»
- protected void initializeDirectEditManager(final org.eclipse.gef.Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- «overrideI»
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-'''
-
-def refreshVisuals(GenCommonBase it, boolean needsRefreshBounds ) '''
- «generatedMemberComment»
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- «IF needsRefreshBounds»
- refreshBounds();
- «ENDIF»
- }
-'''
-
-override refreshLabel(GenCommonBase it , GenDiagram diagram )'''
- «generatedMemberComment»
- protected void refreshLabel() {
- org.eclipse.gef.EditPolicy maskLabelPolicy = getEditPolicy(org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy==null){
- maskLabelPolicy = getEditPolicy(org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View)getModel();
- if(view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
- }
- }
-'''
-
-override refreshUnderline (GenCommonBase it)'''
- «generatedMemberComment»
- protected void refreshUnderline() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if(resolveSemanticElement() instanceof org.eclipse.uml2.uml.Feature){
- if(((org.eclipse.uml2.uml.Feature)resolveSemanticElement()).isStatic()){
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)getFigure()).setTextUnderline(true);
- }
- else{((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)getFigure()).setTextUnderline(false);}
- }
- }
-'''
-
-override refreshStrikeThrough (GenCommonBase it)'''
- «generatedMemberComment»
- protected void refreshStrikeThrough() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-'''
-
-override refreshFont (GenCommonBase it)'''
- «generatedMemberComment»
- protected void refreshFont() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) |
- (style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL));
- setFont(fontData);
- }
- }
-'''
-
-override setFontColor (GenCommonBase it)'''
- «generatedMemberComment»
- protected void setFontColor(org.eclipse.swt.graphics.Color color) {
- getFigure().setForegroundColor(color);
- }
-'''
-
-override addSemanticListeners (GenCommonBase it)'''
- «generatedMemberComment»
- protected void addSemanticListeners() {
- if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
- org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
- parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «nonNLS»
- }
- } else {
- super.addSemanticListeners();
- }
- }
-'''
-
-override removeSemanticListeners (GenCommonBase it)'''
- «generatedMemberComment»
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); «nonNLS»
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-'''
-
-override getAccessibleEditPart (GenCommonBase it)'''
- «generatedMemberComment»
- protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- «overrideC»
- public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-'''
-
-override getFontStyleOwnerView(GenCommonBase it, Viewmap viewmap ) '''
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() {
- «IF isFixedFont(viewmap)»
- return (org.eclipse.gmf.runtime.notation.View) getModel();
- «ELSE»
- return getPrimaryView();
- «ENDIF»
- }
-'''
-
-
-//BEGIN: PapyrusGenCode
-//Methods for advanced direct edition
-
-def getDirectEditionType(GenCommonBase it, Boolean readOnly) '''
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- «IF readOnly»
- // The label is read-only (defined in GMFGen model)
- return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION;
- «ELSE»
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION;
- «ENDIF»
- }
-'''
-
-def checkExtendedEditor (GenCommonBase it)'''
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(),this);
- }
- return false;
- }
-'''
-
-def checkDefaultEdition (GenCommonBase it)'''
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-'''
-
-def initExtendedEditorConfiguration (GenCommonBase it)'''
- /**
- * Initializes the extended editor configuration
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator.getDefault().getPreferenceStore().getString(org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-'''
-
-def updateExtendedEditorConfiguration (GenCommonBase it)'''
- /**
- * Updates the preference configuration
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator.getDefault().getPreferenceStore().getString(
- org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(),this);
- } else if (org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-'''
-
-def performDefaultDirectEditorEdit (GenCommonBase it)'''
- /**
- * Performs the direct edit usually used by GMF editors.
- * @param theRequest the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final org.eclipse.gef.Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- «overrideI»
- public void run() {
- if (isActive() && isEditable()) {
- if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) theRequest.getExtendedData().get(
- org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-'''
-//END: PapyrusGenCode
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend
deleted file mode 100644
index d5595688daf..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend
+++ /dev/null
@@ -1,166 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov - refactoring of containerBaseCanonicalMethods.xpt; extraction of API/non-API of CEP templates
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.impl.diagram.update
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenContainerBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Common
-import xpt.diagram.updater.DiagramUpdater
-import xpt.diagram.updater.NodeDescriptor
-import xpt.diagram.updater.Utils_qvto
-import xpt.diagram.updater.LinkDescriptor
-import xpt.editor.VisualIDRegistry
-
-@Singleton class CanonicalUpdate extends impl.diagram.update.CanonicalUpdate {
- @Inject extension Common;
- @Inject extension Utils_qvto;
-
- @Inject NodeDescriptor nodeDescriptor;
- @Inject MetaModel xptMetaModel;
- @Inject DiagramUpdater xptDiagramUpdater;
- @Inject LinkDescriptor linkDescriptor;
- @Inject VisualIDRegistry xptVisualIDRegistry;
-
- override def getFeaturesToSynchronizeMethod(GenContainerBase it) '''
- «IF getSemanticChildrenChildFeatures(it).size == 1»
-
- «generatedMemberComment»
- protected org.eclipse.emf.ecore.EStructuralFeature getFeatureToSynchronize() {
- return «xptMetaModel.MetaFeature(getSemanticChildrenContainmentFeatures(it).head)»;
- }
- «ELSEIF getSemanticChildrenChildFeatures(it).size > 1»
-
- «generatedMemberComment»
- protected java.util.Set<org.eclipse.emf.ecore.EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new java.util.HashSet<org.eclipse.emf.ecore.EStructuralFeature>();
- «FOR f : getSemanticChildrenContainmentFeatures(it)»
- «addContainmentFeature(f)»
- «ENDFOR»
- }
- return myFeaturesToSynchronize;
- }
- «ENDIF»
- '''
-
- override def getSemanticChildrenListMethod(GenContainerBase it) '''
- «generatedMemberComment»
- protected java.util.List<org.eclipse.emf.ecore.EObject> getSemanticChildrenList() {
- «IF hasSemanticChildren(it)/*REVISIT: is there real need for this check - Generator seems to consult needsCanonicalEP, which in turns ensures there are semantic children?*/»
- org.eclipse.gmf.runtime.notation.View viewObject = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- java.util.LinkedList<org.eclipse.emf.ecore.EObject> result = new java.util.LinkedList<org.eclipse.emf.ecore.EObject>();
- java.util.List<«nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)»> childDescriptors = «xptDiagramUpdater.
- getSemanticChildrenMethodCall(it)»(viewObject);
- for («nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)» d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- «ELSE»
- return java.util.Collections.EMPTY_LIST;
- «ENDIF»
- }
- '''
-
- override def refreshConnectionsBody(GenDiagram it) '''
- «Domain2Notation(it)» domain2NotationMap = new «Domain2Notation(it)»();
- java.util.Collection<«linkDescriptor.qualifiedClassName(editorGen.diagramUpdater)»> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
- java.util.List<org.eclipse.gmf.runtime.notation.View> edges = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>();
- for (Object edge : getDiagram().getEdges())
- {
- if (edge instanceof org.eclipse.gmf.runtime.notation.View)
- {
- edges.add((org.eclipse.gmf.runtime.notation.View) edge);
- }
- }
- java.util.Collection<org.eclipse.gmf.runtime.notation.View> existingLinks = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>(edges);
- for (java.util.Iterator<org.eclipse.gmf.runtime.notation.View> linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextDiagramLink = (org.eclipse.gmf.runtime.notation.Edge) linksIterator.next();
- int diagramLinkVisualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(nextDiagramLink);
- if (diagramLinkVisualID == -1«FOR link : links.filter[gl|gl.modelFacet == null]»«compareLinkVisualID(link)»«ENDFOR») {
- if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
- linksIterator.remove();
- }
- continue;
- }
- org.eclipse.emf.ecore.EObject diagramLinkObject = nextDiagramLink.getElement();
- org.eclipse.emf.ecore.EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
- org.eclipse.emf.ecore.EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
- for (java.util.Iterator<«it.editorGen.diagramUpdater.linkDescriptorQualifiedClassName»> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
- «linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)» nextLinkDescriptor = linkDescriptorsIterator.next();
- if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
- linksIterator.remove();
- linkDescriptorsIterator.remove();
- break;
- }
- }
- }
- deleteViews(existingLinks.iterator());
- return createConnections(linkDescriptors, domain2NotationMap);
- '''
-
- override def collectAllLinksMethod(GenDiagram it) '''
- «generatedMemberComment»
- private java.util.Collection<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> collectAllLinks(org.eclipse.gmf.runtime.notation.View view, «Domain2Notation(
- it)» domain2NotationMap) {
- if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view))) {
- return java.util.Collections.emptyList();
- }
- java.util.LinkedList<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> result = new java.util.LinkedList<«linkDescriptor.
- qualifiedClassName(it.editorGen.diagramUpdater)»>();
- String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(view);
- if (vid != null) {
- switch (vid) {
- «FOR se : it.allSemanticElements»
- «caseSemanticElement(se)»
- «ENDFOR»
- }
- }
- for (java.util.Iterator<?> children = view.getChildren().iterator(); children.hasNext();) {
- result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) children.next(), domain2NotationMap));
- }
- for (java.util.Iterator<?> edges = view.getSourceEdges().iterator(); edges.hasNext();) {
- result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) edges.next(), domain2NotationMap));
- }
- return result;
- }
- '''
-
- override getEditPartMethod(GenDiagram it) '''
- «generatedMemberComment»
- private org.eclipse.gef.EditPart getEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap) {
- org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.get(domainModelElement);
- if (view != null) {
- return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
- }
- '''
-
- override getHintedEditPartMethod(GenDiagram it) '''
- «generatedMemberComment»
- protected final org.eclipse.gef.EditPart getHintedEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap, int hintVisualId) {
- org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.getHinted(domainModelElement, «xptVisualIDRegistry.typeMethodCall(it, 'hintVisualId')»);
- if (view != null) {
- return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend
deleted file mode 100644
index 0c80b1fd830..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend
+++ /dev/null
@@ -1,159 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007-2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [235113] alternative parser access
- * [244419] custom parsers
- * [138179] expression-backed labels
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.impl.parsers
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import impl.parsers.expression_qvto
-import metamodel.MetaModel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildLabelNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenParsers
-import parsers.ExpressionLabelParser
-import parsers.PredefinedParser
-import plugin.Activator
-import xpt.Common
-import xpt.Common_qvto
-import xpt.editor.VisualIDRegistry
-import xpt.expressions.OclTracker_qvto
-import xpt.expressions.getExpression
-import xpt.providers.ElementTypes
-import xpt.providers.ParserUtils_qvto
-
-@Singleton class ParserProvider extends impl.parsers.ParserProvider {
- @Inject extension Common
- @Inject extension Common_qvto
-
- @Inject extension OclTracker_qvto
- @Inject extension ParserUtils_qvto
- @Inject extension expression_qvto
-
- @Inject extension ExpressionLabelParser;
- @Inject extension PredefinedParser;
-
- @Inject getExpression xptGetExpression;
- @Inject MetaModel xptMetaModel;
- @Inject VisualIDRegistry xptVisualIDRegistry;
- @Inject ElementTypes xptElementTypes;
- @Inject parsers.ParserProvider xptParsers;
- @Inject Activator xptActivator;
-
- override def HintAdapterClass(GenParsers it) '''
- «generatedMemberComment()»
- private static class HintAdapter extends org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter {
-
- «generatedMemberComment()»
- private final org.eclipse.gmf.runtime.emf.type.core.IElementType elementType;
-
- «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;
- }
-
- «generatedMemberComment()»
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
- if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) {
- return elementType;
- }
- return super.getAdapter(adapter);
- }
- }
- '''
-
- override dispatch dispatch_parsers(GenNode it) '''
- «FOR label : it.labels»
- «IF label.modelFacet != null»
- «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)»
- «ENDIF»
- «ENDFOR»
- '''
-
- override dispatch dispatch_parsers(GenLink it) '''
- «FOR label : it.labels»
- «IF label.modelFacet != null»
- «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)»
- «ENDIF»
- «ENDFOR»
- '''
-
- override dispatch dispatch_getParsers(GenNode it) //
- '''
- «FOR label : it.labels»
- «IF label.modelFacet != null»
- «doGetParser(label.modelFacet.parser, label)»
- «ENDIF»
- «ENDFOR»
-
- '''
-
- override dispatch dispatch_getParsers(GenLink it) //
- '''
- «FOR label : it.labels»
- «IF label.modelFacet != null»
- «doGetParser(label.modelFacet.parser, label)»
- «ENDIF»
- «ENDFOR»
-
- '''
-
- override dispatch dispatch_getParsers(GenChildLabelNode it) '''
- «IF it.modelFacet != null»
- «doGetParser(it.labelModelFacet.parser, it)»
- «ENDIF»
- '''
-
- override def getParserByVisualIdMethod(GenParsers it) '''
- «generatedMemberComment()»
- protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(String visualID) {
- if (visualID != null) {
- switch (visualID) {
- «FOR node : editorGen.diagram.topLevelNodes»
- «dispatch_getParsers(node)»
- «ENDFOR»
- «FOR node : editorGen.diagram.childNodes»
- «dispatch_getParsers(node)»
- «ENDFOR»
- «FOR link : editorGen.diagram.links»
- «dispatch_getParsers(link)»
- «ENDFOR»
- }
- }
- return null;
- }
- '''
-
- override def provider_providesMethod(GenParsers it) '''
- «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 («xptElementTypes.qualifiedClassName(editorGen.diagram)».getElement(hint) == null) {
- return false;
- }
- return getParser(hint) != null;
- }
- return false;
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend
deleted file mode 100644
index 829fb4e25fe..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.impl.preferences
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenStandardPreferencePage
-import org.eclipse.papyrus.gmf.codegen.gmfgen.StandardPreferencePages
-import xpt.Common
-
-//DOCUMENTATION: PapyrusGencode
-//change the superclass and the initialization
-
-@Singleton class StandardPage extends impl.preferences.StandardPage {
- @Inject extension Common;
-
-
- override Main(GenStandardPreferencePage it) '''
- «copyright(it.diagram.editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» «extendsList(it)» «implementsList(it)» {
-
- «generatedMemberComment»
- public «className(it)»() {
- setPreferenceStore(«getDiagram().editorGen.plugin.activatorQualifiedClassName».getInstance().getPreferenceStore());
- «IF StandardPreferencePages.GENERAL_LITERAL == kind»
- setPreferenceKey(«getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID);
- «ENDIF»
- }
- }
- '''
-
- override extendsList(GenStandardPreferencePage it) '''
- «IF kind == StandardPreferencePages::GENERAL_LITERAL»
- extends org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage«»
- «ELSEIF kind == StandardPreferencePages::APPEARANCE_LITERAL»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage«»
- «ELSEIF kind == StandardPreferencePages::CONNECTIONS_LITERAL»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage«»
- «ELSEIF kind == StandardPreferencePages::PRINTING_LITERAL»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage«»
- «ELSEIF kind == StandardPreferencePages::RULERS_AND_GRID_LITERAL»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage«»
- «ENDIF»
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend
deleted file mode 100644
index a64ee9fb184..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend
+++ /dev/null
@@ -1,46 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Florian Noyrit - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.metamodel;
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.Facility_qvto
-import org.eclipse.emf.codegen.ecore.genmodel.GenPackage
-import org.eclipse.papyrus.gmf.codegen.gmfgen.DynamicModelAccess
-import xpt.Common
-
-@Singleton class Facility extends metamodel.Facility {
-
- @Inject extension Common;
- @Inject extension Facility_qvto;
-
-
-
-override getMethod(GenPackage it, DynamicModelAccess dma)'''
- «generatedMemberComment('@throws IllegalStateException if no EPackage with given URI is registered.')»
- public static «className(dma)» get«getNameToken(it)»() {
- if («fieldName(it)» == null) {
- org.eclipse.emf.ecore.EPackage pkg = getRegistry().getEPackage("«getEcorePackage().nsURI»");
- if (pkg == null) {
- throw new IllegalStateException("Package «getEcorePackage().name»(«getEcorePackage().nsURI») not found");
- }
- «fieldName(it)» = new «className(dma)»(pkg);
- «fieldName(it)».init«getNameToken(it)»();
- }
- return «fieldName(it)»;
- }
-'''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend
deleted file mode 100644
index ea237bda310..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 Anatoliy Tischenko and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Anatoliy Tischenko - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.metamodel
-
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass
-import org.eclipse.emf.codegen.ecore.genmodel.GenFeature
-import com.google.inject.Inject
-import metamodel.MetaModel_qvto
-import com.google.inject.Singleton
-
-@Singleton class MetaModel extends metamodel.MetaModel {
-
- @Inject extension MetaModel_qvto;
-
- override DeclareAndAssign2(GenClass it, String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) //
- '''«getQualifiedInterfaceName(it)» «assignee» = «getFeatureValue(srcFeature, src, srcMetaClass)».«srcExt»;'''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/parsers/PredefinedParser.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/parsers/PredefinedParser.xtend
deleted file mode 100644
index da444804ed4..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/parsers/PredefinedParser.xtend
+++ /dev/null
@@ -1,68 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
- * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
- * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 464625
- *
- *****************************************************************************/
-package aspects.parsers
-
-import com.google.inject.Singleton
-
-@Singleton class PredefinedParser extends parsers.PredefinedParser{
-
- override def extendsList(org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser it) //
- '''extends org.eclipse.papyrus.infra.gmfdiag.common.parsers.AbstractElementTypeBasedAttributeParser'''
-
- override def additions(org.eclipse.papyrus.gmf.codegen.gmfgen.PredefinedParser it) //
- '''
- /**
- * @generated
- * {@inheritDoc}
- * @see org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object)
- */
- @Override
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getModificationCommand(final org.eclipse.emf.ecore.EObject element, final org.eclipse.emf.ecore.EStructuralFeature feature, final Object value) {
- org.eclipse.gmf.runtime.common.core.command.ICommand result = null;
-
- // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name
- if (feature.equals(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNamedElement_Name())) {
- if (org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement) element)) {
- final org.eclipse.papyrus.infra.core.resource.ModelSet modelSet = (org.eclipse.papyrus.infra.core.resource.ModelSet) element.eResource().getResourceSet();
- if (null != modelSet) {
- result = new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (org.eclipse.uml2.uml.NamedElement) element, (String) value, null));
- }
- }
- }
-
- return null != result ? result : super.getModificationCommand(element, feature, value);
- }
-
- /**
- * @generated
- * {@inheritDoc}
- * @see org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature)
- */
- @Override
- protected Object getValue(final org.eclipse.emf.ecore.EObject element, final org.eclipse.emf.ecore.EStructuralFeature feature) {
- Object result = null;
-
- if(element instanceof org.eclipse.uml2.uml.NamedElement && feature.equals(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNamedElement_Name())){
- if (org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement)element)) {
- result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement)element);
- }
- }
-
- return null != result ? result : super.getValue(element, feature);
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend
deleted file mode 100644
index 75836a21c66..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend
+++ /dev/null
@@ -1,26 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Anatoliy Tischenko - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import com.google.inject.Singleton
-
-@Singleton class CodeStyle extends xpt.CodeStyle {
-
- override overrideI(GenCommonBase xptSelf) '''
- @Override
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend
deleted file mode 100644
index 6d41ee972c5..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend
+++ /dev/null
@@ -1,47 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt;
-
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
-
-@Singleton class Common extends xpt.Common {
- override copyright(GenEditorGenerator it)
- '''
- «IF copyrightText !== null»
- /**
- * «copyrightText.replaceAll('\n', '\n * ')»
- */
- «ENDIF»
- '''
-
- def String stringVisualID(GenCommonBase it) {
- if (visualIDOverride !== null)
- visualIDOverride
- else
- visualID.toString
- }
-
- def String stringUniqueIdentifier(GenCommonBase it) {
- if (visualIDOverride !== null)
- visualIDOverride
- else
- it.uniqueIdentifier
- }
-}
-
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/QualifiedClassNameProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/QualifiedClassNameProvider.xtend
deleted file mode 100644
index e5ad0f2340c..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/QualifiedClassNameProvider.xtend
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Florian Noyrit - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt
-
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-
-@Singleton class QualifiedClassNameProvider extends xpt.QualifiedClassNameProvider {
-
-
-
-
- override dispatch getItemSemanticEditPolicyQualifiedClassName(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy'''
- override dispatch getItemSemanticEditPolicyQualifiedClassName(GenCompartment it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy'''
- override dispatch getItemSemanticEditPolicyQualifiedClassName(GenLink it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy'''
- override dispatch getItemSemanticEditPolicyQualifiedClassName(GenNode it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy'''
-
-
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend
deleted file mode 100644
index 9583698f144..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend
+++ /dev/null
@@ -1,85 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007-2012 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.diagram.commands
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.LinkModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeLinkModelFacet
-import xpt.Common
-import xpt.diagram.Utils_qvto
-
-@Singleton class CreateLinkUtils extends xpt.diagram.commands.CreateLinkUtils {
- @Inject extension Common;
- @Inject extension Utils_qvto;
-
- @Inject MetaModel xptMetaModel;
-
-
- /**
- * Fields of command that creates link.
- */
- override dispatch fields(LinkModelFacet it) '''
- «extraLineBreak»
- «generatedMemberComment()»
- protected final org.eclipse.emf.ecore.EObject source;
-
- «generatedMemberComment()»
- protected final org.eclipse.emf.ecore.EObject target;
- '''
-
- override dispatch fields(TypeLinkModelFacet it) '''
- «extraLineBreak»
- «generatedMemberComment()»
- protected final org.eclipse.emf.ecore.EObject source;
-
- «generatedMemberComment()»
- protected final org.eclipse.emf.ecore.EObject target;
- «IF hasContainerOtherThanSource(it)»
-
- «generatedMemberComment()»
- protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container;
- «ENDIF»
- '''
-
- override dispatch containerAccessor(TypeLinkModelFacet it) '''
- «IF hasContainerOtherThanSource(it)»
-
- «generatedMemberComment()»
- public «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» getContainer() {
- return container;
- }
-
- «generatedMemberComment(
- 'Default approach is to traverse ancestors of the source to find instance of container.\n' + 'Modify with appropriate logic.'
- )»
- protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» deduceContainer(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) {
- // Find container element for the new link.
- // Climb up by containment hierarchy starting from the source
- // and return the first element that is instance of the container class.
- for (org.eclipse.emf.ecore.EObject element = source; element != null; element = element.eContainer()) {
- if («xptMetaModel.IsInstance(containmentMetaFeature.genClass, 'element')») {
- return «xptMetaModel.CastEObject(it.containmentMetaFeature.genClass, 'element')»;
- }
- }
- return null;
- }
- «ENDIF»
-
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend
deleted file mode 100644
index 04d75dfd30e..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend
+++ /dev/null
@@ -1,230 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.diagram.commands
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeModelFacet
-import xpt.Common
-import xpt.OclMigrationProblems_qvto
-import xpt.diagram.Utils_qvto
-
-@Singleton class CreateNodeCommand extends xpt.diagram.commands.CreateNodeCommand {
- @Inject extension Common;
-
- @Inject extension OclMigrationProblems_qvto;
- @Inject extension MetaModel
- @Inject extension Utils_qvto;
-
-
- @Inject MetaModel xptMetaModel;
-
- override CreateNodeCommand(GenNode it) '''
- «copyright(it.diagram.editorGen)»
- package «packageName(it)»;
-
-
-
- «generatedClassComment()»
- public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
-
- «IF ! it.modelFacet.isPhantomElement()»
- «generatedMemberComment()»
- private org.eclipse.gmf.runtime.notation.Diagram diagram = null;
- «ENDIF»
-
- «_constructor(it)»
-
- «getElementToEdit(it)»
-
- «canExecuteMethod(it)»
-
- «doExecuteWithResultMethod(it)»
-
- «doConfigureMethod(it)»
-
- «additions(it)»
- }
- '''
-
- override _constructor(GenNode it) '''
- «generatedMemberComment()»
- public «className(it)»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.gmf.runtime.notation.Diagram diagram) {
- super(req.getLabel(), null, req);
- «IF ! it.modelFacet.isPhantomElement()»
- this.diagram = diagram;
- «ENDIF»
- }
- '''
-
-// override CreateNodeCommand(TypeModelFacet it) '''
-// «copyright(ownerGenNode(it).diagram.editorGen)»
-// package «packageName(it)»;
-//
-// «generatedClassComment()»
-// public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
-//««« Mutating canvas auxiliary
-// «generatedMemberComment»
-// private org.eclipse.emf.ecore.EClass eClass = null;
-// «generatedMemberComment»
-// private org.eclipse.emf.ecore.EObject eObject = null;
-// ««« Mutating canvas auxiliary constructor
-// «generatedMemberComment»
-// public «ownerGenNode(it).createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) {
-// super(req.getLabel(), null, req);
-// this.eObject = eObject;
-// this.eClass = eObject != null ? eObject.eClass() : null;
-// }
-// ««« Mutating canvas auxiliary builder
-// «generatedMemberComment»
-// public static «ownerGenNode(it).createCommandClassName» create(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) {
-// return new «ownerGenNode(it).createCommandClassName»(req, eObject);
-// }
-// « _constructor(it)»
-// « getElementToEdit(it)»
-// « canExecuteMethod(it)»
-// « doExecuteWithResultMethod(it)»
-// « doConfigureMethod(it)»
-// }
-// '''
-//
-//
-//
-// /**
-// * TODO: either use setElementToEdit, or generate downcasted version (which may be troublesome if containment and child features point to a different parent)
-// */
-// override getElementToEdit(TypeModelFacet it) '''
-// «generatedMemberComment('FIXME: replace with setElementToEdit()')»
-// protected org.eclipse.emf.ecore.EObject getElementToEdit() {
-//
-// ««« Mutating canvas helper
-// 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;
-//
-// }
-// '''
-
- // [AbstractElement] Modified for Abstract domain element
- override doExecuteWithResultMethod(GenNode it) '''
- «generatedMemberComment()»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- ««« [AbstractElement] START
-
- «IF it.modelFacet.metaClass.ecoreClass.abstract != true»
- ««« [AbstractElement] END
- «IF it.modelFacet.isPhantomElement()»
- «phantomElementCreation(it.modelFacet, it, 'newElement')»
- «ELSE»
- «normalElementCreation(it.modelFacet, it, 'newElement')»
- «ENDIF»
- «extraLineBreak»
- «initialize(it.modelFacet, it, 'newElement')»
- «IF true/*FIXME boolean needsExternalConfiguration*/»
- «extraLineBreak»
- doConfigure(newElement, monitor, info);
- «extraLineBreak»
- «ENDIF»
- ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«xptMetaModel.
- DowncastToEObject(it.modelFacet.metaClass, 'newElement')»);
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(newElement);
- }
- ««« [AbstractElement] START
- «ELSE»
- throw new UnsupportedOperationException("Unimplemented operation (abstract domain element).");
- }
- «ENDIF»
- ««« [AbstractElement] END
- '''
-
-
- override canExecute_Normal(TypeModelFacet it) '''
- «IF containmentMetaFeature != null»
- «IF containmentMetaFeature.ecoreFeature != null»
- «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || (childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature))»
- «IF ! isUnbounded(containmentMetaFeature.ecoreFeature)»
- «DeclareAndAssign(containmentMetaFeature.genClass,'container', 'getElementToEdit()') »
- «IF isSingleValued(containmentMetaFeature.ecoreFeature)»
- if («getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass) » != null) {
- «ELSE»
- if (« getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass)».size() >= «containmentMetaFeature.ecoreFeature.upperBound») {
- «ENDIF»
- return false;
- }
- «ENDIF»
- «IF childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature)»
- «IF isSingleValued(childMetaFeature.ecoreFeature)»
- if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) » != null) {
- «ELSE»
- if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) ».size() >= «childMetaFeature.ecoreFeature.upperBound») {
- «ENDIF»
- return false;
- }
- «ENDIF»
- «ENDIF»
- «ENDIF»
- «ENDIF»
-
- org.eclipse.emf.ecore.EObject target = getElementToEdit();
- org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), «MetaClass(metaClass)»);
- return data.isPermitted();
-
- '''
-
-
- override normalElementCreation(TypeModelFacet it, GenNode node, String varName) '''
- «xptMetaModel.NewInstance(it.metaClass, varName)»
-
- org.eclipse.emf.ecore.EObject target = getElementToEdit();
- org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target, «varName»);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, «varName»)) {
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- «extraLineBreak»
- «IF containmentMetaFeature != null»
- «xptMetaModel.DeclareAndAssign(it.containmentMetaFeature.genClass, 'qualifiedTarget', 'target')»
- «xptMetaModel.modifyFeature(containmentMetaFeature, 'qualifiedTarget', containmentMetaFeature.genClass, varName)»
- «ELSE»
- //
- // FIXME no containment feature found in the genmodel, toolsmith need to manually write code here to add «varName» to a parent
- //
- «ENDIF»
-
- }
- } else {
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
- «IF hasExplicitChildFeature(it)»
- «xptMetaModel.DeclareAndAssign(it.childMetaFeature.genClass, 'childHolder', 'getElementToEdit()')»
- «xptMetaModel.modifyFeature(it.childMetaFeature, 'childHolder', childMetaFeature.genClass, varName)»
- «ENDIF»
- '''
-
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend
deleted file mode 100644
index fb95b001f4f..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend
+++ /dev/null
@@ -1,79 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 Anatolyi Tischenko and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Anatolyi Tischenko - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.diagram.commands
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.LinkModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-
-@Singleton class ReorientLinkUtils extends xpt.diagram.commands.ReorientLinkUtils {
-
- @Inject extension Common
-
- override canReorient(LinkModelFacet it, GenLink link) '''
- «generatedMemberComment()»
- public boolean canExecute() {
- «checkLinkValidity(it)»
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- «generatedMemberComment()»
- protected boolean canReorientSource() {
- «checkSourceRequestValidity(it, link)»
- }
-
- «generatedMemberComment()»
- protected boolean canReorientTarget() {
- «checkTargetRequestValidity(it, link)»
- }
- '''
-
- override reorient(LinkModelFacet it) '''
-
- «generatedMemberComment()»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
- org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info)
- throws org.eclipse.core.commands.ExecutionException {
- if (!canExecute()) {
- throw new org.eclipse.core.commands.ExecutionException("Invalid arguments in reorient link command"); «nonNLS()»
- }
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- «generatedMemberComment()»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientSource() throws org.eclipse.core.commands.ExecutionException {
- «reorientSource(it)»
- }
-
- «generatedMemberComment()»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientTarget() throws org.eclipse.core.commands.ExecutionException {
- «reorientTarget(it)»
- }
- '''
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/BaseEditHelper.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/BaseEditHelper.xtend
deleted file mode 100644
index 844d3346635..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/BaseEditHelper.xtend
+++ /dev/null
@@ -1,28 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.diagram.edithelpers;
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-public class BaseEditHelper extends xpt.diagram.edithelpers.BaseEditHelper {
-
- override superClass(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase'''
-
- override def editPolicyCommandConstant(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase.EDIT_POLICY_COMMAND'''
-
- override def contextElementTypeConstant(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE'''
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend
deleted file mode 100644
index 3af8e37cdd9..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006-2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.diagram.edithelpers;
-
-import com.google.inject.Inject
-import org.eclipse.papyrus.gmf.codegen.gmfgen.MetamodelType
-import utils.EditHelperUtils_qvto
-import xpt.Common
-
-public class EditHelper extends xpt.diagram.edithelpers.EditHelper {
- @Inject extension Common;
- @Inject extension EditHelperUtils_qvto
-
-
-
-
- override EditHelper(MetamodelType it) '''
- «copyright(diagramElement.diagram.editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «editHelperClassName» extends «getBaseEditHelperFullName(diagramElement.getDiagram())» {
- «additions(it)»
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend
deleted file mode 100644
index d216d9ea0fc..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Patrick Tessier (CEA LIST)
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editparts
-
-import aspects.xpt.QualifiedClassNameProvider
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenContainerBase
-
-//Documentation: PapyrusGenCode
-//This template has been modified in order to remove canonical ediPolicies
-
-@Singleton class Common extends xpt.diagram.editparts.Common {
- @Inject extension aspects.xpt.Common;
-
- @Inject QualifiedClassNameProvider qualifiedClassNameProvider;
-
- override installCanonicalEditPolicy(GenContainerBase it) '''
- «IF it.needsCanonicalEditPolicy»
- ««« BEGIN: PapyrusGenCode
- ««« Used to remove at each time canonical editpolicies
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»());
- ««« END: PapyrusGenCode
-
- «ENDIF»
- '''
-
- override creationEditPolicyNewInstance(GenCommonBase it)
- '''new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy()'''
-
-
- override installSemanticEditPolicy(GenCommonBase it) '''
- «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 «qualifiedClassNameProvider.getItemSemanticEditPolicyQualifiedClassName(it)»());
- «ENDIF»
- '''
-
- override def visualIDConstant(GenCommonBase it) '''
- «generatedMemberComment»
- public static final String VISUAL_ID = "«stringVisualID»";
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend
deleted file mode 100644
index e1f832a51c6..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editparts
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-//DOCUMENTATION: PapyrusGencode
-//change to manage the figure of the comment
-@Singleton class EditPartFactory extends xpt.diagram.editparts.EditPartFactory {
-
- @Inject extension xpt.Common;
-
-
- override getTextCellEditorLocator(GenDiagram it) '''
- «generatedMemberComment»
- public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator(
- org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart source) {
- if (source.getFigure() instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure){
- return new MultilineCellEditorLocator(
- (org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure) source.getFigure());
- }
- else {
- return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
-
- }
- }
-
-
- «generatedClassComment»
- static private class MultilineCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
-
- «generatedClassComment»
- private org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure multilineEditableFigure;
-
- «generatedClassComment»
- public MultilineCellEditorLocator(org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure figure) {
- this.multilineEditableFigure = figure;
- }
-
- «generatedClassComment»
- public org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure getMultilineEditableFigure() {
- return multilineEditableFigure;
- }
-
- «generatedClassComment»
- public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
- org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl();
- org.eclipse.draw2d.geometry.Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
- rect.x=getMultilineEditableFigure().getEditionLocation().x;
- rect.y=getMultilineEditableFigure().getEditionLocation().y;
- getMultilineEditableFigure().translateToAbsolute(rect);
- if (getMultilineEditableFigure().getText().length() > 0) {
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(text.computeSize(rect.width,
- org.eclipse.swt.SWT.DEFAULT)));
- }
- if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend
deleted file mode 100644
index 35fce1f1d72..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend
+++ /dev/null
@@ -1,389 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2014, 2021 Borland Software Corporation, Christian W. Damus, CEA LIST, Artal and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Christian W. Damus - bug 451230
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass
-import org.eclipse.emf.codegen.ecore.genmodel.GenFeature
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeLinkModelFacet
-import plugin.Activator
-import xpt.OclMigrationProblems_qvto
-import xpt.editor.VisualIDRegistry
-import xpt.providers.ElementTypes
-
-//Documentation: PapyrusGenCode
-//This tamplate has been modified in order to allow the moving command
-@Singleton class BaseItemSemanticEditPolicy extends xpt.diagram.editpolicies.BaseItemSemanticEditPolicy {
- @Inject extension Common;
- @Inject Activator xptPluginActivator;
- @Inject extension VisualIDRegistry
- @Inject ElementTypes xptElementTypes;
- @Inject extension OclMigrationProblems_qvto;
- @Inject extension xpt.diagram.editpolicies.Utils_qvto
- @Inject MetaModel xptMetaModel;
-
- override BaseItemSemanticEditPolicy(GenDiagram it) '''
-«copyright(editorGen)»
-package «packageName(it)»;
-
-«generatedClassComment()»
-public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy {
-
- «attributes(it)»
-
- «constructor(it)»
-
- «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' + 'Add the reoriented view to the request extended data so that the view\n ' + 'currently edited can be distinguished from other views of the same element\n ' +
- 'and these latter possibly removed if they become inconsistent after reconnect\n'
- )»
- @SuppressWarnings("unchecked")
- 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) {
- String id = «getVisualIDMethodCall(it)»((org.eclipse.gmf.runtime.notation.View) view);
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view);
- }
- }
- return super.getCommand(request);
- }
-
- «generatedMemberComment('Returns visual id from request parameters.')»
- protected String getVisualID(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
- return (String) request.getParameter(VISUAL_ID_KEY);
- }
-
- «semanticPart(it)»
-
- «generatedMemberComment('Returns editing domain from the host edit part.')»
- protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- return ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- }
-
- «addDestroyShortcutsCommand(it)»
-
-«IF links.exists(link|!link.sansDomain)»
- «linkConstraints(it)»
-«ENDIF»
-
- «additions(it)»
-}
-'''
-
-override def addDestroyShortcutsCommand(GenDiagram it) '''
- «generatedMemberComment('Clean all shortcuts to the host element from the same diagram')»
- protected void addDestroyShortcutsCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd, org.eclipse.gmf.runtime.notation.View view) {
- «_assert('view.getEAnnotation(\"Shortcut\") == null')»
- 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()) { «nonNLS()»
- continue;
- }
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), nextView));
- }
- }
-'''
-
- override attributes(GenDiagram it) '''
- «generatedMemberComment('Extended request data key to hold editpart visual id.')»
- public static final String VISUAL_ID_KEY = "visual_id"; «nonNLS()»
- «generatedMemberComment('Extended request data key to hold the edge view during a reconnect request.')»
- public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; «nonNLS»
- «generatedMemberComment()»
- private final org.eclipse.gmf.runtime.emf.type.core.IElementType myElementType;
- '''
-
- override semanticPart(GenDiagram it) '''
- «getSemanticCommand(it)»
-
- «addDeleteViewCommand(it)»
-
- «getEditHelperCommand(it)»
-
- «getContextElementType(it)»
-
- «getSemanticCommandSwitch(it)»
-
- «getConfigureCommand(it)»
-
- «getCreateRelationshipCommand(it)»
-
- «getCreateCommand(it)»
-
- «getCreateSemanticServiceEditCommand(it)»
-
- «getSetCommand(it)»
-
- «getEditContextCommand(it)»
-
- «getDestroyElementCommand(it)»
-
- «getDestroyReferenceCommand(it)»
-
- «getDuplicateCommand(it)»
-
- «getMoveCommand(it)»
-
- «getReorientReferenceRelationshipCommand(it)»
-
- «getReorientRelationshipCommand(it)»
-
- «getGEFWrapper(it)»
- '''
-
- override getContextElementType(GenDiagram it) '''
- «generatedMemberComment()»
- protected org.eclipse.gmf.runtime.emf.type.core.IElementType getContextElementType(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «xptElementTypes.qualifiedClassName(it)».getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
- '''
-
- override getCreateRelationshipCommand(GenDiagram it) '''
-«generatedMemberComment()»
-protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- «IF !usingElementTypeCreationCommand»
- return null;
- «ELSE»
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)getHost()).resolveSemanticElement());
- if(req.getElementType() != null) {
- commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getElementType(), req.getClientContext());
- }
-
- if(commandService == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
-
- org.eclipse.gmf.runtime.common.core.command.ICommand semanticCommand = commandService.getEditCommand(req);
-
- if((semanticCommand != null) && (semanticCommand.canExecute())) {
- return getGEFWrapper(semanticCommand);
- }
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- «ENDIF»
-}
-'''
-
- override getCreateCommand(GenDiagram it) '''
-«generatedMemberComment()»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
- if (requestElementType instanceof org.eclipse.gmf.runtime.emf.type.core.IElementType) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandProvider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if (commandProvider != null) {
- org.eclipse.gmf.runtime.common.core.command.ICommand command = commandProvider.getEditCommand(req);
- if (command != null && command.canExecute()) {
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
- }
- }
- }
- return null;
- }
-'''
-
-
- override getMoveCommand(GenDiagram it) '''
-«generatedMemberComment()»
-protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest req) {
- ««« BEGIN: PapyrusGenCode
- ««« add move command
- org.eclipse.emf.ecore.EObject targetCEObject = req.getTargetContainer();
- if(targetCEObject != null) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(targetCEObject);
- if(provider != null) {
- org.eclipse.gmf.runtime.common.core.command.ICommand moveCommand = provider.getEditCommand(req);
- if(moveCommand != null) {
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(moveCommand);
- }
- }
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- } else {
- return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand(req));
- }
- ««« END: PapyrusGenCode
-
-}
-'''
-
- /**
- * FIXME need to check constraint's provider to ensure we don't generate a field
- * for e.g. Java (or Literal, which is unlikely, though) expressions
- *
- * [Papyrus Quick Fix] Do not generate field when the expression is provided
- * by a GenJavaExpressionProvider.
- */
- override linkConstraints(GenDiagram it) '''
-
- «generatedMemberComment()»
- public static «getLinkCreationConstraintsClassName()» getLinkConstraints() {
- «getLinkCreationConstraintsClassName()» cached = «xptPluginActivator.instanceAccess(it.editorGen)».getLinkConstraints();
- if (cached == null) {
- «xptPluginActivator.instanceAccess(it.editorGen)».setLinkConstraints(cached = new «getLinkCreationConstraintsClassName()»());
- }
- return cached;
- }
-
-«generatedClassComment()»
-public static class «getLinkCreationConstraintsClassName()» {
-
- «generatedMemberComment»
- public «getLinkCreationConstraintsClassName()»() {«««package-local for the BaseItemSemanticEditPolicy to instantiate. Perhaps, protected is better (i.e. if someone subclasses it?)
- // use static method #getLinkConstraints() to access instance
- }
-
- «FOR nextLink : it.links»
- «canCreate(nextLink)»
- «ENDFOR»
-
- «FOR nextLink : it.links»
- «canExist(nextLink)»
- «ENDFOR»
-}
-'''
-
- /**
- * [MG] extracted from LET statement, @see checkEMFConstraints(TypeLinkModelFacet)
- */
- private def checkChildFeatureBounds(TypeLinkModelFacet it) {
- childMetaFeature != containmentMetaFeature && !isUnbounded(childMetaFeature.ecoreFeature)
- }
-
- def checkEMFConstraints(TypeLinkModelFacet it) '''
-«IF containmentMetaFeature.ecoreFeature != null»
- «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || checkChildFeatureBounds(it)»
- if («getContainerVariable(it)» != null) {
- «checkEMFConstraints(containmentMetaFeature, it)»
- «IF checkChildFeatureBounds(it)»
- «checkEMFConstraints(childMetaFeature, it)»
- «ENDIF»
- }
- «ENDIF»
-«ENDIF»
-'''
-
- override checkEMFConstraints(GenFeature it, TypeLinkModelFacet modelFacet) '''
-«IF modelFacet.containmentMetaFeature.ecoreFeature != null»
-«IF ! isUnbounded(ecoreFeature)»
-if («featureBoundComparator(it, getContainerVariable(modelFacet), modelFacet.getSourceType())») {
- return false;
-}
-«ENDIF»
-«ENDIF»
-'''
-
- override canCreate(GenLink it) '''
-«generatedMemberComment()»
-public boolean canCreate«stringUniqueIdentifier()»(
-«IF !it.sansDomain»
-«canCreateParameters(it.modelFacet)»
-«ENDIF»
-) {
- «IF !it.sansDomain»
- «checkEMFConstraints(it.modelFacet)»
- «ENDIF»
- return canExist«stringUniqueIdentifier()»(
- «IF !it.sansDomain»
- «canCreateValues(it.modelFacet)»
- «ENDIF»
- );
-}
-'''
-
- override featureBoundsConditionClause(GenFeature it, String targetVar, GenClass targetType) '''
-«««Checking upper bounds if was specified in MM
-«IF ecoreFeature != null»
- «IF ! isUnbounded(ecoreFeature)»«featureBoundComparator(it, targetVar, targetType)»«ENDIF»
- ««« Checking uniqueness in addition if upper bounds != 1
- «IF ! isSingleValued(ecoreFeature) && ! isUnbounded(ecoreFeature)» || «ENDIF»
- ««« Checking uniqueness in if upper bounds !- 1
- «IF ! isSingleValued(ecoreFeature)»«featureUniquenessComparator(it, targetVar, targetType)»«ENDIF»
-«ENDIF»
-'''
-
- override featureBoundComparator(GenFeature it, String featureVar, GenClass featureVarGenClass) '''
- «xptMetaModel.getFeatureValue(it, featureVar, featureVarGenClass)»
- «IF ecoreFeature.upperBound == 1»
- != null
- «ELSE»
- .size() >= «ecoreFeature.upperBound»
- «ENDIF»
- '''
-
- // Generate generic method if using semantic creation command based on element types framework.
- def getCreateSemanticServiceEditCommand(GenDiagram it) '''
-«IF usingElementTypeCreationCommand»
- «generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getSemanticCreationCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if(commandService == null) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- return commandService.getEditCommand(req);
- }
-«ENDIF»
-'''
-
- /**
- * XXX for now, both constraints are injected into single method
- * which may not 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.
-*/
- override canExist(GenLink it) '''
- «generatedMemberComment()»
- public boolean canExist«stringUniqueIdentifier()»(
- «IF !it.sansDomain»
- «canExistParameters(it.modelFacet)»
- «ENDIF»
- ) {
- «IF creationConstraints != null && creationConstraints.isValid() && it.diagram.editorGen.expressionProviders != null»
- try {
- «IF creationConstraints.sourceEnd != null»
- «checkAdditionalConstraint(creationConstraints.sourceEnd.provider, creationConstraints.sourceEnd, 'source', 'target', creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass())»
- «ENDIF»
- «IF creationConstraints.targetEnd != null»
- «checkAdditionalConstraint(creationConstraints.targetEnd.provider, creationConstraints.targetEnd, 'target', 'source', creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass())»
- «ENDIF»
- return true;
- } catch(Exception e) {
- «xptPluginActivator.instanceAccess(it.diagram.editorGen)».logError("Link constraint evaluation error", e); «nonNLS()»
- return false;
- }
- «ELSE»
- return true;
- «ENDIF»
- }
- '''
-
- override def getGEFWrapper(GenDiagram it) '''
- «generatedMemberComment()»
- protected final org.eclipse.gef.commands.Command getGEFWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) {
- return (cmd == null) ? org.eclipse.gef.commands.UnexecutableCommand.INSTANCE : new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(cmd);
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend
deleted file mode 100644
index 87b6cdf9ce3..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend
+++ /dev/null
@@ -1,121 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.emf.common.util.EList
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeModelFacet
-import xpt.Common
-import xpt.diagram.editpolicies.childContainerCreateCommand
-
-@Singleton class CompartmentItemSemanticEditPolicy extends xpt.diagram.editpolicies.CompartmentItemSemanticEditPolicy {
- @Inject extension Common;
- @Inject extension MetaModel
-
- @Inject childContainerCreateCommand xptChildContainerCreateCommand;
- @Inject BaseItemSemanticEditPolicy xptBaseItemSemanticEditPolicy;
-
-
- override CompartmentItemSemanticEditPolicy(GenCompartment it) '''
- «copyright(getDiagram().editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment()»
- public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» {
-
- «_constructor(it)»
-
- «xptChildContainerCreateCommand.childContainerCreateCommand( it.childNodes)»
-
- «additions(it)»
- }
- '''
-
-def getChildNodeReference (EList<GenChildNode> it) '''
- «IF !(it.isEmpty)»
- «generatedMemberComment»
- private static Set<EReference> compartmentReferences;
-
- «generatedMemberComment»
- static {
- ««« compartmentReferences = new HashSet<EReference>(«it.modelFacet->size()»);
- compartmentReferences = new HashSet<EReference>();
-
- «FOR n : it»
- «childRef(n.modelFacet,n)»
- «ENDFOR»
- }
- «generatedMemberComment»
- protected Iterable<EReference> getCompartmentReferences() {
- return compartmentReferences;
- }
-«ENDIF»
-
-'''
-
-def childRef(TypeModelFacet it ,GenNode node) '''
- compartmentReferences.add(«MetaFeature (node.modelFacet.containmentMetaFeature)»);
-'''
-
-
-def isCorrectCompartment (GenCompartment it)'''
- «generatedMemberComment»
- protected boolean isMovedIntoCorrectCompartment(MoveRequest req){
- for(Object entry : req.getElementsToMove().entrySet()) {
- if(entry instanceof Map.Entry<?, ?>) {
- Map.Entry<?, ?> mapEntry = (Map.Entry<?, ?>)entry;
- Object key = mapEntry.getKey();
- if(key instanceof EObject) {
- EObject dropppedObject = (EObject)key;
- EObject semanticHost = ((IGraphicalEditPart)getHost()).resolveSemanticElement();
- boolean foundERefrences = false;
- if(semanticHost != null) {
- for(EReference ref : getCompartmentReferences()) {
- if(ref.isContainment()) {
- foundERefrences = PackageUtil.canContain(semanticHost.eClass(), ref, dropppedObject.eClass(), false);
- } else {
- foundERefrences = PackageUtil.canReference(semanticHost.eClass(), ref, dropppedObject.eClass());
- }
- if(foundERefrences) {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
-'''
-
-def constraintedMoveCommand (GenCompartment it)'''
- «generatedMemberComment»
- @Override
- protected Command getMoveCommand(MoveRequest req) {
- if (isMovedIntoCorrectCompartment(req)){
- return super.getMoveCommand(req);
- } else {
- return UnexecutableCommand.INSTANCE;
- }
- }
-'''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xtend
deleted file mode 100644
index b41e386fe49..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xtend
+++ /dev/null
@@ -1,23 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Singleton
-
-@Singleton class DiagramItemSemanticEditPolicy extends xpt.diagram.editpolicies.DiagramItemSemanticEditPolicy {
-
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend
deleted file mode 100644
index efc74115f2c..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend
+++ /dev/null
@@ -1,57 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007-2012, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * - #386838 - migrate to Xtend2
- * Vincent Lorenzo (CEA-LIST)
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import impl.diagram.commands.DeleteLinkCommand
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeLinkModelFacet
-import utils.UtilsItemSemanticEditPolicy
-import xpt.Common
-
-@Singleton class LinkItemSemanticEditPolicy extends xpt.diagram.editpolicies.LinkItemSemanticEditPolicy {
- @Inject extension Common;
- @Inject extension DeleteLinkCommand
- @Inject extension UtilsItemSemanticEditPolicy
-
- override dispatch getDestroySemanticCommand(TypeLinkModelFacet it, GenLink genLink) '''
- ««« Test to know which delete command should be used in the generated code : "Traditional Delete Command" or the Delete Service
-
- «IF genLink.usingDeleteService»
-
- «generatedMemberComment»
- «getDestroyElementCommandByService(it)»
- «ELSE»
- «generatedMemberComment»
- protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
- java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy )));
- return getGEFWrapper(cmd.reduce());
- //return getGEFWrapper(«newDeleteLinkWithClassCommand(it,genLink, 'req')»);
- }
- «ENDIF»
- '''
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend
deleted file mode 100644
index 51164126f8e..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend
+++ /dev/null
@@ -1,256 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257632] do not rely on EditPart presence for element deletion
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import java.util.List
-import org.eclipse.papyrus.gmf.codegen.gmfgen.FeatureLinkModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeLinkModelFacet
-import utils.UtilsItemSemanticEditPolicy
-import xpt.Common
-import xpt.diagram.editpolicies.childContainerCreateCommand
-import xpt.editor.VisualIDRegistry
-
-/**
- * This template should be called only for non-design nodes (modelFacet != null)
- * because *ItemSemanticEditPolicy responsible for dealing with semantic model
- * elements and meaningless (should not be generated) for pure design nodes.
- */
-@Singleton class NodeItemSemanticEditPolicy extends xpt.diagram.editpolicies.NodeItemSemanticEditPolicy {
-
- @Inject extension Common;
- @Inject extension xpt.diagram.editpolicies.Utils_qvto;
- @Inject extension UtilsItemSemanticEditPolicy
-
-
- @Inject BaseItemSemanticEditPolicy xptBaseItemSemanticEditPolicy;
- @Inject childContainerCreateCommand xptChildContainerCreateCommand;
- @Inject linkCommands xptLinkCommands;
- @Inject VisualIDRegistry xptVisualIDRegistry;
-
-
-
- override NodeItemSemanticEditPolicy(GenNode it) '''
- «copyright(getDiagram().editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment()»
- public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» {
-
- «xptBaseItemSemanticEditPolicy.defaultConstructor(it)»
-
- «xptChildContainerCreateCommand.childContainerCreateCommand(it.childNodes)»
-
- ««« Papyrus REM :
- ««« Test to know how the delete of this EditPart is done : we used the DeleteService or the "Traditional method"
-
- «IF usingDeleteService»
- «generatedMemberComment»
- «getDestroyElementCommandByService(it)»
- «ELSE»
- «getDestroyElementCommand(it)»
- «IF hasChildrenOrCompartments(it)»
- «addDestroyChildNodesCommand(it)»
- «ENDIF»
- «ENDIF»
-
- «xptLinkCommands.linkCommands(it)»
-
- «additions(it)»
- }
- '''
-
- override getDestroyElementCommand(GenNode it) '''
- «generatedMemberComment()»
-protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
- ««« «destroyEdges('view')»
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut");«nonNLS»
- if (annotation == null) {
- // there are indirectly referenced children, need extra commands: «it.childNodes.union(compartments.map(c | c.childNodes).flatten).exists[GenChildNode gcn | !isDirectlyOwned(gcn, it)]»
- «IF hasChildrenOrCompartments(it)»
- addDestroyChildNodesCommand(cmd);
- «ENDIF»
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy )));
- } else {«««Here, we may play smart and don't generate else for non-toplevel nodes(which can't be shortcuts). Is it worth doing?
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
-}
- '''
-
- override addDestroyChildNodesCommand(GenNode it) '''
- «generatedMemberComment()»
- protected void addDestroyChildNodesCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- for (java.util.Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
- org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) nit.next();
- String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(node);
- if (vid != null) {
- switch (vid) {
- «FOR cn : it.childNodes»
- «destroyChildNodes(cn, 'node', it)»
- «ENDFOR»
- «FOR compartment : it.compartments»
- «xptVisualIDRegistry.caseVisualID(compartment)»
- for (java.util.Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- org.eclipse.gmf.runtime.notation.Node cnode = (org.eclipse.gmf.runtime.notation.Node) cit.next();
- String cvid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(cnode);
- if (cvid != null) {
- switch (cvid) {
- «FOR cn : compartment.childNodes»
- «destroyChildNodes(cn, 'cnode', it)»
- «ENDFOR»
- }
- }
- }
- break;
- «ENDFOR»
- }
- }
- }
- }
- '''
-
-
- /**
- * @param view - Notation element for the passed node
- * assumes 'cmd' to point to composite command
- */
- override destroyEdges(GenNode it, String view) '''
-
-««« XXX: Though semantic editpolicy is supposed to create commands that operate with semantic elements only,
-««« old code used to delegate child/link deletion to respective editparts, which in turn led to semantic commands
-««« being combined with notational commands (BaseItemSemanticEditPolicy#addDeleteViewCommand()).
-««« ---
-««« Use DiagramUpdater.get[Incoming|Outgoing]View instead, to clean links that are not present on a diagram
-««« (but don't forget to clean corresponding Edge, if any)
-
-
-«««// This part is commented for Papyrus
-«««// Some Papyrus diagrams with lots of elements are reaching the 65K Java limit for method size.
-«««// The following change is not supposed to modify the method behavior, just propose a slight more
-«««// compact code to avoid size limit.
-«««
-««««IF genIncomingLinks->notEmpty()-»
-««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getTargetEdges().iterator(); it.hasNext();) {
-««« org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
-««««FOREACH genIncomingLinks AS il-»
-««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(incomingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il») {
-««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'incomingLink') FOR il-»
-««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR il»);
-««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
-««« continue;
-««« }
-««««ENDFOREACH-»
-««« }
-««««ENDIF-»
-««««IF genOutgoingLinks->notEmpty()-»
-««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getSourceEdges().iterator(); it.hasNext();) {
-««« org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
-««««FOREACH genOutgoingLinks AS ol-»
-««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(outgoingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol») {
-««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'outgoingLink') FOR ol-»
-««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR ol»);
-««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
-««« continue;
-««« }
-««««ENDFOREACH-»
-««« }
-««««ENDIF-»
-
-
-«IF !genIncomingLinks.isEmpty()»
- for (java.util.Iterator<?> it = «view».getTargetEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(incomingLink);
- if (vid != null) {
- switch(vid) {
-«IF !genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty»
-«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]»
- case «VisualIDRegistry.visualID(il)»:
-«ENDFOR»
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
-«ENDIF»
-«IF !genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty»
-«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]»
- case «VisualIDRegistry.visualID(il)»:
-«ENDFOR»
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
-«ENDIF»
- }
- }
- }
-«ENDIF»
-
-«IF genOutgoingLinks.isEmpty()»
- for (java.util.Iterator<?> it = «view».getSourceEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(outgoingLink);
- if (vid != null) {
- switch(vid) {
-«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty»
-«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]»
- case «VisualIDRegistry.visualID(ol)»:
-«ENDFOR»
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(outgoingLink.getSource().getElement(), null, outgoingLink.getTarget().getElement(), false);
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
- break;
-«ENDIF»
-«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty»
-«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]»
- case «VisualIDRegistry.visualID(ol)»:
-«ENDFOR»
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
- break;
-«ENDIF»
- }
- }
- }
-«ENDIF»
- '''
-
-
-
- private def static <T> Iterable<T> union(Iterable<? extends T> listA, Iterable<? extends T> listB) {
- var List<T> result = newLinkedList();
- result.addAll(listA);
- result.addAll(listB);
- return result;
- }
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend
deleted file mode 100644
index 438dd9ddc2b..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend
+++ /dev/null
@@ -1,80 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.OpenDiagramBehaviour
-import xpt.Common
-import xpt.editor.DiagramEditorUtil
-
-@Singleton class OpenDiagram extends xpt.diagram.editpolicies.OpenDiagram {
- @Inject extension Common;
-
-
- @Inject DiagramEditorUtil xptDiagramEditorUtil;
-
-
-
- override openCommandClass_intializeNewDiagram(OpenDiagramBehaviour it) '''
- «generatedMemberComment»
- protected org.eclipse.gmf.runtime.notation.Diagram intializeNewDiagram() throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.gmf.runtime.notation.Diagram d = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint());
- if (d == null) {
- throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind");
- }
- diagramFacet.setDiagramLink(d);
- «_assert('diagramFacet.eResource() != null')»
- diagramFacet.eResource().getContents().add(d);
- org.eclipse.emf.ecore.EObject container = diagramFacet.eContainer();
- while (container instanceof org.eclipse.gmf.runtime.notation.View) {
- ((org.eclipse.gmf.runtime.notation.View) container).persist();
- container = container.eContainer();
- }
- try {
- «IF null == subject.diagram.editorGen.application»
- new org.eclipse.ui.actions.WorkspaceModifyOperation() {
- protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, java.lang.reflect.InvocationTargetException, InterruptedException {
- try {
- «ENDIF»
- for (java.util.Iterator<?> it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) {
- nextResource.save(«xptDiagramEditorUtil.qualifiedClassName(subject.diagram)».getSaveOptions());
- }
- }
- «IF null == subject.diagram.editorGen.application»
- } catch (java.io.IOException ex) {
- throw new java.lang.reflect.InvocationTargetException(ex, "Save operation failed");
- }
- }
- }.run(null);
- } catch (java.lang.reflect.InvocationTargetException e) {
- throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
- } catch (InterruptedException e) {
- throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
- }
- «ELSE»
- } catch (java.io.IOException ex) {
- throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", ex);
- }
- «ENDIF»
- return d;
- }
- '''
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend
deleted file mode 100644
index 4318a9e5fd8..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and other.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Common
-
-/**
- * FIXME: [MG] - reverse the calls? call common code from here and TextelectionEP and not vice versa
-*/
-@Singleton class TextNonResizableEditPolicy extends xpt.diagram.editpolicies.TextNonResizableEditPolicy {
-
- @Inject extension Common;
-
- override TextNonResizableEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy'''
-
- override def TextNonResizableEditPolicy_createSelectionHandles(GenDiagram it) '''
- «generatedMemberComment»
- protected java.util.List<?> createSelectionHandles() {
- org.eclipse.gef.handles.MoveHandle moveHandle =
- new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
- moveHandle.setBorder(null);
- moveHandle.setDragTracker(new org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx(getHost()));
- return java.util.Collections.singletonList(moveHandle);
- }
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend
deleted file mode 100644
index d3b92960cf7..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and other.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import com.google.inject.Inject
-import xpt.Common
-import com.google.inject.Singleton
-import xpt.CodeStyle
-
-@Singleton class TextSelectionEditPolicy extends xpt.diagram.editpolicies.TextSelectionEditPolicy {
-
- @Inject extension Common
- @Inject extension CodeStyle
-
- // rebranch to the tooling runtime in the release train.
- override TextSelectionEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy'''
-
- override textFeedback_createFocusFeedbackFigure(GenDiagram it) '''
- «generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFocusFeedbackFigure() {
- return new org.eclipse.draw2d.Figure() {
-
- «overrideC»
- protected void paintFigure(org.eclipse.draw2d.Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
- '''
-
- override textFeedback_getHostPositionListener(GenDiagram it) '''
- «generatedMemberComment»
- private org.eclipse.draw2d.FigureListener getHostPositionListener() {
- if (hostPositionListener == null) {
- hostPositionListener = new org.eclipse.draw2d.FigureListener() {
- «overrideI»
- public void figureMoved(org.eclipse.draw2d.IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/Utils_qvto.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/Utils_qvto.xtend
deleted file mode 100644
index 041724da9bd..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/Utils_qvto.xtend
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007-2013 Borland Software Corporation && others
- *
- * All rights reserved. This program && the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, && is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API && implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkEnd
-
-@Singleton class Utils_qvto extends xpt.diagram.editpolicies.Utils_qvto {
-
-def Boolean containsCreateStartLinkCommand(GenLinkEnd it){
- for (l : getAllPotentialLinks(it)){
- if(createStartLinkCommand(l, it)){
- return true;
- }
- }
-
- return false;
-}
-
-def Boolean containsCreateCompleteLinkCommand(GenLinkEnd it){
- for (l : getAllPotentialLinks(it)){
- if(createCompleteLinkCommand(l, it)){
- return true;
- }
- }
-
- return false;
-}
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend
deleted file mode 100644
index 1035d8553bd..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend
+++ /dev/null
@@ -1,75 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeModelFacet
-import xpt.Common
-import xpt.providers.ElementTypes
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-@Singleton class childContainerCreateCommand extends xpt.diagram.editpolicies.childContainerCreateCommand{
-
- @Inject extension Common;
-
- @Inject extension ElementTypes;
-
- @Inject extension MetaModel;
-
-
- override CharSequence childContainerCreateCommand(Iterable<? extends GenNode> nodes) '''
- «IF ! nodes.empty»
-
- «generatedMemberComment()»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- «FOR n : nodes»
- «IF !n.sansDomain»
- «childNodeCreateCommand(n.modelFacet, n)»
- «ENDIF»
- «ENDFOR»
- return super.getCreateCommand(req);
- }
- «ENDIF»
- '''
-
- def childNodeCreateCommand(TypeModelFacet it,GenNode node)'''
- if («accessElementType(node)» == requestElementType) {
- «IF it.eResource.allContents.filter(typeof (GenDiagram)).filter[genDiagram | genDiagram.usingElementTypeCreationCommand].size>0»
- // adjust the containment feature
- org.eclipse.emf.ecore.EReference containmentFeature = «MetaFeature(it.childMetaFeature)»;
- req.setContainmentFeature(containmentFeature);
- «ENDIF»
-
- «IF it.eResource.allContents.filter(typeof (GenDiagram)).filter[genDiagram | genDiagram.usingElementTypeCreationCommand].size>0»
- return getGEFWrapper(getSemanticCreationCommand(req));
- «ELSE»
- return getGEFWrapper(new «node.getCreateCommandQualifiedClassName()»(req, org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getDiagramFrom(getHost())));
- «ENDIF»
-
- }
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend
deleted file mode 100644
index 3893c79418f..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend
+++ /dev/null
@@ -1,195 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Dmitry Stadnik (Borland) - creation logic was moved in commands
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * - #386838 - migrate to Xtend2
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.diagram.editpolicies
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkEnd
-import xpt.Common
-import xpt.diagram.commands.CreateLinkCommand
-import xpt.editor.VisualIDRegistry
-import xpt.providers.ElementTypes
-
-/**
- * Start start of link creation.
- * User click to this editpart and start dragging with link tool.
- * Complete end of the command
- * User points to this editpart as a link target and release mouse button.
- *
- * Outgoing the node is link source
- * This element could be a source for this type of link.
- * Incoming the node is link destination
- * This element could be a target for this type of link.
- *
- * Parameters:
- *
- * diagram GenDiagram used to collect all defined links
- *
- * this Instance of GenLinkEnd for the element link could be creates to/from.
- * This could be GenNode or GenLink in case of links to links,
- * in the latter case it is assumed that its a TypeLink (so its model facet is LinkTypeModelFacet),
- * because RefLinks don't have underlying semantic identity
- *
-*/
-@Singleton class linkCommands extends xpt.diagram.editpolicies.linkCommands {
- @Inject extension xpt.diagram.editpolicies.Utils_qvto;
- @Inject extension Common;
-
- @Inject VisualIDRegistry xptVisualIDRegistry;
- @Inject ElementTypes xptElementTypes;
- @Inject CreateLinkCommand xptCreateLinkCommand;
-
- override createLinkCommands(GenLinkEnd it) '''
-
- «IF it.eResource.allContents.filter(typeof (GenDiagram)).filter[genDiagram | genDiagram.usingElementTypeCreationCommand].size<1»
-
- «generatedMemberComment()»
- protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- org.eclipse.gef.commands.Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
- «ENDIF»
-
- «generatedMemberComment()»
- protected org.eclipse.gef.commands.Command getStartCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType;
-
- «FOR l : getAllPotentialLinks(it)»
- «startLinkCommands(l, it)»
- «ENDFOR»
- return null;
- }
-
- «generatedMemberComment()»
- protected org.eclipse.gef.commands.Command getCompleteCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType;
-
- «FOR l : getAllPotentialLinks(it)»
- «completeLinkCommands(l, it)»
- «ENDFOR»
- return null;
- }
- '''
-
- override startLinkCommands(GenLink it, GenLinkEnd linkEnd) '''
- if («xptElementTypes.accessElementType(it)» == baseElementType) {
- «IF createStartLinkCommand(it, linkEnd)»
-
- return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req,
- «IF createStartIncomingLinkCommand(it, linkEnd)»
- req.getTarget(), req.getSource()
- «ELSE»
- req.getSource(), req.getTarget()
- «ENDIF»
- ));
- «ELSE»
- return null;
- «ENDIF»
- '''
-
- override completeLinkCommands(GenLink it, GenLinkEnd linkEnd) '''
- if («xptElementTypes.accessElementType(it)» == baseElementType) {
- «IF createCompleteLinkCommand(it, linkEnd)»
-
- return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req,
- «IF createCompleteOutgoingLinkCommand(it, linkEnd)»
- req.getTarget(), req.getSource()
- «ELSE»
- req.getSource(), req.getTarget()
- «ENDIF»
- ));
- «ELSE»
- return null;
- «ENDIF»
- '''
-
-
- // We overwrite the reorientTypeLinkCommands to manages the links which use the ReorientCommand provided by the EditService
- override reorientTypeLinkCommands(GenLinkEnd it) '''
- «generatedMemberComment(
- 'Returns command to reorient EClass based link. New link target or source\n' + 'should be the domain model element associated with this node.\n'
- )»
- protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
- String vid = getVisualID(req);
- if (vid != null) {
- switch (vid) {
- «FOR link : getReroutableTypeLinks(it)»
- «reorientLinkCommandWithService(link) »
- «ENDFOR»
- «callReorientCommand(it)»
- «FOR link : getReroutableTypeLinks(it)»
- «reorientLinkCommandWithoutService(link) »
- «ENDFOR»
- }
- }
- return super.getReorientRelationshipCommand(req);
- }
- '''
-
- //This function writes only : "case myLinkEditPart.VISUAL_ID:"
- //for the link which uses the ReorientCommand provided by the EditService
- def reorientLinkCommandWithService(GenLink it) '''
- «IF usingReorientService»
- «xptVisualIDRegistry.caseVisualID(it)»
- «ENDIF»
- '''
-
- // This function writes the code to call the ReorientCommand provided by the ReorientService
- def callReorientCommand(GenLinkEnd it) '''
- «var views = getReroutableTypeLinks(it)»
- «IF views !== null && !views.empty»
- «IF !views.filter[view| view.usingReorientService].empty»
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if(provider == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- org.eclipse.gmf.runtime.common.core.command.ICommand reorientCommand = provider.getEditCommand(req);
- if(reorientCommand == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- «ENDIF»
- «ENDIF»
- '''
-
- // This function writes the code for the Links which uses their own ReorientCommand (the initial code)
- def reorientLinkCommandWithoutService(GenLink it) '''
- «IF !usingReorientService»
- «reorientLinkCommand(it)»
- «ENDIF»
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/PreferenceInitializer.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/PreferenceInitializer.xtend
deleted file mode 100644
index cf20e7fb93d..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/PreferenceInitializer.xtend
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Patrick Tessier (CEA LIST)
- *
- *****************************************************************************/
-package aspects.xpt.diagram.preferences
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import plugin.Activator
-import xpt.Common
-
-@Singleton class PreferenceInitializer extends xpt.diagram.preferences.PreferenceInitializer {
- @Inject extension Common;
-
- @Inject Activator xptActivator;
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend
deleted file mode 100644
index e93478157c0..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend
+++ /dev/null
@@ -1,73 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Thibault Landre (Atos Origin) - initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.diagram.preferences
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenStandardPreferencePage
-import org.eclipse.papyrus.gmf.codegen.gmfgen.StandardPreferencePages
-import utils.PrefsConstant_qvto
-import xpt.Common
-import xpt.diagram.Utils_qvto
-
-@Singleton class extensions extends xpt.diagram.preferences.extensions {
- @Inject extension Common;
- @Inject extension Utils_qvto;
- @Inject extension PrefsConstant_qvto;
-
- @Inject xpt.diagram.preferences.PreferenceInitializer xptPreferenceInitializer;
-
- override extensions(GenDiagram it) '''
-
- «tripleSpace(1)»<extension point="org.eclipse.core.runtime.preferences" id="prefs">
- «tripleSpace(2)»«xmlGeneratedTag»
- «tripleSpace(2)»<initializer class="«xptPreferenceInitializer.qualifiedClassName(it)»"/>
- «tripleSpace(1)»</extension>
-
- «IF ! it.preferencePages.empty»
- «tripleSpace(1)»<extension point="org.eclipse.ui.preferencePages" id="prefpages">
- «tripleSpace(2)»«xmlGeneratedTag»
- «FOR pref : allPreferencePages(it)»
- «IF pref instanceof GenStandardPreferencePage»
- «papyrusPreferencePage(pref as GenStandardPreferencePage)»
- «ENDIF»
- «ENDFOR»
- «tripleSpace(1)»</extension>
- «ENDIF»
- '''
-
- def papyrusPreferencePage(GenStandardPreferencePage it) '''
- «IF StandardPreferencePages.GENERAL_LITERAL == kind»
- <page
- id="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»"
- name="«getDiagram().editorGen.modelID» Diagram"
- category="«getDiagramPreferencePageCategory()»"
- class="«getQualifiedClassName()»">
- </page>
- «ELSEIF StandardPreferencePages.PRINTING_LITERAL == kind ||
- StandardPreferencePages.RULERS_AND_GRID_LITERAL == kind»
- <page
- id="«getQualifiedClassName()»"
- name="%prefpage.«ID»"
- category="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»"
- class="«getQualifiedClassName()»">
- </page>
- «ENDIF»
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend
deleted file mode 100644
index 585dfa42c49..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend
+++ /dev/null
@@ -1,357 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2014, 2021 Borland Software Corporation, CEA, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2
- * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.diagram.updater
-
-import aspects.xpt.Common
-import aspects.xpt.editor.VisualIDRegistry
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.FeatureLinkModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenContainerBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagramUpdater
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeLinkModelFacet
-import xpt.Common_qvto
-import xpt.GenModelUtils_qvto
-import xpt.diagram.updater.UpdaterLinkType
-import xpt.diagram.updater.Utils_qvto
-import java.util.Set
-import org.eclipse.emf.codegen.ecore.genmodel.GenFeature
-
-// we removed all static modifiers and all private methods becames protected to allow to override method.
-//see bug421212: [Diagram] Papyrus should provide actions for Show/Hide related links in all diagrams
-@Singleton class DiagramUpdater extends xpt.diagram.updater.DiagramUpdater {
- @Inject extension Common;
- @Inject extension Common_qvto;
- @Inject extension Utils_qvto;
- @Inject extension GenModelUtils_qvto;
- @Inject xpt.diagram.updater.LinkDescriptor linkDescriptor;
- @Inject VisualIDRegistry xptVisualIDRegistry;
- @Inject xpt.diagram.updater.NodeDescriptor nodeDescriptor;
-
- @Inject MetaModel xptMetaModel;
-
- def diagramUpdaterInstanceToUse(GenDiagramUpdater it) '''
- «IF customDiagramUpdaterSingletonPath !== null»
- «customDiagramUpdaterSingletonPath»
- «ELSE»
- «diagramUpdaterQualifiedClassName».INSTANCE
- «ENDIF»
- '''
-
- protected def typeOfCrossReferenceAdapter() '''org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter'''
-
- override getSemanticChildrenMethodCall(GenContainerBase it) '''«diagramUpdaterInstanceToUse(it.diagramUpdater)».«getSemanticChildrenMethodName(
- it)»'''
-
- override doGetSomeLinksMethodCall(GenCommonBase it, UpdaterLinkType linkType) '''«diagramUpdaterInstanceToUse(
- it.getDiagram().diagramUpdater)».«linkGetterName(linkType)»'''
-
- // override runtimeTypedInstanceName(GenDiagramUpdater it) '''INSTANCE'''
- //
- // override runtimeTypedInstanceCall(GenDiagramUpdater it) '''«qualifiedClassName(it)».«runtimeTypedInstanceName(it)»'''
- //protected constructor to allow overriding
- def _constructor(GenDiagramUpdater it) '''
- «generatedMemberComment()»
- protected «diagramUpdaterClassName»(){
- //to prevent instantiation allowing the override
- }
- '''
-
- //create the singleton using custom class defined in GMFGen
- public def classSingleton(GenDiagramUpdater it) '''
- «««we create the singleton only in the case where there is no custom diagram updater
- «IF customDiagramUpdaterSingletonPath === null»
- «generatedMemberComment()»
- public static final «diagramUpdaterQualifiedClassName» INSTANCE = new «diagramUpdaterClassName»();
- «ENDIF»
- '''
-
- override DiagramUpdater(GenDiagramUpdater it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» implements org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater {
- «classSingleton(it)»
- «_constructor(it)»
- «isShortcutOrphaned(it)»
- «var semanticContainers = it.editorGen.diagram.allContainers.filter[container|hasSemanticChildren(container)]»
- «getGenericSemanticChildrenOfView(it, semanticContainers)»
- «FOR next : semanticContainers»
- «getSemanticChildrenOfView(next)»
- «ENDFOR»
-
- «getPhantomNodesIterator(it)»
-
- «getGenericConnectedLinks(it, getAllSemanticElements(editorGen.diagram), UpdaterLinkType::CONTAINED)»
-
- «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::INCOMING)»
-
- «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::OUTGOING)»
- «FOR e : getAllSemanticElements(editorGen.diagram)»
- «getContainedLinks(e)»
- «ENDFOR»
- «FOR e : getAllSemanticDiagramElements(editorGen.diagram)»
- «getIncomingLinks(e)»
- «ENDFOR»
- «FOR e : getAllSemanticDiagramElements(editorGen.diagram)»
- «getOutgoingLinks(e)»
- «ENDFOR»
- «FOR link : getAllContainedLinks(editorGen.diagram)»
- «getContainedLinksByTypeMethod(link)»
- «ENDFOR»
- «FOR link : getAllIncomingLinks(editorGen.diagram)»
- «getIncomingLinksByTypeMethod(link)»
- «ENDFOR»
- «FOR link : getAllOutgoingLinks(editorGen.diagram)»
- «getOutgoingLinksByTypeMethod(link)»
- «ENDFOR»
-
- «runtimeTypedInstance(it)»
-
- «additions(it)»
- }
- '''
-
- override def getConnectedLinks(GenCommonBase it, Iterable<GenLink> genLinks, UpdaterLinkType linkType,
- boolean needCrossReferencer) '''
-
- «generatedMemberComment»
- «««remove static modifier
- public «listOfLinkDescriptors(it)» «linkGetterName(it, linkType)»(org.eclipse.gmf.runtime.notation.View view) {
- «IF genLinks.notEmpty»
- «xptMetaModel.DeclareAndAssign(it.metaClass, 'modelElement', 'view.getElement()')»
- «IF needCrossReferencer»
- «typeOfCrossReferenceAdapter» crossReferencer = «typeOfCrossReferenceAdapter».getCrossReferenceAdapter(view.eResource().getResourceSet());
- «ENDIF»
- «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»();
- «FOR link : genLinks»
- «colectConnectedLinks(link, linkType, needCrossReferencer, isExternalInterface(it.metaClass))»
- «ENDFOR»
- return result;
- «ELSE»
- return «newEmptyList()»;
- «ENDIF»
- }
- '''
-
- override def colectConnectedLinks(GenLink it, UpdaterLinkType linkType, boolean needCrossReferencer,
- boolean isExternalInterface) '''
- «IF it.modelFacet != null»
- «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»
- if («xptMetaModel.IsInstance(it.modelFacet.getLinkEndType(linkType), 'modelElement')») {
- «ENDIF»
- result.addAll(«chooseConnectedLinksByTypeMethodName(it.modelFacet, linkType, it)»(« //
- IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»«xptMetaModel.
- CastEObject(it.modelFacet.getLinkEndType(linkType), 'modelElement')»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferencer«ENDIF»));
- «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»
- }
- «ENDIF»
- «ENDIF»
- '''
-
- override def getIncomingLinksByTypeMethod(GenLink it) '''
- «generatedMemberComment»
- «««remove static modifier + private->protected
- protected java.util.Collection<«linkDescriptor.qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(
- UpdaterLinkType::INCOMING)»(«xptMetaModel.QualifiedClassName(it.modelFacet.targetType)» target, «typeOfCrossReferenceAdapter» crossReferencer) {
- «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»();
- java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
- for (org.eclipse.emf.ecore.EStructuralFeature.Setting setting : settings) {
- «getIncomingLinksByTypeMethodBody(it.modelFacet, it)»
- }
- return result;
- }
- '''
-
- def CharSequence getICustomDiagramUpdater(GenContainerBase it) '''org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater<«nodeDescriptor.
- qualifiedClassName(it.diagramUpdater)»>'''
-
- override getSemanticChildrenOfView(GenContainerBase it) '''
- «««remove static modifier
- «IF specificDiagramUpdaterClassName !== null»
- «generatedMemberComment»
- public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
- «getICustomDiagramUpdater(it)» customUpdater = new «specificDiagramUpdaterClassName»();
- return customUpdater.getSemanticChildren(view);
- }
- «ELSE»
- «generatedMemberComment»
- public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
- «IF getSemanticChildrenChildFeatures(it).notEmpty || it.getPhantomNodes().notEmpty»
- «defineModelElement(it)»
- «newLinkedListOfNodeDescriptors(it.diagramUpdater, 'result')»();
- «/* childMetaFeature can be null here! */FOR childMetaFeature : getSemanticChildrenChildFeatures(it)»
- «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 childMetaFeature.listType»
- for (java.util.Iterator<?> it = «xptMetaModel.getFeatureValue(childMetaFeature, 'modelElement', it.getModelElementType())».iterator(); it.hasNext();) {
- «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'it.next()', true)»
- «ELSE»
- { «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'modelElement',
- it.getModelElementType(), childMetaFeature)»
- «ENDIF»
- String visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it.diagram)»(view, «xptMetaModel.
- DowncastToEObject(childMetaFeature.typeGenClass, 'childElement')»);
- «FOR next : getSemanticChildren(it, childMetaFeature)»
- «checkChildElementVisualID(next, null != childMetaFeature && childMetaFeature.listType)»
- «ENDFOR»
- }
- «ENDFOR»
- «IF it.getPhantomNodes.notEmpty»
- org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
- for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = getPhantomNodesIterator(resource); it.hasNext();) {
- org.eclipse.emf.ecore.EObject childElement = it.next();
- if (childElement == modelElement) {
- continue;
- }
- «FOR phantom : it.phantomNodes»
- «addNextIfPhantom(phantom)»
- «ENDFOR»
- }
- «ENDIF»
- return result;
- «ELSE»
- return «newEmptyList()»;
- «ENDIF»
- }
- «ENDIF»
- '''
-
-
- override defineLinkSource(TypeLinkModelFacet it, boolean inLoop) '''
- «IF sourceMetaFeature.listType»
- java.util.List<?> sources = «xptMetaModel.getFeatureValue(sourceMetaFeature, 'link', metaClass)»;
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if («xptMetaModel.NotInstance(it.sourceType, 'theSource')») {
- «stopLinkProcessing(inLoop)»
- }
- «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'theSource', true)»
- «ELSE»
- «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'link', metaClass, sourceMetaFeature)»
- «ENDIF»
- '''
-
- def isDiagram(GenDiagram it) ''''''
-
- override defineLinkDestination(TypeLinkModelFacet it, Boolean inLoop) '''
- «IF targetMetaFeature.listType»
- java.util.List<?> targets = «xptMetaModel.getFeatureValue(it.targetMetaFeature, 'link', metaClass)»;
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if («xptMetaModel.NotInstance(it.targetType, 'theTarget')») {
- «stopLinkProcessing(inLoop)»
- }
- «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'theTarget', true)»
- «ELSE»
- «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'link', metaClass, targetMetaFeature)»
- «ENDIF»
- '''
-
- //remove static modifier + private->protected
- override getOutgoingLinksByTypeMethodSignature(GenLink it) '''protected java.util.Collection<«linkDescriptor.
- qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(UpdaterLinkType::OUTGOING)»(«xptMetaModel.
- QualifiedClassName(it.modelFacet.sourceType)» source)'''
-
- override getGenericSemanticChildrenOfView(GenDiagramUpdater it, Iterable<GenContainerBase> semanticContainers) '''
-
- «generatedMemberComment»
- ««« remove static modifier
- public «listOfNodeDescriptors» getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) {
- «IF semanticContainers.notEmpty»
- String vid = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(view);
- if (vid != null) {
- switch (vid) {
- «FOR next : semanticContainers»
- «getSemanticChildrenCase(next)»
- «ENDFOR»
- }
- }
- «ENDIF»
- return «newEmptyList()»;
- }
- '''
-
- override dispatch getContainedLinksByTypeMethod(TypeLinkModelFacet it, GenLink genLink) '''
-
- «generatedMemberComment»
- ««« remove static modifier + private->protected
- protected java.util.Collection<«linkDescriptor.qualifiedClassName(genLink.diagramUpdater)»> «getConnectedLinksByTypeMethodName(
- genLink, UpdaterLinkType::CONTAINED)»(«xptMetaModel.QualifiedClassName(childMetaFeature.genClass)» container) {
- «getContainedLinksByTypeMethodBody(it, genLink, false)»
- }
- '''
-
- override getGenericConnectedLinks(GenDiagramUpdater it, Iterable<? extends GenCommonBase> linkContainers,
- UpdaterLinkType linkType) '''
-
- «generatedMemberComment»
- ««« remove static modifier
- public «listOfLinkDescriptors» get«linkType.linkMethodSuffix»Links(org.eclipse.gmf.runtime.notation.View view) {
- «IF linkContainers.notEmpty»
- String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view);
- if (vid != null) {
- switch (vid) {
- «FOR next : linkContainers»
- «getContainedLinksCase(next, linkType)»
- «ENDFOR»
- }
- }
- «ENDIF»
- return «newEmptyList»;
- }
- '''
-
- override runtimeTypedInstance(GenDiagramUpdater it) '''
- '''
-
- /**
- * XXX: [MG] suspicious code inside, EVEN after I moved ", " into the IF, there still may be problem if inner IF condition is not met.
- * Need to check with case when it.modelFacet.childMetaFeature == null
- */
- override def checkChildElementVisualID(GenNode it, Boolean inLoop) '''
- if («VisualIDRegistry::visualID(it)».equals(visualID)) {
- result.add(new «nodeDescriptor.qualifiedClassName(it.getDiagram().diagramUpdater)»(«IF null != modelFacet.childMetaFeature»«xptMetaModel.DowncastToEObject(modelFacet.childMetaFeature.typeGenClass, 'childElement')», «ENDIF»visualID));
- «IF inLoop»
- continue;
- «ENDIF»
- }
- '''
-
- override def checkLinkVisualID(TypeLinkModelFacet it, GenLink genLink, boolean inLoop) '''
- if (!«VisualIDRegistry::visualID(genLink)».equals(«xptVisualIDRegistry.getLinkWithClassVisualIDMethodCall(genLink.diagram)»(«xptMetaModel.DowncastToEObject(metaClass, 'link')»))) {
- «stopLinkProcessing(inLoop)»
- }
- '''
-
- override def getSemanticChildrenMethodName(GenContainerBase it) '''get«stringUniqueIdentifier()»_SemanticChildren'''
-
- override protected def linkGetterName(GenCommonBase it, UpdaterLinkType linkType) '''get«stringUniqueIdentifier()»_«linkType.linkMethodSuffix»Links'''
-
- override def getConnectedLinksByTypeMethodName(GenLink it, UpdaterLinkType linkType) '''get«linkType.linkMethodSuffix»«getConnectedLinksByTypeMethodFragment(modelFacet)»_«stringVisualID»'''
-
- override def dispatch getConnectedLinksByTypeMethodFragment(TypeLinkModelFacet it) '''TypeModelFacetLinks'''
-
- override def dispatch getConnectedLinksByTypeMethodFragment(FeatureLinkModelFacet it) '''FeatureModelFacetLinks'''
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend
deleted file mode 100644
index 899b8d8aa1c..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2014 Borland Software Corporation, CEA, and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2
- * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter
- *
- *****************************************************************************/
-package aspects.xpt.diagram.updater
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagramUpdater
-import xpt.Common
-
-@Singleton class LinkDescriptor extends xpt.diagram.updater.LinkDescriptor {
- @Inject extension Common;
-
- override def extendsList(GenDiagramUpdater it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterLinkDescriptor'''
-
- override def refOnlyLinkConstructor(GenDiagramUpdater it) '''
- «generatedMemberComment»
- public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) {
- super(source, destination, elementType, linkVID);
- }
- '''
-
- override def typeLinkConstructor(GenDiagramUpdater it) '''
- «generatedMemberComment»
- public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) {
- super(source, destination, linkElement, elementType, linkVID);
- }
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend
deleted file mode 100644
index 394e76dfc5e..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend
+++ /dev/null
@@ -1,37 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2014 Borland Software Corporation, CEA, and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2
- * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter
- *
- *****************************************************************************/
-package aspects.xpt.diagram.updater
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagramUpdater
-import xpt.Common
-
-@Singleton class NodeDescriptor extends xpt.diagram.updater.NodeDescriptor {
- @Inject extension Common;
-
- override def extendsList(GenDiagramUpdater it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterNodeDescriptor'''
-
- override def constructor(GenDiagramUpdater it) '''
- «generatedMemberComment»
- public «className(it)»(org.eclipse.emf.ecore.EObject modelElement, String visualID) {
- super(modelElement, visualID);
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend
deleted file mode 100644
index 26fda2ab8e4..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend
+++ /dev/null
@@ -1,57 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.diagram.views
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLabel
-import xpt.diagram.Utils_qvto
-import xpt.diagram.ViewmapAttributesUtils_qvto
-
-/**
- * Renamed from xpt::diagram::views::Utils.xpt
- * in order to have consistent naming between Xtend files migrated from _qvto helpers and xpt templates
- */
-@Singleton class ViewStyles extends xpt.diagram.views.ViewStyles{
- @Inject extension Common;
- @Inject extension ViewmapAttributesUtils_qvto;
- @Inject extension Utils_qvto;
-
-
-
- override dispatch offset(GenExternalNodeLabel it, String viewVar) '''
- «IF labelOffsetX(viewmap, 0) != 0 || labelOffsetY(viewmap, 0) != 0»
- «offset(it,viewVar, labelOffsetX(viewmap, 0), labelOffsetY(viewmap, 0))»
- «ELSE»
- «offset(it,viewVar, 0, 15)»
- «ENDIF»
- '''
-
- override def offset(GenLabel it, String viewVar, int x, int y) '''
- «val location = stringUniqueIdentifier.toFirstLower+'_Location'»
- org.eclipse.gmf.runtime.notation.Location «location» = (org.eclipse.gmf.runtime.notation.Location) «viewVar».getLayoutConstraint();
- «IF it.getDiagram().isPixelMapMode()»
- «location».setX(«x»);
- «location».setY(«y»);
- «ELSE»
- «location».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»));
- «location».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»));
- «ENDIF»
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend
deleted file mode 100644
index 1bccf7a4266..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend
+++ /dev/null
@@ -1,50 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorView
-import xpt.Common
-
-@Singleton class ActionBarContributor extends xpt.editor.ActionBarContributor {
- @Inject extension Common;
- @Inject Editor xptEditor;
-
- override def ActionBarContributor(GenEditorView it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» «extendsList(it)» {
-
- «generatedMemberComment»
-
- protected Class<«xptEditor.qualifiedClassName(it)»> getEditorClass() {
- return «xptEditor.qualifiedClassName(it)».class;
- }
-
- «generatedMemberComment»
- protected String getEditorId() {
- return «xptEditor.qualifiedClassName(it)».ID;
- }
- «initMethod(it)»
- «additions(it)»
- }
- '''
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend
deleted file mode 100644
index 4e1f7d45cf9..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend
+++ /dev/null
@@ -1,188 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Anatloyi Tischenko and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Anatloyi Tischenko - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Common
-import com.google.inject.Inject
-import xpt.CodeStyle
-import xpt.editor.GenDiagram_qvto
-import xpt.editor.CreationWizardPage
-import xpt.Externalizer
-import plugin.Activator
-import xpt.editor.DiagramEditorUtil
-import xpt.ExternalizerUtils_qvto
-import com.google.inject.Singleton
-
-@Singleton class CreationWizard extends xpt.editor.CreationWizard {
-
- @Inject extension Common
- @Inject extension CodeStyle
- @Inject extension ExternalizerUtils_qvto
- @Inject extension GenDiagram_qvto
-
- @Inject Activator xptActivator
- @Inject CreationWizardPage xptCreationWizardPage
- @Inject DiagramEditorUtil xptDiagramEditorUtil
- @Inject Externalizer xptExternalizer
-
- override CreationWizard(GenDiagram it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)»
- «extendsList(it)» «implementsList(it)» {
-
- «generatedMemberComment»
- private org.eclipse.ui.IWorkbench workbench;
-
- «generatedMemberComment»
- protected org.eclipse.jface.viewers.IStructuredSelection selection;
-
- «generatedMemberComment»
- protected «xptCreationWizardPage.qualifiedClassName(it)» diagramModelFilePage;
-
- «IF standaloneDomainModel(it)»
- «generatedMemberComment»
- protected «xptCreationWizardPage.qualifiedClassName(it)» domainModelFilePage;
- «ENDIF»
-
- «generatedMemberComment»
- protected org.eclipse.emf.ecore.resource.Resource diagram;
-
- «generatedMemberComment»
- private boolean openNewlyCreatedDiagramEditor = true;
-
- «generatedMemberComment»
- public org.eclipse.ui.IWorkbench getWorkbench() {
- return workbench;
- }
-
- «generatedMemberComment»
- public org.eclipse.jface.viewers.IStructuredSelection getSelection() {
- return selection;
- }
-
- «generatedMemberComment»
- public final org.eclipse.emf.ecore.resource.Resource getDiagram() {
- return diagram;
- }
-
- «generatedMemberComment»
- public final boolean isOpenNewlyCreatedDiagramEditor() {
- return openNewlyCreatedDiagramEditor;
- }
-
- «generatedMemberComment»
- public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
- this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
- }
-
- «generatedMemberComment»
- public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- setWindowTitle(«xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForCreationWizard(it)))»);
- setDefaultPageImageDescriptor(«xptActivator.qualifiedClassName(editorGen.plugin)».getBundledImageDescriptor(
- "icons/wizban/New«IF domainDiagramElement != null»«domainDiagramElement.genPackage.prefix»«ENDIF»Wizard.gif")); //$NON-NLS-1$
- setNeedsProgressMonitor(true);
- }
-
- «generatedMemberComment»
- public void addPages() {
- diagramModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»(
- "DiagramModelFile", getSelection(), "«editorGen.diagramFileExtension»"); //$NON-NLS-1$ //$NON-NLS-2$
- diagramModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen,
- titleKey(i18nKeyForCreationWizardDiagramPage(it)))»);
- diagramModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen,
- descriptionKey(i18nKeyForCreationWizardDiagramPage(it)))»);
- addPage(diagramModelFilePage);
- «IF standaloneDomainModel(it)»
-
- domainModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»(
- "DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$
-
- «overrideC»
- public void setVisible(boolean visible) {
- if (visible) {
- String fileName = diagramModelFilePage.getFileName();
- fileName = fileName.substring(0, fileName.length() - ".«editorGen.diagramFileExtension»".length()); //$NON-NLS-1$
- setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName(
- getContainerFullPath(), fileName, "«editorGen.domainFileExtension»")); //$NON-NLS-1$
- }
- super.setVisible(visible);
- }
- };
- domainModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen,
- titleKey(i18nKeyForCreationWizardDomainPage(it)))»);
- domainModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen,
- descriptionKey(i18nKeyForCreationWizardDomainPage(it)))»);
- addPage(domainModelFilePage);
- «ENDIF»
- }
-
- «generatedMemberComment»
- public boolean performFinish() {
- org.eclipse.jface.operation.IRunnableWithProgress op =
- «IF editorGen.application == null»
- new org.eclipse.ui.actions.WorkspaceModifyOperation(null) {
-
- «overrideC»
- protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor)
- throws org.eclipse.core.runtime.CoreException, InterruptedException {
- «ELSE»
- new org.eclipse.jface.operation.IRunnableWithProgress() {
-
- public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- «ENDIF»
- diagram = «xptDiagramEditorUtil.qualifiedClassName(it)».createDiagram(diagramModelFilePage.getURI(),
- «IF standaloneDomainModel(it)»
- domainModelFilePage.getURI(),
- «ENDIF»
- monitor);
- if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
- try {
- «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagram);
- } catch (org.eclipse.ui.PartInitException e) {
- org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
- «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardOpenEditorError(it))», null, e.getStatus());
- }
- }
- }
- };
- try {
- getContainer().run(false, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (java.lang.reflect.InvocationTargetException e) {
- if (e.getTargetException() instanceof org.eclipse.core.runtime.CoreException) {
- org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
- «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardCreationError(it))», null,
- ((org.eclipse.core.runtime.CoreException) e.getTargetException()).getStatus());
- } else {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Error creating diagram", e.getTargetException()); //$NON-NLS-1$
- }
- return false;
- }
- return diagram != null;
- }
- «additions(it)»
- }
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend
deleted file mode 100644
index 7216228545e..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2008, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2, use GMFT runtime
- * Vincent Lorenzo (CEA LIST)
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Singleton
-
-//This class is not used, now we use org.eclipse.papyrus.common.actions.DeleteFromModelAction
-@Singleton class DeleteElementAction extends xpt.editor.DeleteElementAction {
-
-
-
-// override DeleteElementAction(GenDiagram it) '''
-// //This file is not used.
-// //The DeleteElementAction is removed from the plugin and replaced by DeleteFromModelAction in the plugin org.eclipse.diagram.common.
-// '''
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend
deleted file mode 100644
index 51d59f678e3..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Florian Noyrit - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenContainerBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-@Singleton class DiagramContentInitializer extends xpt.editor.DiagramContentInitializer {
- @Inject extension Common;
-
- @Inject VisualIDRegistry xptVisualIDRegistry;
-
- override def getCompartment(GenDiagram it) '''
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, String visualID) {
- String type = «xptVisualIDRegistry.typeMethodCall(it, 'visualID')»;
- for (java.util.Iterator it = node.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (nextView instanceof org.eclipse.gmf.runtime.notation.Node && type.equals(nextView.getType())) {
- return (org.eclipse.gmf.runtime.notation.Node) nextView;
- }
- }
- return null;
- }
- '''
-
- override def createChildrenMethodName(GenContainerBase it) '''create«it.stringUniqueIdentifier»_Children'''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend
deleted file mode 100644
index 8cf2d820a02..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2008, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Vincent Lorenzo (CEA LIST)
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import plugin.Activator
-import xpt.Common import xpt.CodeStyle
-
-//We remove the dependance with DeleteElementAction. Now this action is added to the popup menu with the extension point org.eclipse.ui.popup
-//in org.eclipse.papyrus.uml.diagram.common
-@Singleton class DiagramEditorContextMenuProvider extends xpt.editor.DiagramEditorContextMenuProvider {
- @Inject extension Common;
- @Inject extension CodeStyle
-
- @Inject Activator xptActivator;
-
-
- override DiagramEditorContextMenuProvider(GenDiagram it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider {
-
- «generatedMemberComment»
- private org.eclipse.ui.IWorkbenchPart part;
-
- ««« «generatedMemberComment»
- ««« private «xptDeleteElementAction.qualifiedClassName(it)» deleteAction;
-
- «generatedMemberComment»
- public DiagramEditorContextMenuProvider(org.eclipse.ui.IWorkbenchPart part, org.eclipse.gef.EditPartViewer viewer) {
- super(part, viewer);
- this.part = part;
- ««« deleteAction = new «xptDeleteElementAction.qualifiedClassName(it)»(part);
- ««« deleteAction.init();
- }
-
- ««« «generatedMemberComment»
- ««« public void dispose() {
- ««« if (deleteAction != null) {
- ««« deleteAction.dispose();
- ««« deleteAction = null;
- ««« }
- ««« super.dispose();
- ««« }
-
- «generatedMemberComment»
- public void buildContextMenu(final org.eclipse.jface.action.IMenuManager menu) {
- getViewer().flush();
- try {
- org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(
- (org.eclipse.emf.ecore.EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
-
- «overrideI(it.editorGen.diagram)»
- public void run() {
- org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService.getInstance().contributeToPopupMenu(
- DiagramEditorContextMenuProvider.this, part);
- menu.remove(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_DELETE_FROM_MODEL);
- ««« menu.appendToGroup("editGroup", deleteAction);
- }
- });
- } catch (Exception e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Error building context menu", e);
- }
- }
- «additions(it)»
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend
deleted file mode 100644
index 501fb3bc20a..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend
+++ /dev/null
@@ -1,109 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and other.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import xpt.Common
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Externalizer
-import xpt.CodeStyle
-import metamodel.MetaModel
-import plugin.Activator
-import xpt.editor.GenDiagram_qvto
-import com.google.inject.Singleton
-
-@Singleton class DiagramEditorUtil extends xpt.editor.DiagramEditorUtil {
-
- @Inject extension Common
- @Inject extension CodeStyle
- @Inject extension GenDiagram_qvto
-
- @Inject Activator xptActivator
- @Inject Externalizer xptExternalizer
- @Inject MetaModel xptMetaModel
-
- override def getUniqueFileNameMethod(GenDiagram it) '''
- «generatedMemberComment»
- public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) {
- return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «»
- org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application == null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»);
- }
- '''
-
- override createDiagramMethod(GenDiagram it) '''
- «generatedMemberComment(
- (if(editorGen.application == null) 'This method should be called within a workspace modify operation since it creates resources.' else ''))»
- public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel(
- it)» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
- progressMonitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForCreateDiagramProgressTask(it))», 3);
- final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
- «IF standaloneDomainModel(it)»
- final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
- «ELSEIF domainDiagramElement != null && hasDocumentRoot(it)/*for standalone models, we assume its resourcefactory would be able to set extendedMetaData option*/»
- ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
- ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultLoadOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
- «ENDIF»
- final String diagramName = diagramURI.lastSegment();
- org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «xptExternalizer.
- accessorCall(editorGen, i18nKeyForCreateDiagramCommandLabel(it))», java.util.Collections.EMPTY_LIST) {
- «overrideC»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- «IF domainDiagramElement != null»
- «xptMetaModel.QualifiedClassName(domainDiagramElement)» model = createInitialModel();
- attachModelToResource(model, «IF standaloneDomainModel(it)»model«ELSE»diagram«ENDIF»Resource);
- «ENDIF»
- «extraLineBreak»
- org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
- «IF domainDiagramElement != null»
- «xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»,
- «ENDIF»
- «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»);
- if (diagram != null) {
- diagramResource.getContents().add(diagram);
- diagram.setName(diagramName);
- «IF domainDiagramElement != null»
- diagram.setElement(«xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»);
- «ENDIF»
- }
-
- try {
- «IF standaloneDomainModel(it)»modelResource.save(«callGetSaveOptions(it)»);«ENDIF»
- diagramResource.save(«callGetSaveOptions(it)»);
- } catch (java.io.IOException e) {
- «/*
- * TODO CommandResult.newErrorCommandResult(e) would be better? Or even throw ExecutionEx?
- * */
- extraLineBreak»
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to store model and diagram resources", e); «nonNLS(1)»
- }
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- }
- };
- try {
- org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.SubProgressMonitor(progressMonitor, 1), null);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to create model and diagram", e); «nonNLS(
- 1)»
- }
- «IF editorGen.application == null»
- «IF standaloneDomainModel(it)»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF»
- setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource));
- «ENDIF»
- return diagramResource;
- }
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend
deleted file mode 100644
index 50db59ac161..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend
+++ /dev/null
@@ -1,339 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import plugin.Activator
-import xpt.Common
-import xpt.Externalizer
-import xpt.CodeStyle
-import xpt.editor.DiagramEditorUtil
-
-@Singleton class DocumentProvider extends xpt.editor.DocumentProvider {
- @Inject extension Common;
- @Inject extension CodeStyle
-
- @Inject Activator xptActivator;
- @Inject Externalizer xptExternalizer;
- @Inject DiagramEditorUtil xptDiagramEditorUtil
-
-
-
- override setDocumentContent(GenDiagram it) '''
- «generatedMemberComment»
- protected void setDocumentContent(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, org.eclipse.ui.IEditorInput element) throws org.eclipse.core.runtime.CoreException {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
- org.eclipse.emf.transaction.TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
- «IF null == it.editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») {
- org.eclipse.core.resources.IStorage storage = ((«fileEditorInputClassFQName(it)») element).getStorage();
- org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil.load(domain, storage, true, getProgressMonitor());
- document.setContent(diagram);
- } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») {
- org.eclipse.emf.common.util.URI uri = ((«uriEditorInputClassFQName(it)») element).getURI();
- org.eclipse.emf.ecore.resource.Resource resource = null;
- try {
- resource = domain.getResourceSet().getResource(uri.trimFragment(), false);
- if (resource == null) {
- resource = domain.getResourceSet().createResource(uri.trimFragment());
- }
- if (!resource.isLoaded()) {
- try {
- @SuppressWarnings({ "rawtypes", "unchecked" })
- java.util.Map<?,?> options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions());
- // @see 171060
- // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
- resource.load(options);
- } catch (java.io.IOException e) {
- resource.unload();
- throw e;
- }
- }
- if (uri.fragment() != null) {
- org.eclipse.emf.ecore.EObject rootElement = resource.getEObject(uri.fragment());
- if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- document.setContent(rootElement);
- return;
- }
- } else {
- for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = resource.getContents().iterator(); it.hasNext();) {
- Object rootElement = it.next();
- if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- document.setContent(rootElement);
- return;
- }
- }
- }
- throw new RuntimeException(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentProviderNoDiagramInResourceError(it))»);
- } catch (Exception e) {
- org.eclipse.core.runtime.CoreException thrownExcp = null;
- if (e instanceof org.eclipse.core.runtime.CoreException) {
- thrownExcp = (org.eclipse.core.runtime.CoreException) e;
- } else {
- String msg = e.getLocalizedMessage();
- thrownExcp = new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(it.editorGen.plugin)».ID, 0,
- msg != null ? msg : «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentProviderDiagramLoadingError(it))», e));
- }
- throw thrownExcp;
- }
- } else {
- «throwIncorrectInputException(it)»
- }
- }
- '''
-
- override createEditingDomain(GenDiagram it) '''
- «generatedMemberComment»
- private org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory.getInstance().createEditingDomain();
- editingDomain.setID("«editingDomainID»"); «nonNLS(1)»
- final org.eclipse.emf.transaction.NotificationFilter diagramResourceModifiedFilter = org.eclipse.emf.transaction.NotificationFilter.createNotifierFilter(editingDomain.getResourceSet()).and(org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.ADD)).and(org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(org.eclipse.emf.ecore.resource.ResourceSet.class, org.eclipse.emf.ecore.resource.ResourceSet.RESOURCE_SET__RESOURCES));
- editingDomain.getResourceSet().eAdapters().add(new org.eclipse.emf.common.notify.Adapter() {
-
- private org.eclipse.emf.common.notify.Notifier myTarger;
-
- «overrideI»
- public org.eclipse.emf.common.notify.Notifier getTarget() {
- return myTarger;
- }
-
- «overrideI»
- public boolean isAdapterForType(Object type) {
- return false;
- }
-
- «overrideI»
- public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
- if (diagramResourceModifiedFilter.matches(notification)) {
- Object value = notification.getNewValue();
- if (value instanceof org.eclipse.emf.ecore.resource.Resource) {
- ((org.eclipse.emf.ecore.resource.Resource) value).setTrackingModification(true);
- }
- }
- }
-
- «overrideI»
- public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget) {
- myTarger = newTarget;
- }
-
- });
-
- return editingDomain;
- }
- '''
-
- override doSaveDocument(GenDiagram it) '''
- «generatedMemberComment»
- protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor, Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, boolean overwrite) throws org.eclipse.core.runtime.CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- if (!overwrite && !info.isSynchronized()) {
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID,
- «IF null == editorGen.application»org.eclipse.core.resources.IResourceStatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.IStatus.ERROR«ENDIF»,
- «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentUnsynchronizedFileSaveError(it))»,
- null));
- }
- «IF null == editorGen.application»
- info.stopResourceListening();
- «ENDIF»
- fireElementStateChanging(element);
- try {
- monitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveDiagramTask(it))», info.getResourceSet().getResources().size() + 1); //"Saving diagram"
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
- monitor.setTaskName(org.eclipse.osgi.util.NLS.bind(
- «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveNextResourceTask(it))»,
- nextResource.getURI()));
- if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
- try {
- nextResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»);
- } catch (java.io.IOException e) {
- fireElementStateChangeFailed(element);
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null));
- }
- }
- monitor.worked(1);
- }
- monitor.done();
- info.setModificationStamp(computeModificationStamp(info));
- } catch (RuntimeException x) {
- fireElementStateChangeFailed(element);
- throw x;
- } «IF null == editorGen.application» finally {
- info.startResourceListening();
- } «ENDIF»
- } else {
- org.eclipse.emf.common.util.URI newResoruceURI;
- java.util.List<org.eclipse.core.resources.IFile> affectedFiles = null;
- «IF null == editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») {
- org.eclipse.core.resources.IFile newFile = ((«fileEditorInputClassFQName(it)») element).getFile();
- affectedFiles = java.util.Collections.singletonList(newFile);
- newResoruceURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
- } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») {
- newResoruceURI = ((«uriEditorInputClassFQName(it)») element).getURI();
- } else {
- fireElementStateChangeFailed(element);
- «throwIncorrectInputException(it)»
- }
- if (false == document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
- fireElementStateChangeFailed(element);
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0,
- "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); «nonNLS(1)» «nonNLS(2)»
- }
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
- final org.eclipse.emf.ecore.resource.Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
- final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram());
- try {
- new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveAs(it))», diagramCopy.getName()), affectedFiles) {
- «overrideC»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- newResource.getContents().add(diagramCopy);
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- }
- }.execute(monitor, null);
- newResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- fireElementStateChangeFailed(element);
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null));
- } catch (java.io.IOException e) {
- fireElementStateChangeFailed(element);
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null));
- }
- newResource.unload();
- }
- }
- '''
-
- override computeSchedulingRule(GenDiagram it) '''
- «generatedMemberComment»
- private org.eclipse.core.runtime.jobs.ISchedulingRule computeSchedulingRule(org.eclipse.core.resources.IResource toCreateOrModify) {
- if (toCreateOrModify.exists()) {
- return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
- }
- org.eclipse.core.resources.IResource parent = toCreateOrModify;
- do {«/*FIXME [MG] the bug is closed long ago, still need? */»
- /*
- * XXX This is a workaround for
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
- * IResourceRuleFactory.createRule should iterate the hierarchy
- * itself.
- */
- toCreateOrModify = parent;
- parent = toCreateOrModify.getParent();
- } while (parent != null && !parent.exists());
-
- return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
- }
- '''
-
- override doValidateState(GenDiagram it) '''
- «generatedMemberComment»
- protected void doValidateState(Object element, Object computationContext) throws org.eclipse.core.runtime.CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.LinkedList<org.eclipse.core.resources.IFile> files2Validate = new java.util.LinkedList<org.eclipse.core.resources.IFile>();
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null && file.isReadOnly()) {
- files2Validate.add(file);
- }
- }
- org.eclipse.core.resources.ResourcesPlugin.getWorkspace().validateEdit(files2Validate.toArray(new org.eclipse.core.resources.IFile[files2Validate.size()]), computationContext);
- }
-
- super.doValidateState(element, computationContext);
- }
- '''
-
- override getResetRule(GenDiagram it) '''
- «generatedMemberComment»
- protected org.eclipse.core.runtime.jobs.ISchedulingRule getResetRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> rules = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>();
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
- }
- }
- return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
- }
- return null;
- }
- '''
-
- override getSaveRule(GenDiagram it) '''
- «generatedMemberComment»
- protected org.eclipse.core.runtime.jobs.ISchedulingRule getSaveRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> rules = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>();
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- rules.add(computeSchedulingRule(file));
- }
- }
- return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
- }
- return null;
- }
- '''
-
- override getSynchronizeRule(GenDiagram it) '''
- «generatedMemberComment»
- protected org.eclipse.core.runtime.jobs.ISchedulingRule getSynchronizeRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> rules = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>();
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
- }
- }
- return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
- }
- return null;
- }
- '''
-
- override getValidateStateRule(GenDiagram it) '''
- «generatedMemberComment»
- protected org.eclipse.core.runtime.jobs.ISchedulingRule getValidateStateRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {«/*FIXME: [MG] bad copy paste here, files should be <IFile>, its a miracle that it does not fail in runtime at toArray stage */»
- java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> files = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>();
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- files.add(file);
- }
- }
- return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule(files.toArray(new org.eclipse.core.resources.IFile[files.size()]));
- }
- return null;
- }
- '''
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend
deleted file mode 100644
index 6a7884c5f8d..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend
+++ /dev/null
@@ -1,617 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2017 Borland Software Corporation, CEA, and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Emilien Perico (Atos Origin) - add code to refactor some classes
- * Christian W. Damus (CEA) - bug 430648
- * Christian W. Damus (CEA) - bug 431023
- * Micka¿l ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 512343
- *
- *****************************************************************************/
-
-package aspects.xpt.editor
-
-import aspects.xpt.navigator.NavigatorLinkHelper
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorView
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import org.eclipse.papyrus.gmf.codegen.gmfgen.Palette
-import xpt.Common
-import xpt.navigator.Utils_qvto
-import xpt.CodeStyle
-
-@Singleton class Editor extends xpt.editor.Editor {
- @Inject extension Common;
- @Inject NavigatorLinkHelper xptNavigatorLinkHelper;
- @Inject extension Utils_qvto;
- @Inject extension CodeStyle
-
- override extendsList(GenEditorView it) '''extends org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor'''
-
- override attributes(GenEditorView it) '''
- «generatedMemberComment»
- public static final String ID = "«ID»"; «nonNLS»
-
- «generatedMemberComment»
-public static final String CONTEXT_ID = "«contextID»"; «nonNLS»
-
-
- ««« Documentation. adds listener for papyrus editors
- «generatedMemberComment»
- private org.eclipse.gef.KeyHandler paletteKeyHandler = null;
-
- «generatedMemberComment»
- private org.eclipse.swt.events.MouseListener paletteMouseListener = null;
-
- ««« Helps to handle correctly the dirty state
- «generatedMemberComment»
- private org.eclipse.papyrus.commands.util.OperationHistoryDirtyState dirtyState;
-
- «generatedMemberComment»
- private org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain;
-
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider documentProvider;
- '''
-
- override constructor(GenEditorView it) '''
- «generatedMemberComment»
- public «className»(org.eclipse.papyrus.infra.core.services.ServicesRegistry servicesRegistry, org.eclipse.gmf.runtime.notation.Diagram diagram) throws org.eclipse.papyrus.infra.core.services.ServiceException{
- super(servicesRegistry, diagram);
-
- ««« Documentation. adds listener for papyrus palette service
- // adds a listener to the palette service, which reacts to palette customizations
- org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().addProviderChangeListener(this);
-
- «««Share the same editing domain
- // Share the same editing provider
- editingDomain = servicesRegistry.getService(org.eclipse.emf.transaction.TransactionalEditingDomain.class);
- documentProvider = new org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider(editingDomain);
-
- // overrides editing domain created by super constructor
- setDocumentProvider(documentProvider);
-
- «««end of listeners addition
- }
- '''
-
- override getNavigatorSelection(GenNavigator it) '''
-
- «generatedMemberComment»
- private org.eclipse.jface.viewers.ISelection getNavigatorSelection() {
- «IF getDiagramTopReference(it) !==null »
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument();
- «ENDIF»
- «xptNavigatorLinkHelper.findSelectionBody(it)»
- }
- '''
-
-override createPaletteRoot (Palette it)'''
- «generatedMemberComment»
- protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot(org.eclipse.gef.palette.PaletteRoot existingPaletteRoot) {
- org.eclipse.gef.palette.PaletteRoot paletteRoot;
- if (existingPaletteRoot == null) {
- paletteRoot = org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent());
- } else {
- org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent());
- paletteRoot = existingPaletteRoot;
- }
- applyCustomizationsToPalette(paletteRoot);
- return paletteRoot;
- }
-'''
-
-// FIXME - This has been overrided to comment the test on the palette tag in the gmfgen
- override Editor(GenEditorView it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» «extendsList(it)» «implementsList(it)» {
-
- «attributes(it)»
-
- «constructor(it)»
-
- «getContextID(it)»
-
-««« «IF editorGen.diagram.palette != null»
- «createPaletteRoot(editorGen.diagram.palette)»
-««« «ENDIF»
-
- «getPreferencesHint(it)»
-
- «getContributorId(it)»
-
- «getAdapter(it)»
-
- «getDocumentProvider(it)»
-
- «getEditingDomain(it)»
-
- «setDocumentProvider(it)»
- «IF isIDEMode(it)»
-
- «gotoMarker(it)»
-
- «isSaveAsAllowed(it)»
-
- «doSaveAs(it)»
-
- «performSaveAs(it)»
-
- «getShowInContext(it)»
-
- «IF hasNavigator(it)»
- «getNavigatorSelection(it.editorGen.navigator)»
- «ENDIF»
- «ENDIF»
-
- «configureGraphicalViewer(it)»
-
- «IF editorGen.diagram.generateCreateShortcutAction»
-
- «initializeGraphicalViewer(it)»
-
- «controlLastClickPositionProviderService»
-
- «dispose»
-
- «DropTargetListener(it)»
- «ENDIF»
-
- «additions(it)»
- }
- '''
-
-def createPaletteCustomizer (GenEditorView it)'''
- «generatedMemberComment»
- protected org.eclipse.gef.ui.palette.PaletteCustomizer createPaletteCustomizer() {
- return new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteCustomizer(getPreferenceStore());
- }
-'''
-
-override additions (GenEditorView it)'''
-
- «createEditingDomain(it)»
-
- « configureDiagramEditDomain(it)»
-
- « doSave(it)»
-
- « getDirtyState(it)»
-
- « setUndoContext(it)»
-
- « isDirty(it)»
-
- «««Documentation. adds method to handle palette changes
- « handlePaletteChange(it)»
-
- « dispose(it)»
-
- « getPaletteViewer(it)»
-
- ««« Documentation: (RS) advanced customization abilities
- ««« « createPaletteCustomizer»
-
- « constructPaletteViewer(it)»
-
- « createPaletteviewerProvider(it)»
-
- «getGraphicalViewer(it)»
-
- «initializeGraphicalViewer(it)»
-
- «selectionChanged(it)»
-
-'''
-
-def handlePaletteChange (GenEditorView it) '''
- «generatedMemberComment»
- public void providerChanged(org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent event) {
- // update the palette if the palette service has changed
- if (org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().equals(event.getSource())) {
- org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this,
- getDefaultPaletteContent());
- }
- }
-'''
-
-def constructPaletteViewer (GenEditorView it) '''
- «generatedMemberComment»
- protected org.eclipse.gef.ui.palette.PaletteViewer constructPaletteViewer() {
- return new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteViewer();
- }
-'''
-
-override dispose(GenEditorView it)'''
- «generatedMemberComment»
- public void dispose() {
- // remove palette service listener
- // remove preference listener
- org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
-
- if(dirtyState != null) {
- dirtyState.dispose();
- dirtyState = null;
- }
-
- super.dispose();
- }
-'''
-
-def getPaletteViewer (GenEditorView it)'''
- «generatedMemberComment»
- protected org.eclipse.gef.ui.palette.PaletteViewer getPaletteViewer() {
- return getEditDomain().getPaletteViewer();
- }
-'''
-
-override implementsList(Iterable<String> it)'''
- implements org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener
- «IF ! it.isEmpty»,
- «FOR string : it SEPARATOR ', '»
- «implementsListEntry(string)»
- «ENDFOR»
- «ENDIF»
-'''
-
-def implementsListEntry (String it)'''«it»'''
-
-def createPaletteviewerProvider (GenEditorView it)'''
-«generatedMemberComment»
-protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerProvider() {
- getEditDomain().setPaletteRoot(createPaletteRoot(null));
- return new org.eclipse.gef.ui.palette.PaletteViewerProvider(getEditDomain()) {
-
- /**
- * Override to provide the additional behavior for the tools. Will intialize with a
- * PaletteEditPartFactory that has a TrackDragger that understand how to handle the
- * mouseDoubleClick event for shape creation tools. Also will initialize the palette
- * with a defaultTool that is the SelectToolEx that undestands how to handle the enter
- * key which will result in the creation of the shape also.
- */
- «overrideC(it.editorGen.diagram)»
- protected void configurePaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer viewer) {
- super.configurePaletteViewer(viewer);
-
- // customize menu...
- viewer.setContextMenu(new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteContextMenuProvider(viewer));
-
- viewer.getKeyHandler().setParent(getPaletteKeyHandler());
- viewer.getControl().addMouseListener(getPaletteMouseListener());
-
- // Add a transfer drag target listener that is supported on
- // palette template entries whose template is a creation tool.
- // This will enable drag and drop of the palette shape creation
- // tools.
- viewer.addDragSourceListener(new org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener(viewer));
- viewer.setCustomizer(createPaletteCustomizer());
- }
-
- «overrideC(it.editorGen.diagram)»
- public org.eclipse.gef.ui.palette.PaletteViewer createPaletteViewer(org.eclipse.swt.widgets.Composite parent) {
- org.eclipse.gef.ui.palette.PaletteViewer pViewer = constructPaletteViewer();
- pViewer.createControl(parent);
- configurePaletteViewer(pViewer);
- hookPaletteViewer(pViewer);
- return pViewer;
- }
-
- /**
- * @return Palette Key Handler for the palette
- */
- private org.eclipse.gef.KeyHandler getPaletteKeyHandler() {
-
- if (paletteKeyHandler == null) {
-
- paletteKeyHandler = new org.eclipse.gef.KeyHandler() {
-
- /**
- * Processes a <i>key released </i> event. This method is called by the Tool
- * whenever a key is released, and the Tool is in the proper state. Override
- * to support pressing the enter key to create a shape or connection
- * (between two selected shapes)
- *
- * @param event
- * the KeyEvent
- * @return <code>true</code> if KeyEvent was handled in some way
- */
- «overrideC(it.editorGen.diagram)»
- public boolean keyReleased(org.eclipse.swt.events.KeyEvent event) {
-
- if (event.keyCode == org.eclipse.swt.SWT.Selection) {
-
- org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool();
-
- if (toolSupportsAccessibility(tool)) {
-
- tool.keyUp(event, getDiagramGraphicalViewer());
-
- // deactivate current selection
- getPaletteViewer().setActiveTool(null);
-
- return true;
- }
-
- }
- return super.keyReleased(event);
- }
-
- };
-
- }
- return paletteKeyHandler;
- }
-
- /**
- * @return Palette Mouse listener for the palette
- */
- private org.eclipse.swt.events.MouseListener getPaletteMouseListener() {
-
- if (paletteMouseListener == null) {
-
- paletteMouseListener = new org.eclipse.swt.events.MouseListener() {
-
- /**
- * Flag to indicate that the current active tool should be cleared after a
- * mouse double-click event.
- */
- private boolean clearActiveTool = false;
-
- /**
- * Override to support double-clicking a palette tool entry to create a
- * shape or connection (between two selected shapes).
- *
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- «overrideI(it.editorGen.diagram)»
- public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) {
- org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool();
-
- if (toolSupportsAccessibility(tool)) {
-
- tool.setViewer(getDiagramGraphicalViewer());
- tool.setEditDomain(getDiagramGraphicalViewer().getEditDomain());
- tool.mouseDoubleClick(e, getDiagramGraphicalViewer());
-
- // Current active tool should be deactivated,
- // but if it is down here it will get
- // reactivated deep in GEF palette code after
- // receiving mouse up events.
- clearActiveTool = true;
- }
- }
-
- «overrideI(it.editorGen.diagram)»
- public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
- // do nothing
- }
-
- «overrideI(it.editorGen.diagram)»
- public void mouseUp(org.eclipse.swt.events.MouseEvent e) {
- // Deactivate current active tool here if a
- // double-click was handled.
- if (clearActiveTool) {
- getPaletteViewer().setActiveTool(null);
- clearActiveTool = false;
- }
-
- }
- };
-
- }
- return paletteMouseListener;
- }
-
- };
- }
-'''
-
-//Not used
-override performSaveAs (GenEditorView it)'''
- «generatedMemberComment»
-protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- // Nothing
-}
-'''
-
-//Share the same editing domain
-override getEditingDomain (GenEditorView it)'''
- «generatedMemberComment»
- public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- return editingDomain;
- }
-'''
-
-def createEditingDomain (GenEditorView it)'''
-«generatedMemberComment»
- protected org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() {
- // Already configured
- return editingDomain;
- }
-'''
-
-
-def configureDiagramEditDomain (GenEditorView it)'''
-«generatedMemberComment»
- protected void configureDiagramEditDomain() {
- super.configureDiagramEditDomain();
- getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new org.eclipse.gef.commands.CommandStackListener() {
-
- «overrideI(it.editorGen.diagram)»
- public void commandStackChanged(java.util.EventObject event) {
- if (org.eclipse.swt.widgets.Display.getCurrent() == null) {
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- firePropertyChange(org.eclipse.ui.IEditorPart.PROP_DIRTY);
- }
- });
- } else {
- firePropertyChange(org.eclipse.ui.IEditorPart.PROP_DIRTY);
- }
- }
- });
- }
-'''
-
-def doSave (GenEditorView it)'''
-«generatedMemberComment»
- public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- // The saving of the resource is done by the CoreMultiDiagramEditor
- getDirtyState().saved();
- }
-'''
-
-def getDirtyState (GenEditorView it)'''
-«generatedMemberComment»
- protected org.eclipse.papyrus.commands.util.OperationHistoryDirtyState getDirtyState() {
- if(dirtyState == null) {
- dirtyState = org.eclipse.papyrus.commands.util.OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory());
- }
- return dirtyState;
- }
-'''
-
-def setUndoContext (GenEditorView it)'''
-«generatedMemberComment»
- protected void setUndoContext(org.eclipse.core.commands.operations.IUndoContext context) {
- if(dirtyState != null) {
- dirtyState.dispose();
- dirtyState = null;
- }
-
- super.setUndoContext(context);
- }
-'''
-
-//Fix the dirty state
-def isDirty (GenEditorView it)'''
-«generatedMemberComment»
- public boolean isDirty() {
- return getDirtyState().isDirty();
- }
-'''
-
-//Code refactoring moved in UMLDiagramEditor
-override getDocumentProvider (GenEditorView it)'''
- «generatedMemberComment»
- protected final org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider getDocumentProvider(org.eclipse.ui.IEditorInput input) {
- return documentProvider;
- }
-'''
-
-override setDocumentProvider (GenEditorView it)'''
- «generatedMemberComment»
- protected final void setDocumentProvider(org.eclipse.ui.IEditorInput input) {
- // Already set in the constructor
- }
-'''
-
-def getGraphicalViewer (GenEditorView it)'''
-«generatedMemberComment»
- @Override
- public org.eclipse.gef.GraphicalViewer getGraphicalViewer() {
- return super.getGraphicalViewer();
- }
-'''
-
-
-override initializeGraphicalViewer (GenEditorView it)'''
-«generatedMemberComment»
- @Override
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
-
- // Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(
- new org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener(getDiagramGraphicalViewer(), org.eclipse.jface.util.LocalSelectionTransfer.getTransfer()) {
-
- @Override
- protected Object getJavaObject(org.eclipse.swt.dnd.TransferData data) {
- // It is usual for the transfer data not to be set because it is available locally
- return LocalSelectionTransfer.getTransfer().getSelection();
- }
-
- @Override
- protected org.eclipse.emf.transaction.TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
-
- }
-'''
-
-def selectionChanged (GenEditorView it)'''
-«generatedMemberComment»
- @Override
- public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) {
- if (getSite().getPage().getActiveEditor() instanceof org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) {
- org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor editor = (org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) getSite().getPage().getActiveEditor();
- // If not the active editor, ignore selection changed.
- if (this.equals(editor.getActiveEditor())) {
- updateActions(getSelectionActions());
- super.selectionChanged(part, selection);
- } else {
- super.selectionChanged(part, selection);
- }
- } else {
- super.selectionChanged(part, selection);
- }
- // from
- // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart,
- // ISelection)
- if (part == this) {
- rebuildStatusLine();
- }
- }
-'''
-
-override getContextID (GenEditorView it)'''
- «generatedMemberComment»
-protected String getContextID() {
- return CONTEXT_ID;
-}
-'''
-
- override getAdapter(GenEditorView it) '''
- «IF !hasPropertySheet(it) || hasNavigator(it)»
-
- «generatedMemberComment»
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class type) {
- «IF !hasPropertySheet(it)»
- if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) {
- return null;
- }
- «ENDIF»
- «IF hasNavigator(it)»
- if (type == org.eclipse.ui.part.IShowInTargetList.class) {
- return new org.eclipse.ui.part.IShowInTargetList() {
-
- «overrideI(it.editorGen.diagram)»
- public String[] getShowInTargetIds() {
- return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID };
- }
- };
- }
- «ENDIF»
- return super.getAdapter(type);
- }
- «ENDIF»
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend
deleted file mode 100644
index 52f599433bf..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend
+++ /dev/null
@@ -1,95 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 Anatoliy Tischenko and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Anatoliy Tischenko - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import xpt.Common
-import com.google.inject.Inject
-import plugin.Activator
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Externalizer
-import xpt.ExternalizerUtils_qvto
-import com.google.inject.Singleton
-
-@Singleton class InitDiagramFileAction extends xpt.editor.InitDiagramFileAction {
-
- @Inject extension Common
- @Inject extension ExternalizerUtils_qvto
-
- @Inject Activator xptActivator
- @Inject xpt.editor.DiagramEditorUtil xptDiagramEditorUtil
- @Inject Externalizer xptExternalizer
-
- override classBody_PDE(GenDiagram it) '''
- «generatedMemberComment»
- private org.eclipse.ui.IWorkbenchPart targetPart;
-
- «generatedMemberComment»
- private org.eclipse.emf.common.util.URI domainModelURI;
-
- «generatedMemberComment»
- public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
- this.targetPart = targetPart;
- }
-
- «generatedMemberComment»
- public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
- domainModelURI = null;
- action.setEnabled(false);
- if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection == false || selection.isEmpty()) {
- return;
- }
- org.eclipse.core.resources.IFile file =
- (org.eclipse.core.resources.IFile) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
- domainModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
- action.setEnabled(true);
- }
-
- «generatedMemberComment»
- private org.eclipse.swt.widgets.Shell getShell() {
- return targetPart.getSite().getShell();
- }
-
- «generatedMemberComment»
- public void run(org.eclipse.jface.action.IAction action) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
- org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
- «IF editorGen.sameFileForDiagramAndModel»
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl();
- «ELSE»
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
- «ENDIF»
- org.eclipse.emf.ecore.EObject diagramRoot = null;
- try {
- org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(domainModelURI, true);
- diagramRoot = resource.getContents().get(0);
- } catch (org.eclipse.emf.common.util.WrappedException ex) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Unable to load resource: " + domainModelURI, ex); «nonNLS(1)»
- }
- if (diagramRoot == null) {
- org.eclipse.jface.dialogs.MessageDialog.openError(getShell(),
- «xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»,
- «xptExternalizer.accessorCall(editorGen, messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»);
- return;
- }
- org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain);
- wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
- «xptExternalizer.accessorCall(editorGen, i18nKeyForInitDiagramFileWizardTitle())»,
- «VisualIDRegistry::modelID(editorGen.diagram)»));
- «xptDiagramEditorUtil.qualifiedClassName(editorGen.diagram)».runWizard(getShell(), wizard, "InitDiagramFile"); «nonNLS(
- 1)»
- }
- '''
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ModelElementSelectionPage.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ModelElementSelectionPage.xtend
deleted file mode 100644
index 39fd14b0fe7..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ModelElementSelectionPage.xtend
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-@Singleton class ModelElementSelectionPage extends xpt.editor.ModelElementSelectionPage{
-
- override def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultModelElementSelectionPage'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend
deleted file mode 100644
index 1e556efd597..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend
+++ /dev/null
@@ -1,215 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Externalizer
-import xpt.ExternalizerUtils_qvto
-import xpt.Common
-import xpt.editor.ModelElementSelectionPage
-import plugin.Activator
-import xpt.editor.DiagramContentInitializer
-import xpt.CodeStyle
-
-@Singleton class NewDiagramFileWizard extends xpt.editor.NewDiagramFileWizard {
-
- @Inject extension Common
- @Inject extension CodeStyle
- @Inject extension ExternalizerUtils_qvto;
-
- @Inject Activator xptActivator
- @Inject DiagramEditorUtil xptDiagramEditorUtil
- @Inject Externalizer xptExternalizer;
- @Inject DiagramContentInitializer xptDiagramContentInitializer
- @Inject ModelElementSelectionPage xptModelElementSelectionPage
- @Inject xpt.editor.VisualIDRegistry xptVisualIDRegistry
-
- override i18nValues(GenDiagram it) '''
- «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Initialize new diagram file')»
- «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Diagram file')»
- «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)),
- 'Create new diagram based on {0} model content')»
- «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)),
- 'Select diagram root element')»
- «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), 'Diagram root element')»
- «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)),
- 'Select semantic model element to be depicted on diagram')»
- «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it),
- 'Select diagram root element:')»
- «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it),
- 'Diagram root element is not selected')»
- «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it),
- 'Invalid diagram root element is selected')»
- «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardInitDiagramCommand(it), 'Initializing diagram contents')»
- «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardIncorrectRootError(it),
- 'Incorrect model object stored as a root resource object')»
- '''
-
- override NewDiagramFileWizard(GenDiagram it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» extends org.eclipse.jface.wizard.Wizard {
-
- «generatedMemberComment»
- private «creationPage(it)» myFileCreationPage;
-
- «generatedMemberComment»
- private «xptModelElementSelectionPage.qualifiedClassName(it)» diagramRootElementSelectionPage;
-
- «generatedMemberComment»
- private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain;
-
- «generatedMemberComment»
- public «className(it)»(org.eclipse.emf.common.util.URI domainModelURI,
- org.eclipse.emf.ecore.EObject diagramRoot,
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
- «_assert('domainModelURI != null : \"Domain model uri must be specified\"')»
- «_assert('diagramRoot != null : \"Doagram root element must be specified\"')»
- «_assert('editingDomain != null : \"Editing domain must be specified\"')»
-
- myFileCreationPage = new «creationPage(it)»(«xptExternalizer.accessorCall(editorGen,
- nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))», org.eclipse.jface.viewers.StructuredSelection.EMPTY);
- myFileCreationPage.setTitle(«xptExternalizer.accessorCall(editorGen,
- titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))»);
- myFileCreationPage.setDescription(org.eclipse.osgi.util.NLS.bind(
- «xptExternalizer.accessorCall(editorGen, descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))»,
- «VisualIDRegistry::modelID(it)»));
- org.eclipse.core.runtime.IPath filePath;
- String fileName = org.eclipse.emf.common.util.URI.decode(domainModelURI.trimFileExtension().lastSegment());
- if (domainModelURI.isPlatformResource()) {
- filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toPlatformString(true));
- } else if (domainModelURI.isFile()) {
- filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toFileString());
- } else {
- // TODO : use some default path
- throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); «nonNLS(1)»
- }
- myFileCreationPage.setContainerFullPath(filePath);
- myFileCreationPage.setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName(
- filePath, fileName, "«editorGen.diagramFileExtension»")); «nonNLS(1)»
-
- diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(«xptExternalizer.accessorCall(editorGen,
- nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»);
- diagramRootElementSelectionPage.setTitle(«xptExternalizer.accessorCall(editorGen,
- titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»);
- diagramRootElementSelectionPage.setDescription(«xptExternalizer.accessorCall(editorGen,
- descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»);
- diagramRootElementSelectionPage.setModelElement(diagramRoot);
-
- myEditingDomain = editingDomain;
- }
-
- «generatedMemberComment»
- public void addPages() {
- addPage(myFileCreationPage);
- addPage(diagramRootElementSelectionPage);
- }
-
- «generatedMemberComment»
- public boolean performFinish() {
- java.util.LinkedList<org.eclipse.core.resources.IFile> affectedFiles = new java.util.LinkedList<org.eclipse.core.resources.IFile>();
- «IF null == editorGen.application»
- org.eclipse.core.resources.IFile diagramFile = myFileCreationPage.createNewFile();
- «xptDiagramEditorUtil.callSetCharset(it, 'diagramFile')»
- affectedFiles.add(diagramFile);
- org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
- «ELSE»
- org.eclipse.core.runtime.IPath diagramModelPath = myFileCreationPage.getContainerFullPath().append(myFileCreationPage.getFileName());
- org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createFileURI(diagramModelPath.toString());
- «ENDIF»
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet();
- final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(diagramModelURI);
- org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command =
- new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(
- myEditingDomain, «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardInitDiagramCommand(it))», affectedFiles) {
-
- «overrideC»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
- org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info)
- throws org.eclipse.core.commands.ExecutionException {
- String diagramVID = «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(diagramRootElementSelectionPage.getModelElement());
- if (diagramVID.equals(«VisualIDRegistry::visualID(it)»)) {
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult(
- «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardIncorrectRootError(it))»);
- }
- org.eclipse.gmf.runtime.notation.Diagram diagram =
- org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
- diagramRootElementSelectionPage.getModelElement(), «VisualIDRegistry::modelID(it)»,
- «xptActivator.preferenceHintAccess(editorGen)»);
- diagramResource.getContents().add(diagram);
- «IF editorGen.sameFileForDiagramAndModel»
- diagramResource.getContents().add(diagram.getElement());
- «ENDIF»
- «IF !it.synchronized»
- new «xptDiagramContentInitializer.qualifiedClassName(it)»().initDiagramContent(diagram);
- «ENDIF»
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- }
- };
- try {
- org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(
- command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
- diagramResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»);
- «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagramResource);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Unable to create model and diagram", e); «nonNLS(1)»
- } catch (java.io.IOException ex) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Save operation failed for: " + diagramModelURI, ex); «nonNLS(1)»
- } catch (org.eclipse.ui.PartInitException ex) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError(
- "Unable to open editor", ex); «nonNLS(1)»
- }
- return true;
- }
-
- «generatedClassComment»
- private static class DiagramRootElementSelectionPage extends «xptModelElementSelectionPage.qualifiedClassName(it)» {
-
- «generatedMemberComment»
- protected DiagramRootElementSelectionPage(String pageName) {
- super(pageName);
- }
-
- «generatedMemberComment»
- protected String getSelectionTitle() {
- return «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it))»;
- }
-
- «generatedMemberComment»
- protected boolean validatePage() {
- if (getModelElement() == null) {
- setErrorMessage(«xptExternalizer.accessorCall(editorGen,
- i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it))»);
- return false;
- }
- boolean result = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides(
- new org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation(
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getModelElement()),
- «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»));
- setErrorMessage(result ? null : «xptExternalizer.accessorCall(editorGen,
- i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it))»);
- return result;
- }
- }
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend
deleted file mode 100644
index a2d78fd8ce6..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend
+++ /dev/null
@@ -1,74 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 Anatoliy Tischenko and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Anatoliy Tischenko - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import xpt.Common
-import xpt.CodeStyle
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import com.google.inject.Singleton
-
-@Singleton class ResourceSetInfo extends xpt.editor.ResourceSetInfo {
-
- @Inject extension Common
- @Inject extension CodeStyle
-
- override handleResourceChangedSD(GenDiagram it) '''
- «generatedMemberComment»
- public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
- «updateSynchStateSD(it)»
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- «overrideI»
- public void run() {
- handleElementChanged(ResourceSetInfo.this, resource, null);
- }
- });
- return true;
- }
- '''
-
- override handleResourceDeletedSD(GenDiagram it) '''
- «generatedMemberComment»
- public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
- «updateSynchStateSD(it)»
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- «overrideI»
- public void run() {
- fireElementDeleted(ResourceSetInfo.this.getEditorInput());
- }
- });
- return true;
- }
- '''
-
- override handleResourceMovedSD(GenDiagram it) '''
- «generatedMemberComment»
- public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
- «updateSynchStateSD(it)»
- if (myDocument.getDiagram().eResource() == resource) {
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- «overrideI»
- public void run() {
- handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
- }
- });
- } else {
- handleResourceDeleted(resource);
- }
- return true;
- }
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend
deleted file mode 100644
index 9ac95d9c527..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Common
-
-@Singleton class ResourceSetModificationListener extends xpt.editor.ResourceSetModificationListener {
- @Inject extension Common;
-
-
-
- override notifyChanged(GenDiagram it) '''
- «generatedMemberComment»
- public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
- if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.ResourceSet) {
- super.notifyChanged(notification);
- }
- if (!notification.isTouch() && myModifiedFilter.matches(notification)) {
- if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.Resource) {
- org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) notification.getNotifier();
- if (resource.isLoaded()) {
- boolean modified = false;
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
- org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
- if (nextResource.isLoaded()) {
- modified = nextResource.isModified();
- }
- }
- boolean dirtyStateChanged = false;
- synchronized (myInfo) {
- if (modified != myInfo.fCanBeSaved) {
- myInfo.fCanBeSaved = modified;
- dirtyStateChanged = true;
- }
- «IF null == editorGen.application»
- if (!resource.isModified()) {
- myInfo.setSynchronized(resource);
- }
- «ENDIF»
- }
- if (dirtyStateChanged) {
- fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);
-
- if (!modified) {
- myInfo.setModificationStamp(computeModificationStamp(myInfo));
- }
- }
- }
- }
- }
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend
deleted file mode 100644
index 69274c55254..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend
+++ /dev/null
@@ -1,216 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Common
-import xpt.editor.DiagramEditorUtil
-import xpt.CodeStyle
-import plugin.Activator
-import xpt.providers.ValidationProvider
-
-@Singleton class ValidateAction extends xpt.editor.ValidateAction {
- @Inject extension Common;
- @Inject extension CodeStyle
-
- @Inject DiagramEditorUtil xptDiagramEditorUtil;
- @Inject Activator xptActivator
- @Inject ValidationProvider xptValidationProvider
-
- override runNonUIValidation(GenDiagram it) '''
-
- «generatedMemberComment»
- public static void runNonUIValidation(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.swt.widgets.Shell shell = org.eclipse.swt.widgets.Display.getCurrent().getActiveShell();
- if (shell == null) {
- shell = new org.eclipse.swt.widgets.Shell();
- }
-
- org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart =
- org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory.getInstance().createDiagramEditPart(
- view.getDiagram(),shell);
- runValidation(diagramEditPart, view);
- }
- '''
-
- override createMarkersForStatus(GenDiagram it) '''
-
- «generatedMemberComment»
- private static void createMarkers(
- «IF editorGen.application == null»org.eclipse.core.resources.IFile
- «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target,
- org.eclipse.core.runtime.IStatus validationStatus,
- org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {
- if (validationStatus.isOK()) {
- return;
- }
- final org.eclipse.core.runtime.IStatus rootStatus = validationStatus;
- java.util.List allStatuses = new java.util.ArrayList();
- «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = new «xptDiagramEditorUtil.
- qualifiedClassName(it)».LazyElement2ViewMap(
- diagramEditPart.getDiagramView(),
- collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allStatuses));
- for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) {
- org.eclipse.emf.validation.model.IConstraintStatus nextStatus =
- (org.eclipse.emf.validation.model.IConstraintStatus) it.next();
- org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView(
- diagramEditPart, nextStatus.getTarget(), element2ViewMap);
- addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
- org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true),
- nextStatus.getMessage(), nextStatus.getSeverity());
- }
- }
- '''
-
- override createMarkersForDiagnostic(GenDiagram it) '''
-
- «generatedMemberComment»
- private static void createMarkers(
- «IF editorGen.application == null»org.eclipse.core.resources.IFile
- «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target,
- org.eclipse.emf.common.util.Diagnostic emfValidationStatus,
- org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {
- if (emfValidationStatus.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) {
- return;
- }
- final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus;
- java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics = new java.util.ArrayList<org.eclipse.emf.common.util.Diagnostic>();
- «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap =
- new «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap(
- diagramEditPart.getDiagramView(),
- collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allDiagnostics));
- for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
- org.eclipse.emf.common.util.Diagnostic nextDiagnostic = it.next();
- java.util.List<?> data = nextDiagnostic.getData();
- if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0);
- org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView(
- diagramEditPart, element, element2ViewMap);
- addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
- org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(element, true),
- nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
- }
- }
- }
- '''
-
- override collectTargetElementsFromStatus(GenDiagram it) '''
-
- «generatedMemberComment»
- private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.core.runtime.IStatus status,
- java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.validation.model.IConstraintStatus> allConstraintStatuses) {
- if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) {
- targetElementCollector.add(((org.eclipse.emf.validation.model.IConstraintStatus) status).getTarget());
- allConstraintStatuses.add((org.eclipse.emf.validation.model.IConstraintStatus)status);
- }
- if (status.isMultiStatus()) {
- org.eclipse.core.runtime.IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);
- }
- }
- return targetElementCollector;
- }
- '''
-
- override collectTargetElementsFromDiagnostic(GenDiagram it) '''
-
- «generatedMemberComment»
- private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic,
- java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics) {
- java.util.List<?> data = diagnostic.getData();
- org.eclipse.emf.ecore.EObject target = null;
- if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
- target = (org.eclipse.emf.ecore.EObject) data.get(0);
- targetElementCollector.add(target);
- allDiagnostics.add(diagnostic);
- }
- if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
- for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) {
- collectTargetElements(it.next(), targetElementCollector, allDiagnostics);
- }
- }
- return targetElementCollector;
- }
- '''
-
- override run(GenDiagram it) '''
-
- «generatedMemberComment»
- public void run() {
- org.eclipse.ui.IWorkbenchPart workbenchPart = page.getActivePart();
- if (workbenchPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) {
- final org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart part = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) workbenchPart;
- try {
- «IF editorGen.application == null»
- new org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation(
- «ENDIF»
- new org.eclipse.jface.operation.IRunnableWithProgress() {
-
- «overrideI»
- public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
- throws InterruptedException, java.lang.reflect.InvocationTargetException {
- runValidation(part.getDiagramEditPart(), part.getDiagram());
- }
- }
- «IF editorGen.application == null»
- )
- «ENDIF»
- .run(new org.eclipse.core.runtime.NullProgressMonitor());
- } catch (Exception e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation action failed", e); «nonNLS(1)»
- }
- }
- }
- '''
-
- override runValidationWithEP(GenDiagram it) '''
-
- «generatedMemberComment»
- public static void runValidation(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.gmf.runtime.notation.View view) {
- final org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart fpart = diagramEditPart;
- final org.eclipse.gmf.runtime.notation.View fview = view;
- org.eclipse.emf.transaction.TransactionalEditingDomain txDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view);
- «xptValidationProvider.qualifiedClassName(it)».runWithConstraints(txDomain, new Runnable() {
-
- «overrideI»
- public void run() {
- validate(fpart, fview);
- }
- });
- }
- '''
-
- override runEMFValidator(GenDiagram it) '''
-
- «generatedMemberComment»
- private static org.eclipse.emf.common.util.Diagnostic runEMFValidator(
- org.eclipse.gmf.runtime.notation.View target) {
- if (target.isSetElement() && target.getElement() != null) {
- return new org.eclipse.emf.ecore.util.Diagnostician() {
-
- «overrideC»
- public String getObjectLabel(org.eclipse.emf.ecore.EObject eObject) {
- return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(eObject, true);
- }
- }.validate(target.getElement());
- }
- return org.eclipse.emf.common.util.Diagnostic.OK_INSTANCE;
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend
deleted file mode 100644
index d7dc88cd6ff..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend
+++ /dev/null
@@ -1,342 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #372479, #386838
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenJavaExpressionProvider
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeModelFacet
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ValueExpression
-import xpt.CodeStyle
-import xpt.Common_qvto
-import xpt.diagram.editpolicies.LinkUtils_qvto
-import xpt.diagram.updater.Utils_qvto
-
-//XXX: [MG] decide what to do with @MetaDef methods
-@Singleton class VisualIDRegistry extends xpt.editor.VisualIDRegistry {
- @Inject extension MetaModel
- @Inject extension Common
- @Inject extension Common_qvto;
- @Inject extension LinkUtils_qvto;
- @Inject extension Utils_qvto;
-
- @Inject CodeStyle xptCodeStyle;
-
- override getDiagramVisualID(GenDiagram it) '''
- «generatedMemberComment()»
- public static String «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «unrecognizedVID(it)»
- }
- return «visualID(it)»;
- }
- '''
-
- /**
- * Support for extra contstraints to check about model element.
- * Includes expression fields for interpreted constrains (like ocl or regexp).
- * For each model element that has an associated constraint, there's a method is<DomainElement>_<UID>()
- * that performs extra specification as defined by value expression
- *
- * FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator)
- */
- override constraintMethods(GenDiagram it) '''
- «IF null != editorGen.expressionProviders»
- «FOR topNode : topLevelNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod(
- topNode)»«ENDFOR»
- «FOR childNode : childNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod(
- childNode)»«ENDFOR»
- «FOR link : links.filter[n|!n.sansDomain]»«constraintMethod(link.modelFacet, link)»«ENDFOR»
- «ENDIF»
- '''
- //[ExtendedConstraint] Model selector constraint
- override checkDomainElementConstraints(TypeModelFacet it, GenCommonBase commonBase) '''
-««« «IF null != modelElementSelector»
-««« //«it.eContainer»
-««« //->«modelElementSelector»
-««« «ENDIF»
- ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
- «IF null != modelElementSelector»
- «IF commonBase instanceof GenLink || !(modelElementSelector.provider instanceof GenJavaExpressionProvider)»
- ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
- && «domainElementConstraintMethodName(commonBase)»(«CastEObject(metaClass,'domainElement')»)
- ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
- «ELSE»
- && «domainElementConstraintMethodName(commonBase)»(containerView, «CastEObject(metaClass, 'domainElement')»)
- «ENDIF»
- «ENDIF»
- ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
- '''
-
-// override dispatch domainElementConstraintMethod(GenExpressionInterpreter it, GenCommonBase diagramElement,
-// ValueExpression expression, GenClass context) '''
-// «generatedMemberComment()»
-// «IF diagramElement instanceof GenLink»
-//
-// «ELSE»
-// private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) {
-// Object result = «xptGetExpression.getExpression(it, expression, context)».evaluate(domainElement);
-// return result instanceof Boolean && ((Boolean)result).booleanValue();
-// }
-// «ENDIF»
-//
-// '''
-
- // [ExtendedConstraint] Model selector constraint
- override dispatch domainElementConstraintMethod(GenJavaExpressionProvider it, GenCommonBase diagramElement,
- ValueExpression expression, GenClass context) '''
- «generatedMemberComment»
- ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
- «IF diagramElement instanceof GenLink»
- ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
- private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) {
- ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
- «ELSE»
- private static boolean «domainElementConstraintMethodName(diagramElement)»(org.eclipse.gmf.runtime.notation.View containerView, «QualifiedClassName(
- context)» domainElement) {
- «ENDIF»
- ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
- «IF injectExpressionBody && (expression.body != null && expression.body.length() != 0)»
- «expression.body»
- «ELSEIF throwException || (injectExpressionBody && (expression.body == null || expression.body.length() == 0))»
- // FIXME: implement this method
- // Ensure that you remove @generated or mark it @generated NOT
- throw new java.lang.UnsupportedOperationException("No java implementation provided in '« domainElementConstraintMethodName(diagramElement)»' operation");«nonNLS»
- «ELSE»
- return false;
- «ENDIF»
- }
- '''
-
- override runtimeTypedInstance(GenDiagram it) '''
- «generatedClassComment()»
- public static final org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure() {
- «generatedMemberComment()»
- «xptCodeStyle.overrideC(it)»
- public String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
- return «getVisualIDMethodCall(it)»(view);
- }
-
- «generatedMemberComment()»
- «xptCodeStyle.overrideC(it)»
- public String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
- return «getModelIDMethodCall(it)»(view);
- }
-
- «generatedMemberComment()»
- «xptCodeStyle.overrideC(it)»
- public String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
- return «getNodeVisualIDMethodCall(it)»(containerView, domainElement);
- }
-
- «generatedMemberComment()»
- «xptCodeStyle.overrideC(it)»
- public boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) {
- return «checkNodeVisualIDMethodCall(it)»(containerView, domainElement, candidate);
- }
-
- «generatedMemberComment()»
- «xptCodeStyle.overrideC(it)»
- public boolean «isCompartmentVisualIDMethodName(it)»(String visualID) {
- return «isCompartmentVisualIDMethodCall(it)»(visualID);
- }
-
- «generatedMemberComment()»
- «xptCodeStyle.overrideC(it)»
- public boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) {
- return «isSemanticLeafVisualIDMethodCall(it)»(visualID);
- }
- };
- '''
-
- override getModelID(GenDiagram it) '''
- «generatedMemberComment()»
- public static String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.gmf.runtime.notation.View diagram = view.getDiagram();
- while (view != diagram) {
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «nonNLS(1)»
- if (annotation != null) {
- return annotation.getDetails().get("modelID"); «nonNLS(1)»
- }
- view = (org.eclipse.gmf.runtime.notation.View) view.eContainer();
- }
- return diagram != null ? diagram.getType() : null;
- }
- '''
-
- override def getType(GenDiagram it) '''
- «generatedMemberComment()»
- public static String «getTypeMethodName(it)»(String visualID) {
- return visualID;
- }
- '''
-
- override def getViewVisualID(GenDiagram it) '''
- «generatedMemberComment()»
- public static String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
- if (view instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- if («modelID(it)».equals(view.getType())) {
- return «visualID(it)»;
- } else {
- «unrecognizedVID(it)»
- }
- }
- return «getVisualIDMethodCall(it)»(view.getType());
- }
- '''
-
- override def unrecognizedVID(GenDiagram it) '''
- return "";
- '''
-
- override def getVisualID(GenDiagram it) '''
- «generatedMemberComment()»
- public static String «getVisualIdMethodName(it)»(String type) {
- return type;
- }
- '''
-
- override def getNodeVisualID(GenDiagram it) '''
- «generatedMemberComment()»
- public static String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «unrecognizedVID(it)»
- }
- String containerModelID = «getModelIDMethodCall(it)»(containerView);
- if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)»
- «unrecognizedVID(it)»
- }
- String containerVisualID;
- if («modelID(it)».equals(containerModelID)) {
- containerVisualID = «getVisualIDMethodCall(it)»(containerView);
- } else {
- if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- containerVisualID = «visualID(it)»;
- } else {
- «unrecognizedVID(it)»
- }
- }
- if (containerVisualID != null) {
- switch (containerVisualID) {
- «FOR container : allContainers»
- «caseDomainContainerVisualID(container)»
- «ENDFOR»
- }
- }
- «unrecognizedVID(it)»
- }
- '''
-
- override def getLinkWithClassVisualID(GenDiagram it) '''
- «generatedMemberComment()»
- public static String «getLinkWithClassVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «unrecognizedVID(it)»
- }
- «FOR typeLink : links.filter[l|isTypeLink(l)]»«returnVisualID(typeLink)»«ENDFOR»
- «unrecognizedVID(it)»
- }
- '''
-
- override def canCreateNode(GenDiagram it) '''
- «generatedMemberComment()»
- public static boolean «canCreateNodeMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, String nodeVisualID) {
- String containerModelID = «getModelIDMethodCall(it)»(containerView);
- if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)»
- return false;
- }
- String containerVisualID;
- if («modelID(it)».equals(containerModelID)) {
- containerVisualID = «getVisualIDMethodCall(it)»(containerView);
- } else {
- if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- containerVisualID = «visualID(it)»;
- } else {
- return false;
- }
- }
- if (containerVisualID != null) {
- switch (containerVisualID) {
- «FOR container : allContainers.filter[e|getEssentialVisualChildren(e).notEmpty]»«checkEssentialChildren(container)»«ENDFOR»
- «FOR link : links.filter[l|getEssentialVisualChildren(l).notEmpty]»«checkEssentialChildren(link)»«ENDFOR»
- }
- }
- return false;
- }
- '''
-
- override def checkEssentialChild(GenCommonBase it) '''
- if («visualID(it)».equals(nodeVisualID)) {
- return true;
- }
- '''
-
- override def isCompartmentVisualID(GenDiagram it) '''
- «generatedMemberComment()»
- public static boolean «isCompartmentVisualIDMethodName(it)»(String visualID) {
- «IF compartments.notEmpty»
- if (visualID != null) {
- switch (visualID) {
- «FOR compartment : compartments»«caseVisualID(compartment)»«ENDFOR»
- return true;
- }
- }
- «ENDIF»
- return false;
- }
- '''
-
- override def isSemanticLeafVisualID(GenDiagram it) {
- var leafs = it.allNodes.filter[n | getSemanticChildren(n).empty && n.compartments.forall[c | getSemanticChildren(c).empty]].sortBy[n|n.visualID]
- return '''
- «generatedMemberComment()»
- public static boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) {
- if (visualID != null) {
- switch (visualID) {
- «/*We need to ensure at last one case, this is legitimate way*/
- caseVisualID(it)»
- return false;
- «IF leafs.notEmpty»
- «FOR leaf : leafs»«caseVisualID(leaf)»«ENDFOR»
- return true;
- «ENDIF»
- }
- }
- return false;
- }
- '''
- }
-
- override def checkNodeVisualID(GenDiagram it) '''
- «generatedMemberComment()»
- public static boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) {
- if (candidate == null){
- //unrecognized id is always bad
- return false;
- }
- String basic = «getNodeVisualIDMethodName(it)»(containerView, domainElement);
- return candidate.equals(basic);
- }
- '''
-
- override def domainElementConstraintMethodName(GenCommonBase it) '''is«stringUniqueIdentifier()»'''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend
deleted file mode 100644
index cf4599f1e45..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend
+++ /dev/null
@@ -1,108 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.editor
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
-import xpt.Common
-
-@Singleton class extensions extends xpt.editor.extensions {
- @Inject extension Common;
-
- override extensions(GenEditorGenerator it) '''
- «extraLineBreak»
- ««« YT (not used):
- ««« «tripleSpace(1)»<extension point="org.eclipse.ui.editors" id="gmf-editor">
- ««« «tripleSpace(2)»«xmlGeneratedTag()»
- ««« «tripleSpace(2)»<editor
- ««« «tripleSpace(3)»id="«editor.ID»"
- ««« «tripleSpace(3)»name="%editorName"
- ««« «tripleSpace(3)»icon="«editor.iconPathX»"
- ««« «tripleSpace(3)»extensions="«diagramFileExtension»"
- ««« «tripleSpace(3)»default="true"
- ««« «tripleSpace(3)»class="«xptEditor.qualifiedClassName(editor)»"
- ««« «tripleSpace(3)»matchingStrategy="«xptMatching.qualifiedClassName(diagram)»"
- ««« «tripleSpace(3)»contributorClass="«xptActionBarContributor.qualifiedClassName(editor)»">
- ««« «tripleSpace(2)»</editor>
- ««« «tripleSpace(1)»</extension>
-
- «extraLineBreak»«outTab»
- «tripleSpace(1)»<extension point="org.eclipse.ui.contexts" id="ui-context">
- «tripleSpace(2)»«xmlGeneratedTag()»
- «tripleSpace(2)»<context
- «tripleSpace(3)»description="%context.description"
- «tripleSpace(3)»id="«editor.contextID»"
- «tripleSpace(3)»name="%context.name"
- «tripleSpace(3)»parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
- «tripleSpace(2)»</context>
- «tripleSpace(1)»</extension>
-
- ««« YT (not used):
- ««« «tripleSpace(1)»<extension point="org.eclipse.ui.newWizards" id="creation-wizard">
- ««« «tripleSpace(2)»«xmlGeneratedTag()»
- ««« «tripleSpace(2)»<wizard
- ««« «tripleSpace(3)»name="%newWizardName"
- ««« «tripleSpace(3)»icon="«diagram.creationWizardIconPathX»"
- ««« «tripleSpace(3)»category="«diagram.creationWizardCategoryID»"
- ««« «tripleSpace(3)»class="«xptCreationWizard.qualifiedClassName(diagram)»"
- ««« «tripleSpace(3)»id="«xptCreationWizard.qualifiedClassName(diagram)»ID">
- ««« «tripleSpace(3)»<description>%newWizardDesc</description>
- ««« «tripleSpace(2)»</wizard>
- ««« «tripleSpace(1)»</extension>
- «««
- ««« «IF diagram.generateInitDiagramAction()»
- ««« «IF null == application»
- ««« «tripleSpace(1)»<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action">
- ««« «tripleSpace(2)»«xmlGeneratedTag()»
- ««« «tripleSpace(2)»<objectContribution
- ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram"
- ««« «tripleSpace(4)»nameFilter="*.«domainFileExtension»"
- ««« «tripleSpace(4)»objectClass="org.eclipse.core.resources.IFile">
- ««« «tripleSpace(3)»<action
- ««« «tripleSpace(5)»label="%initDiagramActionLabel"
- ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»"
- ««« «tripleSpace(5)»menubarPath="additions"
- ««« «tripleSpace(5)»enablesFor="1"
- ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction">
- ««« «tripleSpace(3)»</action>
- ««« «tripleSpace(2)»</objectContribution>
- ««« «tripleSpace(1)»</extension>
- ««« «ELSE»
- ««« «tripleSpace(1)»<extension point="org.eclipse.ui.actionSets" id="init-diagram-action">
- ««« «tripleSpace(2)»«xmlGeneratedTag()»
- ««« «tripleSpace(2)»<actionSet
- ««« «tripleSpace(4)»label="%initDiagramActionLabel"
- ««« «tripleSpace(4)»visible="true"
- ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram">
- ««« «tripleSpace(3)»<action
- ««« «tripleSpace(5)»label="%initDiagramActionLabel"
- ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»"
- ««« «tripleSpace(5)»menubarPath="file/additions"
- ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction">
- ««« «tripleSpace(3)»</action>
- ««« «tripleSpace(2)»</actionSet>
- ««« «tripleSpace(1)»</extension>
- ««« «ENDIF»
- ««« «extraLineBreak» «tripleSpace(1)»
- ««« «ENDIF»
- «««
- '''
-
- override outTab() {
- return ' ';
- }
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend
deleted file mode 100644
index a7239df5bc2..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend
+++ /dev/null
@@ -1,122 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.editor.palette
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.AbstractToolEntry
-import org.eclipse.papyrus.gmf.codegen.gmfgen.Palette
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
-import xpt.Common
-import xpt.Common_qvto
-import xpt.providers.ElementTypes
-
-@Singleton class PaletteFactory extends xpt.editor.palette.PaletteFactory {
- @Inject extension Common;
- @Inject extension Common_qvto;
- @Inject extension Utils_qvto;
-
- @Inject ElementTypes xptElementTypes;
-
-
- override PaletteFactory(Palette it) '''
- «copyright(diagram.editorGen)»
- package «packageName»;
-
- «generatedClassComment»
- public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter {
- //RS: New Palette generation
-
- //Generates the ID for the tool elements
- //Generate the tool factory (if(ID) createtool...)
- «FOR tool : collectTools(it)»
- «generateIDAttribute(tool)»
- «ENDFOR»
-
- «««Generates the default constructor
- «generatedMemberComment»
- public «factoryClassName»() {
-
- }
-
- «««Generates the main method to create tool
- «generateCreateTool(it)»
-
- «««Generates the main method to create template
- «generateGetTemplate(it)»
-
- «««Generates each method for tool creation
-
- «FOR tool : collectTools(it)»
- «createTool(tool)»
- «ENDFOR»
-
- }
- '''
-
- def generateCreateTool(Palette it) '''
- «generatedMemberComment»
- public org.eclipse.gef.Tool createTool(String toolId) {
- «FOR tool : collectTools(it)»
- «checkToolID(tool)»
- «ENDFOR»
- // default return: null
- return null;
- }
- '''
-
- def checkToolID(AbstractToolEntry it) '''
- if (toolId.equals(«getConstantIDName(id)»)) {
- return «createMethodName»();
- }
- '''
-
- def generateGetTemplate(Palette it) '''
- «generatedMemberComment»
- public Object getTemplate(String templateId) {
-
- // default return: null
- return null;
- }
- '''
-
- def generateIDAttribute(AbstractToolEntry it) '''
- «generatedMemberComment»
- private final static String «getConstantIDName(id)» = «id»;«IF isQuoted(id,'"')»«nonNLS»«ENDIF»
- '''
-
- def createTool(AbstractToolEntry it) '''
- «generatedMemberComment»
- private org.eclipse.gef.Tool «createMethodName»() {
- «newTool(it as ToolEntry, 'entry')»
- }
- '''
-
- def newTool(ToolEntry it, String toolVarName) '''
- «IF elements.isEmpty()»
- «ERROR('no elements for tool generation (Palette)')»
- «ELSE»
- java.util.List<org.eclipse.gmf.runtime.emf.type.core.IElementType> types = new java.util.ArrayList<org.eclipse.gmf.runtime.emf.type.core.IElementType>(«elements.size»);
- «FOR e : elements»
- types.add(«xptElementTypes.accessElementType(e)»);
- «ENDFOR»
- ««« RS: modified tool creation to have stereotypes-aware tools
- org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF it.genNodes.isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types);
- return tool;
- «ENDIF»
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/Utils_qvto.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/Utils_qvto.xtend
deleted file mode 100644
index 82a90e1bce8..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/Utils_qvto.xtend
+++ /dev/null
@@ -1,208 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2017 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Mickael ADAM (ALL4TEC) - mickael.adam@all4tec.net - Bug 510587
- *
- *****************************************************************************/
-package aspects.xpt.editor.palette
-
-import com.google.inject.Singleton
-import org.eclipse.core.runtime.IPath
-import org.eclipse.core.runtime.Path
-import org.eclipse.emf.common.util.URI
-import org.eclipse.emf.ecore.EObject
-import org.eclipse.emf.ecore.xmi.XMLResource
-import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl
-import org.eclipse.papyrus.gmf.codegen.gmfgen.AbstractToolEntry
-import org.eclipse.papyrus.gmf.codegen.gmfgen.Palette
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry
-import org.eclipse.papyrus.infra.types.ExternallyRegisteredType
-import org.eclipse.papyrus.infra.types.MetamodelTypeConfiguration
-import org.eclipse.papyrus.infra.types.SpecializationTypeConfiguration
-import org.eclipse.papyrus.infra.types.core.IConfiguredHintedElementType
-import java.util.HashMap
-import org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl
-
-@Singleton class Utils_qvto extends xpt.editor.palette.Utils_qvto {
-
- /**
- * collect all tools availables and valid to generate the palette. A tool is not valid when it does not create either a link or a node
- */
- override Iterable<AbstractToolEntry> collectTools(Palette palette) {
- return collectGroups(palette).map[g|g.entries.filter(typeof(AbstractToolEntry))].flatten.filter [ tool |
- isValidTool(tool)
- ]
- }
-
- def boolean isValidTool(AbstractToolEntry entry) {
-
- if (entry instanceof ToolEntry) {
- if (null != entry.qualifiedToolName && !entry.qualifiedToolName.empty) {
- return true;
- }
-
- val links = (entry as ToolEntry).genLinks.size;
- val nodes = (entry as ToolEntry).genNodes.size;
- return nodes + links != 0;
- } else {
- return true;
- }
- }
-
- def String getToolPath(String it) {
- var String result = null
-
- /** returns the '/' separator and then the id of the parent group path */
- if (isQuoted(it, '"')) {
- result = it.substring(1, it.length - 1)
- } else {
- result = it
- }
-
- return "/" + result;
- }
-
- def boolean isQuoted(String source, String quoteStr) {
-
- if (quoteStr == null) {
- return false;
- }
-
- return source.length() >= (quoteStr.length() * 2) && source.startsWith(quoteStr) && source.endsWith(quoteStr);
-
- }
-
- def getConstantIDName(String it) {
- if (isQuoted(it, '"')) {
- return getUpperAndUnderscoreString(it.substring(1, it.length() - 1))
- } else {
- return getUpperAndUnderscoreString(it)
- }
- }
-
- def String getUpperAndUnderscoreString(String value) {
- return value.toUpperCase.replace(".", "_")
- }
-
- /**
- * The plateform protocol prefix.
- */
- var static String PLUGIN_PROTOCOL = "platform:/plugin/"
-
- /**
- * Retrieve the bundle id of a platform/plug-in path.
- *
- * @param initialValue
- * The initial value from which the bundle has to be retrieved
- * @param defaultValue
- * The default bundle id value if bundle id not found
- * @return the bundle id
- */
- def String retrieveBundleId(String initialValue, String defaultValue) {
- var String result = null
- if (initialValue.startsWith(PLUGIN_PROTOCOL)) {
- var String tmp = initialValue.substring(PLUGIN_PROTOCOL.length())
- var int bundleIdEndIndex = tmp.indexOf("/")
- result = tmp.substring(0, bundleIdEndIndex)
- } else {
- result = defaultValue
- }
- return result
- }
-
- /**
- * Retrieve the local path of a platform/plug-in path.
- *
- * @param initialValue
- * the initial value from which the local path has to be retrieved
- * @return the local path
- */
- def String retrieveLocalPath(String initialValue) {
- var String result = ""
- if (initialValue.startsWith(PLUGIN_PROTOCOL)) {
- var String tmp = initialValue.substring(PLUGIN_PROTOCOL.length())
- var int bundleIdEndIndex = tmp.indexOf("/")
- result = tmp.substring(bundleIdEndIndex)
- } else {
- result = initialValue
- }
- return result
- }
-
- /**
- * @return The relative path of the model's resource
- *
- * @param it
- * the EObject to get the relative path
-
- */
- def String getRelativePath(EObject it) {
- var String path = null;
- var URI resourceURI = eResource().getURI()
- if (resourceURI.isPlatformResource()) {
- var String platformString = resourceURI.toPlatformString(true)
- var IPath workspacePath = new Path(platformString)
- workspacePath = workspacePath.removeFirstSegments(1)
- workspacePath = workspacePath.removeLastSegments(1)
- path = workspacePath.toString()
- } else {
- path = "model"
- }
- return path;
- }
-
- /**
- * Get the href string for the elementTypeConfiguration model of the unique identifier.
- */
- def String getElementTypeConfHRef(String uniqueIdentifier, XMLResource resource) {
-
- //Load element type registry
- org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry.getInstance().getClass()
-
- var String href = null
- val type = ElementTypeRegistry.getInstance().getType(uniqueIdentifier)
-
- if (type instanceof IConfiguredHintedElementType) {
- val xmlHelper = new XMLHelperImpl(resource)
- val options = new HashMap<Object, Object>()
- //Set option to have platform:/ sheme instead of ../../..
- options.put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware())
- xmlHelper.options = options;
- href = xmlHelper.getHREF(type.configuration as EObject)
- }
- return href;
-
- }
-
- /**
- * Get the href string for the elementTypeConfiguration model of the unique identifier.
- */
- def String getConfigurationXsiType(String uniqueIdentifier, XMLResource resource) {
- var String type = null
- val eltype = ElementTypeRegistry.getInstance().getType(uniqueIdentifier)
- if (eltype instanceof IConfiguredHintedElementType) {
- var configuration = eltype.configuration
- if (configuration instanceof SpecializationTypeConfiguration) {
- type = "elementtypesconfigurations:SpecializationTypeConfiguration"
- } else if (configuration instanceof MetamodelTypeConfiguration) {
- type = "elementtypesconfigurations:MetamodelTypeConfiguration"
- } else if (configuration instanceof ExternallyRegisteredType) {
- type = "elementtypesconfigurations:ExternallyRegisteredType"
- }
- }
- return type;
-
- }
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend
deleted file mode 100644
index e569ea0b757..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 Anatoliy Tischenko and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Anatoliy Tischenko - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.expressions
-
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import com.google.inject.Inject
-import aspects.xpt.Common
-import com.google.inject.Singleton
-
-@Singleton class AbstractExpression extends xpt.expressions.AbstractExpression {
-
- @Inject extension Common
-
- override performCast(GenDiagram it) '''
- «generatedMemberComment(
- 'Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected')»
- public static Object performCast(Object value, org.eclipse.emf.ecore.EDataType targetType) {
- if (targetType instanceof org.eclipse.emf.ecore.EEnum) {
- if (value instanceof org.eclipse.emf.ecore.EEnumLiteral) {
- org.eclipse.emf.ecore.EEnumLiteral literal = (org.eclipse.emf.ecore.EEnumLiteral) value;
- return (literal.getInstance() != null) ? literal.getInstance() : literal;
- }
- }
- if (false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) {
- return value;
- }
- Class<?> targetClass = targetType.getInstanceClass();
- Number num = (Number) value;
- Class<?> valClass = value.getClass();
- Class<?> targetWrapperClass = targetClass;
- if (targetClass.isPrimitive()) {
- targetWrapperClass = org.eclipse.emf.ecore.util.EcoreUtil.wrapperClassFor(targetClass);
- }
- if (valClass.equals(targetWrapperClass)) {
- return value;
- }
- if (Number.class.isAssignableFrom(targetWrapperClass)) {
- if (targetWrapperClass.equals(Byte.class)) {
- return new Byte(num.byteValue());
- }
- if (targetWrapperClass.equals(Integer.class)) {
- return new Integer(num.intValue());
- }
- if (targetWrapperClass.equals(Short.class)) {
- return new Short(num.shortValue());
- }
- if (targetWrapperClass.equals(Long.class)) {
- return new Long(num.longValue());
- }
- if (targetWrapperClass.equals(java.math.BigInteger.class)) {
- return java.math.BigInteger.valueOf(num.longValue());
- }
- if (targetWrapperClass.equals(Float.class)) {
- return new Float(num.floatValue());
- }
- if (targetWrapperClass.equals(Double.class)) {
- return new Double(num.doubleValue());
- }
- if (targetWrapperClass.equals(java.math.BigDecimal.class)) {
- return new java.math.BigDecimal(num.doubleValue());
- }
- }
- return value;
- }
- '''
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend
deleted file mode 100644
index c89df4f466c..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend
+++ /dev/null
@@ -1,58 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common import xpt.CodeStyle
-
-@Singleton class AbstractNavigatorItem extends xpt.navigator.AbstractNavigatorItem {
- @Inject extension Common;
- @Inject extension CodeStyle
-
- override def registerAdapterFactory(GenNavigator it) '''
- «generatedMemberComment()»
- static {
- @SuppressWarnings("rawtypes")
- final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class };
- final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() {
- «overrideI(it.editorGen.diagram)»
- public String getContributorId() {
- return "«editorGen.plugin.ID»"; «nonNLS(1)»
- }
- };
- org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
-
- «overrideI(it.editorGen.diagram)»
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof «qualifiedClassName(it)» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) {
- return propertySheetPageContributor;
- }
- return null;
- }
-
- «overrideI(it.editorGen.diagram)»
- @SuppressWarnings("rawtypes")
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, «qualifiedClassName(it)».class);
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend
deleted file mode 100644
index a9e354adf56..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import plugin.Activator
-import xpt.Common
-
-@Singleton class DomainNavigatorContentProvider extends xpt.navigator.DomainNavigatorContentProvider {
- @Inject extension Common;
-
- @Inject Activator xptActivator
- @Inject NavigatorContentProvider xptNavigatorContentProvider;
- @Inject DomainNavigatorItem xptDomainNavigatorItem;
-
- override def wrapEObjects(GenNavigator it) '''
- «generatedMemberComment()»
- public Object[] wrapEObjects(Object[] objects, Object parentElement) {
- java.util.Collection<«xptDomainNavigatorItem.qualifiedClassName(it)»> result = new java.util.ArrayList<«xptDomainNavigatorItem.qualifiedClassName(it)»>();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof org.eclipse.emf.ecore.EObject) {
- result.add(new «xptDomainNavigatorItem.qualifiedClassName(it)»((org.eclipse.emf.ecore.EObject) objects[i], parentElement, myAdapterFctoryContentProvier));
- }
- }
- return result.toArray();
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend
deleted file mode 100644
index 8b2724a3003..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import com.google.inject.Inject
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
-import xpt.CodeStyle
-
-@com.google.inject.Singleton class DomainNavigatorItem extends xpt.navigator.DomainNavigatorItem {
- @Inject extension Common;
- @Inject extension CodeStyle
-
- override def registerAdapterFactory(GenNavigator it) '''
- «generatedMemberComment()»
- static {
- @SuppressWarnings("rawtypes")
- final Class[] supportedTypes = new Class[] { org.eclipse.emf.ecore.EObject.class, org.eclipse.ui.views.properties.IPropertySource.class };
- org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
-
- «overrideI(it.editorGen.diagram)»
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof «qualifiedClassName(it)») {
- «qualifiedClassName(it)» domainNavigatorItem = («qualifiedClassName(it)») adaptableObject;
- org.eclipse.emf.ecore.EObject eObject = domainNavigatorItem.getEObject();
- if (adapterType == org.eclipse.emf.ecore.EObject.class) {
- return eObject;
- }
- if (adapterType == org.eclipse.ui.views.properties.IPropertySource.class) {
- return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject);
- }
- }
-
- return null;
- }
-
- «overrideI(it.editorGen.diagram)»
- @SuppressWarnings("rawtypes")
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, «qualifiedClassName(it)».class);
- }
- '''
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend
deleted file mode 100644
index 22d98127b91..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend
+++ /dev/null
@@ -1,394 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Modified by Patrick Tessier (CEA LIST)
- * Emilien Perico (Atos Origin) - update template for GMF 2.2 compliance
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.emf.codegen.util.CodeGenUtil
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigatorReferenceType
-import xpt.CodeStyle
-import xpt.Common_qvto
-import xpt.editor.VisualIDRegistry
-import xpt.navigator.Utils_qvto
-
-@Singleton class NavigatorContentProvider extends xpt.navigator.NavigatorContentProvider {
- @Inject extension Common;
- @Inject extension Common_qvto;
- @Inject extension Utils_qvto;
- @Inject extension CodeStyle
-
- @Inject VisualIDRegistry xptVisualIDRegistry;
-
-
- override NavigatorContentProvider(GenNavigator it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment()»
- public class «className(it)» implements org.eclipse.ui.navigator.ICommonContentProvider {
-
- «attributes(it)»
-
- «constructor(it)»
-
- «genAllMethodNodeCase»
-
- «iContentProvider(it)»
-
- «iStructuredContentProvider(it)»
-
- «iMementoAware(it)»
-
- «iCommonContentProvider(it)»
-
- «iTreeContentProvider(it)»
-
- «additions(it)»
- }
- '''
-
-
-
- override processChanges(GenNavigator it) '''
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = it.next();
- nextResource.unload();
- }
- if (myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
- }
- return true;
- '''
-
- override def initCommonAttributes(GenNavigator it) '''
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «createEditingDomain(it)»;
- myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain;
- @SuppressWarnings("serial")
- java.util.Map<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean> map = new java.util.HashMap<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean>() {
-
- «overrideI(it.editorGen.diagram)»
- public java.lang.Boolean get(java.lang.Object key) {
- if (!containsKey(key)) {
- if (key instanceof org.eclipse.emf.ecore.resource.Resource) {
- put((org.eclipse.emf.ecore.resource.Resource) key, java.lang.Boolean.TRUE);
- }
- }
- return super.get(key);
- }
- };
- myEditingDomain.setResourceToReadOnlyMap(map);
- myViewerRefreshRunnable = new Runnable() {
-
- «overrideI(it.editorGen.diagram)»
- 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() {
-
- «overrideC(it.editorGen.diagram)»
- public void dispose() {
- }
-
- «overrideC(it.editorGen.diagram)»
- public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
- «processChanges(it)»
- }
-
- «overrideC(it.editorGen.diagram)»
- public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
- «processChanges(it)»
- }
-
- «overrideC(it.editorGen.diagram)»
- public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
- «processChanges(it)»
- }
- });
- '''
-
- override def constructor(GenNavigator it) '''
- «generatedMemberComment()»
- public «className(it)»() {
- «initCommonAttributes(it)»
- }
- '''
-
- override dispose(GenNavigator it) '''
- «generatedMemberComment()»
- public void dispose() {
- myWorkspaceSynchronizer.dispose();
- myWorkspaceSynchronizer = null;
- myViewerRefreshRunnable = null;
-
- for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource resource = it.next();
- resource.unload();
- }
-
- ((org.eclipse.emf.transaction.TransactionalEditingDomain) myEditingDomain).dispose();
- myEditingDomain = null;
- }
- '''
-
-
-
- override getFileChildren(GenNavigator it) '''
- «var references = getChildReferencesFrom(it, null)»
- «getFileResource(it)»
- java.util.Collection<Object> result = new java.util.ArrayList<Object>();
- «FOR groupName : getGroupNames(references)»
- «initGroupVariables(groupName, it, references, 'file', null)»
- «ENDFOR»
- java.util.List<org.eclipse.gmf.runtime.notation.View> topViews = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>(resource.getContents().size());
- for (org.eclipse.emf.ecore.EObject o : resource.getContents()) {
- if (o instanceof org.eclipse.gmf.runtime.notation.View) {
- topViews.add((org.eclipse.gmf.runtime.notation.View) o);
- }
- }
- «FOR ref : references»
- «addNavigatorItemsPrefix(ref)»selectViewsByType(resource.getContents(), «getChildViewType(ref.child)»)«addNavigatorItemsSuffix(ref, 'file', false)»
- «ENDFOR»
- «FOR groupName : getGroupNames(references)»
- «addGroups(groupName, references)»
- «ENDFOR»
- return result.toArray();
- '''
-
-
-
- override getViewChildren(GenNavigator it) '''
- «generatedMemberComment()»
- private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) {
- String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view);
- if (vid != null) {
- switch (vid) {
- ««« BEGIN: PapyrusGenCode
- ««« Restructuration of the case
- «FOR node : getNavigatorContainerNodes(it)»
- «caseNavigatorNode(node, it)»
- «ENDFOR»
- «««BEGIN: PapyrusGenCode
- }
- }
- return EMPTY_ARRAY;
- }
- '''
-
- override utilityMethods(GenNavigator it) '''
- «IF getNavigatorContainerNodes(it).notEmpty»
- «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;
- }
-
- «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;
- }
- «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;
- }
-
- «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;
- }
-«««
- «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;
- }
-
- «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;
- }
- «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;
- }
-
- «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;
- }
- «ENDIF»
-
- «generatedMemberComment()»
- private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
- return «VisualIDRegistry::modelID(editorGen.diagram)».equals(«xptVisualIDRegistry.
- getModelIDMethodCall(editorGen.diagram)»(view));
- }
-
-
- «getForeignShortcuts(it)»
- '''
-
- override getForeignShortcuts(GenNavigator it) '''
- «IF editorGen.diagram.generateCreateShortcutAction() && getChildReferencesFrom(it, editorGen.diagram).notEmpty»
-
- «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) { «nonNLS»
- result.add(nextView);
- }
- }
- return createNavigatorItems(result, parent, false);
- }
- «ENDIF»
- '''
-
-
-
- override caseNavigatorNode(GenCommonBase it, GenNavigator navigator) '''
-
- case «VisualIDRegistry::visualID(it)»: {
- «««BEGIN: PapyrusGenCode
- ««« this code has been modified to call directly submethods
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenFor«it.editPartClassName»(view, parentElement);
- «««END: PapyrusGenCode
- }
- '''
-
- override createEditingDomain(GenNavigator it) '''org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain()'''
-
-//BEGIN: PapyrusGenCode
-//Loop to call generator of each method
-def genAllMethodNodeCase(GenNavigator it)'''
-«FOR container :getNavigatorContainerNodes(it)»
-« caseMethodNodeNode(container,it) »
-«ENDFOR»
-
-'''
-//END: PapyrusGenCode
-//BEGIN: PapyrusGenCode
-//this template has been modified to fixe bug generation by GMF framework.
-//Is avoid generated method that are greater than 64Kb
-def caseMethodNodeNode(GenCommonBase it, GenNavigator navigator) '''
-/**
- *
- *Papyrus Template
- *this method is a modification of gmf code in order to avoid getViewChidreen() method becoming greater than 64kb.
- *@generated
-**/
-private Object[] getViewChildrenFor«it.editPartClassName»(org.eclipse.gmf.runtime.notation.View view, Object parentElement){
- java.util.Collection result = new java.util.ArrayList();
- «addForeignShortcuts(it)»
- «var _references = getChildReferencesFrom(navigator, it)»
- «FOR groupNames : getGroupNames(_references)»
- «initGroupVariables(groupNames,navigator, _references, 'parentElement', it)»
- «ENDFOR»
-
-
-
- «IF ! _references.empty»
- «FOR referencesIterator : 1.._references.size»
- «var reference = _references.get(referencesIterator-1)»
- «IF ! reference.findConnectionPaths.empty»
- «FOR pathsIterator : 1..reference.findConnectionPaths.size»
- «var path = reference.findConnectionPaths.get(pathsIterator-1)»
- «IF ! path.segments.empty»
- «FOR segmentsIterator : 1..path.segments.size»
- «var segment = path.segments.get(segmentsIterator-1)»
- «IF referencesIterator==1 && pathsIterator==1 && segmentsIterator==1»java.util.Collection «ENDIF»
- connectedViews = «childrenMethodName(segment.from,reference.referenceType, segment) »
- («IF segmentsIterator==1»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF»
- , «xptVisualIDRegistry.typeMethodCall(segment.to)»);
-
- «ENDFOR»
- «ENDIF»
- «addNavigatorItemsPrefix(reference)»connectedViews«addNavigatorItemsSuffix(reference,'parentElement', reference.referenceType != GenNavigatorReferenceType.CHILDREN_LITERAL) »
- «ENDFOR»
- «ENDIF»
- «ENDFOR»
- «ENDIF»
-
- «FOR groupNames : getGroupNames(_references)»
- « addGroups(groupNames,_references) »
- «ENDFOR»
-
-
- return result.toArray();
-}
-'''
-
-override def String i18nKeyForGroup(String groupName, GenCommonBase contextElement) {
- return 'NavigatorGroupName.' + (if(null != contextElement) contextElement.stringUniqueIdentifier else 'File') + '.' +
- CodeGenUtil::validJavaIdentifier(groupName)
-}
-
-//END: PapyrusGenCod
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend
deleted file mode 100644
index 4d4c9db1b7b..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import com.google.inject.Inject
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
-
-@com.google.inject.Singleton class NavigatorGroup extends xpt.navigator.NavigatorGroup {
- @Inject extension Common;
-
- override def attributes(GenNavigator it) '''
- «generatedMemberComment()»
- private String myGroupName;
-
- «generatedMemberComment()»
- private String myIcon;
-
- «generatedMemberComment()»
- private java.util.Collection<java.lang.Object> myChildren = new java.util.LinkedList<java.lang.Object>();
- '''
-
- override def addChildren(GenNavigator it) '''
- «generatedMemberComment()»
- public void addChildren(java.util.Collection<java.lang.Object> children) {
- myChildren.addAll(children);
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend
deleted file mode 100644
index 28c898455d0..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common import xpt.CodeStyle
-
-@Singleton class NavigatorItem extends xpt.navigator.NavigatorItem {
- @Inject extension Common;
- @Inject extension CodeStyle
-
- override def registerAdapterFactory(GenNavigator it) '''
- «generatedMemberComment()»
- static {
- @SuppressWarnings("rawtypes")
- final Class[] supportedTypes = new Class[] { org.eclipse.gmf.runtime.notation.View.class, org.eclipse.emf.ecore.EObject.class };
- org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
-
- «overrideI(it.editorGen.diagram)»
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof «qualifiedClassName(it)» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) {
- return ((«qualifiedClassName(it)») adaptableObject).getView();
- }
- return null;
- }
-
- «overrideI(it.editorGen.diagram)»
- @SuppressWarnings("rawtypes")
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, «qualifiedClassName(it)».class);
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend
deleted file mode 100644
index 1fa196ea881..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend
+++ /dev/null
@@ -1,66 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Modified by Patrick Tessier (CEA LIST)
- * Emilien Perico (Atos Origin) - update template for GMF 2.2 compliance
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import metamodel.MetaModel
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.LabelModelFacet
-import parsers.ParserProvider
-import plugin.Activator
-import xpt.navigator.Utils_qvto
-
-@Singleton class NavigatorLabelProvider extends xpt.navigator.NavigatorLabelProvider {
- @Inject extension Common;
- @Inject extension Utils_qvto;
-
- @Inject Activator xptActivator;
- @Inject ParserProvider xptParserProvider;
- @Inject MetaModel xptMetaModel;
-
- override def getTextMethodName(GenCommonBase it) '''get«stringUniqueIdentifier»Text'''
-
- override def CharSequence getDiagramLabelText(GenCommonBase it, GenCommonBase elementTypeHolder, LabelModelFacet labelModelFacet) '''
- org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = «xptParserProvider.accessorCall(it, elementTypeHolder, labelModelFacet, 'view.getElement() != null ? view.getElement() : view')»;
- if (parser != null) {
- return parser.getPrintString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(view.getElement() != null ? view.getElement() : view), org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE.intValue());
- } else {
- «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("Parser was not found for label «stringVisualID»"); «nonNLS(1)»
- «returnEmptyString()»
- }
- '''
-
- override def getLabelFeatureText(GenCommonBase it, GenClass genClass) '''
- «IF null != genClass && null != genClass.labelFeature»
- «xptMetaModel.DeclareAndAssign(genClass, 'domainModelElement', 'view.getElement()')»
- if (domainModelElement != null) {
- return «IF !isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»UMLLabelInternationalization.getInstance().getLabel(domainModelElement)«IF !isStringFeature(genClass.labelFeature)»)«ENDIF»;
- } else {
- «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("No domain element for view with visualID = «stringVisualID»"); «nonNLS(1)»
- «returnEmptyString()»
- }
- «ELSE»
- «returnEmptyString()»
- «ENDIF»
- '''
-
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend
deleted file mode 100644
index f86273f438a..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
-import xpt.navigator.Utils_qvto
-
-@Singleton class NavigatorLinkHelper extends xpt.navigator.NavigatorLinkHelper {
- @Inject extension Common;
- @Inject extension Utils_qvto;
-
-
- override findSelection(GenNavigator it) '''
- «generatedMemberComment()»
- public org.eclipse.jface.viewers.IStructuredSelection findSelection(org.eclipse.ui.IEditorInput anInput) {
- «IF getDiagramTopReference(it) !=null»
- «defineDiagramDocument(editorGen.plugin)»
- «ENDIF»
- «findSelectionBody(it)»
- }
- '''
-
- override findSelectionBody(GenNavigator it) '''
- «IF getDiagramTopReference(it) !=null»
- «getDiagramSelection(getDiagramTopReference(it))»
- «ENDIF»
- return org.eclipse.jface.viewers.StructuredSelection.EMPTY;
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend
deleted file mode 100644
index b1c60b4c605..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.navigator
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator
-import xpt.Common
-import xpt.editor.VisualIDRegistry
-
-@Singleton class NavigatorSorter extends xpt.navigator.NavigatorSorter {
- @Inject extension Common;
-
- @Inject VisualIDRegistry xptVisualIDRegistry;
- @Inject NavigatorItem xptNavigatorItem;
-
- override def category(GenNavigator it) '''
- «generatedMemberComment()»
- public int category(Object element) {
- if (element instanceof «xptNavigatorItem.qualifiedClassName(it)») {
- «xptNavigatorItem.qualifiedClassName(it)» item = («xptNavigatorItem.qualifiedClassName(it)») element;
- «IF editorGen.diagram.generateCreateShortcutAction()»
- if (item.getView().getEAnnotation("Shortcut") != null) { «nonNLS(1)»
- return SHORTCUTS_CATEGORY;
- }
- «ENDIF»
- return «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(item.getView()).hashCode();
- }
- return GROUP_CATEGORY;
- }
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend
deleted file mode 100644
index aabd780a585..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend
+++ /dev/null
@@ -1,177 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Florian Noyrit - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.plugin
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExpressionInterpreter
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenPlugin
-import plugin.Activator
-import xpt.Common
-import xpt.editor.DocumentProvider
-import xpt.providers.ElementInitializers
-import xpt.expressions.getExpression
-
-@Singleton class ActivatorImpl extends xpt.plugin.ActivatorImpl {
- @Inject extension Common;
-
- @Inject Activator xptActivator;
- @Inject DocumentProvider xptDocProvider;
- @Inject ElementInitializers xptElementInitializers;
- @Inject getExpression xptExpr;
-
- override ActivatorImpl(GenPlugin it)'''
- «copyright(editorGen)»
- package «xptActivator.packageName(it)»;
-
- «generatedClassComment»
- public class «xptActivator.className(it)» extends org.eclipse.ui.plugin.AbstractUIPlugin {
-
- «attrs(it)»
- «constructor(it)»
- «start(it)»
- «stop(editorGen)»
- «getInstance(it)»
-
- «getPreferenceStore»
-
- «getItemProvidersAdaptorFactory(it)»
- «getItemImageDescriptor(it)»
- «getBundleDescriptorImage(it)»
- «findImageDescriptor(it)»
- «getBundleImage(it)»
- «getString(it)»
- «documentProviderGetter(editorGen.diagram)»
- «linkConstraint(editorGen.diagram)»
- «initializerGetter(editorGen.diagram)»
- «initializerSetter(editorGen.diagram)»
- «providersAccessMethods(it)»
- «logError(it)»
- «logInfo(it)»
- «getLogError(it)»
- «additions(it)»
- }
-'''
-
-override attrs(GenPlugin it)'''
- «generatedMemberComment»
- public static final String ID = "«ID»"; //$NON-NLS-1$
-
- «generatedMemberComment»
- private org.eclipse.papyrus.infra.core.log.LogHelper myLogHelper;
-
- «generatedMemberComment»
- public static final org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint DIAGRAM_PREFERENCES_HINT =
- new org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint(ID);
-
- «generatedMemberComment»
- private static «xptActivator.className(it)» instance;
-
- «generatedMemberComment»
- private org.eclipse.emf.common.notify.AdapterFactory adapterFactory;
-
- «generatedMemberComment»
- private «xptDocProvider.qualifiedClassName(editorGen.diagram)» documentProvider;
-
- «IF editorGen.diagram.links.exists(l| !l.sansDomain)»
- «generatedMemberComment»
- private «editorGen.diagram.getLinkCreationConstraintsQualifiedClassName()» linkConstraints;
- «ENDIF»
-
- «generatedMemberComment»
- private «xptElementInitializers.qualifiedClassName(editorGen.diagram)» initializers;
-
- «IF it.editorGen.expressionProviders != null»
- «FOR p : it.editorGen.expressionProviders.providers.filter(typeof(GenExpressionInterpreter))»
- «generatedMemberComment»
- private «xptExpr.getExpressionInterpriterQualifiedClassName(p)» «p.language»Factory;
- «ENDFOR»
- «ENDIF»
-'''
-
-
-override start(GenPlugin it)'''
- «generatedMemberComment»
- public void start(org.osgi.framework.BundleContext context) throws Exception {
- super.start(context);
- instance = this;
- myLogHelper = new org.eclipse.papyrus.infra.core.log.LogHelper(this);
- org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
- adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory();
- «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer diagramPreferenceInitializer = new «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer();
- diagramPreferenceInitializer.initializeDefaultPreferences();
-
- }
-'''
-
-override stop(GenEditorGenerator it)'''
- «generatedMemberComment»
- public void stop(org.osgi.framework.BundleContext context) throws Exception {
- adapterFactory = null;
- «IF diagram.links.exists(l| !l.sansDomain)»
- linkConstraints = null;
- «ENDIF»
- initializers = null;
- «IF expressionProviders != null»
- «FOR p : expressionProviders.providers.filter(typeof(GenExpressionInterpreter))»
- «p.language»Factory = null;
- «ENDFOR»
- «ENDIF»
- instance = null;
- super.stop(context);
- }
-'''
-
-def getPreferenceStore()'''
- «generatedMemberComment»
- public org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() {
- org.eclipse.jface.preference.IPreferenceStore store=org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
- return store;
- }
-
-'''
-
- override logError(GenPlugin it) '''
- «generatedMemberComment»
- public void logError(String error) {
- getLogHelper().warn(error);
- }
-
- «generatedMemberComment»
- public void logError(String error, Throwable throwable) {
- getLogHelper().error(error, throwable);
- }
- '''
-
- override logInfo(GenPlugin it) '''
- «generatedMemberComment»
- public void logInfo(String message) {
- getLogHelper().info(message);
- }
-
- «generatedMemberComment»
- public void logInfo(String message, Throwable throwable) {
- getLogHelper().error(message, throwable);
- }
- '''
-
- override getLogError(GenPlugin it) '''
- «generatedMemberComment»
- public org.eclipse.papyrus.infra.core.log.LogHelper getLogHelper() {
- return myLogHelper;
- }
- '''
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend
deleted file mode 100644
index 5775d1f9184..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend
+++ /dev/null
@@ -1,83 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2015, 2021 Borland Software Corporation, Christian W. Damus, CEA LIST, Artal and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Thibault Landre (Atos Origin) - add Papyrus dependencies to Papyrus GMF diagram*
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr : add the dependencyorg.eclipse.papyrus.infra.services.edit
- * Christian W. Damus - bug 477384
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.plugin
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenPlugin
-import xpt.Common
-
-@Singleton class manifest extends xpt.plugin.manifest{
-
-@Inject extension Common
-
-override requireBundle(GenPlugin it)'''
-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,
- org.eclipse.papyrus.uml.diagram.common,
- org.eclipse.papyrus.infra.gmfdiag.common,
- org.eclipse.papyrus.uml.service.types,
- org.eclipse.papyrus.infra.widgets,
- org.eclipse.papyrus.infra.ui,
- org.eclipse.papyrus.infra.core.sashwindows.di,
-«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»
-«var reqPlugins = getAllRequiredPlugins()»
-«IF !reqPlugins.contains('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')»
-«var notUsetBooleanVar = reqPlugins.add('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')»
-«ENDIF»
-«FOR reqId : reqPlugins» «reqId»;visibility:=reexport,«extraLineBreak»
-«ENDFOR» org.eclipse.gef,
- org.eclipse.papyrus.infra.gmfdiag.preferences,
- «IF it.eResource.allContents.filter(typeof (GenCommonBase)).filter[node | node.usingDeleteService || node.usingReorientService].size != 0»
- org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors,
- org.eclipse.papyrus.infra.services.edit
- «ELSE»
- org.eclipse.papyrus.extensionpoints.editors
-«ENDIF»
-'''
-
- override def executionEnvironment(GenPlugin it) '''
- Bundle-RequiredExecutionEnvironment: JavaSE-11
- '''
-
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend
deleted file mode 100644
index 6cefc5ab2d8..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend
+++ /dev/null
@@ -1,292 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017, 2021 CEA LIST, ALL4TEC, Artal and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - initial API and implementation
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 510587: the palette must not be generated by using GMF gen
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.plugin
-
-import aspects.xpt.Common
-import aspects.xpt.editor.palette.Utils_qvto
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import java.util.Iterator
-import java.util.List
-import org.eclipse.emf.ecore.EObject
-import org.eclipse.papyrus.gmf.codegen.gmfgen.AbstractToolEntry
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenEditorGenerator
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenPlugin
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolEntry
-import org.eclipse.papyrus.gmf.codegen.gmfgen.ToolGroup
-import xpt.editor.extensions
-import xpt.plugin.pluginUtils
-import java.io.File
-
-@Singleton class plugin extends xpt.plugin.plugin {
-
- @Inject extension Common
- @Inject extension pluginUtils
- @Inject extension Utils_qvto
-
- @Inject extensions xptEditorExtension
- @Inject xpt.diagram.preferences.extensions xptPreferencesExtension
- @Inject xpt.propsheet.extensions xptPropsheetExtension
- @Inject xpt.navigator.extensions xptNavigatorExtension
- @Inject xpt.application.extensions xptApplicationExtension
- @Inject xpt.diagram.updater.extensions xptUpdaterExtension
- @Inject impl.actions.extensions xptActionExtension
- @Inject xpt.providers.extensions xptProvidersExtension
-
- override plugin(GenPlugin it) '''
- <?xml version="1.0" encoding="UTF-8"?>
- <?eclipse version="3.0"?>
- «xcopyright(it.editorGen)»
- <plugin>
- ««««fileTypes()»
- ««««extension_parser()»
- «xptEditorExtension.extensions(it.editorGen)»
- «««global actions handled in the diagram.common plugin
- ««««pluginMenu()»
- «validation(it.editorGen.diagram)»
- «IF it.editorGen.metrics != null»«metrics(it.editorGen.metrics)»«ENDIF»
- «««RS: redefine palette generation
-««« «palettePredefinedEntries(editorGen)»
-««« «paletteEntries(editorGen)»
- «xptPreferencesExtension.extensions(it.editorGen.diagram)»
- «IF it.editorGen.propertySheet != null»«xptPropsheetExtension.extensions(it.editorGen.propertySheet)»«ENDIF»
- «xptProvidersExtension.extensions(it.editorGen.diagram)»
- «IF it.editorGen.navigator != null»«xptNavigatorExtension.extensions(it.editorGen.navigator)»«ENDIF»
- «IF it.editorGen.application != null»«xptApplicationExtension.extensions(it.editorGen.application)»«ENDIF»
- «extensionsConstraintProviders(it.editorGen)»
- «xptUpdaterExtension.extensions(it.editorGen.diagramUpdater)»
- «xptActionExtension.Main(it.editorGen)»
- «additions(it)»
- «notationTypesMap(editorGen)»
-««« «paletteConfiguration(editorGen)»
- </plugin>
- '''
-
-
- /**
- * deprecated: palette configuration are now declared through architecture model.
- */
- def paletteConfiguration(GenEditorGenerator it) '''
-<extension point="org.eclipse.papyrus.infra.gmfdiag.common.paletteDefinition">
- «xmlGeneratedTag»
- <paletteDefinition
- ID="«plugin.ID».paletteconfiguration"
- class="org.eclipse.papyrus.infra.gmfdiag.common.service.palette.ExtendedPluginPaletteProvider"
- name="«plugin.name» Palette"
- path="«relativePath»/«modelID».paletteconfiguration"
- provider="Eclipse Modeling Project">
- <Priority
- name="Lowest">
- </Priority>
- <!-- Specify diagram to which this palette tool relates -->
- <editor
- id="«plugin.ID»">
- </editor>
- </paletteDefinition>
-</extension>
- '''
-
- override additions(GenPlugin it) ''''''
-
- // def category(GenDiagram it) '''«getDiagramPreferencePageCategory()».«editorGen.modelID»'''
-
- //RS: redefine palette generation, using predefined entries
- def palettePredefinedEntries(GenEditorGenerator it) '''
- «xmlGeneratedTag»
- <extension
- id="«plugin.name».palettedefinition"
- name="«plugin.name» Predefined Entries"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- «xmlGeneratedTag»
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Lowest"/>
- <contribution
- factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
-
- «FOR tool : collectTools(diagram.palette)»
- «predefinedEntryDefinition(tool)»
- «ENDFOR»
-
- </contribution>
- </paletteProvider>
-
- </extension>
- '''
-
- //RS: redefine palette generation, using predefined entries
- def paletteEntries(GenEditorGenerator it) '''
- «xmlGeneratedTag»
- <extension
- id="«plugin.name».standard"
- name="«plugin.name» Standard Palette"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- «xmlGeneratedTag»
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Low"/>
- <contribution
- factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
-
- «FOR tool : diagram.palette.groups»
- «groupUsage(tool)»
- «ENDFOR»
- </contribution>
- <editor id="«plugin.ID»"/>
- </paletteProvider>
-
- </extension>
- '''
-
- def groupUsage(ToolGroup it) '''
- <entry
- description="«it.description»"
- id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF»
- kind="«IF it.stack && it.toolsOnly»stack«ELSE»drawer«ENDIF»"
- label="«it.title»"
- large_icon="«largeIconPath»"
- path="«getPath(it)»"
- small_icon="«smallIconPath»">
- <expand
- force="true">
- </expand>
- </entry>
- ««« TODO: call sub entries...
- «FOR entry : it.entries.filter[e| e instanceof ToolEntry]»
- «toolUsage(entry, it)»
- «ENDFOR»
- «FOR entry : it.entries.filter[e| e instanceof ToolGroup]»
- «toolUsage(entry, it)»
- «ENDFOR»
- '''
-
- private def getPath(ToolEntry it) {
- return buildPath(it.eContainer);
- }
-
- private def getPath(ToolGroup it) {
- return buildPath(it.eContainer);
- }
-
- private def buildPath(EObject it) {
- var path = new StringBuilder();
- var container = it;
- while (container instanceof ToolGroup) {
- path.insert(0, getToolPath((container as ToolGroup).id));
- container = container.eContainer;
- }
- return if(path.length() != 0) path.toString else "/" ;
- }
-
- def dispatch toolUsage(ToolEntry it, ToolGroup group) '''
- <predefinedEntry
- id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF»
- path="«getPath(it)»">
- </predefinedEntry>
- '''
-
- def dispatch toolUsage(ToolGroup it, ToolGroup group) '''
- «groupUsage(it)»
- '''
-
- def predefinedEntryDefinition(AbstractToolEntry it) '''
- <entry
- defineOnly="true"
- description="«it.description»"
- id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF»
- kind="tool"
- label="«it.title»"
- large_icon="«largeIconPath»"
- path=""
- small_icon="«smallIconPath»">
- </entry>
- '''
-
- // set notation type mapping extension point
- def notationTypesMap(GenEditorGenerator it) '''
-«tripleSpace(0)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
-«tripleSpace(1)»«xmlGeneratedTag»
-«tripleSpace(1)»<diagramMappings diagramID="«modelID»">
-«tripleSpace(1)» <mapping type="«modelID»" humanReadableType="«modelID.replaceAll('Papyrus|UML|Diagram', '')»Diagram"/>
- «FOR compartment : diagram.compartments»
- «compartmentToTypeMap(compartment)»
- «ENDFOR»
- «FOR link : diagram.links»
- «linksToTypeMap(link)»
- «ENDFOR»
- «FOR externalLabel : diagram.eResource.allContents.filter(typeof (GenExternalNodeLabel)).toIterable»
- «floatingLabelToTypeMap(externalLabel)»
- «externalNodeLabelToTypeMap(externalLabel)»
- «ENDFOR»
-«tripleSpace(1)»</diagramMappings>
-«tripleSpace(0)»</extension>
- '''
- def compartmentToTypeMap(GenCompartment it) '''
- <mapping
- humanReadableType="«title.replaceAll('Compartment', '')»"
- type="«stringVisualID»">
- </mapping>
- '''
-
- def linksToTypeMap(GenLink it) '''
- «FOR label : labels»
- «linkLabelToTypeMap(label)»
- «ENDFOR»
- '''
-
- def linkLabelToTypeMap(GenLinkLabel it)'''
- ««« it is used on a LabelVisibilityPreference...
- «IF labelVisibilityPreference !== null »
- <mapping
- humanReadableType="«labelVisibilityPreference.role»"
- type="«stringVisualID»">
- </mapping>
- «ENDIF»
- '''
-
- def externalNodeLabelToTypeMap(GenExternalNodeLabel it)'''
- «IF labelVisibilityPreference !== null »
- <mapping
- humanReadableType="«labelVisibilityPreference.role»"
- type="«stringVisualID»">
- </mapping>
- «ENDIF»
- '''
-
- def floatingLabelToTypeMap(GenExternalNodeLabel it)'''
- ««« it is used on a ExtensionGenView...
- «IF superEditPart !== null»
- «««...to be extended as floatingLabel
- «IF "FloatingLabelEditPart".equals(name) »
- <mapping
- humanReadableType="Floating Label"
- type="«stringVisualID»">
- </mapping>
- «ENDIF»
- «ENDIF»
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend
deleted file mode 100644
index 5763d0c00aa..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.propsheet
-
-import aspects.xpt.Common
-import aspects.xpt.editor.VisualIDRegistry
-import aspects.xpt.providers.ElementTypes
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenPropertySheet
-
-@Singleton class LabelProvider extends xpt.propsheet.LabelProvider {
- @Inject extension Common;
-
- @Inject ElementTypes xptElementTypes;
- @Inject VisualIDRegistry visualId;
-
- override def unwrapMethods(GenPropertySheet it) '''
- «generatedMemberComment»
- private Object unwrap(Object element) {
- if (element instanceof org.eclipse.jface.viewers.IStructuredSelection) {
- return ((org.eclipse.jface.viewers.IStructuredSelection) element).getFirstElement();
- }
- return element;
- }
-
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.View getView(Object element) {
- if (element instanceof org.eclipse.gmf.runtime.notation.View) {
- return (org.eclipse.gmf.runtime.notation.View) element;
- }
- if (element instanceof org.eclipse.core.runtime.IAdaptable) {
- return (org.eclipse.gmf.runtime.notation.View)
- ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- }
- return null;
- }
-
- «generatedMemberComment»
- private org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(org.eclipse.gmf.runtime.notation.View view) {
- // For intermediate views climb up the containment hierarchy to find the one associated with an element type.
- while (view != null) {
- String vid = «visualId.qualifiedClassName(editorGen.diagram)».getVisualID(view);
- org.eclipse.gmf.runtime.emf.type.core.IElementType etype =
- «xptElementTypes.qualifiedClassName(editorGen.diagram)».getElementType(vid);
- if (etype != null) {
- return etype;
- }
- view = view.eContainer() instanceof org.eclipse.gmf.runtime.notation.View ?
- (org.eclipse.gmf.runtime.notation.View) view.eContainer() : null;
- }
- return null;
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/PropertySection.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/PropertySection.xtend
deleted file mode 100644
index ea4f067f98b..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/PropertySection.xtend
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package aspects.xpt.propsheet
-
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCustomPropertyTab
-
-@Singleton class PropertySection extends xpt.propsheet.PropertySection {
-
- override extendsList(GenCustomPropertyTab it) '''extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.sheet.DefaultPropertySection'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/EditPartProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/EditPartProvider.xtend
deleted file mode 100644
index 0c290ed71de..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/EditPartProvider.xtend
+++ /dev/null
@@ -1,29 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Vincent Lorenzo (CEA-LIST) Add a line to initialize the display of the compartments to true
- * Vincent Lorenzo (CEA-LIST) - Add lines to initialize the display of the labels - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-@Singleton class EditPartProvider extends xpt.providers.EditPartProvider {
-
- override def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.providers.DefaultEditPartProvider'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend
deleted file mode 100644
index 86d8539267d..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2014 Borland Software Corporation, CEA, and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
- * [221347] Got rid of generated interfaces
- * (IObjectInitializer, IFeatureInitializer) and implementation thereof
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Christian W. Damus (CEA) - bug 440263
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import java.util.List
-import metamodel.MetaModel
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenFeatureSeqInitializer
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenFeatureValueSpec
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLanguage
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.TypeModelFacet
-import plugin.Activator
-import xpt.expressions.AbstractExpression
-import xpt.providers.ElementInitializers_qvto
-
-/**
- * XXX should generate this class only when there is initialization logic defined in the model
- */
-@Singleton class ElementInitializers extends xpt.providers.ElementInitializers {
-
- @Inject extension Common;
- @Inject extension ElementInitializers_qvto;
-
- @Inject Activator xptActivator
- @Inject AbstractExpression xptAbstractExpression;
- @Inject MetaModel xptMetaModel
-
- /////////////////////////////////
- override dispatch CharSequence javaMethod(GenNode it) '''
- «IF !it.sansDomain»
- «javaMethod(it.modelFacet, it)»
- «ENDIF»
- '''
-
- override dispatch CharSequence javaMethod(GenLink it) '''
- «IF !it.sansDomain»
- «javaMethod(it.modelFacet, it)»
- «ENDIF»
- '''
-
- override dispatch CharSequence performInit(GenFeatureValueSpec it, GenCommonBase diagramElement, String instanceVar,
- GenClass instanceClass, List<Integer> counters) '''
- «IF it.value.provider.getLanguage() == GenLanguage::LITERAL_LITERAL»
- «xptMetaModel.modifyFeature(feature, instanceVar, instanceClass, value.body)»
- «extraLineBreak»
- «ELSE»
- «var expressionVarName = getVariableName('value', counters)»
- Object «expressionVarName» = «evaluateExpr(value.provider, diagramElement, it, instanceVar)»;
- «IF feature.listType»
- if («expressionVarName» instanceof java.util.Collection) {
- «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».clear();
- «IF feature.typeGenClassifier.expressionResultNeedsCast()»
- for (java.util.Iterator it = ((java.util.Collection) «expressionVarName»).iterator(); it.hasNext(); ) {
- Object next = «xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(it.next(), «xptMetaModel.
- MetaClass(feature.typeGenClassifier)»);
- «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel.
- QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») next);
- }
- «ELSE»
- «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».addAll(((java.util.Collection) «expressionVarName»));
- «ENDIF»
- } else if(«expressionVarName» != null) {
- «IF feature.typeGenClassifier.expressionResultNeedsCast()»
- «expressionVarName» = «xptAbstractExpression
- .qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass(
- feature.typeGenClassifier)»);
- «ENDIF»
- «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel.
- QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») «expressionVarName»);
- }
- «ELSE»
- if(«expressionVarName» != null) {
- «IF feature.typeGenClassifier.expressionResultNeedsCast()»
- «extraLineBreak»
- «expressionVarName» = «
- xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass(
- feature.typeGenClassifier)»);
- «ENDIF»
- «xptMetaModel.setFeatureValue(feature, instanceVar, instanceClass, expressionVarName, true)»;
- }
- «ENDIF/*isListType*/»
- «ENDIF/*is literal expression*/»
- '''
-
- override dispatch CharSequence initMethod(GenFeatureSeqInitializer it, GenCommonBase diagramElement) '''
- «generatedMemberComment»
- public void init_«diagramElement.stringUniqueIdentifier()»(«xptMetaModel.QualifiedClassName(elementClass)» instance) {
- try {
- «FOR i : it.initializers»
- «performInit(i, diagramElement, 'instance', elementClass, <Integer>newLinkedList(initializers.indexOf(i)))»
- «ENDFOR»
- } catch(RuntimeException e) {
- «xptActivator.qualifiedClassName(diagramElement.getDiagram().editorGen.plugin)».getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
- '''
-
- override def initMethodCall(GenCommonBase linkOrNode, TypeModelFacet modelFacet, String newElementVar) '''
- «IF modelFacet.modelElementInitializer != null»
- «elementInitializersInstanceCall(linkOrNode)».init_«linkOrNode.stringUniqueIdentifier»(«newElementVar»);
- «ENDIF»
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers_qvto.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers_qvto.xtend
deleted file mode 100644
index ddddefa956c..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers_qvto.xtend
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2014 Borland Software Corporation, CEA, and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
- * [221347] Got rid of generated interfaces
- * (IObjectInitializer, IFeatureInitializer) and implementation thereof
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Christian W. Damus (CEA) - bug 440263
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenFeatureValueSpec
-
-@Singleton class ElementInitializers_qvto extends xpt.providers.ElementInitializers_qvto {
- @Inject extension Common
-
- override def String javaMethodName(GenCommonBase de, GenFeatureValueSpec valueSpec) {
- var middlePart = ''
- if (valueSpec.featureSeqInitializer.creatingInitializer != null) {
- middlePart = valueSpec.featureSeqInitializer.creatingInitializer.feature.ecoreFeature.name + '_'
- }
- return valueSpec.feature.ecoreFeature.name + '_' + middlePart + de.stringUniqueIdentifier
- }
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend
deleted file mode 100644
index 349299eaa36..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend
+++ /dev/null
@@ -1,176 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2006, 2014 Borland Software Corporation, Christian W. Damus, and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Christian W. Damus - bug 451230
- * Benoit Maggi (CEA LIST) -#510281 change dependency to replace gmft-runtime
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import aspects.xpt.CodeStyle
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.diagram.Utils_qvto
-import xpt.editor.VisualIDRegistry
-import plugin.Activator
-
-@Singleton class ElementTypes extends xpt.providers.ElementTypes {
- @Inject extension Common;
- @Inject extension Utils_qvto;
-
- @Inject CodeStyle xptCodeStyle;
- @Inject VisualIDRegistry xptVisualIDRegistry;
-
- @Inject Activator xptActivator;
-
- override def attributes(GenDiagram it) '''
- «generatedMemberComment»
- private static java.util.Map<org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.ENamedElement> elements;
-
- «generatedMemberComment»
- private static org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages elementTypeImages = new org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages(« //
- xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().getItemProvidersAdapterFactory());
-
- «generatedMemberComment»
- private static java.util.Set<org.eclipse.gmf.runtime.emf.type.core.IElementType> KNOWN_ELEMENT_TYPES;
- '''
-
- override def getElement(GenDiagram it) '''
- «generatedMemberComment('Returns \'type\' of the ecore object associated with the hint.\n')»
- public static synchronized org.eclipse.emf.ecore.ENamedElement getElement(org.eclipse.core.runtime.IAdaptable hint) {
- Object type = hint.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
- if (elements == null) {
- elements = new java.util.IdentityHashMap<org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.ENamedElement>();
- «IF domainDiagramElement != null»«bindUniqueIdentifierToNamedElement(domainDiagramElement, stringUniqueIdentifier())»«ENDIF»
- «FOR node : getAllNodes()»
- «IF node.modelFacet != null»«bindUniqueIdentifierToNamedElement(node.modelFacet, node.stringUniqueIdentifier())»«ENDIF»
- «ENDFOR»
- «FOR link : it.links»
- «IF link.modelFacet != null»«bindUniqueIdentifierToNamedElement(link.modelFacet, link.stringUniqueIdentifier())»«ENDIF»
- «ENDFOR»
- }
- return elements.get(type);
- }
- '''
-
- override def isKnownElementType(GenDiagram it) '''
- «generatedMemberComment»
- public static synchronized boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
- if (KNOWN_ELEMENT_TYPES == null) {
- KNOWN_ELEMENT_TYPES = new java.util.HashSet<org.eclipse.gmf.runtime.emf.type.core.IElementType>();
- «FOR e : it.getAllTypedElements()»
- «addKnownElementType(e)»
- «ENDFOR»
- }
-
- boolean result = KNOWN_ELEMENT_TYPES.contains(elementType);
-
- if (!result) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType[] supertypes = elementType.getAllSuperTypes();
- for (int i = 0; !result && (i < supertypes.length); i++) {
- result = KNOWN_ELEMENT_TYPES.contains(supertypes[i]);
- }
- }
-
- return result;
- }
- '''
-
- override def additions(GenDiagram it) '''
- «super.additions(it)»
-
- «generatedMemberComment»
- public static boolean isKindOf(org.eclipse.gmf.runtime.emf.type.core.IElementType subtype, org.eclipse.gmf.runtime.emf.type.core.IElementType supertype) {
- boolean result = subtype == supertype;
-
- if (!result) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType[] supertypes = subtype.getAllSuperTypes();
- for (int i = 0; !result && (i < supertypes.length); i++) {
- result = supertype == supertypes[i];
- }
- }
-
- return result;
- }
- '''
-
- override def getElementTypeByVisualID(GenDiagram it) '''
- «generatedMemberComment»
- public static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(String visualID) {
- if (visualID != null) {
- switch (visualID) {
- «FOR e : it.getAllTypedElements().filter[el|el.elementType != null]»
- «caseElementType(e)»
- «ENDFOR»
- }
- }
- return null;
- }
- '''
-
- override def getElementType(GenDiagram it) '''
- «generatedMemberComment»
- private static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeByUniqueId(String id) {
- return org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getType(id);
- }
- '''
-
- override def elementTypeField(GenCommonBase it) '''
- «IF null != elementType»
- «generatedMemberComment»
- public static final org.eclipse.gmf.runtime.emf.type.core.IElementType «stringUniqueIdentifier» = getElementTypeByUniqueId("«elementType.
- uniqueIdentifier»"); «nonNLS(1)»
- «ENDIF»
- '''
-
- override def typedInstance(GenDiagram it) '''
- «generatedClassComment»
- public static final org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramElementTypes TYPED_INSTANCE
- = new org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramElementTypes(elementTypeImages) {
-
- «generatedMemberComment»
- «xptCodeStyle.overrideC(it)»
- public boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
- return «qualifiedClassName(it)».isKnownElementType(elementType);
- }
-
- «generatedMemberComment»
- «xptCodeStyle.overrideC(it)»
- public org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeForVisualId(String visualID) {
- return «qualifiedClassName(it)».getElementType(visualID);
- }
-
- «generatedMemberComment»
- «xptCodeStyle.overrideC(it)»
- public org.eclipse.emf.ecore.ENamedElement getDefiningNamedElement(org.eclipse.core.runtime.IAdaptable elementTypeAdapter) {
- return «qualifiedClassName(it)».getElement(elementTypeAdapter);
- }
- };
- '''
-
- override def accessElementType(GenCommonBase it) '''«it.diagram.elementTypesQualifiedClassName».«stringUniqueIdentifier»'''
-
- override def caseElementType(GenCommonBase it) '''
- «xptVisualIDRegistry.caseVisualID(it)»
- return «stringUniqueIdentifier()»;
- '''
-
- override def addKnownElementType(GenCommonBase it) '''
- «IF null != elementType»
- KNOWN_ELEMENT_TYPES.add(«stringUniqueIdentifier()»);
- «ENDIF»
- '''
-} \ No newline at end of file
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/IconProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/IconProvider.xtend
deleted file mode 100644
index 9f521dd78e9..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/IconProvider.xtend
+++ /dev/null
@@ -1,29 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2014 Borland Software Corporation, CEA, and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
- * [221347] Got rid of generated interfaces
- * (IObjectInitializer, IFeatureInitializer) and implementation thereof
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Christian W. Damus (CEA) - bug 440263
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-
-@Singleton class IconProvider extends xpt.providers.IconProvider {
-
- override def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.providers.DefaultElementTypeIconProvider'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend
deleted file mode 100644
index ba61eba2f66..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend
+++ /dev/null
@@ -1,95 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Common
-
-@Singleton class MarkerNavigationProvider extends xpt.providers.MarkerNavigationProvider {
- @Inject extension Common;
-
- override def MarkerNavigationProvider(GenDiagram it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)»
- extends org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider {
-
- «generatedMemberComment»
- public static final String MARKER_TYPE =
- «editorGen.plugin.activatorQualifiedClassName».ID + ".«getValidationDiagnosticMarkerType()»"; «nonNLS(1)»
-
- «generatedMemberComment»
- protected void doGotoMarker(org.eclipse.core.resources.IMarker marker) {
- String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
- if (elementId == null || !(getEditor() instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor)) {
- return;
- }
- org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor editor =
- (org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) getEditor();
- java.util.Map<?, ?> editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
- org.eclipse.emf.ecore.EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
- if (targetView == null) {
- return;
- }
- org.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart) editPartRegistry.get(targetView);
- if (targetEditPart != null) {
- «getDiagramEditorUtilQualifiedClassName()».selectElementsInDiagram(
- editor, java.util.Arrays.asList(new org.eclipse.gef.EditPart[] { targetEditPart }));
- }
- }
-
- «generatedMemberComment»
- public static void deleteMarkers(org.eclipse.core.resources.IResource resource) {
- try {
- resource.deleteMarkers(MARKER_TYPE, true, org.eclipse.core.resources.IResource.DEPTH_ZERO);
- } catch (org.eclipse.core.runtime.CoreException e) {
- «editorGen.plugin.activatorQualifiedClassName».getInstance().logError(
- "Failed to delete validation markers", e); «nonNLS(1)»
- }
- }
-
- «generatedMemberComment»
- public static org.eclipse.core.resources.IMarker addMarker(org.eclipse.core.resources.IFile file,
- String elementId, String location, String message, int statusSeverity) {
- org.eclipse.core.resources.IMarker marker = null;
- try {
- marker = file.createMarker(MARKER_TYPE);
- marker.setAttribute(org.eclipse.core.resources.IMarker.MESSAGE, message);
- marker.setAttribute(org.eclipse.core.resources.IMarker.LOCATION, location);
- marker.setAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, elementId);
- int markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_INFO;
- if (statusSeverity == org.eclipse.core.runtime.IStatus.WARNING) {
- markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_WARNING;
- } else if (statusSeverity == org.eclipse.core.runtime.IStatus.ERROR ||
- statusSeverity == org.eclipse.core.runtime.IStatus.CANCEL) {
- markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_ERROR;
- }
- marker.setAttribute(org.eclipse.core.resources.IMarker.SEVERITY, markerSeverity);
- } catch (org.eclipse.core.runtime.CoreException e) {
- «editorGen.plugin.activatorQualifiedClassName».getInstance().logError(
- "Failed to create validation marker", e); «nonNLS(1)»
- }
- return marker;
- }
- «additions(it)»
- }
- '''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ParserUtils_qvto.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ParserUtils_qvto.xtend
deleted file mode 100644
index 503823c4f81..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ParserUtils_qvto.xtend
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2014 Borland Software Corporation, CEA, and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
- * [221347] Got rid of generated interfaces
- * (IObjectInitializer, IFeatureInitializer) and implementation thereof
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Christian W. Damus (CEA) - bug 440263
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-
-@Singleton class ParserUtils_qvto extends xpt.providers.ParserUtils_qvto {
- @Inject extension Common
-
- override def String parserFieldName(GenCommonBase element) {
- return element.stringUniqueIdentifier.toFirstLower + '_Parser'
- }
-
- override def String parserAccessorName(GenCommonBase element) {
- return 'get' + element.stringUniqueIdentifier.toFirstUpper + '_Parser'
- }
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend
deleted file mode 100644
index 7bc3ee98432..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend
+++ /dev/null
@@ -1,88 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2009, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Ansgar Radermacher (CEA LIST) - added support for EMF validation
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import xpt.Common
-import xpt.editor.Editor
-import xpt.editor.VisualIDRegistry
-
-/**
- * FIXME: [MG] monolithic template with most of the code "same-generated".
- * Unfortunately, a lot of the logic is based around «IF editorGen.application == null» and we don't have a good ways to deal with taht in GMFT-runtimw
- */
-@Singleton class ValidationDecoratorProvider extends xpt.providers.ValidationDecoratorProvider{
- @Inject extension Common;
-
-
- @Inject Editor xptEditor;
- @Inject VisualIDRegistry xptVisualIDRegistry;
-
-
-
-override ValidationDecoratorProvider(GenDiagram it) '''
-«copyright(editorGen)»
-package «packageName(it)»;
-
-«generatedClassComment»
-public class «className(it)»
- extends org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider
- implements org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider {
-
- «generatedMemberComment»
- public void createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) {
- org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) decoratorTarget.getAdapter(org.eclipse.gef.EditPart.class);
- if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart ||
- editPart instanceof org.eclipse.gef.editparts.AbstractConnectionEditPart) {
- Object model = editPart.getModel();
- if ((model instanceof org.eclipse.gmf.runtime.notation.View)) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) model;
- if (!(view instanceof org.eclipse.gmf.runtime.notation.Edge) && !view.isSetElement()) {
- return;
- }
- }
- org.eclipse.gef.EditDomain ed = editPart.getViewer().getEditDomain();
- if (!(ed instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain)) {
- return;
- }
- if (((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain) ed).getEditorPart() instanceof
- «xptEditor.qualifiedClassName(editorGen.editor)») {
- decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
- }
- }
- }
-
- «generatedMemberComment»
- public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
- if (!(operation instanceof org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation)) {
- return false;
- }
- org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget =
- ((org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation) operation).getDecoratorTarget();
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) decoratorTarget.getAdapter(
- org.eclipse.gmf.runtime.notation.View.class);
- return view != null && «VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view));
- }
-
-
- «additions(it)»
-}
-'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend
deleted file mode 100644
index 22c20f0444e..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend
+++ /dev/null
@@ -1,207 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - introduced GenAuditContext entity straightforward and simple #validate() implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenAuditRoot
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagramElementTarget
-import xpt.Common
-import xpt.Common_qvto
-import xpt.GenAuditRoot_qvto
-import xpt.editor.VisualIDRegistry
-import plugin.Activator
-import xpt.CodeStyle
-
-@Singleton class ValidationProvider extends xpt.providers.ValidationProvider {
- @Inject extension Common;
- @Inject extension Common_qvto;
- @Inject extension GenAuditRoot_qvto;
- @Inject extension CodeStyle
-
- @Inject VisualIDRegistry xptVisualIDRegistry;
- @Inject Activator xptActivator
-
-
- override selectors(GenAuditRoot it) '''
- «IF it !=null»
- «IF it.clientContexts !=null»
- «FOR ctx : it.clientContexts»
- «generatedMemberComment»
- public static class «ctx.className» implements org.eclipse.emf.validation.model.IClientSelector {
-
- «generatedMemberComment»
- public boolean selects(Object object) {
- «IF ctx.ruleTargets.filter(typeof(GenDiagramElementTarget)).notEmpty»
- if (isInDefaultEditorContext(object) && object instanceof org.eclipse.gmf.runtime.notation.View) {
- final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) object);
- boolean result = false;
- «FOR e : getTargetDiagramElements(ctx)»
- result = result || «VisualIDRegistry::visualID(e)».equals(id);
- «ENDFOR»
- return result;
- }
- return false;
- «ELSE»
- return isInDefaultEditorContext(object);
- «ENDIF»
- }
- }
- «ENDFOR»
- «ENDIF»
- «ENDIF»
- '''
-
- override constraintAdapters(GenAuditRoot it, GenDiagram diagram) '''
- «IF it !=null»
- «IF diagram.editorGen.expressionProviders != null»
- «FOR next : it.rules.filter[a | a.requiresConstraintAdapter]»
- «constraintAdapter(next, diagram.editorGen.expressionProviders)»
- «ENDFOR»
-
- «IF it.rules.exists[a | a.requiresConstraintAdapter]»
- «constraintAdapters_formatMethod(it)»
- «ENDIF»
- «ENDIF»
- «ENDIF»
- '''
-
- override runWithActiveConstraints(GenDiagram it) '''
- «generatedMemberComment»
- public static void runWithConstraints(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, Runnable operation) {
- final Runnable op = operation;
- Runnable task = new Runnable() {
- «overrideI»
- public void run() {
- try {
- constraintsActive = true;
- op.run();
- } finally {
- constraintsActive = false;
- }
- }
- };
- if(editingDomain != null) {
- try {
- editingDomain.runExclusive(task);
- } catch (Exception e) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation failed", e); «nonNLS(1)»
- }
- } else {
- task.run();
- }
- }
- '''
-
- override def strategy_support(GenDiagram it) '''
- «IF hasDiagramElementTargetRule(editorGen.audits)»
- «generatedMemberComment»
- public static org.eclipse.emf.validation.service.ITraversalStrategy getNotationTraversalStrategy(
- org.eclipse.emf.validation.service.IBatchValidator validator) {
- return new CtxSwitchStrategy(validator);
- }
-
- «generatedMemberComment»
- private static class CtxSwitchStrategy implements org.eclipse.emf.validation.service.ITraversalStrategy {
-
- «generatedMemberComment»
- private org.eclipse.emf.validation.service.ITraversalStrategy defaultStrategy;
-
- «generatedMemberComment»
- private String currentSemanticCtxId;
-
- «generatedMemberComment»
- private boolean ctxChanged = true;
-
- «generatedMemberComment»
- private org.eclipse.emf.ecore.EObject currentTarget;
-
- «generatedMemberComment»
- private org.eclipse.emf.ecore.EObject preFetchedNextTarget;
-
- «generatedMemberComment»
- private final String[] contextSwitchingIdentifiers;
-
- «generatedMemberComment»
- CtxSwitchStrategy(org.eclipse.emf.validation.service.IBatchValidator validator) {
- this.defaultStrategy = validator.getDefaultTraversalStrategy();
- this.contextSwitchingIdentifiers = new String[] {
- «FOR e : getAllTargetDiagramElements(editorGen.audits) SEPARATOR ','»«VisualIDRegistry::visualID(e)»«ENDFOR»
- };
- java.util.Arrays.sort(this.contextSwitchingIdentifiers);
- }
-
- «generatedMemberComment»
- public void elementValidated(org.eclipse.emf.ecore.EObject element,
- org.eclipse.core.runtime.IStatus status) {
- defaultStrategy.elementValidated(element, status);
- }
-
- «generatedMemberComment»
- public boolean hasNext() {
- return defaultStrategy.hasNext();
- }
-
- «generatedMemberComment»
- public boolean isClientContextChanged() {
- if (preFetchedNextTarget == null) {
- preFetchedNextTarget = next();
- prepareNextClientContext(preFetchedNextTarget);
- }
- return ctxChanged;
- }
-
- «generatedMemberComment»
- public org.eclipse.emf.ecore.EObject next() {
- org.eclipse.emf.ecore.EObject nextTarget = preFetchedNextTarget;
- if (nextTarget == null) {
- nextTarget = defaultStrategy.next();
- }
- this.preFetchedNextTarget = null;
- return this.currentTarget = nextTarget;
- }
-
- «generatedMemberComment»
- public void startTraversal(java.util.Collection traversalRoots, org.eclipse.core.runtime.IProgressMonitor monitor) {
- defaultStrategy.startTraversal(traversalRoots, monitor);
- }
-
- «generatedMemberComment»
- private void prepareNextClientContext(org.eclipse.emf.ecore.EObject nextTarget) {
- if (nextTarget != null && currentTarget != null) {
- if (nextTarget instanceof org.eclipse.gmf.runtime.notation.View) {
- final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) nextTarget);
- String nextSemanticId = (id != null && java.util.Arrays.binarySearch(contextSwitchingIdentifiers, id) >= 0) ? id : null;
- if ((currentSemanticCtxId != null && currentSemanticCtxId != nextSemanticId)
- || (nextSemanticId != null && nextSemanticId != currentSemanticCtxId)) {
- this.ctxChanged = true;
- }«/*[artem] not sure why not ctxChanged = <expr>, is it intentional not to reset ctxChanged if condition did not match? I doubt. FIXME?*/»
- currentSemanticCtxId = nextSemanticId;
- } else {
- // context of domain model
- this.ctxChanged = currentSemanticCtxId != null;
- currentSemanticCtxId = null;
- }
- } else {
- this.ctxChanged = false;
- }
- }
- }
- «ENDIF»
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend
deleted file mode 100644
index e253ddbe37a..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend
+++ /dev/null
@@ -1,685 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013, 2017, 2021 Borland Software Corporation, CEA LIST, Artal and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Vincent Lorenzo (CEA-LIST) Add a line to initialize the display of the compartments to true
- * Vincent Lorenzo (CEA-LIST) - Add lines to initialize the display of the labels - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels
- * Vincent Lorenzo (CEA-LIST) - Bug 520733
- * Etienne ALLOGO (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : PapyrusGmfExtension epackage merge into gmfgen
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildLabelNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenChildNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCompartment
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExternalNodeLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLink
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenLinkLabel
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenTopLevelNode
-import org.eclipse.papyrus.gmf.codegen.gmfgen.MetamodelType
-import org.eclipse.papyrus.gmf.codegen.gmfgen.NotationType
-import org.eclipse.papyrus.gmf.codegen.gmfgen.SpecializationType
-import xpt.Common_qvto
-import xpt.diagram.Utils_qvto
-import xpt.diagram.ViewmapAttributesUtils_qvto
-import xpt.diagram.editpolicies.LinkUtils_qvto
-import xpt.diagram.views.ViewStyles
-import xpt.editor.VisualIDRegistry
-
-@Singleton class ViewProvider extends xpt.providers.ViewProvider {
- @Inject extension Common;
- @Inject extension Common_qvto;
-
- @Inject extension Utils_qvto;
- @Inject extension LinkUtils_qvto;
- @Inject extension ViewmapAttributesUtils_qvto;
- @Inject extension VisualIDRegistry;
-
- @Inject VisualIDRegistry xptVisualIDRegistry;
- @Inject ViewStyles xptViewStyles;
-
- override ViewProvider(GenDiagram it) '''
- «copyright(editorGen)»
- package «packageName(it)»;
-
- «generatedClassComment»
- public class «className(it)» «extendsList(it)»«implementsList(it)» {
-
- «generatedMemberComment»
- public final boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
- if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) operation);
- }
- «_assert('operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation')»
-
- /* we check this view provider is the good one for the currently edited diagram */
- if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateChildViewOperation) {
- View container = ((org.eclipse.gmf.runtime.diagram.core.services.view.CreateChildViewOperation) operation).getContainerView();
- Diagram diagram = container.getDiagram();
- if(!getDiagramProvidedId().equals(diagram.getType())) {
- return false;
- }
- }
-
- if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) operation);
- } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) operation);
- } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) operation);
- }
- return false;
- }
-
- «generatedMemberComment»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation op) {
- /*
- if (op.getViewKind() == Node.class)
- return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- if (op.getViewKind() == Edge.class)
- return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- */
-
- // check Diagram Type should be the class diagram
- String modelID = «getModelIDMethodCall(it)»(op.getContainerView());
- if(!getDiagramProvidedId().equals(modelID)) {
- return false;
- }
-
- String visualID = «getVisualIDMethodCall(it)»(op.getSemanticHint());
- if(org.eclipse.gmf.runtime.notation.Node.class.isAssignableFrom(op.getViewKind())) {
- return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID);
- }
-
- return true;
- }
-
- «generatedMemberComment»
- protected String getDiagramProvidedId() {
- /*
- * Indicates for which diagram this provider works for.
- * <p>
- * This method can be overloaded when diagram editor inherits from another one, but should never be <code>null</code>
- * </p>
- *
- * @return the unique identifier of the diagram for which views are provided.
- */
- return «VisualIDRegistry::modelID(it)»;
- }
-
- «generatedMemberComment»«/* When diagram domain element is null only diagram kind is checked */»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation op) {
- return «VisualIDRegistry::modelID(it)».equals(op.getSemanticHint())«IF domainDiagramElement != null» && «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())) != null && !«xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())).isEmpty()«ENDIF»;
- }
-
- «generatedMemberComment»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation op) {
- if (op.getContainerView() == null) {
- return false;
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- String visualID;
- if (op.getSemanticHint() == null) {
- // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
- // In this situation there should be NO elementType, visualID will be determined
- // by VisualIDRegistry.getNodeVisualID() for domainElement.
- if (elementType != null || domainElement == null) {«/* XXX Perhaps, better to fix CanonicalEP instead of this hack? */»
- return false;
- }
- visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement);
- } else {
- visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(op.getSemanticHint());
- if (elementType != null) {«/*
- Semantic hint is specified together with element type.
- Both parameters should describe exactly the same diagram element.
- In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for
- domainElement (if specified) is the same as in element type. */»
-
- if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- return false; // foreign element type
- }
-
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- if (!op.getSemanticHint().equals(elementTypeHint)) {
- return false; // if semantic hint is specified it should be the same as in element type
- }
- //if (domainElement != null && !visualID.equals(«getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) {
- // return false; // visual id for node EClass should match visual id from element type
- //}
- } else {«/*
- Element type is not specified. Domain element should be present (except pure design elements).
- This method is called with EObjectAdapter as parameter from:
- - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint)
- - generated ViewFactory.decorateView() for parent element */»
- «IF ! getAllTypedElements(it).filter[e|e.elementType != null].empty»
- if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(op.getContainerView()))) {
- return false; // foreign diagram
- }
- if (visualID != null) {
- switch (visualID) {
- «IF getAllNodes().exists[e|e.elementType instanceof NotationType]»
- «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(NotationType))»
- «localCaseVisualID(e)»
- «ENDFOR»
- break; // pure design element
- «ENDIF»
- «IF getAllNodes().exists[e|e.elementType instanceof MetamodelType || e.elementType instanceof SpecializationType]»
- «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(MetamodelType))»
- «localCaseVisualID(e)»
- «ENDFOR»
- «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(SpecializationType))»
- «localCaseVisualID(e)»
- «ENDFOR»
- if (domainElement == null || !visualID.equals(«xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) {
- return false; // visual id in semantic hint should match visual id for domain element
- }
- break;«/*FIXME: Perhaps, can return true or false right away, without any further check?*/»
- «ENDIF»
- default:
- return false;
- }
- }
- «ELSE»
- return false;
- «ENDIF»
- }
- }
-
- return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID);
- }
-
- «generatedMemberComment»«/* XXX: unlike createNode, we don't check op.containerView() for null here. On purpose? */»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation op) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
-
- if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- return false; // foreign element type
- }
-
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
- return false; // our hint is visual id and must be specified, and it should be the same as in element type
- }
- //String visualID = «getVisualIDMethodCall(it)»(elementTypeHint);
- //org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- //if (domainElement != null && !visualID.equals(«getLinkWithClassVisualIDMethodCall(it)»(domainElement))) {
- // return false; // visual id for link EClass should match visual id from element type
- //}
- return true; «««Does it make sense to check visualID here, like we did for nodes?
- }
-
-
- «generatedMemberComment»
- @SuppressWarnings("unchecked")
- public org.eclipse.gmf.runtime.notation.Diagram createDiagram(org.eclipse.core.runtime.IAdaptable semanticAdapter, String diagramKind, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();«/* FIXME instantiate diagramRunTimeClass instead */»
- org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils.stampCurrentVersion(diagram);«/* Papyrus specific diagram versioning */»
- diagram.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle());
- «xptViewStyles.addCustomStyles(it, 'diagram.getStyles()')»
- diagram.setType(«VisualIDRegistry::modelID(it)»);
- diagram.setElement(«IF domainDiagramElement != null»getSemanticElement(semanticAdapter)«ELSE»null«ENDIF»);
- «IF units != null»
- diagram.setMeasurementUnit(org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpperCase»_LITERAL);
- «ENDIF»
- «IF ! styles.empty»
- // initializeFromPreferences
- org.eclipse.jface.preferences.IPreferenceStore store = (org.eclipse.jface.preferences.IPreferenceStore) preferencesHint.getPreferenceStore();
- «initializeStyles(it, 'diagram', 'store', false, false, false)»
- «ENDIF»
- return diagram;
- }
-
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node createNode(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- final org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(semanticAdapter);
- final String visualID;
- if (semanticHint == null) {
- visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(containerView, domainElement);
- } else {
- visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(semanticHint);
- }
- if (visualID != null) {
- switch(visualID) {
- «FOR n : getAllNodes()»
- «xptVisualIDRegistry.caseVisualID(n)»
- return create«n.stringUniqueIdentifier»(domainElement, containerView, index, persisted, preferencesHint);
- «ENDFOR»
- }
- }
- // can't happen, provided #provides(CreateNodeViewOperation) is correct
- return null;
- }
-
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Edge createEdge(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(semanticAdapter);
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(elementTypeHint);
- if (vid != null) {
- switch (vid) {
- «FOR link : links»
- «xptVisualIDRegistry.caseVisualID(link)»
- return create«link.stringUniqueIdentifier»(«IF isTypeLink(link)» getSemanticElement(semanticAdapter), «ENDIF»containerView, index, persisted, preferencesHint);
- «ENDFOR»
- }
- }
- // can never happen, provided #provides(CreateEdgeViewOperation) is correct
- return null;
- }
-
- «FOR next : getAllNodes()»
- «createNodeMethod(next)»
- «ENDFOR»
- «FOR next : links»
- «createEdgeMethod(next)»
- «ENDFOR»
-
- «IF ! topLevelNodes.empty»
- «generatedMemberComment»
- protected void stampShortcut(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.Node target) {
- if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(containerView))) {
- «addShortcutAnnotation(it, 'target')»
- }
- }
- «ENDIF»
-
- «IF links.map[l|l.labels].flatten.notEmpty || topLevelNodes.map[n|n.labels].flatten.notEmpty || childNodes.map[n|n.labels].flatten.notEmpty»
- «generatedMemberComment»
- protected org.eclipse.gmf.runtime.notation.Node createLabel(org.eclipse.gmf.runtime.notation.View owner, String hint) {
- org.eclipse.gmf.runtime.notation.DecorationNode rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDecorationNode();
- rv.setType(hint);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true);
- return rv;
- }
- «ENDIF»
-
- «IF getAllNodes().map[n|n.compartments].flatten.notEmpty»
- «generatedMemberComment»
- protected org.eclipse.gmf.runtime.notation.Node createCompartment(org.eclipse.gmf.runtime.notation.View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) {
- //SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
- //rv.setShowTitle(showTitle);
- //rv.setCollapsed(isCollapsed);
- org.eclipse.gmf.runtime.notation.Node rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBasicCompartment();
-
- rv.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
-
- if (hasTitle) {
- org.eclipse.gmf.runtime.notation.TitleStyle ts = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle();
- rv.getStyles().add(ts);
- }
- if (canSort) {
- rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createSortingStyle());
- }
- if (canFilter) {
- rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFilteringStyle());
- }
- rv.setType(hint);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true);
- return rv;
- }
- «ENDIF»
-
- «getSemanticElementMethod(it)»
- «getSemanticElementTypeMethod(it)»
- «additions(it)»
- }
- '''
-
-
-
- override dispatch createNodeMethod(GenNode it) '''
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- «IF canUseShapeStyle(viewmap)»
- org.eclipse.gmf.runtime.notation.Shape node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape();
- «ELSE»
- org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createNode();
- node.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());«/* FIXME Contionally add this style, whether toolsmith needs Notes or not */»
- «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, 'node.getStyles()')»
- «ENDIF»
- «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')»
- «xptViewStyles.addCustomStyles(it, 'node.getStyles()')»
- node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
- node.setType(«xptVisualIDRegistry.typeMethodCall(it)»);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- «IF it instanceof GenTopLevelNode»
- stampShortcut(containerView, node);
- «ENDIF»
- // initializeFromPreferences «/* XXX Perhaps, do init only once, for complete figure? */»
- final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «initializeStyles(it, 'node', 'prefStore', !isFixedForeground(viewmap), !isFixedBackground(viewmap), !isFixedFont(viewmap))»
- «FOR label : it.labels»
- «initLabel(label, 'node', 'prefStore')»
- «ENDFOR»
- «FOR comp : it.compartments»
- «initCompartment(comp, 'node', 'prefStore')»
- «ENDFOR»
- ««« BEGIN Papyrus Modification
- «IF compartments.size != 0»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(«'node'», «'prefStore'», "«elementType.displayName»");
- «ENDIF»
- ««« END Papyrus Modification
- «initLabelVisibility(it,'node', 'prefStore')»
- return node;
- }
- '''
-
- // Location as layoutConstraint, no children
- override dispatch createNodeMethod(GenChildLabelNode it) '''
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());«/* [artem] XXX not sure, why LabelNode needs location */»
- «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')»
- «xptViewStyles.addCustomStyles(it, 'node.getStyles()')»
- node.setType(«xptVisualIDRegistry.typeMethodCall(it)»);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
-
- final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «initFontFromPrefs(it,'node', 'prefStore')»
- «initForegroundFromPrefs(it,'node', 'prefStore')»
- return node;
- }
- '''
-
- override createEdgeMethod(GenLink it) '''
- «generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Edge create«stringUniqueIdentifier»(«IF isTypeLink(it)»org.eclipse.emf.ecore.EObject domainElement, «ENDIF»org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- «IF isFixedForeground(viewmap)»
- org.eclipse.gmf.runtime.notation.Edge edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createEdge();
- edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRoutingStyle());
- «ELSE»
- org.eclipse.gmf.runtime.notation.Connector edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createConnector();
- «ENDIF»
- «IF !isFixedFont(viewmap)»
- edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle());
- «ENDIF»
- «xptViewStyles.addCustomStyles(it, 'edge.getStyles()')»
- org.eclipse.gmf.runtime.notation.RelativeBendpoints bendpoints = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRelativeBendpoints();
- java.util.List<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint> points = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint>(2);
- points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint());
- points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint());
- bendpoints.setPoints(points);
- edge.setBendpoints(bendpoints);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, edge, index, persisted);
- edge.setType(«xptVisualIDRegistry.typeMethodCall(it)»);
- edge.setElement(«IF isTypeLink(it)»domainElement«ELSE»null«ENDIF»);
- // initializePreferences
- final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «initializeStyles(it, 'edge', 'prefStore', !isFixedForeground(viewmap), false, !isFixedFont(viewmap))»
- //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- //if (routing != null) {
- // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- //}
- «initRountingFromPrefs(it,'edge', 'prefStore')»
- «FOR label : it.labels»
- «initLabel(label, 'edge', 'prefStore')»
- «ENDFOR»
- «initLabelVisibility(it,'edge', 'prefStore')»
- return edge;
- }
- '''
-
- override getSemanticElementMethod(GenDiagram it) '''
- «generatedMemberComment»
- protected org.eclipse.emf.ecore.EObject getSemanticElement(org.eclipse.core.runtime.IAdaptable semanticAdapter) {
- if (semanticAdapter == null) {
- return null;
- }
- org.eclipse.emf.ecore.EObject eObject = (org.eclipse.emf.ecore.EObject) semanticAdapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- if (eObject != null) {
- return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.resolve(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(eObject), eObject);
- }
- return null;
- }
- '''
-
- override getSemanticElementTypeMethod(GenDiagram it) '''
- «generatedMemberComment»
- protected org.eclipse.gmf.runtime.emf.type.core.IElementType getSemanticElementType(org.eclipse.core.runtime.IAdaptable semanticAdapter) {
- if (semanticAdapter == null) {
- return null;
- }
- return (org.eclipse.gmf.runtime.emf.type.core.IElementType) semanticAdapter.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
- }
- '''
- override initLabel(GenLabel it, String nodeVar, String prefStoreVar) '''
- «var String labelVar = it.stringUniqueIdentifier.toFirstLower»
- org.eclipse.gmf.runtime.notation.Node «labelVar» = createLabel(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)»);
- «IF it.modelFacet !=null»
- «xptViewStyles.addTextStyle(it.modelFacet, labelVar + '.getStyles()')»
- «ENDIF»
- «xptViewStyles.addCustomStyles(it, labelVar + '.getStyles()')»
- «IF it.oclIsKindOf(typeof(GenExternalNodeLabel)) || it.oclIsKindOf(typeof(GenLinkLabel))»
- «labelVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());
- «xptViewStyles.offset(it, labelVar)»
- «ENDIF»
- «initializeStyles(it, labelVar, prefStoreVar, false, false, false)»
- '''
-
- override def initCompartment(GenCompartment it, String nodeVar, String prefStoreVar) '''
- «var String compartmentVar= it.stringUniqueIdentifier.toFirstLower»
- «IF it.styles.notEmpty || isStoringChildPositions(it.layoutType)»org.eclipse.gmf.runtime.notation.Node «compartmentVar» = «ENDIF»createCompartment(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)», «canCollapse», «needsTitle», «listLayout», «listLayout»);
- «xptViewStyles.addCustomStyles(it, compartmentVar + '.getStyles()')»
- «IF isStoringChildPositions(it.layoutType)»
- «IF viewmap.canUseShapeStyle()»
- «compartmentVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle());
- «ELSE /* Intentionally not adding Description style, as it deemed to be useless for compartments (can't avoid for ShapeStyle - benefits of a single style overwheight drawbacks of Description presence) */»
- «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, compartmentVar + '.getStyles()')»
- «ENDIF»
- «compartmentVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
- «initializeStyles(it, compartmentVar, prefStoreVar, !viewmap.isFixedForeground(), !viewmap.isFixedBackground(), !viewmap.isFixedFont())»
- «ELSE»
- «initializeStyles(it, compartmentVar, prefStoreVar, false, false, false)»
- «ENDIF»
- '''
-
-override additions(GenDiagram it)'''
-
- «generatedMemberComment»
- private void initFontStyleFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
- {
- String fontConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.FONT);
- String fontColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FONT);
-
- org.eclipse.gmf.runtime.notation.FontStyle viewFontStyle = (org.eclipse.gmf.runtime.notation.FontStyle) view.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FONT_STYLE);
- if (viewFontStyle != null)
- {
- org.eclipse.swt.graphics.FontData fontData = org.eclipse.jface.preference.PreferenceConverter.getFontData(store, fontConstant);
- viewFontStyle.setFontName(fontData.getName());
- viewFontStyle.setFontHeight(fontData.getHeight());
- viewFontStyle.setBold((fontData.getStyle() & org.eclipse.swt.SWT.BOLD) != 0);
- viewFontStyle.setItalic((fontData.getStyle() & org.eclipse.swt.SWT.ITALIC) != 0);
-
- org.eclipse.swt.graphics.RGB fontRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, fontColorConstant);
- viewFontStyle.setFontColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
- }
-
- «generatedMemberComment»
- private void initForegroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
- {
- String lineColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE);
- org.eclipse.swt.graphics.RGB lineRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, lineColorConstant);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(lineRGB));
- }
-
- «generatedMemberComment»
- private void initBackgroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
- {
- String fillColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL);
- String gradientColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName,org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT);
- String gradientPolicyConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName,org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.GRADIENT_POLICY);
-
-
- org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, fillColorConstant);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB));
-
-
- org.eclipse.gmf.runtime.notation.FillStyle fillStyle = (org.eclipse.gmf.runtime.notation.FillStyle) view
- .getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FILL_STYLE);
- fillStyle
- .setFillColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB).intValue());
-
- ;
- if (store.getBoolean(gradientPolicyConstant)) {
- org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
- store.getString(gradientColorConstant));
- fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
- fillStyle
- .setTransparency(gradientPreferenceConverter.getTransparency());
- }
- }
-
-
-'''
-
-override initFontFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar)'''
- «specificInitFontFromPrefs(it,viewVar, prefStoreVar)»
-'''
-
-
-def specificInitFontFromPrefs(GenNode it,String viewVar, String prefStoreVar)'''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitFontFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) '''
-«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitFontFromPrefs(GenLink it,String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitFontFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
-«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-
-
-override initForegroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
- «specificInitForegroundFromPrefs(it,viewVar, prefStoreVar)»
-'''
-
-def specificInitForegroundFromPrefs(GenNode it,String viewVar, String prefStoreVar)'''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitForegroundFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitForegroundFromPrefs(GenLink it,String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitForegroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
-'''
-
-
-
-
-
-override initBackgroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
- « specificInitBackgroundFromPrefs(it,viewVar, prefStoreVar) »
-'''
-
-def specificInitBackgroundFromPrefs(GenNode it,String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitBackgroundFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitBackgroundFromPrefs(GenLink it, String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitBackgroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
-'''
-
-
-def initRountingFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
- « specificInitRountingFromPrefs(it,viewVar, prefStoreVar)»
-'''
-
-def specificInitRountingFromPrefs(GenNode it,String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitRountingFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitRountingFromPrefs(GenLink it, String viewVar, String prefStoreVar) '''
- «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-def specificInitRountingFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) '''
-'''
-
-//write the line to initialize the property isVisible for the label of the link
-def initLabelVisibility(GenLink it,String viewVar, String prefStoreVar) '''
-
- «IF it.labels.filter(typeof (GenLinkLabel)).exists[lbl | lbl.labelVisibilityPreference !== null]»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-//write the line to initialize the property isVisible for the label of the link
-def initLabelVisibility(GenNode it,String viewVar, String prefStoreVar) '''
- «IF it.labels.filter(typeof (GenExternalNodeLabel)).exists[lbl | lbl.labelVisibilityPreference !== null]»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-'''
-
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend
deleted file mode 100644
index 321df416522..00000000000
--- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend
+++ /dev/null
@@ -1,228 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2007, 2010, 2013, 2017 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #386838 - migrate to Xtend2
- * Vincent Lorenzo (CEA-LIST) - Bug 520882
- *
- *****************************************************************************/
-package aspects.xpt.providers
-
-import aspects.xpt.Common
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenCommonBase
-import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram
-import org.eclipse.papyrus.gmf.codegen.gmfgen.MetamodelType
-import org.eclipse.papyrus.gmf.codegen.gmfgen.NotationType
-import org.eclipse.papyrus.gmf.codegen.gmfgen.SpecializationType
-import parsers.ParserProvider
-import xpt.diagram.Utils_qvto
-import xpt.diagram.edithelpers.EditHelper
-import xpt.diagram.edithelpers.EditHelperAdvice
-import xpt.providers.ShortcutsDecoratorProvider
-
-@Singleton class extensions extends xpt.providers.extensions {
- @Inject extension Common;
- @Inject extension Utils_qvto;
-
- @Inject ViewProvider viewProvider;
- @Inject xpt.providers.IconProvider iconProvider;
- @Inject xpt.providers.EditPartProvider editPartProvider;
- @Inject ParserProvider labelParsers;
- @Inject ShortcutsDecoratorProvider shorcutProvider;
- @Inject VisualTypeProvider visualTypeProvider;
- @Inject EditHelper editHelper;
- @Inject EditHelperAdvice editHelperAdvice;
-
- override extensions(GenDiagram it) '''
- «extraLineBreak»
- «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">
- «tripleSpace(2)»«xmlGeneratedTag»
- «tripleSpace(2)»<viewProvider class="«viewProvider.qualifiedClassName(it)»">
- «tripleSpace(3)»<Priority name="«notationViewProviderPriority»"/>
- «IF ! shortcutsProvidedFor.empty/*allow provider activation when another diagram tries to create a node, perhaps ours*/»
- «tripleSpace(3)»<object id="referencing-diagrams" class="org.eclipse.gmf.runtime.notation.Diagram">
- «tripleSpace(4)»<method name="getType()" value="«FOR s : shortcutsProvidedFor SEPARATOR ','»«s»«ENDFOR»"/>
- «tripleSpace(3)»</object>
- «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" containerViews="referencing-diagrams"/>
- «ENDIF»
- «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="«editorGen.modelID»"/>
- «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="«commaSeparatedVisualIDs(allNodes)»"/>
- «IF ! links.empty/*it is unlikely there would be a diagram without a node, but a diagram without links deemed possible */»
- «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="«commaSeparatedVisualIDs(links)»"/>
- «ENDIF»
- «tripleSpace(2)»</viewProvider>
- «tripleSpace(1)»</extension>
-
- «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider">
- «tripleSpace(2)»«xmlGeneratedTag»
- «tripleSpace(2)»<editpartProvider class="«editPartProvider.qualifiedClassName(it)»">
- «tripleSpace(3)»<Priority name="«editPartProviderPriority»"/>
- «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram">
- «tripleSpace(4)»<method name="getType()" value="«editorGen.modelID»"/>
- «tripleSpace(3)»</object>
- «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes">
- «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(allNodes)»"/>
- «tripleSpace(3)»</object>
- «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links">
- «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(links)»"/>
- «tripleSpace(3)»</object>
- «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels">
- «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(allNodes.map[n|n.labels].flatten)»"/>
- «tripleSpace(3)»</object>
- «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments">
- «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(compartments)»"/>
- «tripleSpace(3)»</object>
- «tripleSpace(3)»<context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/>
- «tripleSpace(2)»</editpartProvider>
- «tripleSpace(1)»</extension>
-
-««« «modelingAssistantProvider(it)»
-
- «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider">
- «tripleSpace(2)»«xmlGeneratedTag»
- «tripleSpace(2)»<IconProvider class="«iconProvider.qualifiedClassName(it)»">
- «tripleSpace(3)»<Priority name="«iconProviderPriority»"/>
- «tripleSpace(2)»</IconProvider>
- «tripleSpace(1)»</extension>
- «IF editorGen.labelParsers != null && editorGen.labelParsers.extensibleViaService»
- «extraLineBreak»
- «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider">
- «tripleSpace(2)»«xmlGeneratedTag»
- «tripleSpace(2)»<ParserProvider class="«labelParsers.qualifiedClassName(editorGen.labelParsers)»">
- «tripleSpace(3)»<Priority name="«editorGen.labelParsers.providerPriority»"/>
- «tripleSpace(2)»</ParserProvider>
- «tripleSpace(1)»</extension>
- «ENDIF»
- «IF generateShortcutIcon()»
- «extraLineBreak»
- «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders" id="decorator-provider">
- «tripleSpace(2)»«xmlGeneratedTag»
- «tripleSpace(2)»<decoratorProvider class="«shorcutProvider.qualifiedClassName(it)»">
- «tripleSpace(3)»<Priority name="«shortcutsDecoratorProviderPriority»"/>
- «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)" id="generated-top-nodes">
- «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(it.topLevelNodes)/*generated code supports shortcuts only to top-level nodes*/»"/>
- «tripleSpace(3)»</object>
- «tripleSpace(3)»<context decoratorTargets="generated-top-nodes"/>
- «tripleSpace(2)»</decoratorProvider>
- «tripleSpace(1)»</extension>
- «ENDIF»
-
-««« commented for bug 520882
-««« «IF !getLocalDefineTypedElements(it).empty»
-««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
-««« «tripleSpace(2)»«xmlGeneratedTag»
-««« «FOR e : getLocalDefineTypedElements(it)»
-««« «elementTypeSafe(e.elementType)»
-««« «ENDFOR»
-««« «tripleSpace(1)»</extension>
-««« «ENDIF»
-«««
-««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings">
-««« «tripleSpace(2)»«xmlGeneratedTag»
-««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size<1»
-««« «tripleSpace(2)»<clientContext id="«editorGen.plugin.ID».TypeContext">
-««« «tripleSpace(3)»<enablement>
-««« «tripleSpace(4)»<test
-««« «tripleSpace(5)»property="org.eclipse.gmf.runtime.emf.core.editingDomain"
-««« «tripleSpace(5)»value="«editingDomainID»"/>
-««« «tripleSpace(3)»</enablement>
-««« «tripleSpace(2)»</clientContext>
-««« «tripleSpace(2)»<binding context="«editorGen.plugin.ID».TypeContext">
-««« «ENDIF»
-««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0»
-«««
-««« <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
-««« «ENDIF»
-««« «FOR e : getLocalDefineTypedElements(it)»
-««« «tripleSpace(3)»<elementType ref="«e.elementType.uniqueIdentifier»"/>
-««« «ENDFOR»
-««« «tripleSpace(3)»<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
-««« «tripleSpace(2)»</binding>
-««« «tripleSpace(1)»</extension>
-
- «extraLineBreak»
- «tripleSpace(1)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders">
- «tripleSpace(2)»«xmlGeneratedTag»
- «tripleSpace(2)»<visualTypeProvider
- «tripleSpace(4)»class="«visualTypeProvider.qualifiedClassName(it)»"
- «tripleSpace(4)»diagramType="«editorGen.modelID»">
- «tripleSpace(3)»</visualTypeProvider>
- «tripleSpace(1)»</extension>
- '''
-
- def getLocalDefineTypedElements(GenDiagram it) {
- getAllTypedElements(it).filter[et| false == et.elementType.definedExternally]
- }
-// override modelingAssistantProvider(GenDiagram it) '''
-//
-// <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders" id="modelassist-provider">
-// «xmlGeneratedTag»
-// <modelingAssistantProvider class="«getModelingAssistantProviderQualifiedClassName()»">
-// <Priority name="«modelingAssistantProviderPriority»"/>
-// <object class="«getEditPartQualifiedClassName()»" id="«getUniqueIdentifier()»"/>
-// «FOR n :topLevelNodes»
-// <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/>
-// «ENDFOR»
-// «FOR n:childNodes»
-// <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/>
-// «ENDFOR»
-// <context elements="«getUniqueIdentifier()»,«FOR n : topLevelNodes SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOR»,«FOR n : childNodes SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOR»"/>
-// </modelingAssistantProvider>
-// </extension>
-//
-//
-// '''
-
- override def commaSeparatedVisualIDs(Iterable<? extends GenCommonBase> list) '''«FOR gcb : list SEPARATOR ','»«gcb.stringUniqueIdentifier»«ENDFOR»'''
-
- override def dispatch elementType(MetamodelType it) '''
- «tripleSpace(2)»<metamodel nsURI="«getMetaClass().genPackage.getEcorePackage.nsURI»">
- «tripleSpace(3)»<metamodelType
- «tripleSpace(5)»id="«uniqueIdentifier»"
- «IF null != displayName»
- «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»"
- «ENDIF»
- «tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- «tripleSpace(5)»eclass="«getMetaClass().ecoreClass.name»"
- «tripleSpace(5)»edithelper="«editHelper.qualifiedClassName(it)»">
- «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/>
- «tripleSpace(3)»</metamodelType>
- «tripleSpace(2)»</metamodel>
- '''
-
- override def specializationType(SpecializationType it) '''
- «tripleSpace(3)»<specializationType
- «tripleSpace(5)»id="«uniqueIdentifier»"
- «IF null != displayName»
- «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»"
- «ENDIF»
- «tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"«IF editHelperAdviceClassName != null»
- «tripleSpace(5)»edithelperadvice="«editHelperAdvice.qualifiedClassName(it)»"«ENDIF»>
- «tripleSpace(4)»<specializes id="«IF (null == metamodelType)»org.eclipse.gmf.runtime.emf.type.core.null«ELSE»«metamodelType.
- uniqueIdentifier»«ENDIF»"/>
- «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/>
- «tripleSpace(3)»</specializationType>
- '''
-
- override def dispatch elementType(NotationType it) '''
- «tripleSpace(2)»<specializationType
- «tripleSpace(4)»id="«uniqueIdentifier»"
- «IF null != displayName»
- «tripleSpace(4)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»"
- «ENDIF»
- «tripleSpace(4)»kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
- «tripleSpace(3)»<specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- «tripleSpace(3)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/>
- «tripleSpace(2)»</specializationType>
- '''
-}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.releng.dev.release/release.xml b/plugins/toolsmiths/org.eclipse.papyrus.releng.dev.release/release.xml
index 1ec097f2d72..34f545d24e1 100755
--- a/plugins/toolsmiths/org.eclipse.papyrus.releng.dev.release/release.xml
+++ b/plugins/toolsmiths/org.eclipse.papyrus.releng.dev.release/release.xml
@@ -17,7 +17,6 @@
<feature name="org.eclipse.license" version="2.0.2" license="true"/>
<feature name="org.eclipse.papyrus.gmf.tooling.feature" version="3.3.0"/>
<plugin name="org.eclipse.papyrus.codegen" version="1.2.0"/>
- <plugin name="org.eclipse.papyrus.def" version="1.3.100"/>
<plugin name="org.eclipse.papyrus.gmfgenextension" version="2.0.0"/>
<plugin name="org.eclipse.papyrus.dev.assistants.codegen" version="1.2.100"/>
<plugin name="org.eclipse.papyrus.mwe2.utils" version="1.2.0"/>
@@ -88,7 +87,6 @@
<plugin name="org.eclipse.papyrus.bundles.tests" version="1.3.0"/>
<plugin name="org.eclipse.papyrus.codegen" version="1.2.0"/>
<plugin name="org.eclipse.papyrus.customization.nattableconfiguration" version="2.0.100"/>
- <plugin name="org.eclipse.papyrus.def" version="1.3.100"/>
<plugin name="org.eclipse.papyrus.dev.assistants.codegen" version="1.2.100"/>
<plugin name="org.eclipse.papyrus.dev.pluginexplorer" version="1.2.0"/>
<plugin name="org.eclipse.papyrus.dev.project.management" version="1.3.0"/>
diff --git a/plugins/toolsmiths/pom.xml b/plugins/toolsmiths/pom.xml
index d506e59d7a1..e873526d122 100644
--- a/plugins/toolsmiths/pom.xml
+++ b/plugins/toolsmiths/pom.xml
@@ -36,7 +36,6 @@
<module>gmf-tooling</module>
<module>org.eclipse.papyrus.customization.nattableconfiguration</module>
<module>org.eclipse.papyrus.codegen</module>
- <module>org.eclipse.papyrus.def</module>
<module>org.eclipse.papyrus.dev.assistants.codegen</module>
<module>org.eclipse.papyrus.dev.pluginexplorer</module>
<module>org.eclipse.papyrus.dev.project.management</module>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
index 62c4cf8723a..7ce68ac2ffe 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
@@ -10,8 +10,6 @@
modelID="PapyrusUMLActivityDiagram"
diagramFileExtension="PapyrusUMLActivity_diagram"
domainFileExtension="PapyrusUMLActivity"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2009 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.activity/src-gen">
<audits>
@@ -20530,7 +20528,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
index 78875a03c2e..20d5d258aae 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
@@ -6,8 +6,6 @@
<gmfgen:GenEditorGenerator
packageNamePrefix="org.eclipse.papyrus.uml.diagram.clazz"
modelID="PapyrusUMLClassDiagram" domainFileExtension="PapyrusUMLClass"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.clazz/src-gen">
<diagram visualID="1000" editPartClassName="ModelEditPart"
@@ -6687,7 +6685,7 @@
</preferencePages>
</diagram>
<plugin iD="org.eclipse.papyrus.uml.diagram.clazz"
- name="PapyrusUMLClassDiagram" version="3.1.0.qualifier" />
+ name="PapyrusUMLClassDiagram" version="4.1.0.qualifier" />
<editor />
<navigator />
<diagramUpdater />
@@ -6781,7 +6779,7 @@
rootInput="PapyrusUMLClassDiagram">
<invocations xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0" oclExpression="self.diagram" />
</extensions>
</gmfgen:GenEditorGenerator>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.gmfgen
index ce73cf2028b..420284cbce5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.gmfgen
@@ -10,8 +10,6 @@
modelID="PapyrusUMLCommunicationDiagram"
diagramFileExtension="PapyrusUMLCommunication_diagram"
domainFileExtension="PapyrusUMLCommunication"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.communication/src-gen">
<diagram
@@ -924,7 +922,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen
index 731ac3ca33e..142fe6ec33b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen
@@ -9,8 +9,6 @@
packageNamePrefix="org.eclipse.papyrus.uml.diagram.component"
modelID="PapyrusUMLComponentDiagram"
domainFileExtension="PapyrusUMLComponent"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.component/src-gen">
<diagram
@@ -3299,7 +3297,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
index 238999c182a..a765de40dc1 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
@@ -10,8 +10,6 @@
modelID="CompositeStructure"
diagramFileExtension="uml_csd"
domainFileExtension="uml"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.composite/src-gen">
<diagram
@@ -10666,7 +10664,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen
index 81548fee070..c8158587330 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen
@@ -10,8 +10,6 @@
modelID="PapyrusUMLDeploymentDiagram"
diagramFileExtension="PapyrusUMLDeployment_diagram"
domainFileExtension="umlDeployment"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.deployment/src-gen">
<diagram
@@ -3405,7 +3403,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen
index 70a0d7a99af..c46b0ac1476 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen
@@ -9,8 +9,6 @@
packageNamePrefix="org.eclipse.papyrus.uml.diagram.profile"
modelID="PapyrusUMLProfileDiagram"
domainFileExtension="PapyrusUMLProfile"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.profile/src-gen">
<diagram
@@ -3527,7 +3525,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen
index 971310d14e4..c52eb4f22b7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen
@@ -9,8 +9,6 @@
packageNamePrefix="org.eclipse.papyrus.uml.diagram.sequence"
modelID="PapyrusUMLSequenceDiagram"
domainFileExtension="PapyrusUMLSequence"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2018 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.sequence/src-gen">
<audits>
@@ -2378,7 +2376,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
index 81bd16a59cd..66d711418e0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
@@ -10,8 +10,6 @@
modelID="PapyrusUMLStateMachineDiagram"
diagramFileExtension="PapyrusUMLStateMachine_diagram"
domainFileExtension="PapyrusUMLStateMachine"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.statemachine/src-gen">
<audits>
@@ -2710,7 +2708,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/README.txt b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/README.txt
index c9fd42259cc..9b76d09f6dd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/README.txt
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/README.txt
@@ -23,18 +23,18 @@ The generation is deactivated for all palettes in Papyrus.
Since papyrus element type configuration is not used for elements of this diagram, paletteConfiguration model can not be generated. So the default Eclipse palette definition is kept.
If you have modified palette and want to regenerate it:
- - go to org.eclipse.papyrus.def/aspects.xpt.plugin/plugin.xtend
- - uncomment line 65-66:
+ - go to org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt.plugin/plugin.xtend
+ - uncomment line 72-73:
««« «palettePredefinedEntries(editorGen)»
««« «paletteEntries(editorGen)»
- generate as usual papyrus diagram
- - comment line 65-66
+ - comment line 72-73
If you want to generate paletteConfiguration model when element type configuration will be available for timing diagram:
- go to org.eclipse.papyrus.codegen.PapyrusGenerator.customRun()
- uncomment "generatePaletteConfiguration()"
- - go to org.eclipse.papyrus.def/aspects.xpt.plugin/plugin.xtend
- - uncomment line 77:
+ - go to org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt.plugin/plugin.xtend
+ - uncomment line 84:
««« «paletteConfiguration(editorGen)»
- generate as usual papyrus diagram
- comment previous uncommented lines
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen
index 488a89e1e5e..9aa7105a897 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.gmfgen
@@ -10,8 +10,6 @@
modelID="PapyrusUMLTimingDiagram"
diagramFileExtension="PapyrusUMLTiming_diagram"
domainFileExtension="PapyrusUMLTiming"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.timing/src-gen">
<diagram
@@ -2258,7 +2256,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram.gmfgen.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram.gmfgen.prefs
index 96fb4135058..3e6dd8ffa48 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram.gmfgen.prefs
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram.gmfgen.prefs
@@ -1,4 +1,3 @@
-dynamic_figure_templates=file\:/D\:/LOCAL/workspace-MDTPapyrus/org.eclipse.papyrus.def/dynamic-templates3.5/codegen
eclipse.preferences.version=1
generate_rcp=false
ignore_gmfgen_validation=false
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram1.gmfgen.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram1.gmfgen.prefs
index d0c7cb487b7..b4cc915e639 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram1.gmfgen.prefs
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/.settings/usecaseDiagram1.gmfgen.prefs
@@ -1,5 +1,4 @@
#Thu May 28 17:04:58 CEST 2009
-dynamic_figure_templates=file\:/D\:/LOCAL/workspace-MDTPapyrus/org.eclipse.papyrus.def/dynamic-templates3.5/codegen
eclipse.preferences.version=1
generate_rcp=false
ignore_gmfgen_validation=false
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen
index 4ff0e3b95f0..6745c91f132 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen
@@ -9,8 +9,6 @@
packageNamePrefix="org.eclipse.papyrus.uml.diagram.usecase"
modelID="UseCase"
domainFileExtension="PapyrusUMLUsecase"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.usecase/src-gen">
<diagram
@@ -2935,7 +2933,7 @@
<invocations
xsi:type="gmfgen:GenTemplateInvocation"
description="VisualTypeProvider"
- templateFqn="aspects::xpt::providers::VisualTypeProvider::VisualTypeProvider"
+ templateFqn="xpt::providers::VisualTypeProvider::VisualTypeProvider"
inputs="/0/@extensions.0"
oclExpression="self.diagram"/>
</extensions>
diff --git a/tests/junit/framework/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/apireport/excludes.txt b/tests/junit/framework/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/apireport/excludes.txt
index 6effaf55fcc..a96a9f118f1 100644
--- a/tests/junit/framework/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/apireport/excludes.txt
+++ b/tests/junit/framework/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/apireport/excludes.txt
@@ -31,7 +31,6 @@ R:.*\.junit?\b
# Don't analyze developer bundles
org.eclipse.papyrus.dev.feature
org.eclipse.papyrus.codegen
-org.eclipse.papyrus.def
org.eclipse.papyrus.dev.assistants.codegen
org.eclipse.papyrus.dev.java.utils
org.eclipse.papyrus.dev.project.management

Back to the top