Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2013-12-03 12:40:36 +0000
committerFlorian Noyrit2013-12-03 12:40:36 +0000
commit9e4aeb2c15eb24b47b3c372fc7aadeddac3c46bb (patch)
tree2e181c3b23c3f011711af6ad103b833b3531b612 /extraplugins
parent1878fdd63943831fe1b37dd047ceccaa12dea151 (diff)
downloadorg.eclipse.papyrus-9e4aeb2c15eb24b47b3c372fc7aadeddac3c46bb.tar.gz
org.eclipse.papyrus-9e4aeb2c15eb24b47b3c372fc7aadeddac3c46bb.tar.xz
org.eclipse.papyrus-9e4aeb2c15eb24b47b3c372fc7aadeddac3c46bb.zip
Update facade to support operation wrapping and to fix several bugs.
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdfbin632121 -> 694392 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptxbin928095 -> 928322 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java2
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java2
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/.classpath2
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/META-INF/MANIFEST.MF14
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.acceleo2
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.properties7
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/icons/facade.pngbin0 -> 382 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.properties2
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.xml60
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/ui/launcher/GenerateCodeAction.java108
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/ui/launcher/GenerateFacadeAction.java148
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl)22
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl)10
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl)10
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl)10
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl191
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl)10
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/AbstractRepresentingClass.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/AbstractRepresentingClass.mtl)10
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/Class.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/Class.mtl)13
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.java (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/GenFacade.java)7
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/GenFacade.mtl)47
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/LoaderClass.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/LoaderClass.mtl)12
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/PackageClass.mtl1289
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/RepresentingElementAdapter.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/RepresentingElementAdapter.mtl)12
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/ResourceClass.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/ResourceClass.mtl)10
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/WrapperClass.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/WrapperClass.mtl)25
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl)71
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl)12
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/FacadeCodeGenPlugin.java (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/FacadeCodeGenPlugin.java)26
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/Messages.java45
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl160
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/handlers/GenerateFacadeHandler.java229
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/messages.properties8
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/EEFGeneratorAdapter.java (renamed from extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/util/EEFGeneratorAdapter.java)115
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.java970
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/MappingMissing.java6
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.java152
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/META-INF/MANIFEST.MF6
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/plugin.xml3
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/ResourceManager.java13
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/SWTResourceManager.java13
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/FacadeDefinitionEditorActivator.java (renamed from extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/Activator.java)27
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/FacadeSpecificEditor.java338
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/Messages.java258
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/EditionUtils.java99
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/ExtensionKindColumnEditingSupport.java97
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/IsPossibleColumnEditingSupport.java100
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassAliasColumnEditingSupport.java55
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassIsAbstractColumnEditingSupport.java44
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassToKeepColumnEditingSupport.java49
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassUseRepresentedColumnEditingSupport.java99
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesAliasColumnEdintingSupport.java66
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMaxColumnEdintingSupport.java76
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMinColumnEdintingSupport.java76
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesToKeepColumnEditingSupport.java78
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/StereotypeIncompatibilityColumnEditingSupport.java267
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/glue/GlueGenerator.java127
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/messages.properties115
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/CreatePreliminaryMetamodelListener.java148
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/EcoreGenerator.java574
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/MetamodelUtils.java471
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionContentProvider.java75
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionLabelProvider.java108
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesContentProvider.java37
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesLabelProvider.java97
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelContentProvider.java57
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelLabelProvider.java130
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/PropertiesContentProvider.java39
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/PropertiesLabelProvider.java137
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/TypedElementContentProvider.java90
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/TypedElementLabelProvider.java176
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/utils/CombinationGenerator.java104
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/utils/ProfileUtils.java48
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/utils/PrunerUtils.java146
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/utils/StereotypeUtils.java54
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/utils/UMLModelUtils.java29
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/.classpath2
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/icons/full/ctool16/CreateFacade_virtualMetaclasses_StereotypeInterface.gifbin223 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/icons/full/ctool16/CreateFacade_virtualMetaclasses_VirtualMetaclass.gifbin223 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/icons/full/ctool16/CreateVirtualMetaclass_virtualProperties_VirtualProperty.gifbin223 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/icons/full/ctool16/CreateVirtualMetamodel_virtualClassifiers_StereotypeInterface.gifbin223 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/icons/full/obj16/KeepableElement.gifbin129 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/icons/full/obj16/Literal.gifbin129 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/icons/full/obj16/StereotypeInterface.gifbin129 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/icons/full/obj16/VirtualElement.gifbin129 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/plugin.properties82
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/extensiondefinition/provider/BaseMetaclassItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/extensiondefinition/provider/CombinationItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/extensiondefinition/provider/ExtensionDefinitionItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/extensiondefinition/provider/ExtensiondefinitionItemProviderAdapterFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/provider/FacadeEditPlugin.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/provider/FacadeItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/provider/FacadeItemProviderAdapterFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualClassifierItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualDatatypeItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualElementItemProvider.java40
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualEnumItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualLiteralItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualMetaclassItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualMetamodelItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualOperationItemProvider.java18
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualParameterItemProvider.java18
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualPropertyItemProvider.java75
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualTypedElementItemProvider.java191
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facade/virtualmetamodel/provider/VirtualmetamodelItemProviderAdapterFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facademapping/provider/FacadeMapppingItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facademapping/provider/FacademappingEditPlugin.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facademapping/provider/FacademappingItemProviderAdapterFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facademapping/provider/MappingItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.edit/src/org/eclipse/papyrus/facademapping/provider/StereotypedMappingItemProvider.java16
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/.classpath2
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/icons/full/obj16/ProfilclarificationModelFile.gifbin346 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/icons/full/wizban/NewProfilclarification.gifbin2462 -> 0 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/plugin.properties38
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/plugin.xml92
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/extensiondefinition/presentation/ExtensiondefinitionActionBarContributor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/extensiondefinition/presentation/ExtensiondefinitionEditor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/extensiondefinition/presentation/ExtensiondefinitionModelWizard.java18
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/presentation/FacadeActionBarContributor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/presentation/FacadeEditor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/presentation/FacadeEditorPlugin.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/presentation/FacadeModelWizard.java18
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/virtualmetamodel/presentation/VirtualmetamodelActionBarContributor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/virtualmetamodel/presentation/VirtualmetamodelEditor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facade/virtualmetamodel/presentation/VirtualmetamodelModelWizard.java18
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facademapping/presentation/FacademappingActionBarContributor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facademapping/presentation/FacademappingEditor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facademapping/presentation/FacademappingEditorPlugin.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.editor/src/org/eclipse/papyrus/facademapping/presentation/FacademappingModelWizard.java18
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/META-INF/MANIFEST.MF2
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/Activator.java30
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/CombinationGenerator.java123
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/FacadeUtilsActivator.java43
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/RepresentingElement.java13
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/WrappingEObjectContainmentEList.java29
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/WrappingEObjectContainmentWithInverseEList.java29
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/WrappingEObjectEList.java29
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/WrappingEObjectWithInverseEList.java69
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/WrappingList.java13
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/subset/WrappingSubsetEObjectContainmentEList.java21
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/subset/WrappingSubsetEObjectContainmentWithInverseEList.java21
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/subset/WrappingSubsetEObjectEList.java21
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.utils/src/org/eclipse/papyrus/facade/utils/wrappinglist/subset/WrappingSubsetEObjectWithInverseEList.java21
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/META-INF/MANIFEST.MF11
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/build.properties3
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/icons/facade.pngbin0 -> 382 bytes
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/model/facade.ecore21
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/plugin.properties9
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/plugin.xml40
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/schema/facadeDefinition.exsd145
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/Facade.java40
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/FacadeActivator.java77
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/FacadeFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/FacadePackage.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/Messages.java68
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/BaseMetaclass.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/Combination.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/ExtensionDefinition.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/ExtensionDefinitionKind.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/ExtensiondefinitionFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/ExtensiondefinitionPackage.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/impl/BaseMetaclassImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/impl/CombinationImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/impl/ExtensionDefinitionImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/impl/ExtensiondefinitionFactoryImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/impl/ExtensiondefinitionPackageImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/util/ExtensiondefinitionAdapterFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/util/ExtensiondefinitionResourceFactoryImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/util/ExtensiondefinitionResourceImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/util/ExtensiondefinitionSwitch.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/util/ExtensiondefinitionXMLProcessor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/validation/BaseMetaclassValidator.java37
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/validation/CombinationValidator.java30
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/extensiondefinition/validation/ExtensionDefinitionValidator.java40
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/impl/FacadeFactoryImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/impl/FacadeImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/impl/FacadePackageImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/messages.properties20
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/util/FacadeAdapterFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/util/FacadeResourceFactoryImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/util/FacadeResourceImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/util/FacadeSwitch.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/util/FacadeXMLProcessor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/validation/FacadeValidator.java33
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualClassifier.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualDatatype.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualElement.java42
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualEnum.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualLiteral.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualMetaclass.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualMetamodel.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualOperation.java17
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualParameter.java17
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualProperty.java71
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualTypedElement.java114
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualmetamodelFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/VirtualmetamodelPackage.java424
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualClassifierImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualDatatypeImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualElementImpl.java69
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualEnumImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualLiteralImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualMetaclassImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualMetamodelImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualOperationImpl.java17
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualParameterImpl.java17
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualPropertyImpl.java139
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualTypedElementImpl.java289
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualmetamodelFactoryImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/impl/VirtualmetamodelPackageImpl.java111
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/util/VirtualmetamodelAdapterFactory.java33
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/util/VirtualmetamodelResourceFactoryImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/util/VirtualmetamodelResourceImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/util/VirtualmetamodelSwitch.java40
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/util/VirtualmetamodelXMLProcessor.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualClassifierValidator.java28
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualDatatypeValidator.java26
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualElementValidator.java31
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualEnumValidator.java30
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualLiteralValidator.java26
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualMetaclassValidator.java39
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualMetamodelValidator.java36
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualOperationValidator.java30
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualParameterValidator.java26
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualPropertyValidator.java28
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facade/virtualmetamodel/validation/VirtualTypedElementValidator.java30
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/ExtensionDefinitionKind.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/FacadeMappping.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/FacademappingFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/FacademappingPackage.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/Mapping.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/StereotypedMapping.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/impl/FacadeMapppingImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/impl/FacademappingFactoryImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/impl/FacademappingPackageImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/impl/MappingImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/impl/StereotypedMappingImpl.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/util/FacademappingAdapterFactory.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/src/org/eclipse/papyrus/facademapping/util/FacademappingSwitch.java15
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade/text/description.txt12
-rw-r--r--extraplugins/org.eclipse.papyrus.qvtTransformation/src/org/eclipse/papyrus/qvttransformation/Activator.java2
-rw-r--r--extraplugins/org.eclipse.papyrus.qvtTransformation/src/org/eclipse/papyrus/qvttransformation/popup/actions/SelectQVTTransformation.java2
257 files changed, 9704 insertions, 3369 deletions
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdf b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdf
index 729c17aace5..1bbe3ce2737 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdf
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdf
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptx b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptx
index bf447853259..1328d3e78c7 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptx
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptx
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java
index da8b9d8db2e..0755d1481e7 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java
index 05cf38cdecf..61ad60bd1f3 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java
index 459715e1ba1..8816a182d7b 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java
index 2baf3d1cf51..4bb55ed7d2d 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java
index e1ceb6dc213..37d92dd795b 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java
index 5ab37a1c22b..82936252503 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java
index e3fd02c03b7..16ae3abbd7d 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java
index 9af233e2af7..73764677f42 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java
index a588ddbbf06..1a1c587b072 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java
index 4926478ddb5..0861ea91141 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java
index adadfdeb090..8a6cb154128 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java
index eaaa973fc2b..b2e328783ad 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java
index 1232575847f..5677e62876f 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.editor.provider;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java
index 0b668b501b2..7c911454ea3 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.launcher;
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java
index 32bf1d17b28..5132b46cb68 100644
--- a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagramtemplate.launcher;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/.classpath b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/.classpath
index 0c2c7e3d267..5496d8e7f08 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/.classpath
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/.classpath
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src-templates"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src-custom"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/META-INF/MANIFEST.MF b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/META-INF/MANIFEST.MF
index f980a18f0c0..875c37db936 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/META-INF/MANIFEST.MF
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/META-INF/MANIFEST.MF
@@ -1,9 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Codegen
+Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.facade.codegen;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 0.10.1.qualifier
Bundle-Activator: org.eclipse.papyrus.facade.codegen.FacadeCodeGenPlugin
+Bundle-Localization: plugin
+Bundle-Vendor: %vendorName
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.emf.eef.codegen.launcher,
@@ -12,10 +14,12 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.codegen.ecore,
org.eclipse.acceleo.engine,
org.eclipse.emf.eef.codegen.ecore;bundle-version="1.2.0",
- org.eclipse.papyrus.facade;bundle-version="1.0.0",
+ org.eclipse.papyrus.facade;bundle-version="0.10.1",
org.eclipse.uml2.codegen.ecore;bundle-version="1.9.0",
- org.eclipse.uml2.uml;bundle-version="4.1.0"
+ org.eclipse.uml2.uml;bundle-version="4.1.0",
+ org.eclipse.papyrus.facade.utils;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.facade.codegen.GenFacade,
+Export-Package: org.eclipse.papyrus.facade.codegen.genfacade,
org.eclipse.papyrus.facade.codegen.utils
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.acceleo b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.acceleo
index e23ef25281c..927a3f72b52 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.acceleo
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.acceleo
@@ -18,7 +18,7 @@
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
- dependencies="${target.folder}/../../org.eclipse.papyrus.facade;"
+ dependencies="${target.folder}/../../org.eclipse.emf.eef.codegen.ecore;${target.folder}/../../org.eclipse.ui.ide;${target.folder}/../../org.eclipse.papyrus.facade;${target.folder}/../../org.eclipse.uml2.uml;${target.folder}/../../org.eclipse.uml2.codegen.ecore;${target.folder}/../../org.eclipse.papyrus.facade.utils;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.properties b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.properties
index 75710eb2526..e5054e06e6a 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.properties
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/build.properties
@@ -1,8 +1,9 @@
-source.. = src/,\
- src-custom/
+source.. = src-templates/,\
+ src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
bin/,\
- src-custom/
+ src/,\
+ icons/
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/icons/facade.png b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/icons/facade.png
new file mode 100644
index 00000000000..779a7b8b123
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/icons/facade.png
Binary files differ
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.properties b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.properties
new file mode 100644
index 00000000000..f0885250491
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.properties
@@ -0,0 +1,2 @@
+pluginName=Papyrus Facade (Incubation)
+vendorName=Eclipse Modeling Project \ No newline at end of file
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.xml b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.xml
index 518938f551f..bda059b0aab 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.xml
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/plugin.xml
@@ -1,28 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="true"
- id="org.eclipse.emf.eef.codegen.ecore.ui.launcher"
- objectClass="org.eclipse.emf.codegen.ecore.genmodel.GenModel">
- <menu
- id="org.eclipse.emf.eef.ui.menu"
- label="EEF"
- path="edit">
- <groupMarker
- name="facade-generation">
- </groupMarker>
- </menu>
- <action
- class="org.eclipse.papyrus.facade.codegen.ui.launcher.GenerateFacadeAction"
- enablesFor="*"
- id="org.eclipse.papyrus.facade.codegen"
- label="Generate Facade Code"
- menubarPath="org.eclipse.emf.eef.ui.menu/facade-generation">
- </action>
- </objectContribution>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.facade.category"
+ id="org.eclipse.papyrus.facade.codegen.generateFacadeCodeCommand"
+ name="Generate Facade Code">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.facade.codegen.handlers.GenerateFacadeHandler"
+ commandId="org.eclipse.papyrus.facade.codegen.generateFacadeCodeCommand">
+ </handler>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.emf.codegen.ecore.genmodel.presentation.GenModelEditorID">
+ <command
+ commandId="org.eclipse.papyrus.facade.codegen.generateFacadeCodeCommand"
+ icon="icons/facade.png"
+ id="org.eclipse.papyrus.facade.codegen.menu.generateFacadeCodeCommand">
+
+ <visibleWhen>
+ <with variable="activeMenuSelection">
+ <iterate
+ ifEmpty="false">
+ <adapt type="org.eclipse.emf.codegen.ecore.genmodel.GenModel">
+
+ </adapt>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
</extension>
</plugin>
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/ui/launcher/GenerateCodeAction.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/ui/launcher/GenerateCodeAction.java
deleted file mode 100644
index a2c19cf693c..00000000000
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/ui/launcher/GenerateCodeAction.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.facade.codegen.ui.launcher;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
-import org.eclipse.emf.eef.codegen.flow.Workflow;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * @author <a href="mailto:stephane.bouchet@obeo.fr">Stephane Bouchet</a>
- */
-public abstract class GenerateCodeAction implements IObjectActionDelegate {
-
- protected Shell shell;
-
- protected List<GenModel> emfGenModels;
-
- protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
-
- public GenerateCodeAction() {
- emfGenModels = new ArrayList<GenModel>();
- }
-
- /**
- * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- shell = targetPart.getSite().getShell();
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- if(emfGenModels != null) {
- final Workflow flow = initEMFGenFlow();
- flow.prepare();
- Job job = new Job("EEF architecture generation") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- flow.execute(monitor);
- monitor.done();
- return Status.OK_STATUS;
- }
-
- };
- job.setUser(true);
- job.schedule();
- }
- }
-
- /**
- * @return the flow to execute in order to generate EMF code.
- */
- protected abstract Workflow initEMFGenFlow();
-
- /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- emfGenModels.clear();
- if(selection instanceof StructuredSelection) {
- StructuredSelection sSelection = (StructuredSelection)selection;
- for(Object selectedElement : sSelection.toList()) {
- if(selectedElement instanceof GenModel) {
- emfGenModels.add((GenModel)selectedElement);
- }
- }
-
- }
- }
-
- protected IProject extractProject(String sPath) {
- IPath path = new Path(sPath);
- if(path.isEmpty()) {
- return null;
- }
- return workspace.getRoot().getProject(path.segment(0));
- }
-
-}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/ui/launcher/GenerateFacadeAction.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/ui/launcher/GenerateFacadeAction.java
deleted file mode 100644
index ed4cff98f7b..00000000000
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/ui/launcher/GenerateFacadeAction.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.facade.codegen.ui.launcher;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.codegen.ecore.Generator;
-import org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter;
-import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.common.util.UniqueEList;
-import org.eclipse.emf.eef.codegen.flow.Step;
-import org.eclipse.emf.eef.codegen.flow.Workflow;
-import org.eclipse.papyrus.facade.codegen.FacadeCodeGenPlugin;
-import org.eclipse.papyrus.facade.codegen.GenFacade.GenFacade;
-import org.eclipse.papyrus.facade.codegen.util.EEFGeneratorAdapter;
-
-/**
- * @author <a href="mailto:goulwen.lefur@obeo.fr">Goulwen Le Fur</a>
- */
-public class GenerateFacadeAction extends GenerateCodeAction {
-
- /**
- * {@inheritDoc}
- *
- * @see GenerateCodeAction#initEMFGenFlow()
- */
- protected Workflow initEMFGenFlow() {
- final Workflow flow = new Workflow("Generate Facade code ", shell);
- for(final org.eclipse.emf.codegen.ecore.genmodel.GenModel emfGenModel : emfGenModels) {
- String s2 = "Generate Facade code for " + emfGenModel.eResource().getURI().toString();
- flow.addStep(s2, new Step("FACADE MODEL") {
-
- @Override
- public IStatus execute(IProgressMonitor monitor) {
- // create the model project
- IProject modelProject = extractProject(emfGenModel.getModelProjectDirectory());
- if(modelProject == null) {
- return Status.OK_STATUS;
- }
- List<IProject> referencedProjects = new UniqueEList<IProject>();
- if(!workspace.getRoot().exists(modelProject.getFullPath())) {
- // TODO Manage the case when the model project has been deleted from the workspace but is still present on disk ?
- modelProject = Generator.createEMFProject(new Path(emfGenModel.getModelDirectory()), modelProject.getLocation(), referencedProjects, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN), Generator.EMF_MODEL_PROJECT_STYLE | Generator.EMF_PLUGIN_PROJECT_STYLE);
- } else if(!modelProject.isAccessible()) {
- try {
- modelProject.open(monitor);
- } catch (CoreException e) {
- return new Status(IStatus.ERROR, FacadeCodeGenPlugin.PLUGIN_ID, e.getMessage(), e);
- }
- }
- // generate using acceleo
- List<String> args = new ArrayList<String>();
- File modelDirectory = modelProject.getLocation().toFile();
- try {
- GenFacade generator = new GenFacade(emfGenModel, modelDirectory, args);
- generator.doGenerate(BasicMonitor.toMonitor(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)));
- } catch (IOException e) {
- return new Status(IStatus.ERROR, FacadeCodeGenPlugin.PLUGIN_ID, e.getMessage(), e);
- }
- return Status.OK_STATUS;
- }
- });
-
- if(emfGenModel.isCodeFormatting()) {
- // TODO Ne rafraichir avant le formatage que si le folder demand� n'est pas accessible
- // FIXME IMPORTANT !!! Virer le double refresh, fait � l'arrache par LDE qui sait pas comment faire autrement
- // TODO D�terminer pourquoi il reste des diff�rences de formatage avec EMF
- // TODO D�terminer pourquoi quand on fait clic-droit -> Source -> format sur le code g�n�r�, le code est modifi�
- // (cas o� le projet vient d'�tre cr�� par exemple)
- String s1b = "Refreshing workspace " + emfGenModel.eResource().getURI().toString();
- flow.addStep(s1b, new Step("REFRESH") {
-
- @Override
- public IStatus execute(IProgressMonitor monitor) {
- // refresh model project
- IProject modelProject = extractProject(emfGenModel.getModelProjectDirectory());
- if(modelProject == null) {
- return Status.OK_STATUS;
- }
- try {
- if(!modelProject.isOpen()) {
- modelProject.open(monitor);
- }
- modelProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- } catch (CoreException e) {
- return new Status(IStatus.ERROR, FacadeCodeGenPlugin.PLUGIN_ID, e.getMessage(), e);
- }
- return Status.OK_STATUS;
- }
- });
-
- String s2prime = "Formatting generated files";
- flow.addStep(s2prime, new Step(s2prime) {
-
- @Override
- public IStatus execute(IProgressMonitor monitor) {
- EEFGeneratorAdapter eefGen = new EEFGeneratorAdapter();
- eefGen.generate(emfGenModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, BasicMonitor.toMonitor(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)));
- return Status.OK_STATUS;
- }
- });
- }
-
- String s3 = "Refreshing workspace " + emfGenModel.eResource().getURI().toString();
- flow.addStep(s3, new Step("REFRESH") {
-
- @Override
- public IStatus execute(IProgressMonitor monitor) {
- // refresh model project
- IProject modelProject = extractProject(emfGenModel.getModelProjectDirectory());
- if(modelProject == null) {
- return Status.OK_STATUS;
- }
- try {
- if(!modelProject.isOpen()) {
- modelProject.open(monitor);
- }
- modelProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- } catch (CoreException e) {
- return new Status(IStatus.ERROR, FacadeCodeGenPlugin.PLUGIN_ID, e.getMessage(), e);
- }
- return Status.OK_STATUS;
- }
- });
- }
- return flow;
- }
-
-}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl
index a438b94e2f4..1c550f7422d 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module eIsSet('http://www.eclipse.org/emf/2002/GenModel')/]
@@ -41,11 +51,11 @@
[if (genFeature.isVolatile()) ]
return !(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)[genFeature.getGetAccessor()/]()).featureMap().isEmpty();
[else]
- return [safeNameAccessor/] != null && ![safeNameAccessor/].featureMap().isEmpty();
+ return [genFeature.getGetAccessor()/]() != null && ![genFeature.getGetAccessor()/]().featureMap().isEmpty();
[/if]
[else]
[if (genClass.isField(genFeature)) ]
- return [safeNameAccessor/] != null && ![safeNameAccessor/].isEmpty();
+ return [genFeature.getGetAccessor()/]() != null && ![genFeature.getGetAccessor()/]().isEmpty();
[else]
[if (genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
[genFeature.getImportedType(genClass)/] [safeNameAccessor/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
@@ -59,7 +69,7 @@
return isSet[genFeature.getAccessorName()/]();
[else][if (genFeature.isResolveProxies()) ]
[if (genClass.isField(genFeature)) ]
- return [safeNameAccessor/] != null;
+ return [genFeature.getGetAccessor()/]() != null;
[else]
[if (genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
return eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]) != null;
@@ -69,7 +79,7 @@
[/if]
[else][if (not genFeature.hasEDefault()) ]
[if (genClass.isField(genFeature)) ]
- return [safeNameAccessor/] != null;
+ return [genFeature.getGetAccessor()/]() != null;
[else]
[if (genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
return eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]) != null;
@@ -86,7 +96,7 @@
return ([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) != [genFeature.getUpperName()/]_EFLAG_DEFAULT;
[/if]
[else]
- return [safeNameAccessor/] != [genFeature.getEDefault()/];
+ return [genFeature.getGetAccessor()/]() != [genFeature.getEDefault()/];
[/if]
[else]
[if (genFeature.isEnumType() and genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
@@ -97,7 +107,7 @@
[/if]
[else]
[if (genClass.isField(genFeature)) ]
- return [genFeature.getEDefault()/] == null ? [safeNameAccessor/] != null : ![genFeature.getEDefault()/].equals([safeNameAccessor/]);
+ return [genFeature.getEDefault()/] == null ? [genFeature.getGetAccessor()/]() != null : ![genFeature.getEDefault()/].equals([genFeature.getGetAccessor()/]());
[else]
[if (genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
[genFeature.getImportedType(genClass)/] [safeNameAccessor/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], [genFeature.getEDefault()/]);
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl
index 9a573177520..b6d0ecd3c59 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module eUnset('http://www.eclipse.org/emf/2002/GenModel')/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl
index 85e96a8eb49..39960920800 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module genDeclaredFields('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl
index b790a7c7aad..2f3a615e867 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module genFeature('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore','http://www.eclipse.org/uml2/4.0.0/UML')/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl
new file mode 100644
index 00000000000..54e85fb0106
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl
@@ -0,0 +1,191 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module genOperation('http://www.eclipse.org/emf/2002/GenModel')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnum /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenOperation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenParameter /]
+[import org::eclipse::papyrus::facade::codegen::utils::FacadeCodegenUtils /]
+[import org::eclipse::papyrus::facade::codegen::utils::WrappingListUtils /]
+
+[template public genOperation(genOperation : GenOperation, genClass : GenClass, genPackage : GenPackage, genModel : GenModel, isJDK50 : Boolean, isInterface : Boolean, isImplementation : Boolean, isGWT : Boolean)]
+[if (isImplementation) ]
+ [if (genOperation.isInvariant() and genOperation.hasInvariantExpression()) ]
+ /**
+ * The cached validation expression for the '{@link #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/]) <em>[genOperation.getFormattedName()/]</em>}' invariant operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/])
+ * @generated
+ * @ordered
+ */
+ protected static final [genModel.getImportedName('java.lang.String')/] [genClass.getUniqueNameUpperCase(genOperation)/]__EEXPRESSION = "[genOperation.getInvariantExpression('\t\t')/]";[genModel.getNonNLS()/]
+
+ [else][if (genOperation.hasInvocationDelegate()) ]
+ /**
+ * The cached invocation delegate for the '{@link #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/]) <em>[genOperation.getFormattedName()/]</em>}' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/])
+ * @generated
+ * @ordered
+ */
+ protected static final [genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/].Internal.InvocationDelegate [genClass.getUniqueNameUpperCase(genOperation)/]__EINVOCATION_DELEGATE = (([genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/].Internal)[genOperation.getQualifiedOperationAccessor()/]).getInvocationDelegate();
+
+ [/if][/if]
+[/if]
+[if (isInterface) ]
+[comment]<%@ include file="Class/genOperation.javadoc.override.javajetinc" fail="alternative" %>[/comment]
+[comment]<%@ start %>[/comment]
+ /**
+[comment]<%@ include file="Class/genOperation.javadoc.insert.javajetinc" fail="silent" %>[/comment]
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ [if (genOperation.hasDocumentation() or genOperation.hasParameterDocumentation()) ]
+ * <!-- begin-model-doc -->
+ [if (genOperation.hasDocumentation()) ]
+ * [genOperation.getDocumentation(genModel.getIndentation())/]
+ [/if]
+ [for (genParameter : GenParameter | genOperation.genParameters)]
+ [if (genParameter.hasDocumentation())]
+ [let documentation : String = genParameter.getDocumentation('')]
+ [if (documentation.contains('\n') or documentation.contains('\r')) ]
+ * @param [genParameter.getName()/]
+ * [genParameter.getDocumentation(genModel.getIndentation())/]
+ [else]
+ * @param [genParameter.getName()/] [genParameter.getDocumentation(genModel.getIndentation())/]
+ [/if]
+ [/let]
+ [/if]
+ [/for]
+ * <!-- end-model-doc -->
+ [/if]
+ [if (not genModel.suppressEMFModelTags)]
+ [let modelInfoLines : Sequence(String) = genOperation.getModelInfo().tokenize(genModel.getLineDelimiter())]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + '\t * ')/]
+ [/if]
+ [/let]
+ [/if]
+ * @generated
+ */
+[comment]<%@ end %><%//Class/genOperation.javadoc.override.javajetinc%>[/comment]
+[else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isJDK50)][comment]//Class/genOperation.annotations.insert.javajetinc[/comment]
+[comment]<%@ include file="Class/genOperation.annotations.insert.javajetinc" fail="silent" %>[/comment]
+ [/if]
+[/if]
+[if (not isImplementation) ]
+ [genOperation.getTypeParameters(genClass)/][genOperation.getImportedType(genClass)/] [genOperation.getName()/]([genOperation.getParameters(genClass)/])[genOperation.getThrows(genClass)/];
+
+[else]
+ public [genOperation.getTypeParameters(genClass)/][genOperation.getImportedType(genClass)/] [genOperation.getName()/]([genOperation.getParameters(genClass)/])[genOperation.getThrows(genClass)/] {
+ [if (genOperation.hasBody()) ]
+ [genOperation.getBody(genModel.getIndentation())/]
+ [else]
+ [if (genOperation.isListType())]
+ [if (genOperation.isPrimtiveList())]
+ [genOperation.genGetContentPrimitiveType(genModel, genPackage)/]
+ [else]
+ [genModel.getImportedName('org.eclipse.emf.common.util.EList')/]<? extends [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/]> umlList = (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genOperation.ecoreOperation.findUMLGetAccessor(genModel)/]([genParameters(genOperation)/]);
+ [genOperation.getImportedType(genClass)/] update = new [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/]<[genOperation.getTypeGenClass().getQualifiedInterfaceName()/]>();
+
+ for([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] umlElement : umlList) {
+
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().findOrCreateSpecific(([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/])umlElement);
+ if(representingElement != null) {
+ if(representingElement instanceof [genOperation.getTypeGenClass().getQualifiedInterfaceName()/]) {
+ update.add(([genOperation.getTypeGenClass().getQualifiedInterfaceName()/])representingElement);
+ }
+ }
+ }
+
+ return update;
+ [/if]
+
+ [else]
+ [if (genOperation.isPrimitive())]
+ [genOperation.genGetContentPrimitiveType(genModel, genPackage)/]
+ [else]
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] umlElement = (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genOperation.ecoreOperation.findUMLGetAccessor(genModel)/]([genParameters(genOperation)/]);
+
+ if(umlElement [if (genOperation.isEnumType())] !=null [else] instanceof [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] [/if]) {
+
+
+ [if (genOperation.isEnumType())]
+ Enum representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().getEnumMappingFromUML((Enum)umlElement);
+ [else]
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().findOrCreateSpecific(([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/])umlElement);
+ [/if]
+
+ if(representingElement != null) {
+ if(representingElement instanceof [genOperation.getTypeGenClassifier().getAppropriateQualifiedTypeName()/]) {
+
+ return ([genOperation.getTypeGenClassifier().getAppropriateQualifiedTypeName()/])representingElement;
+
+ }
+ }
+ }
+
+ return null;
+ [/if]
+ [/if]
+
+ [/if]
+ }
+
+[/if]
+[comment]<%@ include file="Class/genOperation.insert.javajetinc" fail="silent" %>[/comment]
+[comment]<%@ end %><%//Class/implementedGenOperation.override.javajetinc%>[/comment]
+[/template]
+
+[template public genParameters(genOperation : GenOperation)]
+ [for (param : GenParameter | genOperation.genParameters) separator (',')]
+ [if (param.isPrimitive() or genOperation.isInvariant() or param.isPrimtiveList())]
+ [param.getName()/]
+ [else]
+ [if (param.isListType())]
+ [param.getGenModel().getImportedName(param.getGenPackage().getUtilitiesPackageName()+'.Wrapper')/].getInstance().toRepresentedList([param.getName()/])
+ [else]
+ [if (param.isEnumType())]
+ (([param.getGenModel().getImportedName(param.getTypeGenClassifier().getEcoreClassifier().findUMLMetaElement(param.getGenModel()).getPackagePathFromUML()+'.'+param.getTypeGenClassifier().getEcoreClassifier().getUMLMetaElement(param.getGenModel()))/])[param.getGenModel().getImportedName(param.getGenPackage().getUtilitiesPackageName()+'.Wrapper')/].getInstance().getEnumMappingFromSpecific([param.getName()/]))
+ [else]
+ ([param.getGenModel().getImportedName(param.getTypeGenClass().ecoreClass.findUMLMetaElement(param.getGenModel()).getPackagePathFromUML()+'.'+param.getTypeGenClass().ecoreClass.getUMLMetaElement(param.getGenModel()))/])[param.getName()/].get__Represented()
+ [/if]
+ [/if]
+ [/if]
+
+ [/for]
+[/template]
+
+[template public genGetContentPrimitiveType(genOperation : GenOperation, genModel: GenModel, genPackage : GenPackage)]
+
+ [if (genOperation.isVoid())]
+ (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genOperation.ecoreOperation.findUMLGetAccessor(genModel)/]([genParameters(genOperation)/]);
+ [else]
+ return (([genModel.getImportedName(genOperation.genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genOperation.ecoreOperation.findUMLGetAccessor(genModel)/]([genParameters(genOperation)/]);
+ [/if]
+
+[/template]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl
index 74b614a1e5e..27bebd978a0 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module reflectiveDelegationAlternative('http://www.eclipse.org/emf/2002/GenModel')/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/AbstractRepresentingClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/AbstractRepresentingClass.mtl
index 848dbdac4e4..ea9464612df 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/AbstractRepresentingClass.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/AbstractRepresentingClass.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module AbstractRepresentingClass('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/Class.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/Class.mtl
index e15cc883bc1..4e80f3a0cf3 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/Class.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/Class.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module Class('http://www.eclipse.org/emf/2002/GenModel')/]
@@ -148,7 +158,6 @@ package [genPackage.getClassPackageName()/];
public[if (genClass.isAbstract()) ] abstract[/if] class [genClass.getClassName()/][genClass.getTypeParameters().trim()/][if (genClass.ecoreClass.eSuperTypes->isEmpty()) ] extends [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.AbstractRepresentingElement')/] [else] [genClass.getClassExtends()/] [/if][genClass.getClassImplements()/] {
-
[else]
public interface [genClass.getInterfaceName()/][genClass.getTypeParameters().trim()/][genClass.getInterfaceExtends()/], [genModel.getImportedName('org.eclipse.papyrus.facade.utils.RepresentingElement')/] {
@@ -812,7 +821,7 @@ public interface [genClass.getInterfaceName()/][genClass.getTypeParameters().tri
[let size : Integer = genParameters->size()]
case [genClass.getQualifiedOperationID(genOperation)/]:
[if (genOperation.isVoid()) ]
- [genOperation.getName()/]([for (genParameter : GenParameter | genParameters)][if (not isJDK50 and genParameter.isPrimitiveType()) ]([/if][if (genParameter.getTypeGenDataType() = null or not genParameter.getTypeGenDataType().isObjectType() or genParameter.getRawType() <> genParameter.getType(genClass)) ]([genParameter.getObjectType(genClass)/])[/if]arguments.get([i/])[if (not isJDK50 and genParameter.isPrimitiveType()) ]).[genParameter.getPrimitiveValueFunction()/]()[/if][if (i < (size - 1)) ], [/if][/for]);
+ [genOperation.getName()/]([for (genParameter : GenParameter | genParameters)][if (not isJDK50 and genParameter.isPrimitiveType()) ]([/if][if (genParameter.getTypeGenDataType() = null or not genParameter.getTypeGenDataType().isObjectType() or genParameter.getRawType() <> genParameter.getType(genClass)) ]([genParameter.getObjectType(genClass)/])[/if]arguments.get([i/])[if (not isJDK50 and genParameter.isPrimitiveType()) ]).[genParameter.getPrimitiveValueFunction()/]()[/if][if (size > 1 and i < size) ], [/if][/for]);
return null;
[else]
return [if (not isJDK50 and genOperation.isPrimitiveType())]new [genOperation.getObjectType(genClass)/]([/if][genOperation.getName()/]([for (genParameter : GenParameter | genParameters)][if (not isJDK50 and genParameter.isPrimitiveType())]([/if][if (genParameter.getTypeGenDataType() = null or not genParameter.getTypeGenDataType().isObjectType() or genParameter.getRawType() <> genParameter.getType(genClass)) ]([genParameter.getObjectType(genClass)/])[/if]arguments.get([i - 1/])[if (not isJDK50 and genParameter.isPrimitiveType()) ]).[genParameter.getPrimitiveValueFunction()/]()[/if][if (i < size) ], [/if][/for])[if (not isJDK50 and genOperation.isPrimitiveType()) ])[/if];
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/GenFacade.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.java
index d4721636a43..31b9c62b4d2 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/GenFacade.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.java
@@ -7,8 +7,9 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * CEA LIST - Modification to support Facade code generation
*******************************************************************************/
-package org.eclipse.papyrus.facade.codegen.GenFacade;
+package org.eclipse.papyrus.facade.codegen.genfacade;
import java.io.File;
import java.io.IOException;
@@ -37,14 +38,14 @@ public class GenFacade extends AbstractAcceleoGenerator {
*
* @generated
*/
- public static final String MODULE_FILE_NAME = "/org/eclipse/papyrus/facade/codegen/GenFacade/GenFacade";
+ public static final String MODULE_FILE_NAME = "/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade"; //$NON-NLS-1$
/**
* The name of the templates that are to be generated.
*
* @generated
*/
- public static final String[] TEMPLATE_NAMES = { "GenAllGenClass" };
+ public static final String[] TEMPLATE_NAMES = { "GenAllGenClass" }; //$NON-NLS-1$
/**
* The list of properties files from the launch parameters (Launch configuration).
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/GenFacade.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.mtl
index 4751c33a8ab..3f688fde6df 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/GenFacade.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.mtl
@@ -1,22 +1,21 @@
-[comment encoding = UTF-8
-/*******************************************************************************
- * Copyright (c) 2011 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - Initial API and implementation
- *******************************************************************************/
-/]
+[comment]Copyright (c) 2008, 2012 Obeo.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8/]
[module GenFacade('http://www.eclipse.org/emf/2002/Ecore', 'http://www.eclipse.org/emf/2002/GenModel')/]
[import org::eclipse::emf::eef::codegen::ecore::model::buildproperties /]
[import org::eclipse::emf::eef::codegen::ecore::model::AdapterFactoryClass /]
[import org::eclipse::emf::eef::codegen::ecore::model::FactoryClass /]
-[import org::eclipse::emf::eef::codegen::ecore::model::PackageClass /]
-[import org::eclipse::papyrus::facade::codegen::GenFacade::Class /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::PackageClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::Class /]
[import org::eclipse::emf::eef::codegen::ecore::model::EnumClass /]
[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
@@ -27,16 +26,16 @@
[import org::eclipse::emf::eef::codegen::ecore::model::Plugin /]
[import org::eclipse::emf::eef::codegen::ecore::model::plugin_properties /]
[import org::eclipse::emf::eef::codegen::ecore::model::plugin_xml /]
-[import org::eclipse::papyrus::facade::codegen::GenFacade::ResourceClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::ResourceClass /]
[import org::eclipse::emf::eef::codegen::ecore::model::ResourceFactoryClass /]
[import org::eclipse::emf::eef::codegen::ecore::model::SwitchClass /]
[import org::eclipse::emf::eef::codegen::ecore::model::ValidatorClass /]
[import org::eclipse::emf::eef::codegen::ecore::model::XmlProcessorClass /]
[import org::eclipse::emf::eef::codegen::ecore::services::fileUtil /]
-[import org::eclipse::papyrus::facade::codegen::GenFacade::WrapperClass /]
-[import org::eclipse::papyrus::facade::codegen::GenFacade::LoaderClass /]
-[import org::eclipse::papyrus::facade::codegen::GenFacade::AbstractRepresentingClass /]
-[import org::eclipse::papyrus::facade::codegen::GenFacade::RepresentingElementAdapter /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::WrapperClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::LoaderClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::AbstractRepresentingClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::RepresentingElementAdapter /]
[import org::eclipse::papyrus::facade::codegen::utils::FacadeCodegenUtils /]
@@ -93,6 +92,8 @@
[p.prepareCache()/][comment Create helpers to cache and supply information for unique naming./]
[copyEcore(p)/]
+
+ [initUtilsCaches()/]
[for (genClass : GenClass | p.genClasses)]
[if (genClass.canGenerate())]
@@ -112,9 +113,7 @@
[if (p.hasClassifiers())]
- [comment @TODO
- if genModel.generateSchema -> generateSchema,
- if p.loadingInitialization -> generateSerialization/]
+
[if (not genModel.suppressEMFMetaData and not genModel.suppressInterfaces)]
[p.packageClass(true, false)/]
@@ -132,9 +131,9 @@
[p.xmlProcessorClass()/]
[/if]
- [if (p.hasConstraints())]
+ [comment][if (p.hasConstraints())]
[p.validatorClass()/]
- [/if]
+ [/if][/comment]
[if (p.adapterFactory and p.genClasses->notEmpty())]
[p.switchClass()/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/LoaderClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/LoaderClass.mtl
index 310a7f19d66..0be27c265bd 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/LoaderClass.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/LoaderClass.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module LoaderClass('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
@@ -56,7 +66,7 @@ import org.xml.sax.SAXException;
public class Loader {
public static Resource doLoad(InputStream inputStream, Map<?, ?> options, EFactory inputFactory, Resource res) throws IOException {
- System.err.println("Load : " + res);
+ //System.err.println("Load : " + res);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/PackageClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/PackageClass.mtl
new file mode 100644
index 00000000000..0ccb37a9895
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/PackageClass.mtl
@@ -0,0 +1,1289 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module PackageClass('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::common /]
+[import org::eclipse::emf::eef::codegen::ecore::services::header /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnum /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnumLiteral /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenOperation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenParameter /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenTypeParameter /]
+[import org::eclipse::emf::eef::codegen::ecore::model::genpackage::EGenericType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::EAnnotation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::StringUtil /]
+
+[template public packageClass(genPackage : GenPackage, isInterface : Boolean, isImplementation : Boolean)]
+[comment]
+ /**
+ * <copyright>
+ *
+ * Copyright (c) 2002-2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ */
+[/comment]
+[let genModel : GenModel = genPackage.genModel]
+[let packageName : String = genPackage.packageClassPackageName(isInterface)]
+[let className : String = genPackage.packageClassName(isImplementation)]
+
+[genModel.initializeImportManager(genPackage, packageName, className)/]
+
+[if (isImplementation)]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.EPackage.Registry')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.EPackage.Descriptor')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.EPackageImpl.EBasicWhiteList')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.EPackageImpl.EBasicWhiteList')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container.Dynamic')/]
+[if (genPackage.isLiteralsInterface())]
+ [genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + '.Literals')/]
+[/if]
+[for (genClassifier : GenClassifier | genPackage.getOrderedGenClassifiers())]
+ [genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + '.' + genPackage.getClassifierID(genClassifier))/]
+[/for]
+[/if]
+
+
+
+[file (packageClassPath(genPackage, isInterface, isImplementation), false, 'UTF-8')]
+[genModel.includeHeader()/]
+package [packageName/];
+[let content : String = genPackage.packageClassFileContent(isInterface, isImplementation, genModel, className)]
+[genModel.genSortedImports()/]
+
+[content.trim()/]
+[/let]
+[/file]
+
+
+
+[/let][comment className /]
+[/let][comment packageName /]
+[/let][comment genModel /]
+[/template]
+
+[template protected packageClassFileContent(genPackage : GenPackage, isInterface : Boolean, isImplementation : Boolean, genModel : GenModel, className : String)]
+[let publicStaticFinalFlag : String = if (isImplementation) then 'public static final ' else '' endif]
+[if (isImplementation)]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.EPackage.Registry')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.EPackage.Descriptor')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.EPackageImpl.EBasicWhiteList')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container.Dynamic')/]
+ [if (genPackage.isLiteralsInterface())]
+[genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + '.Literals')/]
+ [/if]
+ [for (genClassifier : GenClassifier | genPackage.getOrderedGenClassifiers())]
+ [genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + '.' + genPackage.getClassifierID(genClassifier))/]
+ [/for]
+[/if]
+[if (isInterface)]
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ [if (genModel.operationReflection)]
+ * <li>each operation of each class,</li>
+ [/if]
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ [if (genPackage.hasDocumentation())]
+ * <!-- begin-model-doc -->
+ * [genPackage.getDocumentation(genModel.getIndentation())/]
+ * <!-- end-model-doc -->
+ [/if]
+ * @see [genPackage.getQualifiedFactoryInterfaceName()/]
+ [if (not genModel.suppressEMFModelTags)]
+ [let modelInfoLines : Sequence(String) = genPackage.getModelInfo().tokenize(genModel.getLineDelimiter() + '\r')]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + ' * ')/]
+ [/if]
+ [/let]
+ [/if]
+ * @generated
+ */
+[else][comment isInterface /]
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+[/if][comment isInterface /]
+[if (isImplementation)]
+public class [className/] extends [genModel.getImportedName('org.eclipse.emf.ecore.impl.EPackageImpl')/][if (not isInterface)] implements [genPackage.getImportedPackageInterfaceName()/][/if] {
+[else]
+public interface [className/] extends [genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/] {
+[/if]
+[if (genModel.hasCopyrightField())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] copyright = [genModel.getCopyrightFieldLiteral()/];[genModel.getNonNLS()/]
+
+[/if]
+[if (isInterface)]
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] eNAME = "[genPackage.getPackageName()/]";[genModel.getNonNLS()/]
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] eNS_URI = "[genPackage.getNSURI()/]";[genModel.getNonNLS()/]
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] eNS_PREFIX = "[genPackage.getNSName()/]";[genModel.getNonNLS()/]
+ [if (genPackage.isContentType())]
+
+ /**
+ * The package content type ID.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] eCONTENT_TYPE = "[genPackage.contentTypeIdentifier/]";[genModel.getNonNLS()/]
+ [/if]
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genPackage.getPackageInterfaceName()/] eINSTANCE = [genPackage.getQualifiedPackageClassName()/].init();
+
+ [for (genClassifier : GenClassifier | genPackage.getOrderedGenClassifiers())]
+ /**
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [if (not genClass.isInterface())]
+ * The meta object id for the '{@link [genClass.getQualifiedClassName()/] <em>[genClass.getFormattedName()/]</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genClass.getQualifiedClassName()/]
+ [else]
+ * The meta object id for the '{@link [genClass.getQualifiedInterfaceName()/] <em>[genClass.getFormattedName()/]</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genClass.getQualifiedInterfaceName()/]
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenEnum))]
+ [let genEnum : GenEnum = genClassifier.oclAsType(GenEnum)]
+ * The meta object id for the '{@link [genEnum.getQualifiedName()/] <em>[genEnum.getFormattedName()/]</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genEnum.getQualifiedName()/]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ * The meta object id for the '<em>[genDataType.getFormattedName()/]</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ [if (not genDataType.isPrimitiveType() and not genDataType.isArrayType())]
+ * @see [genDataType.getRawInstanceClassName()/]
+ [/if]
+ [/let]
+ [/if][/if][/if]
+ * @see [genPackage.getQualifiedPackageClassName()/]#get[genClassifier.getClassifierAccessorName()/]()
+ * @generated
+ */
+ [publicStaticFinalFlag/]int [genPackage.getClassifierID(genClassifier)/] = [genPackage.getClassifierValue(genClassifier)/];
+
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [for (genFeature : GenFeature | genClass.getAllGenFeatures())]
+ /**
+ * The feature id for the '<em><b>[genFeature.getFormattedName()/]</b></em>' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [publicStaticFinalFlag/]int [genClass.getFeatureID(genFeature)/] = [genClass.getFeatureValue(genFeature)/];
+
+ [/for]
+ /**
+ * The number of structural features of the '<em>[genClass.getFormattedName()/]</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [publicStaticFinalFlag/]int [genClass.getFeatureCountID()/] = [genClass.getFeatureCountValue()/];
+
+ [if (genModel.operationReflection)]
+ [for (genOperation : GenOperation | genClass.getAllGenOperations(false))]
+ [if (genClass.getOverrideGenOperation(genOperation) = null)]
+ /**
+ * The operation id for the '<em>[genOperation.getFormattedName()/]</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [publicStaticFinalFlag/]int [genClass.getOperationID(genOperation, false)/] = [genClass.getOperationValue(genOperation)/];
+
+ [/if]
+ [/for]
+ /**
+ * The number of operations of the '<em>[genClass.getFormattedName()/]</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [publicStaticFinalFlag/]int [genClass.getOperationCountID()/] = [genClass.getOperationCountValue()/];
+
+ [/if]
+ [/let]
+ [/if]
+ [/for]
+[/if]
+[if (isImplementation)]
+ [if (genPackage.isLoadingInitialization())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected String packageFilename = "[genPackage.getSerializedPackageFilename()/]";[genModel.getNonNLS()/]
+
+ [/if]
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private [genClassifier.getImportedMetaType()/] [genClassifier.getClassifierInstanceName()/] = null;
+
+ [/for]
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see [genPackage.getQualifiedPackageInterfaceName()/]#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private [genPackage.getPackageClassName()/]() {
+ super(eNS_URI, [genPackage.getQualifiedEFactoryInstanceAccessor()/]);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link [genPackage.getImportedPackageInterfaceName()/]#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ [if (not genPackage.isLoadedInitialization())]
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ [/if]
+ * @generated
+ */
+ public static [genPackage.getImportedPackageInterfaceName()/] init() {
+ if (isInited) return ([genPackage.getImportedPackageInterfaceName()/])[genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([genPackage.getImportedPackageInterfaceName()/].eNS_URI);
+
+ [if (genModel.runtimePlatform = GenRuntimePlatform::GWT)]
+ initializeRegistryHelpers();
+
+ [/if]
+ // Obtain or create and register package
+ [genPackage.getPackageClassName()/] the[genPackage.getBasicPackageName()/] = ([genPackage.getPackageClassName()/])([genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.get(eNS_URI) instanceof [genPackage.getPackageClassName()/] ? [genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.get(eNS_URI) : new [genPackage.getPackageClassName()/]());
+
+ isInited = true;
+
+ [if (genPackage.getPackageSimpleDependencies()->notEmpty())]
+ // Initialize simple dependencies
+ [for (dep : GenPackage | genPackage.getPackageSimpleDependencies())]
+ [dep.getImportedPackageInterfaceName()/].eINSTANCE.eClass();
+ [/for]
+
+ [/if]
+ [if (genPackage.getPackageInterDependencies()->notEmpty())]
+ // Obtain or create and register interdependencies
+ [for (interdep : GenPackage | genPackage.getPackageInterDependencies())]
+ [interdep.getImportedPackageClassName()/] [genPackage.getPackageInstanceVariable(interdep)/] = ([interdep.getImportedPackageClassName()/])([genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([interdep.getImportedPackageInterfaceName()/].eNS_URI) instanceof [interdep.getImportedPackageClassName()/] ? [genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([interdep.getImportedPackageInterfaceName()/].eNS_URI) : [interdep.getImportedPackageInterfaceName()/].eINSTANCE);
+ [/for]
+
+ [/if]
+ [if (genPackage.isLoadedInitialization() or genPackage.getPackageLoadInterDependencies()->notEmpty())]
+ // Load packages
+ [if (genPackage.isLoadingInitialization())]
+ the[genPackage.getBasicPackageName()/].loadPackage();
+ [/if]
+ [for (interdep : GenPackage | genPackage.getPackageLoadInterDependencies())]
+ [if (interdep.isLoadingInitialization())]
+ [genPackage.getPackageInstanceVariable(interdep)/].loadPackage();
+ [/if]
+ [/for]
+
+ [/if]
+ [if (not genPackage.isLoadedInitialization() or genPackage.getPackageBuildInterDependencies()->notEmpty())]
+ // Create package meta-data objects
+ [if (not genPackage.isLoadedInitialization())]
+ the[genPackage.getBasicPackageName()/].createPackageContents();
+ [/if]
+ [for (interdep : GenPackage | genPackage.getPackageBuildInterDependencies())]
+ [genPackage.getPackageInstanceVariable(interdep)/].createPackageContents();
+ [/for]
+
+ // Initialize created meta-data
+ [if (not genPackage.isLoadedInitialization())]
+ the[genPackage.getBasicPackageName()/].initializePackageContents();
+ [/if]
+ [for (interdep : GenPackage | genPackage.getPackageBuildInterDependencies())]
+ [genPackage.getPackageInstanceVariable(interdep)/].initializePackageContents();
+ [/for]
+
+ [/if]
+ [if (genPackage.isLoadedInitialization() or genPackage.getPackageLoadInterDependencies()->notEmpty())]
+ // Fix loaded packages
+ [if (genPackage.isLoadedInitialization())]
+ the[genPackage.getBasicPackageName()/].fixPackageContents();
+ [/if]
+ [for (interdep : GenPackage | genPackage.getPackageLoadInterDependencies())]
+ [genPackage.getPackageInstanceVariable(interdep)/].fixPackageContents();
+ [/for]
+
+ [/if]
+ [comment][if (genPackage.hasConstraints())]
+ // Register package validator
+ [genModel.getImportedName('org.eclipse.emf.ecore.EValidator')/].Registry.INSTANCE.put
+ (the[genPackage.getBasicPackageName()/],
+ new [genModel.getImportedName('org.eclipse.emf.ecore.EValidator')/].Descriptor()
+ {
+ public [genModel.getImportedName('org.eclipse.emf.ecore.EValidator')/] getEValidator()
+ {
+ return [genPackage.getImportedValidatorClassName()/].INSTANCE;
+ }
+ });
+
+ [/if][/comment]
+ [if (not genPackage.isEcorePackage())]
+ // Mark meta-data to indicate it can't be changed
+ the[genPackage.getBasicPackageName()/].freeze();
+
+ [/if]
+
+ // Update the registry and return the package
+ [genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.put([genPackage.getImportedPackageInterfaceName()/].eNS_URI, the[genPackage.getBasicPackageName()/]);
+ return the[genPackage.getBasicPackageName()/];
+ }
+ [if (genModel.runtimePlatform = GenRuntimePlatform::GWT)]
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static void initializeRegistryHelpers() {
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [if (not genClass.dynamic)]
+ [genModel.getImportedName('org.eclipse.emf.common.util.Reflect')/].register
+ ([if (genClass.isMapEntry())][genClass.getImportedClassName()/][else][genClass.getRawImportedInterfaceName()/][/if].class,
+ new [genModel.getImportedName('org.eclipse.emf.common.util.Reflect')/].Helper()
+ {
+ public boolean isInstance(Object instance)
+ {
+ return instance instanceof [if (genClass.isMapEntry())][genClass.getImportedClassName()/][else][genClass.getRawImportedInterfaceName()/][genClass.getInterfaceWildTypeArguments()/][/if];
+ }
+
+ public Object newArrayInstance(int size)
+ {
+ return new [if (genClass.isMapEntry())][genClass.getImportedClassName()/][else][genClass.getRawImportedInterfaceName()/][/if]['[size]'/];
+ }
+ });
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ [if (not genDataType.isPrimitiveType() and not genDataType.isObjectType())]
+ [genModel.getImportedName('org.eclipse.emf.common.util.Reflect')/].register
+ ([genDataType.getRawImportedInstanceClassName()/].class,
+ new [genModel.getImportedName('org.eclipse.emf.common.util.Reflect')/].Helper() {
+ public boolean isInstance(Object instance) {
+ return instance instanceof [genDataType.getImportedWildcardInstanceClassName()/];
+ }
+
+ public Object newArrayInstance(int size) {
+ [if (genDataType.isArrayType())]
+ [let componentType :String = genDataType.getRawImportedInstanceClassName().replaceAll('(?:\\[\\])+$', '')]
+ [let indices : String = genDataType.getRawImportedInstanceClassName().replaceAll('.*(?:\\[\\])+$', '$1')]
+ return new [componentType/]['[size]'/][indices/];
+ [/let]
+ [/let]
+ [else]
+ return new [genDataType.getRawImportedInstanceClassName()/]['[size]'/];
+ [/if]
+ }
+ });
+ [/if]
+ [/let]
+ [/if][/if]
+ [/for]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class WhiteList implements [genModel.getImportedName('com.google.gwt.user.client.rpc.IsSerializable')/], EBasicWhiteList {
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [if (not genClass.dynamic)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [if (genClass.isMapEntry())][genClass.getImportedClassName()/][else][genClass.getImportedWildcardInstanceClassName()/][/if] [genClass.getSafeUncapName()/];
+
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ [if (not genDataType.isObjectType() and genDataType.isSerializable())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genDataType.getImportedWildcardInstanceClassName()/] [genDataType.getSafeUncapName()/];
+
+ [/if]
+ [/let]
+ [/if][/if]
+ [/for]
+ }
+ [/if]
+
+[/if]
+[if (isInterface)][comment TODO REMOVE THIS BOGUS EMPTY LINE /]
+
+[/if]
+[for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ [if (isInterface)]
+ /**
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ * Returns the meta object for class '{@link [genClass.getQualifiedInterfaceName()/] <em>[genClass.getFormattedName()/]</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>[genClass.getFormattedName()/]</em>'.
+ * @see [genClass.getQualifiedInterfaceName()/]
+ [if (not genModel.suppressEMFModelTags and (genClass.isExternalInterface() or genClass.dynamic))]
+ [let modelInfoLines : Sequence(String) = genClass.getModelInfo().tokenize(genModel.getLineDelimiter() + '\r')]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + '\t * ')/]
+ [/if]
+ [/let]
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenEnum))]
+ [let genEnum : GenEnum = genClassifier.oclAsType(GenEnum)]
+ * Returns the meta object for enum '{@link [genEnum.getQualifiedName()/] <em>[genEnum.getFormattedName()/]</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>[genEnum.getFormattedName()/]</em>'.
+ * @see [genEnum.getQualifiedName()/]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ [if (genDataType.isPrimitiveType() or genDataType.isArrayType())]
+ * Returns the meta object for data type '<em>[genDataType.getFormattedName()/]</em>'.
+ [else]
+ * Returns the meta object for data type '{@link [genDataType.getRawInstanceClassName()/] <em>[genDataType.getFormattedName()/]</em>}'.
+ [/if]
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>[genDataType.getFormattedName()/]</em>'.
+ [if (not genDataType.isPrimitiveType() and not genDataType.isArrayType())]
+ * @see [genDataType.getRawInstanceClassName()/]
+ [/if]
+ [if (not genModel.suppressEMFModelTags)]
+ [let modelInfoLines : Sequence(String) = genDataType.getModelInfo().tokenize(genModel.getLineDelimiter() + '\r')]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + '\t * ')/]
+ [/if]
+ [/let]
+ [/if]
+ [/let]
+ [/if][/if][/if]
+ * @generated
+ */
+ [else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [/if]
+ [if (isImplementation)]
+ public [genClassifier.getImportedMetaType()/] get[genClassifier.getClassifierAccessorName()/]() {
+ [if (genPackage.isLoadedInitialization())]
+ if ([genClassifier.getClassifierInstanceName()/] == null) {
+ [genClassifier.getClassifierInstanceName()/] = ([genClassifier.getImportedMetaType()/])[genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([genPackage.getImportedPackageInterfaceName()/].eNS_URI).getEClassifiers().get([genPackage.getLocalClassifierIndex(genClassifier)/]);
+ }
+ [/if]
+ return [genClassifier.getClassifierInstanceName()/];
+ }
+
+ [else]
+ [genClassifier.getImportedMetaType()/] get[genClassifier.getClassifierAccessorName()/]();
+
+ [/if]
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [for (genFeature : GenFeature | genClass.genFeatures)]
+ [if (isInterface)]
+ /**
+ * Returns the meta object for the [genFeature.getFeatureKind()/] '{@link [genClass.getQualifiedInterfaceName()/][if (not genClass.isMapEntry() and not genFeature.isSuppressedGetVisibility())]#[genFeature.getGetAccessor()/][/if] <em>[genFeature.getFormattedName()/]</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the [genFeature.getFeatureKind()/] '<em>[genFeature.getFormattedName()/]</em>'.
+ * @see [genClass.getQualifiedInterfaceName()/][if (not genClass.isMapEntry() and not genFeature.isSuppressedGetVisibility())]#[genFeature.getGetAccessor()/]()[/if]
+ * @see #get[genClass.getClassifierAccessorName()/]()
+ * @generated
+ */
+ [else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [/if]
+ [if (isImplementation)]
+ public [genFeature.getImportedMetaType()/] get[genFeature.getFeatureAccessorName()/]() {
+ [if (not genPackage.isLoadedInitialization())]
+ return ([genFeature.getImportedMetaType()/])[genClass.getClassifierInstanceName()/].getEStructuralFeatures().get([genClass.getLocalFeatureIndex(genFeature)/]);
+ [else]
+ return ([genFeature.getImportedMetaType()/])get[genClassifier.getClassifierAccessorName()/]().getEStructuralFeatures().get([genClass.getLocalFeatureIndex(genFeature)/]);
+ [/if]
+ }
+ [else]
+ [genFeature.getImportedMetaType()/] get[genFeature.getFeatureAccessorName()/]();
+ [/if]
+
+ [/for]
+ [if (genModel.operationReflection)]
+ [for (genOperation : GenOperation | genClass.genOperations)]
+ [if (isInterface)]
+ /**
+ * Returns the meta object for the '{@link [genClass.getQualifiedInterfaceName()/]#[genOperation.getName()/]([genOperation.getParameterTypes(', ')/]) <em>[genOperation.getFormattedName()/]</em>}' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the '<em>[genOperation.getFormattedName()/]</em>' operation.
+ * @see [genClass.getQualifiedInterfaceName()/]#[genOperation.getName()/]([genOperation.getParameterTypes(', ')/])
+ * @generated
+ */
+ [else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [/if]
+ [if (isImplementation)]
+ public [genOperation.getImportedMetaType()/] get[genOperation.getOperationAccessorName()/]() {
+ [if (not genPackage.isLoadedInitialization())]
+ return [genClass.getClassifierInstanceName()/].getEOperations().get([genClass.getLocalOperationIndex(genOperation)/]);
+ [else]
+ return get[genClassifier.getClassifierAccessorName()/]().getEOperations().get([genClass.getLocalOperationIndex(genOperation)/]);
+ [/if]
+ }
+ [else]
+ [genOperation.getImportedMetaType()/] get[genOperation.getOperationAccessorName()/]();
+ [/if]
+
+ [/for]
+ [/if]
+ [/let]
+ [/if]
+[/for]
+[if (isInterface)]
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+[else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+[/if]
+[if (isImplementation)]
+ public [genPackage.getImportedFactoryInterfaceName()/] get[genPackage.getFactoryName()/]() {
+ return ([genPackage.getImportedFactoryInterfaceName()/])getEFactoryInstance();
+ }
+[else]
+ [genPackage.getFactoryInterfaceName()/] get[genPackage.getFactoryName()/]();
+[/if]
+
+[if (isImplementation)]
+ [if (not genPackage.isLoadedInitialization())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ [if (genPackage.genClasses->notEmpty())]
+ // Create classes and their features
+ [for (genClass : GenClass | genPackage.genClasses) separator (genModel.getLineDelimiter())]
+ [genClass.getClassifierInstanceName()/] = create[genClass.getMetaType()/]([genClass.getClassifierID()/]);
+ [for (genFeature : GenFeature | genClass.genFeatures)]
+ create[genFeature.getMetaType()/]([genClass.getClassifierInstanceName()/], [genClass.getFeatureID(genFeature)/]);
+ [/for]
+ [if (genModel.operationReflection)]
+ [for (genOperation : GenOperation | genClass.genOperations)]
+ createEOperation([genClass.getClassifierInstanceName()/], [genClass.getOperationID(genOperation, false)/]);
+ [/for]
+ [/if]
+ [/for]
+ [/if]
+ [if (genPackage.genEnums->notEmpty())]
+
+ // Create enums
+ [for (genEnum : GenEnum | genPackage.genEnums)]
+ [genEnum.getClassifierInstanceName()/] = createEEnum([genEnum.getClassifierID()/]);
+ [/for]
+ [/if]
+ [if (genPackage.genDataTypes->notEmpty())]
+
+ // Create data types
+ [for (genDataType : GenDataType | genPackage.genDataTypes)]
+ [genDataType.getClassifierInstanceName()/] = createEDataType([genDataType.getClassifierID()/]);
+ [/for]
+ [/if]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+ [if (genPackage.getPackageInitializationDependencies()->notEmpty())]
+
+ // Obtain other dependent packages
+ [for (dep : GenPackage | genPackage.getPackageInitializationDependencies())]
+ [dep.getImportedPackageInterfaceName()/] [genPackage.getPackageInstanceVariable(dep)/] = ([dep.getImportedPackageInterfaceName()/])[genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([dep.getImportedPackageInterfaceName()/].eNS_URI);
+ [/for]
+ [/if]
+ [if (genPackage.getSubGenPackages()->notEmpty())]
+
+ // Add subpackages
+ [for (sub : GenPackage | genPackage.getSubGenPackages())]
+ getESubpackages().add([genPackage.getPackageInstanceVariable(sub)/]);
+ [/for]
+ [/if]
+ [if (genPackage.genClasses->notEmpty())]
+ [comment { boolean firstOperationAssignment = true; int maxTypeParameterAssignment = 0;/]
+ [if (genModel.useGenerics())]
+
+ // Create type parameters
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ [for (genTypeParameter : GenTypeParameter | genClassifier.genTypeParameters)]
+ [if (genTypeParameter.ecoreTypeParameter.eBounds->notEmpty() or genTypeParameter.isUsed())]
+ [genModel.getImportedName('org.eclipse.emf.ecore.ETypeParameter')/] [genClassifier.getClassifierInstanceName()/]_[genTypeParameter.getName()/] = addETypeParameter([genClassifier.getClassifierInstanceName()/], "[genTypeParameter.getName()/]");[genModel.getNonNLS()/]
+ [else]
+ addETypeParameter([genClassifier.getClassifierInstanceName()/], "[genTypeParameter.getName()/]");[genModel.getNonNLS()/]
+ [/if]
+ [/for]
+ [/for]
+ [/if]
+
+ [if (genModel.useGenerics())]
+
+ // Set bounds for type parameters[genPackage.resetMaxGenericTypeAssignment()/][genPackage.resetGenOperationPrefix()/]
+ [for (genClassifier : GenClassifier |genPackage.genClassifiers)]
+ [for (genTypeParameter : GenTypeParameter | genClassifier.genTypeParameters)]
+ [for (bound : EGenericType | genTypeParameter.ecoreTypeParameter.eBounds)]
+ [genPackage.prefix(0)/]g1 = createEGenericType([bound.type(genModel, genPackage)/]);
+ [for (eGenericType : EGenericType | bound.eAllContents(EGenericType))]
+ [comment]<%for (InformationIterator i=new InformationIterator(bound); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>[/comment]
+ [genPackage.prefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/for]
+ [genClassifier.getClassifierInstanceName()/]_[genTypeParameter.getName()/].getEBounds().add(g1);
+ [/for]
+ [/for]
+ [/for]
+ [/if]
+
+ // Add supertypes to classes
+ [for (genClass : GenClass | genPackage.genClasses)]
+ [if (not genClass.hasGenericSuperTypes())]
+ [for (baseGenClass : GenClass | genClass.getBaseGenClasses())]
+ [genClass.getClassifierInstanceName()/].getESuperTypes().add([genPackage.getPackageInstanceVariable(baseGenClass.genPackage)/].get[baseGenClass.getClassifierAccessorName()/]());
+ [/for]
+ [else]
+ [for (superType : EGenericType | genClass.ecoreClass.eGenericSuperTypes)]
+ [genPackage.prefix(0)/]g1 = createEGenericType([superType.type(genModel, genPackage)/]);
+ [for (eGenericType : EGenericType | superType.eAllContents(EGenericType))]
+ [comment]<%for (InformationIterator i=new InformationIterator(superType); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>[/comment]
+ [genPackage.prefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/for]
+ [genClass.getClassifierInstanceName()/].getEGenericSuperTypes().add(g1);
+ [/for]
+ [/if]
+ [/for]
+
+ // Initialize classes[if (genModel.operationReflection)], features, and operations; add parameters[else] and features; add operations and parameters[/if]
+ [for (genClass : GenClass | genPackage.genClasses) separator(genModel.getLineDelimiter())]
+ [let hasInstanceTypeName : Boolean = genModel.useGenerics() and genClass.ecoreClass.instanceTypeName <> null and genClass.ecoreClass.instanceTypeName.contains('<')]
+ initEClass([genClass.getClassifierInstanceName()/], [if (genClass.dynamic)]null[else][genClass.getRawImportedInterfaceName()/].class[/if], "[genClass.getName()/]", [genClass.getAbstractFlag()/], [genClass.getInterfaceFlag()/], [genClass.getGeneratedInstanceClassFlag()/][if (hasInstanceTypeName)], "[genClass.ecoreClass.instanceTypeName/]"[/if]);[genModel.getNonNLS()/][if (hasInstanceTypeName)][genModel.getNonNLS(2)/][/if]
+ [for (genFeature : GenFeature |genClass.genFeatures)]
+ [if (genFeature.hasGenericType())]
+ [let genericType : EGenericType = genFeature.ecoreFeature.eGenericType]
+ [genPackage.prefix(0)/]g1 = createEGenericType([genericType.type(genModel, genPackage)/]);
+ [for (eGenericType : EGenericType | genericType.eAllContents(EGenericType))]
+ [comment]<%for (InformationIterator i=new InformationIterator(genFeature.getEcoreFeature().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>[/comment]
+ [genPackage.prefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/for]
+ [/let]
+ [/if]
+ [if (genFeature.isReferenceType())]
+ [let reverse : String = if (genFeature.getReverse() = null) then 'null' else genPackage.getPackageInstanceVariable(genFeature.getReverse().getGenPackage()) + '.get' + genFeature.getReverse().getFeatureAccessorName() + '()' endif]
+ initEReference(get[genFeature.getFeatureAccessorName()/](), [if (genFeature.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())/].get[genFeature.getTypeClassifierAccessorName()/]()[/if], [reverse/], "[genFeature.getName()/]", [genFeature.getDefaultValue()/], [genFeature.getLowerBound()/], [genFeature.getUpperBound()/], [genFeature.getContainerClass()/], [genFeature.getTransientFlag()/], [genFeature.getVolatileFlag()/], [genFeature.getChangeableFlag()/], [genFeature.getContainmentFlag()/], [genFeature.getResolveProxiesFlag()/], [genFeature.getUnsettableFlag()/], [genFeature.getUniqueFlag()/], [genFeature.getDerivedFlag()/], [genFeature.getOrderedFlag()/]);[genModel.getNonNLS()/][genModel.getNonNLS(genFeature.getDefaultValue(), 2)/]
+ [for (keyFeature : GenFeature |genFeature.getKeys())]
+ get[genFeature.getFeatureAccessorName()/]().getEKeys().add([genPackage.getPackageInstanceVariable(keyFeature.getGenPackage())/].get[keyFeature.getFeatureAccessorName()/]());
+ [/for]
+ [/let]
+ [else]
+ initEAttribute(get[genFeature.getFeatureAccessorName()/](), [if (genFeature.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())/].get[genFeature.getTypeClassifierAccessorName()/]()[/if], "[genFeature.getName()/]", [genFeature.getDefaultValue()/], [genFeature.getLowerBound()/], [genFeature.getUpperBound()/], [genFeature.getContainerClass()/], [genFeature.getTransientFlag()/], [genFeature.getVolatileFlag()/], [genFeature.getChangeableFlag()/], [genFeature.getUnsettableFlag()/], [genFeature.getIDFlag()/], [genFeature.getUniqueFlag()/], [genFeature.getDerivedFlag()/], [genFeature.getOrderedFlag()/]);[genModel.getNonNLS()/][genModel.getNonNLS(genFeature.getDefaultValue(), 2)/]
+ [/if]
+ [/for]
+ [for (genOperation : GenOperation | genClass.genOperations)]
+
+ [if (genModel.useGenerics())]
+ [genOperation.prefix()/][if (genModel.operationReflection)]initEOperation(get[genOperation.getOperationAccessorName()/]()[else]addEOperation([genClass.getClassifierInstanceName()/][/if], [if (genOperation.isVoid() or genOperation.hasGenericType())]null[else][genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())/].get[genOperation.getTypeClassifierAccessorName()/]()[/if], "[genOperation.getName()/]", [genOperation.getLowerBound()/], [genOperation.getUpperBound()/], [genOperation.getUniqueFlag()/], [genOperation.getOrderedFlag()/]);[genModel.getNonNLS()/]
+ [else][if (not genOperation.isVoid())]
+ [if (not genOperation.ecoreOperation.ordered or not genOperation.ecoreOperation.unique)]
+ [genPackage.requireAddEOperation()/][genOperation.prefix()/][if (genModel.operationReflection)]initEOperation(get[genOperation.getOperationAccessorName()/]()[else]addEOperation([genClass.getClassifierInstanceName()/][/if], [genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())/].get[genOperation.getTypeClassifierAccessorName()/](), "[genOperation.getName()/]", [genOperation.getLowerBound()/], [genOperation.getUpperBound()/], [genOperation.getUniqueFlag()/], [genOperation.getOrderedFlag()/]);[genModel.getNonNLS()/]
+ [else]
+ [genOperation.prefix()/][if (genModel.operationReflection)]initEOperation(get[genOperation.getOperationAccessorName()/]()[else]addEOperation([genClass.getClassifierInstanceName()/][/if], [genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())/].get[genOperation.getTypeClassifierAccessorName()/](), "[genOperation.getName()/]", [genOperation.getLowerBound()/], [genOperation.getUpperBound()/]);[genModel.getNonNLS()/]
+ [/if]
+ [else]
+ [genOperation.prefix()/][if (genModel.operationReflection)]initEOperation(get[genOperation.getOperationAccessorName()/]()[else]addEOperation([genClass.getClassifierInstanceName()/][/if], null, "[genOperation.getName()/]");[genModel.getNonNLS()/]
+ [/if][/if]
+ [if (genModel.useGenerics())]
+ [for (genTypeParameter : GenTypeParameter | genOperation.genTypeParameters)][comment @TODO remove let typeParameterVariable /]
+ [let typeParameterVariable : String =
+ if (genTypeParameter.ecoreTypeParameter.eBounds->notEmpty() or genTypeParameter.isUsed()) then
+ if (i = 1) then
+ genModel.getImportedName('org.eclipse.emf.ecore.ETypeParameter') + ' t' + i + ' = '
+ else
+ 't' + i + ' = '
+ endif
+ else
+ ''
+ endif
+ ]
+ [comment for (ListIterator<GenTypeParameter> t=genOperation.getGenTypeParameters().listIterator(); t.hasNext(); ) {
+ GenTypeParameter genTypeParameter = t.next();
+ String typeParameterVariable = "";
+ if (genTypeParameter.getEcoreTypeParameter().getEBounds()->notEmpty() || genTypeParameter.isUsed()) {
+ if (maxTypeParameterAssignment <= t.previousIndex()) {
+ ++maxTypeParameterAssignment;
+ typeParameterVariable = genModel.getImportedName("org.eclipse.emf.ecore.ETypeParameter") + " t" + t.nextIndex() + " = ";
+ } else {
+ typeParameterVariable = "t" + t.nextIndex() + " = ";
+ }
+ } /]
+ [typeParameterVariable/]addETypeParameter(op, "[genTypeParameter.getName()/]");[genModel.getNonNLS()/]
+ [for (typeParameter : EGenericType | genTypeParameter.ecoreTypeParameter.eBounds)]
+[comment <%for (InformationIterator i=new InformationIterator(typeParameter); i.hasNext(); ) {
+ Information info = i.next(); String typePrefix = "";
+ if (maxGenericTypeAssignment <= eGenericType.depth()) {
+ ++maxGenericTypeAssignment;
+ typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " ";
+ }%>/]
+ [for (eGenericType : EGenericType | Sequence{typeParameter}->union(typeParameter.eAllContents(EGenericType)))]
+ [genPackage.typePrefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ [if (eGenericType.depth() > 0)]
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/if]
+ [/for]
+ t[i + 1/].getEBounds().add(g1);
+ [/for]
+ [/let]
+ [/for]
+ [/if]
+ [for (genParameter : GenParameter | genOperation.genParameters)]
+ [if (genParameter.hasGenericType())]
+ [for (eGenericType : EGenericType | genParameter.ecoreParameter.eAllContents(EGenericType))]
+ [comment <%for (InformationIterator i=new InformationIterator(genParameter.getEcoreParameter().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>/]
+ [genPackage.typePrefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ [if (eGenericType.depth() > 0)]
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/if]
+ [/for]
+ [/if]
+ [if (genModel.useGenerics())]
+ addEParameter(op, [if (genParameter.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())/].get[genParameter.getTypeClassifierAccessorName()/]()[/if], "[genParameter.getName()/]", [genParameter.getLowerBound()/], [genParameter.getUpperBound()/], [genParameter.getUniqueFlag()/], [genParameter.getOrderedFlag()/]);[genModel.getNonNLS()/]
+ [else][if (not genParameter.ecoreParameter.ordered or not genParameter.ecoreParameter.unique)]
+ [genPackage.requireAddEParameter()/]addEParameter(op, [if (genParameter.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())/].get[genParameter.getTypeClassifierAccessorName()/]()[/if], "[genParameter.getName()/]", [genParameter.getLowerBound()/], [genParameter.getUpperBound()/], [genParameter.getUniqueFlag()/], [genParameter.getOrderedFlag()/]);[genModel.getNonNLS()/]
+ [else]
+ addEParameter(op, [if (genParameter.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())/].get[genParameter.getTypeClassifierAccessorName()/]()[/if], "[genParameter.getName()/]", [genParameter.getLowerBound()/], [genParameter.getUpperBound()/]);[genModel.getNonNLS()/]
+ [/if][/if]
+ [/for]
+ [if (genOperation.hasGenericExceptions())]
+ [for (genericExceptions : EGenericType | genOperation.ecoreOperation.eGenericExceptions)]
+ [for (eGenericType : EGenericType | genericExceptions.eAllContents(EGenericType)->flatten())]
+ [comment <%for (InformationIterator i=new InformationIterator(genericExceptions); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>/]
+ [genPackage.typePrefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ [if (eGenericType.depth() > 0)]
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/if]
+ addEException(op, g[eGenericType.depth() + 1/]);
+ [/for]
+ [/for]
+ [else]
+ [for (genException : GenClassifier | genOperation.getGenExceptions())]
+ addEException(op, [genPackage.getPackageInstanceVariable(genException.genPackage)/].get[genException.getClassifierAccessorName()/]());
+ [/for]
+ [/if]
+ [if (not genOperation.isVoid() and genOperation.hasGenericType())]
+ [for (eGenericType : EGenericType | Sequence{genOperation.ecoreOperation.eGenericType}->union(genOperation.ecoreOperation.eGenericType.eAllContents(EGenericType)))]
+ [comment]<%for (InformationIterator i=new InformationIterator(genOperation.getEcoreOperation().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>[/comment]
+ [genPackage.typePrefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ [if (eGenericType.depth() > 0)]
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/if]
+ [/for]
+ initEOperation(op, g1);
+ [/if]
+ [/for][comment genOperation/]
+ [/let]
+ [/for]
+ [/if]
+ [if (genPackage.genEnums->notEmpty())]
+
+ // Initialize enums and add enum literals
+ [for (genEnum : GenEnum | genPackage.genEnums) separator(genModel.getLineDelimiter())]
+ initEEnum([genEnum.getClassifierInstanceName()/], [genModel.getImportedName(genEnum.getQualifiedName())/].class, "[genEnum.getName()/]");[genModel.getNonNLS()/]
+ [for (genEnumLiteral : GenEnumLiteral |genEnum.genEnumLiterals)]
+ addEEnumLiteral([genEnum.getClassifierInstanceName()/], [if (genModel.getImportedName(genEnum.getQualifiedName()) = genEnum.getClassifierID())][genEnum.getQualifiedName()/][else][genModel.getImportedName(genEnum.getQualifiedName())/][/if].[genEnumLiteral.getEnumLiteralInstanceConstantName()/]);
+ [/for]
+ [/for]
+ [/if]
+ [if (genPackage.genDataTypes->notEmpty())]
+
+ // Initialize data types
+ [for (genDataType : GenDataType | genPackage.genDataTypes)]
+ [let hasInstanceTypeName : Boolean = genModel.useGenerics() and genDataType.ecoreDataType.instanceTypeName <> null and genDataType.ecoreDataType.instanceTypeName.contains('<')]
+ initEDataType([genDataType.getClassifierInstanceName()/], [genDataType.getRawImportedInstanceClassName()/].class, "[genDataType.getName()/]", [genDataType.getSerializableFlag()/], [genDataType.getGeneratedInstanceClassFlag()/][if (hasInstanceTypeName)], "[genDataType.ecoreDataType.instanceTypeName/]"[/if]);[genModel.getNonNLS()/][if (hasInstanceTypeName)][genModel.getNonNLS(2)/][/if]
+ [/let]
+ [/for]
+ [/if]
+ [if (genPackage.getSuperGenPackage() = null)]
+
+ // Create resource
+ createResource(eNS_URI);
+ [/if]
+ [if (not genPackage.isEcorePackage() and genPackage.getAnnotationSources()->notEmpty())]
+
+ // Create annotations
+ [for (annotationSource : String |genPackage.getAnnotationSources())]
+ // [annotationSource/]
+ create[genPackage.getAnnotationSourceIdentifier(annotationSource)/]Annotations();
+ [/for]
+ [/if]
+ }
+
+ [for (annotationSource : String | genPackage.getAnnotationSources())]
+ /**
+ * Initializes the annotations for <b>[annotationSource/]</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void create[genPackage.getAnnotationSourceIdentifier(annotationSource)/]Annotations() {
+ String source = [if (annotationSource = null)]null;[else]"[annotationSource/]";[genModel.getNonNLS()/][/if]
+ [for (eAnnotation : EAnnotation | genPackage.getAllAnnotations())]
+ [let annotationReferenceDataList : Sequence(Sequence(OclAny)) = eAnnotation.getReferenceData(genPackage)]
+ [comment] @TODO How? use collect(some transformation) on annotationSource creation
+[if (annotationSource = null)][eAnnotation.source = null/][else][annotationSource = eAnnotation.source/][/if][/comment]
+ addAnnotation
+ ([genPackage.getAnnotatedModelElementAccessor(eAnnotation)/],
+ source,
+ new String['[]'/]
+ {
+ [eAnnotation.writeKeyValuePairs(genModel)/]
+ }[if (eAnnotation.hasReferenceData(genPackage))]);[else],[/if]
+ [if (not eAnnotation.hasReferenceData(genPackage))]
+ new [genModel.getImportedName('org.eclipse.emf.common.util.URI')/]['[]'/]
+ {
+ [for (annotationReferenceData : Sequence(OclAny) | annotationReferenceDataList) separator (',' + genModel.getNonNLS())]
+ [genModel.getImportedName('org.eclipse.emf.common.util.URI')/].createURI([if (annotationReferenceData->at(1) <> genPackage)][annotationReferenceData->at(1).oclAsType(GenPackage).getImportedPackageInterfaceName()/].[/if]eNS_URI).appendFragment("[annotationReferenceData->at(2)/]")[/for][genModel.getNonNLS()/]
+ });
+ [/if]
+ [for (nestedEAnnotation : EAnnotation | genPackage.getAllNestedAnnotations(eAnnotation))]
+ [let nestedAnnotationSource : String = nestedEAnnotation.source]
+ [let depth : Integer = nestedEAnnotation.depth()]
+ [let nestedAnnotationReferenceDataList : Sequence(Sequence(OclAny)) = nestedEAnnotation.getReferenceData(genPackage)]
+ addAnnotation
+ ([genPackage.getAnnotatedModelElementAccessor(eAnnotation)/],
+ [depth/],
+ [if (nestedAnnotationSource = null)]null,[else]"[nestedAnnotationSource/]",[genModel.getNonNLS()/][/if]
+ new String['[]'/]
+ {
+ [nestedEAnnotation.writeKeyValuePairs(genModel)/]
+ }[if (nestedEAnnotation.hasReferenceData(genPackage))]);[else],[/if]
+ [if (not nestedEAnnotation.hasReferenceData(genPackage))]
+ new [genModel.getImportedName('org.eclipse.emf.common.util.URI')/]['[]'/]
+ {
+ [for (annotationReferenceData : Sequence(OclAny) | nestedAnnotationReferenceDataList) separator (',' + genModel.getNonNLS())]
+ [genModel.getImportedName('org.eclipse.emf.common.util.URI')/].createURI([if (annotationReferenceData->at(1) <> genPackage)][annotationReferenceData->at(1).oclAsType(GenPackage).getImportedPackageInterfaceName()/].[/if]eNS_URI).appendFragment("[annotationReferenceData->at(2)/]")[/for][genModel.getNonNLS()/]
+ });
+ [/if]
+ [/let]
+ [/let]
+ [/let]
+ [/for]
+ [/let]
+ [/for]
+ }
+
+ [/for]
+ [else]
+ [if (genPackage.isLoadingInitialization())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isLoaded = false;
+
+ /**
+ * Laods the package and any sub-packages from their serialized form.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void loadPackage() {
+ if (isLoaded) return;
+ isLoaded = true;
+
+ [genModel.getImportedName('java.net.URL')/] url = getClass().getResource(packageFilename);
+ if (url == null) {
+ throw new RuntimeException("Missing serialized package: " + packageFilename);[genModel.getNonNLS()/]
+ }
+ [genModel.getImportedName('org.eclipse.emf.common.util.URI')/] uri = [genModel.getImportedName('org.eclipse.emf.common.util.URI')/].createURI(url.toString());
+ [genModel.getImportedName('org.eclipse.emf.ecore.resource.Resource')/] resource = new [genModel.getImportedName('org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl')/]().createResource(uri);
+ try {
+ resource.load(null);
+ }
+ catch ([genModel.getImportedName('java.io.IOException')/] exception) {
+ throw new [genModel.getImportedName('org.eclipse.emf.common.util.WrappedException')/](exception);
+ }
+ initializeFromLoadedEPackage(this, ([genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/])resource.getContents().get(0));
+ createResource(eNS_URI);
+ }
+
+ [/if]
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isFixed = false;
+
+ /**
+ * Fixes up the loaded package, to make it appear as if it had been programmatically built.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fixPackageContents() {
+ if (isFixed) return;
+ isFixed = true;
+ fixEClassifiers();
+ }
+
+ /**
+ * Sets the instance class on the given classifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation())]
+ @Override
+ [/if]
+ protected void fixInstanceClass([genModel.getImportedName('org.eclipse.emf.ecore.EClassifier')/] eClassifier) {
+ if (eClassifier.getInstanceClassName() == null) {
+ [let dynamicGenClasses : OrderedSet(GenClass) = genPackage.genClasses->select(c : GenClass | c.dynamic)]
+ [if (dynamicGenClasses->isEmpty())]
+ eClassifier.setInstanceClassName("[genPackage.getInterfacePackageName()/]." + eClassifier.getName());[genModel.getNonNLS()/]
+ setGeneratedClassName(eClassifier);
+ [else]
+ switch (eClassifier.getClassifierID()) {
+ [for (genClass : GenClass | dynamicGenClasses)]
+ [if (genClass.dynamic)]
+ case [genPackage.getClassifierID(genClass)/]:
+ [/if]
+ [/for]
+ {
+ break;
+ }
+ default:
+ {
+ eClassifier.setInstanceClassName("[genPackage.getInterfacePackageName()/]." + eClassifier.getName());[genModel.getNonNLS()/]
+ setGeneratedClassName(eClassifier);
+ break;
+ }
+ }
+ [/if]
+ [/let]
+ }
+ }
+
+ [/if]
+ [if (needsAddEOperation())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/] addEOperation([genModel.getImportedName('org.eclipse.emf.ecore.EClass')/] owner, [genModel.getImportedName('org.eclipse.emf.ecore.EClassifier')/] type, String name, int lowerBound, int upperBound, boolean isUnique, boolean isOrdered) {
+ [genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/] o = addEOperation(owner, type, name, lowerBound, upperBound);
+ o.setUnique(isUnique);
+ o.setOrdered(isOrdered);
+ return o;
+ }
+
+ [/if][comment needsAddEOperation /]
+ [if (needsAddEParameter())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genModel.getImportedName('org.eclipse.emf.ecore.EParameter')/] addEParameter([genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/] owner, [genModel.getImportedName('org.eclipse.emf.ecore.EClassifier')/] type, String name, int lowerBound, int upperBound, boolean isUnique, boolean isOrdered) {
+ [genModel.getImportedName('org.eclipse.emf.ecore.EParameter')/] p = ecoreFactory.createEParameter();
+ p.setEType(type);
+ p.setName(name);
+ p.setLowerBound(lowerBound);
+ p.setUpperBound(upperBound);
+ p.setUnique(isUnique);
+ p.setOrdered(isOrdered);
+ owner.getEParameters().add(p);
+ return p;
+ }
+
+ [/if][comment needsAddEParameter /]
+[/if][comment isImplementation) /]
+[if (isInterface and genPackage.isLiteralsInterface())]
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ [if (genModel.operationReflection)]
+ * <li>each operation of each class,</li>
+ [/if]
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isImplementation)]public [/if]interface Literals {
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ /**
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [if (not genClass.isInterface())]
+ * The meta object literal for the '{@link [genClass.getQualifiedClassName()/] <em>[genClass.getFormattedName()/]</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genClass.getQualifiedClassName()/]
+ [else]
+ * The meta object literal for the '{@link [genClass.getQualifiedInterfaceName()/] <em>[genClass.getFormattedName()/]</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genClass.getQualifiedInterfaceName()/]
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenEnum))]
+ [let genEnum : GenEnum = genClassifier.oclAsType(GenEnum)]
+ * The meta object literal for the '{@link [genEnum.getQualifiedName()/] <em>[genEnum.getFormattedName()/]</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genEnum.getQualifiedName()/]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ * The meta object literal for the '<em>[genDataType.getFormattedName()/]</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ [if (not genDataType.isPrimitiveType() and not genDataType.isArrayType())]
+ * @see [genDataType.getRawInstanceClassName()/]
+ [/if]
+ [/let]
+ [/if][/if][/if]
+ * @see [genPackage.getQualifiedPackageClassName()/]#get[genClassifier.getClassifierAccessorName()/]()
+ * @generated
+ */
+ [publicStaticFinalFlag/][genClassifier.getImportedMetaType()/] [genPackage.getClassifierID(genClassifier)/] = eINSTANCE.get[genClassifier.getClassifierAccessorName()/]();
+
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [for (genFeature : GenFeature |genClass.genFeatures)]
+ /**
+ * The meta object literal for the '<em><b>[genFeature.getFormattedName()/]</b></em>' [genFeature.getFeatureKind()/] feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genFeature.getImportedMetaType()/] [genClass.getFeatureID(genFeature)/] = eINSTANCE.get[genFeature.getFeatureAccessorName()/]();
+
+ [/for]
+ [if (genModel.operationReflection)]
+ [for (genOperation : GenOperation | genClass.genOperations)]
+ /**
+ * The meta object literal for the '<em><b>[genOperation.getFormattedName()/]</b></em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genOperation.getImportedMetaType()/] [genClass.getOperationID(genOperation, false)/] = eINSTANCE.get[genOperation.getOperationAccessorName()/]();
+
+ [/for]
+ [/if]
+ [/let]
+ [/if]
+ [/for]
+ }
+
+[/if]
+} //[className/]
+[/let][comment publicStaticFinalFlag /]
+[/template]
+
+[query public packageClassPackageName(genPackage : GenPackage, isInterface : Boolean) : String =
+ if (isInterface and not genPackage.genModel.suppressInterfaces) then
+ genPackage.getReflectionPackageName()
+ else
+ genPackage.getClassPackageName()
+ endif
+/]
+
+[query public packageClassName(genPackage : GenPackage, isImplementation : Boolean) : String =
+ if (isImplementation) then
+ genPackage.getPackageClassName()
+ else
+ genPackage.getPackageInterfaceName()
+ endif
+/]
+
+[query public packageClassPath(genPackage : GenPackage, isInterface : Boolean, isImplementation : Boolean) : String
+ = genPackage.genModel.modelPath(genPackage.packageClassPackageName(isInterface), genPackage.packageClassName(isImplementation)) /]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/RepresentingElementAdapter.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/RepresentingElementAdapter.mtl
index 87fbb44c113..f5be6ff5a8e 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/RepresentingElementAdapter.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/RepresentingElementAdapter.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module RepresentingElementAdapter('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
@@ -75,7 +85,7 @@ public class RepresentingElementAdapter extends AdapterImpl {
specificNotifier.eNotify(notification);
}
- System.err.println("UML Notif -> " + msg);
+ //System.err.println("UML Notif -> " + msg);
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/ResourceClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/ResourceClass.mtl
index 8915fbe1934..5db46f61e88 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/ResourceClass.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/ResourceClass.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module ResourceClass('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/WrapperClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/WrapperClass.mtl
index 4b485f67b0e..aac751d53f3 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/GenFacade/WrapperClass.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/WrapperClass.mtl
@@ -1,3 +1,13 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
[comment encoding = UTF-8 /]
[module WrapperClass('http://www.eclipse.org/emf/2002/GenModel','http://www.eclipse.org/papyrus/facademapping','http://www.eclipse.org/emf/2002/Ecore')]
@@ -62,7 +72,6 @@ private static volatile Wrapper instance = null;
[genModel.getAllMetaclassMappings().genMappingfromUML(genModel, genPackage)/]
-
return null;
}
@@ -79,6 +88,16 @@ private static volatile Wrapper instance = null;
}
}
+ public <E extends [genModel.getImportedName('org.eclipse.papyrus.facade.utils.RepresentingElement')/]> [genModel.getImportedName('org.eclipse.emf.common.util.EList')/] toRepresentedList([genModel.getImportedName('java.util.List')/]<E> list) {
+ [genModel.getImportedName('org.eclipse.emf.common.util.EList')/]<[genModel.getImportedName('org.eclipse.emf.ecore.EObject')/]> result = new [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/]<[genModel.getImportedName('org.eclipse.emf.ecore.EObject')/]>();
+
+ for(E representingElement : list) {
+ result.add(representingElement.get__Represented());
+ }
+
+ return result;
+ }
+
public [genModel.getImportedName('org.eclipse.emf.ecore.EStructuralFeature')/] getFeatureMappingFromUML([genModel.getImportedName('org.eclipse.emf.ecore.EStructuralFeature')/] feature) {
[genModel.getAllFeatureMappings().getFeatureMappingFromUML(genModel, genPackage)/]
@@ -135,14 +154,14 @@ private static volatile Wrapper instance = null;
[template public genEnumMappingfromUML(mapping : Mapping , genModel:GenModel, genPackage: GenPackage)]
if(value == [getPackagePathFromMapping(mapping)/].[getUMLEnumElementFromMapping(mapping)/]) {
- return [genModel.getImportedName(genPackage.getInterfacePackageName())/].[getSpecificEnumElementFromMapping(mapping)/];
+ return [genModel.getImportedName(genPackage.getInterfacePackageName())/].[getFacadeEnumElementFromMapping(mapping)/];
}
[/template]
[template public genEnumMappingfromSpecific(mapping : Mapping , genModel:GenModel, genPackage: GenPackage)]
- if(value == [genModel.getImportedName(genPackage.getInterfacePackageName())/].[getSpecificEnumElementFromMapping(mapping)/]) {
+ if(value == [genModel.getImportedName(genPackage.getInterfacePackageName())/].[getFacadeEnumElementFromMapping(mapping)/]) {
return [getPackagePathFromMapping(mapping)/].[getUMLEnumElementFromMapping(mapping)/];
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl
index 269b8f79569..9712b218a46 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl
@@ -1,20 +1,29 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ CEA LIST - Initial API and implementation[/comment]
[comment encoding = UTF-8 /]
[module FacadeCodegenUtils('http://www.eclipse.org/emf/2002/Ecore','http://www.eclipse.org/papyrus/facademapping', 'http://www.eclipse.org/emf/2002/GenModel','http://www.eclipse.org/uml2/4.0.0/UML')/]
-[query public getUMLMetaElement( specificMetaElement : EObject, genModel :GenModel) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLMetaElement( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificMetaElement,genModel})
+[query public getUMLMetaElement( facadeMetaElement : EObject, genModel :GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLMetaElement( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,genModel})
/]
-[query public findUMLMetaElement( specificMetaElement : EObject, genModel :GenModel) : EObject
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLMetaElement( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificMetaElement,genModel})
+[query public findUMLMetaElement( facadeMetaElement : EObject, genModel :GenModel) : EObject
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLMetaElement( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,genModel})
/]
-[query public findUMLGetAccessor( specificMetaFeature : EObject, specificGenModel :GenModel) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLGetAccessor( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificMetaFeature,specificGenModel})
+[query public findUMLGetAccessor( facadeMetaFeature : EObject, facadeGenModel :GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLGetAccessor( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaFeature,facadeGenModel})
/]
-[query public findUMLAccessorName( specificMetaFeature : EObject, specificGenModel :GenModel) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLAccessorName( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificMetaFeature,specificGenModel})
+[query public findUMLAccessorName( facadeMetaFeature : EObject, facadeGenModel :GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLAccessorName( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaFeature,facadeGenModel})
/]
[query public getClassifierAccessorName( genModel:GenModel, mapping:Mapping) : String
@@ -29,56 +38,56 @@
= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLPackageName( org.eclipse.papyrus.facademapping.Mapping)', Sequence{mapping})
/]
-[query public getPackagePathFromUML( specificMetaElement:EObject) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getPackagePathFromUML(org.eclipse.emf.ecore.EObject)', Sequence{specificMetaElement})
+[query public getPackagePathFromUML( facadeMetaElement:EObject) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getPackagePathFromUML(org.eclipse.emf.ecore.EObject)', Sequence{facadeMetaElement})
/]
[query public getPackagePathFromMapping( mapping : Mapping) : String
= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getPackagePathFromMapping(org.eclipse.papyrus.facademapping.Mapping)', Sequence{mapping})
/]
-[query public getUMLFactory( specificMetaElement:EObject, genModel:GenModel) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLFactory( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificMetaElement,genModel})
+[query public getUMLFactory( facadeMetaElement:EObject, genModel:GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLFactory( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,genModel})
/]
[query public getUMLAccessorName( mapping : Mapping, genModel :GenModel) : EObject
= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLAccessorName( org.eclipse.papyrus.facademapping.Mapping ,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{mapping,genModel})
/]
-[query public getAllMetaclassMappings( specificGenModel :GenModel) : Sequence(Mapping)
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllMetaclassMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificGenModel})
+[query public getAllMetaclassMappings( facadeGenModel :GenModel) : Sequence(Mapping)
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllMetaclassMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeGenModel})
/]
[query public getUMLFeatureFromMapping( mapping : Mapping, genModel :GenModel) : EObject
= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLFeatureFromMapping( org.eclipse.papyrus.facademapping.Mapping ,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{mapping,genModel})
/]
-[query public getAllFeatureMappings( specificGenModel :GenModel) : Sequence(Mapping)
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllFeatureMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificGenModel})
+[query public getAllFeatureMappings( facadeGenModel :GenModel) : Sequence(Mapping)
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllFeatureMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeGenModel})
/]
[query public getAppropriateQualifiedTypeName( genClassifier :GenClassifier) : String
= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAppropriateQualifiedTypeName(org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)', Sequence{genClassifier})
/]
-[query public getAllStereotypeQualifiedNames( specificMetaElement:EObject, specificGenModel:GenModel) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllStereotypeQualifiedNames( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificMetaElement,specificGenModel})
+[query public getAllStereotypeQualifiedNames( facadeMetaElement:EObject, facadeGenModel:GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllStereotypeQualifiedNames( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,facadeGenModel})
/]
-[query public getNonAssociationStereotypeQualifiedNames( specificMetaElement:EObject, specificGenModel:GenModel) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getNonAssociationStereotypeQualifiedNames( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificMetaElement,specificGenModel})
+[query public getNonAssociationStereotypeQualifiedNames( facadeMetaElement:EObject, facadeGenModel:GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getNonAssociationStereotypeQualifiedNames( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,facadeGenModel})
/]
[query public getUMLEnumElementFromMapping( mapping : Mapping) : String
= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLEnumElementFromMapping( org.eclipse.papyrus.facademapping.Mapping )', Sequence{mapping})
/]
-[query public getSpecificEnumElementFromMapping( mapping : Mapping) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getSpecificEnumElementFromMapping( org.eclipse.papyrus.facademapping.Mapping )', Sequence{mapping})
+[query public getFacadeEnumElementFromMapping( mapping : Mapping) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getFacadeEnumElementFromMapping( org.eclipse.papyrus.facademapping.Mapping )', Sequence{mapping})
/]
-[query public getAllEnumLiteralMappings( specificGenModel :GenModel) : Sequence(Mapping)
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllEnumLiteralMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{specificGenModel})
+[query public getAllEnumLiteralMappings( facadeGenModel :GenModel) : Sequence(Mapping)
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllEnumLiteralMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeGenModel})
/]
[query public isStereotypeProperty(genFeature:GenFeature) : Boolean
@@ -93,8 +102,12 @@
= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isExtentionStereotypeProperty(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)', Sequence{genFeature})
/]
-[query public isPrimtiveList(genFeature:GenFeature) : Boolean
-= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isPrimtiveList(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)', Sequence{genFeature})
+[query public isPrimtiveList(genTypedElement:GenTypedElement) : Boolean
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isPrimtiveList(org.eclipse.emf.codegen.ecore.genmodel.GenTypedElement)', Sequence{genTypedElement})
+/]
+
+[query public isPrimitive(genTypedElement:GenTypedElement) : Boolean
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isPrimitive(org.eclipse.emf.codegen.ecore.genmodel.GenTypedElement)', Sequence{genTypedElement})
/]
[query public getCorrespondingStereotypeMapping(mapping : Mapping, genModel:GenModel,genPackage:GenPackage) : String
@@ -107,4 +120,8 @@
[query public copyEcore(genPackage:GenPackage) : OclVoid
= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'copyEcore(org.eclipse.emf.codegen.ecore.genmodel.GenPackage)', Sequence{genPackage})
-/] \ No newline at end of file
+/]
+
+[query public initUtilsCaches(traceabilityContext : OclAny) : OclVoid
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'initUtilsCaches()', Sequence{})
+/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl
index 76c3a5be69e..f825f95aa75 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl
@@ -1,6 +1,14 @@
+[comment]Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ CEA LIST - Initial API and implementation[/comment]
[comment encoding = UTF-8 /]
[module WrappingListUtils('http://www.eclipse.org/emf/2002/Ecore','http://www.eclipse.org/papyrus/facademapping', 'http://www.eclipse.org/emf/2002/GenModel','http://www.eclipse.org/uml2/2.2.0/GenModel')/]
[query public getWrappingListConstructor(genClass:GenClass, genFeature:GenFeature, typeArgument:String) : String
-= invoke('org.eclipse.papyrus.facade.codegen.utils.WrappingListUtils', 'getWrappingListConstructor(org.eclipse.emf.codegen.ecore.genmodel.GenClass, org.eclipse.emf.codegen.ecore.genmodel.GenFeature, java.lang.String)', Sequence{ genClass, genFeature, typeArgument})
-/] \ No newline at end of file
+= invoke('org.eclipse.papyrus.facade.codegen.utils.WrappingListUtils', 'getWrappingListConstructor(org.eclipse.emf.codegen.ecore.genmodel.GenClass, org.eclipse.emf.codegen.ecore.genmodel.GenFeature, java.lang.String)', Sequence{ genClass, genFeature, typeArgument})/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/FacadeCodeGenPlugin.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/FacadeCodeGenPlugin.java
index bbc9d745b88..a7c88816fbd 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/FacadeCodeGenPlugin.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/FacadeCodeGenPlugin.java
@@ -1,5 +1,19 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facade.codegen;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -13,15 +27,16 @@ public class FacadeCodeGenPlugin extends AbstractUIPlugin {
// The shared instance
private static FacadeCodeGenPlugin plugin;
-
- /**
- * The constructor
- */
+
+ /** The log. */
+ public static LogHelper log;
+
public FacadeCodeGenPlugin() {
}
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
@@ -31,6 +46,7 @@ public class FacadeCodeGenPlugin extends AbstractUIPlugin {
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
@@ -40,7 +56,7 @@ public class FacadeCodeGenPlugin extends AbstractUIPlugin {
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static FacadeCodeGenPlugin getDefault() {
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/Messages.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/Messages.java
new file mode 100644
index 00000000000..00cafa5e7ec
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/Messages.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.facade.codegen;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.facade.codegen.messages"; //$NON-NLS-1$
+
+ public static String GenerateCodeAction_0;
+
+ public static String GenerateFacadeAction_0;
+
+ public static String GenerateFacadeAction_1;
+
+ public static String GenerateFacadeAction_3;
+
+ public static String GenerateFacadeAction_5;
+
+ public static String GenerateFacadeAction_6;
+
+ public static String FacadeCodegenUtils_48;
+
+ public static String FacadeCodegenUtils_49;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl
deleted file mode 100644
index 3a558b52ae6..00000000000
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl
+++ /dev/null
@@ -1,160 +0,0 @@
-[comment encoding = UTF-8 /]
-[module genOperation('http://www.eclipse.org/emf/2002/GenModel')/]
-
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnum /]
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenOperation /]
-[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenParameter /]
-
-[template public genOperation(genOperation : GenOperation, genClass : GenClass, genPackage : GenPackage, genModel : GenModel, isJDK50 : Boolean, isInterface : Boolean, isImplementation : Boolean, isGWT : Boolean)]
-[if (isImplementation) ]
- [if (genOperation.isInvariant() and genOperation.hasInvariantExpression()) ]
- /**
- * The cached validation expression for the '{@link #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/]) <em>[genOperation.getFormattedName()/]</em>}' invariant operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/])
- * @generated
- * @ordered
- */
- protected static final [genModel.getImportedName('java.lang.String')/] [genClass.getUniqueNameUpperCase(genOperation)/]__EEXPRESSION = "[genOperation.getInvariantExpression('\t\t')/]";[genModel.getNonNLS()/]
-
- [else][if (genOperation.hasInvocationDelegate()) ]
- /**
- * The cached invocation delegate for the '{@link #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/]) <em>[genOperation.getFormattedName()/]</em>}' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/])
- * @generated
- * @ordered
- */
- protected static final [genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/].Internal.InvocationDelegate [genClass.getUniqueNameUpperCase(genOperation)/]__EINVOCATION_DELEGATE = (([genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/].Internal)[genOperation.getQualifiedOperationAccessor()/]).getInvocationDelegate();
-
- [/if][/if]
-[/if]
-[if (isInterface) ]
-[comment]<%@ include file="Class/genOperation.javadoc.override.javajetinc" fail="alternative" %>[/comment]
-[comment]<%@ start %>[/comment]
- /**
-[comment]<%@ include file="Class/genOperation.javadoc.insert.javajetinc" fail="silent" %>[/comment]
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- [if (genOperation.hasDocumentation() or genOperation.hasParameterDocumentation()) ]
- * <!-- begin-model-doc -->
- [if (genOperation.hasDocumentation()) ]
- * [genOperation.getDocumentation(genModel.getIndentation())/]
- [/if]
- [for (genParameter : GenParameter | genOperation.genParameters)]
- [if (genParameter.hasDocumentation())]
- [let documentation : String = genParameter.getDocumentation('')]
- [if (documentation.contains('\n') or documentation.contains('\r')) ]
- * @param [genParameter.getName()/]
- * [genParameter.getDocumentation(genModel.getIndentation())/]
- [else]
- * @param [genParameter.getName()/] [genParameter.getDocumentation(genModel.getIndentation())/]
- [/if]
- [/let]
- [/if]
- [/for]
- * <!-- end-model-doc -->
- [/if]
- [if (not genModel.suppressEMFModelTags)]
- [let modelInfoLines : Sequence(String) = genOperation.getModelInfo().tokenize(genModel.getLineDelimiter())]
- [if (modelInfoLines->isEmpty())]
- * @model
- [else]
- * @model [modelInfoLines->sep(genModel.getLineDelimiter() + '\t * ')/]
- [/if]
- [/let]
- [/if]
- * @generated
- */
-[comment]<%@ end %><%//Class/genOperation.javadoc.override.javajetinc%>[/comment]
-[else]
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- [if (isJDK50)][comment]//Class/genOperation.annotations.insert.javajetinc[/comment]
-[comment]<%@ include file="Class/genOperation.annotations.insert.javajetinc" fail="silent" %>[/comment]
- [/if]
-[/if]
-[if (not isImplementation) ]
- [genOperation.getTypeParameters(genClass)/][genOperation.getImportedType(genClass)/] [genOperation.getName()/]([genOperation.getParameters(genClass)/])[genOperation.getThrows(genClass)/];
-
-[else]
- public [genOperation.getTypeParameters(genClass)/][genOperation.getImportedType(genClass)/] [genOperation.getName()/]([genOperation.getParameters(genClass)/])[genOperation.getThrows(genClass)/] {
- [if (genOperation.hasBody()) ]
- [genOperation.getBody(genModel.getIndentation())/]
- [else][if (genOperation.isInvariant())]
- [let opClass : GenClass = genOperation.genClass]
- [let diagnostics : String = genOperation.genParameters->at(1).oclAsType(GenParameter).getName()]
- [let ctx : String = genOperation.genParameters->at(2).oclAsType(GenParameter).getName()]
- [if (genOperation.hasInvariantExpression()) ]
- return
- [opClass.genPackage.getImportedValidatorClassName()/].validate
- ([genClass.getQualifiedClassifierAccessor()/],
- this,
- [diagnostics/],
- [ctx/],
- "[genOperation.getValidationDelegate()/]",[genModel.getNonNLS()/]
- [genOperation.getQualifiedOperationAccessor()/],
- [genClass.getUniqueNameUpperCase(genOperation)/]__EEXPRESSION,
- [genModel.getImportedName('org.eclipse.emf.common.util.Diagnostic')/].ERROR,
- [opClass.genPackage.getImportedValidatorClassName()/].DIAGNOSTIC_SOURCE,
- [opClass.genPackage.getImportedValidatorClassName()/].[opClass.getOperationID(genOperation)/]);
- [else]
- // TODO: implement this method
- // -> specify the condition that violates the invariant
- // -> verify the details of the diagnostic, including severity and message
- // Ensure that you remove @generated or mark it @generated NOT
- if (false) {
- if ([diagnostics/] != null) {
- [diagnostics/].add
- (new [genModel.getImportedName('org.eclipse.emf.common.util.BasicDiagnostic')/]
- ([genModel.getImportedName('org.eclipse.emf.common.util.Diagnostic')/].ERROR,
- [opClass.genPackage.getImportedValidatorClassName()/].DIAGNOSTIC_SOURCE,
- [opClass.genPackage.getImportedValidatorClassName()/].[opClass.getOperationID(genOperation)/],
- [genModel.getImportedName('org.eclipse.emf.ecore.plugin.EcorePlugin')/].INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object['[]'/] { "[genOperation.getName()/]", [genModel.getImportedName('org.eclipse.emf.ecore.util.EObjectValidator')/].getObjectLabel(this, [ctx/]) }),[genModel.getNonNLS()/][genModel.getNonNLS(2)/]
- new Object ['[]'/] { this }));
- }
- return false;
- }
- return true;
- [/if]
- [/let]
- [/let]
- [/let]
- [else][if (genOperation.hasInvocationDelegate())]
- [let size : Integer = genOperation.genParameters->size()]
- try {
- [if (genOperation.isVoid()) ]
- [genClass.getUniqueNameUpperCase(genOperation)/]__EINVOCATION_DELEGATE.dynamicInvoke(this, [if (size > 0) ]new [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/].UnmodifiableEList<Object>([size/], [genOperation.getParametersArray(genClass)/])[else]null[/if]);
- [else]
- return [if (not isJDK50 and genOperation.isPrimitiveType()) ]([/if]([genOperation.getObjectType(genClass)/])[genClass.getUniqueNameUpperCase(genOperation)/]__EINVOCATION_DELEGATE.dynamicInvoke(this, [if (size > 0) ]new [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/].UnmodifiableEList<Object>([size/], [genOperation.getParametersArray(genClass)/])[else]null[/if])[if (not isJDK50 and genOperation.isPrimitiveType()) ]).[genOperation.getPrimitiveValueFunction()/]()[/if];
- [/if]
- }
- catch ([genModel.getImportedName(if (isGWT) then 'org.eclipse.emf.common.util.InvocationTargetException' else 'java.lang.reflect.InvocationTargetException' endif)/] ite) {
- throw new [genModel.getImportedName('org.eclipse.emf.common.util.WrappedException')/](ite);
- }
- [/let]
- [else]
-[comment]<%@ include file="Class/implementedGenOperation.TODO.override.javajetinc" fail="alternative" %>[/comment]
-[comment]<%@ start %>[/comment]
- // TODO: implement this method
- // Ensure that you remove @generated or mark it @generated NOT
- throw new UnsupportedOperationException();
-[comment]<%@ end %><%//Class/implementedGenOperation.todo.override.javajetinc%>[/comment]
- [/if][/if][/if]
- }
-
-[/if]
-[comment]<%@ include file="Class/genOperation.insert.javajetinc" fail="silent" %>[/comment]
-[comment]<%@ end %><%//Class/implementedGenOperation.override.javajetinc%>[/comment]
-[/template]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/handlers/GenerateFacadeHandler.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/handlers/GenerateFacadeHandler.java
new file mode 100644
index 00000000000..a32042d416e
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/handlers/GenerateFacadeHandler.java
@@ -0,0 +1,229 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.facade.codegen.handlers;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.codegen.ecore.Generator;
+import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
+import org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.UniqueEList;
+import org.eclipse.emf.eef.codegen.flow.Step;
+import org.eclipse.emf.eef.codegen.flow.Workflow;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.facade.codegen.FacadeCodeGenPlugin;
+import org.eclipse.papyrus.facade.codegen.Messages;
+import org.eclipse.papyrus.facade.codegen.genfacade.GenFacade;
+import org.eclipse.papyrus.facade.codegen.utils.EEFGeneratorAdapter;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Handler to generate Facade code.
+ */
+public class GenerateFacadeHandler extends AbstractHandler {
+
+
+ /** The workspace. */
+ protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+
+ /**
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ List<GenModel> emfGenModels = new ArrayList<GenModel>();
+
+ // get workbench window
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ // set selection service
+ ISelectionService service = window.getSelectionService();
+ // set structured selection
+ IStructuredSelection structured = (IStructuredSelection)service.getSelection();
+
+ if(structured != null) {
+ for(Object selectedElement : structured.toList()) {
+ if(selectedElement instanceof GenModel) {
+ emfGenModels.add((GenModel)selectedElement);
+ }
+ }
+ }
+
+ if(emfGenModels != null) {
+ final Workflow flow = initEMFGenFlow(emfGenModels);
+ flow.prepare();
+ Job job = new Job(Messages.GenerateCodeAction_0) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ flow.execute(monitor);
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setUser(true);
+ job.schedule();
+ }
+
+ return null;
+ }
+
+ /**
+ * Inits the emf gen flow.
+ *
+ * @param emfGenModels
+ * the emf Genmodels to generate the facade for
+ * @return the workflow
+ */
+ protected Workflow initEMFGenFlow(List<GenModel> emfGenModels) {
+ final Workflow flow = new Workflow(Messages.GenerateFacadeAction_0, Display.getCurrent().getActiveShell());
+ for(final org.eclipse.emf.codegen.ecore.genmodel.GenModel emfGenModel : emfGenModels) {
+ String s2 = Messages.GenerateFacadeAction_1 + emfGenModel.eResource().getURI().toString();
+ flow.addStep(s2, new Step("FACADE MODEL") { //$NON-NLS-1$
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor) {
+ // create the model project
+ IProject modelProject = getProjectFromStringPath(emfGenModel.getModelProjectDirectory());
+ if(modelProject == null) {
+ return Status.OK_STATUS;
+ }
+ List<IProject> referencedProjects = new UniqueEList<IProject>();
+ if(!workspace.getRoot().exists(modelProject.getFullPath())) {
+ if(modelProject.getLocation().toFile().exists()) {
+ modelProject.getLocation().toFile().delete();
+ }
+ modelProject = Generator.createEMFProject(new Path(emfGenModel.getModelDirectory()), modelProject.getLocation(), referencedProjects, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN), Generator.EMF_MODEL_PROJECT_STYLE | Generator.EMF_PLUGIN_PROJECT_STYLE);
+ } else if(!modelProject.isAccessible()) {
+ try {
+ modelProject.open(monitor);
+ } catch (CoreException e) {
+ return new Status(IStatus.ERROR, FacadeCodeGenPlugin.PLUGIN_ID, e.getMessage(), e);
+ }
+ }
+ // generate using acceleo
+ List<String> args = new ArrayList<String>();
+ File modelDirectory = modelProject.getLocation().toFile();
+ try {
+ GenFacade generator = new GenFacade(emfGenModel, modelDirectory, args);
+ generator.doGenerate(BasicMonitor.toMonitor(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)));
+ } catch (IOException e) {
+ return new Status(IStatus.ERROR, FacadeCodeGenPlugin.PLUGIN_ID, e.getMessage(), e);
+ }
+ return Status.OK_STATUS;
+ }
+ });
+
+ if(emfGenModel.isCodeFormatting()) {
+ refresh(emfGenModel, flow);
+
+ String s2prime = Messages.GenerateFacadeAction_5;
+ flow.addStep(s2prime, new Step(s2prime) {
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor) {
+ EEFGeneratorAdapter eefGen = new EEFGeneratorAdapter();
+ eefGen.generate(emfGenModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, BasicMonitor.toMonitor(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)));
+ return Status.OK_STATUS;
+ }
+ });
+ }
+
+ refresh(emfGenModel, flow);
+ }
+ return flow;
+ }
+
+ /**
+ * Refresh.
+ *
+ * @param emfGenModel
+ * the emf GenModel that is used to generate facade code for
+ * @param flow
+ * the flow
+ */
+ protected void refresh(final org.eclipse.emf.codegen.ecore.genmodel.GenModel emfGenModel, Workflow flow) {
+ String s3 = Messages.GenerateFacadeAction_6 + emfGenModel.eResource().getURI().toString();
+ flow.addStep(s3, new Step("REFRESH") { //$NON-NLS-1$
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor) {
+ // refresh model project
+ IProject modelProject = getProjectFromStringPath(emfGenModel.getModelProjectDirectory());
+ if(modelProject == null) {
+ return Status.OK_STATUS;
+ }
+ try {
+ if(!modelProject.isOpen()) {
+ modelProject.open(monitor);
+ }
+ modelProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (CoreException e) {
+ return new Status(IStatus.ERROR, FacadeCodeGenPlugin.PLUGIN_ID, e.getMessage(), e);
+ }
+ return Status.OK_STATUS;
+ }
+ });
+ }
+
+
+
+
+
+ /**
+ * Extract project.
+ *
+ * @param stringPath
+ * the path to the project encoded as a string
+ * @return the corresponding project
+ */
+ protected IProject getProjectFromStringPath(String stringPath) {
+ IPath path = new Path(stringPath);
+ if(path.isEmpty()) {
+ return null;
+ }
+ return workspace.getRoot().getProject(path.segment(0));
+ }
+
+
+
+}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/messages.properties b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/messages.properties
new file mode 100644
index 00000000000..16cb71d9451
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/messages.properties
@@ -0,0 +1,8 @@
+GenerateCodeAction_0=EEF architecture generation
+GenerateFacadeAction_0=Generate Facade code
+GenerateFacadeAction_1=Generate Facade code for
+GenerateFacadeAction_3=Refreshing workspace
+GenerateFacadeAction_5=Formatting generated files
+GenerateFacadeAction_6=Refreshing workspace
+FacadeCodegenUtils_48=Problem with :
+FacadeCodegenUtils_49=Problem with :
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/util/EEFGeneratorAdapter.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/EEFGeneratorAdapter.java
index 594c46d7f51..f6ab31310f5 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-custom/org/eclipse/papyrus/facade/codegen/util/EEFGeneratorAdapter.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/EEFGeneratorAdapter.java
@@ -1,14 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.facade.codegen.util;
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.facade.codegen.utils;
import java.io.ByteArrayInputStream;
@@ -36,13 +39,12 @@ import org.eclipse.emf.common.util.URI;
*/
public class EEFGeneratorAdapter extends AbstractGeneratorAdapter {
- private static final String JAVA_EXT_FILE = "java";
+ private static final String JAVA_EXT_FILE = "java"; //$NON-NLS-1$
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter#canGenerate(java.lang.Object,
- * java.lang.Object)
+ * @see org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter#canGenerate(java.lang.Object, java.lang.Object)
*/
@Override
public boolean canGenerate(Object object, Object projectType) {
@@ -52,45 +54,31 @@ public class EEFGeneratorAdapter extends AbstractGeneratorAdapter {
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter#doGenerate(java.lang.Object,
- * java.lang.Object, org.eclipse.emf.common.util.Monitor)
+ * @see org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter#doGenerate(java.lang.Object, java.lang.Object,
+ * org.eclipse.emf.common.util.Monitor)
*/
@Override
- protected Diagnostic doGenerate(Object object, Object projectType,
- Monitor monitor) throws Exception {
- GenModel genmodel = (GenModel) object;
+ protected Diagnostic doGenerate(Object object, Object projectType, Monitor monitor) throws Exception {
+ GenModel genmodel = (GenModel)object;
IFolder folder = null;
- final IProgressMonitor progressMonitor = BasicMonitor
- .toIProgressMonitor(monitor);
- if (projectType == GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE) {
- final Object codeFormatter = createCodeFormatter(null,
- URI.createPlatformResourceURI(genmodel.getModelDirectory(),
- true));
- folder = ResourcesPlugin.getWorkspace().getRoot()
- .getFolder(new Path(genmodel.getModelDirectory())); // path);
- if (folder != null && folder.isAccessible()) {
- folder.accept(new ResourceVisitorFormatter(codeFormatter,
- progressMonitor));
+ final IProgressMonitor progressMonitor = BasicMonitor.toIProgressMonitor(monitor);
+ if(projectType == GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE) {
+ final Object codeFormatter = createCodeFormatter(null, URI.createPlatformResourceURI(genmodel.getModelDirectory(), true));
+ folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(genmodel.getModelDirectory())); // path);
+ if(folder != null && folder.isAccessible()) {
+ folder.accept(new ResourceVisitorFormatter(codeFormatter, progressMonitor));
}
- } else if (projectType == GenBaseGeneratorAdapter.EDIT_PROJECT_TYPE) {
- final Object codeFormatter = createCodeFormatter(null,
- URI.createPlatformResourceURI(genmodel.getEditDirectory(),
- true));
- folder = ResourcesPlugin.getWorkspace().getRoot()
- .getFolder(new Path(genmodel.getEditDirectory()));
- if (folder != null && folder.isAccessible()) {
- folder.accept(new ResourceVisitorFormatter(codeFormatter,
- progressMonitor));
+ } else if(projectType == GenBaseGeneratorAdapter.EDIT_PROJECT_TYPE) {
+ final Object codeFormatter = createCodeFormatter(null, URI.createPlatformResourceURI(genmodel.getEditDirectory(), true));
+ folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(genmodel.getEditDirectory()));
+ if(folder != null && folder.isAccessible()) {
+ folder.accept(new ResourceVisitorFormatter(codeFormatter, progressMonitor));
}
- } else if (projectType == GenBaseGeneratorAdapter.EDITOR_PROJECT_TYPE) {
- final Object codeFormatter = createCodeFormatter(null,
- URI.createPlatformResourceURI(
- genmodel.getEditorDirectory(), true));
- folder = ResourcesPlugin.getWorkspace().getRoot()
- .getFolder(new Path(genmodel.getEditorDirectory()));
- if (folder != null && folder.isAccessible()) {
- folder.accept(new ResourceVisitorFormatter(codeFormatter,
- progressMonitor));
+ } else if(projectType == GenBaseGeneratorAdapter.EDITOR_PROJECT_TYPE) {
+ final Object codeFormatter = createCodeFormatter(null, URI.createPlatformResourceURI(genmodel.getEditorDirectory(), true));
+ folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(genmodel.getEditorDirectory()));
+ if(folder != null && folder.isAccessible()) {
+ folder.accept(new ResourceVisitorFormatter(codeFormatter, progressMonitor));
}
}
return Diagnostic.OK_INSTANCE;
@@ -102,8 +90,7 @@ public class EEFGeneratorAdapter extends AbstractGeneratorAdapter {
* @return
*/
protected IPath buildModelPath(GenModel genmodel, GenPackage genPack) {
- String pathStr = genmodel.getModelDirectory() + "/"
- + genPack.getQualifiedPackageName().replaceAll("\\.", "/");
+ String pathStr = genmodel.getModelDirectory() + "/" + genPack.getQualifiedPackageName().replaceAll("\\.", "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IPath path = new Path(pathStr);
return path;
}
@@ -115,10 +102,8 @@ public class EEFGeneratorAdapter extends AbstractGeneratorAdapter {
*/
protected IPath buildProviderPath(GenModel genmodel, GenPackage genPack) {
String pathStr = genmodel.getEditDirectory();
- if (genPack.getProviderPackageName() != null
- && !genPack.getProviderPackageName().equals("")) {
- pathStr += "/"
- + genPack.getProviderPackageName().replaceAll("\\.", "/");
+ if(genPack.getProviderPackageName() != null && !genPack.getProviderPackageName().equals("")) { //$NON-NLS-1$
+ pathStr += "/" + genPack.getProviderPackageName().replaceAll("\\.", "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
IPath path = new Path(pathStr);
return path;
@@ -131,11 +116,8 @@ public class EEFGeneratorAdapter extends AbstractGeneratorAdapter {
*/
protected IPath buildPresentationPath(GenModel genmodel, GenPackage genPack) {
String pathStr = genmodel.getEditorDirectory();
- if (genPack.getPresentationPackageName() != null
- && !genPack.getPresentationPackageName().equals("")) {
- pathStr += "/"
- + genPack.getPresentationPackageName().replaceAll("\\.",
- "/");
+ if(genPack.getPresentationPackageName() != null && !genPack.getPresentationPackageName().equals("")) { //$NON-NLS-1$
+ pathStr += "/" + genPack.getPresentationPackageName().replaceAll("\\.", "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
IPath path = new Path(pathStr);
return path;
@@ -147,22 +129,23 @@ public class EEFGeneratorAdapter extends AbstractGeneratorAdapter {
* @author <a href="mailto:goulwen.lefur@obeo.fr">Goulwen Le Fur</a>
*/
private final class ResourceVisitorFormatter implements IResourceVisitor {
+
private final Object codeFormatter;
private final IProgressMonitor progressMonitor;
- private ResourceVisitorFormatter(Object codeFormatter,
- IProgressMonitor progressMonitor) {
+ private ResourceVisitorFormatter(Object codeFormatter, IProgressMonitor progressMonitor) {
this.codeFormatter = codeFormatter;
this.progressMonitor = progressMonitor;
}
public boolean visit(IResource resource) throws CoreException {
try {
- if (resource instanceof IFile
- && ((IFile) resource).getFileExtension().equals(
- JAVA_EXT_FILE)) {
- formatFile((IFile) resource, codeFormatter, progressMonitor);
+ String fileExtension = ((IFile)resource).getFileExtension();
+ if(fileExtension != null) {
+ if(resource instanceof IFile && fileExtension.equals(JAVA_EXT_FILE)) {
+ formatFile((IFile)resource, codeFormatter, progressMonitor);
+ }
}
return true;
} catch (Exception e) {
@@ -176,15 +159,11 @@ public class EEFGeneratorAdapter extends AbstractGeneratorAdapter {
* @param progressMonitor
* @throws Exception
*/
- private void formatFile(IFile file, Object codeFormatter,
- IProgressMonitor progressMonitor) throws Exception {
- URI createPlatformResourceURI = URI.createURI(file.getFullPath()
- .toString(), true);
- final String contentsStr = getContents(createPlatformResourceURI,
- null);
- String formatedContentsStr = formatCode(contentsStr, codeFormatter);
- ByteArrayInputStream formatedContents = new ByteArrayInputStream(
- formatedContentsStr.getBytes());
+ private void formatFile(IFile file, Object codeFormatter, IProgressMonitor progressMonitor) throws Exception {
+ URI createPlatformResourceURI = URI.createURI(file.getFullPath().toString(), true);
+ final String contentsStr = getContents(createPlatformResourceURI, null);
+ String formatedContentsStr = formatCode(contentsStr, codeFormatter, true);
+ ByteArrayInputStream formatedContents = new ByteArrayInputStream(formatedContentsStr.getBytes());
file.setContents(formatedContents, true, true, progressMonitor);
formatedContents.close();
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.java
index 4a57246134b..72be502d4b3 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facade.codegen.utils;
import java.io.File;
@@ -6,6 +19,8 @@ import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -22,6 +37,7 @@ import org.eclipse.emf.codegen.ecore.genmodel.GenDataType;
import org.eclipse.emf.codegen.ecore.genmodel.GenFeature;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
+import org.eclipse.emf.codegen.ecore.genmodel.GenTypedElement;
import org.eclipse.emf.codegen.util.CodeGenUtil;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@@ -31,12 +47,17 @@ import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.facade.codegen.FacadeCodeGenPlugin;
+import org.eclipse.papyrus.facade.codegen.Messages;
+import org.eclipse.papyrus.facade.utils.CombinationGenerator;
import org.eclipse.papyrus.facademapping.ExtensionDefinitionKind;
import org.eclipse.papyrus.facademapping.FacadeMappping;
import org.eclipse.papyrus.facademapping.Mapping;
@@ -49,19 +70,47 @@ import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Stereotype;
-
+/**
+ * The utils class used to generate facade code.
+ */
public class FacadeCodegenUtils {
- protected static String UML_GEN_MODEL = "platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel";
+ /** The path to the UML GenModel. */
+ protected final static String UML_GEN_MODEL = "platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel"; //$NON-NLS-1$
+
+ /** A cache of all mappings */
+ protected static HashMap<GenModel, List<Mapping>> allMappingsCache = new HashMap<GenModel, List<Mapping>>();
+
+ /** A cache of stereotyped mappings. */
+ protected static HashMap<GenModel, List<StereotypedMapping>> stereotypedMappingsCache = new HashMap<GenModel, List<StereotypedMapping>>();
+
+ /** A cache of enum literal mappings. */
+ protected static HashMap<GenModel, List<Mapping>> enumLiteralMappingsCache = new HashMap<GenModel, List<Mapping>>();
- static List<Mapping> allMappings = null;
+ /** A cache of feature mappings. */
+ protected static HashMap<GenModel, List<Mapping>> featureMappingsCache = new HashMap<GenModel, List<Mapping>>();
+ /** A cache of all metaclass mappings. */
+ protected static HashMap<GenModel, List<Mapping>> allMetaclassMappingsCache = new HashMap<GenModel, List<Mapping>>();
+ private static Set<String> javaDefaultTypes = null;
+
+ private static Set<String> ecoreDefaultTypes;
+
+
+ /**
+ * Find the mapping model from a genModel. Basically, the mapping model must be in the same folder as the ecoremodel underlying the GenModel and
+ * named with the same filename but the file extension.
+ *
+ * @param genModel
+ * the GenModel that will be used to try to find the mapping model
+ * @return the string
+ */
public static String findMappingModel(GenModel genModel) {
if(!genModel.getForeignModel().isEmpty()) {
String metamodel = genModel.getForeignModel().get(0);
- metamodel = metamodel.replaceAll(".ecore", ".facademapping");
+ metamodel = metamodel.replaceAll(".ecore", ".facademapping"); //$NON-NLS-1$ //$NON-NLS-2$
URI ecoreURI = genModel.eResource().getURI();
ecoreURI = ecoreURI.trimSegments(1);
@@ -73,6 +122,13 @@ public class FacadeCodegenUtils {
}
+ /**
+ * Gets the UML element of a mapping.
+ *
+ * @param mapping
+ * the mapping to find the UML element for
+ * @return the UML element mapped in the mapping
+ */
protected static EObject getUMLElement(Mapping mapping) {
if(mapping instanceof StereotypedMapping) {
@@ -92,16 +148,24 @@ public class FacadeCodegenUtils {
}
- protected static List<Mapping> getAllMappings(GenModel specificGenModel) {
+ /**
+ * Gets the all the mappings based on a GenModel of a facade
+ *
+ * @param facadeGenModel
+ * the GenModel of a facade
+ * @return all the mappings corresponding to a facade GenModel
+ */
+ protected static synchronized List<Mapping> getAllMappings(GenModel facadeGenModel) {
+
+ if(!allMappingsCache.containsKey(facadeGenModel)) {
- if(allMappings == null) {
- allMappings = new ArrayList<Mapping>();
+ List<Mapping> allMappings = new ArrayList<Mapping>();
- String mappingModel = findMappingModel(specificGenModel);
+ String mappingModel = findMappingModel(facadeGenModel);
if(mappingModel != null) {
- if(specificGenModel.eResource() != null) {
- if(specificGenModel.eResource().getResourceSet() != null) {
- ResourceSet resourceSet = specificGenModel.eResource().getResourceSet();
+ if(facadeGenModel.eResource() != null) {
+ if(facadeGenModel.eResource().getResourceSet() != null) {
+ ResourceSet resourceSet = facadeGenModel.eResource().getResourceSet();
Resource res = resourceSet.getResource(URI.createURI(mappingModel, true), true);
if(res != null) {
if(!res.getContents().isEmpty()) {
@@ -119,22 +183,35 @@ public class FacadeCodegenUtils {
}
}
}
+
+ allMappingsCache.put(facadeGenModel, allMappings);
}
- return allMappings;
+
+ return allMappingsCache.get(facadeGenModel);
+
}
- public static String getAllStereotypeQualifiedNames(EObject specificMetaElement, GenModel specificGenModel) {
+ /**
+ * Get the stereotype qualifiedNames that are applied on the UML element represented by the facadeMetaElement
+ *
+ * @param facadeMetaElement
+ * the facade metaelement
+ * @param facadeGenModel
+ * the facade GenModel
+ * @return the stereotype qualifiedNames
+ */
+ public static String getAllStereotypeQualifiedNames(EObject facadeMetaElement, GenModel facadeGenModel) {
Set<String> result = new HashSet<String>();
- for(Mapping mapping : getAllMappings(specificGenModel)) {
- if(EcoreUtil.equals(mapping.getSpecificDomainElement(), specificMetaElement)) {
+ for(Mapping mapping : getAllMappings(facadeGenModel)) {
+ if(EcoreUtil.equals(mapping.getSpecificDomainElement(), facadeMetaElement)) {
if(mapping instanceof StereotypedMapping) {
for(EObject stereotype : ((StereotypedMapping)mapping).getAppliedStereotypes()) {
if(stereotype instanceof Stereotype) {
- result.add("\"" + ((Stereotype)stereotype).getQualifiedName() + "\"");
+ result.add("\"" + ((Stereotype)stereotype).getQualifiedName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
@@ -153,22 +230,32 @@ public class FacadeCodegenUtils {
return sb.toString();
}
- return "";
+ return ""; //$NON-NLS-1$
}
- public static String getNonAssociationStereotypeQualifiedNames(EObject specificMetaElement, GenModel specificGenModel) {
+ /**
+ * Get the stereotype qualifiedNames that are applied on the UML element represented by the facadeMetaElement but that are not association kind of
+ * mapping
+ *
+ * @param facadeMetaElement
+ * the facade metaelement
+ * @param facadeGenModel
+ * the facade GenModel
+ * @return the stereotype qualifiedNames
+ */
+ public static String getNonAssociationStereotypeQualifiedNames(EObject facadeMetaElement, GenModel facadeGenModel) {
Set<String> result = new HashSet<String>();
- for(Mapping mapping : getAllMappings(specificGenModel)) {
- if(EcoreUtil.equals(mapping.getSpecificDomainElement(), specificMetaElement)) {
+ for(Mapping mapping : getAllMappings(facadeGenModel)) {
+ if(EcoreUtil.equals(mapping.getSpecificDomainElement(), facadeMetaElement)) {
if(mapping instanceof StereotypedMapping) {
if(((StereotypedMapping)mapping).getKind() != ExtensionDefinitionKind.ASSOCIATION) {
for(EObject stereotype : ((StereotypedMapping)mapping).getAppliedStereotypes()) {
if(stereotype instanceof Stereotype) {
- result.add("\"" + ((Stereotype)stereotype).getQualifiedName() + "\"");
+ result.add("\"" + ((Stereotype)stereotype).getQualifiedName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
@@ -188,64 +275,78 @@ public class FacadeCodegenUtils {
return sb.toString();
}
- return "";
+ return ""; //$NON-NLS-1$
}
- public static String findUMLGetAccessor(EObject specificMetaFeature, GenModel specificGenModel) {
-
- EObject umlMetaFeature = findUMLMetaElement(specificMetaFeature, specificGenModel);
-
- if(umlMetaFeature != null) {
- if(umlMetaFeature instanceof EStructuralFeature) {
+ /**
+ * Find UML getAccessor.
+ *
+ * @param facadeMetaFeature
+ * the facade metafeature
+ * @param facadeGenModel
+ * the facade GenModel
+ * @return the getAccessor
+ */
+ public static String findUMLGetAccessor(EObject facadeMetaFeature, GenModel facadeGenModel) {
+
+ EObject umlMetaElement = findUMLMetaElement(facadeMetaFeature, facadeGenModel);
+
+ if(umlMetaElement != null) {
+ if(umlMetaElement instanceof ETypedElement) {
ResourceSet resourceSet = new ResourceSetImpl();
EObject umlGenModel = resourceSet.getResource(URI.createURI(UML_GEN_MODEL, true), true).getContents().get(0);
if(umlGenModel != null) {
if(umlGenModel instanceof org.eclipse.uml2.codegen.ecore.genmodel.GenModel) {
- return ((org.eclipse.uml2.codegen.ecore.genmodel.GenModel)umlGenModel).findGenFeature((EStructuralFeature)umlMetaFeature).getGetAccessor();
+ if(umlMetaElement instanceof EStructuralFeature) {
+ return ((org.eclipse.uml2.codegen.ecore.genmodel.GenModel)umlGenModel).findGenFeature((EStructuralFeature)umlMetaElement).getGetAccessor();
+ } else if(umlMetaElement instanceof EOperation) {
+ return ((org.eclipse.uml2.codegen.ecore.genmodel.GenModel)umlGenModel).findGenOperation((EOperation)umlMetaElement).getName();
+ }
}
}
- } else if(umlMetaFeature instanceof Property) {
-
- if(umlMetaFeature.eResource() != null) {
- if(!umlMetaFeature.eResource().getContents().isEmpty()) {
- EObject root = umlMetaFeature.eResource().getContents().get(0);
+ } else if(umlMetaElement instanceof Property) {
+ if(umlMetaElement.eResource() != null) {
+ if(!umlMetaElement.eResource().getContents().isEmpty()) {
+ EObject root = umlMetaElement.eResource().getContents().get(0);
if(root instanceof Profile) {
- GenModel profileGen = getGenModel(umlMetaFeature);
- EObject umlMetaFeatureDefinition = ((Profile)root).getDefinition((NamedElement)umlMetaFeature);
+ GenModel profileGen = getGenModel(umlMetaElement);
+ EObject umlMetaFeatureDefinition = ((Profile)root).getDefinition((NamedElement)umlMetaElement);
if(umlMetaFeatureDefinition instanceof EStructuralFeature) {
return ((org.eclipse.uml2.codegen.ecore.genmodel.GenModel)profileGen).findGenFeature((EStructuralFeature)umlMetaFeatureDefinition).getGetAccessor();
}
-
}
}
}
-
-
-
-
}
}
- return "FAILED_TO_FIND_MAPPED_GET_ACCESSOR";
+ return "FAILED_TO_FIND_MAPPED_GET_ACCESSOR"; //$NON-NLS-1$
}
- protected static GenModel getGenModel(EObject element) {
- Map<String, URI> map = EcorePlugin.getEPackageNsURIToGenModelLocationMap(true);
+ /**
+ * Try to get the GenModel from an eObject
+ *
+ * @param metaElement
+ * the metaElement to find the GenMdoel for
+ * @return the GenModel
+ */
+ protected static GenModel getGenModel(EObject metaElement) {
+ Map<String, URI> nsURIToGenModelsMap = EcorePlugin.getEPackageNsURIToGenModelLocationMap(true);
- if(element.eResource() != null) {
- if(!element.eResource().getContents().isEmpty()) {
- EObject root = element.eResource().getContents().get(0);
+ if(metaElement.eResource() != null) {
+ if(!metaElement.eResource().getContents().isEmpty()) {
+ EObject root = metaElement.eResource().getContents().get(0);
if(root instanceof Profile) {
- Stereotype ePackageStereotype = ((Profile)root).getAppliedStereotype("Ecore::EPackage");
+ Stereotype ePackageStereotype = ((Profile)root).getAppliedStereotype("Ecore::EPackage"); //$NON-NLS-1$
if(ePackageStereotype != null) {
- Object nsURI = ((Profile)root).getValue(ePackageStereotype, "nsURI");
+ Object nsURI = ((Profile)root).getValue(ePackageStereotype, "nsURI"); //$NON-NLS-1$
if(nsURI instanceof String) {
- URI genModelURI = map.get(nsURI);
+ URI genModelURI = nsURIToGenModelsMap.get(nsURI);
String paltformstring = genModelURI.toPlatformString(true);
URI pluginURI = URI.createPlatformPluginURI(paltformstring, true);
if(pluginURI != null) {
@@ -265,8 +366,17 @@ public class FacadeCodegenUtils {
return null;
}
- public static String findUMLAccessorName(EObject specificMetaFeature, GenModel specificGenModel) {
- EObject umlMetaFeature = findUMLMetaElement(specificMetaFeature, specificGenModel);
+ /**
+ * Find UML accessorName of a facade metaFeature.
+ *
+ * @param facadeMetaFeature
+ * the facade metafeature
+ * @param facadeGenModel
+ * the facade GenModel
+ * @return the string
+ */
+ public static String findUMLAccessorName(EObject facadeMetaFeature, GenModel facadeGenModel) {
+ EObject umlMetaFeature = findUMLMetaElement(facadeMetaFeature, facadeGenModel);
if(umlMetaFeature instanceof NamedElement) {
@@ -301,130 +411,132 @@ public class FacadeCodegenUtils {
}
}
- return "FAILED_TO_FIND_MAPPED_GET_ACCESSOR_NAME";
+ return "FAILED_TO_FIND_MAPPED_GET_ACCESSOR_NAME"; //$NON-NLS-1$
}
- public static List<? extends Mapping> getAllMetaclassMappings(GenModel specificGenModel) {
-
- ArrayList<Mapping> result = new ArrayList<Mapping>();
-
- String mappingModel = findMappingModel(specificGenModel);
- if(mappingModel != null) {
-
- if(specificGenModel.eResource() != null) {
- if(specificGenModel.eResource().getResourceSet() != null) {
- ResourceSet resourceSet = specificGenModel.eResource().getResourceSet();
- EObject root = resourceSet.getResource(URI.createURI(mappingModel, true), true).getContents().get(0);
-
- if(root != null) {
- if(root instanceof FacadeMappping) {
- FacadeMappping facadeMappping = (FacadeMappping)root;
-
- for(Mapping mapping : facadeMappping.getMappings()) {
- if(!(mapping instanceof StereotypedMapping)) {
- if(mapping.getSpecificDomainElement() instanceof EClassifier) {
- if(mapping.getUmlElement() != TypesPackage.eINSTANCE.getBoolean() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getString() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getReal() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getInteger() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getUnlimitedNatural()) {
- if(!(mapping.getUmlElement() instanceof Stereotype)) {
- if(mapping.getSpecificDomainElement() instanceof EClass) {
- if(!((EClass)mapping.getSpecificDomainElement()).isAbstract()) {
- result.add(mapping);
- }
- } else {
- result.add(mapping);
- }
- }
- }
+ /**
+ * Gets all the metaclass mappings.
+ *
+ * @param facadeGenModel
+ * the facade GenModel
+ * @return all mappings that map a metaclass
+ */
+ public static synchronized List<? extends Mapping> getAllMetaclassMappings(GenModel facadeGenModel) {
+
+ if(!allMetaclassMappingsCache.containsKey(facadeGenModel)) {
+
+ List<Mapping> allMetaclassMappings = new ArrayList<Mapping>();
+
+ for(Mapping mapping : getAllMappings(facadeGenModel)) {
+ if(!(mapping instanceof StereotypedMapping)) {
+ if(mapping.getSpecificDomainElement() instanceof EClassifier) {
+ if(mapping.getUmlElement() != TypesPackage.eINSTANCE.getBoolean() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getString() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getReal() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getInteger() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getUnlimitedNatural()) {
+ if(!(mapping.getUmlElement() instanceof Stereotype)) {
+ if(mapping.getSpecificDomainElement() instanceof EClass) {
+ if(!((EClass)mapping.getSpecificDomainElement()).isAbstract()) {
+ allMetaclassMappings.add(mapping);
}
} else {
- if(((StereotypedMapping)mapping).getKind() == ExtensionDefinitionKind.ASSOCIATION) {
- result.add(mapping);
- }
+ allMetaclassMappings.add(mapping);
}
}
}
}
+ } else {
+ if(((StereotypedMapping)mapping).getKind() == ExtensionDefinitionKind.ASSOCIATION) {
+ allMetaclassMappings.add(mapping);
+ }
}
}
+ allMetaclassMappingsCache.put(facadeGenModel, allMetaclassMappings);
}
- return result;
+ return allMetaclassMappingsCache.get(facadeGenModel);
}
- public static List<? extends Mapping> getAllEnumLiteralMappings(GenModel specificGenModel) {
-
- ArrayList<Mapping> result = new ArrayList<Mapping>();
-
- String mappingModel = findMappingModel(specificGenModel);
- if(mappingModel != null) {
-
- if(specificGenModel.eResource() != null) {
- if(specificGenModel.eResource().getResourceSet() != null) {
- ResourceSet resourceSet = specificGenModel.eResource().getResourceSet();
- EObject root = resourceSet.getResource(URI.createURI(mappingModel, true), true).getContents().get(0);
-
- if(root != null) {
- if(root instanceof FacadeMappping) {
- FacadeMappping facadeMappping = (FacadeMappping)root;
+ /**
+ * Initializes caches
+ */
+ public static void initUtilsCaches() {
+ allMappingsCache.clear();
+ allMetaclassMappingsCache.clear();
+ enumLiteralMappingsCache.clear();
+ featureMappingsCache.clear();
+ stereotypedMappingsCache.clear();
+ }
- for(Mapping mapping : facadeMappping.getMappings()) {
- if(mapping.getSpecificDomainElement() instanceof EEnumLiteral) {
- if(mapping.getUmlElement() != TypesPackage.eINSTANCE.getBoolean() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getString() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getReal() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getInteger() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getUnlimitedNatural()) {
- result.add(mapping);
- }
- }
- }
+ /**
+ * Gets all the enumLiteral mappings.
+ *
+ * @param facadeGenModel
+ * the facade GenModel
+ * @return all mappings that map an enumLiteral
+ */
+ public static synchronized List<? extends Mapping> getAllEnumLiteralMappings(GenModel facadeGenModel) {
+
+ if(!enumLiteralMappingsCache.containsKey(facadeGenModel)) {
+ List<Mapping> enumLiteralMappings = new ArrayList<Mapping>();
+ synchronized(enumLiteralMappings) {
+
+ for(Mapping mapping : getAllMappings(facadeGenModel)) {
+ if(mapping.getSpecificDomainElement() instanceof EEnumLiteral) {
+ if(mapping.getUmlElement() != TypesPackage.eINSTANCE.getBoolean() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getString() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getReal() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getInteger() && mapping.getUmlElement() != TypesPackage.eINSTANCE.getUnlimitedNatural()) {
+ enumLiteralMappings.add(mapping);
}
}
}
}
-
+ enumLiteralMappingsCache.put(facadeGenModel, enumLiteralMappings);
}
+ return enumLiteralMappingsCache.get(facadeGenModel);
- return result;
}
- public static List<? extends Mapping> getAllFeatureMappings(GenModel specificGenModel) {
+ /**
+ * Gets all the feature mappings.
+ *
+ * @param facadeGenModel
+ * the facade GenModel
+ * @return all mappings that map a feature
+ */
+ public static synchronized List<? extends Mapping> getAllFeatureMappings(GenModel facadeGenModel) {
- ArrayList<Mapping> result = new ArrayList<Mapping>();
+ if(!featureMappingsCache.containsKey(facadeGenModel)) {
- String mappingModel = findMappingModel(specificGenModel);
- if(mappingModel != null) {
+ List<Mapping> featureMappings = new ArrayList<Mapping>();
- if(specificGenModel.eResource() != null) {
- if(specificGenModel.eResource().getResourceSet() != null) {
- ResourceSet resourceSet = specificGenModel.eResource().getResourceSet();
- EObject root = resourceSet.getResource(URI.createURI(mappingModel, true), true).getContents().get(0);
+ for(Mapping mapping : getAllMappings(facadeGenModel)) {
+ if(!isExtensionStereotypePropertyFromFacade(mapping.getSpecificDomainElement(), facadeGenModel)) {
+ if(mapping.getSpecificDomainElement() instanceof EStructuralFeature) {
- if(root != null) {
- if(root instanceof FacadeMappping) {
- FacadeMappping facadeMappping = (FacadeMappping)root;
-
- for(Mapping mapping : facadeMappping.getMappings()) {
- if(!isExtensionStereotypePropertyFromSpecific(mapping.getSpecificDomainElement(), specificGenModel)) {
- if(mapping.getSpecificDomainElement() instanceof EStructuralFeature) {
-
- result.add(mapping);
- }
- if(mapping.getSpecificDomainElement() instanceof Property) {
+ featureMappings.add(mapping);
+ }
+ if(mapping.getSpecificDomainElement() instanceof Property) {
- if(((Property)mapping.getSpecificDomainElement()).getClass_() instanceof Stereotype) {
- result.add(mapping);
- }
- }
- }
- }
+ if(((Property)mapping.getSpecificDomainElement()).getClass_() instanceof Stereotype) {
+ featureMappings.add(mapping);
}
}
}
}
-
+ featureMappingsCache.put(facadeGenModel, featureMappings);
}
- return result;
+ return featureMappingsCache.get(facadeGenModel);
+
}
- public static EObject findUMLMetaElement(EObject specificMetaElement, GenModel genModel) {
+ /**
+ * Find UML metaElement.
+ *
+ * @param facadeMetaElement
+ * the facade metaElement
+ * @param genModel
+ * the GenModel
+ * @return the UML metaElement
+ */
+ public static EObject findUMLMetaElement(EObject facadeMetaElement, GenModel genModel) {
String mappingModel = findMappingModel(genModel);
if(mappingModel != null) {
@@ -437,7 +549,7 @@ public class FacadeCodegenUtils {
if(root instanceof FacadeMappping) {
FacadeMappping facadeMappping = (FacadeMappping)root;
for(Mapping mapping : facadeMappping.getMappings()) {
- if(EcoreUtil.equals(mapping.getSpecificDomainElement(), specificMetaElement)) {
+ if(EcoreUtil.equals(mapping.getSpecificDomainElement(), facadeMetaElement)) {
return getUMLElement(mapping);
@@ -456,6 +568,15 @@ public class FacadeCodegenUtils {
return null;
}
+ /**
+ * Gets the FeatureAccessorName of a the UML feature from a mapping.
+ *
+ * @param mapping
+ * the mapping
+ * @param genModel
+ * the GenModel
+ * @return the UML feature from mapping
+ */
public static String getUMLFeatureFromMapping(Mapping mapping, GenModel genModel) {
EObject UMLMetaElement = mapping.getUmlElement();
@@ -494,66 +615,96 @@ public class FacadeCodegenUtils {
}
}
- return "FAILED_TO_FIND_MAPPED_UML_FEATURE";
+ return "FAILED_TO_FIND_MAPPED_UML_FEATURE"; //$NON-NLS-1$
}
+ /**
+ * Gets the package path from mapping.
+ *
+ * @param mapping
+ * the mapping
+ * @return the package path from mapping
+ */
public static String getPackagePathFromMapping(Mapping mapping) {
EObject UMLMetaElement = getUMLElement(mapping);
return getPackagePathFromUML(UMLMetaElement);
}
+ /**
+ * Gets the EPackage path from UML element mapped by a mapping.
+ *
+ * @param UMLMetaElement
+ * the UML metaElement
+ * @return the EPackage path from UML
+ */
public static String getPackagePathFromUML(EObject UMLMetaElement) {
EObject root = UMLMetaElement.eResource().getContents().get(0);
if(root instanceof Profile) {
- Stereotype ePackageStereotype = ((Profile)root).getAppliedStereotype("Ecore::EPackage");
+ Stereotype ePackageStereotype = ((Profile)root).getAppliedStereotype("Ecore::EPackage"); //$NON-NLS-1$
if(ePackageStereotype != null) {
- Object packageName = ((Profile)root).getValue(ePackageStereotype, "packageName");
- Object basePackage = ((Profile)root).getValue(ePackageStereotype, "basePackage");
+ Object packageName = ((Profile)root).getValue(ePackageStereotype, "packageName"); //$NON-NLS-1$
+ Object basePackage = ((Profile)root).getValue(ePackageStereotype, "basePackage"); //$NON-NLS-1$
if(packageName instanceof String && basePackage instanceof String) {
if(UMLMetaElement instanceof NamedElement) {
- return basePackage + "." + packageName;
+ return basePackage + "." + packageName; //$NON-NLS-1$
}
}
}
} else {
- return "org.eclipse.uml2.uml";
+ return "org.eclipse.uml2.uml"; //$NON-NLS-1$
}
- return "FAILED_TO_FIND_MAPPED_UML_PACKAGE_PATH";
+ return "FAILED_TO_FIND_MAPPED_UML_PACKAGE_PATH"; //$NON-NLS-1$
}
+ /**
+ * Gets the full EPackage path from a mapping.
+ *
+ * @param mapping
+ * the mapping
+ * @return the Epackage path
+ */
public static String getUMLPackageName(Mapping mapping) {
EObject UMLMetaElement = getUMLElement(mapping);
EObject root = UMLMetaElement.eResource().getContents().get(0);
if(root instanceof Profile) {
- Stereotype ePackageStereotype = ((Profile)root).getAppliedStereotype("Ecore::EPackage");
+ Stereotype ePackageStereotype = ((Profile)root).getAppliedStereotype("Ecore::EPackage"); //$NON-NLS-1$
if(ePackageStereotype != null) {
- Object packageName = ((Profile)root).getValue(ePackageStereotype, "packageName");
+ Object packageName = ((Profile)root).getValue(ePackageStereotype, "packageName"); //$NON-NLS-1$
if(packageName instanceof String) {
if(UMLMetaElement instanceof NamedElement) {
- return getPackagePathFromMapping(mapping) + "." + packageName + "Package";
+ return getPackagePathFromMapping(mapping) + "." + packageName + "Package"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
} else {
- return getPackagePathFromMapping(mapping) + ".UMLPackage";
+ return getPackagePathFromMapping(mapping) + ".UMLPackage"; //$NON-NLS-1$
}
- return "FAILED_TO_FIND_MAPPED_UML_PACKAGE_NAME";
+ return "FAILED_TO_FIND_MAPPED_UML_PACKAGE_NAME"; //$NON-NLS-1$
}
+ /**
+ * Gets the UML accessorName from a mapping.
+ *
+ * @param mapping
+ * the mapping
+ * @param genModel
+ * the GenModel
+ * @return the UML accessorName
+ */
public static String getUMLAccessorName(Mapping mapping, GenModel genModel) {
EObject UMLMetaElement = getUMLElement(mapping);
@@ -582,21 +733,48 @@ public class FacadeCodegenUtils {
}
}
- return "FAILED_TO_FIND_MAPPED_UML_ACCESSOR_NAME";
+ return "FAILED_TO_FIND_MAPPED_UML_ACCESSOR_NAME"; //$NON-NLS-1$
}
+ /**
+ * Gets the ClassifierAccessorName from a mapping.
+ *
+ * @param genModel
+ * the GenModel
+ * @param mapping
+ * the mapping
+ * @return the ClassifierAccessorName
+ */
public static String getClassifierAccessorName(GenModel genModel, Mapping mapping) {
return genModel.findGenClassifier((EClassifier)mapping.getSpecificDomainElement()).getClassifierAccessorName();
}
+ /**
+ * Gets the FeatureAccessorName from a mapping.
+ *
+ * @param genModel
+ * the GenModel
+ * @param mapping
+ * the mapping
+ * @return the FeatureAccessorName
+ */
public static String getFeatureAccessorName(GenModel genModel, Mapping mapping) {
return genModel.findGenFeature((EStructuralFeature)mapping.getSpecificDomainElement()).getFeatureAccessorName();
}
- public static String getUMLMetaElement(EObject specificMetaElement, GenModel genModel) {
+ /**
+ * Gets the UML meta element mapped to a facadeElement.
+ *
+ * @param facadeMetaElement
+ * the facade meta element
+ * @param genModel
+ * the GenModel
+ * @return the UML meta element
+ */
+ public static String getUMLMetaElement(EObject facadeMetaElement, GenModel genModel) {
for(Mapping mapping : getAllMappings(genModel)) {
- if(EcoreUtil.equals(mapping.getSpecificDomainElement(), specificMetaElement)) {
+ if(EcoreUtil.equals(mapping.getSpecificDomainElement(), facadeMetaElement)) {
EObject UMLMetaElement = getUMLElement(mapping);
if(UMLMetaElement instanceof ENamedElement) {
@@ -608,30 +786,40 @@ public class FacadeCodegenUtils {
}
}
- return "FAILED_TO_FIND_MAPPED_UML_METACLASS";
+
+ return "FAILED_TO_FIND_MAPPED_UML_METACLASS"; //$NON-NLS-1$
}
- public static String getUMLFactory(EObject specificMetaElement, GenModel genModel) {
+ /**
+ * Gets the UML factory.
+ *
+ * @param facadeMetaElement
+ * the facade meta element
+ * @param genModel
+ * the GenModel
+ * @return the UML factory
+ */
+ public static String getUMLFactory(EObject facadeMetaElement, GenModel genModel) {
for(Mapping mapping : getAllMappings(genModel)) {
- if(EcoreUtil.equals(mapping.getSpecificDomainElement(), specificMetaElement)) {
+ if(EcoreUtil.equals(mapping.getSpecificDomainElement(), facadeMetaElement)) {
EObject UMLMetaElement = getUMLElement(mapping);
if(UMLMetaElement != null) {
EObject root = UMLMetaElement.eResource().getContents().get(0);
if(root instanceof Profile) {
- Stereotype ePackageStereotype = ((Profile)root).getAppliedStereotype("Ecore::EPackage");
+ Stereotype ePackageStereotype = ((Profile)root).getAppliedStereotype("Ecore::EPackage"); //$NON-NLS-1$
if(ePackageStereotype != null) {
- Object packageName = ((Profile)root).getValue(ePackageStereotype, "packageName");
+ Object packageName = ((Profile)root).getValue(ePackageStereotype, "packageName"); //$NON-NLS-1$
if(packageName instanceof String) {
if(UMLMetaElement instanceof NamedElement) {
- return getPackagePathFromUML(UMLMetaElement) + "." + packageName + "Factory";
+ return getPackagePathFromUML(UMLMetaElement) + "." + packageName + "Factory"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
} else {
- return getPackagePathFromUML(UMLMetaElement) + ".UMLFactory";
+ return getPackagePathFromUML(UMLMetaElement) + ".UMLFactory"; //$NON-NLS-1$
}
}
@@ -641,9 +829,16 @@ public class FacadeCodegenUtils {
- return "FAILED_TO_FIND_MAPPED_UML_FACTORY";
+ return "FAILED_TO_FIND_MAPPED_UML_FACTORY"; //$NON-NLS-1$
}
+ /**
+ * Gets the appropriate qualified type name.
+ *
+ * @param genClassifier
+ * a genClassifier
+ * @return the qualifiedType name
+ */
public static String getAppropriateQualifiedTypeName(GenClassifier genClassifier) {
if(genClassifier instanceof GenClass) {
@@ -655,32 +850,55 @@ public class FacadeCodegenUtils {
} else {
- return "FAILED_TO_FIND_QUALIFIED_TYPE_NAME";
+ return "FAILED_TO_FIND_QUALIFIED_TYPE_NAME"; //$NON-NLS-1$
}
}
+ /**
+ * Gets the UML enum element from mapping.
+ *
+ * @param mapping
+ * the mapping
+ * @return the UML enum element from mapping
+ */
public static String getUMLEnumElementFromMapping(Mapping mapping) {
if(mapping.getUmlElement() instanceof EEnumLiteral) {
- return ((EEnumLiteral)mapping.getUmlElement()).getEEnum().getName() + ".get(" + ((EEnumLiteral)mapping.getUmlElement()).getValue() + ")";
+ return ((EEnumLiteral)mapping.getUmlElement()).getEEnum().getName() + ".get(" + ((EEnumLiteral)mapping.getUmlElement()).getValue() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
} else if(mapping.getUmlElement() instanceof EnumerationLiteral) {
- return ((EnumerationLiteral)mapping.getUmlElement()).getEnumeration().getName() + ".get(\"" + ((EnumerationLiteral)mapping.getUmlElement()).getName() + "\")";
+ return ((EnumerationLiteral)mapping.getUmlElement()).getEnumeration().getName() + ".get(\"" + ((EnumerationLiteral)mapping.getUmlElement()).getName() + "\")"; //$NON-NLS-1$ //$NON-NLS-2$
}
- return "FAILED_TO_FIND_MAPPED_UML_ENUM_ELEMENT";
+ return "FAILED_TO_FIND_MAPPED_UML_ENUM_ELEMENT"; //$NON-NLS-1$
}
- public static String getSpecificEnumElementFromMapping(Mapping mapping) {
+ /**
+ * Gets the facade enum element from mapping.
+ *
+ * @param mapping
+ * the mapping
+ * @return the facade enum element from the mapping
+ */
+ public static String getFacadeEnumElementFromMapping(Mapping mapping) {
if(mapping.getUmlElement() instanceof EEnumLiteral) {
- return ((EEnumLiteral)mapping.getUmlElement()).getEEnum().getName() + ".get(" + ((EEnumLiteral)mapping.getUmlElement()).getValue() + ")";
+ return ((EEnumLiteral)mapping.getUmlElement()).getEEnum().getName() + ".get(" + ((EEnumLiteral)mapping.getUmlElement()).getValue() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
} else if(mapping.getUmlElement() instanceof EnumerationLiteral) {
- return ((EnumerationLiteral)mapping.getUmlElement()).getEnumeration().getName() + ".get(\"" + ((EnumerationLiteral)mapping.getUmlElement()).getName() + "\")";
+ return ((EnumerationLiteral)mapping.getUmlElement()).getEnumeration().getName() + ".get(\"" + ((EnumerationLiteral)mapping.getUmlElement()).getName() + "\")"; //$NON-NLS-1$ //$NON-NLS-2$
}
- return "FAILED_TO_FIND_MAPPED_SPECIFIC_ENUM_ELEMENT";
+ return "FAILED_TO_FIND_MAPPED_FACADE_ENUM_ELEMENT"; //$NON-NLS-1$
}
- protected static boolean isExtensionStereotypePropertyFromSpecific(EObject specificElement, GenModel genModel) {
- EObject umlElement = findUMLMetaElement(specificElement, genModel);
+ /**
+ * Checks if facade element represents a stereotype role for an extension
+ *
+ * @param facadeElement
+ * the facade element
+ * @param genModel
+ * the GenModel
+ * @return true, if facade element represents a stereotype role for an extension
+ */
+ protected static boolean isExtensionStereotypePropertyFromFacade(EObject facadeElement, GenModel genModel) {
+ EObject umlElement = findUMLMetaElement(facadeElement, genModel);
if(umlElement instanceof Property) {
if(((Property)umlElement).getAssociation() instanceof Extension) {
@@ -693,6 +911,13 @@ public class FacadeCodegenUtils {
return Boolean.FALSE;
}
+ /**
+ * Checks if is extention stereotype property.
+ *
+ * @param genFeature
+ * the gen feature
+ * @return true, if is extention stereotype property
+ */
public static boolean isExtentionStereotypeProperty(GenFeature genFeature) {
@@ -709,6 +934,13 @@ public class FacadeCodegenUtils {
return Boolean.FALSE;
}
+ /**
+ * Checks if is extension property.
+ *
+ * @param genFeature
+ * the gen feature
+ * @return true, if is extension property
+ */
public static boolean isExtensionProperty(GenFeature genFeature) {
EObject umlElement = findUMLMetaElement(genFeature.getEcoreFeature(), genFeature.getGenModel());
@@ -721,6 +953,13 @@ public class FacadeCodegenUtils {
return Boolean.FALSE;
}
+ /**
+ * Checks if is stereotype property.
+ *
+ * @param genFeature
+ * the gen feature
+ * @return true, if is stereotype property
+ */
public static boolean isStereotypeProperty(GenFeature genFeature) {
EClass ecoreClass = genFeature.getGenClass().getEcoreClass();
@@ -749,6 +988,13 @@ public class FacadeCodegenUtils {
return Boolean.FALSE;
}
+ /**
+ * Gets the stereotype qualified name.
+ *
+ * @param genFeature
+ * the gen feature
+ * @return the stereotype qualified name
+ */
public static String getStereotypeQualifiedName(GenFeature genFeature) {
EObject umlElement = findUMLMetaElement(genFeature.getEcoreFeature(), genFeature.getGenModel());
@@ -757,56 +1003,87 @@ public class FacadeCodegenUtils {
return ((Property)umlElement).getClass_().getQualifiedName();
}
}
- return "FAILED_TO_FIND_STEREOTYPE_QUALIFIEDNAME";
+ return "FAILED_TO_FIND_STEREOTYPE_QUALIFIEDNAME"; //$NON-NLS-1$
+ }
+
+
+
+ /**
+ * Gets the stereotyped mappings.
+ *
+ * @param genModel
+ * the GenModel
+ * @return the stereotyped mappings
+ */
+ public static synchronized List<StereotypedMapping> getStereotypedMappings(GenModel genModel) {
+
+ if(!stereotypedMappingsCache.containsKey(genModel)) {
+
+ List<StereotypedMapping> stereotypedMappings = new ArrayList<StereotypedMapping>();
+ for(Mapping mapping : getAllMappings(genModel)) {
+ if(mapping instanceof StereotypedMapping) {
+ stereotypedMappings.add((StereotypedMapping)mapping);
+ }
+ }
+
+ stereotypedMappingsCache.put(genModel, stereotypedMappings);
+ }
+
+ return stereotypedMappingsCache.get(genModel);
}
+ /**
+ * Generate the wrapper for a mapping considering possible application of stereotype combinations
+ *
+ * @param mapping
+ * the mapping
+ * @param genModel
+ * the GenModel
+ * @param genPackage
+ * the gen package
+ * @return the corresponding stereotype mapping
+ */
public static String getCorrespondingStereotypeMapping(org.eclipse.papyrus.facademapping.Mapping mapping, GenModel genModel, GenPackage genPackage) {
- String result = "";
+ String result = ""; //$NON-NLS-1$
if(!(mapping instanceof StereotypedMapping)) {
- List<Mapping> allMappings = getAllMappings(genModel);
List<StereotypedMapping> correspondingStereotypeMappings = new ArrayList<StereotypedMapping>();
List<StereotypedMapping> correspondingAssocationStereotypeMappings = new ArrayList<StereotypedMapping>();
- for(Mapping toProcessMapping : allMappings) {
- if(mapping != toProcessMapping) {
- if(toProcessMapping instanceof StereotypedMapping) {
+ for(Mapping toProcessMapping : getStereotypedMappings(genModel)) {
+ if(mapping != toProcessMapping) {
- boolean isAbstract = false;
- EList<EObject> stereos = ((StereotypedMapping)toProcessMapping).getAppliedStereotypes();
- for(EObject stereo : stereos) {
- if(stereo instanceof Stereotype) {
- if(((Stereotype)stereo).isAbstract()) {
- isAbstract = true;
- }
+ boolean isAbstract = false;
+ EList<EObject> stereos = ((StereotypedMapping)toProcessMapping).getAppliedStereotypes();
+ for(EObject stereo : stereos) {
+ if(stereo instanceof Stereotype) {
+ if(((Stereotype)stereo).isAbstract()) {
+ isAbstract = true;
}
}
- if(!isAbstract) {
-
- if(((StereotypedMapping)toProcessMapping).getKind() == ExtensionDefinitionKind.GENERALIZATION || ((StereotypedMapping)toProcessMapping).getKind() == ExtensionDefinitionKind.MULTI_GENERALIZATION) {
- if(toProcessMapping.getUmlElement() == mapping.getUmlElement()) {
- correspondingStereotypeMappings.add((StereotypedMapping)toProcessMapping);
- }
- } else {
- if(toProcessMapping.getUmlElement() instanceof EClass) {
- List candidates = new ArrayList<>();
- candidates.add((EClass)toProcessMapping.getUmlElement());
- candidates.addAll(((EClass)toProcessMapping.getUmlElement()).getEAllSuperTypes());
-
- if(candidates.contains(toProcessMapping.getUmlElement()))
- correspondingAssocationStereotypeMappings.add((StereotypedMapping)toProcessMapping);
- }
+ }
+ if(!isAbstract) {
+ if(((StereotypedMapping)toProcessMapping).getKind() == ExtensionDefinitionKind.GENERALIZATION || ((StereotypedMapping)toProcessMapping).getKind() == ExtensionDefinitionKind.MULTI_GENERALIZATION) {
+ if(toProcessMapping.getUmlElement() == mapping.getUmlElement()) {
+ correspondingStereotypeMappings.add((StereotypedMapping)toProcessMapping);
+ }
+ } else {
+ if(mapping.getUmlElement() instanceof EClass) {
+ List<EObject> candidates = new ArrayList<EObject>();
+ candidates.add((EClass)mapping.getUmlElement());
+ candidates.addAll(((EClass)mapping.getUmlElement()).getEAllSuperTypes());
+
+ if(candidates.contains(toProcessMapping.getUmlElement()))
+ correspondingAssocationStereotypeMappings.add((StereotypedMapping)toProcessMapping);
}
}
}
}
}
-
-
for(StereotypedMapping correspondingStereotypeMapping : correspondingStereotypeMappings) {
if(correspondingStereotypeMapping.getSpecificDomainElement() instanceof ENamedElement) {
@@ -819,19 +1096,35 @@ public class FacadeCodegenUtils {
//Create combination with association stereo
if(!correspondingAssocationStereotypeMappings.isEmpty()) {
- for(StereotypedMapping stereotypedAssocationMapping : correspondingAssocationStereotypeMappings) {
- combination.addAll((Collection<? extends Stereotype>)stereotypedAssocationMapping.getAppliedStereotypes());
- if(stereotypedAssocationMapping.getSpecificDomainElement() instanceof ENamedElement) {
- name += "_" + ((ENamedElement)stereotypedAssocationMapping.getSpecificDomainElement()).getName().toLowerCase();
- } else {
- System.err.println("Problem with : " + stereotypedAssocationMapping.getSpecificDomainElement());
+
+ for(int k = 1; k <= correspondingAssocationStereotypeMappings.size(); k++) {
+ CombinationGenerator combinaisonGenerator = new CombinationGenerator(correspondingAssocationStereotypeMappings.size(), k);
+
+ //Process each combination
+ while(combinaisonGenerator.hasMore()) {
+ int[] indices = combinaisonGenerator.getNext();
+
+ //Single stereotype first
+ combination = new ArrayList<Stereotype>();
+ combination.addAll((Collection<? extends Stereotype>)correspondingStereotypeMapping.getAppliedStereotypes());
+ name = ((ENamedElement)correspondingStereotypeMapping.getSpecificDomainElement()).getName().toLowerCase();
+
+ for(int i = 0; i < indices.length; i++) {
+ combination.addAll((Collection<? extends Stereotype>)correspondingAssocationStereotypeMappings.get(indices[i]).getAppliedStereotypes());
+
+ if(correspondingAssocationStereotypeMappings.get(indices[i]).getSpecificDomainElement() instanceof ENamedElement) {
+ name += "_" + ((ENamedElement)correspondingAssocationStereotypeMappings.get(indices[i]).getSpecificDomainElement()).getName().toLowerCase(); //$NON-NLS-1$
+ } else {
+ FacadeCodeGenPlugin.log.warn(Messages.FacadeCodegenUtils_48 + correspondingAssocationStereotypeMappings.get(indices[i]).getSpecificDomainElement());
+ }
+ }
+ result += addWrappingStereotypeMapping(combination, name, genPackage, genModel, correspondingStereotypeMapping);
}
}
- result += addWrappingStereotypeMapping(combination, name, genPackage, genModel, correspondingStereotypeMapping);
}
} else {
- System.err.println("Problem with : " + correspondingStereotypeMapping.getSpecificDomainElement());
+ FacadeCodeGenPlugin.log.warn(Messages.FacadeCodegenUtils_49 + correspondingStereotypeMapping.getSpecificDomainElement());
}
}
@@ -842,33 +1135,57 @@ public class FacadeCodegenUtils {
}
+ /**
+ * Generate the actual text for a wrapping of a combination of stereotype application
+ *
+ * @param combination
+ * the combination
+ * @param name
+ * the name
+ * @param genPackage
+ * the gen package
+ * @param genModel
+ * the GenModel
+ * @param correspondingStereotypeMapping
+ * the corresponding stereotype mapping
+ * @return the string
+ */
protected static String addWrappingStereotypeMapping(List<Stereotype> combination, String name, GenPackage genPackage, GenModel genModel, StereotypedMapping correspondingStereotypeMapping) {
- String result = "";
+ String result = ""; //$NON-NLS-1$
- result += "java.util.List<org.eclipse.uml2.uml.Stereotype> " + name + "_Stereotypes = new java.util.ArrayList<org.eclipse.uml2.uml.Stereotype>();\n";
+ result += "java.util.List<org.eclipse.uml2.uml.Stereotype> " + name + "_Stereotypes = new java.util.ArrayList<org.eclipse.uml2.uml.Stereotype>();\n"; //$NON-NLS-1$ //$NON-NLS-2$
result += addStereotypes(combination, name);
- result += "if(((org.eclipse.uml2.uml.Element)umlElement).getAppliedStereotypes().size() == " + name + "_Stereotypes.size()) {\n";
- result += "if(((org.eclipse.uml2.uml.Element)umlElement).getAppliedStereotypes().containsAll(" + name + "_Stereotypes)) {\n";
- result += "return " + genPackage.getImportedPackageInterfaceName() + ".eINSTANCE.get" + getClassifierAccessorName(genModel, correspondingStereotypeMapping) + "();\n";
- result += "}\n";
- result += "}\n";
- for(Stereotype stereotype : combination) {
- result += "}\n";
+ result += "if(((org.eclipse.uml2.uml.Element)umlElement).getAppliedStereotypes().size() == " + name + "_Stereotypes.size()) {\n"; //$NON-NLS-1$ //$NON-NLS-2$
+ result += "if(((org.eclipse.uml2.uml.Element)umlElement).getAppliedStereotypes().containsAll(" + name + "_Stereotypes)) {\n"; //$NON-NLS-1$ //$NON-NLS-2$
+ result += "return " + genPackage.getImportedPackageInterfaceName() + ".eINSTANCE.get" + getClassifierAccessorName(genModel, correspondingStereotypeMapping) + "();\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ result += "}\n"; //$NON-NLS-1$
+ result += "}\n"; //$NON-NLS-1$
+ for(int i = 0; i < combination.size(); i++) {
+ result += "}\n"; //$NON-NLS-1$
}
return result;
}
+ /**
+ * Generate the text for the combination of stereotype application
+ *
+ * @param combination
+ * the combination
+ * @param name
+ * the name
+ * @return the string
+ */
protected static String addStereotypes(List<Stereotype> combination, String name) {
- String result = "";
+ String result = ""; //$NON-NLS-1$
for(EObject stereotype : combination) {
if(stereotype instanceof Stereotype) {
- result += "if(((org.eclipse.uml2.uml.Element)umlElement).getApplicableStereotype(\"" + ((Stereotype)stereotype).getQualifiedName() + "\") != null) {\n";
- result += name + "_Stereotypes.add(((org.eclipse.uml2.uml.Element)umlElement).getApplicableStereotype(\"" + ((Stereotype)stereotype).getQualifiedName() + "\"));\n";
+ result += "if(((org.eclipse.uml2.uml.Element)umlElement).getApplicableStereotype(\"" + ((Stereotype)stereotype).getQualifiedName() + "\") != null) {\n"; //$NON-NLS-1$ //$NON-NLS-2$
+ result += name + "_Stereotypes.add(((org.eclipse.uml2.uml.Element)umlElement).getApplicableStereotype(\"" + ((Stereotype)stereotype).getQualifiedName() + "\"));\n"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -876,14 +1193,205 @@ public class FacadeCodegenUtils {
return result;
}
- public static boolean isPrimtiveList(GenFeature genFeature) {
- if(CodeGenUtil.isJavaDefaultType(genFeature.getListItemType())) {
+ /**
+ * Checks if is a list of primitive types.
+ *
+ * @param genFeature
+ * the genFeature
+ * @return true, if is list of primitive types
+ */
+ public static boolean isPrimtiveList(GenTypedElement genTypedElement) {
+ if(CodeGenUtil.isJavaDefaultType(genTypedElement.getListItemType())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
+ /**
+ * Checks if is primitive type.
+ *
+ * @param genFeature
+ * the genFeature
+ * @return true, if is primitive type
+ */
+ public static boolean isPrimitive(GenTypedElement genTypedElement) {
+ if(isJavaDefaultType(genTypedElement.getType())) {
+ return Boolean.TRUE;
+ }
+
+ if(isEcoreDefaultType(genTypedElement.getType())) {
+ return Boolean.TRUE;
+ }
+
+ if(genTypedElement.getType().startsWith("java.util.Map<")) {
+ return Boolean.TRUE;
+ }
+
+ return Boolean.FALSE;
+ }
+
+ /**
+ * Tests whether the given string is the name of a primitive or java.lang type.
+ */
+ protected static boolean isEcoreDefaultType(String s) {
+ return getEcoreDefaultTypes().contains(s);
+ }
+
+ /**
+ * Tests whether the given string is the name of a primitive or java.lang type.
+ */
+ protected static boolean isJavaDefaultType(String s) {
+ return getJavaDefaultTypes().contains(s);
+ }
+
+ /**
+ * Returns the names of the ecore types
+ */
+ public static synchronized Set<String> getEcoreDefaultTypes() {
+ if(ecoreDefaultTypes == null) {
+ Set<String> result = new HashSet<String>(100);
+ result.add("org.eclipse.emf.ecore.EAnnotation");
+ result.add("org.eclipse.emf.ecore.EAttribute");
+ result.add("org.eclipse.emf.ecore.EClass");
+ result.add("org.eclipse.emf.ecore.EClassifier");
+ result.add("org.eclipse.emf.ecore.EcoreFactory");
+ result.add("org.eclipse.emf.ecore.EcorePackage");
+ result.add("org.eclipse.emf.ecore.EDataType");
+ result.add("org.eclipse.emf.ecore.EEnum");
+ result.add("org.eclipse.emf.ecore.EEnumLiteral");
+ result.add("org.eclipse.emf.ecore.EFactory");
+ result.add("org.eclipse.emf.ecore.EGenericType");
+ result.add("org.eclipse.emf.ecore.EModelElement");
+ result.add("org.eclipse.emf.ecore.ENamedElement");
+ result.add("org.eclipse.emf.ecore.EObject");
+ result.add("org.eclipse.emf.ecore.EOperation");
+ result.add("org.eclipse.emf.ecore.EPackage");
+ result.add("org.eclipse.emf.ecore.EParameter");
+ result.add("org.eclipse.emf.ecore.EReference");
+ result.add("org.eclipse.emf.ecore.EStructuralFeature");
+ result.add("org.eclipse.emf.ecore.ETypedElement");
+ result.add("org.eclipse.emf.ecore.ETypeParameter");
+ result.add("org.eclipse.emf.ecore.EValidator");
+ result.add("org.eclipse.emf.ecore.InternalEObject");
+
+ //ypes not directly EMF but used by EMF
+ result.add("org.eclipse.emf.common.util.DiagnosticChain");
+
+
+ ecoreDefaultTypes = Collections.unmodifiableSet(result);
+ }
+ return ecoreDefaultTypes;
+ }
+
+ /**
+ * Returns the names of the primitives and types
+ */
+ public static synchronized Set<String> getJavaDefaultTypes() {
+ if(javaDefaultTypes == null) {
+ Set<String> result = new HashSet<String>(100);
+ result.add("java.lang.AbstractMethodError");
+ result.add("java.lang.ArithmeticException");
+ result.add("java.lang.ArrayIndexOutOfBoundsException");
+ result.add("java.lang.ArrayStoreException");
+ result.add("java.lang.Boolean");
+ result.add("java.lang.Byte");
+ result.add("java.lang.Character");
+ result.add("java.lang.Class");
+ result.add("java.lang.ClassCastException");
+ result.add("java.lang.ClassCircularityError");
+ result.add("java.lang.ClassFormatError");
+ result.add("java.lang.ClassLoader");
+ result.add("java.lang.ClassNotFoundException");
+ result.add("java.lang.CloneNotSupportedException");
+ result.add("java.lang.Cloneable");
+ result.add("java.lang.Comparable");
+ result.add("java.lang.Compiler");
+ result.add("java.lang.Double");
+ result.add("java.lang.Deprecated");
+ result.add("java.lang.Enum");
+ result.add("java.lang.Error");
+ result.add("java.lang.Exception");
+ result.add("java.lang.ExceptionInInitializerError");
+ result.add("java.lang.Float");
+ result.add("java.lang.FloatingDecimal");
+ result.add("java.lang.IllegalAccessError");
+ result.add("java.lang.IllegalAccessException");
+ result.add("java.lang.IllegalArgumentException");
+ result.add("java.lang.IllegalMonitorStateException");
+ result.add("java.lang.IllegalStateException");
+ result.add("java.lang.IllegalThreadStateException");
+ result.add("java.lang.IncompatibleClassChangeError");
+ result.add("java.lang.IndexOutOfBoundsException");
+ result.add("java.lang.InheritableThreadLocal");
+ result.add("java.lang.InstantiationError");
+ result.add("java.lang.InstantiationException");
+ result.add("java.lang.Integer");
+ result.add("java.lang.InternalError");
+ result.add("java.lang.InterruptedException");
+ result.add("java.lang.LinkageError");
+ result.add("java.lang.Long");
+ result.add("java.lang.Math");
+ result.add("java.lang.NegativeArraySizeException");
+ result.add("java.lang.NoClassDefFoundError");
+ result.add("java.lang.NoSuchFieldError");
+ result.add("java.lang.NoSuchFieldException");
+ result.add("java.lang.NoSuchMethodError");
+ result.add("java.lang.NoSuchMethodException");
+ result.add("java.lang.NullPointerException");
+ result.add("java.lang.Number");
+ result.add("java.lang.NumberFormatException");
+ result.add("java.lang.Object");
+ result.add("java.lang.Override");
+ result.add("java.lang.OutOfMemoryError");
+ result.add("java.lang.Package");
+ result.add("java.lang.Process");
+ result.add("java.lang.Runnable");
+ result.add("java.lang.Runtime");
+ result.add("java.lang.RuntimeException");
+ result.add("java.lang.RuntimePermission");
+ result.add("java.lang.SecurityException");
+ result.add("java.lang.SecurityManager");
+ result.add("java.lang.Short");
+ result.add("java.lang.StackOverflowError");
+ result.add("java.lang.String");
+ result.add("java.lang.StringBuffer");
+ result.add("java.lang.StringBuilder");
+ result.add("java.lang.StringIndexOutOfBoundsException");
+ result.add("java.lang.SuppressWarnings");
+ result.add("java.lang.System");
+ result.add("java.lang.Thread");
+ result.add("java.lang.ThreadDeath");
+ result.add("java.lang.ThreadGroup");
+ result.add("java.lang.ThreadLocal");
+ result.add("java.lang.Throwable");
+ result.add("java.lang.UnknownError");
+ result.add("java.lang.UnsatisfiedLinkError");
+ result.add("java.lang.UnsupportedClassVersionError");
+ result.add("java.lang.UnsupportedOperationException");
+ result.add("java.lang.VerifyError");
+ result.add("java.lang.VirtualMachineError");
+ result.add("Void");
+ result.add("void");
+ result.add("boolean");
+ result.add("byte");
+ result.add("char");
+ result.add("double");
+ result.add("float");
+ result.add("int");
+ result.add("long");
+ result.add("short");
+ javaDefaultTypes = Collections.unmodifiableSet(result);
+ }
+ return javaDefaultTypes;
+ }
+
+ /**
+ * Copy the original ecore metamodel in the impl source package
+ *
+ * @param genPackage
+ * the gen package
+ */
public static void copyEcore(GenPackage genPackage) {
@@ -893,16 +1401,16 @@ public class FacadeCodegenUtils {
URI originalURI = ecoreModelElement.eResource().getURI();
String modelDirectory = genModel.getModelDirectory();
- String implPackage = genPackage.getClassPackageName().replaceAll("\\.", "/");
- if(!implPackage.startsWith("/") && !modelDirectory.endsWith("/")) {
- implPackage = "/" + implPackage;
+ String implPackage = genPackage.getClassPackageName().replaceAll("\\.", "/"); //$NON-NLS-1$ //$NON-NLS-2$
+ if(!implPackage.startsWith("/") && !modelDirectory.endsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$
+ implPackage = "/" + implPackage; //$NON-NLS-1$
}
String filePath = modelDirectory + implPackage;
- if(!filePath.endsWith("/")) {
- filePath += "/";
+ if(!filePath.endsWith("/")) { //$NON-NLS-1$
+ filePath += "/"; //$NON-NLS-1$
}
filePath += originalURI.lastSegment();
- URI destURI = URI.createURI("platform:/resource" + filePath, true);
+ URI destURI = URI.createURI("platform:/resource" + filePath, true); //$NON-NLS-1$
String dest = destURI.toPlatformString(true);
try {
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/MappingMissing.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/MappingMissing.java
deleted file mode 100644
index 026ab0512d7..00000000000
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/MappingMissing.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.eclipse.papyrus.facade.codegen.utils;
-
-
-public class MappingMissing extends Exception {
-
-}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.java
index fcec17be87a..21372aa2d6c 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facade.codegen.utils;
import java.util.ArrayList;
@@ -19,13 +32,20 @@ import org.eclipse.emf.ecore.EStructuralFeature;
public class WrappingListUtils {
- private static final String UNSUPPORTED_LIST_CONSTRUCTOR = "UNSUPPORTED_LIST_CONSTRUCTOR";
+ private static final String UNSUPPORTED_LIST_CONSTRUCTOR = "UNSUPPORTED_LIST_CONSTRUCTOR"; //$NON-NLS-1$
+ /**
+ * Gets the list of genFeatures that are subsetted by the genFeature.
+ *
+ * @param genFeature
+ * the genFeature
+ * @return the list of subsetted genFeatures
+ */
protected static List<GenFeature> getSubsetReferenceGenFeature(GenFeature genFeature) {
List<GenFeature> result = new ArrayList<GenFeature>();
EStructuralFeature ecoreFeature = genFeature.getEcoreFeature();
if(ecoreFeature != null) {
- EAnnotation annotation = ecoreFeature.getEAnnotation("subsets");
+ EAnnotation annotation = ecoreFeature.getEAnnotation("subsets"); //$NON-NLS-1$
if(annotation != null) {
EList<EObject> references = annotation.getReferences();
for(EObject ref : references) {
@@ -40,6 +60,18 @@ public class WrappingListUtils {
return result;
}
+
+ /**
+ * Gets the wrapping list constructor.
+ *
+ * @param genClass
+ * the gen class
+ * @param genFeature
+ * the gen feature
+ * @param typeArgument
+ * the type argument
+ * @return the wrapping list constructor
+ */
public static String getWrappingListConstructor(GenClass genClass, GenFeature genFeature, String typeArgument) {
boolean isJava5 = isJDK50(genClass.getGenModel());
@@ -48,12 +80,12 @@ public class WrappingListUtils {
GenClassImpl genClassImpl = (GenClassImpl)genClass;
StringBuffer sb = new StringBuffer();
- String unsettable = genFeature.isUnsettable() ? ".Unsettable" : "";
- String offsetCorrectionField = genClassImpl.hasOffsetCorrection() ? " + " + genClassImpl.getOffsetCorrectionField(null) : "";
+ String unsettable = genFeature.isUnsettable() ? ".Unsettable" : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ String offsetCorrectionField = genClassImpl.hasOffsetCorrection() ? " + " + genClassImpl.getOffsetCorrectionField(null) : ""; //$NON-NLS-1$ //$NON-NLS-2$
if(genFeature.isMapType()) {
- sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_MapType");
+ sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_MapType"); //$NON-NLS-1$
// GenClass mapGenClass = genFeature.getMapEntryTypeGenClass();
// sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.emf.ecore.util.EcoreEMap"));
// sb.append(unsettable);
@@ -77,7 +109,7 @@ public class WrappingListUtils {
// }
// sb.append(")");
} else if(genFeature.isFeatureMapType()) {
- sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_FeatureMapType");
+ sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_FeatureMapType"); //$NON-NLS-1$
// if(genFeature.isWrappedFeatureMapType()) {
// sb.append(genFeature.getImportedEffectiveFeatureMapWrapperClass());
// sb.append("(new ");
@@ -94,7 +126,7 @@ public class WrappingListUtils {
EGenericType eGenericType = genFeature.getEcoreFeature().getEGenericType();
if(genClassImpl.getGenModel().isSuppressNotification()) {
- sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_Generic");
+ sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_Generic"); //$NON-NLS-1$
// sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.emf.ecore.util.BasicInternalEList"));
// if(genClassImpl.getGenModel().getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF28_VALUE) {
@@ -112,66 +144,66 @@ public class WrappingListUtils {
if(genFeature.isBidirectional()) {
GenFeature reverseFeature = genFeature.getReverse();
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectContainmentWithInverseEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectContainmentWithInverseEList")); //$NON-NLS-1$
} else {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectContainmentWithInverseEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectContainmentWithInverseEList")); //$NON-NLS-1$
}
sb.append(unsettable);
if(genFeature.isResolveProxies()) {
// sb.append(".Resolving");
- sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_Resolving");
+ sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_Resolving"); //$NON-NLS-1$
}
if(isJava5) {
sb.append('<');
sb.append(genFeature.getListItemType(genClassImpl));
sb.append('>');
}
- sb.append("(");
+ sb.append("("); //$NON-NLS-1$
sb.append(typeArgument);
- sb.append(".class, this, ");
+ sb.append(".class, this, "); //$NON-NLS-1$
sb.append(genClassImpl.getQualifiedFeatureID(genFeature));
sb.append(offsetCorrectionField);
- sb.append(", ");
+ sb.append(", "); //$NON-NLS-1$
sb.append(reverseFeature.getGenClass().getQualifiedFeatureID(reverseFeature));
if(reverseFeature.getGenClass().hasOffsetCorrection()) {
- sb.append(" + ");
+ sb.append(" + "); //$NON-NLS-1$
sb.append(genClassImpl.getOffsetCorrectionField(genFeature));
}
- sb.append(",(java.util.Collection)umlList");
+ sb.append(",(java.util.Collection)umlList"); //$NON-NLS-1$
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
for(GenFeature feature : getSubsetReferenceGenFeature(genFeature)) {
- sb.append(",(" + genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList") + ")" + feature.getGetAccessor() + "()");
+ sb.append(",(" + genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList") + ")" + feature.getGetAccessor() + "()"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
- sb.append(")");
+ sb.append(")"); //$NON-NLS-1$
} else {
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectContainmentEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectContainmentEList")); //$NON-NLS-1$
} else {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectContainmentEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectContainmentEList")); //$NON-NLS-1$
}
sb.append(unsettable);
if(genFeature.isResolveProxies()) {
// sb.append(".Resolving");
- sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_Resolving");
+ sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_Resolving"); //$NON-NLS-1$
}
if(isJava5) {
sb.append('<');
sb.append(genFeature.getListItemType(genClassImpl));
sb.append('>');
}
- sb.append("(");
+ sb.append("("); //$NON-NLS-1$
sb.append(typeArgument);
- sb.append(".class, this, ");
+ sb.append(".class, this, "); //$NON-NLS-1$
sb.append(genClassImpl.getQualifiedFeatureID(genFeature));
sb.append(offsetCorrectionField);
- sb.append(",(java.util.Collection)umlList");
+ sb.append(",(java.util.Collection)umlList"); //$NON-NLS-1$
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
for(GenFeature feature : getSubsetReferenceGenFeature(genFeature)) {
- sb.append(",(" + genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList") + ")" + feature.getGetAccessor() + "()");
+ sb.append(",(" + genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList") + ")" + feature.getGetAccessor() + "()"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
- sb.append(")");
+ sb.append(")"); //$NON-NLS-1$
}
} else if(genFeature.isReferenceType()) {
if(genFeature.isBidirectional()) {
@@ -179,23 +211,23 @@ public class WrappingListUtils {
if(genFeature.isResolveProxies()) {
// sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList"));
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectWithInverseEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectWithInverseEList")); //$NON-NLS-1$
} else {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectWithInverseEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectWithInverseEList")); //$NON-NLS-1$
}
} else {
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectWithInverseEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectWithInverseEList")); //$NON-NLS-1$
} else {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectWithInverseEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectWithInverseEList")); //$NON-NLS-1$
}
}
sb.append(unsettable);
if(reverseFeature.isListType()) {
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
- sb.append(".WrappingSubsetManyInverse");
+ sb.append(".WrappingSubsetManyInverse"); //$NON-NLS-1$
} else {
- sb.append(".WrappingManyInverse");
+ sb.append(".WrappingManyInverse"); //$NON-NLS-1$
}
}
if(isJava5) {
@@ -203,37 +235,37 @@ public class WrappingListUtils {
sb.append(genFeature.getListItemType(genClassImpl));
sb.append('>');
}
- sb.append("(");
+ sb.append("("); //$NON-NLS-1$
sb.append(typeArgument);
- sb.append(".class, this, ");
+ sb.append(".class, this, "); //$NON-NLS-1$
sb.append(genClassImpl.getQualifiedFeatureID(genFeature));
sb.append(offsetCorrectionField);
- sb.append(", ");
+ sb.append(", "); //$NON-NLS-1$
sb.append(reverseFeature.getGenClass().getQualifiedFeatureID(reverseFeature));
if(reverseFeature.getGenClass().hasOffsetCorrection()) {
- sb.append(" + ");
+ sb.append(" + "); //$NON-NLS-1$
sb.append(genClassImpl.getOffsetCorrectionField(genFeature));
}
- sb.append(",(java.util.Collection)umlList");
+ sb.append(",(java.util.Collection)umlList"); //$NON-NLS-1$
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
for(GenFeature feature : getSubsetReferenceGenFeature(genFeature)) {
- sb.append(",(" + genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList") + ")" + feature.getGetAccessor() + "()");
+ sb.append(",(" + genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList") + ")" + feature.getGetAccessor() + "()"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
- sb.append(")");
+ sb.append(")"); //$NON-NLS-1$
} else {
if(genFeature.isResolveProxies()) {
// sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.emf.ecore.util.EObjectResolvingEList"));
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectEList")); //$NON-NLS-1$
} else {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectEList")); //$NON-NLS-1$
}
} else {
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.subset.WrappingSubsetEObjectEList")); //$NON-NLS-1$
} else {
- sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectEList"));
+ sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingEObjectEList")); //$NON-NLS-1$
}
}
sb.append(unsettable);
@@ -242,26 +274,26 @@ public class WrappingListUtils {
sb.append(genFeature.getListItemType(genClassImpl));
sb.append('>');
}
- sb.append("(");
+ sb.append("("); //$NON-NLS-1$
sb.append(typeArgument);
- sb.append(".class, this, ");
+ sb.append(".class, this, "); //$NON-NLS-1$
sb.append(genClassImpl.getQualifiedFeatureID(genFeature));
sb.append(offsetCorrectionField);
- sb.append(",(java.util.Collection)umlList");
+ sb.append(",(java.util.Collection)umlList"); //$NON-NLS-1$
if(!getSubsetReferenceGenFeature(genFeature).isEmpty()) {
for(GenFeature feature : getSubsetReferenceGenFeature(genFeature)) {
- sb.append(",(" + genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList") + ")" + feature.getGetAccessor() + "()");
+ sb.append(",(" + genClassImpl.getGenModel().getImportedName("org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList") + ")" + feature.getGetAccessor() + "()"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
- sb.append(")");
+ sb.append(")"); //$NON-NLS-1$
}
} else { //data type
if(genFeature.isUnique()) {
// sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.emf.ecore.util.EDataTypeUniqueEList"));
- sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_UniqueDatatype");
+ sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_UniqueDatatype"); //$NON-NLS-1$
} else {
// sb.append(genClassImpl.getGenModel().getImportedName("org.eclipse.emf.ecore.util.EDataTypeEList"));
- sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_NotUniqueDatatype");
+ sb.append(UNSUPPORTED_LIST_CONSTRUCTOR + "_NotUniqueDatatype"); //$NON-NLS-1$
}
sb.append(unsettable);
if(isJava5) {
@@ -269,25 +301,39 @@ public class WrappingListUtils {
sb.append(genFeature.getListItemType(genClassImpl));
sb.append('>');
}
- sb.append("(");
+ sb.append("("); //$NON-NLS-1$
sb.append(isPrimitiveType(eGenericType.getERawType()) ? genFeature.getRawListItemType() : typeArgument);
- sb.append(".class, this, ");
+ sb.append(".class, this, "); //$NON-NLS-1$
sb.append(genClassImpl.getQualifiedFeatureID(genFeature));
sb.append(offsetCorrectionField);
- sb.append(")");
+ sb.append(")"); //$NON-NLS-1$
}
}
return sb.toString();
}
- return "";
+ return ""; //$NON-NLS-1$
}
+ /**
+ * Checks if the genModel is defined as JDK50 complianceLevel.
+ *
+ * @param genModel
+ * the genModel
+ * @return true, if the genModel is defined as JDK50 complianceLevel.
+ */
public static boolean isJDK50(GenModel genModel) {
if(genModel != null && genModel.getComplianceLevel() != null)
return genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50;
return false;
}
+ /**
+ * Checks if is primitive type.
+ *
+ * @param eType
+ * the eType
+ * @return true, if is primitive type
+ */
static public boolean isPrimitiveType(EClassifier eType) {
return eType != null && CodeGenUtil.isJavaPrimitiveType(eType.getInstanceClassName());
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/META-INF/MANIFEST.MF b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/META-INF/MANIFEST.MF
index 736e0407fd9..d0c443f4655 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/META-INF/MANIFEST.MF
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: FacadeSepcificEditor
Bundle-SymbolicName: org.eclipse.papyrus.facade.definition.editor;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.facadeSpecificEditor.Activator
+Bundle-Activator: org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.jface.text,
@@ -11,6 +11,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.uml2;bundle-version="3.2.0",
org.eclipse.uml2.uml;bundle-version="4.1.0",
org.eclipse.papyrus.facade.editor;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.extensionpoints
+ org.eclipse.papyrus.uml.extensionpoints,
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
+ org.eclipse.papyrus.facade.utils;bundle-version="0.10.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/plugin.xml b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/plugin.xml
index d0db3b48518..bc95e9e6f16 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/plugin.xml
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/plugin.xml
@@ -13,6 +13,5 @@
id="FacadeDefinitionEditor">
</editor>
</extension>
-
-
+
</plugin>
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/ResourceManager.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/ResourceManager.java
index 1f509369c90..4b94d4e04d4 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/ResourceManager.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/ResourceManager.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package com.swtdesigner;
import java.io.File;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/SWTResourceManager.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/SWTResourceManager.java
index 0cf20cb0699..d0bf3bcaa18 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/SWTResourceManager.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/com/swtdesigner/SWTResourceManager.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package com.swtdesigner;
import java.io.FileInputStream;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/Activator.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/FacadeDefinitionEditorActivator.java
index c0efec8a88f..116954f3596 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/Activator.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/FacadeDefinitionEditorActivator.java
@@ -1,24 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends AbstractUIPlugin {
+public class FacadeDefinitionEditorActivator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.papyrus.FacadeSpecificEditor"; //$NON-NLS-1$
// The shared instance
- private static Activator plugin;
+ private static FacadeDefinitionEditorActivator plugin;
+
+ public static LogHelper log;
/**
* The constructor
*/
- public Activator() {
+ public FacadeDefinitionEditorActivator() {
}
/*
@@ -29,6 +45,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
@@ -46,7 +63,7 @@ public class Activator extends AbstractUIPlugin {
*
* @return the shared instance
*/
- public static Activator getDefault() {
+ public static FacadeDefinitionEditorActivator getDefault() {
return plugin;
}
@@ -54,7 +71,7 @@ public class Activator extends AbstractUIPlugin {
* Returns an image descriptor for the image file at the given plug-in relative path
*
* @param path
- * the path
+ * the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/FacadeSpecificEditor.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/FacadeSpecificEditor.java
index f7a2a84bd95..c839948ea50 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/FacadeSpecificEditor.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/FacadeSpecificEditor.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor;
import java.lang.reflect.InvocationTargetException;
@@ -41,7 +54,6 @@ import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinitionKind;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensiondefinitionFactory;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensiondefinitionPackage;
import org.eclipse.papyrus.facade.presentation.FacadeEditor;
-import org.eclipse.papyrus.facade.presentation.FacadeEditorPlugin;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetamodel;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelFactory;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelPackage;
@@ -51,6 +63,7 @@ import org.eclipse.papyrus.facadeSpecificEditor.editingSupport.IsPossibleColumnE
import org.eclipse.papyrus.facadeSpecificEditor.editingSupport.MetaclassAliasColumnEditingSupport;
import org.eclipse.papyrus.facadeSpecificEditor.editingSupport.MetaclassIsAbstractColumnEditingSupport;
import org.eclipse.papyrus.facadeSpecificEditor.editingSupport.MetaclassToKeepColumnEditingSupport;
+import org.eclipse.papyrus.facadeSpecificEditor.editingSupport.MetaclassUseRepresentedColumnEditingSupport;
import org.eclipse.papyrus.facadeSpecificEditor.editingSupport.PropertiesAliasColumnEdintingSupport;
import org.eclipse.papyrus.facadeSpecificEditor.editingSupport.PropertiesMaxColumnEdintingSupport;
import org.eclipse.papyrus.facadeSpecificEditor.editingSupport.PropertiesMinColumnEdintingSupport;
@@ -64,8 +77,8 @@ import org.eclipse.papyrus.facadeSpecificEditor.providers.IncompatibilitiesConte
import org.eclipse.papyrus.facadeSpecificEditor.providers.IncompatibilitiesLabelProvider;
import org.eclipse.papyrus.facadeSpecificEditor.providers.MetamodelContentProvider;
import org.eclipse.papyrus.facadeSpecificEditor.providers.MetamodelLabelProvider;
-import org.eclipse.papyrus.facadeSpecificEditor.providers.PropertiesContentProvider;
-import org.eclipse.papyrus.facadeSpecificEditor.providers.PropertiesLabelProvider;
+import org.eclipse.papyrus.facadeSpecificEditor.providers.TypedElementContentProvider;
+import org.eclipse.papyrus.facadeSpecificEditor.providers.TypedElementLabelProvider;
import org.eclipse.papyrus.facadeSpecificEditor.utils.ProfileUtils;
import org.eclipse.papyrus.facadeSpecificEditor.utils.StereotypeUtils;
import org.eclipse.papyrus.facadeSpecificEditor.utils.UMLModelUtils;
@@ -101,20 +114,30 @@ import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Stereotype;
+/**
+ * The Class Facade Definition Editor. It is mostly UI.
+ */
public class FacadeSpecificEditor extends FacadeEditor {
+ /** The facade under edition */
protected Facade facade;
- protected String[] filterExtInput = { "*.uml" };
-
+ /** The model resource of the facade */
protected Resource facadeModelResource;
+ /** The initialize button. */
protected Button initializeButton;
+ /** The profiles that are invloved in the facade. */
protected List<Profile> profileModels = new ArrayList<Profile>();
+ /** The resource set used to open UML profiles */
protected ResourceSet profileResourceSet = new ResourceSetImpl();
+
+ /**
+ * UI elements
+ */
protected Tree metamodelTree;
protected Tree extensionDefinitionTable;
@@ -127,9 +150,9 @@ public class FacadeSpecificEditor extends FacadeEditor {
protected static TreeViewer metamodelTreeViewer;
- protected TableViewer propertiesTableViewer;
+ protected TreeViewer propertiesTreeViewer;
- protected Table propertiesTable;
+ protected Tree propertiesTree;
protected TableViewer incompatibilitiesTableViewer;
@@ -149,26 +172,18 @@ public class FacadeSpecificEditor extends FacadeEditor {
protected Text nsURI;
- protected String getString(String key) {
- return FacadeEditorPlugin.INSTANCE.getString(key);
- }
-
- public static TreeViewer getExtensionDefintionTreeViewer() {
- return extensionDefintionTreeViewer;
- }
-
- public static TreeViewer getMetamodelTreeViewer() {
- return metamodelTreeViewer;
- }
+ /**
+ * @see org.eclipse.papyrus.facade.presentation.FacadeEditor#createModel()
+ *
+ */
public void createModel() {
- // super.createModel();
+
URI resourceURI = EditUIUtil.getURI(getEditorInput());
Exception exception = null;
facadeModelResource = null;
try {
// Load the resource through the editing domain.
- //
facadeModelResource = editingDomain.getResourceSet().getResource(resourceURI, true);
} catch (Exception e) {
exception = e;
@@ -197,7 +212,25 @@ public class FacadeSpecificEditor extends FacadeEditor {
}
/**
- * Helper method to clear the template of specific information
+ * Getter for the extensionDefintionTreeViewer widget
+ *
+ * @return the extensionDefintionTreeViewer widget
+ */
+ public static TreeViewer getExtensionDefintionTreeViewer() {
+ return extensionDefintionTreeViewer;
+ }
+
+ /**
+ * Getter for the metamodelTreeViewer widget
+ *
+ * @return the metamodelTreeViewer widget
+ */
+ public static TreeViewer getMetamodelTreeViewer() {
+ return metamodelTreeViewer;
+ }
+
+ /**
+ * Helper method to clear the facade.
*/
protected void clearModel() {
RemoveCommand commandMetaclasses = new RemoveCommand(editingDomain, facade, FacadePackage.eINSTANCE.getFacade_Virtualmetamodel(), facade.getVirtualmetamodel());
@@ -207,8 +240,12 @@ public class FacadeSpecificEditor extends FacadeEditor {
editingDomain.getCommandStack().execute(commandStereotype);
}
- protected class FacadeMetamodelInitializer extends MouseAdapter {
+ protected class FacadeInitializer extends MouseAdapter {
+
+ /**
+ * Open profiles to start the definition of the facade.
+ */
protected void openProfile() {
RegisteredProfile[] regProfiles = RegisteredProfile.getRegisteredProfiles();
ListSelectionDialog dlg = new ListSelectionDialog(Display.getCurrent().getActiveShell(), Arrays.asList(regProfiles), new IStructuredContentProvider() {
@@ -221,50 +258,57 @@ public class FacadeSpecificEditor extends FacadeEditor {
public Object[] getElements(Object inputElement) {
if(inputElement instanceof List) {
- return ((List)inputElement).toArray();
+ return ((List<?>)inputElement).toArray();
}
return Collections.emptyList().toArray();
}
- }, new ExtensionLabelProvider(), "Select the Profiles:");
- dlg.setTitle("Profile selection");
+ }, new ExtensionLabelProvider(), Messages.FacadeSpecificEditor_1);
+ dlg.setTitle(Messages.FacadeSpecificEditor_2);
dlg.open();
-
- for(Object selectedElement : dlg.getResult()) {
- if(selectedElement instanceof RegisteredProfile) {
- EObject model = UMLModelUtils.loadModel(((RegisteredProfile)selectedElement).uri, profileResourceSet);
- if(model instanceof Profile) {
- TreeIterator<EObject> it = model.eAllContents();
- boolean failed = false;
- while(it.hasNext() && !failed) {
- EObject eObject = (EObject)it.next();
- if(eObject instanceof PrimitiveType) {
- Stereotype stereotype = ((PrimitiveType)eObject).getAppliedStereotype("Ecore::EDataType");
- if(stereotype != null) {
- Object value = ((PrimitiveType)eObject).getValue(stereotype, "instanceClassName");
- if(!(value instanceof String)) {
+ if(dlg.getResult() != null) {
+
+ for(Object selectedElement : dlg.getResult()) {
+ if(selectedElement instanceof RegisteredProfile) {
+ EObject model = UMLModelUtils.loadModel(((RegisteredProfile)selectedElement).uri, profileResourceSet);
+ if(model instanceof Profile) {
+ TreeIterator<EObject> it = model.eAllContents();
+ boolean failed = false;
+ while(it.hasNext() && !failed) {
+ EObject eObject = (EObject)it.next();
+ if(eObject instanceof PrimitiveType) {
+ Stereotype stereotype = ((PrimitiveType)eObject).getAppliedStereotype("Ecore::EDataType"); //$NON-NLS-1$
+ if(stereotype != null) {
+ Object value = ((PrimitiveType)eObject).getValue(stereotype, "instanceClassName"); //$NON-NLS-1$
+ if(!(value instanceof String)) {
+ failed = true;
+ MessageDialog.openError(getContainer().getShell(), Messages.FacadeSpecificEditor_5, Messages.FacadeSpecificEditor_6 + ((PrimitiveType)eObject).getName() + Messages.FacadeSpecificEditor_7);
+ }
+ }
+ }
+ if(eObject instanceof Extension) {
+ if(((Extension)eObject).isRequired()) {
failed = true;
- MessageDialog.openError(getContainer().getShell(), "PrimitiveType issue", "PrimitiveType " + ((PrimitiveType)eObject).getName() + " must be stereotype with Ecore::EDataType and instanceTypeName must be specified");
+ MessageDialog.openError(getContainer().getShell(), Messages.FacadeSpecificEditor_8, Messages.FacadeSpecificEditor_9);
}
}
}
- if(eObject instanceof Extension) {
- if(((Extension)eObject).isRequired()) {
- failed = true;
- MessageDialog.openError(getContainer().getShell(), "Required extension issue", "Required extension are not suppported yet.");
- }
+ if(!failed) {
+ profileModels.add((Profile)model);
}
+ } else {
+ MessageDialog.openError(getContainer().getShell(), Messages.FacadeSpecificEditor_10, Messages.FacadeSpecificEditor_11);
}
- if(!failed) {
- profileModels.add((Profile)model);
- }
- } else {
- MessageDialog.openError(getContainer().getShell(), "Open a real Profile", "The model you open is not a profile");
}
}
-
}
}
+ /**
+ * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
+ *
+ * @param e
+ */
+
public void mouseUp(MouseEvent e) {
profileModels.clear();
@@ -272,19 +316,14 @@ public class FacadeSpecificEditor extends FacadeEditor {
openProfile();
if(!profileModels.isEmpty()) {
- // while(MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Open another one", "Should we open another profile")) {
- // openProfile();
- // }
clearModel();
ProfileUtils.clearSiblings();
VirtualMetamodel virtualMetamodel = VirtualmetamodelFactory.eINSTANCE.createVirtualMetamodel();
- virtualMetamodel.setName("");
- virtualMetamodel.setNsPrefix("");
- virtualMetamodel.setNsURI("");
-
- // facade.setVirtualmetamodel(virtualMetamodel);
+ virtualMetamodel.setName(""); //$NON-NLS-1$
+ virtualMetamodel.setNsPrefix(""); //$NON-NLS-1$
+ virtualMetamodel.setNsURI(""); //$NON-NLS-1$
SetCommand command = new SetCommand(editingDomain, facade, FacadePackage.eINSTANCE.getFacade_Virtualmetamodel(), virtualMetamodel);
editingDomain.getCommandStack().execute(command);
@@ -298,13 +337,16 @@ public class FacadeSpecificEditor extends FacadeEditor {
}
}
+ /**
+ * Creates the extension definitions from the selected UML profiles
+ */
protected void createExtensionDefinitions() {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
try {
dialog.run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
- monitor.beginTask("Load profile", IProgressMonitor.UNKNOWN);
+ monitor.beginTask(Messages.FacadeSpecificEditor_15, IProgressMonitor.UNKNOWN);
// Find all extensions be it in the profile or in another profile
Set<Extension> extensions = new HashSet<Extension>();
@@ -339,22 +381,6 @@ public class FacadeSpecificEditor extends FacadeEditor {
ProfileUtils.initSiblings(stereotype);
- // if (!stereotype.isAbstract()) {
-
- // EList<Classifier> generalsAndI = stereotype.getGenerals();
- // // generalsAndI.add(stereotype);
- // boolean oneParentIsAbstract = false;
- // for (int i = 0; i < generalsAndI.size() && !oneParentIsAbstract; i++) {
- // Classifier general = generalsAndI.get(i);
- // if (general.isAbstract()) {
- // oneParentIsAbstract = true;
- // }
- // }
- //
- // if (!oneParentIsAbstract) {
-
- // if (!extension.isRequired()) {
-
List<EClass> baseMetaclasses = StereotypeUtils.getAllExtendableMetaclasses(extension, false);
for(EClass eClass : baseMetaclasses) {
@@ -365,10 +391,6 @@ public class FacadeSpecificEditor extends FacadeEditor {
AddCommand command2 = new AddCommand(editingDomain, extensionDefinition, ExtensiondefinitionPackage.eINSTANCE.getExtensionDefinition_BaseMetaclasses(), baseMetaclass);
editingDomain.getCommandStack().execute(command2);
}
- // }
- // }
-
- // }
}
}
@@ -389,20 +411,22 @@ public class FacadeSpecificEditor extends FacadeEditor {
}
+ /**
+ * @see org.eclipse.papyrus.facade.presentation.FacadeEditor#createPages()
+ *
+ */
public void createPages() {
// Creates the model from the editor input
- //
createModel();
// Only creates the other pages if there is something that can be edited
- //
if(!getEditingDomain().getResourceSet().getResources().isEmpty()) {
Composite composite = new Composite(getContainer(), SWT.NONE);
composite.setLayout(new GridLayout(1, true));
initializeButton = new Button(composite, SWT.PUSH);
- initializeButton.setText("Open Profile");
- initializeButton.addMouseListener(new FacadeMetamodelInitializer());
+ initializeButton.setText(Messages.FacadeSpecificEditor_16);
+ initializeButton.addMouseListener(new FacadeInitializer());
tabFolder = new TabFolder(composite, SWT.BORDER);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
@@ -410,17 +434,17 @@ public class FacadeSpecificEditor extends FacadeEditor {
tabFolder.setLayout(new GridLayout(1, true));
TabItem clarifyExtensionsTabItem = new TabItem(tabFolder, SWT.NONE);
- clarifyExtensionsTabItem.setText("Clarify extensions");
+ clarifyExtensionsTabItem.setText(Messages.FacadeSpecificEditor_17);
createClarifyExtension(tabFolder, clarifyExtensionsTabItem);
TabItem designMetamodelTabItem = new TabItem(tabFolder, SWT.NONE);
- designMetamodelTabItem.setText("Define metamodel");
+ designMetamodelTabItem.setText(Messages.FacadeSpecificEditor_18);
createDesignMetamodel(tabFolder, designMetamodelTabItem);
TabItem generateMetamodelTabItem = new TabItem(tabFolder, SWT.NONE);
- generateMetamodelTabItem.setText("Create actual metamodel");
+ generateMetamodelTabItem.setText(Messages.FacadeSpecificEditor_19);
createGenerateEcore(tabFolder, generateMetamodelTabItem);
@@ -434,26 +458,16 @@ public class FacadeSpecificEditor extends FacadeEditor {
}
});
- int pageIndex = addPage(composite);
- setPageText(pageIndex, getString("_UI_SelectionPage_label"));
-
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- setActivePage(0);
- }
- });
-
+ addPage(composite);
+ setActivePage(0);
}
// Ensures that this editor will only display the page's tab
// area if there are more than one page
- //
getContainer().addControlListener(new ControlAdapter() {
boolean guard = false;
-
public void controlResized(ControlEvent event) {
if(!guard) {
guard = true;
@@ -471,6 +485,14 @@ public class FacadeSpecificEditor extends FacadeEditor {
});
}
+ /**
+ * Creates the tab corresponding to the generation of the actual ECore metamodel
+ *
+ * @param tabFolder
+ * the tab folder
+ * @param generateMetamodelTabItem
+ * the generate metamodel tab item
+ */
protected void createGenerateEcore(Composite tabFolder, TabItem generateMetamodelTabItem) {
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
Composite composite = new Composite(tabFolder, SWT.NONE);
@@ -478,19 +500,18 @@ public class FacadeSpecificEditor extends FacadeEditor {
composite.setLayout(new GridLayout(1, true));
Label metamodelNameLabel = new Label(composite, SWT.NONE);
- metamodelNameLabel.setText("Name: ");
+ metamodelNameLabel.setText(Messages.FacadeSpecificEditor_21);
metamodelName = new Text(composite, SWT.BORDER);
metamodelName.setLayoutData(layoutData);
if(facade.getVirtualmetamodel() != null) {
if(facade.getVirtualmetamodel().getName() != null) {
metamodelName.setText(facade.getVirtualmetamodel().getName());
} else {
- metamodelName.setText("");
+ metamodelName.setText(""); //$NON-NLS-1$
}
}
metamodelName.addModifyListener(new ModifyListener() {
-
public void modifyText(ModifyEvent e) {
SetCommand commandName = new SetCommand(editingDomain, facade.getVirtualmetamodel(), VirtualmetamodelPackage.eINSTANCE.getVirtualMetamodel_Name(), metamodelName.getText());
editingDomain.getCommandStack().execute(commandName);
@@ -498,19 +519,18 @@ public class FacadeSpecificEditor extends FacadeEditor {
});
Label nsPrefixLabel = new Label(composite, SWT.NONE);
- nsPrefixLabel.setText("NSPrefix: ");
+ nsPrefixLabel.setText(Messages.FacadeSpecificEditor_23);
nsPrefix = new Text(composite, SWT.BORDER);
nsPrefix.setLayoutData(layoutData);
if(facade.getVirtualmetamodel() != null) {
if(facade.getVirtualmetamodel().getNsPrefix() != null) {
nsPrefix.setText(facade.getVirtualmetamodel().getNsPrefix());
} else {
- nsPrefix.setText("");
+ nsPrefix.setText(""); //$NON-NLS-1$
}
}
nsPrefix.addModifyListener(new ModifyListener() {
-
public void modifyText(ModifyEvent e) {
SetCommand commandName = new SetCommand(editingDomain, facade.getVirtualmetamodel(), VirtualmetamodelPackage.eINSTANCE.getVirtualMetamodel_NsPrefix(), nsPrefix.getText());
editingDomain.getCommandStack().execute(commandName);
@@ -519,19 +539,18 @@ public class FacadeSpecificEditor extends FacadeEditor {
});
Label nsURILabel = new Label(composite, SWT.NONE);
- nsURILabel.setText("NSURI: ");
+ nsURILabel.setText(Messages.FacadeSpecificEditor_25);
nsURI = new Text(composite, SWT.BORDER);
nsURI.setLayoutData(layoutData);
if(facade.getVirtualmetamodel() != null) {
if(facade.getVirtualmetamodel().getNsURI() != null) {
nsURI.setText(facade.getVirtualmetamodel().getNsURI());
} else {
- nsURI.setText("");
+ nsURI.setText(""); //$NON-NLS-1$
}
}
nsURI.addModifyListener(new ModifyListener() {
-
public void modifyText(ModifyEvent e) {
SetCommand commandName = new SetCommand(editingDomain, facade.getVirtualmetamodel(), VirtualmetamodelPackage.eINSTANCE.getVirtualMetamodel_NsURI(), nsURI.getText());
editingDomain.getCommandStack().execute(commandName);
@@ -540,15 +559,20 @@ public class FacadeSpecificEditor extends FacadeEditor {
});
createEcoreButton = new Button(composite, SWT.NONE);
- createEcoreButton.setText("Generate Ecore metamodel and mapping");
+ createEcoreButton.setText(Messages.FacadeSpecificEditor_27);
createEcoreButton.addMouseListener(new EcoreGenerator(facade, editingDomain));
-
- // createGlueButton.addMouseListener(new GlueGenerator(facade));
-
generateMetamodelTabItem.setControl(composite);
}
+ /**
+ * Creates the tab used to define the wanted facade metamodel.
+ *
+ * @param tabFolder
+ * the tab folder
+ * @param designMetamodelTabItem
+ * the design metamodel tab item
+ */
protected void createDesignMetamodel(Composite tabFolder, TabItem designMetamodelTabItem) {
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
@@ -557,7 +581,7 @@ public class FacadeSpecificEditor extends FacadeEditor {
composite.setLayout(new GridLayout(1, true));
createMetamodelButton = new Button(composite, SWT.NONE);
- createMetamodelButton.setText("Create preliminary metamodel");
+ createMetamodelButton.setText(Messages.FacadeSpecificEditor_28);
createMetamodelButton.addMouseListener(new CreatePreliminaryMetamodelListener(facade, editingDomain));
SashForm sashFormMetamodel = new SashForm(composite, SWT.VERTICAL);
@@ -574,84 +598,97 @@ public class FacadeSpecificEditor extends FacadeEditor {
TreeViewerColumn metaclassTreeViewerColumn = new TreeViewerColumn(metamodelTreeViewer, SWT.NONE);
TreeColumn metaclassTreeColumn = metaclassTreeViewerColumn.getColumn();
metaclassTreeColumn.setWidth(300);
- metaclassTreeColumn.setText("Metaclass name");
+ metaclassTreeColumn.setText(Messages.FacadeSpecificEditor_29);
TreeViewerColumn metaclassToKeepTreeViewerColumn = new TreeViewerColumn(metamodelTreeViewer, SWT.NONE);
TreeColumn metaclassToKeepTreeColumn = metaclassToKeepTreeViewerColumn.getColumn();
metaclassToKeepTreeColumn.setWidth(60);
- metaclassToKeepTreeColumn.setText("To keep");
+ metaclassToKeepTreeColumn.setText(Messages.FacadeSpecificEditor_30);
metaclassToKeepTreeViewerColumn.setEditingSupport(new MetaclassToKeepColumnEditingSupport(metamodelTreeViewer, editingDomain, metamodelTree, facade));
TreeViewerColumn metaclassAliasTreeViewerColumn = new TreeViewerColumn(metamodelTreeViewer, SWT.NONE);
TreeColumn metaclassAliasTreeColumn = metaclassAliasTreeViewerColumn.getColumn();
metaclassAliasTreeColumn.setWidth(300);
- metaclassAliasTreeColumn.setText("Alias");
+ metaclassAliasTreeColumn.setText(Messages.FacadeSpecificEditor_31);
metaclassAliasTreeViewerColumn.setEditingSupport(new MetaclassAliasColumnEditingSupport(metamodelTreeViewer, editingDomain, metamodelTree));
TreeViewerColumn metaclassIsAbstractTreeViewerColumn = new TreeViewerColumn(metamodelTreeViewer, SWT.NONE);
TreeColumn metaclassIsAbstractTreeColumn = metaclassIsAbstractTreeViewerColumn.getColumn();
metaclassIsAbstractTreeColumn.setWidth(100);
- metaclassIsAbstractTreeColumn.setText("Make it abstract");
+ metaclassIsAbstractTreeColumn.setText(Messages.FacadeSpecificEditor_32);
metaclassIsAbstractTreeViewerColumn.setEditingSupport(new MetaclassIsAbstractColumnEditingSupport(metamodelTreeViewer, editingDomain, metamodelTree));
+ TreeViewerColumn metaclassUseRepresentedTreeViewerColumn = new TreeViewerColumn(metamodelTreeViewer, SWT.NONE);
+ TreeColumn metaclassUseRepresentedTreeColumn = metaclassUseRepresentedTreeViewerColumn.getColumn();
+ metaclassUseRepresentedTreeColumn.setWidth(100);
+ metaclassUseRepresentedTreeColumn.setText(Messages.FacadeSpecificEditor_0);
+ metaclassUseRepresentedTreeViewerColumn.setEditingSupport(new MetaclassUseRepresentedColumnEditingSupport(metamodelTreeViewer, editingDomain, metamodelTree));
+
metamodelTreeViewer.setContentProvider(new MetamodelContentProvider());
metamodelTreeViewer.setLabelProvider(new MetamodelLabelProvider());
metamodelTreeViewer.setInput(facade);
metamodelTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
public void selectionChanged(SelectionChangedEvent event) {
if(event.getSelection() instanceof IStructuredSelection) {
Object first = ((IStructuredSelection)event.getSelection()).getFirstElement();
- propertiesTableViewer.setInput(first);
- propertiesTableViewer.refresh();
+ propertiesTreeViewer.setInput(first);
+ propertiesTreeViewer.refresh();
}
}
});
- propertiesTableViewer = new TableViewer(sashFormMetamodel, SWT.BORDER | SWT.FULL_SELECTION);
- propertiesTableViewer.getControl().setLayoutData(layoutData);
- propertiesTable = propertiesTableViewer.getTable();
- propertiesTable.setHeaderVisible(true);
+ propertiesTreeViewer = new TreeViewer(sashFormMetamodel, SWT.BORDER | SWT.FULL_SELECTION);
+ propertiesTreeViewer.getControl().setLayoutData(layoutData);
+ propertiesTree = propertiesTreeViewer.getTree();
+ propertiesTree.setHeaderVisible(true);
- TableViewerColumn propertiesTableViewerColumn = new TableViewerColumn(propertiesTableViewer, SWT.NONE);
- TableColumn propertiesTableColumn = propertiesTableViewerColumn.getColumn();
+ TreeViewerColumn propertiesTableViewerColumn = new TreeViewerColumn(propertiesTreeViewer, SWT.NONE);
+ TreeColumn propertiesTableColumn = propertiesTableViewerColumn.getColumn();
propertiesTableColumn.setWidth(200);
- propertiesTableColumn.setText("Feature name");
+ propertiesTableColumn.setText(Messages.FacadeSpecificEditor_33);
- TableViewerColumn propertiesToKeepTableViewerColumn = new TableViewerColumn(propertiesTableViewer, SWT.NONE);
- TableColumn propertiesToKeepTableColumn = propertiesToKeepTableViewerColumn.getColumn();
+ TreeViewerColumn propertiesToKeepTableViewerColumn = new TreeViewerColumn(propertiesTreeViewer, SWT.NONE);
+ TreeColumn propertiesToKeepTableColumn = propertiesToKeepTableViewerColumn.getColumn();
propertiesToKeepTableColumn.setWidth(60);
- propertiesToKeepTableColumn.setText("To keep");
- propertiesToKeepTableViewerColumn.setEditingSupport(new PropertiesToKeepColumnEditingSupport(propertiesTableViewer, editingDomain, propertiesTable));
+ propertiesToKeepTableColumn.setText(Messages.FacadeSpecificEditor_34);
+ propertiesToKeepTableViewerColumn.setEditingSupport(new PropertiesToKeepColumnEditingSupport(propertiesTreeViewer, editingDomain, propertiesTree));
- TableViewerColumn propertiesAliasTableViewerColumn = new TableViewerColumn(propertiesTableViewer, SWT.NONE);
- TableColumn propertiesAliasTreeColumn = propertiesAliasTableViewerColumn.getColumn();
+ TreeViewerColumn propertiesAliasTableViewerColumn = new TreeViewerColumn(propertiesTreeViewer, SWT.NONE);
+ TreeColumn propertiesAliasTreeColumn = propertiesAliasTableViewerColumn.getColumn();
propertiesAliasTreeColumn.setWidth(200);
- propertiesAliasTreeColumn.setText("Alias");
- propertiesAliasTableViewerColumn.setEditingSupport(new PropertiesAliasColumnEdintingSupport(propertiesTableViewer, editingDomain, propertiesTable));
+ propertiesAliasTreeColumn.setText(Messages.FacadeSpecificEditor_35);
+ propertiesAliasTableViewerColumn.setEditingSupport(new PropertiesAliasColumnEdintingSupport(propertiesTreeViewer, editingDomain, propertiesTree));
- TableViewerColumn propertiesMinTableViewerColumn = new TableViewerColumn(propertiesTableViewer, SWT.NONE);
- TableColumn propertiesMinTreeColumn = propertiesMinTableViewerColumn.getColumn();
+ TreeViewerColumn propertiesMinTableViewerColumn = new TreeViewerColumn(propertiesTreeViewer, SWT.NONE);
+ TreeColumn propertiesMinTreeColumn = propertiesMinTableViewerColumn.getColumn();
propertiesMinTreeColumn.setWidth(50);
- propertiesMinTreeColumn.setText("Min");
- propertiesMinTableViewerColumn.setEditingSupport(new PropertiesMinColumnEdintingSupport(propertiesTableViewer, editingDomain, propertiesTable));
+ propertiesMinTreeColumn.setText(Messages.FacadeSpecificEditor_36);
+ propertiesMinTableViewerColumn.setEditingSupport(new PropertiesMinColumnEdintingSupport(propertiesTreeViewer, editingDomain, propertiesTree));
- TableViewerColumn propertiesMaxTableViewerColumn = new TableViewerColumn(propertiesTableViewer, SWT.NONE);
- TableColumn propertiesMaxTreeColumn = propertiesMaxTableViewerColumn.getColumn();
+ TreeViewerColumn propertiesMaxTableViewerColumn = new TreeViewerColumn(propertiesTreeViewer, SWT.NONE);
+ TreeColumn propertiesMaxTreeColumn = propertiesMaxTableViewerColumn.getColumn();
propertiesMaxTreeColumn.setWidth(50);
- propertiesMaxTreeColumn.setText("Max");
- propertiesMaxTableViewerColumn.setEditingSupport(new PropertiesMaxColumnEdintingSupport(propertiesTableViewer, editingDomain, propertiesTable));
+ propertiesMaxTreeColumn.setText(Messages.FacadeSpecificEditor_37);
+ propertiesMaxTableViewerColumn.setEditingSupport(new PropertiesMaxColumnEdintingSupport(propertiesTreeViewer, editingDomain, propertiesTree));
- propertiesTableViewer.setContentProvider(new PropertiesContentProvider());
- propertiesTableViewer.setLabelProvider(new PropertiesLabelProvider());
+ propertiesTreeViewer.setContentProvider(new TypedElementContentProvider());
+ propertiesTreeViewer.setLabelProvider(new TypedElementLabelProvider());
designMetamodelTabItem.setControl(composite);
}
+ /**
+ * Creates the tab used to clarify extensions identified in the UML profiles
+ *
+ * @param tabFolder
+ * the tab folder
+ * @param clarifyExtensionsTabItem
+ * the clarify extensions tab item
+ */
protected void createClarifyExtension(Composite tabFolder, TabItem clarifyExtensionsTabItem) {
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
@@ -669,18 +706,18 @@ public class FacadeSpecificEditor extends FacadeEditor {
TreeViewerColumn extensionDefinitionTableViewerColumn = new TreeViewerColumn(extensionDefintionTreeViewer, SWT.NONE);
TreeColumn extensionDefinitionTableColumn = extensionDefinitionTableViewerColumn.getColumn();
extensionDefinitionTableColumn.setWidth(300);
- extensionDefinitionTableColumn.setText("Stereotype name");
+ extensionDefinitionTableColumn.setText(Messages.FacadeSpecificEditor_38);
TreeViewerColumn extensionKindTableViewerColumn = new TreeViewerColumn(extensionDefintionTreeViewer, SWT.NONE);
TreeColumn extensionKindTableColumn = extensionKindTableViewerColumn.getColumn();
extensionKindTableColumn.setWidth(150);
- extensionKindTableColumn.setText("Kind");
+ extensionKindTableColumn.setText(Messages.FacadeSpecificEditor_39);
extensionKindTableViewerColumn.setEditingSupport(new ExtensionKindColumnEditingSupport(extensionDefintionTreeViewer, editingDomain, extensionDefinitionTable));
TreeViewerColumn isPossibleTableViewerColumn = new TreeViewerColumn(extensionDefintionTreeViewer, SWT.NONE);
TreeColumn isPossibleTableColumn = isPossibleTableViewerColumn.getColumn();
isPossibleTableColumn.setWidth(200);
- isPossibleTableColumn.setText("Applicable on this metaclass");
+ isPossibleTableColumn.setText(Messages.FacadeSpecificEditor_40);
isPossibleTableViewerColumn.setEditingSupport(new IsPossibleColumnEditingSupport(extensionDefintionTreeViewer, editingDomain, extensionDefinitionTable));
extensionDefintionTreeViewer.setContentProvider(new ExtensionDefintionContentProvider());
@@ -689,7 +726,6 @@ public class FacadeSpecificEditor extends FacadeEditor {
extensionDefintionTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
public void selectionChanged(SelectionChangedEvent event) {
if(event.getSelection() instanceof IStructuredSelection) {
Object first = ((IStructuredSelection)event.getSelection()).getFirstElement();
@@ -708,12 +744,12 @@ public class FacadeSpecificEditor extends FacadeEditor {
TableViewerColumn stereoTableViewerColumn = new TableViewerColumn(incompatibilitiesTableViewer, SWT.NONE);
TableColumn stereoTableColumn = stereoTableViewerColumn.getColumn();
stereoTableColumn.setWidth(300);
- stereoTableColumn.setText("Stereotype");
+ stereoTableColumn.setText(Messages.FacadeSpecificEditor_41);
TableViewerColumn stereoIncompatibilityTableViewerColumn = new TableViewerColumn(incompatibilitiesTableViewer, SWT.NONE);
TableColumn stereoIncompatibilityTableColumn = stereoIncompatibilityTableViewerColumn.getColumn();
stereoIncompatibilityTableColumn.setWidth(150);
- stereoIncompatibilityTableColumn.setText("Is compatible combination");
+ stereoIncompatibilityTableColumn.setText(Messages.FacadeSpecificEditor_42);
stereoIncompatibilityTableViewerColumn.setEditingSupport(new StereotypeIncompatibilityColumnEditingSupport(incompatibilitiesTableViewer, editingDomain, incompatibilitiesTable));
incompatibilitiesTableViewer.setContentProvider(new IncompatibilitiesContentProvider());
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/Messages.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/Messages.java
new file mode 100644
index 00000000000..5547489cab5
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/Messages.java
@@ -0,0 +1,258 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.facadeSpecificEditor;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.facadeSpecificEditor.messages"; //$NON-NLS-1$
+
+ public static String EcoreGenerator_10;
+
+ public static String EcoreGenerator_11;
+
+ public static String EcoreGenerator_12;
+
+ public static String EcoreGenerator_13;
+
+ public static String EcoreGenerator_14;
+
+ public static String EcoreGenerator_15;
+
+ public static String EcoreGenerator_16;
+
+ public static String EcoreGenerator_17;
+
+ public static String EcoreGenerator_18;
+
+ public static String EcoreGenerator_19;
+
+ public static String EcoreGenerator_20;
+
+ public static String EcoreGenerator_21;
+
+ public static String EcoreGenerator_22;
+
+ public static String EcoreGenerator_23;
+
+ public static String EcoreGenerator_24;
+
+ public static String EcoreGenerator_25;
+
+ public static String EcoreGenerator_26;
+
+ public static String EcoreGenerator_27;
+
+ public static String EcoreGenerator_3;
+
+ public static String EcoreGenerator_30;
+
+ public static String EcoreGenerator_31;
+
+ public static String EcoreGenerator_35;
+
+ public static String EcoreGenerator_36;
+
+ public static String EcoreGenerator_37;
+
+ public static String EcoreGenerator_4;
+
+ public static String EcoreGenerator_40;
+
+ public static String EcoreGenerator_41;
+
+ public static String EcoreGenerator_42;
+
+ public static String EcoreGenerator_43;
+
+ public static String EcoreGenerator_44;
+
+ public static String EcoreGenerator_45;
+
+ public static String EcoreGenerator_5;
+
+ public static String EcoreGenerator_6;
+
+ public static String EcoreGenerator_9;
+
+ public static String ExtensionDefintionLabelProvider_13;
+
+ public static String ExtensionKindColumnEditingSupport_0;
+
+ public static String ExtensionKindColumnEditingSupport_1;
+
+ public static String ExtensionKindColumnEditingSupport_2;
+
+ public static String ExtensionKindColumnEditingSupport_3;
+
+ public static String ExtensionKindColumnEditingSupport_4;
+
+ public static String ExtensionKindColumnEditingSupport_5;
+
+ public static String ExtensionKindColumnEditingSupport_6;
+
+ public static String ExtensionKindColumnEditingSupport_7;
+
+ public static String ExtensionKindColumnEditingSupport_8;
+
+ public static String FacadeSpecificEditor_0;
+
+ public static String FacadeSpecificEditor_1;
+
+ public static String FacadeSpecificEditor_10;
+
+ public static String FacadeSpecificEditor_11;
+
+ public static String FacadeSpecificEditor_15;
+
+ public static String FacadeSpecificEditor_16;
+
+ public static String FacadeSpecificEditor_17;
+
+ public static String FacadeSpecificEditor_18;
+
+ public static String FacadeSpecificEditor_19;
+
+ public static String FacadeSpecificEditor_2;
+
+ public static String FacadeSpecificEditor_21;
+
+ public static String FacadeSpecificEditor_23;
+
+ public static String FacadeSpecificEditor_25;
+
+ public static String FacadeSpecificEditor_27;
+
+ public static String FacadeSpecificEditor_28;
+
+ public static String FacadeSpecificEditor_29;
+
+ public static String FacadeSpecificEditor_30;
+
+ public static String FacadeSpecificEditor_31;
+
+ public static String FacadeSpecificEditor_32;
+
+ public static String FacadeSpecificEditor_33;
+
+ public static String FacadeSpecificEditor_34;
+
+ public static String FacadeSpecificEditor_35;
+
+ public static String FacadeSpecificEditor_36;
+
+ public static String FacadeSpecificEditor_37;
+
+ public static String FacadeSpecificEditor_38;
+
+ public static String FacadeSpecificEditor_39;
+
+ public static String FacadeSpecificEditor_40;
+
+ public static String FacadeSpecificEditor_41;
+
+ public static String FacadeSpecificEditor_42;
+
+ public static String FacadeSpecificEditor_5;
+
+ public static String FacadeSpecificEditor_6;
+
+ public static String FacadeSpecificEditor_7;
+
+ public static String FacadeSpecificEditor_8;
+
+ public static String FacadeSpecificEditor_9;
+
+ public static String IsPossibleColumnEditingSupport_0;
+
+ public static String IsPossibleColumnEditingSupport_1;
+
+ public static String IsPossibleColumnEditingSupport_2;
+
+ public static String MetamodelLabelProvider_8;
+
+ public static String MetamodelUtils_0;
+
+ public static String MetamodelUtils_1;
+
+ public static String MetamodelUtils_10;
+
+ public static String MetamodelUtils_11;
+
+ public static String MetamodelUtils_12;
+
+ public static String MetamodelUtils_13;
+
+ public static String MetamodelUtils_2;
+
+ public static String MetamodelUtils_3;
+
+ public static String MetamodelUtils_4;
+
+ public static String MetamodelUtils_5;
+
+ public static String MetamodelUtils_6;
+
+ public static String MetamodelUtils_7;
+
+ public static String MetamodelUtils_8;
+
+ public static String MetamodelUtils_9;
+
+ public static String PropertiesMaxColumnEdintingSupport_0;
+
+ public static String PropertiesMaxColumnEdintingSupport_1;
+
+ public static String PropertiesMaxColumnEdintingSupport_2;
+
+ public static String PropertiesMaxColumnEdintingSupport_3;
+
+ public static String PropertiesMaxColumnEdintingSupport_4;
+
+ public static String PropertiesMaxColumnEdintingSupport_5;
+
+ public static String PropertiesMinColumnEdintingSupport_0;
+
+ public static String PropertiesMinColumnEdintingSupport_1;
+
+ public static String PropertiesMinColumnEdintingSupport_2;
+
+ public static String PropertiesMinColumnEdintingSupport_3;
+
+ public static String PropertiesMinColumnEdintingSupport_4;
+
+ public static String PropertiesMinColumnEdintingSupport_5;
+
+ public static String PropertiesToKeepColumnEditingSupport_0;
+
+ public static String PropertiesToKeepColumnEditingSupport_1;
+
+ public static String PropertiesToKeepColumnEditingSupport_2;
+
+ public static String PropertiesToKeepColumnEditingSupport_3;
+
+ public static String StereotypeIncompatibilityColumnEditingSupport_0;
+
+ public static String StereotypeIncompatibilityColumnEditingSupport_1;
+
+ public static String StereotypeIncompatibilityColumnEditingSupport_2;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/EditionUtils.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/EditionUtils.java
index 82d88231155..c25fc8a125a 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/EditionUtils.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/EditionUtils.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
import java.util.ArrayList;
@@ -14,9 +27,17 @@ import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinitionKind;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensiondefinitionPackage;
import org.eclipse.papyrus.facadeSpecificEditor.utils.ProfileUtils;
-
public class EditionUtils {
+ /**
+ * Check is a combination of stereotypes appears in a list (independently from the order of the combination)
+ *
+ * @param list
+ * the list to search in
+ * @param combinaison
+ * the combination to find
+ * @return
+ */
public static boolean containsCombination(List<Combination> list, Combination combinaison) {
for(Combination item : list) {
if(item.getMembers().size() == combinaison.getMembers().size()) {
@@ -30,6 +51,15 @@ public class EditionUtils {
}
+ /**
+ * Find a combination of stereotypes appears in a list of combination (independently from the order of the combination)
+ *
+ * @param list
+ * the list to search in
+ * @param combinaison
+ * the combination to find
+ * @return
+ */
public static Combination getCombinationThatMatch(List<Combination> list, Combination combinaison) {
for(Combination item : list) {
if(item.getMembers().size() == combinaison.getMembers().size()) {
@@ -43,6 +73,13 @@ public class EditionUtils {
}
+ /**
+ * Generate the stereotype combinations for the facade
+ *
+ * @param facade
+ * the facade to generate the combinations for
+ * @param editingDomain
+ */
public static void initAllStereotypeCombinations(Facade facade, AdapterFactoryEditingDomain editingDomain) {
for(ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
@@ -62,60 +99,26 @@ public class EditionUtils {
}
for(Combination combination : toAdd) {
- // if (baseMeta.getExtensionDefinition().getExtension().isRequired()) {
- // if (combination.getMetaClasses().size() == 1) {
- // if (combination.getMetaClasses().get(0).isPossible()) {
- // AddCommand addIncompatibilitiesCommand = new AddCommand(editingDomain, baseMeta, FacadeMetamodelPackage.eINSTANCE.getBaseMetaclass_CompatibleStereotypes(), combination);
- // editingDomain.getCommandStack().execute(addIncompatibilitiesCommand);
- // } else {
- // AddCommand addIncompatibilitiesCommand = new AddCommand(editingDomain, baseMeta, FacadeMetamodelPackage.eINSTANCE.getBaseMetaclass_IncompatibleStereotypes(), combination);
- // editingDomain.getCommandStack().execute(addIncompatibilitiesCommand);
- // }
- // } else {
- // AddCommand addIncompatibilitiesCommand = new AddCommand(editingDomain, baseMeta, FacadeMetamodelPackage.eINSTANCE.getBaseMetaclass_IncompatibleStereotypes(), combination);
- // editingDomain.getCommandStack().execute(addIncompatibilitiesCommand);
- // }
- // } else {
- // if (containsOnlyRequired(combination)) {
- // AddCommand addIncompatibilitiesCommand = new AddCommand(editingDomain, baseMeta, FacadeMetamodelPackage.eINSTANCE.getBaseMetaclass_CompatibleStereotypes(), combination);
- // editingDomain.getCommandStack().execute(addIncompatibilitiesCommand);
- // } else {
+
AddCommand addIncompatibilitiesCommand = new AddCommand(editingDomain, baseMeta, ExtensiondefinitionPackage.eINSTANCE.getBaseMetaclass_IncompatibleStereotypes(), combination);
editingDomain.getCommandStack().execute(addIncompatibilitiesCommand);
- // }
- // }
}
-
- // if (baseMeta.isPossible()) {
- // // if (baseMeta.getExtensionDefinition().getExtension().isRequired()) {
- // AddCommand addIncompatibilitiesCommand = new AddCommand(editingDomain, baseMeta, FacadeMetamodelPackage.eINSTANCE.getBaseMetaclass_CompatibleStereotypes(), toAdd);
- // editingDomain.getCommandStack().execute(addIncompatibilitiesCommand);
- // // }
- // } else {
- // AddCommand addIncompatibilitiesCommand = new AddCommand(editingDomain, baseMeta, FacadeMetamodelPackage.eINSTANCE.getBaseMetaclass_IncompatibleStereotypes(), toAdd);
- // editingDomain.getCommandStack().execute(addIncompatibilitiesCommand);
- // }
-
}
}
}
+ /**
+ * Remove the stereotype combinations from the facade
+ *
+ * @param facade
+ * @param editingDomain
+ */
public static void clearAllStereotypeCombinations(Facade facade, AdapterFactoryEditingDomain editingDomain) {
for(ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
for(BaseMetaclass baseMeta : extensionDefinition.getBaseMetaclasses()) {
List<Combination> possibleCombinations = ProfileUtils.getPossibleCombinations(baseMeta);
- // System.err.println("For : " + baseMeta.getExtensionDefinition().getStereotype().getName());
- // for (Combination combination : possibleCombinations) {
- // System.err.print("\t");
- // for (BaseMetaclass metaclass : combination.getMetaClasses()) {
- // System.err.print(metaclass.getExtensionDefinition().getStereotype().getName() + ", ");
- // }
- // System.err.println();
- //
- // }
-
List<Combination> incompatibilitiesToRemove = new ArrayList<Combination>();
for(Combination incompatibleBase : baseMeta.getIncompatibleStereotypes()) {
@@ -141,6 +144,12 @@ public class EditionUtils {
}
}
+ /**
+ * Check whether the baseMetaclass has a combination that is required
+ *
+ * @param baseMeta
+ * @return
+ */
public static boolean hasARequiredCombination(BaseMetaclass baseMeta) {
List<Combination> combinaisonsToCheck = new ArrayList<Combination>();
@@ -161,6 +170,12 @@ public class EditionUtils {
}
+ /**
+ * Initialize the isPossible of all the extension definitions of a Facade
+ *
+ * @param facade
+ * @param editingDomain
+ */
public static void initIsPossible(Facade facade, AdapterFactoryEditingDomain editingDomain) {
for(ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
for(BaseMetaclass baseMeta : extensionDefinition.getBaseMetaclasses()) {
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/ExtensionKindColumnEditingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/ExtensionKindColumnEditingSupport.java
index c6137f888ac..32eee41119c 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/ExtensionKindColumnEditingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/ExtensionKindColumnEditingSupport.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
import java.lang.reflect.InvocationTargetException;
@@ -18,6 +31,7 @@ import org.eclipse.papyrus.facade.Facade;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinition;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinitionKind;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensiondefinitionPackage;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.papyrus.facadeSpecificEditor.utils.ProfileUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -37,12 +51,22 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
this.parent = parent;
}
+ /**
+ * Change the interpretation to give to an extension to ExtensionDefinitionKind.ASSOCIATION
+ *
+ * @param element
+ */
protected void transformIntoAssociation(ExtensionDefinition element) {
SetCommand command = new SetCommand(editingDomain, element, ExtensiondefinitionPackage.eINSTANCE.getExtensionDefinition_Kind(), ExtensionDefinitionKind.ASSOCIATION); //$NON-NLS-1$
editingDomain.getCommandStack().execute(command);
}
+ /**
+ * Change the interpretation to give to an extension to ExtensionDefinitionKind.GENERALIZATION
+ *
+ * @param element
+ */
protected void transformIntoGeneralization(ExtensionDefinition element) {
SetCommand command = new SetCommand(editingDomain, element, ExtensiondefinitionPackage.eINSTANCE.getExtensionDefinition_Kind(), ExtensionDefinitionKind.GENERALIZATION); //$NON-NLS-1$
@@ -50,6 +74,11 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
}
+ /**
+ * Change the interpretation to give to an extension to ExtensionDefinitionKind.MULTI_GENERALIZATION
+ *
+ * @param element
+ */
protected void transformIntoMultiGeneralization(ExtensionDefinition element) {
SetCommand command = new SetCommand(editingDomain, element, ExtensiondefinitionPackage.eINSTANCE.getExtensionDefinition_Kind(), ExtensionDefinitionKind.MULTI_GENERALIZATION); //$NON-NLS-1$
@@ -57,6 +86,11 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
}
+ /**
+ * Change the interpretation to give to an extension to ExtensionDefinitionKind.FUSION
+ *
+ * @param element
+ */
protected void transformIntoFusion(ExtensionDefinition element) {
SetCommand command = new SetCommand(editingDomain, element, ExtensiondefinitionPackage.eINSTANCE.getExtensionDefinition_Kind(), ExtensionDefinitionKind.FUSION); //$NON-NLS-1$
@@ -64,6 +98,12 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
}
+ /**
+ * Check if the stereotype involved in the extensionDefinition is also used to type the property of a stereotype elsewhere
+ *
+ * @param extensionDefinition
+ * @return
+ */
protected boolean stereotypeUsedElsewhere(ExtensionDefinition extensionDefinition) {
EList<ExtensionDefinition> allExtensionDefintion = extensionDefinition.getFacade().getExtensionDefinitions();
@@ -80,6 +120,12 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
return false;
}
+ /**
+ * Check if the stereotype involved in the extensionDefinition is also involved in another extensionDefinition
+ *
+ * @param extensionDefinition
+ * @return
+ */
protected boolean hasOtherExtension(ExtensionDefinition extensionDefinition) {
EList<ExtensionDefinition> allExtensionDefintion = extensionDefinition.getFacade().getExtensionDefinitions();
@@ -94,11 +140,16 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
return false;
}
+ /**
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(final Object element, final Object value) {
final ExtensionDefinitionKind newValue = ExtensionDefinitionKind.get((Integer)value);
-
if(element instanceof ExtensionDefinition) {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
@@ -106,7 +157,7 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
dialog.run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
- monitor.beginTask("Updating stereotypes definitions", IProgressMonitor.UNKNOWN);
+ monitor.beginTask(Messages.ExtensionKindColumnEditingSupport_0, IProgressMonitor.UNKNOWN);
Facade facade = ((ExtensionDefinition)element).getFacade();
@@ -127,18 +178,15 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
}
}
- // // Clear incompatibilities
- // EditionUtils.clearStereotypeCombinations(facade, editingDomain);
-
} else if(newValue == ExtensionDefinitionKind.GENERALIZATION) {
if(((ExtensionDefinition)element).getExtension().getMetaclass().isAbstract()) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Warning", "The extension extends an abstract class. The extension cannot be a generalization.");
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.ExtensionKindColumnEditingSupport_1, Messages.ExtensionKindColumnEditingSupport_2);
} else {
if(((ExtensionDefinition)element).getExtension().isRequired()) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Warning", "The extension is required. The extension cannot be a generalization.");
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.ExtensionKindColumnEditingSupport_3, Messages.ExtensionKindColumnEditingSupport_4);
} else {
transformIntoGeneralization((ExtensionDefinition)element);
@@ -155,15 +203,10 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
}
}
-
-
- // // Init incompatibilities
- // EditionUtils.initStereotypeCombinations(facade, editingDomain);
-
} else if(newValue == ExtensionDefinitionKind.MULTI_GENERALIZATION) {
if(hasOtherExtension((ExtensionDefinition)element) && stereotypeUsedElsewhere((ExtensionDefinition)element)) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Warning", "Cannot change the extension kind to MultiGeneralization because stereotype is used to type a property elsewhere. ");
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.ExtensionKindColumnEditingSupport_5, Messages.ExtensionKindColumnEditingSupport_6);
} else {
transformIntoMultiGeneralization((ExtensionDefinition)element);
// All children and generals must be set to generalization as well
@@ -180,7 +223,7 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
} else if(newValue == ExtensionDefinitionKind.FUSION) {
if(hasOtherExtension((ExtensionDefinition)element) && stereotypeUsedElsewhere((ExtensionDefinition)element)) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Warning", "Cannot change the extension kind to Fusion because stereotype is used to type a property elsewhere. ");
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.ExtensionKindColumnEditingSupport_7, Messages.ExtensionKindColumnEditingSupport_8);
} else {
transformIntoFusion((ExtensionDefinition)element);
@@ -219,9 +262,15 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
}
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
- // System.err.println("LA : " + element);
if(element instanceof ExtensionDefinition) {
int value = ((ExtensionDefinition)element).getKind().getValue();
return value;
@@ -230,25 +279,35 @@ public class ExtensionKindColumnEditingSupport extends EditingSupport {
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
if(element instanceof ExtensionDefinition) {
-
- // String[] itemsArray = { ExtensionDefinitionKind.ASSOCIATION.getName(), ExtensionDefinitionKind.GENERALIZATION.getName(), ExtensionDefinitionKind.MULTI_GENERALIZATION.getName(), ExtensionDefinitionKind.FUSION.getName() };
String[] itemsArray = { ExtensionDefinitionKind.ASSOCIATION.getName(), ExtensionDefinitionKind.GENERALIZATION.getName(), ExtensionDefinitionKind.MULTI_GENERALIZATION.getName() };
-
ComboBoxCellEditor combo = new ComboBoxCellEditor(parent, itemsArray, SWT.READ_ONLY);
-
return combo;
}
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
return true;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/IsPossibleColumnEditingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/IsPossibleColumnEditingSupport.java
index 46a8dd39c3b..4cfe72a3dba 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/IsPossibleColumnEditingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/IsPossibleColumnEditingSupport.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
import java.lang.reflect.InvocationTargetException;
@@ -17,6 +30,7 @@ import org.eclipse.papyrus.facade.Facade;
import org.eclipse.papyrus.facade.extensiondefinition.BaseMetaclass;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinition;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensiondefinitionPackage;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.papyrus.facadeSpecificEditor.utils.ProfileUtils;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -34,12 +48,22 @@ public class IsPossibleColumnEditingSupport extends EditingSupport {
this.parent = parent;
}
+ /**
+ * Change IsPossible in the model to impossible
+ *
+ * @param element
+ */
protected void transformPossibleIntoImpossible(BaseMetaclass element) {
SetCommand command = new SetCommand(editingDomain, element, ExtensiondefinitionPackage.eINSTANCE.getBaseMetaclass_Possible(), false);
editingDomain.getCommandStack().execute(command);
}
+ /**
+ * Change IsPossible in the model to possible
+ *
+ * @param element
+ */
protected void transformImpossibleIntoPossible(BaseMetaclass element) {
SetCommand command = new SetCommand(editingDomain, element, ExtensiondefinitionPackage.eINSTANCE.getBaseMetaclass_Possible(), true);
@@ -47,6 +71,11 @@ public class IsPossibleColumnEditingSupport extends EditingSupport {
}
+ /**
+ * Change IsPossible in the model to impossible and propagate to children and generals
+ *
+ * @param element
+ */
protected void transformAllPossibleIntoImpossible(BaseMetaclass element) {
Facade facade = ((BaseMetaclass)element).getExtensionDefinition().getFacade();
transformPossibleIntoImpossible((BaseMetaclass)element);
@@ -64,25 +93,13 @@ public class IsPossibleColumnEditingSupport extends EditingSupport {
}
}
}
-
- // Stereotype incompatibility of required extension must be updated too
- // for (ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
- // if (extensionDefinition.getExtension().isRequired()) {
- // for (BaseMetaclass baseMetaclass : extensionDefinition.getBaseMetaclasses()) {
- // Combination fakeCombinaison = VirtualProfileFactory.eINSTANCE.createCombination();
- // fakeCombinaison.getMetaClasses().add(element);
- //
- // Combination combination = EditionUtils.getCombinationThatMatch(baseMetaclass.getCompatibleStereotypes(), fakeCombinaison);
- // if (combination != null) {
- // StereotypeIncompatibilityColumnEditingSupport.makeItImcompatible(baseMetaclass, combination, false);
- // }
- // }
- // }
- // }
-
- // EditionUtils.clearStereotypeCombinations(facade, editingDomain);
}
+ /**
+ * Change IsPossible in the model to possible and propagate to children and generals
+ *
+ * @param element
+ */
protected void transformAllImpossibleIntoPossible(BaseMetaclass element) {
Facade facade = ((BaseMetaclass)element).getExtensionDefinition().getFacade();
transformImpossibleIntoPossible((BaseMetaclass)element);
@@ -100,31 +117,21 @@ public class IsPossibleColumnEditingSupport extends EditingSupport {
}
}
}
-
- // Stereotype incompatibility of required extension must be updated too
- // for (ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
- // if (extensionDefinition.getExtension().isRequired()) {
- // for (BaseMetaclass baseMetaclass : extensionDefinition.getBaseMetaclasses()) {
- // Combination fakeCombinaison = VirtualProfileFactory.eINSTANCE.createCombination();
- // fakeCombinaison.getMetaClasses().add(element);
- //
- // Combination combination = EditionUtils.getCombinationThatMatch(baseMetaclass.getIncompatibleStereotypes(), fakeCombinaison);
- // if (combination != null) {
- // StereotypeIncompatibilityColumnEditingSupport.makeItCompatible(baseMetaclass, combination, false);
- // }
- // }
- // }
- // }
-
- // EditionUtils.initStereotypeCombinations(facade, editingDomain);
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(final Object element, final Object value) {
if(element instanceof BaseMetaclass) {
if(EditionUtils.hasARequiredCombination((BaseMetaclass)element)) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Cannot change possibility", "Cannot change because it contains a required metaclass in the combinations");
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.IsPossibleColumnEditingSupport_0, Messages.IsPossibleColumnEditingSupport_1);
} else {
@@ -133,7 +140,7 @@ public class IsPossibleColumnEditingSupport extends EditingSupport {
dialog.run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
- monitor.beginTask("Updating stereotypes definitions", IProgressMonitor.UNKNOWN);
+ monitor.beginTask(Messages.IsPossibleColumnEditingSupport_2, IProgressMonitor.UNKNOWN);
if((Boolean)value == true) {
transformAllImpossibleIntoPossible((BaseMetaclass)element);
@@ -164,6 +171,13 @@ public class IsPossibleColumnEditingSupport extends EditingSupport {
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
if(element instanceof BaseMetaclass) {
@@ -174,11 +188,25 @@ public class IsPossibleColumnEditingSupport extends EditingSupport {
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
return true;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
if(element instanceof BaseMetaclass) {
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassAliasColumnEditingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassAliasColumnEditingSupport.java
index ff61b1514bf..e18fbdeaeaa 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassAliasColumnEditingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassAliasColumnEditingSupport.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
import org.eclipse.emf.edit.command.SetCommand;
@@ -6,7 +19,7 @@ import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetaclass;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelPackage;
import org.eclipse.swt.widgets.Composite;
@@ -22,32 +35,60 @@ public class MetaclassAliasColumnEditingSupport extends EditingSupport {
this.parent = parent;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(Object element, Object value) {
- if(element instanceof VirtualMetaclass) {
- SetCommand command = new SetCommand(editingDomain, (VirtualMetaclass)element, VirtualmetamodelPackage.eINSTANCE.getVirtualElement_AliasName(), (String)value); //$NON-NLS-1$
+ if(element instanceof VirtualElement) {
+ SetCommand command = new SetCommand(editingDomain, (VirtualElement)element, VirtualmetamodelPackage.eINSTANCE.getVirtualElement_AliasName(), (String)value); //$NON-NLS-1$
editingDomain.getCommandStack().execute(command);
getViewer().refresh();
}
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
- if(element instanceof VirtualMetaclass) {
- if(((VirtualMetaclass)element).getAliasName() == null) {
- return "";
+ if(element instanceof VirtualElement) {
+ if(((VirtualElement)element).getAliasName() == null) {
+ return ""; //$NON-NLS-1$
} else {
- return ((VirtualMetaclass)element).getAliasName();
+ return ((VirtualElement)element).getAliasName();
}
}
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
return new TextCellEditor(parent);
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
return true;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassIsAbstractColumnEditingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassIsAbstractColumnEditingSupport.java
index e9489f3d8ad..8531c561cce 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassIsAbstractColumnEditingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassIsAbstractColumnEditingSupport.java
@@ -1,6 +1,18 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
-
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.jface.viewers.CellEditor;
@@ -24,6 +36,13 @@ public class MetaclassIsAbstractColumnEditingSupport extends EditingSupport {
this.parent = parent;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
if(element instanceof VirtualMetaclass) {
@@ -36,11 +55,25 @@ public class MetaclassIsAbstractColumnEditingSupport extends EditingSupport {
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
return true;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
if(element instanceof VirtualMetaclass) {
@@ -49,6 +82,13 @@ public class MetaclassIsAbstractColumnEditingSupport extends EditingSupport {
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(Object element, Object value) {
if(element instanceof VirtualMetaclass) {
@@ -58,7 +98,5 @@ public class MetaclassIsAbstractColumnEditingSupport extends EditingSupport {
getViewer().refresh();
}
-
}
-
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassToKeepColumnEditingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassToKeepColumnEditingSupport.java
index e6527923f8f..c17545dc1c5 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassToKeepColumnEditingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassToKeepColumnEditingSupport.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
import org.eclipse.emf.edit.command.SetCommand;
@@ -28,22 +41,40 @@ public class MetaclassToKeepColumnEditingSupport extends EditingSupport {
this.facade = facade;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(Object element, Object value) {
if(element instanceof VirtualElement) {
VirtualMetamodel metamodel = facade.getVirtualmetamodel();
- if(PrunerUtils.canBeUnkept((VirtualElement)element, metamodel)) {
+ if((Boolean)value == false) {
+ if(PrunerUtils.classifierUnkeep((VirtualElement)element, metamodel, editingDomain)) {
+
+ getViewer().refresh();
+ }
+ } else {
SetCommand command = new SetCommand(editingDomain, (VirtualElement)element, VirtualmetamodelPackage.eINSTANCE.getVirtualElement_Kept(), (Boolean)value); //$NON-NLS-1$
editingDomain.getCommandStack().execute(command);
getViewer().refresh();
}
-
}
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
if(element instanceof VirtualElement) {
@@ -52,6 +83,13 @@ public class MetaclassToKeepColumnEditingSupport extends EditingSupport {
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
@@ -59,6 +97,13 @@ public class MetaclassToKeepColumnEditingSupport extends EditingSupport {
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
return true;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassUseRepresentedColumnEditingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassUseRepresentedColumnEditingSupport.java
new file mode 100644
index 00000000000..73686c74159
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/MetaclassUseRepresentedColumnEditingSupport.java
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
+
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetaclass;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelPackage;
+import org.eclipse.swt.widgets.Composite;
+
+public class MetaclassUseRepresentedColumnEditingSupport extends EditingSupport {
+
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ protected Composite parent;
+
+ public MetaclassUseRepresentedColumnEditingSupport(ColumnViewer viewer, AdapterFactoryEditingDomain editingDomain, Composite parent) {
+ super(viewer);
+ this.editingDomain = editingDomain;
+ this.parent = parent;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ if(element instanceof VirtualElement) {
+ return new CheckboxCellEditor(parent);
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ protected Object getValue(Object element) {
+ if(element instanceof VirtualElement) {
+ return Boolean.valueOf(((VirtualElement)element).isUseRepresented());
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
+ @Override
+ protected void setValue(Object element, Object value) {
+ if(element instanceof VirtualMetaclass) {
+
+ SetCommand command = new SetCommand(editingDomain, (VirtualMetaclass)element, VirtualmetamodelPackage.eINSTANCE.getVirtualElement_UseRepresented(), (Boolean)value); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ getViewer().refresh();
+
+ }
+ }
+}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesAliasColumnEdintingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesAliasColumnEdintingSupport.java
index c887f4ac83b..868c785dfca 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesAliasColumnEdintingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesAliasColumnEdintingSupport.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
import org.eclipse.emf.edit.command.SetCommand;
@@ -6,7 +19,7 @@ import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualProperty;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelPackage;
import org.eclipse.swt.widgets.Composite;
@@ -22,42 +35,65 @@ public class PropertiesAliasColumnEdintingSupport extends EditingSupport {
this.parent = parent;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(Object element, Object value) {
- if(element instanceof VirtualProperty) {
- // if(!(((VirtualProperty)element).getRepresentedElement() instanceof Property)) {
- SetCommand command = new SetCommand(editingDomain, (VirtualProperty)element, VirtualmetamodelPackage.eINSTANCE.getVirtualElement_AliasName(), (String)value); //$NON-NLS-1$
+ if(element instanceof VirtualElement) {
+ SetCommand command = new SetCommand(editingDomain, (VirtualElement)element, VirtualmetamodelPackage.eINSTANCE.getVirtualElement_AliasName(), (String)value); //$NON-NLS-1$
editingDomain.getCommandStack().execute(command);
getViewer().refresh();
- // }
}
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
- if(element instanceof VirtualProperty) {
- // if(!(((VirtualProperty)element).getRepresentedElement() instanceof Property)) {
- if(((VirtualProperty)element).getAliasName() == null) {
- return "";
+ if(element instanceof VirtualElement) {
+ if(((VirtualElement)element).getAliasName() == null) {
+ return ""; //$NON-NLS-1$
} else {
- return ((VirtualProperty)element).getAliasName();
+ return ((VirtualElement)element).getAliasName();
}
- // }
}
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
- // if(!(((VirtualProperty)element).getRepresentedElement() instanceof Property)) {
+
return new TextCellEditor(parent);
- // } else {
- // return null;
- // }
+
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
+
return true;
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMaxColumnEdintingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMaxColumnEdintingSupport.java
index 67cdca9d995..79cfb5b0b7f 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMaxColumnEdintingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMaxColumnEdintingSupport.java
@@ -1,6 +1,19 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
-import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -9,10 +22,12 @@ import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualProperty;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualTypedElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelPackage;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.MultiplicityElement;
public class PropertiesMaxColumnEdintingSupport extends EditingSupport {
@@ -26,25 +41,31 @@ public class PropertiesMaxColumnEdintingSupport extends EditingSupport {
this.parent = parent;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(Object element, Object value) {
- if(element instanceof VirtualProperty) {
+ if(element instanceof VirtualTypedElement) {
try {
- if(((VirtualProperty)element).getRepresentedElement() instanceof Property || ((VirtualProperty)element).getRepresentedElement() instanceof EStructuralFeature) {
+ if(((VirtualTypedElement)element).getRepresentedElement() instanceof MultiplicityElement || ((VirtualTypedElement)element).getRepresentedElement() instanceof ETypedElement) {
boolean isOk = false;
int intValue = Integer.valueOf((String)value);
-
if(intValue >= -1) {
int upperReference = 0;
- if(((VirtualProperty)element).getRepresentedElement() instanceof Property) {
- upperReference = ((Property)((VirtualProperty)element).getRepresentedElement()).getUpper();
+ if(((VirtualTypedElement)element).getRepresentedElement() instanceof MultiplicityElement) {
+ upperReference = ((MultiplicityElement)((VirtualTypedElement)element).getRepresentedElement()).getUpper();
- } else if(((VirtualProperty)element).getRepresentedElement() instanceof EStructuralFeature) {
- upperReference = ((EStructuralFeature)((VirtualProperty)element).getRepresentedElement()).getUpperBound();
+ } else if(((VirtualTypedElement)element).getRepresentedElement() instanceof ETypedElement) {
+ upperReference = ((ETypedElement)((VirtualTypedElement)element).getRepresentedElement()).getUpperBound();
}
if(upperReference != -1) {
@@ -59,46 +80,69 @@ public class PropertiesMaxColumnEdintingSupport extends EditingSupport {
}
if(isOk) {
- SetCommand command = new SetCommand(editingDomain, (VirtualProperty)element, VirtualmetamodelPackage.eINSTANCE.getVirtualProperty_Upper(), intValue); //$NON-NLS-1$
+ SetCommand command = new SetCommand(editingDomain, (VirtualTypedElement)element, VirtualmetamodelPackage.eINSTANCE.getVirtualTypedElement_Upper(), intValue); //$NON-NLS-1$
editingDomain.getCommandStack().execute(command);
getViewer().refresh();
} else {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Problem with upper bound", "Custom upper bound must be <= " + upperReference);
+ MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.PropertiesMaxColumnEdintingSupport_0, Messages.PropertiesMaxColumnEdintingSupport_1 + upperReference);
}
} else {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Problem with upper bound", "Upper bound must be an between [-1 and +inf[");
+ MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.PropertiesMaxColumnEdintingSupport_2, Messages.PropertiesMaxColumnEdintingSupport_3);
}
}
} catch (NumberFormatException ex) {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Problem with upper bound", "Lower bound must be an integer.");
+ MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.PropertiesMaxColumnEdintingSupport_4, Messages.PropertiesMaxColumnEdintingSupport_5);
}
}
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
- if(element instanceof VirtualProperty) {
+ if(element instanceof VirtualTypedElement) {
- return ((VirtualProperty)element).getUpper() + "";
+ return ((VirtualTypedElement)element).getUpper() + ""; //$NON-NLS-1$
}
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
- if(element instanceof VirtualProperty) {
+ if(element instanceof VirtualTypedElement) {
return new TextCellEditor(parent);
}
+
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
if(element instanceof VirtualProperty) {
return true;
}
+
return false;
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMinColumnEdintingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMinColumnEdintingSupport.java
index 51e905e2729..8f62674c1f0 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMinColumnEdintingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesMinColumnEdintingSupport.java
@@ -1,6 +1,19 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
-import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -9,10 +22,12 @@ import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualProperty;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualTypedElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelPackage;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.MultiplicityElement;
public class PropertiesMinColumnEdintingSupport extends EditingSupport {
@@ -26,25 +41,31 @@ public class PropertiesMinColumnEdintingSupport extends EditingSupport {
this.parent = parent;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(Object element, Object value) {
- if(element instanceof VirtualProperty) {
+ if(element instanceof VirtualTypedElement) {
try {
- if(((VirtualProperty)element).getRepresentedElement() instanceof Property || ((VirtualProperty)element).getRepresentedElement() instanceof EStructuralFeature) {
+ if(((VirtualTypedElement)element).getRepresentedElement() instanceof MultiplicityElement || ((VirtualTypedElement)element).getRepresentedElement() instanceof ETypedElement) {
boolean isOk = false;
int intValue = Integer.valueOf((String)value);
-
if(intValue >= -1) {
int lowerReference = 0;
- if(((VirtualProperty)element).getRepresentedElement() instanceof Property) {
- lowerReference = ((Property)((VirtualProperty)element).getRepresentedElement()).getLower();
+ if(((VirtualTypedElement)element).getRepresentedElement() instanceof MultiplicityElement) {
+ lowerReference = ((MultiplicityElement)((VirtualTypedElement)element).getRepresentedElement()).getLower();
- } else if(((VirtualProperty)element).getRepresentedElement() instanceof EStructuralFeature) {
- lowerReference = ((EStructuralFeature)((VirtualProperty)element).getRepresentedElement()).getLowerBound();
+ } else if(((VirtualTypedElement)element).getRepresentedElement() instanceof ETypedElement) {
+ lowerReference = ((ETypedElement)((VirtualTypedElement)element).getRepresentedElement()).getLowerBound();
}
if(lowerReference != -1) {
@@ -54,46 +75,69 @@ public class PropertiesMinColumnEdintingSupport extends EditingSupport {
}
if(isOk) {
- SetCommand command = new SetCommand(editingDomain, (VirtualProperty)element, VirtualmetamodelPackage.eINSTANCE.getVirtualProperty_Lower(), intValue); //$NON-NLS-1$
+ SetCommand command = new SetCommand(editingDomain, (VirtualTypedElement)element, VirtualmetamodelPackage.eINSTANCE.getVirtualTypedElement_Lower(), intValue); //$NON-NLS-1$
editingDomain.getCommandStack().execute(command);
getViewer().refresh();
} else {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Problem with lower bound", "Custom lower bound must be >= " + lowerReference);
+ MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.PropertiesMinColumnEdintingSupport_0, Messages.PropertiesMinColumnEdintingSupport_1 + lowerReference);
}
} else {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Problem with upper bound", "Lower bound must be an between [-1 and +inf[");
+ MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.PropertiesMinColumnEdintingSupport_2, Messages.PropertiesMinColumnEdintingSupport_3);
}
}
} catch (NumberFormatException ex) {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Problem with lower bound", "Lower bound must be an integer.");
+ MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.PropertiesMinColumnEdintingSupport_4, Messages.PropertiesMinColumnEdintingSupport_5);
}
}
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
- if(element instanceof VirtualProperty) {
+ if(element instanceof VirtualTypedElement) {
- return ((VirtualProperty)element).getLower() + "";
+ return ((VirtualTypedElement)element).getLower() + ""; //$NON-NLS-1$
}
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
- if(element instanceof VirtualProperty) {
+ if(element instanceof VirtualTypedElement) {
return new TextCellEditor(parent);
}
+
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
if(element instanceof VirtualProperty) {
return true;
}
+
return false;
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesToKeepColumnEditingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesToKeepColumnEditingSupport.java
index 43232326eff..536b683afb3 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesToKeepColumnEditingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/PropertiesToKeepColumnEditingSupport.java
@@ -1,14 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualProperty;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelPackage;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.uml2.uml.Property;
public class PropertiesToKeepColumnEditingSupport extends EditingSupport {
@@ -22,35 +41,74 @@ public class PropertiesToKeepColumnEditingSupport extends EditingSupport {
this.parent = parent;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(Object element, Object value) {
if(element instanceof VirtualElement) {
-
- SetCommand command = new SetCommand(editingDomain, (VirtualElement)element, VirtualmetamodelPackage.eINSTANCE.getVirtualElement_Kept(), (Boolean)value); //$NON-NLS-1$
- editingDomain.getCommandStack().execute(command);
- getViewer().refresh();
-
+ boolean canBeUnkept = true;
+ if(element instanceof VirtualProperty) {
+ if(((VirtualElement)element).getRepresentedElement() instanceof EStructuralFeature) {
+ if(((EStructuralFeature)((VirtualElement)element).getRepresentedElement()).getLowerBound() > 0) {
+ canBeUnkept = false;
+ MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.PropertiesToKeepColumnEditingSupport_0, Messages.PropertiesToKeepColumnEditingSupport_1);
+ }
+ } else if(((VirtualElement)element).getRepresentedElement() instanceof Property) {
+ if(((Property)((VirtualElement)element).getRepresentedElement()).getLower() > 0) {
+ canBeUnkept = false;
+ MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.PropertiesToKeepColumnEditingSupport_2, Messages.PropertiesToKeepColumnEditingSupport_3);
+ }
+ }
+
+ }
+
+ if(canBeUnkept) {
+ SetCommand command = new SetCommand(editingDomain, (VirtualElement)element, VirtualmetamodelPackage.eINSTANCE.getVirtualElement_Kept(), (Boolean)value); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ getViewer().refresh();
+ }
}
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
if(element instanceof VirtualElement) {
-
return Boolean.valueOf(((VirtualElement)element).isKept());
-
}
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
-
return new CheckboxCellEditor(parent);
-
-
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
return true;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/StereotypeIncompatibilityColumnEditingSupport.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/StereotypeIncompatibilityColumnEditingSupport.java
index cc241f8d053..30a0e5c20e7 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/StereotypeIncompatibilityColumnEditingSupport.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/editingSupport/StereotypeIncompatibilityColumnEditingSupport.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.editingSupport;
import java.lang.reflect.InvocationTargetException;
@@ -15,16 +28,14 @@ import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.facade.Facade;
import org.eclipse.papyrus.facade.extensiondefinition.BaseMetaclass;
import org.eclipse.papyrus.facade.extensiondefinition.Combination;
-import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinition;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensiondefinitionFactory;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensiondefinitionPackage;
import org.eclipse.papyrus.facadeSpecificEditor.FacadeSpecificEditor;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.Stereotype;
public class StereotypeIncompatibilityColumnEditingSupport extends EditingSupport {
@@ -38,6 +49,12 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
this.parent = parent;
}
+ /**
+ * Change a compatibility between stereotype application to incompatible in the model
+ *
+ * @param baseMetaclass
+ * @param combinaison
+ */
protected void transformCompatibleIntoIncompatible(BaseMetaclass baseMetaclass, Combination combinaison) {
AddCommand command = new AddCommand(editingDomain, baseMetaclass, ExtensiondefinitionPackage.eINSTANCE.getBaseMetaclass_IncompatibleStereotypes(), combinaison); //$NON-NLS-1$
editingDomain.getCommandStack().execute(command);
@@ -45,31 +62,23 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
editingDomain.getCommandStack().execute(removeCommand);
}
+ /**
+ * Change a compatibility between stereotype application to incompatible in the model
+ *
+ * @param baseMetaclass
+ * @param combinaison
+ */
protected void transformAllCompatibleIntoIncompatible(BaseMetaclass baseMetaclass, Combination combinaison) {
- Facade facade = baseMetaclass.getExtensionDefinition().getFacade();
transformCompatibleIntoIncompatible(baseMetaclass, combinaison);
-
- // baseMetaclass, all children and generals must be set to Compatible
- // HashSet<Stereotype> siblings = ProfileUtils.getSiblings(baseMetaclass.getExtensionDefinition().getStereotype());
- // for(ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
- // if(extensionDefinition.getExtension() == baseMetaclass.getExtensionDefinition().getExtension()) {
- // if(siblings.contains(extensionDefinition.getStereotype())) {
- // for(BaseMetaclass baseMetaclass1 : extensionDefinition.getBaseMetaclasses())
- //
- // if(baseMetaclass1.getBase() == baseMetaclass.getBase()) {
- // Combination combi = EditionUtils.getCombinationThatMatch(baseMetaclass1.getCompatibleStereotypes(), combinaison);
- // if(combi != null) {
- // transformCompatibleIntoIncompatible(baseMetaclass1, combi);
- // } else {
- // System.err.println("Problem to find combinaison in sibling");
- // }
- // }
- // }
- // }
- // }
}
+ /**
+ * Change a compatibility between stereotype application to compatible in the model
+ *
+ * @param baseMetaclass
+ * @param combinaison
+ */
protected void transformImcompatibleIntoCompatible(BaseMetaclass baseMetaclass, Combination combinaison) {
RemoveCommand removeCommand = new RemoveCommand(editingDomain, baseMetaclass, ExtensiondefinitionPackage.eINSTANCE.getBaseMetaclass_IncompatibleStereotypes(), combinaison); //$NON-NLS-1$
editingDomain.getCommandStack().execute(removeCommand);
@@ -77,52 +86,23 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
editingDomain.getCommandStack().execute(addCommand);
}
+ /**
+ * Change a compatibility between stereotype application to compatible in the model
+ *
+ * @param baseMetaclass
+ * @param combinaison
+ */
protected void transformAllImcompatibleIntoCompatible(BaseMetaclass baseMetaclass, Combination combinaison) {
- Facade facade = baseMetaclass.getExtensionDefinition().getFacade();
transformImcompatibleIntoCompatible(baseMetaclass, combinaison);
-
- // baseMetaclass, all children and generals must be set to Incompatible
- // HashSet<Stereotype> siblings = ProfileUtils.getSiblings(baseMetaclass.getExtensionDefinition().getStereotype());
- // for(ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
- // if(extensionDefinition.getExtension() == baseMetaclass.getExtensionDefinition().getExtension()) {
- // if(siblings.contains(extensionDefinition.getStereotype())) {
- // for(BaseMetaclass baseMetaclass1 : extensionDefinition.getBaseMetaclasses())
- // if(baseMetaclass1.getBase() == baseMetaclass.getBase()) {
- // Combination combi = EditionUtils.getCombinationThatMatch(baseMetaclass1.getIncompatibleStereotypes(), combinaison);
- // if(combi != null) {
- // transformImcompatibleIntoCompatible(baseMetaclass1, combi);
- // } else {
- // System.err.println("Problem to find combinaison in sibling");
- // }
- // }
- // }
- // }
- // }
- }
-
- protected BaseMetaclass findCorrespondingGeneral(BaseMetaclass containerBaseMetaClass) {
-
- Stereotype containerGeneral = containerBaseMetaClass.getExtensionDefinition().getExtension().getStereotype();
-
- Facade facade = containerBaseMetaClass.getExtensionDefinition().getFacade();
-
- for(ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
- if(extensionDefinition.getExtension() == containerBaseMetaClass.getExtensionDefinition().getExtension()) {
- if(extensionDefinition.getStereotype() == containerGeneral) {
- for(BaseMetaclass baseMetaclass : extensionDefinition.getBaseMetaclasses()) {
- if(baseMetaclass.getBase() == containerBaseMetaClass.getBase()) {
- return baseMetaclass;
- }
- }
- }
- }
- }
-
- return null;
-
}
+ /**
+ * Used to propagate compatibilities and incompatibilities among stereotype applications
+ *
+ * @param combination
+ * @param iAmNotARequired
+ */
protected void proceedTheOtherWayCompatibleIntoIncompatible(Combination combination, boolean iAmNotARequired) {
for(BaseMetaclass meta : ((Combination)combination).getMembers()) {
@@ -136,7 +116,6 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
// fake Combination + the general basemetaclass that own this combinaison
if(iAmNotARequired) {
BaseMetaclass containerBaseMetaClass = (BaseMetaclass)((Combination)combination).eContainer();
- // BaseMetaclass general = findCorrespondingGeneral(containerBaseMetaClass);
BaseMetaclass general = containerBaseMetaClass;
fakeCombination.getMembers().add(general);
}
@@ -147,12 +126,18 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
if(combinaison != null) {
transformAllCompatibleIntoIncompatible(meta, combinaison);
} else {
- System.err.println("Problem to find combinaison CompatibleIntoIncompatible");
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.StereotypeIncompatibilityColumnEditingSupport_0);
}
// }
}
}
+ /**
+ * Used to propagate compatibilities and incompatibilities among stereotype applications
+ *
+ * @param combination
+ * @param iAmNotARequired
+ */
protected void proceedTheOtherWayImcompatibleIntoCompatible(Combination combination, boolean iAmNotARequired) {
for(BaseMetaclass meta : ((Combination)combination).getMembers()) {
// Build fake Combination that contain all the basemetaclass of the combinaison except the basemetaclass we are processing
@@ -176,125 +161,44 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
if(combinaison != null) {
transformAllImcompatibleIntoCompatible(meta, combinaison);
} else {
- System.err.println("Problem to find combinaison ImcompatibleIntoCompatible");
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.StereotypeIncompatibilityColumnEditingSupport_1);
}
// }
}
}
- // protected void updateRequiredIntoIncompatible(Facade facade, BaseMetaclass baseMetaclass, Combination combination) {
- // for (ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
- // if (extensionDefinition.getExtension().isRequired()) {
- // for (BaseMetaclass baseMetaclass2 : extensionDefinition.getBaseMetaclasses()) {
- // if (baseMetaclass2.getMetaclass() == baseMetaclass.getMetaclass()) {
- // // Build fake combination
- // Combination fakeCombination = FacadeMetamodelFactory.eINSTANCE.createCombination();
- // for (BaseMetaclass metaFake : combination.getMetaClasses()) {
- // fakeCombination.getMetaClasses().add(metaFake);
- // }
- // BaseMetaclass containerBaseMetaClass = (BaseMetaclass) combination.eContainer();
- // BaseMetaclass general = findCorrespondingGeneral(containerBaseMetaClass);
- // fakeCombination.getMetaClasses().add(general);
- //
- // // We go through the compatible combinaison of this basemeta and try to find the fake
- // Combination combinaison = EditionUtils.getCombinationThatMatch(baseMetaclass2.getCompatibleStereotypes(), fakeCombination);
- // if (combinaison != null) {
- // transformCompatibleIntoIncompatible(baseMetaclass2, combinaison);
- // } else {
- // System.err.println("Problem to find combinaison-update");
- // }
- // }
- //
- // }
- // }
- //
- // }
- //
- // }
- //
- // protected void updateRequiredIntoCompatible(Facade facade, BaseMetaclass baseMetaclass, Combination combination) {
- // for (ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
- // if (extensionDefinition.getExtension().isRequired()) {
- // for (BaseMetaclass baseMetaclass2 : extensionDefinition.getBaseMetaclasses()) {
- // if (baseMetaclass2.getMetaclass() == baseMetaclass.getMetaclass()) {
- // // Build fake combination
- // Combination fakeCombination = FacadeMetamodelFactory.eINSTANCE.createCombination();
- // for (BaseMetaclass metaFake : combination.getMetaClasses()) {
- // fakeCombination.getMetaClasses().add(metaFake);
- // }
- // BaseMetaclass containerBaseMetaClass = (BaseMetaclass) combination.eContainer();
- // BaseMetaclass general = findCorrespondingGeneral(containerBaseMetaClass);
- // fakeCombination.getMetaClasses().add(general);
- //
- // // We go through the compatible combinaison of this basemeta and try to find the fake
- // Combination combinaison = EditionUtils.getCombinationThatMatch(baseMetaclass2.getIncompatibleStereotypes(), fakeCombination);
- // if (combinaison != null) {
- // transformImcompatibleIntoCompatible(baseMetaclass2, combinaison);
- // } else {
- // System.err.println("Problem to find combinaison-update");
- // }
- // }
- //
- // }
- // }
- //
- // }
- //
- // }
-
+ /**
+ * Set a combination of stereotype application to incompatible
+ *
+ * @param baseMetaclass
+ * @param combination
+ * @param bothWays
+ */
protected void makeItImcompatible(BaseMetaclass baseMetaclass, Combination combination, boolean bothWays) {
-
- // if (!EditionUtils.containsOnlyRequired(combination)) {
- // Facade facade = baseMetaclass.getExtensionDefinition().getFacade();
-
- // Make it incompatible
- // First way
transformAllCompatibleIntoIncompatible(baseMetaclass, combination);
-
- // if (!baseMetaclass.getExtensionDefinition().getExtension().isRequired()) {
- // The other way
proceedTheOtherWayCompatibleIntoIncompatible(combination, true);
-
- // updateRequiredIntoIncompatible(facade, baseMetaclass, combination);
- // } else {
- // if (bothWays) {
- // if (((Combination) combination).getMetaClasses().size() == 1) {
- // // System.err.println("Ici : " + ((Combination) combination).getMetaClasses().get(0).getExtensionDefinition().getStereotype());
- // IsPossibleColumnEditingSupport.transformAllPossibleIntoImpossible(((Combination) combination).getMetaClasses().get(0));
- // } else {
- // proceedTheOtherWayCompatibleIntoIncompatible(combination, false);
- // }
- // }
- // }
- // } else {
- // MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Cannot because required", "All those stereotypes are required");
- // }
}
+ /**
+ * Set a combination of stereotype application to compatible
+ *
+ * @param baseMetaclass
+ * @param combination
+ * @param bothWays
+ */
protected void makeItCompatible(BaseMetaclass baseMetaclass, Combination combination, boolean bothWays) {
- // Facade facade = baseMetaclass.getExtensionDefinition().getFacade();
-
- // First way
transformAllImcompatibleIntoCompatible(baseMetaclass, (Combination)combination);
-
- // if (!baseMetaclass.getExtensionDefinition().getExtension().isRequired()) {
- // The other way
proceedTheOtherWayImcompatibleIntoCompatible(combination, true);
-
- // updateRequiredIntoCompatible(facade, baseMetaclass, combination);
- // } else {
- // if (bothWays) {
- // if (((Combination) combination).getMetaClasses().size() == 1) {
- // // System.err.println("Ici : " + ((Combination) combination).getMetaClasses().get(0).getExtensionDefinition().getStereotype());
- // IsPossibleColumnEditingSupport.transformAllImpossibleIntoPossible(((Combination) combination).getMetaClasses().get(0));
- // } else {
- // proceedTheOtherWayImcompatibleIntoCompatible(combination, false);
- // }
- // }
- // }
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+ *
+ * @param element
+ * @param value
+ */
@Override
protected void setValue(final Object element, final Object value) {
if(element instanceof Combination) {
@@ -304,7 +208,7 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
dialog.run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
- monitor.beginTask("Updating stereotypes definitions", IProgressMonitor.UNKNOWN);
+ monitor.beginTask(Messages.StereotypeIncompatibilityColumnEditingSupport_2, IProgressMonitor.UNKNOWN);
ISelection selection = FacadeSpecificEditor.getExtensionDefintionTreeViewer().getSelection();
if(selection instanceof IStructuredSelection) {
@@ -338,6 +242,13 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
}
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected Object getValue(Object element) {
if(element instanceof Combination) {
@@ -359,13 +270,25 @@ public class StereotypeIncompatibilityColumnEditingSupport extends EditingSuppor
return null;
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected CellEditor getCellEditor(Object element) {
-
return new CheckboxCellEditor(parent);
-
}
+ /**
+ *
+ * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
@Override
protected boolean canEdit(Object element) {
return true;
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/glue/GlueGenerator.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/glue/GlueGenerator.java
deleted file mode 100644
index 1b405cb1c32..00000000000
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/glue/GlueGenerator.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.eclipse.papyrus.facadeSpecificEditor.glue;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
-import org.eclipse.papyrus.facade.Facade;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-
-public class GlueGenerator extends MouseAdapter {
-
- protected Facade facade;
-
- public GlueGenerator(Facade facade) {
- super();
- this.facade = facade;
-
- }
-
- protected void printHead(PrintStream printStream) {
- printStream.println("import java.io.IOException;");
- printStream.println("import java.io.InputStream;");
- printStream.println("import java.io.OutputStream;");
- printStream.println("import java.util.Map;");
-
- printStream.println("import org.eclipse.emf.common.util.URI;");
- printStream.println("import org.eclipse.emf.ecore.resource.ResourceSet;");
- printStream.println("import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;");
- printStream.println("import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;");
- printStream.println("import org.eclipse.papyrus.FacadeMetamodel.FacadeMetamodel.Facade;");
- printStream.println("import org.eclipse.papyrus.facacemetamodel.interpreter.Loader;");
- printStream.println("import org.eclipse.papyrus.facacemetamodel.interpreter.Saver;");
-
- printStream.println("public class MetamodelResourceImpl extends XMIResourceImpl {");
-
- printStream.println("public MetamodelResourceImpl(URI uri) {");
- printStream.println("super(uri);");
- printStream.println("}");
-
- }
-
- protected void printDoLoad(PrintStream printStream) {
- printStream.println("@Override");
- printStream.println("public void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException {");
-
- printStream.println("URI facadeURI = URI.createPlatformPluginURI(\"/vitualProfile/model/My.facademetamodel\", true);");
- printStream.println("ResourceSet resourceSet = new ResourceSetImpl();");
- printStream.println("try {");
- printStream.println("Object facade = resourceSet.getResource(facadeURI, true).getContents().get(0);");
- printStream.println("if (facade != null) {");
- printStream.println("if (facade instanceof Facade) {");
-
- printStream.println("Loader.doLoad(inputStream, options, (Facade) facade);");
- printStream.println("} else {");
- printStream.println("System.err.println(\"Facade is not of right kind\");");
- printStream.println("}");
- printStream.println("} else {");
- printStream.println("System.err.println(\"Cannot open facade model\");");
- printStream.println("}");
-
- printStream.println("} catch (Exception e) {");
- printStream.println("e.printStackTrace();");
- printStream.println("}");
- printStream.println("}");
- }
-
- protected void printDoSave(PrintStream printStream) {
- printStream.println("@Override");
- printStream.println("public void doSave(OutputStream outputStream, Map<?, ?> options) throws IOException {");
- printStream.println("URI facadeURI = URI.createPlatformPluginURI(\"/vitualProfile/model/My.facademetamodel\", true);");
- printStream.println("ResourceSet resourceSet = new ResourceSetImpl();");
- printStream.println("try {");
- printStream.println("Object facade = resourceSet.getResource(facadeURI, true).getContents().get(0);");
- printStream.println("if (facade != null) {");
- printStream.println("if (facade instanceof Facade) {");
-
- printStream.println("Saver.doSave(outputStream, options, (Facade) facade, this);");
- printStream.println("} else {");
- printStream.println("System.err.println(\"Facade is not of right kind\");");
- printStream.println("}");
- printStream.println("} else {");
- printStream.println("System.err.println(\"Cannot open facade model\");");
- printStream.println("}");
-
- printStream.println("} catch (Exception e) {");
- printStream.println("e.printStackTrace();");
- printStream.println("}");
- printStream.println("}");
- }
-
- protected void printTail(PrintStream printStream) {
- printStream.println("}");
- }
-
- @Override
- public void mouseUp(MouseEvent e) {
-
- URI facadeURI = facade.eResource().getURI();
-
- URI glueURI = facadeURI.appendFileExtension("java");
-
- URIConverter uriConverter = new ExtensibleURIConverterImpl();
-
- try {
- OutputStream outputStream = uriConverter.createOutputStream(glueURI);
- PrintStream printStream = new PrintStream(outputStream);
-
- printHead(printStream);
-
- printDoSave(printStream);
-
- printDoLoad(printStream);
-
- printTail(printStream);
-
- printStream.close();
-
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- }
-}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/messages.properties b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/messages.properties
new file mode 100644
index 00000000000..80e04f055a3
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/messages.properties
@@ -0,0 +1,115 @@
+EcoreGenerator_10=Don't know how to handle association because wrong number of member end :
+EcoreGenerator_11=Don't know how to handle association because wrong number of owned member :
+EcoreGenerator_12=Property : Type not found for :
+EcoreGenerator_13=Virtual property already processed:
+EcoreGenerator_14=Problem with elementReprensentingFather kind:
+EcoreGenerator_15=Problem with representingElement kind:
+EcoreGenerator_16=Problem with metaclass generalization generation for :
+EcoreGenerator_17=Generalization already processed:
+EcoreGenerator_18=EAttribute : Type not found for :
+EcoreGenerator_19=EReference : Type not found for :
+EcoreGenerator_20=The kind of represented Property is unknown:
+EcoreGenerator_21=Problem of type for metaclass properties generation for :
+EcoreGenerator_22=Problem with metaclass properties generation for :
+EcoreGenerator_23=Properties already processed:
+EcoreGenerator_24=createOperations - couldn't find the virtualClassifier that represents the type:
+EcoreGenerator_25=createOperations - parameters - couldn't find the virtualClassifier that represents the type:
+EcoreGenerator_26=The kind of oppositeVirtualProperty is unknown:
+EcoreGenerator_27=Warning : Problem to update eopposite :
+EcoreGenerator_3=setRepresenting : stereotypes are not only onekind on
+EcoreGenerator_30=processEAnnotations: couldn't find representing for :
+EcoreGenerator_31=processEAnnotations: couldn't find corresponding VirtualMetaclass for :
+EcoreGenerator_35=Generate ecore metamodel
+EcoreGenerator_36=Unknown kind of the classifier:
+EcoreGenerator_37=This element doesn't have represented element :
+EcoreGenerator_4=Litral : know the kind of enum literal :
+EcoreGenerator_40=Validation of the generated metamodel
+EcoreGenerator_41=The generated metamodel seems OK.
+EcoreGenerator_42=Validation of the generated metamodel
+EcoreGenerator_43=The generated metamodel contains issues that you must fix in the preliminary metamodel. \nYou may open the generated metamodel to spot the problem but don't fix it manualy.
+EcoreGenerator_44=Metamodel name, nsPrefix and nsURI
+EcoreGenerator_45=Metamodel name, nsPrefix and nsURI must not be empty
+EcoreGenerator_5=Litral : Don't know the kind of enum literal :
+EcoreGenerator_6=Enum : We don't know the kind of represented Element:
+EcoreGenerator_9=Datatype : We don't know the kind of represented Element:
+ExtensionDefintionLabelProvider_13=\ on
+ExtensionKindColumnEditingSupport_0=Updating stereotypes definitions
+ExtensionKindColumnEditingSupport_1=Warning
+ExtensionKindColumnEditingSupport_2=The extension extends an abstract class. The extension cannot be a generalization.
+ExtensionKindColumnEditingSupport_3=Warning
+ExtensionKindColumnEditingSupport_4=The extension is required. The extension cannot be a generalization.
+ExtensionKindColumnEditingSupport_5=Warning
+ExtensionKindColumnEditingSupport_6=Cannot change the extension kind to MultiGeneralization because stereotype is used to type a property elsewhere.
+ExtensionKindColumnEditingSupport_7=Warning
+ExtensionKindColumnEditingSupport_8=Cannot change the extension kind to Fusion because stereotype is used to type a property elsewhere.
+FacadeSpecificEditor_0=Use represented
+FacadeSpecificEditor_1=Select the Profiles:
+FacadeSpecificEditor_10=Open a real Profile
+FacadeSpecificEditor_11=The model you open is not a profile
+FacadeSpecificEditor_15=Load profile
+FacadeSpecificEditor_16=Open Profile
+FacadeSpecificEditor_17=Clarify extensions
+FacadeSpecificEditor_18=Define metamodel
+FacadeSpecificEditor_19=Create actual metamodel
+FacadeSpecificEditor_2=Profile selection
+FacadeSpecificEditor_21=Name:
+FacadeSpecificEditor_23=NSPrefix:
+FacadeSpecificEditor_25=NSURI:
+FacadeSpecificEditor_27=Generate Ecore metamodel and mapping
+FacadeSpecificEditor_28=Create preliminary metamodel
+FacadeSpecificEditor_29=Metaclass name
+FacadeSpecificEditor_30=To keep
+FacadeSpecificEditor_31=Alias
+FacadeSpecificEditor_32=Make it abstract
+FacadeSpecificEditor_33=Feature name
+FacadeSpecificEditor_34=To keep
+FacadeSpecificEditor_35=Alias
+FacadeSpecificEditor_36=Min
+FacadeSpecificEditor_37=Max
+FacadeSpecificEditor_38=Stereotype name
+FacadeSpecificEditor_39=Kind
+FacadeSpecificEditor_40=Applicable on this metaclass
+FacadeSpecificEditor_41=Stereotype
+FacadeSpecificEditor_42=Is compatible combination
+FacadeSpecificEditor_5=PrimitiveType issue
+FacadeSpecificEditor_6=PrimitiveType
+FacadeSpecificEditor_7=\ must be stereotype with Ecore::EDataType and instanceTypeName must be specified
+FacadeSpecificEditor_8=Required extension issue
+FacadeSpecificEditor_9=Required extension are not suppported yet.
+IsPossibleColumnEditingSupport_0=Cannot change possibility
+IsPossibleColumnEditingSupport_1=Cannot change because it contains a required metaclass in the combinations
+IsPossibleColumnEditingSupport_2=Updating stereotypes definitions
+MetamodelLabelProvider_8=Unknow
+MetamodelUtils_0=Don't know how to get fathers :
+MetamodelUtils_1=addMetaclass: didn't add because already represented :
+MetamodelUtils_10=Can't create properties for the type :
+MetamodelUtils_11=postProcessProperties: don't know the representingType for:
+MetamodelUtils_12=postProcessProperties: don't know the representingType for:
+MetamodelUtils_13=The kind of the represented element for the virtualProperty is unknown:
+MetamodelUtils_2=Can't create literal for the type :
+MetamodelUtils_3=Can't create parameters for the operation :
+MetamodelUtils_4=addStereotypeInterface: didn't add because already represented :
+MetamodelUtils_5=Stereotype properties typed by a Class (that are not part of UML metamodel) are not supported yet
+MetamodelUtils_6=Can't process the type :
+MetamodelUtils_7=Can't process the element for property :
+MetamodelUtils_8=addProperty: didn't add because already represented :
+MetamodelUtils_9=Stereotype is already applied to a parent
+PropertiesMaxColumnEdintingSupport_0=Problem with upper bound
+PropertiesMaxColumnEdintingSupport_1=Custom upper bound must be <=
+PropertiesMaxColumnEdintingSupport_2=Problem with upper bound
+PropertiesMaxColumnEdintingSupport_3=Upper bound must be an between [-1 and +inf[
+PropertiesMaxColumnEdintingSupport_4=Problem with upper bound
+PropertiesMaxColumnEdintingSupport_5=Lower bound must be an integer.
+PropertiesMinColumnEdintingSupport_0=Problem with lower bound
+PropertiesMinColumnEdintingSupport_1=Custom lower bound must be >=
+PropertiesMinColumnEdintingSupport_2=Problem with upper bound
+PropertiesMinColumnEdintingSupport_3=Lower bound must be an between [-1 and +inf[
+PropertiesMinColumnEdintingSupport_4=Problem with lower bound
+PropertiesMinColumnEdintingSupport_5=Lower bound must be an integer.
+PropertiesToKeepColumnEditingSupport_0=Cannot unkeep this element
+PropertiesToKeepColumnEditingSupport_1=This element cannot be unkept because it is has lower bound > 0.
+PropertiesToKeepColumnEditingSupport_2=Cannot unkeep this element
+PropertiesToKeepColumnEditingSupport_3=This element cannot be unkept because it is has lower bound > 0.
+StereotypeIncompatibilityColumnEditingSupport_0=Problem to find combinaison CompatibleIntoIncompatible
+StereotypeIncompatibilityColumnEditingSupport_1=Problem to find combinaison ImcompatibleIntoCompatible
+StereotypeIncompatibilityColumnEditingSupport_2=Updating stereotypes definitions
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/CreatePreliminaryMetamodelListener.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/CreatePreliminaryMetamodelListener.java
index 04e81f01547..4e8a2cb7b0c 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/CreatePreliminaryMetamodelListener.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/CreatePreliminaryMetamodelListener.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.metamodel;
import java.util.ArrayList;
@@ -42,8 +55,11 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
this.editingDomain = editingDomain;
}
-
-
+ /**
+ * Interpret the extension as a Generalization and therefore generate the metaclass accordingly
+ *
+ * @param extensionDefinition
+ */
protected void initGeneralization(ExtensionDefinition extensionDefinition) {
BaseMetaclass baseMetaclass = MetamodelUtils.findActualBaseMetaclass(extensionDefinition);
@@ -52,7 +68,6 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
ArrayList<BaseMetaclass> stereotypes = new ArrayList<BaseMetaclass>();
stereotypes.add(baseMetaclass);
MetamodelUtils.addMetaclass(StereotypeUtils.findBase(extensionDefinition), stereotypes, extensionDefinition.getStereotype().getName(), facade, editingDomain);
- // MetamodelUtils.addMetaclass(extensionDefinition.getStereotype(), stereotypes, extensionDefinition.getStereotype().getName(), facade, editingDomain);
if(MetamodelUtils.hasSiblings(extensionDefinition)) {
//Create a Stereotype interface
@@ -60,14 +75,15 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
}
} else {
- System.err.println("initGeneralization: Error can't find actual base metaclass : " + extensionDefinition.getStereotype());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info("initGeneralization: Error can't find actual base metaclass : " + extensionDefinition.getStereotype());
}
-
-
}
-
-
+ /**
+ * Interpret the extension as an Association and therefore generate the metaclass accordingly
+ *
+ * @param extensionDefinition
+ */
protected void initAssociation(ExtensionDefinition extensionDefinition) {
BaseMetaclass baseMetaclass = MetamodelUtils.findActualBaseMetaclass(extensionDefinition);
@@ -77,14 +93,13 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
String name = ((EClass)baseMetaclass.getBase()).getName() + "_" + baseMetaclass.getExtensionDefinition().getStereotype().getName();
MetamodelUtils.addMetaclass(baseMetaclass.getBase(), stereotypes, name, facade, editingDomain);
- // MetamodelUtils.addMetaclass(extensionDefinition.getStereotype(), stereotypes, name, facade, editingDomain);
//Create property in the virtualmetaclass that represents the base metaclass to facilitate navigation
if(MetamodelUtils.isActualExtensionDefinition(extensionDefinition)) {
//Find the base metaclass
VirtualMetaclass virtualMetaclass = MetamodelUtils.findMetaclassWithNoRealStereoThatMatch((EClass)baseMetaclass.getBase(), facade);
//Add the property
- MetamodelUtils.addProperty(virtualMetaclass, extensionDefinition.getExtension().getMemberEnds().get(0), name, facade, editingDomain);
+ MetamodelUtils.addProperty(virtualMetaclass, extensionDefinition.getExtension().getMemberEnds().get(0), extensionDefinition.getExtension().getMemberEnds().get(0).getType(), name, facade, editingDomain);
}
if(MetamodelUtils.hasSiblings(extensionDefinition)) {
@@ -92,31 +107,17 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
MetamodelUtils.addStereotypeInterface(baseMetaclass.getExtensionDefinition().getStereotype(), baseMetaclass.getExtensionDefinition().getStereotype().getName() + "_applied", facade, editingDomain);
}
}
-
- // for(BaseMetaclass baseMetaclass : extensionDefinition.getBaseMetaclasses()) {
- //
- // if(baseMetaclass.getBase() == StereotypeUtils.findEClass(baseMetaclass.getExtensionDefinition().getExtension().getMetaclass())) {
- // ArrayList<BaseMetaclass> stereotypes = new ArrayList<BaseMetaclass>();
- // stereotypes.add(baseMetaclass);
- // String name = ((EClass)baseMetaclass.getBase()).getName() + "_" + baseMetaclass.getExtensionDefinition().getStereotype().getName();
- //
- // MetamodelUtils.addMetaclass(baseMetaclass.getBase(), stereotypes, name, facade, editingDomain);
- //
- // if(baseMetaclass.getExtensionDefinition().getStereotype().getGenerals().isEmpty()) {
- // VirtualMetaclass virtualMetaclass = MetamodelUtils.findMetaclassWithNoRealStereoThatMatch((EClass)baseMetaclass.getBase(), facade);
- // MetamodelUtils.addProperty(virtualMetaclass, baseMetaclass.getExtensionDefinition().getExtension(), name, facade, editingDomain);
- // }
- // }
- // }
-
}
+ /**
+ * Interpret the extension as a MultiGeneralization and therefore generate the metaclass accordingly
+ *
+ * @param extensionDefinition
+ */
protected void initMultiGeneralization(ExtensionDefinition extensionDefinition) {
// Prepare possible METACLASS combinations
HashMap<EClass, ArrayList<Combination>> possibleMetaclasses = new HashMap<EClass, ArrayList<Combination>>();
-
-
for(BaseMetaclass baseMetaclass : extensionDefinition.getBaseMetaclasses()) {
ArrayList<Combination> possibleCombinations = new ArrayList<Combination>();
@@ -136,7 +137,6 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
// I take the compatible combination
for(Combination possibleCombination : baseMetaclass.getCompatibleStereotypes()) {
-
Combination combination = ExtensiondefinitionFactory.eINSTANCE.createCombination();
combination.getMembers().add(baseMetaclass);
combination.getMembers().addAll(possibleCombination.getMembers());
@@ -150,8 +150,6 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
}
-
-
// Generate the possible METACLASS combinations
for(EClass representedElement : possibleMetaclasses.keySet()) {
for(Combination combination : possibleMetaclasses.get(representedElement)) {
@@ -168,8 +166,11 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
}
}
-
-
+ /**
+ * Interpret the extension as a Fusion and therefore generate the metaclass accordingly
+ *
+ * @param extensionDefinition
+ */
protected void initFusion(ExtensionDefinition extensionDefinition) {
if(extensionDefinition.getStereotype().getGenerals().isEmpty()) {
@@ -192,7 +193,9 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
}
}
-
+ /**
+ * Generate the prelimenary metamodel on the basis of the clarification of the extensions
+ */
protected void initMetamodel() {
// Generate for the UML metamodel
@@ -212,7 +215,7 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
}
}
- initStereotypeInterfaces();
+ // initStereotypeInterfaces();
initAbstractMetaclasses(MetamodelUtils.getOnlyVirtualMetaclasses(facade.getVirtualmetamodel().getVirtualClassifiers()));
@@ -222,45 +225,45 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
MetamodelUtils.createGeneralizations(facade, editingDomain);
- // // Create a metaclass for each required stereotype that is defined as METACLASS
- // for (ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
- // if (extensionDefinition.getKind() == ExtensionDefinitionKind.METACLASS) {
- // // if (extensionDefinition.getExtension().isRequired()) {
- // for (BaseMetaclass baseMetaclass : extensionDefinition.getBaseMetaclasses()) {
- // String name = ((ENamedElement) baseMetaclass.getMetaclass()).getName() + "_" + baseMetaclass.getExtensionDefinition().getStereotype().getName();
- // List<BaseMetaclass> stereotypes = new ArrayList<BaseMetaclass>();
- // stereotypes.add(baseMetaclass);
- // MetamodelCreationUtils.addMetaclass(baseMetaclass.getMetaclass(), check, true, stereotypes, name, facade, editingDomain);
- // }
- // // }
- // }
- // }
-
- }
+ MetamodelUtils.postProcessTypedElements(facade, editingDomain);
- private void initStereotypeInterfaces() {
- // for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
- // if(classifier instanceof VirtualMetaclass) {
- // if(!MetamodelUtils.onlyOneKind(((VirtualMetaclass)classifier).getAppliedStereotypes())) {
- // List<Stereotype> stereotypes = MetamodelUtils.getStereotypesFromBaseMetaclass(((VirtualMetaclass)classifier).getAppliedStereotypes());
- // if(stereotypes.size() == 1) {
- //
- // } else {
- // System.err.println("initStereotypeInterfaces: Error with number of different applied stereotypes");
- // }
- // }
- // }
- // }
+ MetamodelUtils.postProcessUseRepresented(facade, editingDomain);
}
-
-
+ // private void initStereotypeInterfaces() {
+ // for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
+ // if(classifier instanceof VirtualMetaclass) {
+ // if(!MetamodelUtils.onlyOneKind(((VirtualMetaclass)classifier).getAppliedStereotypes())) {
+ // List<Stereotype> stereotypes = MetamodelUtils.getStereotypesFromBaseMetaclass(((VirtualMetaclass)classifier).getAppliedStereotypes());
+ // if(stereotypes.size() == 1) {
+ //
+ // } else {
+ // org.eclipse.papyrus.facadeSpecificEditor.Activator.log.info("initStereotypeInterfaces: Error with number of different applied stereotypes");
+ // }
+ // }
+ // }
+ // }
+ // }
+
+ /**
+ * Set the isAbstract value each virtualMetaclass
+ *
+ * @param list
+ */
protected void initAbstractMetaclasses(List<VirtualMetaclass> list) {
for(VirtualMetaclass metaclass : list) {
metaclass.setAbstract(MetamodelUtils.mustBeAbstract(metaclass));
}
}
+ /**
+ * Generate a name that is meaningful using a combination of applied stereotypes
+ *
+ * @param representedElement
+ * @param combination
+ * @return
+ * a meaningful name
+ */
protected String createName(EClass representedElement, Combination combination) {
String name = representedElement.getName();
@@ -271,6 +274,11 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
return name;
}
+ /**
+ * Check whether two or more required stereotypes are defined as MULTI_GENERALIZATION on a unique base metaclass
+ *
+ * @return
+ */
protected boolean isFeasible() {
for(ExtensionDefinition extensionDefinition : facade.getExtensionDefinitions()) {
@@ -288,7 +296,7 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
for(EClass eClass : baseMetaclasses) {
if(baseMetaclasses2.contains(eClass)) {
- MessageDialog.openError(Display.getCurrent().getActiveShell(), "Cannot generate metamodel", "Two or more required stereotypes are defined as metaclass on " + eClass.getName() + ". \nYou must define only one as MultiGeneralization.");
+ MessageDialog.openError(Display.getCurrent().getActiveShell(), "Cannot generate metamodel", "Two or more required stereotypes are defined as MULTI_GENERALIZATION on " + eClass.getName() + ". \nYou must define only one as MultiGeneralization.");
return false;
}
}
@@ -304,6 +312,12 @@ public class CreatePreliminaryMetamodelListener extends MouseAdapter {
return true;
}
+ /**
+ *
+ * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
+ *
+ * @param e
+ */
@Override
public void mouseUp(MouseEvent e) {
if(isFeasible()) {
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/EcoreGenerator.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/EcoreGenerator.java
index 295fdb660d3..eb129a57f8c 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/EcoreGenerator.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/EcoreGenerator.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.metamodel;
import java.io.IOException;
@@ -11,6 +24,7 @@ import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.ui.dialogs.DiagnosticDialog;
import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAnnotation;
@@ -20,9 +34,12 @@ import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EParameter;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcoreFactory;
@@ -32,6 +49,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.Diagnostician;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.EcoreValidator;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -46,7 +64,10 @@ import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualEnum;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualLiteral;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetaclass;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualOperation;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualParameter;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualProperty;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.papyrus.facadeSpecificEditor.utils.StereotypeUtils;
import org.eclipse.papyrus.facademapping.FacadeMappping;
import org.eclipse.papyrus.facademapping.FacademappingFactory;
@@ -87,12 +108,11 @@ public class EcoreGenerator extends MouseAdapter {
protected HashMap<VirtualClassifier, EClassifier> processedClassifier;
- // protected HashMap<Stereotype, EClass> processedStereotype;
-
protected HashMap<VirtualProperty, EStructuralFeature> processedPropertyFeature;
protected static EPackage ecoreMetamodel = EcorePackage.eINSTANCE;
+
public EcoreGenerator(Facade facade, AdapterFactoryEditingDomain editingDomain) {
super();
this.facade = facade;
@@ -103,17 +123,21 @@ public class EcoreGenerator extends MouseAdapter {
processedClassifier = new HashMap<VirtualClassifier, EClassifier>();
generalizationProcessed = new HashSet<VirtualMetaclass>();
processedLiteral = new HashMap<VirtualLiteral, EObject>();
- // processedStereotype = new HashMap<Stereotype, EClass>();
processedPropertyFeature = new HashMap<VirtualProperty, EStructuralFeature>();
}
+ /**
+ * Helper method to create the Ecore file for the actual metamodel for the facade
+ *
+ * @return
+ * the root of the ecore metamodel
+ */
protected EObject createEcoreFile() {
URI ecoreURI = facade.eResource().getURI();
ecoreURI = ecoreURI.trimSegments(1);
- ecoreURI = ecoreURI.appendSegment(facade.getVirtualmetamodel().getName() + ".ecore");
+ ecoreURI = ecoreURI.appendSegment(facade.getVirtualmetamodel().getName() + ".ecore"); //$NON-NLS-1$
ResourceSet resourceSet = new ResourceSetImpl();
- // Resource resource = resourceSet.getResource(ecoreURI, true);
ecoreResource = resourceSet.createResource(ecoreURI);
ecoreResource.getContents().clear();
@@ -128,13 +152,18 @@ public class EcoreGenerator extends MouseAdapter {
return ecoreModel;
}
+ /**
+ * Helper method to create the mapping file between UML + profile and the facade metamodel
+ *
+ * @return
+ * the root of the mapping model
+ */
protected EObject createMappingFile() {
URI ecoreURI = facade.eResource().getURI();
ecoreURI = ecoreURI.trimSegments(1);
- ecoreURI = ecoreURI.appendSegment(facade.getVirtualmetamodel().getName() + ".facademapping");
+ ecoreURI = ecoreURI.appendSegment(facade.getVirtualmetamodel().getName() + ".facademapping"); //$NON-NLS-1$
ResourceSet resourceSet = new ResourceSetImpl();
- // Resource resource = resourceSet.getResource(ecoreURI, true);
mappingResource = resourceSet.createResource(ecoreURI);
mappingResource.getContents().clear();
@@ -146,20 +175,27 @@ public class EcoreGenerator extends MouseAdapter {
return mappingModel;
}
+ /**
+ * Helper method to save the the Ecore facade metamodel file and the the mapping model
+ */
protected void save() {
try {
Map<Object, Object> options = new HashMap<Object, Object>();
- options.put(XMLResource.OPTION_ENCODING, "UTF-8");
-
+ options.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$
ecoreResource.save(options);
-
mappingResource.save(options);
} catch (IOException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
}
}
+ /**
+ * Store a mapping in the mapping model
+ *
+ * @param element
+ * @param representingElement
+ * @param facadeMappingModel
+ */
protected void setRepresenting(VirtualElement element, EObject representingElement, FacadeMappping facadeMappingModel) {
if(element instanceof VirtualMetaclass) {
@@ -182,7 +218,7 @@ public class EcoreGenerator extends MouseAdapter {
} else if(MetamodelUtils.onlyOneKind(((VirtualMetaclass)element).getAppliedStereotypes(), ExtensionDefinitionKind.FUSION)) {
mappingToEdit.setKind(org.eclipse.papyrus.facademapping.ExtensionDefinitionKind.FUSION);
} else {
- System.err.println("setRepresenting : stereotypes are not only onekind on " + element.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_3 + element.getRepresentedElement());
}
mappingToEdit.setUmlElement(element.getRepresentedElement());
@@ -200,18 +236,18 @@ public class EcoreGenerator extends MouseAdapter {
mapping.setSpecificDomainElement(representingElement);
facadeMappingModel.getMappings().add(mapping);
-
-
-
- // SetCommand command = new SetCommand(editingDomain, element, FacadePackage.eINSTANCE.getVirtualElement_RepresentingElement(), representingElement);
- // editingDomain.getCommandStack().execute(command);
}
-
+ /**
+ * Create an EEnum from an VirtualEnum in the facade metamodel
+ *
+ * @param virtualEnum
+ * @param ecoreRoot
+ * @param facadeMappping
+ */
protected void createEnum(VirtualEnum virtualEnum, EPackage ecoreRoot, FacadeMappping facadeMappping) {
if(virtualEnum.getRepresentedElement() instanceof EEnum) {
-
EEnum enumeration = EcoreFactory.eINSTANCE.createEEnum();
enumeration.setName(virtualEnum.getAliasName());
@@ -225,7 +261,7 @@ public class EcoreGenerator extends MouseAdapter {
setRepresenting(literal, enumLiteral, facadeMappping);
processedLiteral.put(literal, enumLiteral);
} else {
- System.err.println("Litral : know the kind of enum literal : " + virtualEnum.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_4 + virtualEnum.getRepresentedElement());
}
}
@@ -249,7 +285,7 @@ public class EcoreGenerator extends MouseAdapter {
processedLiteral.put(literal, enumLiteral);
i++;
} else {
- System.err.println("Litral : Don't know the kind of enum literal : " + literal.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_5 + literal.getRepresentedElement());
}
}
@@ -257,10 +293,17 @@ public class EcoreGenerator extends MouseAdapter {
setRepresenting(virtualEnum, enumeration, facadeMappping);
processedClassifier.put(virtualEnum, enumeration);
} else {
- System.err.println("Enum : We don't know the kind of represented Element: " + virtualEnum.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_6 + virtualEnum.getRepresentedElement());
}
}
+ /**
+ * Create an EDatatype from an VirtualDatatype in the facade metamodel
+ *
+ * @param datatype
+ * @param ecoreRoot
+ * @param facadeMappping
+ */
protected void createDatatype(VirtualDatatype datatype, EPackage ecoreRoot, FacadeMappping facadeMappping) {
if(datatype.getRepresentedElement() instanceof EDataType) {
EDataType eDataType = EcoreFactory.eINSTANCE.createEDataType();
@@ -275,23 +318,29 @@ public class EcoreGenerator extends MouseAdapter {
EDataType eDataType = EcoreFactory.eINSTANCE.createEDataType();
eDataType.setName(datatype.getAliasName());
- Stereotype stereotype = ((PrimitiveType)datatype.getRepresentedElement()).getAppliedStereotype("Ecore::EDataType");
+ Stereotype stereotype = ((PrimitiveType)datatype.getRepresentedElement()).getAppliedStereotype("Ecore::EDataType"); //$NON-NLS-1$
if(stereotype != null) {
- Object value = ((PrimitiveType)datatype.getRepresentedElement()).getValue(stereotype, "instanceClassName");
+ Object value = ((PrimitiveType)datatype.getRepresentedElement()).getValue(stereotype, "instanceClassName"); //$NON-NLS-1$
if(value instanceof String) {
eDataType.setInstanceTypeName((String)value);
}
}
-
ecoreRoot.getEClassifiers().add(eDataType);
setRepresenting(datatype, eDataType, facadeMappping);
processedClassifier.put(datatype, eDataType);
} else {
- System.err.println("Datatype : We don't know the kind of represented Element: " + datatype.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_9 + datatype.getRepresentedElement());
}
}
+ /**
+ * Create an EClass from an VirtualMetaclass in the facade metamodel
+ *
+ * @param metaclass
+ * @param ecoreRoot
+ * @param facadeMappping
+ */
protected void createMetaclass(VirtualMetaclass metaclass, EPackage ecoreRoot, FacadeMappping facadeMappping) {
if(!processedClassifier.containsKey(metaclass)) {
@@ -306,34 +355,13 @@ public class EcoreGenerator extends MouseAdapter {
}
}
- // protected void processEOppositeStereotypeProperty(Property attrStereotype, EReference attrib, EClass representingStereotype, FacadeMappping facadeMappping) {
- // for(Property member : attrStereotype.getAssociation().getMemberEnds()) {
- // if(member != attrStereotype) {
- // if(!processedPropertyFeature.containsKey(member)) {
- // EReference attribOpposite = EcoreFactory.eINSTANCE.createEReference();
- // attribOpposite.setName(member.getName());
- // attribOpposite.setLowerBound(member.getLower());
- // attribOpposite.setUpperBound(member.getUpper());
- //
- // attribOpposite.setEType((EClassifier)processedClassifier.get(attrStereotype.getType()));
- //
- // representingStereotype.getEStructuralFeatures().add(attribOpposite);
- // updateRepresenting(attrStereotype, attribOpposite, facadeMappping);
- // processedPropertyFeature.put(attrStereotype, attribOpposite);
- //
- // attrib.setEOpposite(attribOpposite);
- // } else {
- // EStructuralFeature representingStereotrypeProperty = processedPropertyFeature.get(member);
- // if(representingStereotrypeProperty instanceof EReference) {
- // attrib.setEOpposite((EReference)representingStereotrypeProperty);
- // } else {
- // System.err.println("problem with kind of representingStereotrypeProperty : " + representingStereotrypeProperty);
- // }
- // }
- // }
- // }
- // }
-
+ /**
+ * Add a boolean attribute to a representingElement in the facade metamodel
+ *
+ * @param virtualProperty
+ * @param representingElement
+ * @param facadeMappping
+ */
protected void createBooleanAttribute(VirtualProperty virtualProperty, EClass representingElement, FacadeMappping facadeMappping) {
EAttribute attrib = EcoreFactory.eINSTANCE.createEAttribute();
attrib.setName(virtualProperty.getAliasName());
@@ -343,10 +371,16 @@ public class EcoreGenerator extends MouseAdapter {
representingElement.getEStructuralFeatures().add(attrib);
setRepresenting(virtualProperty, attrib, facadeMappping);
- // updateRepresenting(property, attrib, facadeMappping);
processedPropertyFeature.put(virtualProperty, attrib);
}
+ /**
+ * Add a String attribute to a representingElement in the facade metamodel
+ *
+ * @param virtualProperty
+ * @param representingElement
+ * @param facadeMappping
+ */
protected void createStringAttribute(VirtualProperty virtualProperty, EClass representingElement, FacadeMappping facadeMappping) {
EAttribute attrib = EcoreFactory.eINSTANCE.createEAttribute();
attrib.setName(virtualProperty.getAliasName());
@@ -356,10 +390,16 @@ public class EcoreGenerator extends MouseAdapter {
representingElement.getEStructuralFeatures().add(attrib);
setRepresenting(virtualProperty, attrib, facadeMappping);
- // updateRepresenting(property, attrib, facadeMappping);
processedPropertyFeature.put(virtualProperty, attrib);
}
+ /**
+ * Add an integer attribute to a representingElement in the facade metamodel
+ *
+ * @param virtualProperty
+ * @param representingElement
+ * @param facadeMappping
+ */
protected void createIntegerAttribute(VirtualProperty virtualProperty, EClass representingElement, FacadeMappping facadeMappping) {
EAttribute attrib = EcoreFactory.eINSTANCE.createEAttribute();
attrib.setName(virtualProperty.getAliasName());
@@ -369,14 +409,27 @@ public class EcoreGenerator extends MouseAdapter {
representingElement.getEStructuralFeatures().add(attrib);
setRepresenting(virtualProperty, attrib, facadeMappping);
- // updateRepresenting(property, attrib, facadeMappping);
processedPropertyFeature.put(virtualProperty, attrib);
}
+ /**
+ * Add an unlimitedNatural attribute to a representingElement in the facade metamodel
+ *
+ * @param virtualProperty
+ * @param representingElement
+ * @param facadeMappping
+ */
protected void createUnlimitedNaturalAttribute(VirtualProperty virtualProperty, EClass representingElement, FacadeMappping facadeMappping) {
createIntegerAttribute(virtualProperty, representingElement, facadeMappping);
}
+ /**
+ * Add a real attribute to a representingElement in the facade metamodel
+ *
+ * @param virtualProperty
+ * @param representingElement
+ * @param facadeMappping
+ */
protected void createRealAttribute(VirtualProperty virtualProperty, EClass representingElement, FacadeMappping facadeMappping) {
EAttribute attrib = EcoreFactory.eINSTANCE.createEAttribute();
attrib.setName(virtualProperty.getAliasName());
@@ -386,15 +439,20 @@ public class EcoreGenerator extends MouseAdapter {
representingElement.getEStructuralFeatures().add(attrib);
setRepresenting(virtualProperty, attrib, facadeMappping);
- // updateRepresenting(property, attrib, facadeMappping);
processedPropertyFeature.put(virtualProperty, attrib);
}
+ /**
+ * Generate a eAttribute of eReference in the facade metamodel to represent a virtualProperty
+ *
+ * @param virtualProperty
+ * @param representingElement
+ * @param facadeMappping
+ */
protected void processPropertyFeature(VirtualProperty virtualProperty, EClass representingElement, FacadeMappping facadeMappping) {
if(!processedPropertyFeature.containsKey(virtualProperty)) {
Property property = (Property)virtualProperty.getRepresentedElement();
- // if(!property.getName().startsWith("base_")) {
EObject eType = StereotypeUtils.findEClass((Classifier)((Property)property).getType());
@@ -409,20 +467,6 @@ public class EcoreGenerator extends MouseAdapter {
} else if(eType == TypesPackage.eINSTANCE.getReal()) {
createRealAttribute(virtualProperty, representingElement, facadeMappping);
} else {
-
- // VirtualClassifier typeVirtualMetaclass;
- // EClassifier representingType = null;
- // if(property instanceof ExtensionEnd) {
- // EClassifier eClass = StereotypeUtils.findEClass((Classifier)property.getType());
- // if(eClass != null) {
- // typeVirtualMetaclass = MetamodelUtils.findClassifierThatMatch(eClass, facade);
- // representingType = processedClassifier.get(typeVirtualMetaclass);
- // }
- // } else {
- // typeVirtualMetaclass = MetamodelUtils.findClassifierThatMatch(property.getType(), facade);
- // representingType = processedClassifier.get(typeVirtualMetaclass);
- // }
-
EClassifier representingType = null;
if(eType != null) {
if(eType instanceof EClassifier) {
@@ -438,18 +482,6 @@ public class EcoreGenerator extends MouseAdapter {
representingType = processedClassifier.get(typeVirtualMetaclass);
}
-
-
- // EClassifier representingType = null;
- // EClassifier eClass = StereotypeUtils.findEClass((Classifier)property.getType());
- // if(eClass != null) {
- // VirtualClassifier typeVirtualMetaclass = MetamodelUtils.findClassifierThatMatch(eClass, facade);
- // representingType = processedClassifier.get(typeVirtualMetaclass);
- // }
-
- // VirtualClassifier typeVirtualMetaclass = MetamodelUtils.findClassifierThatMatch(property.getType(), facade);
- // EClassifier representingType = processedClassifier.get(typeVirtualMetaclass);
-
if(representingType != null) {
EStructuralFeature attrib;
if(representingType instanceof EDataType) {
@@ -483,10 +515,10 @@ public class EcoreGenerator extends MouseAdapter {
if(property.getAssociation().getMemberEnds().size() == 2) {
// Do nothing
} else {
- System.err.println("Don't know how to handle association because wrong number of member end : " + property.getAssociation());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_10 + property.getAssociation());
}
} else {
- System.err.println("Don't know how to handle association because wrong number of owned member : " + property.getAssociation());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_11 + property.getAssociation());
}
}
@@ -497,114 +529,23 @@ public class EcoreGenerator extends MouseAdapter {
// updateRepresenting(property, attrib, facadeMappping);
processedPropertyFeature.put(virtualProperty, attrib);
} else {
- System.err.println("Property : Type not found for : " + property);
- System.err.println("Property : Type not found for : " + property.getType());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_12 + property);
}
-
}
- // else if(processedStereotype.containsValue(propertyElement.getType())) {
- // EReference attrib = EcoreFactory.eINSTANCE.createEReference();
- // attrib.setName(propertyElement.getName());
- // attrib.setLowerBound(propertyElement.getLower());
- // attrib.setUpperBound(propertyElement.getUpper());
- //
- // if(propertyElement.getAssociation() != null) {
- // if(propertyElement.getAssociation().getOwnedEnds().size() == 1) {
- // if(propertyElement.getAssociation().getMemberEnds().size() == 2) {
- // // Do nothing
- // } else {
- // System.err.println("Don't know how to handle association because wrong number of member end : " + propertyElement.getAssociation());
- // }
- // } else {
- // System.err.println("Don't know how to handle association because wrong number of owned member : " + propertyElement.getAssociation());
- // }
- // }
- //
- // attrib.setEType((EClassifier)processedStereotype.get(propertyElement.getType()));
- //
- // representingElement.getEStructuralFeatures().add(attrib);
- // updateRepresenting(propertyElement, attrib, facadeMappping);
- // processedPropertyFeature.put(propertyElement, attrib);
- // }
- // else {
- // System.err.println("problem to find representing type for property : " + propertyElement);
- // System.err.println("\t-> " + propertyElement.getType());
- // // for(EObject value : processedClassifier.values()) {
- // // System.err.println("\t\t-" + value);
- // // }
- // }
-
- // }
} else {
- System.err.println("Virtual property already processed: " + virtualProperty);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_13 + virtualProperty);
}
}
- // protected void createAppliedStereotypeElement(EPackage root, FacadeMappping facadeMappping) {
- // HashSet<Stereotype> stereotypes = new HashSet<Stereotype>();
- //
- // for(VirtualMetaclass metaclass : MetamodelUtils.getOnlyVirtualMetaclasses(facade.getVirtualmetamodel().getVirtualClassifiers())) {
- // if(!metaclass.getAppliedStereotypes().isEmpty()) {
- // for(BaseMetaclass baseMetaclass : metaclass.getAppliedStereotypes()) {
- // if(baseMetaclass.getExtensionDefinition().getKind() == ExtensionDefinitionKind.MULTI_GENERALIZATION) {
- // stereotypes.add(baseMetaclass.getExtensionDefinition().getStereotype());
- // }
- // }
- // }
- // }
- //
- // // Create metaclass
- // for(Stereotype stereotype : stereotypes) {
- // EClass eClass = EcoreFactory.eINSTANCE.createEClass();
- // eClass.setName(stereotype.getName() + "_applied");
- // eClass.setAbstract(true);
- //
- // root.getEClassifiers().add(eClass);
- // processedStereotype.put(stereotype, eClass);
- // }
- //
- // // Create features
- // for(Stereotype stereotype : processedStereotype.keySet()) {
- // EClass representingStereotype = processedStereotype.get(stereotype);
- //
- // if(representingStereotype != null) {
- //
- // for(Property attrStereotype : stereotype.getAttributes()) {
- // processStereotypeFeature(attrStereotype, representingStereotype, facadeMappping);
- // }
- //
- // } else {
- // System.err.println("problem to find representing appliedStereotype for : " + stereotype);
- // }
- // }
- //
- // }
-
- // protected void updateRepresenting(Property attrStereotype, EStructuralFeature attrib, FacadeMappping facadeMapping) {
- // boolean found = false;
- // for(VirtualMetaclass virtualMetaclass : MetamodelUtils.getOnlyVirtualMetaclasses(facade.getVirtualmetamodel().getVirtualClassifiers())) {
- // for(VirtualProperty virtualProperty : virtualMetaclass.getProperties()) {
- // if(virtualProperty.getRepresentedElement() == attrStereotype) {
- // found = true;
- // // setRepresenting(virtualProperty, attrib, facadeMappping,true);
- // for(Mapping mapping : facadeMapping.getMappings()) {
- // if(virtualProperty.getRepresentedElement() == mapping.getUmlElement()) {
- // mapping.setUmlElement(virtualProperty.getRepresentedElement());
- // mapping.setSpecificDomainElement(attrib);
- // break;
- // }
- // }
- // }
- // }
- // }
- //
- // if(!found) {
- // System.err.println("Problem to find : " + attrStereotype);
- // }
- // }
-
+ /**
+ * Create the generalization relationships of a representingElement of a virtualMetaclass
+ *
+ * @param metaclass
+ * @param root
+ * @param facadeMappping
+ */
protected void createGeneralisations(VirtualMetaclass metaclass, EPackage root, FacadeMappping facadeMappping) {
if(!generalizationProcessed.contains(metaclass)) {
@@ -620,29 +561,33 @@ public class EcoreGenerator extends MouseAdapter {
if(elementReprensentingFather instanceof EClass) {
((EClass)representingElement).getESuperTypes().add((EClass)elementReprensentingFather);
} else {
- System.err.println("Problem with elementReprensentingFather kind: " + elementReprensentingFather);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_14 + elementReprensentingFather);
}
} else {
- System.err.println("Problem with representingElement kind: " + representingElement);
-
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_15 + representingElement);
}
}
-
} else {
- System.err.println("Problem with metaclass generalization generation for : " + metaclass);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_16 + metaclass);
}
} else {
- System.err.println("Generalization already processed: " + metaclass);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_17 + metaclass);
}
}
+ /**
+ * Generate the properties in the facade metamodel from virtualmetaclass
+ *
+ * @param metaclass
+ * @param root
+ * @param facadeMappping
+ */
protected void createProperties(VirtualMetaclass metaclass, EPackage root, FacadeMappping facadeMappping) {
if(!propertiesProcessed.contains(metaclass)) {
EObject representingElement = processedClassifier.get(metaclass);
if(representingElement != null) {
-
propertiesProcessed.add(metaclass);
// Create features
@@ -663,7 +608,7 @@ public class EcoreGenerator extends MouseAdapter {
setRepresenting(property, attrib, facadeMappping);
processedProperty.put(property, attrib);
} else {
- System.err.println("EAttribute : Type not found for : " + property);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_18 + property);
}
} else if(property.getRepresentedElement() instanceof EReference) {
VirtualClassifier typeVirtualMetaclass = MetamodelUtils.findClassifierThatMatch(((EReference)property.getRepresentedElement()).getEType(), facade);
@@ -678,71 +623,97 @@ public class EcoreGenerator extends MouseAdapter {
setRepresenting(property, attrib, facadeMappping);
processedProperty.put(property, attrib);
} else {
- System.err.println("EReference : Type not found for : " + property);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_19 + property);
}
- }
- // else if(property.getRepresentedElement() instanceof Extension) {
- // VirtualMetaclass associationStereotypeVirtualMetaclass = MetamodelUtils.findMetaclassThatMatch((EClass)StereotypeUtils.findEClass(((Extension)property.getRepresentedElement()).getMetaclass()), ((Extension)property.getRepresentedElement()).getStereotype(), facade);
- // EObject representingAssociationStereotype = processedClassifier.get(associationStereotypeVirtualMetaclass);
- // if(representingAssociationStereotype != null) {
- //
- // // The feature
- // EReference attrib = EcoreFactory.eINSTANCE.createEReference();
- // attrib.setName(property.getAliasName());
- // attrib.setContainment(true);
- // attrib.setEType((EClassifier)representingAssociationStereotype);
- // if(((Extension)property.getRepresentedElement()).isRequired()) {
- // attrib.setLowerBound(1);
- // } else {
- // attrib.setLowerBound(0);
- // }
- // attrib.setUpperBound(1);
- //
- // // And the opposite
- // EReference attribOpposite = EcoreFactory.eINSTANCE.createEReference();
- // attribOpposite.setName("base_" + ((Extension)property.getRepresentedElement()).getMetaclass().getName());
- //
- // attribOpposite.setEType((EClassifier)representingElement);
- // attribOpposite.setLowerBound(1);
- // attribOpposite.setUpperBound(1);
- //
- // ((EClass)representingAssociationStereotype).getEStructuralFeatures().add(attribOpposite);
- // setRepresenting(property, attribOpposite, facadeMappping);
- // processedProperty.put(property, attribOpposite);
- //
- // ((EClass)representingElement).getEStructuralFeatures().add(attrib);
- // setRepresenting(property, attrib, facadeMappping);
- // processedProperty.put(property, attrib);
- //
- // attrib.setEOpposite(attribOpposite);
- // attribOpposite.setEOpposite(attrib);
- //
- // } else {
- // System.err.println("Type not found for : " + property);
- // }
-
- // }
- else if(property.getRepresentedElement() instanceof Property) {
+ } else if(property.getRepresentedElement() instanceof Property) {
processPropertyFeature(property, (EClass)representingElement, facadeMappping);
} else {
- System.err.println("We don't know the kind of represented Property: " + property.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_20 + property.getRepresentedElement());
}
}
}
} else {
- System.err.println("Problem of type for metaclass properties generation for : " + metaclass);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_21 + metaclass);
}
} else {
- System.err.println("Problem with metaclass properties generation for : " + metaclass);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_22 + metaclass);
}
} else {
- System.err.println("Properties already processed: " + metaclass);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_23 + metaclass);
}
}
- protected EReference findEOpposite(EReference eOpposite) {
- VirtualMetaclass oppositeTypeVirtualMetaclass = MetamodelUtils.findMetaclassWithNoRealStereoThatMatch((EClassifier)eOpposite.eContainer(), facade);
+ /**
+ * Generate the operations in the facade metamodel from virtualmetaclass
+ *
+ * @param metaclass
+ * @param root
+ * @param facadeMappping
+ */
+ protected void createOperations(VirtualMetaclass metaclass, EPackage root, FacadeMappping facadeMappping) {
+ for(VirtualOperation virtualOperation : metaclass.getOperations()) {
+ if(virtualOperation.isKept()) {
+ EClassifier representing = processedClassifier.get(metaclass);
+
+ if(representing instanceof EClass) {
+ if(virtualOperation.getRepresentedElement() instanceof EOperation) {
+ EOperation eOperation = (EOperation)EcoreUtil.copy(virtualOperation.getRepresentedElement());
+ eOperation.getEParameters().clear();
+ eOperation.setName(virtualOperation.getAliasName());
+ ((EClass)representing).getEOperations().add(eOperation);
+
+ setRepresenting(virtualOperation, eOperation, facadeMappping);
+
+ if(eOperation.getEType() != null) {
+ if(eOperation.getEType().getEPackage() == UMLPackage.eINSTANCE || eOperation.getEType().getEPackage() == TypesPackage.eINSTANCE) {
+ VirtualClassifier virtualClassifier = MetamodelUtils.findClassifierThatMatch(eOperation.getEType(), facade);
+ if(virtualClassifier != null) {
+ eOperation.setEType(processedClassifier.get(virtualClassifier));
+ } else {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_24 + eOperation.getEType());
+ }
+ }
+ }
+
+ for(VirtualParameter virtualParameter : virtualOperation.getParameters()) {
+ EParameter eParameter = (EParameter)EcoreUtil.copy(virtualParameter.getRepresentedElement());
+
+ eParameter.setName(virtualParameter.getAliasName());
+ eParameter.setLowerBound(virtualParameter.getLower());
+ eParameter.setUpperBound(virtualParameter.getUpper());
+ setRepresenting(virtualParameter, eParameter, facadeMappping);
+ if(eParameter.getEType() != null) {
+ if(eParameter.getEType().getEPackage() == UMLPackage.eINSTANCE || eParameter.getEType().getEPackage() == TypesPackage.eINSTANCE) {
+ VirtualClassifier virtualClassifier = MetamodelUtils.findClassifierThatMatch(eParameter.getEType(), facade);
+ if(virtualClassifier != null) {
+ eParameter.setEType(processedClassifier.get(virtualClassifier));
+ } else {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_25 + eOperation.getEType());
+ }
+ }
+ }
+ eOperation.getEParameters().add(eParameter);
+ }
+
+ EList<EAnnotation> annotation = ((EModelElement)virtualOperation.getRepresentedElement()).getEAnnotations();
+ for(EAnnotation eAnnotation : annotation) {
+ eOperation.getEAnnotations().add(EcoreUtil.copy(eAnnotation));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Find the representing eReference that is the eOpposite of a eReference
+ *
+ * @param reference
+ * @return
+ */
+ protected EReference findEOpposite(EReference reference) {
+ VirtualMetaclass oppositeTypeVirtualMetaclass = MetamodelUtils.findMetaclassWithNoRealStereoThatMatch((EClassifier)reference.eContainer(), facade);
VirtualProperty oppositeVirtualProperty = null;
@@ -751,14 +722,14 @@ public class EcoreGenerator extends MouseAdapter {
EObject virtualPropertyRepresentedElement = virtualProperty.getRepresentedElement();
if(virtualPropertyRepresentedElement instanceof ENamedElement) {
- if(((ENamedElement)virtualPropertyRepresentedElement).getName().equals(eOpposite.getName())) {
+ if(((ENamedElement)virtualPropertyRepresentedElement).getName().equals(reference.getName())) {
oppositeVirtualProperty = virtualProperty;
break;
}
} else if(virtualPropertyRepresentedElement instanceof ExtensionEnd) {
} else {
- System.err.println("Don't know kind oppositeVirtualProperty : " + virtualPropertyRepresentedElement);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_26 + virtualPropertyRepresentedElement);
}
}
@@ -774,6 +745,13 @@ public class EcoreGenerator extends MouseAdapter {
return null;
}
+ /**
+ * Find the facade element that represents a umlElement
+ *
+ * @param umlElement
+ * @param facadeMappping
+ * @return
+ */
protected EObject findRepresenting(EObject umlElement, FacadeMappping facadeMappping) {
for(Mapping mapping : facadeMappping.getMappings()) {
if(mapping.getUmlElement() == umlElement) {
@@ -783,6 +761,12 @@ public class EcoreGenerator extends MouseAdapter {
return null;
}
+ /**
+ * Update the eOpposite among eReferences in the facade metamodel
+ *
+ * @param root
+ * @param facadeMappping
+ */
protected void processEOpposites(EPackage root, FacadeMappping facadeMappping) {
TreeIterator<EObject> it = root.eAllContents();
while(it.hasNext()) {
@@ -793,16 +777,11 @@ public class EcoreGenerator extends MouseAdapter {
EReference eOpposite = reference.getEOpposite();
if(eOpposite != null) {
- // if(!attrib.getName().startsWith("base_")) {
- // if(!eOpposite.getName().startsWith("base_")) {
EReference representingEOpposite = findEOpposite(eOpposite);
if(representingEOpposite == null) {
- System.err.println("Warning : Problem to update eopposite : " + eOpposite);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_27 + eOpposite);
}
reference.setEOpposite(representingEOpposite);
-
- // }
- // }
} else {
for(Mapping mapping : facadeMappping.getMappings()) {
if(mapping.getSpecificDomainElement() == eObject) {
@@ -821,13 +800,14 @@ public class EcoreGenerator extends MouseAdapter {
}
}
}
- // else if (eObject instanceof EAnnotation) {
- // EcoreUtil.remove(eObject);
- // }
-
}
}
+ /**
+ * Copy significant EAnnotations from represented element to representing elements in the facade metamodel
+ *
+ * @param root
+ */
protected void processEAnnotations(EPackage root) {
TreeIterator<EObject> it = root.eAllContents();
while(it.hasNext()) {
@@ -835,7 +815,7 @@ public class EcoreGenerator extends MouseAdapter {
if(eObject instanceof EAnnotation) {
String source = ((EAnnotation)eObject).getSource();
- if(source.equals("subsets") || source.equals("redefines")) {
+ if(source.equals("subsets") || source.equals("redefines")) { //$NON-NLS-1$ //$NON-NLS-2$
ArrayList<EObject> newList = new ArrayList<EObject>();
for(EObject reference : ((EAnnotation)eObject).getReferences()) {
@@ -849,11 +829,11 @@ public class EcoreGenerator extends MouseAdapter {
if(representing != null) {
newList.add(representing);
} else {
- System.err.println("processEAnnotations: couldn't find representing for : " + correspondingVirtualProperty);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_30 + correspondingVirtualProperty);
}
}
} else {
- System.err.println("processEAnnotations: couldn't find correspondingVirtualMetaclass for : " + reference);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_31 + reference);
}
}
@@ -864,23 +844,28 @@ public class EcoreGenerator extends MouseAdapter {
}
}
+ /**
+ *
+ * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
+ *
+ * @param event
+ */
@Override
public void mouseUp(MouseEvent event) {
- if(!facade.getVirtualmetamodel().getName().equals("") && !facade.getVirtualmetamodel().getNsPrefix().equals("") && !facade.getVirtualmetamodel().getNsURI().equals("")) {
+ if(!facade.getVirtualmetamodel().getName().equals("") && !facade.getVirtualmetamodel().getNsPrefix().equals("") && !facade.getVirtualmetamodel().getNsURI().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
try {
dialog.run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
- monitor.beginTask("Generate ecore metamodel", IProgressMonitor.UNKNOWN);
+ monitor.beginTask(Messages.EcoreGenerator_35, IProgressMonitor.UNKNOWN);
propertiesProcessed.clear();
generalizationProcessed.clear();
processedProperty.clear();
processedLiteral.clear();
processedClassifier.clear();
- // processedStereotype.clear();
processedPropertyFeature.clear();
// Create files
@@ -895,68 +880,68 @@ public class EcoreGenerator extends MouseAdapter {
// Create metaclasses first
for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
if(classifier.isKept()) {
- if(classifier instanceof VirtualMetaclass) {
- createMetaclass((VirtualMetaclass)classifier, root, facadeMappping);
- } else if(classifier instanceof VirtualEnum) {
- createEnum((VirtualEnum)classifier, root, facadeMappping);
- } else if(classifier instanceof VirtualDatatype) {
- createDatatype((VirtualDatatype)classifier, root, facadeMappping);
- } else {
- System.err.println("I don't know the kind of that classifier");;
+ if(!classifier.isUseRepresented()) {
+ if(classifier instanceof VirtualMetaclass) {
+ createMetaclass((VirtualMetaclass)classifier, root, facadeMappping);
+ } else if(classifier instanceof VirtualEnum) {
+ createEnum((VirtualEnum)classifier, root, facadeMappping);
+ } else if(classifier instanceof VirtualDatatype) {
+ createDatatype((VirtualDatatype)classifier, root, facadeMappping);
+ } else {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_36 + classifier);
+ }
}
}
}
- // Create stereotyped element
- // createAppliedStereotypeElement(root, facadeMappping);
-
// Hierarchy and features among metaclasses
for(VirtualMetaclass metaclass : MetamodelUtils.getOnlyVirtualMetaclasses(processedClassifier.keySet())) {
createGeneralisations(metaclass, root, facadeMappping);
createProperties(metaclass, root, facadeMappping);
+ createOperations(metaclass, root, facadeMappping);
}
-
// Process eOpposites
processEOpposites(root, facadeMappping);
//Clean eAnnotations
processEAnnotations(root);
- // Save
- save();
+ Diagnostic diagnostic = Diagnostician.INSTANCE.validate(root);
+
+ for(Diagnostic child : diagnostic.getChildren()) {
+ if(child.getCode() == EcoreValidator.DISJOINT_FEATURE_AND_OPERATION_SIGNATURES) {
+ for(Object dataElement : child.getData()) {
+ if(dataElement instanceof EOperation) {
+ EcoreUtil.setSuppressedVisibility((EOperation)dataElement, true);
+ }
+ }
+ }
+ }
+
+ diagnostic = Diagnostician.INSTANCE.validate(root);
// Sanity check
TreeIterator<EObject> it = facade.eAllContents();
while(it.hasNext()) {
EObject eObject = (EObject)it.next();
if(eObject instanceof VirtualElement) {
- // if(((VirtualElement)eObject).getRepresentingElement() == null) {
- // System.err.println("This element doesn't have representing element : " + eObject);
- // System.err.println("\tin " + eObject.eContainer());
- // System.err.println("\tfor " + ((VirtualElement)eObject).getRepresentedElement());
- // }
if(((VirtualElement)eObject).getRepresentedElement() == null) {
- System.err.println("This element doesn't have represented element : " + eObject);
- System.err.println("\tin " + eObject.eContainer());
- System.err.println("\tfor " + ((VirtualElement)eObject).getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.EcoreGenerator_37 + eObject);
}
}
}
- Diagnostic diagnostic = Diagnostician.INSTANCE.validate(root);
-
+ // Save
+ save();
if(diagnostic.getSeverity() == Diagnostic.OK) {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Validation of the generated metamodel", "The generated metamodel seems OK. ");
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.EcoreGenerator_40, Messages.EcoreGenerator_41);
} else {
- DiagnosticDialog dialog = new DiagnosticDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Validation of the generated metamodel", "The generated metamodel contains issues that you must fix in the preliminary metamodel. \nYou may open the generated metamodel to spot the problem but don't fix it manualy. ", diagnostic, Diagnostic.OK | Diagnostic.INFO | Diagnostic.WARNING | Diagnostic.ERROR);
-
+ DiagnosticDialog dialog = new DiagnosticDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.EcoreGenerator_42, Messages.EcoreGenerator_43, diagnostic, Diagnostic.OK | Diagnostic.INFO | Diagnostic.WARNING | Diagnostic.ERROR);
dialog.open();
-
}
-
monitor.done();
}
}
@@ -969,10 +954,7 @@ public class EcoreGenerator extends MouseAdapter {
}
} else {
- MessageDialog.openError(Display.getCurrent().getActiveShell(), "Metamodel name, nsPrefix and nsURI", "Metamodel name, nsPrefix and nsURI must not be empty");
+ MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.EcoreGenerator_44, Messages.EcoreGenerator_45);
}
-
}
-
-
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/MetamodelUtils.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/MetamodelUtils.java
index 20019d1e4ca..a9c86c09035 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/MetamodelUtils.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/metamodel/MetamodelUtils.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.metamodel;
import java.util.ArrayList;
@@ -5,6 +18,7 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
@@ -14,6 +28,8 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EParameter;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.papyrus.facade.Facade;
@@ -22,32 +38,43 @@ import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinition;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinitionKind;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualClassifier;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualDatatype;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualEnum;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualLiteral;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetaclass;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualOperation;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualParameter;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualProperty;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualTypedElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelFactory;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualmetamodelPackage;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.papyrus.facadeSpecificEditor.utils.StereotypeUtils;
-import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Extension;
+import org.eclipse.uml2.uml.MultiplicityElement;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Parameter;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.TypedElement;
public class MetamodelUtils {
+ /**
+ * Check whether the list contains only {@link BaseMetaclass} that represent required extensions
+ *
+ * @param list
+ * @return true if the list contains only required extensions
+ */
public static boolean containsOnlyRequiredBaseMetaclass(List<BaseMetaclass> list) {
if(!list.isEmpty()) {
for(BaseMetaclass baseMetaclass : list) {
- if(baseMetaclass.getExtensionDefinition().getKind() == ExtensionDefinitionKind.MULTI_GENERALIZATION) {
+ if(baseMetaclass.getExtensionDefinition().getKind() == ExtensionDefinitionKind.MULTI_GENERALIZATION || baseMetaclass.getExtensionDefinition().getKind() == ExtensionDefinitionKind.GENERALIZATION) {
if(!baseMetaclass.getExtensionDefinition().getExtension().isRequired()) {
return false;
}
@@ -59,6 +86,12 @@ public class MetamodelUtils {
}
}
+ /**
+ * Check whether the list contains a {@link BaseMetaclass} that represent an abstract stereotype
+ *
+ * @param list
+ * @return true if the list contains a {@link BaseMetaclass} that represent an abstract stereotype
+ */
public static boolean containsAbstractStereotype(EList<BaseMetaclass> list) {
for(BaseMetaclass baseMetaclass : list) {
if(baseMetaclass.getExtensionDefinition().getStereotype().isAbstract()) {
@@ -68,6 +101,14 @@ public class MetamodelUtils {
return false;
}
+ /**
+ * Extract only {@link VirtualMetaclass} from a list of {@link VirtualClassifier}
+ *
+ * @param list
+ * a list containing {@link VirtualClassifier}
+ * @return
+ * a list containing only {@link VirtualMetaclass}
+ */
public static List<VirtualMetaclass> getOnlyVirtualMetaclasses(Collection<VirtualClassifier> list) {
List<VirtualMetaclass> result = new ArrayList<VirtualMetaclass>();
for(VirtualClassifier classifier : list) {
@@ -78,6 +119,14 @@ public class MetamodelUtils {
return result;
}
+
+ /**
+ * Check whether the list contains only {@link BaseMetaclass} that represent abstract stereotype
+ *
+ * @param list
+ * @return
+ * true if the list contains only {@link BaseMetaclass} that represent abstract stereotype
+ */
public static boolean containsOnlyAbstractStereotype(EList<BaseMetaclass> list) {
if(!list.isEmpty()) {
for(BaseMetaclass baseMetaclass : list) {
@@ -91,6 +140,14 @@ public class MetamodelUtils {
}
}
+ /**
+ * Find a {@link VirtualClassifier} that represents the element in the facade
+ *
+ * @param element
+ * the element that must be represented by the {@link VirtualClassifier}
+ * @param facade
+ * @return a {@link VirtualClassifier} that represents the element or null
+ */
public static VirtualClassifier findClassifierThatMatch(EObject element, Facade facade) {
for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
@@ -123,15 +180,28 @@ public class MetamodelUtils {
}
}
+ if(element instanceof Classifier) {
+ EClassifier foundEClass = StereotypeUtils.findEClass((Classifier)element);
+ if(foundEClass != null) {
+ return findClassifierThatMatch(foundEClass, facade);
+ }
+ }
return null;
}
- public static VirtualMetaclass findMetaclassWithNoRealStereoThatMatch(EObject eClassifier, Facade facade) {
+ /**
+ * Find a {@link VirtualClassifier} that represents the element in the facade but that doesn't have a stereotype applied
+ *
+ * @param element
+ * @param facade
+ * @return
+ */
+ public static VirtualMetaclass findMetaclassWithNoRealStereoThatMatch(EObject element, Facade facade) {
for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
if(classifier instanceof VirtualMetaclass) {
- if(((VirtualMetaclass)classifier).getRepresentedElement() == eClassifier) {
+ if(((VirtualMetaclass)classifier).getRepresentedElement() == element) {
if(((VirtualMetaclass)classifier).getAppliedStereotypes().isEmpty() || onlyOneKind(((VirtualMetaclass)classifier).getAppliedStereotypes(), ExtensionDefinitionKind.FUSION)) {
return ((VirtualMetaclass)classifier);
@@ -142,6 +212,13 @@ public class MetamodelUtils {
return null;
}
+ /**
+ * Find a {@link VirtualProperty} that represents the feature in the facade
+ *
+ * @param feature
+ * @param facade
+ * @return
+ */
public static VirtualProperty findProperty(EObject feature, Facade facade) {
for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
if(classifier instanceof VirtualMetaclass)
@@ -154,6 +231,12 @@ public class MetamodelUtils {
return null;
}
+ /**
+ * Find the BaseMetaclass that represents the actual base metaclass among the BaseMetaclasses of an ExtensionDefinition
+ *
+ * @param extensionDefinition
+ * @return
+ */
public static BaseMetaclass findActualBaseMetaclass(ExtensionDefinition extensionDefinition) {
for(BaseMetaclass baseMetaclass : extensionDefinition.getBaseMetaclasses()) {
if(baseMetaclass.getBase() == StereotypeUtils.findBase(extensionDefinition)) {
@@ -165,9 +248,17 @@ public class MetamodelUtils {
}
- public static VirtualMetaclass findMetaclassThatMatch(EObject eClass, Stereotype stereo, Facade facade) {
+ /**
+ * Find a {@link VirtualMetaclass} that represents the element in the facade
+ *
+ * @param element
+ * @param stereo
+ * @param facade
+ * @return
+ */
+ public static VirtualMetaclass findMetaclassThatMatch(EObject element, Stereotype stereo, Facade facade) {
for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
- if(classifier.getRepresentedElement() == eClass) {
+ if(classifier.getRepresentedElement() == element) {
if(classifier instanceof VirtualMetaclass) {
if(((VirtualMetaclass)classifier).getAppliedStereotypes().size() == 1) {
@@ -184,6 +275,13 @@ public class MetamodelUtils {
return null;
}
+ /**
+ * Check whether the stereotype represented by the {@link ExtensionDefinition} is a the same as the stereotype related to the extension
+ * represented by this {@link ExtensionDefinition}
+ *
+ * @param extensionDefinition
+ * @return
+ */
public static boolean isActualExtensionDefinition(ExtensionDefinition extensionDefinition) {
if(extensionDefinition.getExtension().getStereotype() == extensionDefinition.getStereotype()) {
@@ -194,6 +292,13 @@ public class MetamodelUtils {
}
+ /**
+ * Check whether the list of {@link BaseMetaclass} contains only {@link BaseMetaclass} that are of the same {@link ExtensionDefinitionKind}
+ *
+ * @param list
+ * @param kind
+ * @return
+ */
public static boolean onlyOneKind(List<BaseMetaclass> list, ExtensionDefinitionKind kind) {
for(BaseMetaclass baseMetaclass : list) {
if(baseMetaclass.getExtensionDefinition().getKind() != kind) {
@@ -203,6 +308,12 @@ public class MetamodelUtils {
return true;
}
+ /**
+ * Check whether the stereotype represented by an {@link ExtensionDefinition} is also represented by another {@link ExtensionDefinition}
+ *
+ * @param extensionDefinition
+ * @return
+ */
public static boolean hasSiblings(ExtensionDefinition extensionDefinition) {
Facade facade = extensionDefinition.getFacade();
@@ -230,18 +341,7 @@ public class MetamodelUtils {
}
if(requiredBaseMetaclass != null) {
-
- // System.err.println("For \"" + metaclassInput.getAliasName() + "\"The required : " + requiredBaseMetaclass.getExtensionDefinition().getStereotype().getName());
-
output.add(findMetaclassThatMatch((EClass)requiredBaseMetaclass.getBase(), requiredBaseMetaclass.getExtensionDefinition().getStereotype(), facade));
- // HashSet<Stereotype> siblings = ProfileUtils.getSiblings(requiredBaseMetaclass.getExtensionDefinition().getStereotype());
- // for (Stereotype stereotype : siblings) {
- // if (!stereotype.isAbstract()) {
- // // Find metaclass corresponding
- // output.add(findMetaclassThatMatch((EClass) requiredBaseMetaclass.getBase(), stereotype, facade));
- // }
- // }
-
} else {
output.add(findMetaclassWithNoRealStereoThatMatch((EClass)metaclassInput.getRepresentedElement(), facade));
}
@@ -250,6 +350,12 @@ public class MetamodelUtils {
}
+ /**
+ * Get all {@link VirtualMetaclass} (i.e. recursively) that are generals of a {@link VirtualMetaclass}
+ *
+ * @param metaclass
+ * @return
+ */
public static List<VirtualMetaclass> getAllFathers(VirtualMetaclass metaclass) {
List<VirtualMetaclass> toProcess = new ArrayList<VirtualMetaclass>();
@@ -266,12 +372,15 @@ public class MetamodelUtils {
}
+ /**
+ * Get {@link VirtualMetaclass} that are generals of a {@link VirtualMetaclass}
+ *
+ * @param metaclass
+ * @return
+ */
public static List<VirtualMetaclass> getFathers(VirtualMetaclass metaclass) {
List<VirtualMetaclass> output = new ArrayList<VirtualMetaclass>();
- // System.err.println("\t+" + metaclass);
- // System.err.println("\t++" + metaclass.getMetamodel());
- // System.err.println("\t+++" + metaclass.getMetamodel().getFacade());
Facade facade = ((VirtualMetaclass)metaclass).getMetamodel().getFacade();
if(metaclass.getAppliedStereotypes().isEmpty() || onlyOneKind(metaclass.getAppliedStereotypes(), ExtensionDefinitionKind.FUSION)) {
@@ -304,33 +413,7 @@ public class MetamodelUtils {
output.add(findStereotypeInterface(stereotype));
}
- }
- // else {
- // for(BaseMetaclass baseMetaclass : metaclass.getAppliedStereotypes()) {
- // if(baseMetaclass.getExtensionDefinition().getKind() == ExtensionDefinitionKind.ASSOCIATION) {
- // EList<Classifier> supersStereo = baseMetaclass.getExtensionDefinition().getStereotype().getGenerals();
- // for(Classifier superStereo : supersStereo) {
- // output.add(findMetaclassThatMatch((Stereotype)superStereo, (Stereotype)superStereo, facade));
- // }
- //
- // } else if(baseMetaclass.getExtensionDefinition().getKind() == ExtensionDefinitionKind.GENERALIZATION) {
- // EList<Classifier> supersStereo = baseMetaclass.getExtensionDefinition().getStereotype().getGenerals();
- // if(!supersStereo.isEmpty()) {
- // for(Classifier superStereo : supersStereo) {
- // output.add(findMetaclassThatMatch(metaclass.getRepresentedElement(), (Stereotype)superStereo, facade));
- // // output.add(findMetaclassThatMatch((Stereotype)superStereo, (Stereotype)superStereo, facade));
- // }
- // } else {
- // output.add(findMetaclassWithNoRealStereoThatMatch(metaclass.getRepresentedElement(), facade));
- // // output.add(findMetaclassWithNoRealStereoThatMatch(StereotypeUtils.findBase(metaclass.getAppliedStereotypes().get(0).getExtensionDefinition()), facade));
- // }
- // } else {
- // System.err.println("Don't know how to represent : " + metaclass.getAliasName());
- // }
- // }
- // }
- else if(onlyOneKind(metaclass.getAppliedStereotypes(), ExtensionDefinitionKind.ASSOCIATION)) {
- // EList<Classifier> supersStereo = metaclass.getAppliedStereotypes().get(0).getExtensionDefinition().getStereotype().getGenerals();
+ } else if(onlyOneKind(metaclass.getAppliedStereotypes(), ExtensionDefinitionKind.ASSOCIATION)) {
for(BaseMetaclass baseMetaclass : metaclass.getAppliedStereotypes()) {
EList<Classifier> supersStereo = baseMetaclass.getExtensionDefinition().getStereotype().getGenerals();
for(Classifier superStereo : supersStereo) {
@@ -346,15 +429,12 @@ public class MetamodelUtils {
}
} else if(onlyOneKind(metaclass.getAppliedStereotypes(), ExtensionDefinitionKind.GENERALIZATION)) {
for(BaseMetaclass baseMetaclass : metaclass.getAppliedStereotypes()) {
- // EList<Classifier> supersStereo = metaclass.getAppliedStereotypes().get(0).getExtensionDefinition().getStereotype().getGenerals();
EList<Classifier> supersStereo = baseMetaclass.getExtensionDefinition().getStereotype().getGenerals();
if(!supersStereo.isEmpty()) {
for(Classifier superStereo : supersStereo) {
output.add(findMetaclassThatMatch(metaclass.getRepresentedElement(), (Stereotype)superStereo, facade));
- // output.add(findMetaclassThatMatch((Stereotype)superStereo, (Stereotype)superStereo, facade));
}
} else {
- // output.add(findMetaclassWithNoRealStereoThatMatch(metaclass.getRepresentedElement(), facade));
output.add(findMetaclassWithNoRealStereoThatMatch(StereotypeUtils.findBase(metaclass.getAppliedStereotypes().get(0).getExtensionDefinition()), facade));
}
}
@@ -366,10 +446,9 @@ public class MetamodelUtils {
}
}
} else {
- System.err.println("Don't know how to get fathers : " + metaclass.getAliasName());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_0 + metaclass.getAliasName());
}
-
return output;
}
@@ -386,6 +465,12 @@ public class MetamodelUtils {
return null;
}
+ /**
+ * Get {@link VirtualMetaclass} that are children (through generalization relationship) of a {@link VirtualMetaclass}
+ *
+ * @param parent
+ * @return
+ */
public static List<VirtualMetaclass> getChildren(VirtualMetaclass parent) {
List<VirtualMetaclass> children = new ArrayList<VirtualMetaclass>();
@@ -400,6 +485,12 @@ public class MetamodelUtils {
return children;
}
+ /**
+ * Get all {@link VirtualMetaclass} (i.e. recursively) that are children (through generalization relationship) of a {@link VirtualMetaclass}
+ *
+ * @param parent
+ * @return
+ */
public static List<VirtualMetaclass> getAllChildren(VirtualMetaclass parent) {
List<VirtualMetaclass> toProcess = new ArrayList<VirtualMetaclass>();
List<VirtualMetaclass> output = new ArrayList<VirtualMetaclass>();
@@ -424,7 +515,9 @@ public class MetamodelUtils {
return true;
} else {
- if(containsOnlyRequired(getChildren(metaclass))) {
+ List<VirtualMetaclass> children = getChildren(metaclass);
+
+ if(containsOnlyRequired(children)) {
return true;
}
}
@@ -454,7 +547,6 @@ public class MetamodelUtils {
public static boolean canBeAbstract(VirtualMetaclass metaclass) {
- Facade facade = metaclass.getMetamodel().getFacade();
if(!mustBeAbstract(metaclass)) {
for(VirtualMetaclass child : getAllChildren(metaclass)) {
if(child.isKept()) {
@@ -548,14 +640,7 @@ public class MetamodelUtils {
output = metaclass;
}
} else {
- // if(stereotypes != null) {
- // for(BaseMetaclass stereo : stereotypes) {
- // if(!output.getAppliedStereotypes().contains(stereo)) {
- // output.getAppliedStereotypes().add(stereo);
- // }
- // }
- // }
- System.err.println("addMetaclass: I didn't add because already represented : " + representedElement);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_1 + representedElement);
}
return output;
@@ -563,8 +648,6 @@ public class MetamodelUtils {
public static VirtualEnum addEnum(EObject representedElement, String alias, Facade facade, AdapterFactoryEditingDomain editingDomain) {
VirtualEnum output = null;
- // System.err.println("checkIfExists : " + checkIfExists);
-
boolean found = false;
for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
@@ -596,11 +679,10 @@ public class MetamodelUtils {
MetamodelUtils.addLiteral(enumeration, literal, literal.getName(), facade, editingDomain);
}
} else {
- System.err.println("I don't know how to create literal for the type : " + enumeration.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_2 + enumeration.getRepresentedElement());
}
output = enumeration;
-
}
return output;
@@ -608,8 +690,6 @@ public class MetamodelUtils {
public static VirtualOperation addOperation(VirtualMetaclass metaclass, EObject operationElement, String alias, Facade facade, AdapterFactoryEditingDomain editingDomain) {
VirtualOperation output = null;
- // System.err.println("checkIfExists : " + checkIfExists);
-
boolean found = false;
for(VirtualOperation operation : metaclass.getOperations()) {
@@ -621,11 +701,14 @@ public class MetamodelUtils {
}
if(!found) {
-
VirtualOperation operation = VirtualmetamodelFactory.eINSTANCE.createVirtualOperation();
operation.setKept(true);
operation.setRepresentedElement(operationElement);
operation.setAliasName(alias);
+ processMultiplicities(operationElement, operation);
+
+ processTypedElement(operationElement, facade, editingDomain);
+
AddCommand command = new AddCommand(editingDomain, metaclass, VirtualmetamodelPackage.eINSTANCE.getVirtualMetaclass_Operations(), operation);
editingDomain.getCommandStack().execute(command);
@@ -640,7 +723,7 @@ public class MetamodelUtils {
MetamodelUtils.addParameter(operation, param, param.getName(), facade, editingDomain);
}
} else {
- System.err.println("I don't know how to create parameters for the operation : " + operation.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_3 + operation.getRepresentedElement());
}
output = operation;
@@ -652,8 +735,6 @@ public class MetamodelUtils {
public static VirtualDatatype addDatatype(EObject representedElement, String alias, Facade facade, AdapterFactoryEditingDomain editingDomain) {
VirtualDatatype output = null;
- // System.err.println("checkIfExists : " + checkIfExists);
-
boolean found = false;
for(VirtualClassifier classifier : facade.getVirtualmetamodel().getVirtualClassifiers()) {
@@ -665,8 +746,6 @@ public class MetamodelUtils {
}
}
-
-
if(!found) {
VirtualDatatype datatype = VirtualmetamodelFactory.eINSTANCE.createVirtualDatatype();
@@ -699,8 +778,6 @@ public class MetamodelUtils {
}
}
-
-
if(!found) {
VirtualMetaclass metaclass = VirtualmetamodelFactory.eINSTANCE.createVirtualMetaclass();
metaclass.setKept(true);
@@ -711,17 +788,11 @@ public class MetamodelUtils {
AddCommand command = new AddCommand(editingDomain, facade.getVirtualmetamodel(), VirtualmetamodelPackage.eINSTANCE.getVirtualMetamodel_VirtualClassifiers(), metaclass);
editingDomain.getCommandStack().execute(command);
-
-
-
-
output = metaclass;
} else {
- System.err.println("addStereotypeInterface: I didn't add because already represented : " + representedElement);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_4 + representedElement);
}
-
-
return output;
}
@@ -747,99 +818,103 @@ public class MetamodelUtils {
return null;
}
- public static void addProperty(VirtualMetaclass metaclass, EObject propertyElement, String alias, Facade facade, AdapterFactoryEditingDomain editingDomain) {
+ public static void processMultiplicities(EObject element, VirtualTypedElement virtualElement) {
+ int lower = 0;
+ int upper = 0;
+ if(element instanceof ETypedElement) {
+ lower = ((ETypedElement)element).getLowerBound();
+ upper = ((ETypedElement)element).getUpperBound();
+ } else if(element instanceof MultiplicityElement) {
- boolean found = false;
- for(VirtualProperty property : metaclass.getProperties()) {
- if(property.getRepresentedElement() == propertyElement) {
- found = true;
- }
+ lower = ((MultiplicityElement)element).getLower();
+ upper = ((MultiplicityElement)element).getUpper();
}
+ virtualElement.setLower(lower);
+ virtualElement.setUpper(upper);
+ }
- if(!found) {
- int lower = 0;
- int upper = 0;
-
-
-
- // Check if the type of this property exists and if not create the appropriate metaclass and properties
- if(propertyElement instanceof EStructuralFeature) {
- lower = ((EStructuralFeature)propertyElement).getLowerBound();
- upper = ((EStructuralFeature)propertyElement).getUpperBound();
+ public static void processTypedElement(EObject typedElement, Facade facade, AdapterFactoryEditingDomain editingDomain) {
+ if(typedElement instanceof ETypedElement) {
- EClassifier eType = ((EStructuralFeature)propertyElement).getEType();
+ EClassifier eType = ((ETypedElement)typedElement).getEType();
- if(!containtsType(eType, facade)) {
- VirtualClassifier newType = createForType(eType, facade, editingDomain);
- if(newType instanceof VirtualMetaclass) {
- createProperties((VirtualMetaclass)newType, facade, editingDomain);
- }
+ if(!containtsType(eType, facade)) {
+ VirtualClassifier newType = createForType(eType, facade, editingDomain);
+ if(newType instanceof VirtualMetaclass) {
+ createProperties((VirtualMetaclass)newType, facade, editingDomain);
}
- } else if(propertyElement instanceof Property) {
-
- lower = ((Property)propertyElement).getLower();
- upper = ((Property)propertyElement).getUpper();
-
- if(((Property)propertyElement).getType() instanceof Stereotype) {
- //System.err.println("Applied stereotype will be generated to type : " + element);
- } else {
-
- if(((Property)propertyElement).getType() instanceof Enumeration) {
- EObject eType = ((Property)propertyElement).getType();
- String name = ((Property)propertyElement).getType().getName();
- if(!containtsType(eType, facade)) {
- VirtualEnum virtualEnum = MetamodelUtils.addEnum(eType, name, facade, editingDomain);
- }
- } else if(((Property)propertyElement).getType() instanceof DataType) {
- if(((Property)propertyElement).getType() instanceof PrimitiveType) {
- //Check if it is a UML primitivetype
- EObject eType = StereotypeUtils.findEClass((Classifier)((Property)propertyElement).getType());
- if(eType != null) {
- if(!containtsType(eType, facade)) {
- VirtualClassifier virtualClassifier = createForType((EClassifier)eType, facade, editingDomain);
- if(virtualClassifier instanceof VirtualMetaclass) {
- createProperties((VirtualMetaclass)virtualClassifier, facade, editingDomain);
- }
+ }
+ } else if(typedElement instanceof TypedElement) {
+
+ if(!(((TypedElement)typedElement).getType() instanceof Stereotype)) {
+ if(((TypedElement)typedElement).getType() instanceof Enumeration) {
+ EObject eType = ((TypedElement)typedElement).getType();
+ String name = ((TypedElement)typedElement).getType().getName();
+ if(!containtsType(eType, facade)) {
+ MetamodelUtils.addEnum(eType, name, facade, editingDomain);
+ }
+ } else if(((TypedElement)typedElement).getType() instanceof DataType) {
+ if(((TypedElement)typedElement).getType() instanceof PrimitiveType) {
+ //Check if it is a UML primitivetype
+ EObject eType = StereotypeUtils.findEClass((Classifier)((TypedElement)typedElement).getType());
+ if(eType != null) {
+ if(!containtsType(eType, facade)) {
+ VirtualClassifier virtualClassifier = createForType((EClassifier)eType, facade, editingDomain);
+ if(virtualClassifier instanceof VirtualMetaclass) {
+ createProperties((VirtualMetaclass)virtualClassifier, facade, editingDomain);
}
- } else {
- VirtualClassifier virtualClassifier = createForType(((Property)propertyElement).getType(), facade, editingDomain);
}
} else {
-
- VirtualClassifier virtualClassifier = createForType(((Property)propertyElement).getType(), facade, editingDomain);
- if(virtualClassifier instanceof VirtualMetaclass) {
- createProperties((VirtualMetaclass)virtualClassifier, facade, editingDomain);
- }
-
-
- }
- } else if(((Property)propertyElement).getType() instanceof Class) {
- EClassifier eClass = StereotypeUtils.findEClass((Classifier)((Property)propertyElement).getType());
- if(eClass == null) {
- System.err.println("Stereotype properties typed by a Class (that are not part of UML metamodel) are not supported yet");
+ createForType(((TypedElement)typedElement).getType(), facade, editingDomain);
}
} else {
- System.err.println("I don't know how to process the type : " + ((Property)propertyElement).getType());
+
+ VirtualClassifier virtualClassifier = createForType(((TypedElement)typedElement).getType(), facade, editingDomain);
+ if(virtualClassifier instanceof VirtualMetaclass) {
+ createProperties((VirtualMetaclass)virtualClassifier, facade, editingDomain);
+ }
+
+ }
+ } else if(((TypedElement)typedElement).getType() instanceof org.eclipse.uml2.uml.Class) {
+ EClassifier eClass = StereotypeUtils.findEClass((Classifier)((TypedElement)typedElement).getType());
+ if(eClass == null) {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_5);
}
+ } else {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_6 + ((TypedElement)typedElement).getType());
}
+ }
- } else {
- System.err.println("I don't know how to process the element for property : " + propertyElement);
+ } else {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_7 + typedElement);
+ }
+ }
+
+ public static void addProperty(VirtualMetaclass metaclass, EObject propertyElement, EObject type, String alias, Facade facade, AdapterFactoryEditingDomain editingDomain) {
+
+ boolean found = false;
+ for(VirtualProperty property : metaclass.getProperties()) {
+ if(property.getRepresentedElement() == propertyElement) {
+ found = true;
}
+ }
+
+ if(!found) {
+
+ processTypedElement(propertyElement, facade, editingDomain);
VirtualProperty property = VirtualmetamodelFactory.eINSTANCE.createVirtualProperty();
property.setKept(true);
property.setAliasName(alias);
property.setRepresentedElement(propertyElement);
- property.setLower(lower);
- property.setUpper(upper);
+ processMultiplicities(propertyElement, property);
AddCommand command = new AddCommand(editingDomain, metaclass, VirtualmetamodelPackage.eINSTANCE.getVirtualMetaclass_Properties(), property);
editingDomain.getCommandStack().execute(command);
} else {
- System.err.println("addProperty: I didn't add because already represented : " + propertyElement);
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_8 + propertyElement);
}
}
@@ -849,6 +924,9 @@ public class MetamodelUtils {
virtualParameter.setKept(true);
virtualParameter.setAliasName(alias);
virtualParameter.setRepresentedElement(parameterElement);
+ processMultiplicities(parameterElement, virtualParameter);
+
+ processTypedElement(parameterElement, facade, editingDomain);
AddCommand command = new AddCommand(editingDomain, operation, VirtualmetamodelPackage.eINSTANCE.getVirtualOperation_Parameters(), virtualParameter);
editingDomain.getCommandStack().execute(command);
@@ -868,7 +946,6 @@ public class MetamodelUtils {
return literal;
}
-
public static void createStereotypeProperties(VirtualMetaclass metaclass, Facade facade, AdapterFactoryEditingDomain editingDomain) {
// Add stereotype properties only if it is not already added to a father
@@ -886,21 +963,20 @@ public class MetamodelUtils {
if(!hasSiblings(appliedStereotype.getExtensionDefinition())) {
-
EList<Property> stereotypeProperties = appliedStereotype.getExtensionDefinition().getStereotype().getAttributes();
for(Property property : stereotypeProperties) {
if(appliedStereotype.getExtensionDefinition().getKind() == ExtensionDefinitionKind.ASSOCIATION) {
- if(!property.getName().startsWith("base_")) {
- MetamodelUtils.addProperty(metaclass, property, property.getName(), facade, editingDomain);
+ if(!property.getName().startsWith(Extension.METACLASS_ROLE_PREFIX)) {
+ MetamodelUtils.addProperty(metaclass, property, property.getType(), property.getName(), facade, editingDomain);
} else {
if(appliedStereotype.getExtensionDefinition().getExtension().getMemberEnds().contains(property)) {
- MetamodelUtils.addProperty(metaclass, property, property.getName(), facade, editingDomain);
+ MetamodelUtils.addProperty(metaclass, property, property.getType(), property.getName(), facade, editingDomain);
}
}
} else {
- if(!property.getName().startsWith("base_")) {
- MetamodelUtils.addProperty(metaclass, property, property.getName(), facade, editingDomain);
+ if(!property.getName().startsWith(Extension.METACLASS_ROLE_PREFIX)) {
+ MetamodelUtils.addProperty(metaclass, property, property.getType(), property.getName(), facade, editingDomain);
}
}
}
@@ -910,16 +986,16 @@ public class MetamodelUtils {
for(Property property : stereotypeProperties) {
if(appliedStereotype.getExtensionDefinition().getKind() == ExtensionDefinitionKind.ASSOCIATION) {
- if(property.getName().startsWith("base_")) {
+ if(property.getName().startsWith(Extension.METACLASS_ROLE_PREFIX)) {
if(appliedStereotype.getExtensionDefinition().getExtension().getMemberEnds().contains(property)) {
- MetamodelUtils.addProperty(metaclass, property, property.getName(), facade, editingDomain);
+ MetamodelUtils.addProperty(metaclass, property, property.getType(), property.getName(), facade, editingDomain);
}
}
}
}
}
} else {
- System.err.println("Stereotype is already applied to a parent");
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_9);
}
}
}
@@ -928,8 +1004,8 @@ public class MetamodelUtils {
if(metaclass.isStereotypeInterface()) {
EList<Property> stereotypeProperties = ((Stereotype)metaclass.getRepresentedElement()).getAttributes();
for(Property property : stereotypeProperties) {
- if(!property.getName().startsWith("base_")) {
- MetamodelUtils.addProperty(metaclass, property, property.getName(), facade, editingDomain);
+ if(!property.getName().startsWith(Extension.METACLASS_ROLE_PREFIX)) {
+ MetamodelUtils.addProperty(metaclass, property, property.getType(), property.getName(), facade, editingDomain);
}
}
} else {
@@ -938,16 +1014,16 @@ public class MetamodelUtils {
if(onlyOneKind(metaclass.getAppliedStereotypes(), ExtensionDefinitionKind.FUSION) || metaclass.getAppliedStereotypes().isEmpty()) {
EList<EStructuralFeature> properties = ((EClass)metaclass.getRepresentedElement()).getEStructuralFeatures();
for(EStructuralFeature eStructuralFeature : properties) {
- MetamodelUtils.addProperty(metaclass, eStructuralFeature, eStructuralFeature.getName(), facade, editingDomain);
+ MetamodelUtils.addProperty(metaclass, eStructuralFeature, eStructuralFeature.getEType(), eStructuralFeature.getName(), facade, editingDomain);
}
}
} else if(metaclass.getRepresentedElement() instanceof DataType) {
EList<Property> properties = ((DataType)metaclass.getRepresentedElement()).getAttributes();
for(Property property : properties) {
- MetamodelUtils.addProperty(metaclass, property, property.getName(), facade, editingDomain);
+ MetamodelUtils.addProperty(metaclass, property, property.getType(), property.getName(), facade, editingDomain);
}
} else {
- System.err.println("I don't know how to create properties for the type : " + metaclass.getRepresentedElement());
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_10 + metaclass.getRepresentedElement());
}
createStereotypeProperties(metaclass, facade, editingDomain);
@@ -987,12 +1063,10 @@ public class MetamodelUtils {
} else {
elements.add(classifier);
}
-
}
}
return elements;
-
}
public static void createGeneralizations(Facade facade, AdapterFactoryEditingDomain editingDomain) {
@@ -1020,10 +1094,67 @@ public class MetamodelUtils {
private static void createOperations(VirtualMetaclass metaclass, Facade facade, AdapterFactoryEditingDomain editingDomain) {
if(metaclass.getRepresentedElement() instanceof EClass) {
- EList<EOperation> operations = ((EClass)metaclass.getRepresentedElement()).getEOperations();
- for(EOperation eOperation : operations) {
- addOperation(metaclass, eOperation, eOperation.getName(), facade, editingDomain);
+ if(metaclass.getAppliedStereotypes().isEmpty()) {
+ EList<EOperation> operations = ((EClass)metaclass.getRepresentedElement()).getEOperations();
+ for(EOperation eOperation : operations) {
+ addOperation(metaclass, eOperation, eOperation.getName(), facade, editingDomain);
+ }
}
}
}
+
+ public static void postProcessTypedElements(Facade facade, AdapterFactoryEditingDomain editingDomain) {
+ TreeIterator<EObject> it = facade.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = (EObject)it.next();
+
+ if(eObject instanceof VirtualTypedElement) {
+ VirtualTypedElement virtualTypedElement = (VirtualTypedElement)eObject;
+ VirtualClassifier representingType = null;
+ if(virtualTypedElement.getRepresentedElement() instanceof TypedElement) {
+ representingType = MetamodelUtils.findClassifierThatMatch(((TypedElement)virtualTypedElement.getRepresentedElement()).getType(), facade);
+ if(representingType != null) {
+ virtualTypedElement.setType(representingType);
+ } else {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_11 + virtualTypedElement);
+ }
+ } else {
+ if(virtualTypedElement.getRepresentedElement() instanceof ETypedElement) {
+ if(((ETypedElement)virtualTypedElement.getRepresentedElement()).getEType() != null) {
+ representingType = MetamodelUtils.findClassifierThatMatch(((ETypedElement)virtualTypedElement.getRepresentedElement()).getEType(), facade);
+ if(representingType != null) {
+ virtualTypedElement.setType(representingType);
+ } else {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_12 + virtualTypedElement);
+ }
+ }
+ } else {
+ org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator.log.info(Messages.MetamodelUtils_13 + virtualTypedElement);
+ }
+ }
+
+ }
+ }
+ }
+
+ public static void postProcessUseRepresented(Facade facade, AdapterFactoryEditingDomain editingDomain) {
+ TreeIterator<EObject> it = facade.eAllContents();
+ while(it.hasNext()) {
+ EObject virtualElement = (EObject)it.next();
+
+ if(virtualElement instanceof VirtualElement) {
+ EObject represented = ((VirtualElement)virtualElement).getRepresentedElement();
+
+ TreeIterator<EObject> ecoreIt = EcorePackage.eINSTANCE.eAllContents();
+ while(ecoreIt.hasNext()) {
+ EObject ecoreEObject = (EObject)ecoreIt.next();
+ if(ecoreEObject == represented) {
+ ((VirtualElement)virtualElement).setUseRepresented(true);
+ }
+ }
+
+ }
+
+ }
+ }
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionContentProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionContentProvider.java
index f07c342bda7..caa7dbeee3e 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionContentProvider.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionContentProvider.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.providers;
import java.util.ArrayList;
@@ -15,43 +28,54 @@ import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinitionKind;
public class ExtensionDefintionContentProvider implements ITreeContentProvider {
-
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ *
+ */
public void dispose() {
- // TODO Auto-generated method stub
}
-
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ *
+ * @param viewer
+ * @param oldInput
+ * @param newInput
+ */
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
}
-
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
+ *
+ * @param inputElement
+ * @return
+ */
public Object[] getElements(Object inputElement) {
-
HashSet<ExtensionDefinition> output = new HashSet<ExtensionDefinition>();
if(inputElement instanceof Facade) {
-
EList<ExtensionDefinition> extensionsDefinitions = ((Facade)inputElement).getExtensionDefinitions();
for(ExtensionDefinition extensionDefinition : extensionsDefinitions) {
-
output.add(extensionDefinition);
-
- // if (StereotypeTools.findEClass(((Extension) extensionDefinition.getExtension()).getMetaclass()) == extensionDefinition.getBaseMetaclass()) {
- // output.add(extensionDefinition);
- // }
-
}
-
}
return output.toArray();
-
}
-
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ *
+ * @param parentElement
+ * @return
+ */
public Object[] getChildren(Object parentElement) {
List<BaseMetaclass> output = new ArrayList<BaseMetaclass>();
if(parentElement instanceof ExtensionDefinition) {
@@ -69,20 +93,29 @@ public class ExtensionDefintionContentProvider implements ITreeContentProvider {
return output.toArray();
}
-
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public Object getParent(Object element) {
- // TODO Auto-generated method stub
return null;
}
-
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public boolean hasChildren(Object element) {
if(getChildren(element).length != 0) {
return true;
} else {
return false;
}
-
}
-
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionLabelProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionLabelProvider.java
index 7d983399f33..3508440f858 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionLabelProvider.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/ExtensionDefintionLabelProvider.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.providers;
import org.eclipse.emf.ecore.EClass;
@@ -9,7 +22,8 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.papyrus.facade.extensiondefinition.BaseMetaclass;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinition;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinitionKind;
-import org.eclipse.papyrus.facadeSpecificEditor.Activator;
+import org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.papyrus.facadeSpecificEditor.utils.StereotypeUtils;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -18,30 +32,54 @@ import com.swtdesigner.ResourceManager;
public class ExtensionDefintionLabelProvider implements ITableLabelProvider, ILabelProvider, IFontProvider {
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
public void addListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ *
+ */
public void dispose() {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ *
+ * @param element
+ * @param property
+ * @return
+ */
public boolean isLabelProperty(Object element, String property) {
- // TODO Auto-generated method stub
return false;
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
public void removeListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ *
+ * @param element
+ * @param columnIndex
+ * @return
+ */
public Image getColumnImage(Object element, int columnIndex) {
switch(columnIndex) {
@@ -52,29 +90,29 @@ public class ExtensionDefintionLabelProvider implements ITableLabelProvider, ILa
if(element instanceof ExtensionDefinition) {
if(((ExtensionDefinition)element).getKind() == ExtensionDefinitionKind.ASSOCIATION) {
if(((ExtensionDefinition)element).getExtension().isRequired()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/associationRequired.png");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/associationRequired.png"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/association.png");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/association.png"); //$NON-NLS-1$
}
} else if(((ExtensionDefinition)element).getKind() == ExtensionDefinitionKind.GENERALIZATION) {
if(((ExtensionDefinition)element).getExtension().isRequired()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/generalizationRequired.png");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/generalizationRequired.png"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/generalization.png");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/generalization.png"); //$NON-NLS-1$
}
} else if(((ExtensionDefinition)element).getKind() == ExtensionDefinitionKind.MULTI_GENERALIZATION) {
if(((ExtensionDefinition)element).getExtension().isRequired()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/multigeneralizationRequired.png");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/multigeneralizationRequired.png"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/multigeneralization.png");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/multigeneralization.png"); //$NON-NLS-1$
}
} else if(((ExtensionDefinition)element).getKind() == ExtensionDefinitionKind.FUSION) {
if(((ExtensionDefinition)element).getExtension().isRequired()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/fusionRequired.png");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/fusionRequired.png"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/fusion.png");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/fusion.png"); //$NON-NLS-1$
}
}
@@ -85,9 +123,9 @@ public class ExtensionDefintionLabelProvider implements ITableLabelProvider, ILa
if(element instanceof BaseMetaclass) {
if(!((BaseMetaclass)element).getExtensionDefinition().getExtension().isRequired()) {
if(((BaseMetaclass)element).isPossible()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/checked.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/checked.gif"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/unchecked.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/unchecked.gif"); //$NON-NLS-1$
}
}
@@ -101,6 +139,13 @@ public class ExtensionDefintionLabelProvider implements ITableLabelProvider, ILa
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ *
+ * @param element
+ * @param columnIndex
+ * @return
+ */
public String getColumnText(Object element, int columnIndex) {
switch(columnIndex) {
@@ -109,19 +154,19 @@ public class ExtensionDefintionLabelProvider implements ITableLabelProvider, ILa
String name = ((ExtensionDefinition)element).getStereotype().getQualifiedName();
if(!((ExtensionDefinition)element).getStereotype().getGenerals().isEmpty()) {
- name += " [-> ";
+ name += " [-> "; //$NON-NLS-1$
name += ((ExtensionDefinition)element).getStereotype().getGenerals().get(0).getQualifiedName();
if(((ExtensionDefinition)element).getStereotype().getGenerals().size() > 1) {
for(int i = 1; i < ((ExtensionDefinition)element).getStereotype().getGenerals().size(); i++) {
- name += ", " + ((ExtensionDefinition)element).getStereotype().getGenerals().get(i).getQualifiedName();
+ name += ", " + ((ExtensionDefinition)element).getStereotype().getGenerals().get(i).getQualifiedName(); //$NON-NLS-1$
}
}
- name += "]";
+ name += "]"; //$NON-NLS-1$
}
- name += " on";
+ name += Messages.ExtensionDefintionLabelProvider_13;
if(((ExtensionDefinition)element).getKind() != ExtensionDefinitionKind.MULTI_GENERALIZATION) {
if(StereotypeUtils.findBase((ExtensionDefinition)element) != null) {
- name += " " + StereotypeUtils.findBase((ExtensionDefinition)element).getName();
+ name += " " + StereotypeUtils.findBase((ExtensionDefinition)element).getName(); //$NON-NLS-1$
}
}
return name;
@@ -151,26 +196,41 @@ public class ExtensionDefintionLabelProvider implements ITableLabelProvider, ILa
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+
public Image getImage(Object element) {
- // TODO Auto-generated method stub
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public String getText(Object element) {
return getColumnText(element, 0);
}
+ /**
+ * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public Font getFont(Object element) {
-
if(element instanceof ExtensionDefinition) {
-
if(((ExtensionDefinition)element).getStereotype().isAbstract()) {
return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
}
}
-
return JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
}
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesContentProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesContentProvider.java
index eeb42f57867..0fc542ab5c5 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesContentProvider.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesContentProvider.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.providers;
import java.util.HashSet;
@@ -9,32 +22,42 @@ import org.eclipse.papyrus.facade.extensiondefinition.Combination;
public class IncompatibilitiesContentProvider implements IStructuredContentProvider {
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ *
+ */
public void dispose() {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ *
+ * @param viewer
+ * @param oldInput
+ * @param newInput
+ */
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ *
+ * @param inputElement
+ * @return
+ */
public Object[] getElements(Object inputElement) {
HashSet<Combination> output = new HashSet<Combination>();
if(inputElement instanceof BaseMetaclass) {
- // output.addAll(((BaseMetaclass) inputElement).getIncompatibleStereotypes());
-
- // output.addAll(ProfileUtils.getPossibleCombinaisons((BaseMetaclass) inputElement));
output.addAll(((BaseMetaclass)inputElement).getIncompatibleStereotypes());
output.addAll(((BaseMetaclass)inputElement).getCompatibleStereotypes());
-
}
return output.toArray();
-
}
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesLabelProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesLabelProvider.java
index 046659b38ef..165e0b6d717 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesLabelProvider.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/IncompatibilitiesLabelProvider.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.providers;
import java.util.ArrayList;
@@ -14,7 +27,7 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.papyrus.facade.extensiondefinition.BaseMetaclass;
import org.eclipse.papyrus.facade.extensiondefinition.Combination;
import org.eclipse.papyrus.facade.extensiondefinition.ExtensionDefinition;
-import org.eclipse.papyrus.facadeSpecificEditor.Activator;
+import org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator;
import org.eclipse.papyrus.facadeSpecificEditor.FacadeSpecificEditor;
import org.eclipse.papyrus.facadeSpecificEditor.utils.ProfileUtils;
import org.eclipse.swt.graphics.Font;
@@ -26,42 +39,60 @@ import com.swtdesigner.ResourceManager;
public class IncompatibilitiesLabelProvider implements ITableLabelProvider, IFontProvider {
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
public void addListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ *
+ */
public void dispose() {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ *
+ * @param element
+ * @param property
+ * @return
+ */
public boolean isLabelProperty(Object element, String property) {
- // TODO Auto-generated method stub
return false;
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
public void removeListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ *
+ * @param element
+ * @param columnIndex
+ * @return
+ */
public Image getColumnImage(Object element, int columnIndex) {
switch(columnIndex) {
case 0:
if(element instanceof Combination) {
-
- // if (((Extension) ((BaseMetaclass) element).getExtensionDefinition().getExtension()).isRequired()) {
- // return ResourceManager.getPluginImage("org.eclipse.papyrus.FacadeSpecificEditor", "icons/generalizationRequired.png");
- // } else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/combinaison.png");
- // }
-
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/combinaison.png"); //$NON-NLS-1$
}
break;
case 1:
@@ -73,9 +104,9 @@ public class IncompatibilitiesLabelProvider implements ITableLabelProvider, IFon
if(first instanceof BaseMetaclass) {
EList<Combination> incompatibleStereotypes = ((BaseMetaclass)first).getIncompatibleStereotypes();
if(incompatibleStereotypes.contains(element)) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/unchecked.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/unchecked.gif"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/checked.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/checked.gif"); //$NON-NLS-1$
}
}
}
@@ -90,12 +121,19 @@ public class IncompatibilitiesLabelProvider implements ITableLabelProvider, IFon
return null;
}
+ /**
+ * Produce sibling list.
+ *
+ * @param stereotype
+ * the stereotype
+ * @return the string
+ */
protected String produceSiblingList(Stereotype stereotype) {
- String output = "";
+ String output = ""; //$NON-NLS-1$
HashSet<Stereotype> siblings = ProfileUtils.getSiblings(stereotype);
List<Classifier> siblingsList = new ArrayList<Classifier>(siblings);
if(siblingsList.size() > 1) {
- output += "[";
+ output += "["; //$NON-NLS-1$
}
if(!siblingsList.isEmpty()) {
@@ -103,35 +141,39 @@ public class IncompatibilitiesLabelProvider implements ITableLabelProvider, IFon
if(siblingsList.size() > 1) {
for(int i = 1; i < siblingsList.size(); i++) {
- output += ", ";
+ output += ", "; //$NON-NLS-1$
output += siblingsList.get(i).getQualifiedName();
}
}
-
}
if(siblings.size() > 1) {
- output += "]";
+ output += "]"; //$NON-NLS-1$
}
return output;
}
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ *
+ * @param element
+ * @param columnIndex
+ * @return
+ */
public String getColumnText(Object element, int columnIndex) {
switch(columnIndex) {
case 0:
- String name = "";
+ String name = ""; //$NON-NLS-1$
if(element instanceof Combination) {
Combination combination = (Combination)element;
if(!combination.getMembers().isEmpty()) {
- // name += produceSiblingList(combination.getMembers().get(0).getExtensionDefinition().getStereotype());
name += combination.getMembers().get(0).getExtensionDefinition().getStereotype().getName();
if(((Combination)element).getMembers().size() > 1) {
for(int i = 1; i < combination.getMembers().size(); i++) {
- name += ", ";
+ name += ", "; //$NON-NLS-1$
name += combination.getMembers().get(i).getExtensionDefinition().getStereotype().getName();
- // name += produceSiblingList(combination.getMembers().get(i).getExtensionDefinition().getStereotype());
}
}
@@ -142,7 +184,6 @@ public class IncompatibilitiesLabelProvider implements ITableLabelProvider, IFon
break;
case 1:
-
break;
default:
@@ -152,11 +193,15 @@ public class IncompatibilitiesLabelProvider implements ITableLabelProvider, IFon
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public Font getFont(Object element) {
-
if(element instanceof ExtensionDefinition) {
-
if(((ExtensionDefinition)element).getStereotype().isAbstract()) {
return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelContentProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelContentProvider.java
index 0b9148f5022..c1f8cde5ed8 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelContentProvider.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelContentProvider.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.providers;
import java.util.ArrayList;
@@ -11,23 +24,38 @@ import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetaclass;
import org.eclipse.papyrus.facadeSpecificEditor.metamodel.MetamodelUtils;
+
public class MetamodelContentProvider implements ITreeContentProvider {
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ *
+ */
public void dispose() {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ *
+ * @param viewer
+ * @param oldInput
+ * @param newInput
+ */
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
+ *
+ * @param inputElement
+ * @return
+ */
public Object[] getElements(Object inputElement) {
-
List<VirtualElement> elements = new ArrayList<VirtualElement>();
if(inputElement instanceof Facade) {
@@ -37,6 +65,12 @@ public class MetamodelContentProvider implements ITreeContentProvider {
return elements.toArray();
}
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ *
+ * @param parentElement
+ * @return
+ */
public Object[] getChildren(Object parentElement) {
List<VirtualMetaclass> children = new ArrayList<VirtualMetaclass>();
@@ -45,30 +79,37 @@ public class MetamodelContentProvider implements ITreeContentProvider {
for(VirtualClassifier classifier : ((VirtualMetaclass)parentElement).getMetamodel().getVirtualClassifiers()) {
if(classifier instanceof VirtualMetaclass)
-
if(((VirtualMetaclass)classifier).getParents().contains(parentElement)) {
children.add((VirtualMetaclass)classifier);
}
-
}
return children.toArray();
}
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public Object getParent(Object element) {
- // TODO Auto-generated method stub
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public boolean hasChildren(Object element) {
-
if(getChildren(element).length == 0) {
return false;
} else {
return true;
}
- // return true;
}
}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelLabelProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelLabelProvider.java
index b104aeda502..2de7bdc30a3 100644
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelLabelProvider.java
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/MetamodelLabelProvider.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.facadeSpecificEditor.providers;
import org.eclipse.emf.ecore.ENamedElement;
@@ -11,7 +24,8 @@ import org.eclipse.papyrus.facade.virtualmetamodel.VirtualDatatype;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualEnum;
import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetaclass;
-import org.eclipse.papyrus.facadeSpecificEditor.Activator;
+import org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator;
+import org.eclipse.papyrus.facadeSpecificEditor.Messages;
import org.eclipse.papyrus.facadeSpecificEditor.metamodel.MetamodelUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
@@ -22,57 +36,84 @@ import org.eclipse.uml2.uml.NamedElement;
import com.swtdesigner.ResourceManager;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class MetamodelLabelProvider.
+ */
public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvider, IFontProvider, IColorProvider {
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
public void addListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ *
+ */
public void dispose() {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ *
+ * @param element
+ * @param property
+ * @return
+ */
public boolean isLabelProperty(Object element, String property) {
- // TODO Auto-generated method stub
return false;
}
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
public void removeListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
}
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ *
+ * @param element
+ * @param columnIndex
+ * @return
+ */
public Image getColumnImage(Object element, int columnIndex) {
switch(columnIndex) {
case 0:
if(element instanceof VirtualMetaclass) {
if(((VirtualMetaclass)element).isStereotypeInterface()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/virtualmetamodel/StereotypeInterface.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/virtualmetamodel/StereotypeInterface.gif"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/virtualmetamodel/VirtualMetaclass.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/virtualmetamodel/VirtualMetaclass.gif"); //$NON-NLS-1$
}
} else if(element instanceof VirtualDatatype) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/virtualmetamodel/VirtualDatatype.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/virtualmetamodel/VirtualDatatype.gif"); //$NON-NLS-1$
} else if(element instanceof VirtualEnum) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/virtualmetamodel/VirtualEnum.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/virtualmetamodel/VirtualEnum.gif"); //$NON-NLS-1$
}
break;
case 1:
if(element instanceof VirtualElement) {
if(((VirtualElement)element).isKept()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/checked.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/checked.gif"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/unchecked.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/unchecked.gif"); //$NON-NLS-1$
}
-
}
break;
case 2:
@@ -83,11 +124,22 @@ public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvid
if(element instanceof VirtualMetaclass) {
if(MetamodelUtils.canBeAbstract((VirtualMetaclass)element)) {
if(((VirtualMetaclass)element).isAbstract()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/checked.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/checked.gif"); //$NON-NLS-1$
} else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/unchecked.gif");
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/unchecked.gif"); //$NON-NLS-1$
}
}
+ }
+ break;
+
+ case 4:
+ if(element instanceof VirtualElement) {
+
+ if(((VirtualElement)element).isUseRepresented()) {
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/checked.gif"); //$NON-NLS-1$
+ } else {
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/unchecked.gif"); //$NON-NLS-1$
+ }
}
break;
@@ -98,11 +150,18 @@ public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvid
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ *
+ * @param element
+ * @param columnIndex
+ * @return
+ */
public String getColumnText(Object element, int columnIndex) {
switch(columnIndex) {
case 0:
- String result = "Unknow";
+ String result = Messages.MetamodelLabelProvider_8;
if(element instanceof VirtualElement) {
if(((VirtualElement)element).getRepresentedElement() instanceof ENamedElement) {
result = ((ENamedElement)((VirtualElement)element).getRepresentedElement()).getName();
@@ -112,17 +171,17 @@ public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvid
if(element instanceof VirtualMetaclass) {
if(!((VirtualMetaclass)element).getAppliedStereotypes().isEmpty()) {
- result += " (";
+ result += " ("; //$NON-NLS-1$
result += ((VirtualMetaclass)element).getAppliedStereotypes().get(0).getExtensionDefinition().getStereotype().getName();
if(((VirtualMetaclass)element).getAppliedStereotypes().size() > 1) {
for(int i = 1; i < ((VirtualMetaclass)element).getAppliedStereotypes().size(); i++) {
- result += ", ";
+ result += ", "; //$NON-NLS-1$
result += ((VirtualMetaclass)element).getAppliedStereotypes().get(i).getExtensionDefinition().getStereotype().getName();
}
}
- result += ")";
+ result += ")"; //$NON-NLS-1$
}
}
}
@@ -130,7 +189,6 @@ public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvid
return result;
case 1:
-
break;
case 2:
@@ -140,7 +198,6 @@ public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvid
break;
case 3:
-
break;
default:
@@ -150,21 +207,37 @@ public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvid
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public Image getImage(Object element) {
- // TODO Auto-generated method stub
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public String getText(Object element) {
return getColumnText(element, 0) + getColumnText(element, 2);
}
+ /**
+ * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public Font getFont(Object element) {
-
if(element instanceof VirtualMetaclass) {
if(((VirtualMetaclass)element).isAbstract()) {
@@ -172,10 +245,15 @@ public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvid
}
}
-
return JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
}
+ /**
+ * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public Color getForeground(Object element) {
if(element instanceof VirtualElement) {
@@ -186,6 +264,12 @@ public class MetamodelLabelProvider implements ITableLabelProvider, ILabelProvid
return null;
}
+ /**
+ * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
public Color getBackground(Object element) {
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/PropertiesContentProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/PropertiesContentProvider.java
deleted file mode 100644
index 425ced8e708..00000000000
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/PropertiesContentProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.papyrus.facadeSpecificEditor.providers;
-
-import java.util.ArrayList;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualEnum;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetaclass;
-
-public class PropertiesContentProvider implements IStructuredContentProvider {
-
-
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
-
- }
-
-
- public Object[] getElements(Object inputElement) {
- ArrayList<VirtualElement> output = new ArrayList<VirtualElement>();
- if(inputElement instanceof VirtualMetaclass) {
- output.addAll(((VirtualMetaclass)inputElement).getProperties());
- output.addAll(((VirtualMetaclass)inputElement).getOperations());
- }
- if(inputElement instanceof VirtualEnum) {
- output.addAll(((VirtualEnum)inputElement).getLiterals());
- }
-
- return output.toArray();
- }
-
-}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/PropertiesLabelProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/PropertiesLabelProvider.java
deleted file mode 100644
index ad66145d01b..00000000000
--- a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/PropertiesLabelProvider.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.eclipse.papyrus.facadeSpecificEditor.providers;
-
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualLiteral;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualOperation;
-import org.eclipse.papyrus.facade.virtualmetamodel.VirtualProperty;
-import org.eclipse.papyrus.facadeSpecificEditor.Activator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Property;
-
-import com.swtdesigner.ResourceManager;
-
-public class PropertiesLabelProvider implements ITableLabelProvider {
-
-
- public void addListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
-
- }
-
-
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
-
- public boolean isLabelProperty(Object element, String property) {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public void removeListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
-
- }
-
-
- public Image getColumnImage(Object element, int columnIndex) {
- switch(columnIndex) {
- case 0:
- if(element instanceof VirtualProperty) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/virtualmetamodel/VirtualReference.gif");
-
- } else if(element instanceof VirtualOperation) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/virtualmetamodel/VirtualOperation.gif");
-
- } else if(element instanceof VirtualLiteral) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/virtualmetamodel/VirtualLiteral.gif");
-
- }
- break;
- case 1:
- if(element instanceof VirtualElement) {
-
- // if(!(((VirtualProperty)element).getRepresentedElement() instanceof Property)) {
- if(((VirtualElement)element).isKept()) {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/checked.gif");
- } else {
- return ResourceManager.getPluginImage(Activator.getDefault(), "icons/unchecked.gif");
- }
- // }
- }
- break;
- case 2:
-
- break;
- case 3:
-
- break;
- case 4:
-
- break;
- default:
- break;
- }
-
- return null;
- }
-
-
- public String getColumnText(Object element, int columnIndex) {
- switch(columnIndex) {
- case 0:
- if(element instanceof VirtualElement) {
-
- String name = "";
- if(((VirtualElement)element).getRepresentedElement() instanceof ENamedElement) {
- name += ((ENamedElement)((VirtualElement)element).getRepresentedElement()).getName();
- if(((VirtualElement)element).getRepresentedElement() instanceof EStructuralFeature) {
- name += " (" + ((EStructuralFeature)((VirtualElement)element).getRepresentedElement()).getEType().getName() + ")";
- }
- } else if(((VirtualElement)element).getRepresentedElement() instanceof NamedElement) {
- name += ((NamedElement)((VirtualElement)element).getRepresentedElement()).getName();
- if(((VirtualElement)element).getRepresentedElement() instanceof Property) {
- name += " (" + ((Property)((VirtualElement)element).getRepresentedElement()).getType().getName() + ")";
- }
- }
-
- return name;
- }
- break;
- case 1:
-
- break;
- case 2:
- // if(!(((VirtualProperty)element).getRepresentedElement() instanceof Property)) {
- if(element instanceof VirtualElement) {
- return ((VirtualElement)element).getAliasName();
- }
- // }
-
- break;
- case 3:
- if(element instanceof VirtualProperty) {
- return ((VirtualProperty)element).getLower() + "";
- }
- break;
- case 4:
- if(element instanceof VirtualProperty) {
- return ((VirtualProperty)element).getUpper() + "";
- }
- break;
- default:
- break;
- }
-
- return null;
- }
-
-}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/TypedElementContentProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/TypedElementContentProvider.java
new file mode 100644
index 00000000000..420a28fdec3
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/TypedElementContentProvider.java
@@ -0,0 +1,90 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.facadeSpecificEditor.providers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualEnum;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualMetaclass;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualOperation;
+
+public class TypedElementContentProvider implements ITreeContentProvider {
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ *
+ */
+
+ public void dispose() {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ *
+ * @param viewer
+ * @param oldInput
+ * @param newInput
+ */
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ *
+ * @param inputElement
+ * @return
+ */
+
+ public Object[] getElements(Object inputElement) {
+ ArrayList<VirtualElement> output = new ArrayList<VirtualElement>();
+ if(inputElement instanceof VirtualMetaclass) {
+ output.addAll(((VirtualMetaclass)inputElement).getProperties());
+ output.addAll(((VirtualMetaclass)inputElement).getOperations());
+ }
+ if(inputElement instanceof VirtualEnum) {
+ output.addAll(((VirtualEnum)inputElement).getLiterals());
+ }
+
+ return output.toArray();
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ List<Object> result = new ArrayList<Object>();
+ if(parentElement instanceof VirtualOperation) {
+ result.addAll(((VirtualOperation)parentElement).getParameters());
+ }
+
+ return result.toArray();
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if(getChildren(element).length == 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/TypedElementLabelProvider.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/TypedElementLabelProvider.java
new file mode 100644
index 00000000000..355c9e70f4f
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/providers/TypedElementLabelProvider.java
@@ -0,0 +1,176 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.facadeSpecificEditor.providers;
+
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualElement;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualLiteral;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualOperation;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualParameter;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualProperty;
+import org.eclipse.papyrus.facade.virtualmetamodel.VirtualTypedElement;
+import org.eclipse.papyrus.facadeSpecificEditor.FacadeDefinitionEditorActivator;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.NamedElement;
+
+import com.swtdesigner.ResourceManager;
+
+public class TypedElementLabelProvider implements ITableLabelProvider {
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+
+ public void addListener(ILabelProviderListener listener) {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ *
+ */
+ public void dispose() {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ *
+ * @param element
+ * @param property
+ * @return
+ */
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+
+ public void removeListener(ILabelProviderListener listener) {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ *
+ * @param element
+ * @param columnIndex
+ * @return
+ */
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ switch(columnIndex) {
+ case 0:
+ if(element instanceof VirtualProperty) {
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/virtualmetamodel/VirtualReference.gif"); //$NON-NLS-1$
+
+ } else if(element instanceof VirtualOperation) {
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/virtualmetamodel/VirtualOperation.gif"); //$NON-NLS-1$
+
+ } else if(element instanceof VirtualLiteral) {
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/virtualmetamodel/VirtualLiteral.gif"); //$NON-NLS-1$
+
+ } else if(element instanceof VirtualParameter) {
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/virtualmetamodel/VirtualParameter.gif"); //$NON-NLS-1$
+
+ }
+ break;
+ case 1:
+ if(element instanceof VirtualElement) {
+ if(((VirtualElement)element).isKept()) {
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/checked.gif"); //$NON-NLS-1$
+ } else {
+ return ResourceManager.getPluginImage(FacadeDefinitionEditorActivator.getDefault(), "icons/unchecked.gif"); //$NON-NLS-1$
+ }
+ }
+ break;
+ case 2:
+
+ break;
+ case 3:
+
+ break;
+ case 4:
+
+ break;
+ default:
+ break;
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ *
+ * @param element
+ * @param columnIndex
+ * @return
+ */
+
+ public String getColumnText(Object element, int columnIndex) {
+ switch(columnIndex) {
+ case 0:
+ if(element instanceof VirtualElement) {
+
+ String name = ""; //$NON-NLS-1$
+ if(((VirtualElement)element).getRepresentedElement() instanceof ENamedElement) {
+ name += ((ENamedElement)((VirtualElement)element).getRepresentedElement()).getName();
+ } else if(((VirtualElement)element).getRepresentedElement() instanceof NamedElement) {
+ name += ((NamedElement)((VirtualElement)element).getRepresentedElement()).getName();
+ }
+
+ if(element instanceof VirtualTypedElement) {
+ if(((VirtualTypedElement)element).getType() != null) {
+ name += " (" + ((VirtualTypedElement)element).getType().getAliasName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ return name;
+ }
+ break;
+ case 1:
+
+ break;
+ case 2:
+ if(element instanceof VirtualElement) {
+ return ((VirtualElement)element).getAliasName();
+ }
+ break;
+ case 3:
+ if(element instanceof VirtualTypedElement) {
+ return ((VirtualTypedElement)element).getLower() + ""; //$NON-NLS-1$
+ }
+ break;
+ case 4:
+ if(element instanceof VirtualTypedElement) {
+ return ((VirtualTypedElement)element).getUpper() + ""; //$NON-NLS-1$
+ }
+ break;
+ default:
+ break;
+ }
+
+ return null;
+ }
+}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/utils/CombinationGenerator.java b/extraplugins/facade/org.eclipse.papyrus.facade.definition.editor/src/org/eclipse/papyrus/facadeSpecificEditor/utils/CombinationGe