From 0973169f12e43fcb4430e9b31a9f2457ad7fc287 Mon Sep 17 00:00:00 2001 From: Quentin Le Menez Date: Tue, 5 Jul 2016 15:52:36 +0200 Subject: Bug 497306: [PropertyLifecycle] There is no tool that handles customization based on contextual modifications of an element https://bugs.eclipse.org/bugs/show_bug.cgi?id=497306 - First draft of the tool Signed-off-by: Quentin Le Menez --- .../.classpath | 7 + .../.gitignore | 1 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 15 + .../about.html | 28 + .../build.properties | 20 + ...tainer_containersContainer_ElementContainer.gif | Bin 0 -> 223 bytes ...CreateElementProperty_triggers_BasicTrigger.gif | Bin 0 -> 223 bytes ...lementProperty_valueProcessor_JavaProcessor.gif | Bin 0 -> 223 bytes ...yElement_elementContainers_ElementContainer.gif | Bin 0 -> 223 bytes ...gyElement_elementProperties_ElementProperty.gif | Bin 0 -> 223 bytes ...reateStrategySet_strategies_StrategyElement.gif | Bin 0 -> 223 bytes .../icons/full/obj16/BasicTrigger.gif | Bin 0 -> 129 bytes .../icons/full/obj16/ElementContainer.gif | Bin 0 -> 129 bytes .../icons/full/obj16/ElementProperty.gif | Bin 0 -> 129 bytes .../icons/full/obj16/JavaProcessor.gif | Bin 0 -> 129 bytes .../icons/full/obj16/StrategyElement.gif | Bin 0 -> 129 bytes .../icons/full/obj16/StrategySet.gif | Bin 0 -> 129 bytes .../plugin.properties | 58 + .../plugin.xml | 32 + .../pom.xml | 16 + .../provider/AbstractTriggerItemProvider.java | 127 + .../AbstractValueProcessorItemProvider.java | 127 + .../provider/BasicTriggerItemProvider.java | 214 ++ .../provider/ElementContainerItemProvider.java | 161 + .../provider/ElementPropertyItemProvider.java | 244 ++ .../provider/ElementTemplateItemProvider.java | 186 + .../provider/JavaProcessorItemProvider.java | 147 + .../provider/PropertylifecycleEditPlugin.java | 106 + ...ropertylifecycleItemProviderAdapterFactory.java | 421 +++ .../provider/StrategyElementItemProvider.java | 239 ++ .../provider/StrategySetItemProvider.java | 161 + .../provider/StrategyTemplateItemProvider.java | 209 ++ .../.classpath | 7 + .../.gitignore | 1 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 18 + .../about.html | 28 + .../build.properties | 20 + .../full/obj16/PropertylifecycleModelFile.gif | Bin 0 -> 346 bytes .../icons/full/wizban/NewPropertylifecycle.gif | Bin 0 -> 2462 bytes .../plugin.properties | 62 + .../plugin.xml | 47 + .../pom.xml | 16 + .../PropertylifecycleActionBarContributor.java | 450 +++ .../presentation/PropertylifecycleEditor.java | 1880 ++++++++++ .../PropertylifecycleEditorPlugin.java | 108 + .../presentation/PropertylifecycleModelWizard.java | 662 ++++ .../.classpath | 8 + .../.gitignore | 1 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 19 + .../about.html | 28 + .../build.properties | 21 + .../model/papyrus/propertylifecycle.css | 57 + .../model/papyrus/propertylifecycle.di | 2 + .../model/papyrus/propertylifecycle.notation | 3765 ++++++++++++++++++++ .../model/papyrus/propertylifecycle.uml | 449 +++ .../model/propertylifecycle.ecore | 89 + .../model/propertylifecycle.genmodel | 56 + .../plugin.properties | 16 + .../plugin.xml | 49 + .../pom.xml | 16 + .../schema/propertylifecyclestrategyset.exsd | 106 + .../papyrus/propertylifecycle/AbstractTrigger.java | 32 + .../propertylifecycle/AbstractValueProcessor.java | 32 + .../papyrus/propertylifecycle/BasicTrigger.java | 156 + .../propertylifecycle/ElementContainer.java | 66 + .../papyrus/propertylifecycle/ElementProperty.java | 148 + .../papyrus/propertylifecycle/ElementTemplate.java | 97 + .../papyrus/propertylifecycle/JavaProcessor.java | 66 + .../PropertylifecycleFactory.java | 106 + .../PropertylifecyclePackage.java | 1299 +++++++ .../papyrus/propertylifecycle/StrategyElement.java | 73 + .../papyrus/propertylifecycle/StrategySet.java | 55 + .../propertylifecycle/StrategyTemplate.java | 127 + .../impl/AbstractTriggerImpl.java | 50 + .../impl/AbstractValueProcessorImpl.java | 50 + .../propertylifecycle/impl/BasicTriggerImpl.java | 370 ++ .../impl/ElementContainerImpl.java | 204 ++ .../impl/ElementPropertyImpl.java | 393 ++ .../impl/ElementTemplateImpl.java | 249 ++ .../propertylifecycle/impl/JavaProcessorImpl.java | 187 + .../impl/PropertylifecycleFactoryImpl.java | 183 + .../impl/PropertylifecyclePackageImpl.java | 659 ++++ .../impl/StrategyElementImpl.java | 459 +++ .../propertylifecycle/impl/StrategySetImpl.java | 169 + .../impl/StrategyTemplateImpl.java | 310 ++ .../util/PropertylifecycleAdapterFactory.java | 318 ++ .../util/PropertylifecycleResourceFactoryImpl.java | 54 + .../util/PropertylifecycleResourceImpl.java | 41 + .../util/PropertylifecycleSwitch.java | 375 ++ .../papyrus/propertylifecycle/model/Activator.java | 73 + .../IStrategySetExtensionPoint.java | 30 + .../model/registries/StrategySetRegistry.java | 172 + .../.classpath | 7 + .../.gitignore | 1 + .../.options | 3 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 14 + .../about.html | 28 + .../build.properties | 4 + .../icons/menu/removeStrategyModel_16x16.gif | Bin 0 -> 382 bytes .../icons/menu/removeStrategy_16x16.gif | Bin 0 -> 248 bytes .../icons/navigation/arrow_left_16x16.gif | Bin 0 -> 327 bytes .../icons/navigation/arrow_left_double_16x16.gif | Bin 0 -> 597 bytes .../icons/navigation/arrow_right_16x16.gif | Bin 0 -> 541 bytes .../icons/navigation/arrow_right_double_16x16.gif | Bin 0 -> 594 bytes .../icons/navigation/synced_16x16.gif | Bin 0 -> 160 bytes .../icons/tableViewer/checked_12x12.gif | Bin 0 -> 90 bytes .../icons/tableViewer/unchecked_12x12.gif | Bin 0 -> 67 bytes .../icons/treeViewer/container_16x16.gif | Bin 0 -> 354 bytes .../icons/treeViewer/property_16x16.gif | Bin 0 -> 343 bytes .../icons/treeViewer/resource_16x16.gif | Bin 0 -> 582 bytes .../icons/treeViewer/strategySet_16x16.gif | Bin 0 -> 227 bytes .../icons/treeViewer/strategy_16x16.gif | Bin 0 -> 216 bytes .../plugin.xml | 14 + .../pom.xml | 16 + .../propertylifecycle/preferences/Activator.java | 120 + .../preferences/messages/Messages.java | 129 + .../preferences/messages/messages.properties | 52 + .../preferences/pages/AdvancedTab.java | 390 ++ .../pages/AdvancedTabLeftViewerComposite.java | 258 ++ .../pages/AdvancedTabRightViewerComposite.java | 568 +++ .../preferences/pages/BasicTab.java | 413 +++ .../pages/PropertyLifecyclePageComposite.java | 248 ++ .../pages/PropertyLifecyclePreferencesPage.java | 113 + .../utils/AdvancedTabLabelProvider.java | 109 + .../preferences/utils/AdvancedTabViewerUtils.java | 43 + .../preferences/utils/BrowseButton.java | 117 + .../preferences/utils/BrowserUtils.java | 156 + .../preferences/utils/ConvertEcoreToUML.java | 251 ++ .../utils/PropertyLifecyclePreferencesManager.java | 359 ++ .../preferences/utils/SaveButton.java | 140 + .../.classpath | 7 + .../.gitignore | 1 + .../org.eclipse.papyrus.propertylifecycle/.options | 7 + .../org.eclipse.papyrus.propertylifecycle/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 19 + .../about.html | 28 + .../build.properties | 7 + .../PropertyLifecycle.elementtypesconfigurations | 23 + .../plugin.xml | 12 + .../org.eclipse.papyrus.propertylifecycle/pom.xml | 10 + .../papyrus/propertylifecycle/Activator.java | 82 + .../commands/LifeCycleEditElementCommand.java | 155 + .../commands/LifecycleSetCommand.java | 130 + .../advice/PropertyLifecycleHelperAdvice.java | 249 ++ .../propertylifecycle/messages/Messages.java | 35 + .../propertylifecycle/messages/messages.properties | 1 + .../utils/CommandValueProcessor.java | 26 + .../utils/PropertyLifecycleManager.java | 575 +++ .../.classpath | 7 + .../.gitignore | 1 + .../.options | 3 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 16 + .../about.html | 28 + .../build.properties | 5 + .../pom.xml | 16 + .../papyrus/sysml/propertylifecycle/Activator.java | 76 + .../processors/ActorPartPropertyProcessor.java | 61 + .../processors/AllocateProcessor.java | 62 + .../processors/BlockProcessor.java | 62 + .../processors/ConformProcessor.java | 62 + .../ConstraintBlockParameterProcessor.java | 61 + .../processors/ConstraintBlockProcessor.java | 62 + .../processors/ConstraintPropertyProcessor.java | 62 + .../processors/CopyProcessor.java | 62 + .../processors/DimensionProcessor.java | 62 + .../processors/FlowPortProcessor.java | 61 + .../processors/FlowPropertyProcessor.java | 61 + .../processors/FlowSpecificationprocessor.java | 61 + .../processors/ItemFlowProcessor.java | 61 + .../processors/PartPropertyProcessor.java | 61 + .../processors/ReferencePropertyProcessor.java | 61 + .../processors/RequirementProcessor.java | 62 + .../processors/SatisfyProcessor.java | 63 + .../processors/UnitProcessor.java | 63 + .../processors/ValuePropertyProcessor.java | 61 + .../processors/ValueTypeProcessor.java | 62 + .../processors/VerifyProcessor.java | 62 + .../processors/ViewPointProcessor.java | 62 + .../processors/ViewProcessor.java | 61 + .../.classpath | 7 + .../.gitignore | 1 + .../.options | 3 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 15 + .../about.html | 28 + .../build.properties | 5 + .../pom.xml | 16 + .../papyrus/uml/propertylifecycle/Activator.java | 76 + .../processors/AssociationProcessor.java | 150 + .../processors/ExtendProcessor.java | 86 + .../processors/PropertyProcessor.java | 85 + .../processors/RoleBindingProcessor.java | 52 + .../.classpath | 7 + .../.options | 3 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 31 + .../about.html | 28 + .../build.properties | 4 + .../plugin.xml | 5 + .../pom.xml | 16 + .../papyrus/propertylifecycle/tests/Activator.java | 63 + .../papyrus/propertylifecycle/tests/AllTests.java | 27 + .../tests/model/UMLTestModel.java | 168 + .../tests/strategies/StrategyTestModel.java | 229 ++ .../processors/AssociationProcessor.java | 147 + .../strategies/processors/ClassProcessor.java | 103 + .../strategies/processors/ComponentProcessor.java | 101 + .../strategies/processors/PropertyProcessor.java | 92 + .../processors/Sysml14BlockProcessor.java | 58 + .../strategies/processors/SysmlBlockProcessor.java | 64 + .../tests/AbstractPropertyLifecycleTests.java | 316 ++ .../tests/tests/PropertyLifecycleTests.java | 434 +++ .../tests/utils/ITestConstants.java | 179 + .../tests/utils/StrategyFactory.java | 183 + 227 files changed, 26655 insertions(+) create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.classpath create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.gitignore create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.project create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.settings/org.eclipse.jdt.core.prefs create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/META-INF/MANIFEST.MF create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/about.html create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/build.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementContainer_containersContainer_ElementContainer.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementProperty_triggers_BasicTrigger.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementProperty_valueProcessor_JavaProcessor.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategyElement_elementContainers_ElementContainer.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategyElement_elementProperties_ElementProperty.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategySet_strategies_StrategyElement.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/BasicTrigger.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/ElementContainer.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/ElementProperty.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/JavaProcessor.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/StrategyElement.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/StrategySet.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/plugin.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/plugin.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/pom.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/AbstractTriggerItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/AbstractValueProcessorItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/BasicTriggerItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementContainerItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementPropertyItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementTemplateItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/JavaProcessorItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/PropertylifecycleEditPlugin.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/PropertylifecycleItemProviderAdapterFactory.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategyElementItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategySetItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategyTemplateItemProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.classpath create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.gitignore create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.project create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.settings/org.eclipse.jdt.core.prefs create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/META-INF/MANIFEST.MF create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/about.html create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/build.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/icons/full/obj16/PropertylifecycleModelFile.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/icons/full/wizban/NewPropertylifecycle.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/plugin.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/plugin.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/pom.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleActionBarContributor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleEditor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleEditorPlugin.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleModelWizard.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.classpath create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.gitignore create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.project create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.settings/org.eclipse.jdt.core.prefs create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/META-INF/MANIFEST.MF create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/about.html create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/build.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.css create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.di create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.notation create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.uml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/propertylifecycle.ecore create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/propertylifecycle.genmodel create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/plugin.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/plugin.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/pom.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/schema/propertylifecyclestrategyset.exsd create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/AbstractTrigger.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/AbstractValueProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/BasicTrigger.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementContainer.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementProperty.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementTemplate.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/JavaProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/PropertylifecycleFactory.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/PropertylifecyclePackage.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategyElement.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategySet.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategyTemplate.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/AbstractTriggerImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/AbstractValueProcessorImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/BasicTriggerImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementContainerImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementPropertyImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementTemplateImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/JavaProcessorImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/PropertylifecycleFactoryImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/PropertylifecyclePackageImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategyElementImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategySetImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategyTemplateImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleAdapterFactory.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleResourceFactoryImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleResourceImpl.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleSwitch.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/Activator.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/extensionpoints/IStrategySetExtensionPoint.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/registries/StrategySetRegistry.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.classpath create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.gitignore create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.options create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.project create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.settings/org.eclipse.jdt.core.prefs create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/META-INF/MANIFEST.MF create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/about.html create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/build.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/menu/removeStrategyModel_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/menu/removeStrategy_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_left_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_left_double_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_right_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_right_double_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/synced_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/tableViewer/checked_12x12.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/tableViewer/unchecked_12x12.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/container_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/property_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/resource_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/strategySet_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/strategy_16x16.gif create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/plugin.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/pom.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/Activator.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/messages/Messages.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/messages/messages.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTab.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTabLeftViewerComposite.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTabRightViewerComposite.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/BasicTab.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/PropertyLifecyclePageComposite.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/PropertyLifecyclePreferencesPage.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/AdvancedTabLabelProvider.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/AdvancedTabViewerUtils.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/BrowseButton.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/BrowserUtils.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/ConvertEcoreToUML.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/PropertyLifecyclePreferencesManager.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/SaveButton.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.classpath create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.gitignore create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.options create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.project create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.settings/org.eclipse.jdt.core.prefs create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/META-INF/MANIFEST.MF create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/about.html create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/build.properties create mode 100644 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/model/PropertyLifecycle.elementtypesconfigurations create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/plugin.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/pom.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/Activator.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/commands/LifeCycleEditElementCommand.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/commands/LifecycleSetCommand.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/helper/advice/PropertyLifecycleHelperAdvice.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/messages/Messages.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/messages/messages.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/utils/CommandValueProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/utils/PropertyLifecycleManager.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.classpath create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.gitignore create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.options create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.project create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.settings/org.eclipse.jdt.core.prefs create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/META-INF/MANIFEST.MF create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/about.html create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/build.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/pom.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/Activator.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ActorPartPropertyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/AllocateProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/BlockProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConformProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockParameterProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintPropertyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/CopyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/DimensionProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPortProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPropertyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowSpecificationprocessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ItemFlowProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/PartPropertyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ReferencePropertyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/RequirementProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/SatisfyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/UnitProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValuePropertyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValueTypeProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/VerifyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewPointProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.classpath create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.gitignore create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.options create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.project create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.settings/org.eclipse.jdt.core.prefs create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/META-INF/MANIFEST.MF create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/about.html create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/build.properties create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/pom.xml create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/Activator.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/AssociationProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/ExtendProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/PropertyProcessor.java create mode 100755 extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/RoleBindingProcessor.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.classpath create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.options create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.project create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.settings/org.eclipse.jdt.core.prefs create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/META-INF/MANIFEST.MF create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/about.html create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/build.properties create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/plugin.xml create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/pom.xml create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/Activator.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/AllTests.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/model/UMLTestModel.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/StrategyTestModel.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/AssociationProcessor.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/ClassProcessor.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/ComponentProcessor.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/PropertyProcessor.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/Sysml14BlockProcessor.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/SysmlBlockProcessor.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/tests/AbstractPropertyLifecycleTests.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/tests/PropertyLifecycleTests.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/utils/ITestConstants.java create mode 100755 tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/utils/StrategyFactory.java diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.classpath b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.classpath new file mode 100755 index 00000000000..26e67d64ad0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.gitignore b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.gitignore new file mode 100755 index 00000000000..ae3c1726048 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.project b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.project new file mode 100755 index 00000000000..953105cc0a1 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.propertylifecycle.model.edit + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.settings/org.eclipse.jdt.core.prefs b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..0c68a61dca8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/META-INF/MANIFEST.MF b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..0d159382493 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.propertylifecycle.model.edit;singleton:=true +Bundle-Version: 0.0.1.qualifier +Bundle-ClassPath: . +Bundle-Activator: org.eclipse.papyrus.propertylifecycle.provider.PropertylifecycleEditPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Export-Package: org.eclipse.papyrus.propertylifecycle.provider +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.papyrus.propertylifecycle.model;bundle-version="0.0.1";visibility:=reexport, + org.eclipse.emf.edit;bundle-version="2.12.0";visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/about.html b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/about.html new file mode 100755 index 00000000000..d35d5aed64c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/build.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/build.properties new file mode 100755 index 00000000000..477e474a141 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/build.properties @@ -0,0 +1,20 @@ +# Copyright (c) 2016 CEA LIST and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# +# Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html +jars.compile.order = . +source.. = src-gen/ +output.. = bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementContainer_containersContainer_ElementContainer.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementContainer_containersContainer_ElementContainer.gif new file mode 100755 index 00000000000..0a9ad1c7ea8 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementContainer_containersContainer_ElementContainer.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementProperty_triggers_BasicTrigger.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementProperty_triggers_BasicTrigger.gif new file mode 100755 index 00000000000..a259b8fb4f2 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementProperty_triggers_BasicTrigger.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementProperty_valueProcessor_JavaProcessor.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementProperty_valueProcessor_JavaProcessor.gif new file mode 100755 index 00000000000..52be1a507e5 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateElementProperty_valueProcessor_JavaProcessor.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategyElement_elementContainers_ElementContainer.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategyElement_elementContainers_ElementContainer.gif new file mode 100755 index 00000000000..59232185315 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategyElement_elementContainers_ElementContainer.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategyElement_elementProperties_ElementProperty.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategyElement_elementProperties_ElementProperty.gif new file mode 100755 index 00000000000..263f6e69405 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategyElement_elementProperties_ElementProperty.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategySet_strategies_StrategyElement.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategySet_strategies_StrategyElement.gif new file mode 100755 index 00000000000..05c17b39cf5 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/ctool16/CreateStrategySet_strategies_StrategyElement.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/BasicTrigger.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/BasicTrigger.gif new file mode 100755 index 00000000000..badaab0664a Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/BasicTrigger.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/ElementContainer.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/ElementContainer.gif new file mode 100755 index 00000000000..338fb8d9a72 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/ElementContainer.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/ElementProperty.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/ElementProperty.gif new file mode 100755 index 00000000000..d3dc5a9ad81 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/ElementProperty.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/JavaProcessor.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/JavaProcessor.gif new file mode 100755 index 00000000000..7bac4fd3808 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/JavaProcessor.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/StrategyElement.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/StrategyElement.gif new file mode 100755 index 00000000000..cb1755a7125 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/StrategyElement.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/StrategySet.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/StrategySet.gif new file mode 100755 index 00000000000..106881e5d9b Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/icons/full/obj16/StrategySet.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/plugin.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/plugin.properties new file mode 100755 index 00000000000..866671fb27e --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/plugin.properties @@ -0,0 +1,58 @@ +# Copyright (c) 2016 CEA LIST and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# +# Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + +pluginName = Propertylifecycle Edit Support +providerName = www.example.org + +_UI_CreateChild_text = {0} +_UI_CreateChild_text2 = {1} {0} +_UI_CreateChild_text3 = {1} +_UI_CreateChild_tooltip = Create New {0} Under {1} Feature +_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. +_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. + +_UI_PropertyDescriptor_description = The {0} of the {1} + +_UI_StrategyTemplate_type = Strategy Template +_UI_StrategySet_type = Strategy Set +_UI_StrategyElement_type = Strategy Element +_UI_ElementTemplate_type = Element Template +_UI_ElementContainer_type = Element Container +_UI_ElementProperty_type = Element Property +_UI_AbstractTrigger_type = Abstract Trigger +_UI_AbstractValueProcessor_type = Abstract Value Processor +_UI_JavaProcessor_type = Java Processor +_UI_BasicTrigger_type = Basic Trigger +_UI_Unknown_type = Object + +_UI_Unknown_datatype= Value + +_UI_StrategyTemplate_name_feature = Name +_UI_StrategyTemplate_decription_feature = Decription +_UI_StrategyTemplate_id_feature = Id +_UI_StrategySet_strategies_feature = Strategies +_UI_StrategyElement_elementContainers_feature = Element Containers +_UI_StrategyElement_elementProperties_feature = Element Properties +_UI_ElementTemplate_baseType_feature = Base Type +_UI_ElementTemplate_specializedType_feature = Specialized Type +_UI_ElementContainer_containersContainer_feature = Containers Container +_UI_ElementProperty_featureLabel_feature = Feature Label +_UI_ElementProperty_priority_feature = Priority +_UI_ElementProperty_triggers_feature = Triggers +_UI_ElementProperty_valueProcessor_feature = Value Processor +_UI_JavaProcessor_className_feature = Class Name +_UI_BasicTrigger_onCreate_feature = On Create +_UI_BasicTrigger_onDelete_feature = On Delete +_UI_BasicTrigger_onOpen_feature = On Open +_UI_BasicTrigger_onMove_feature = On Move +_UI_Unknown_feature = Unspecified + +_UI_ElementTemplate_matcher_feature = Matcher diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/plugin.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/plugin.xml new file mode 100755 index 00000000000..ac7670721de --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/plugin.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/pom.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/pom.xml new file mode 100755 index 00000000000..fe1a842c067 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.eclipse.papyrus.infra.propertylifecycle.model.edit + 0.0.1.qualifier + org.eclipse.papyrus + eclipse-plugin + + org.eclipse.papyrus + org.eclipse.papyrus.infra.propertylifecycle + 0.0.1.qualifier + ../org.eclipse.papyrus.infra.propertylifecycle/pom.xml + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/AbstractTriggerItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/AbstractTriggerItemProvider.java new file mode 100755 index 00000000000..a32f955a49f --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/AbstractTriggerItemProvider.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.AbstractTrigger} object. + * + * + * + * @generated + */ +public class AbstractTriggerItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public AbstractTriggerItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + return getString("_UI_AbstractTrigger_type"); //$NON-NLS-1$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/AbstractValueProcessorItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/AbstractValueProcessorItemProvider.java new file mode 100755 index 00000000000..c3c24bcafe7 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/AbstractValueProcessorItemProvider.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor} object. + * + * + * + * @generated + */ +public class AbstractValueProcessorItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public AbstractValueProcessorItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + return getString("_UI_AbstractValueProcessor_type"); //$NON-NLS-1$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/BasicTriggerItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/BasicTriggerItemProvider.java new file mode 100755 index 00000000000..c20db0005b1 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/BasicTriggerItemProvider.java @@ -0,0 +1,214 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.propertylifecycle.BasicTrigger; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.BasicTrigger} object. + * + * + * + * @generated + */ +public class BasicTriggerItemProvider extends AbstractTriggerItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public BasicTriggerItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addOnCreatePropertyDescriptor(object); + addOnDeletePropertyDescriptor(object); + addOnOpenPropertyDescriptor(object); + addOnMovePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the On Create feature. + * + * + * + * @generated + */ + protected void addOnCreatePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_BasicTrigger_onCreate_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_BasicTrigger_onCreate_feature", "_UI_BasicTrigger_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.BASIC_TRIGGER__ON_CREATE, + true, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the On Delete feature. + * + * + * + * @generated + */ + protected void addOnDeletePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_BasicTrigger_onDelete_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_BasicTrigger_onDelete_feature", "_UI_BasicTrigger_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.BASIC_TRIGGER__ON_DELETE, + true, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the On Open feature. + * + * + * + * @generated + */ + protected void addOnOpenPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_BasicTrigger_onOpen_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_BasicTrigger_onOpen_feature", "_UI_BasicTrigger_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.BASIC_TRIGGER__ON_OPEN, + true, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the On Move feature. + * + * + * + * @generated + */ + protected void addOnMovePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_BasicTrigger_onMove_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_BasicTrigger_onMove_feature", "_UI_BasicTrigger_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.BASIC_TRIGGER__ON_MOVE, + true, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns BasicTrigger.gif. + * + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/BasicTrigger")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + BasicTrigger basicTrigger = (BasicTrigger) object; + return getString("_UI_BasicTrigger_type") + " " + basicTrigger.isOnCreate(); //$NON-NLS-1$ //$NON-NLS-2$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(BasicTrigger.class)) { + case PropertylifecyclePackage.BASIC_TRIGGER__ON_CREATE: + case PropertylifecyclePackage.BASIC_TRIGGER__ON_DELETE: + case PropertylifecyclePackage.BASIC_TRIGGER__ON_OPEN: + case PropertylifecyclePackage.BASIC_TRIGGER__ON_MOVE: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementContainerItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementContainerItemProvider.java new file mode 100755 index 00000000000..0e44d6f3b8e --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementContainerItemProvider.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.propertylifecycle.ElementContainer; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.ElementContainer} object. + * + * + * + * @generated + */ +public class ElementContainerItemProvider extends ElementTemplateItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public ElementContainerItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(PropertylifecyclePackage.Literals.ELEMENT_CONTAINER__CONTAINERS_CONTAINER); + } + return childrenFeatures; + } + + /** + * + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns ElementContainer.gif. + * + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ElementContainer")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ElementContainer) object).getBaseType(); + return label == null || label.length() == 0 ? getString("_UI_ElementContainer_type") //$NON-NLS-1$ + : + getString("_UI_ElementContainer_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ElementContainer.class)) { + case PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter(PropertylifecyclePackage.Literals.ELEMENT_CONTAINER__CONTAINERS_CONTAINER, + PropertylifecycleFactory.eINSTANCE.createElementContainer())); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementPropertyItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementPropertyItemProvider.java new file mode 100755 index 00000000000..a3e7c0ead64 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementPropertyItemProvider.java @@ -0,0 +1,244 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.ElementProperty} object. + * + * + * + * @generated + */ +public class ElementPropertyItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public ElementPropertyItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addFeatureLabelPropertyDescriptor(object); + addPriorityPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Feature Label feature. + * + * + * + * @generated + */ + protected void addFeatureLabelPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ElementProperty_featureLabel_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_ElementProperty_featureLabel_feature", "_UI_ElementProperty_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.ELEMENT_PROPERTY__FEATURE_LABEL, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Priority feature. + * + * + * + * @generated + */ + protected void addPriorityPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ElementProperty_priority_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_ElementProperty_priority_feature", "_UI_ElementProperty_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.ELEMENT_PROPERTY__PRIORITY, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(PropertylifecyclePackage.Literals.ELEMENT_PROPERTY__TRIGGERS); + childrenFeatures.add(PropertylifecyclePackage.Literals.ELEMENT_PROPERTY__VALUE_PROCESSOR); + } + return childrenFeatures; + } + + /** + * + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns ElementProperty.gif. + * + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ElementProperty")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ElementProperty) object).getFeatureLabel(); + return label == null || label.length() == 0 ? getString("_UI_ElementProperty_type") //$NON-NLS-1$ + : + getString("_UI_ElementProperty_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ElementProperty.class)) { + case PropertylifecyclePackage.ELEMENT_PROPERTY__FEATURE_LABEL: + case PropertylifecyclePackage.ELEMENT_PROPERTY__PRIORITY: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case PropertylifecyclePackage.ELEMENT_PROPERTY__TRIGGERS: + case PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter(PropertylifecyclePackage.Literals.ELEMENT_PROPERTY__TRIGGERS, + PropertylifecycleFactory.eINSTANCE.createBasicTrigger())); + + newChildDescriptors.add(createChildParameter(PropertylifecyclePackage.Literals.ELEMENT_PROPERTY__VALUE_PROCESSOR, + PropertylifecycleFactory.eINSTANCE.createJavaProcessor())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementTemplateItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementTemplateItemProvider.java new file mode 100755 index 00000000000..89902e1c88d --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/ElementTemplateItemProvider.java @@ -0,0 +1,186 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.propertylifecycle.ElementTemplate; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.ElementTemplate} object. + * + * + * + * @generated + */ +public class ElementTemplateItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public ElementTemplateItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addBaseTypePropertyDescriptor(object); + addSpecializedTypePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Base Type feature. + * + * + * + * @generated + */ + protected void addBaseTypePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ElementTemplate_baseType_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_ElementTemplate_baseType_feature", "_UI_ElementTemplate_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.ELEMENT_TEMPLATE__BASE_TYPE, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Specialized Type feature. + * + * + * + * @generated + */ + protected void addSpecializedTypePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ElementTemplate_specializedType_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_ElementTemplate_specializedType_feature", "_UI_ElementTemplate_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.ELEMENT_TEMPLATE__SPECIALIZED_TYPE, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ElementTemplate) object).getBaseType(); + return label == null || label.length() == 0 ? getString("_UI_ElementTemplate_type") //$NON-NLS-1$ + : + getString("_UI_ElementTemplate_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ElementTemplate.class)) { + case PropertylifecyclePackage.ELEMENT_TEMPLATE__BASE_TYPE: + case PropertylifecyclePackage.ELEMENT_TEMPLATE__SPECIALIZED_TYPE: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/JavaProcessorItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/JavaProcessorItemProvider.java new file mode 100755 index 00000000000..aa67cbd60fe --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/JavaProcessorItemProvider.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.propertylifecycle.JavaProcessor; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.JavaProcessor} object. + * + * + * + * @generated + */ +public class JavaProcessorItemProvider extends AbstractValueProcessorItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public JavaProcessorItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addClassNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Class Name feature. + * + * + * + * @generated + */ + protected void addClassNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_JavaProcessor_className_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_JavaProcessor_className_feature", "_UI_JavaProcessor_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.JAVA_PROCESSOR__CLASS_NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns JavaProcessor.gif. + * + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/JavaProcessor")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((JavaProcessor) object).getClassName(); + return label == null || label.length() == 0 ? getString("_UI_JavaProcessor_type") //$NON-NLS-1$ + : + getString("_UI_JavaProcessor_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(JavaProcessor.class)) { + case PropertylifecyclePackage.JAVA_PROCESSOR__CLASS_NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/PropertylifecycleEditPlugin.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/PropertylifecycleEditPlugin.java new file mode 100755 index 00000000000..10631195f90 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/PropertylifecycleEditPlugin.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the Propertylifecycle edit plugin. + * + * + * + * @generated + */ +public final class PropertylifecycleEditPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * + * @generated + */ + public static final PropertylifecycleEditPlugin INSTANCE = new PropertylifecycleEditPlugin(); + + /** + * Keep track of the singleton. + * + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * + * @generated + */ + public PropertylifecycleEditPlugin() { + super(new ResourceLocator[] { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * + * @generated + */ + public static class Implementation extends EclipsePlugin { + /** + * Creates an instance. + * + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/PropertylifecycleItemProviderAdapterFactory.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/PropertylifecycleItemProviderAdapterFactory.java new file mode 100755 index 00000000000..e80be9158ac --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/PropertylifecycleItemProviderAdapterFactory.java @@ -0,0 +1,421 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.domain.EditingDomain; + +import org.eclipse.emf.edit.provider.ChangeNotifier; +import org.eclipse.emf.edit.provider.ChildCreationExtenderManager; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IChangeNotifier; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IDisposable; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.INotifyChangedListener; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.util.PropertylifecycleAdapterFactory; + +/** + * This is the factory that is used to provide the interfaces needed to support Viewers. + * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. + * The adapters also support Eclipse property sheets. + * Note that most of the adapters are shared among multiple instances. + * + * + * + * @generated + */ +public class PropertylifecycleItemProviderAdapterFactory extends PropertylifecycleAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable, IChildCreationExtender { + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * + * + * + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * + * + * + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This helps manage the child creation extenders. + * + * + * + * @generated + */ + protected ChildCreationExtenderManager childCreationExtenderManager = new ChildCreationExtenderManager(PropertylifecycleEditPlugin.INSTANCE, PropertylifecyclePackage.eNS_URI); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * + * + * + * @generated + */ + protected Collection supportedTypes = new ArrayList(); + + /** + * This constructs an instance. + * + * + * + * @generated + */ + public PropertylifecycleItemProviderAdapterFactory() { + supportedTypes.add(IEditingDomainItemProvider.class); + supportedTypes.add(IStructuredItemContentProvider.class); + supportedTypes.add(ITreeItemContentProvider.class); + supportedTypes.add(IItemLabelProvider.class); + supportedTypes.add(IItemPropertySource.class); + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.propertylifecycle.StrategySet} instances. + * + * + * + * @generated + */ + protected StrategySetItemProvider strategySetItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.propertylifecycle.StrategySet}. + * + * + * + * @generated + */ + @Override + public Adapter createStrategySetAdapter() { + if (strategySetItemProvider == null) { + strategySetItemProvider = new StrategySetItemProvider(this); + } + + return strategySetItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.propertylifecycle.StrategyElement} instances. + * + * + * + * @generated + */ + protected StrategyElementItemProvider strategyElementItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.propertylifecycle.StrategyElement}. + * + * + * + * @generated + */ + @Override + public Adapter createStrategyElementAdapter() { + if (strategyElementItemProvider == null) { + strategyElementItemProvider = new StrategyElementItemProvider(this); + } + + return strategyElementItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.propertylifecycle.ElementContainer} instances. + * + * + * + * @generated + */ + protected ElementContainerItemProvider elementContainerItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.propertylifecycle.ElementContainer}. + * + * + * + * @generated + */ + @Override + public Adapter createElementContainerAdapter() { + if (elementContainerItemProvider == null) { + elementContainerItemProvider = new ElementContainerItemProvider(this); + } + + return elementContainerItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.propertylifecycle.ElementProperty} instances. + * + * + * + * @generated + */ + protected ElementPropertyItemProvider elementPropertyItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.propertylifecycle.ElementProperty}. + * + * + * + * @generated + */ + @Override + public Adapter createElementPropertyAdapter() { + if (elementPropertyItemProvider == null) { + elementPropertyItemProvider = new ElementPropertyItemProvider(this); + } + + return elementPropertyItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.propertylifecycle.JavaProcessor} instances. + * + * + * + * @generated + */ + protected JavaProcessorItemProvider javaProcessorItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.propertylifecycle.JavaProcessor}. + * + * + * + * @generated + */ + @Override + public Adapter createJavaProcessorAdapter() { + if (javaProcessorItemProvider == null) { + javaProcessorItemProvider = new JavaProcessorItemProvider(this); + } + + return javaProcessorItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.propertylifecycle.BasicTrigger} instances. + * + * + * + * @generated + */ + protected BasicTriggerItemProvider basicTriggerItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.propertylifecycle.BasicTrigger}. + * + * + * + * @generated + */ + @Override + public Adapter createBasicTriggerAdapter() { + if (basicTriggerItemProvider == null) { + basicTriggerItemProvider = new BasicTriggerItemProvider(this); + } + + return basicTriggerItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * + * + * + * @generated + */ + @Override + public ComposeableAdapterFactory getRootAdapterFactory() { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * + * + * + * @generated + */ + @Override + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * + * + * + * @generated + */ + @Override + public boolean isFactoryForType(Object type) { + return supportedTypes.contains(type) || super.isFactoryForType(type); + } + + /** + * This implementation substitutes the factory itself as the key for the adapter. + * + * + * + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) { + return super.adapt(notifier, this); + } + + /** + * + * + * + * @generated + */ + @Override + public Object adapt(Object object, Object type) { + if (isFactoryForType(type)) { + Object adapter = super.adapt(object, type); + if (!(type instanceof Class) || (((Class) type).isInstance(adapter))) { + return adapter; + } + } + + return null; + } + + /** + * + * + * + * @generated + */ + public List getChildCreationExtenders() { + return childCreationExtenderManager.getChildCreationExtenders(); + } + + /** + * + * + * + * @generated + */ + @Override + public Collection getNewChildDescriptors(Object object, EditingDomain editingDomain) { + return childCreationExtenderManager.getNewChildDescriptors(object, editingDomain); + } + + /** + * + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return childCreationExtenderManager; + } + + /** + * This adds a listener. + * + * + * + * @generated + */ + @Override + public void addListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * + * + * + * @generated + */ + @Override + public void removeListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * + * + * + * @generated + */ + @Override + public void fireNotifyChanged(Notification notification) { + changeNotifier.fireNotifyChanged(notification); + + if (parentAdapterFactory != null) { + parentAdapterFactory.fireNotifyChanged(notification); + } + } + + /** + * This disposes all of the item providers created by this factory. + * + * + * + * @generated + */ + @Override + public void dispose() { + if (strategySetItemProvider != null) { + strategySetItemProvider.dispose(); + } + if (strategyElementItemProvider != null) { + strategyElementItemProvider.dispose(); + } + if (elementContainerItemProvider != null) { + elementContainerItemProvider.dispose(); + } + if (elementPropertyItemProvider != null) { + elementPropertyItemProvider.dispose(); + } + if (javaProcessorItemProvider != null) { + javaProcessorItemProvider.dispose(); + } + if (basicTriggerItemProvider != null) { + basicTriggerItemProvider.dispose(); + } + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategyElementItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategyElementItemProvider.java new file mode 100755 index 00000000000..ceb501ad5aa --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategyElementItemProvider.java @@ -0,0 +1,239 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.StrategyElement} object. + * + * + * + * @generated + */ +public class StrategyElementItemProvider extends ElementTemplateItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public StrategyElementItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + addDecriptionPropertyDescriptor(object); + addIdPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_StrategyTemplate_name_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_StrategyTemplate_name_feature", "_UI_StrategyTemplate_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.STRATEGY_TEMPLATE__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Decription feature. + * + * + * + * @generated + */ + protected void addDecriptionPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_StrategyTemplate_decription_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_StrategyTemplate_decription_feature", "_UI_StrategyTemplate_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.STRATEGY_TEMPLATE__DECRIPTION, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Id feature. + * + * + * + * @generated + */ + protected void addIdPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_StrategyTemplate_id_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_StrategyTemplate_id_feature", "_UI_StrategyTemplate_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.STRATEGY_TEMPLATE__ID, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(PropertylifecyclePackage.Literals.STRATEGY_ELEMENT__ELEMENT_CONTAINERS); + childrenFeatures.add(PropertylifecyclePackage.Literals.STRATEGY_ELEMENT__ELEMENT_PROPERTIES); + } + return childrenFeatures; + } + + /** + * + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns StrategyElement.gif. + * + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/StrategyElement")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((StrategyElement) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_StrategyElement_type") //$NON-NLS-1$ + : + getString("_UI_StrategyElement_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(StrategyElement.class)) { + case PropertylifecyclePackage.STRATEGY_ELEMENT__NAME: + case PropertylifecyclePackage.STRATEGY_ELEMENT__DECRIPTION: + case PropertylifecyclePackage.STRATEGY_ELEMENT__ID: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_CONTAINERS: + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_PROPERTIES: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter(PropertylifecyclePackage.Literals.STRATEGY_ELEMENT__ELEMENT_CONTAINERS, + PropertylifecycleFactory.eINSTANCE.createElementContainer())); + + newChildDescriptors.add(createChildParameter(PropertylifecyclePackage.Literals.STRATEGY_ELEMENT__ELEMENT_PROPERTIES, + PropertylifecycleFactory.eINSTANCE.createElementProperty())); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategySetItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategySetItemProvider.java new file mode 100755 index 00000000000..bbb912a3468 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategySetItemProvider.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.StrategySet; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.StrategySet} object. + * + * + * + * @generated + */ +public class StrategySetItemProvider extends StrategyTemplateItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public StrategySetItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(PropertylifecyclePackage.Literals.STRATEGY_SET__STRATEGIES); + } + return childrenFeatures; + } + + /** + * + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns StrategySet.gif. + * + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/StrategySet")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((StrategySet) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_StrategySet_type") //$NON-NLS-1$ + : + getString("_UI_StrategySet_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(StrategySet.class)) { + case PropertylifecyclePackage.STRATEGY_SET__STRATEGIES: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter(PropertylifecyclePackage.Literals.STRATEGY_SET__STRATEGIES, + PropertylifecycleFactory.eINSTANCE.createStrategyElement())); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategyTemplateItemProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategyTemplateItemProvider.java new file mode 100755 index 00000000000..b196be19d03 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.edit/src-gen/org/eclipse/papyrus/propertylifecycle/provider/StrategyTemplateItemProvider.java @@ -0,0 +1,209 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.StrategyTemplate; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate} object. + * + * + * + * @generated + */ +public class StrategyTemplateItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * + * @generated + */ + public StrategyTemplateItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + addDecriptionPropertyDescriptor(object); + addIdPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_StrategyTemplate_name_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_StrategyTemplate_name_feature", "_UI_StrategyTemplate_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.STRATEGY_TEMPLATE__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Decription feature. + * + * + * + * @generated + */ + protected void addDecriptionPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_StrategyTemplate_decription_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_StrategyTemplate_decription_feature", "_UI_StrategyTemplate_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.STRATEGY_TEMPLATE__DECRIPTION, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Id feature. + * + * + * + * @generated + */ + protected void addIdPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_StrategyTemplate_id_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_StrategyTemplate_id_feature", "_UI_StrategyTemplate_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PropertylifecyclePackage.Literals.STRATEGY_TEMPLATE__ID, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((StrategyTemplate) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_StrategyTemplate_type") //$NON-NLS-1$ + : + getString("_UI_StrategyTemplate_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(StrategyTemplate.class)) { + case PropertylifecyclePackage.STRATEGY_TEMPLATE__NAME: + case PropertylifecyclePackage.STRATEGY_TEMPLATE__DECRIPTION: + case PropertylifecyclePackage.STRATEGY_TEMPLATE__ID: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.classpath b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.classpath new file mode 100755 index 00000000000..26e67d64ad0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.gitignore b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.gitignore new file mode 100755 index 00000000000..ae3c1726048 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.project b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.project new file mode 100755 index 00000000000..6cc6d822e55 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.propertylifecycle.model.editor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.settings/org.eclipse.jdt.core.prefs b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..0c68a61dca8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/META-INF/MANIFEST.MF b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..03b374d2640 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.propertylifecycle.model.editor;singleton:=true +Bundle-Version: 0.0.1.qualifier +Bundle-ClassPath: . +Bundle-Activator: org.eclipse.papyrus.propertylifecycle.presentation.PropertylifecycleEditorPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Export-Package: org.eclipse.papyrus.propertylifecycle.presentation +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.core.resources;bundle-version="3.11.0";visibility:=reexport, + org.eclipse.papyrus.propertylifecycle.model.edit;bundle-version="0.0.1";visibility:=reexport, + org.eclipse.emf.ecore.xmi;bundle-version="2.12.0";visibility:=reexport, + org.eclipse.emf.edit.ui;bundle-version="2.12.0";visibility:=reexport, + org.eclipse.ui.ide;bundle-version="3.12.0";visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/about.html b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/about.html new file mode 100755 index 00000000000..d35d5aed64c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/build.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/build.properties new file mode 100755 index 00000000000..bf68dc02e27 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/build.properties @@ -0,0 +1,20 @@ +# Copyright (c) 2016 CEA LIST and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# +# Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html +jars.compile.order = . +source.. = src-gen/ +output.. = bin diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/icons/full/obj16/PropertylifecycleModelFile.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/icons/full/obj16/PropertylifecycleModelFile.gif new file mode 100755 index 00000000000..5a20b74442c Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/icons/full/obj16/PropertylifecycleModelFile.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/icons/full/wizban/NewPropertylifecycle.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/icons/full/wizban/NewPropertylifecycle.gif new file mode 100755 index 00000000000..a76f326ac03 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/icons/full/wizban/NewPropertylifecycle.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/plugin.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/plugin.properties new file mode 100755 index 00000000000..6e0f06957a0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/plugin.properties @@ -0,0 +1,62 @@ +# Copyright (c) 2016 CEA LIST and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# +# Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + +pluginName = Propertylifecycle Editor +providerName = www.example.org + +_UI_PropertylifecycleEditor_menu = &Propertylifecycle Editor + +_UI_CreateChild_menu_item = &New Child +_UI_CreateSibling_menu_item = N&ew Sibling + +_UI_ShowPropertiesView_menu_item = Show &Properties View +_UI_RefreshViewer_menu_item = &Refresh + +_UI_SelectionPage_label = Selection +_UI_ParentPage_label = Parent +_UI_ListPage_label = List +_UI_TreePage_label = Tree +_UI_TablePage_label = Table +_UI_TreeWithColumnsPage_label = Tree with Columns +_UI_ObjectColumn_label = Object +_UI_SelfColumn_label = Self + +_UI_NoObjectSelected = Selected Nothing +_UI_SingleObjectSelected = Selected Object: {0} +_UI_MultiObjectSelected = Selected {0} Objects + +_UI_OpenEditorError_label = Open Editor + +_UI_Wizard_category = Example EMF Model Creation Wizards + +_UI_CreateModelError_message = Problems encountered in file "{0}" + +_UI_PropertylifecycleModelWizard_label = Propertylifecycle Model +_UI_PropertylifecycleModelWizard_description = Create a new Propertylifecycle model + +_UI_PropertylifecycleEditor_label = Propertylifecycle Model Editor + +_UI_PropertylifecycleEditorFilenameDefaultBase = My +_UI_PropertylifecycleEditorFilenameExtensions = propertylifecycle + +_UI_Wizard_label = New + +_WARN_FilenameExtension = The file name must end in ''.{0}'' +_WARN_FilenameExtensions = The file name must have one of the following extensions: {0} + +_UI_ModelObject = &Model Object +_UI_XMLEncoding = &XML Encoding +_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1 +_UI_Wizard_initial_object_description = Select a model object to create + +_UI_FileConflict_label = File Conflict +_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes? + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/plugin.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/plugin.xml new file mode 100755 index 00000000000..3206e9de309 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/plugin.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + %_UI_PropertylifecycleModelWizard_description + + + + + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/pom.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/pom.xml new file mode 100755 index 00000000000..8086d803beb --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.eclipse.papyrus.infra.propertylifecycle.model.editor + 0.0.1.qualifier + org.eclipse.papyrus + eclipse-plugin + + org.eclipse.papyrus + org.eclipse.papyrus.infra.propertylifecycle + 0.0.1.qualifier + ../org.eclipse.papyrus.infra.propertylifecycle/pom.xml + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleActionBarContributor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleActionBarContributor.java new file mode 100755 index 00000000000..5fbeaf9b5e2 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleActionBarContributor.java @@ -0,0 +1,450 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.presentation; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; + +import org.eclipse.emf.edit.ui.action.ControlAction; +import org.eclipse.emf.edit.ui.action.CreateChildAction; +import org.eclipse.emf.edit.ui.action.CreateSiblingAction; +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; +import org.eclipse.emf.edit.ui.action.LoadResourceAction; +import org.eclipse.emf.edit.ui.action.ValidateAction; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IContributionManager; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.action.SubContributionItem; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.PartInitException; + +/** + * This is the action bar contributor for the Propertylifecycle model editor. + * + * + * + * @generated + */ +public class PropertylifecycleActionBarContributor + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { + /** + * This keeps track of the active editor. + * + * + * + * @generated + */ + protected IEditorPart activeEditorPart; + + /** + * This keeps track of the current selection provider. + * + * + * + * @generated + */ + protected ISelectionProvider selectionProvider; + + /** + * This action opens the Properties view. + * + * + * + * @generated + */ + protected IAction showPropertiesViewAction = new Action(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {//$NON-NLS-1$ + @Override + public void run() { + try { + getPage().showView("org.eclipse.ui.views.PropertySheet"); //$NON-NLS-1$ + } catch (PartInitException exception) { + PropertylifecycleEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * This action refreshes the viewer of the current editor if the editor + * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. + * + * + * + * @generated + */ + protected IAction refreshViewerAction = new Action(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {//$NON-NLS-1$ + @Override + public boolean isEnabled() { + return activeEditorPart instanceof IViewerProvider; + } + + @Override + public void run() { + if (activeEditorPart instanceof IViewerProvider) { + Viewer viewer = ((IViewerProvider) activeEditorPart).getViewer(); + if (viewer != null) { + viewer.refresh(); + } + } + } + }; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * + * + * + * @generated + */ + protected Collection createChildActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateChild actions. + * + * + * + * @generated + */ + protected IMenuManager createChildMenuManager; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * + * + * + * @generated + */ + protected Collection createSiblingActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateSibling actions. + * + * + * + * @generated + */ + protected IMenuManager createSiblingMenuManager; + + /** + * This creates an instance of the contributor. + * + * + * + * @generated + */ + public PropertylifecycleActionBarContributor() { + super(ADDITIONS_LAST_STYLE); + loadResourceAction = new LoadResourceAction(); + validateAction = new ValidateAction(); + controlAction = new ControlAction(); + } + + /** + * This adds Separators for editor additions to the tool bar. + * + * + * + * @generated + */ + @Override + public void contributeToToolBar(IToolBarManager toolBarManager) { + toolBarManager.add(new Separator("propertylifecycle-settings")); //$NON-NLS-1$ + toolBarManager.add(new Separator("propertylifecycle-additions")); //$NON-NLS-1$ + } + + /** + * This adds to the menu bar a menu and some separators for editor additions, + * as well as the sub-menus for object creation items. + * + * + * + * @generated + */ + @Override + public void contributeToMenu(IMenuManager menuManager) { + super.contributeToMenu(menuManager); + + IMenuManager submenuManager = new MenuManager(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_PropertylifecycleEditor_menu"), "org.eclipse.papyrus.infra.propertylifecycleMenuID"); //$NON-NLS-1$ //$NON-NLS-2$ + menuManager.insertAfter("additions", submenuManager); //$NON-NLS-1$ + submenuManager.add(new Separator("settings")); //$NON-NLS-1$ + submenuManager.add(new Separator("actions")); //$NON-NLS-1$ + submenuManager.add(new Separator("additions")); //$NON-NLS-1$ + submenuManager.add(new Separator("additions-end")); //$NON-NLS-1$ + + // Prepare for CreateChild item addition or removal. + // + createChildMenuManager = new MenuManager(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); //$NON-NLS-1$ + submenuManager.insertBefore("additions", createChildMenuManager); //$NON-NLS-1$ + + // Prepare for CreateSibling item addition or removal. + // + createSiblingMenuManager = new MenuManager(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); //$NON-NLS-1$ + submenuManager.insertBefore("additions", createSiblingMenuManager); //$NON-NLS-1$ + + // Force an update because Eclipse hides empty menus now. + // + submenuManager.addMenuListener(new IMenuListener() { + @Override + public void menuAboutToShow(IMenuManager menuManager) { + menuManager.updateAll(true); + } + }); + + addGlobalActions(submenuManager); + } + + /** + * When the active editor changes, this remembers the change and registers with it as a selection provider. + * + * + * + * @generated + */ + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + activeEditorPart = part; + + // Switch to the new selection provider. + // + if (selectionProvider != null) { + selectionProvider.removeSelectionChangedListener(this); + } + if (part == null) { + selectionProvider = null; + } else { + selectionProvider = part.getSite().getSelectionProvider(); + selectionProvider.addSelectionChangedListener(this); + + // Fake a selection changed event to update the menus. + // + if (selectionProvider.getSelection() != null) { + selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); + } + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, + * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings + * that can be added to the selected object and updating the menus accordingly. + * + * + * + * @generated + */ + @Override + public void selectionChanged(SelectionChangedEvent event) { + // Remove any menu items for old selection. + // + if (createChildMenuManager != null) { + depopulateManager(createChildMenuManager, createChildActions); + } + if (createSiblingMenuManager != null) { + depopulateManager(createSiblingMenuManager, createSiblingActions); + } + + // Query the new selection for appropriate new child/sibling descriptors + // + Collection newChildDescriptors = null; + Collection newSiblingDescriptors = null; + + ISelection selection = event.getSelection(); + if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) { + Object object = ((IStructuredSelection) selection).getFirstElement(); + + EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain(); + + newChildDescriptors = domain.getNewChildDescriptors(object, null); + newSiblingDescriptors = domain.getNewChildDescriptors(null, object); + } + + // Generate actions for selection; populate and redraw the menus. + // + createChildActions = generateCreateChildActions(newChildDescriptors, selection); + createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); + + if (createChildMenuManager != null) { + populateManager(createChildMenuManager, createChildActions, null); + createChildMenuManager.update(true); + } + if (createSiblingMenuManager != null) { + populateManager(createSiblingMenuManager, createSiblingActions, null); + createSiblingMenuManager.update(true); + } + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in descriptors, + * and returns the collection of these actions. + * + * + * + * @generated + */ + protected Collection generateCreateChildActions(Collection descriptors, ISelection selection) { + Collection actions = new ArrayList(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in descriptors, + * and returns the collection of these actions. + * + * + * + * @generated + */ + protected Collection generateCreateSiblingActions(Collection descriptors, ISelection selection) { + Collection actions = new ArrayList(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This populates the specified manager with {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the actions collection, + * by inserting them before the specified contribution item contributionID. + * If contributionID is null, they are simply added. + * + * + * + * @generated + */ + protected void populateManager(IContributionManager manager, Collection actions, String contributionID) { + if (actions != null) { + for (IAction action : actions) { + if (contributionID != null) { + manager.insertBefore(contributionID, action); + } else { + manager.add(action); + } + } + } + } + + /** + * This removes from the specified manager all {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the actions collection. + * + * + * + * @generated + */ + protected void depopulateManager(IContributionManager manager, Collection actions) { + if (actions != null) { + IContributionItem[] items = manager.getItems(); + for (int i = 0; i < items.length; i++) { + // Look into SubContributionItems + // + IContributionItem contributionItem = items[i]; + while (contributionItem instanceof SubContributionItem) { + contributionItem = ((SubContributionItem) contributionItem).getInnerItem(); + } + + // Delete the ActionContributionItems with matching action. + // + if (contributionItem instanceof ActionContributionItem) { + IAction action = ((ActionContributionItem) contributionItem).getAction(); + if (actions.contains(action)) { + manager.remove(contributionItem); + } + } + } + } + } + + /** + * This populates the pop-up menu before it appears. + * + * + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + super.menuAboutToShow(menuManager); + MenuManager submenuManager = null; + + submenuManager = new MenuManager(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); //$NON-NLS-1$ + populateManager(submenuManager, createChildActions, null); + menuManager.insertBefore("edit", submenuManager); //$NON-NLS-1$ + + submenuManager = new MenuManager(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); //$NON-NLS-1$ + populateManager(submenuManager, createSiblingActions, null); + menuManager.insertBefore("edit", submenuManager); //$NON-NLS-1$ + } + + /** + * This inserts global actions before the "additions-end" separator. + * + * + * + * @generated + */ + @Override + protected void addGlobalActions(IMenuManager menuManager) { + menuManager.insertAfter("additions-end", new Separator("ui-actions")); //$NON-NLS-1$ //$NON-NLS-2$ + menuManager.insertAfter("ui-actions", showPropertiesViewAction); //$NON-NLS-1$ + + refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); + menuManager.insertAfter("ui-actions", refreshViewerAction); //$NON-NLS-1$ + + super.addGlobalActions(menuManager); + } + + /** + * This ensures that a delete action will clean up all references to deleted objects. + * + * + * + * @generated + */ + @Override + protected boolean removeAllReferencesOnDelete() { + return true; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleEditor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleEditor.java new file mode 100755 index 00000000000..4d574c7e7c8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleEditor.java @@ -0,0 +1,1880 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.presentation; + + +import java.io.IOException; +import java.io.InputStream; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +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.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.propertylifecycle.provider.PropertylifecycleItemProviderAdapterFactory; +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; + +import org.eclipse.swt.layout.FillLayout; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.command.CommandStackListener; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.ui.MarkerHelper; +import org.eclipse.emf.common.ui.ViewerPane; + +import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; + +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.emf.ecore.util.EContentAdapter; +import org.eclipse.emf.ecore.util.EcoreUtil; + +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; + +import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + +import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + +import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + +import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; +import org.eclipse.emf.edit.ui.dnd.LocalTransfer; +import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + +import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + +import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; +import org.eclipse.emf.edit.ui.util.EditUIUtil; + +import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; +import org.eclipse.ui.actions.WorkspaceModifyOperation; + + +/** + * This is an example of a Propertylifecycle model editor. + * + * + * + * @generated + */ +public class PropertylifecycleEditor + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + /** + * This keeps track of the editing domain that is used to track all changes to the model. + * + * + * + * @generated + */ + protected AdapterFactoryEditingDomain editingDomain; + + /** + * This is the one adapter factory used for providing views of the model. + * + * + * + * @generated + */ + protected ComposedAdapterFactory adapterFactory; + + /** + * This is the content outline page. + * + * + * + * @generated + */ + protected IContentOutlinePage contentOutlinePage; + + /** + * This is a kludge... + * + * + * + * @generated + */ + protected IStatusLineManager contentOutlineStatusLineManager; + + /** + * This is the content outline page's viewer. + * + * + * + * @generated + */ + protected TreeViewer contentOutlineViewer; + + /** + * This is the property sheet page. + * + * + * + * @generated + */ + protected List propertySheetPages = new ArrayList(); + + /** + * This is the viewer that shadows the selection in the content outline. + * The parent relation must be correctly defined for this to work. + * + * + * + * @generated + */ + protected TreeViewer selectionViewer; + + /** + * This inverts the roll of parent and child in the content provider and show parents as a tree. + * + * + * + * @generated + */ + protected TreeViewer parentViewer; + + /** + * This shows how a tree view works. + * + * + * + * @generated + */ + protected TreeViewer treeViewer; + + /** + * This shows how a list view works. + * A list viewer doesn't support icons. + * + * + * + * @generated + */ + protected ListViewer listViewer; + + /** + * This shows how a table view works. + * A table can be used as a list with icons. + * + * + * + * @generated + */ + protected TableViewer tableViewer; + + /** + * This shows how a tree view with columns works. + * + * + * + * @generated + */ + protected TreeViewer treeViewerWithColumns; + + /** + * This keeps track of the active viewer pane, in the book. + * + * + * + * @generated + */ + protected ViewerPane currentViewerPane; + + /** + * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. + * + * + * + * @generated + */ + protected Viewer currentViewer; + + /** + * This listens to which ever viewer is active. + * + * + * + * @generated + */ + protected ISelectionChangedListener selectionChangedListener; + + /** + * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. + * + * + * + * @generated + */ + protected Collection selectionChangedListeners = new ArrayList(); + + /** + * This keeps track of the selection of the editor as a whole. + * + * + * + * @generated + */ + protected ISelection editorSelection = StructuredSelection.EMPTY; + + /** + * The MarkerHelper is responsible for creating workspace resource markers presented + * in Eclipse's Problems View. + * + * + * + * @generated + */ + protected MarkerHelper markerHelper = new EditUIMarkerHelper(); + + /** + * This listens for when the outline becomes active + * + * + * + * @generated + */ + protected IPartListener partListener = new IPartListener() { + @Override + public void partActivated(IWorkbenchPart p) { + if (p instanceof ContentOutline) { + if (((ContentOutline) p).getCurrentPage() == contentOutlinePage) { + getActionBarContributor().setActiveEditor(PropertylifecycleEditor.this); + + setCurrentViewer(contentOutlineViewer); + } + } else if (p instanceof PropertySheet) { + if (propertySheetPages.contains(((PropertySheet) p).getCurrentPage())) { + getActionBarContributor().setActiveEditor(PropertylifecycleEditor.this); + handleActivate(); + } + } else if (p == PropertylifecycleEditor.this) { + handleActivate(); + } + } + + @Override + public void partBroughtToTop(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partClosed(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partDeactivated(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partOpened(IWorkbenchPart p) { + // Ignore. + } + }; + + /** + * Resources that have been removed since last activation. + * + * + * + * @generated + */ + protected Collection removedResources = new ArrayList(); + + /** + * Resources that have been changed since last activation. + * + * + * + * @generated + */ + protected Collection changedResources = new ArrayList(); + + /** + * Resources that have been saved. + * + * + * + * @generated + */ + protected Collection savedResources = new ArrayList(); + + /** + * Map to store the diagnostic associated with a resource. + * + * + * + * @generated + */ + protected Map resourceToDiagnosticMap = new LinkedHashMap(); + + /** + * Controls whether the problem indication should be updated. + * + * + * + * @generated + */ + protected boolean updateProblemIndication = true; + + /** + * Adapter used to update the problem indication when resources are demanded loaded. + * + * + * + * @generated + */ + protected EContentAdapter problemIndicationAdapter = new EContentAdapter() { + @Override + public void notifyChanged(Notification notification) { + if (notification.getNotifier() instanceof Resource) { + switch (notification.getFeatureID(Resource.class)) { + case Resource.RESOURCE__IS_LOADED: + case Resource.RESOURCE__ERRORS: + case Resource.RESOURCE__WARNINGS: { + Resource resource = (Resource) notification.getNotifier(); + Diagnostic diagnostic = analyzeResourceProblems(resource, null); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, diagnostic); + } else { + resourceToDiagnosticMap.remove(resource); + } + + if (updateProblemIndication) { + getSite().getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + updateProblemIndication(); + } + }); + } + break; + } + } + } else { + super.notifyChanged(notification); + } + } + + @Override + protected void setTarget(Resource target) { + basicSetTarget(target); + } + + @Override + protected void unsetTarget(Resource target) { + basicUnsetTarget(target); + resourceToDiagnosticMap.remove(target); + if (updateProblemIndication) { + getSite().getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + updateProblemIndication(); + } + }); + } + } + }; + + /** + * This listens for workspace changes. + * + * + * + * @generated + */ + protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener() { + @Override + public void resourceChanged(IResourceChangeEvent event) { + IResourceDelta delta = event.getDelta(); + try { + class ResourceDeltaVisitor implements IResourceDeltaVisitor { + protected ResourceSet resourceSet = editingDomain.getResourceSet(); + protected Collection changedResources = new ArrayList(); + protected Collection removedResources = new ArrayList(); + + @Override + public boolean visit(IResourceDelta delta) { + if (delta.getResource().getType() == IResource.FILE) { + if (delta.getKind() == IResourceDelta.REMOVED || + delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { + Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); + if (resource != null) { + if (delta.getKind() == IResourceDelta.REMOVED) { + removedResources.add(resource); + } else if (!savedResources.remove(resource)) { + changedResources.add(resource); + } + } + } + return false; + } + + return true; + } + + public Collection getChangedResources() { + return changedResources; + } + + public Collection getRemovedResources() { + return removedResources; + } + } + + final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); + delta.accept(visitor); + + if (!visitor.getRemovedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + removedResources.addAll(visitor.getRemovedResources()); + if (!isDirty()) { + getSite().getPage().closeEditor(PropertylifecycleEditor.this, false); + } + } + }); + } + + if (!visitor.getChangedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + changedResources.addAll(visitor.getChangedResources()); + if (getSite().getPage().getActiveEditor() == PropertylifecycleEditor.this) { + handleActivate(); + } + } + }); + } + } catch (CoreException exception) { + PropertylifecycleEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * Handles activation of the editor or it's associated views. + * + * + * + * @generated + */ + protected void handleActivate() { + // Recompute the read only state. + // + if (editingDomain.getResourceToReadOnlyMap() != null) { + editingDomain.getResourceToReadOnlyMap().clear(); + + // Refresh any actions that may become enabled or disabled. + // + setSelection(getSelection()); + } + + if (!removedResources.isEmpty()) { + if (handleDirtyConflict()) { + getSite().getPage().closeEditor(PropertylifecycleEditor.this, false); + } else { + removedResources.clear(); + changedResources.clear(); + savedResources.clear(); + } + } else if (!changedResources.isEmpty()) { + changedResources.removeAll(savedResources); + handleChangedResources(); + changedResources.clear(); + savedResources.clear(); + } + } + + /** + * Handles what to do with changed resources on activation. + * + * + * + * @generated + */ + protected void handleChangedResources() { + if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { + if (isDirty()) { + changedResources.addAll(editingDomain.getResourceSet().getResources()); + } + editingDomain.getCommandStack().flush(); + + updateProblemIndication = false; + for (Resource resource : changedResources) { + if (resource.isLoaded()) { + resource.unload(); + try { + resource.load(Collections.EMPTY_MAP); + } catch (IOException exception) { + if (!resourceToDiagnosticMap.containsKey(resource)) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + } + } + } + + if (AdapterFactoryEditingDomain.isStale(editorSelection)) { + setSelection(StructuredSelection.EMPTY); + } + + updateProblemIndication = true; + updateProblemIndication(); + } + } + + /** + * Updates the problems indication with the information described in the specified diagnostic. + * + * + * + * @generated + */ + protected void updateProblemIndication() { + if (updateProblemIndication) { + BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, + "org.eclipse.papyrus.infra.propertylifecycle.model.editor", //$NON-NLS-1$ + 0, + null, + new Object[] { editingDomain.getResourceSet() }); + for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { + if (childDiagnostic.getSeverity() != Diagnostic.OK) { + diagnostic.add(childDiagnostic); + } + } + + int lastEditorPage = getPageCount() - 1; + if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { + ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic); + if (diagnostic.getSeverity() != Diagnostic.OK) { + setActivePage(lastEditorPage); + } + } else if (diagnostic.getSeverity() != Diagnostic.OK) { + ProblemEditorPart problemEditorPart = new ProblemEditorPart(); + problemEditorPart.setDiagnostic(diagnostic); + problemEditorPart.setMarkerHelper(markerHelper); + try { + addPage(++lastEditorPage, problemEditorPart, getEditorInput()); + setPageText(lastEditorPage, problemEditorPart.getPartName()); + setActivePage(lastEditorPage); + showTabs(); + } catch (PartInitException exception) { + PropertylifecycleEditorPlugin.INSTANCE.log(exception); + } + } + + if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { + markerHelper.deleteMarkers(editingDomain.getResourceSet()); + if (diagnostic.getSeverity() != Diagnostic.OK) { + try { + markerHelper.createMarkers(diagnostic); + } catch (CoreException exception) { + PropertylifecycleEditorPlugin.INSTANCE.log(exception); + } + } + } + } + } + + /** + * Shows a dialog that asks if conflicting changes should be discarded. + * + * + * + * @generated + */ + protected boolean handleDirtyConflict() { + return MessageDialog.openQuestion(getSite().getShell(), + getString("_UI_FileConflict_label"), //$NON-NLS-1$ + getString("_WARN_FileConflict")); //$NON-NLS-1$ + } + + /** + * This creates a model editor. + * + * + * + * @generated + */ + public PropertylifecycleEditor() { + super(); + initializeEditingDomain(); + } + + /** + * This sets up the editing domain for the model editor. + * + * + * + * @generated + */ + protected void initializeEditingDomain() { + // Create an adapter factory that yields item providers. + // + adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + + adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new PropertylifecycleItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); + + // Create the command stack that will notify this editor as commands are executed. + // + BasicCommandStack commandStack = new BasicCommandStack(); + + // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. + // + commandStack.addCommandStackListener(new CommandStackListener() { + @Override + public void commandStackChanged(final EventObject event) { + getContainer().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + firePropertyChange(IEditorPart.PROP_DIRTY); + + // Try to select the affected objects. + // + Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand(); + if (mostRecentCommand != null) { + setSelectionToViewer(mostRecentCommand.getAffectedObjects()); + } + for (Iterator i = propertySheetPages.iterator(); i.hasNext();) { + PropertySheetPage propertySheetPage = i.next(); + if (propertySheetPage.getControl().isDisposed()) { + i.remove(); + } else { + propertySheetPage.refresh(); + } + } + } + }); + } + }); + + // Create the editing domain with a special command stack. + // + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap()); + } + + /** + * This is here for the listener to be able to call it. + * + * + * + * @generated + */ + @Override + protected void firePropertyChange(int action) { + super.firePropertyChange(action); + } + + /** + * This sets the selection into whichever viewer is active. + * + * + * + * @generated + */ + public void setSelectionToViewer(Collection collection) { + final Collection theSelection = collection; + // Make sure it's okay. + // + if (theSelection != null && !theSelection.isEmpty()) { + Runnable runnable = new Runnable() { + @Override + public void run() { + // Try to select the items in the current content viewer of the editor. + // + if (currentViewer != null) { + currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); + } + } + }; + getSite().getShell().getDisplay().asyncExec(runnable); + } + } + + /** + * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. + * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} + * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. + * + * + * + * @generated + */ + @Override + public EditingDomain getEditingDomain() { + return editingDomain; + } + + /** + * + * + * + * @generated + */ + public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { + /** + * + * + * + * @generated + */ + public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * + * + * + * @generated + */ + @Override + public Object[] getElements(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * + * + * + * @generated + */ + @Override + public Object[] getChildren(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean hasChildren(Object object) { + Object parent = super.getParent(object); + return parent != null; + } + + /** + * + * + * + * @generated + */ + @Override + public Object getParent(Object object) { + return null; + } + } + + /** + * + * + * + * @generated + */ + public void setCurrentViewerPane(ViewerPane viewerPane) { + if (currentViewerPane != viewerPane) { + if (currentViewerPane != null) { + currentViewerPane.showFocus(false); + } + currentViewerPane = viewerPane; + } + setCurrentViewer(currentViewerPane.getViewer()); + } + + /** + * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, + * is the current one. + * + * + * + * @generated + */ + public void setCurrentViewer(Viewer viewer) { + // If it is changing... + // + if (currentViewer != viewer) { + if (selectionChangedListener == null) { + // Create the listener on demand. + // + selectionChangedListener = new ISelectionChangedListener() { + // This just notifies those things that are affected by the section. + // + @Override + public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { + setSelection(selectionChangedEvent.getSelection()); + } + }; + } + + // Stop listening to the old one. + // + if (currentViewer != null) { + currentViewer.removeSelectionChangedListener(selectionChangedListener); + } + + // Start listening to the new one. + // + if (viewer != null) { + viewer.addSelectionChangedListener(selectionChangedListener); + } + + // Remember it. + // + currentViewer = viewer; + + // Set the editors selection based on the current viewer's selection. + // + setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); + } + } + + /** + * This returns the viewer as required by the {@link IViewerProvider} interface. + * + * + * + * @generated + */ + @Override + public Viewer getViewer() { + return currentViewer; + } + + /** + * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. + * + * + * + * @generated + */ + protected void createContextMenuFor(StructuredViewer viewer) { + MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ + contextMenu.add(new Separator("additions")); //$NON-NLS-1$ + contextMenu.setRemoveAllWhenShown(true); + contextMenu.addMenuListener(this); + Menu menu = contextMenu.createContextMenu(viewer.getControl()); + viewer.getControl().setMenu(menu); + getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); + + int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; + viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); + viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); + } + + /** + * This is the method called to load a resource into the editing domain's resource set based on the editor's input. + * + * + * + * @generated + */ + public void createModel() { + URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter()); + Exception exception = null; + Resource resource = null; + try { + // Load the resource through the editing domain. + // + resource = editingDomain.getResourceSet().getResource(resourceURI, true); + } catch (Exception e) { + exception = e; + resource = editingDomain.getResourceSet().getResource(resourceURI, false); + } + + Diagnostic diagnostic = analyzeResourceProblems(resource, exception); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); + } + + /** + * Returns a diagnostic describing the errors and warnings listed in the resource + * and the specified exception (if any). + * + * + * + * @generated + */ + public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { + boolean hasErrors = !resource.getErrors().isEmpty(); + if (hasErrors || !resource.getWarnings().isEmpty()) { + BasicDiagnostic basicDiagnostic = new BasicDiagnostic(hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, + "org.eclipse.papyrus.infra.propertylifecycle.model.editor", //$NON-NLS-1$ + 0, + getString("_UI_CreateModelError_message", resource.getURI()), //$NON-NLS-1$ + new Object[] { exception == null ? (Object) resource : exception }); + basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); + return basicDiagnostic; + } else if (exception != null) { + return new BasicDiagnostic(Diagnostic.ERROR, + "org.eclipse.papyrus.infra.propertylifecycle.model.editor", //$NON-NLS-1$ + 0, + getString("_UI_CreateModelError_message", resource.getURI()), //$NON-NLS-1$ + new Object[] { exception }); + } else { + return Diagnostic.OK_INSTANCE; + } + } + + /** + * This is the method used by the framework to install your own controls. + * + * + * + * @generated + */ + @Override + 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()) { + // Create a page for the selection tree view. + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), PropertylifecycleEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + selectionViewer = (TreeViewer) viewerPane.getViewer(); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + viewerPane.setTitle(editingDomain.getResourceSet()); + + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); + + createContextMenuFor(selectionViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ + } + + // Create a page for the parent tree view. + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), PropertylifecycleEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + parentViewer = (TreeViewer) viewerPane.getViewer(); + parentViewer.setAutoExpandLevel(30); + parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); + parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(parentViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ParentPage_label")); //$NON-NLS-1$ + } + + // This is the page for the list viewer + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), PropertylifecycleEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new ListViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + listViewer = (ListViewer) viewerPane.getViewer(); + listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(listViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ListPage_label")); //$NON-NLS-1$ + } + + // This is the page for the tree viewer + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), PropertylifecycleEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + treeViewer = (TreeViewer) viewerPane.getViewer(); + treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + + createContextMenuFor(treeViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreePage_label")); //$NON-NLS-1$ + } + + // This is the page for the table viewer. + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), PropertylifecycleEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TableViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + tableViewer = (TableViewer) viewerPane.getViewer(); + + Table table = tableViewer.getTable(); + TableLayout layout = new TableLayout(); + table.setLayout(layout); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + TableColumn objectColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(3, 100, true)); + objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ + objectColumn.setResizable(true); + + TableColumn selfColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(2, 100, true)); + selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ + selfColumn.setResizable(true); + + tableViewer.setColumnProperties(new String[] { "a", "b" }); //$NON-NLS-1$ //$NON-NLS-2$ + tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(tableViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TablePage_label")); //$NON-NLS-1$ + } + + // This is the page for the table tree viewer. + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), PropertylifecycleEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + treeViewerWithColumns = (TreeViewer) viewerPane.getViewer(); + + Tree tree = treeViewerWithColumns.getTree(); + tree.setLayoutData(new FillLayout()); + tree.setHeaderVisible(true); + tree.setLinesVisible(true); + + TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); + objectColumn.setText(getString("_UI_ObjectColumn_label")); //$NON-NLS-1$ + objectColumn.setResizable(true); + objectColumn.setWidth(250); + + TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); + selfColumn.setText(getString("_UI_SelfColumn_label")); //$NON-NLS-1$ + selfColumn.setResizable(true); + selfColumn.setWidth(200); + + treeViewerWithColumns.setColumnProperties(new String[] { "a", "b" }); //$NON-NLS-1$ //$NON-NLS-2$ + treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(treeViewerWithColumns); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); //$NON-NLS-1$ + } + + getSite().getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + 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; + + @Override + public void controlResized(ControlEvent event) { + if (!guard) { + guard = true; + hideTabs(); + guard = false; + } + } + }); + + getSite().getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + updateProblemIndication(); + } + }); + } + + /** + * If there is just one page in the multi-page editor part, + * this hides the single tab at the bottom. + * + * + * + * @generated + */ + protected void hideTabs() { + if (getPageCount() <= 1) { + setPageText(0, ""); //$NON-NLS-1$ + if (getContainer() instanceof CTabFolder) { + ((CTabFolder) getContainer()).setTabHeight(1); + Point point = getContainer().getSize(); + getContainer().setSize(point.x, point.y + 6); + } + } + } + + /** + * If there is more than one page in the multi-page editor part, + * this shows the tabs at the bottom. + * + * + * + * @generated + */ + protected void showTabs() { + if (getPageCount() > 1) { + setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$ + if (getContainer() instanceof CTabFolder) { + ((CTabFolder) getContainer()).setTabHeight(SWT.DEFAULT); + Point point = getContainer().getSize(); + getContainer().setSize(point.x, point.y - 6); + } + } + } + + /** + * This is used to track the active viewer. + * + * + * + * @generated + */ + @Override + protected void pageChange(int pageIndex) { + super.pageChange(pageIndex); + + if (contentOutlinePage != null) { + handleContentOutlineSelection(contentOutlinePage.getSelection()); + } + } + + /** + * This is how the framework determines which interfaces we implement. + * + * + * + * @generated + */ + @SuppressWarnings("rawtypes") + @Override + public Object getAdapter(Class key) { + if (key.equals(IContentOutlinePage.class)) { + return showOutlineView() ? getContentOutlinePage() : null; + } else if (key.equals(IPropertySheetPage.class)) { + return getPropertySheetPage(); + } else if (key.equals(IGotoMarker.class)) { + return this; + } else { + return super.getAdapter(key); + } + } + + /** + * This accesses a cached version of the content outliner. + * + * + * + * @generated + */ + public IContentOutlinePage getContentOutlinePage() { + if (contentOutlinePage == null) { + // The content outline is just a tree. + // + class MyContentOutlinePage extends ContentOutlinePage { + @Override + public void createControl(Composite parent) { + super.createControl(parent); + contentOutlineViewer = getTreeViewer(); + contentOutlineViewer.addSelectionChangedListener(this); + + // Set up the tree viewer. + // + contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + contentOutlineViewer.setInput(editingDomain.getResourceSet()); + + // Make sure our popups work. + // + createContextMenuFor(contentOutlineViewer); + + if (!editingDomain.getResourceSet().getResources().isEmpty()) { + // Select the root object in the view. + // + contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + } + } + + @Override + public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { + super.makeContributions(menuManager, toolBarManager, statusLineManager); + contentOutlineStatusLineManager = statusLineManager; + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + } + + contentOutlinePage = new MyContentOutlinePage(); + + // Listen to selection so that we can handle it is a special way. + // + contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener() { + // This ensures that we handle selections correctly. + // + @Override + public void selectionChanged(SelectionChangedEvent event) { + handleContentOutlineSelection(event.getSelection()); + } + }); + } + + return contentOutlinePage; + } + + /** + * This accesses a cached version of the property sheet. + * + * + * + * @generated + */ + public IPropertySheetPage getPropertySheetPage() { + PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List selection) { + PropertylifecycleEditor.this.setSelectionToViewer(selection); + PropertylifecycleEditor.this.setFocus(); + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + propertySheetPages.add(propertySheetPage); + + return propertySheetPage; + } + + /** + * This deals with how we want selection in the outliner to affect the other views. + * + * + * + * @generated + */ + public void handleContentOutlineSelection(ISelection selection) { + if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + Iterator selectedElements = ((IStructuredSelection) selection).iterator(); + if (selectedElements.hasNext()) { + // Get the first selected element. + // + Object selectedElement = selectedElements.next(); + + // If it's the selection viewer, then we want it to select the same selection as this selection. + // + if (currentViewerPane.getViewer() == selectionViewer) { + ArrayList selectionList = new ArrayList(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); + } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); + } else { + // Set the input to the widget. + // + if (currentViewerPane.getViewer().getInput() != selectedElement) { + currentViewerPane.getViewer().setInput(selectedElement); + currentViewerPane.setTitle(selectedElement); + } + } + } + } + } + + /** + * This is for implementing {@link IEditorPart} and simply tests the command stack. + * + * + * + * @generated + */ + @Override + public boolean isDirty() { + return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded(); + } + + /** + * This is for implementing {@link IEditorPart} and simply saves the model file. + * + * + * + * @generated + */ + @Override + public void doSave(IProgressMonitor progressMonitor) { + // Save only resources that have actually changed. + // + final Map saveOptions = new HashMap(); + saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); + saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); + + // Do the work within an operation because this is a long running activity that modifies the workbench. + // + WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { + // This is the method that gets invoked when the operation runs. + // + @Override + public void execute(IProgressMonitor monitor) { + // Save the resources to the file system. + // + boolean first = true; + for (Resource resource : editingDomain.getResourceSet().getResources()) { + if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { + try { + long timeStamp = resource.getTimeStamp(); + resource.save(saveOptions); + if (resource.getTimeStamp() != timeStamp) { + savedResources.add(resource); + } + } catch (Exception exception) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + first = false; + } + } + } + }; + + updateProblemIndication = false; + try { + // This runs the options, and shows progress. + // + new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); + + // Refresh the necessary state. + // + ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone(); + firePropertyChange(IEditorPart.PROP_DIRTY); + } catch (Exception exception) { + // Something went wrong that shouldn't. + // + PropertylifecycleEditorPlugin.INSTANCE.log(exception); + } + updateProblemIndication = true; + updateProblemIndication(); + } + + /** + * This returns whether something has been persisted to the URI of the specified resource. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * + * + * + * @generated + */ + protected boolean isPersisted(Resource resource) { + boolean result = false; + try { + InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); + if (stream != null) { + result = true; + stream.close(); + } + } catch (IOException e) { + // Ignore + } + return result; + } + + /** + * This always returns true because it is not currently supported. + * + * + * + * @generated + */ + @Override + public boolean isSaveAsAllowed() { + return true; + } + + /** + * This also changes the editor's input. + * + * + * + * @generated + */ + @Override + public void doSaveAs() { + SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); + saveAsDialog.open(); + IPath path = saveAsDialog.getResult(); + if (path != null) { + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + if (file != null) { + doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); + } + } + } + + /** + * + * + * + * @generated + */ + protected void doSaveAs(URI uri, IEditorInput editorInput) { + (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars().getStatusLineManager().getProgressMonitor() : new NullProgressMonitor(); + doSave(progressMonitor); + } + + /** + * + * + * + * @generated + */ + @Override + public void gotoMarker(IMarker marker) { + List targetObjects = markerHelper.getTargetObjects(editingDomain, marker); + if (!targetObjects.isEmpty()) { + setSelectionToViewer(targetObjects); + } + } + + /** + * This is called during startup. + * + * + * + * @generated + */ + @Override + public void init(IEditorSite site, IEditorInput editorInput) { + setSite(site); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + site.setSelectionProvider(this); + site.getPage().addPartListener(partListener); + ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); + } + + /** + * + * + * + * @generated + */ + @Override + public void setFocus() { + if (currentViewerPane != null) { + currentViewerPane.setFocus(); + } else { + getControl(getActivePage()).setFocus(); + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * + * + * + * @generated + */ + @Override + public void addSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.add(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * + * + * + * @generated + */ + @Override + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.remove(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. + * + * + * + * @generated + */ + @Override + public ISelection getSelection() { + return editorSelection; + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. + * Calling this result will notify the listeners. + * + * + * + * @generated + */ + @Override + public void setSelection(ISelection selection) { + editorSelection = selection; + + for (ISelectionChangedListener listener : selectionChangedListeners) { + listener.selectionChanged(new SelectionChangedEvent(this, selection)); + } + setStatusLineManager(selection); + } + + /** + * + * + * + * @generated + */ + public void setStatusLineManager(ISelection selection) { + IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); + + if (statusLineManager != null) { + if (selection instanceof IStructuredSelection) { + Collection collection = ((IStructuredSelection) selection).toList(); + switch (collection.size()) { + case 0: { + statusLineManager.setMessage(getString("_UI_NoObjectSelected")); //$NON-NLS-1$ + break; + } + case 1: { + String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); + statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); //$NON-NLS-1$ + break; + } + default: { + statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); //$NON-NLS-1$ + break; + } + } + } else { + statusLineManager.setMessage(""); //$NON-NLS-1$ + } + } + } + + /** + * This looks up a string in the plugin's plugin.properties file. + * + * + * + * @generated + */ + private static String getString(String key) { + return PropertylifecycleEditorPlugin.INSTANCE.getString(key); + } + + /** + * This looks up a string in plugin.properties, making a substitution. + * + * + * + * @generated + */ + private static String getString(String key, Object s1) { + return PropertylifecycleEditorPlugin.INSTANCE.getString(key, new Object[] { s1 }); + } + + /** + * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. + * + * + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + ((IMenuListener) getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); + } + + /** + * + * + * + * @generated + */ + public EditingDomainActionBarContributor getActionBarContributor() { + return (EditingDomainActionBarContributor) getEditorSite().getActionBarContributor(); + } + + /** + * + * + * + * @generated + */ + public IActionBars getActionBars() { + return getActionBarContributor().getActionBars(); + } + + /** + * + * + * + * @generated + */ + public AdapterFactory getAdapterFactory() { + return adapterFactory; + } + + /** + * + * + * + * @generated + */ + @Override + public void dispose() { + updateProblemIndication = false; + + ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); + + getSite().getPage().removePartListener(partListener); + + adapterFactory.dispose(); + + if (getActionBarContributor().getActiveEditor() == this) { + getActionBarContributor().setActiveEditor(null); + } + + for (PropertySheetPage propertySheetPage : propertySheetPages) { + propertySheetPage.dispose(); + } + + if (contentOutlinePage != null) { + contentOutlinePage.dispose(); + } + + super.dispose(); + } + + /** + * Returns whether the outline view should be presented to the user. + * + * + * + * @generated + */ + protected boolean showOutlineView() { + return true; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleEditorPlugin.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleEditorPlugin.java new file mode 100755 index 00000000000..34a189cdfa5 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleEditorPlugin.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.presentation; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.ui.EclipseUIPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the Propertylifecycle editor plugin. + * + * + * + * @generated + */ +public final class PropertylifecycleEditorPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * + * @generated + */ + public static final PropertylifecycleEditorPlugin INSTANCE = new PropertylifecycleEditorPlugin(); + + /** + * Keep track of the singleton. + * + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * + * @generated + */ + public PropertylifecycleEditorPlugin() { + super(new ResourceLocator[] { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * + * @generated + */ + public static class Implementation extends EclipseUIPlugin { + /** + * Creates an instance. + * + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleModelWizard.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleModelWizard.java new file mode 100755 index 00000000000..207d06454c9 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model.editor/src-gen/org/eclipse/papyrus/propertylifecycle/presentation/PropertylifecycleModelWizard.java @@ -0,0 +1,662 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.presentation; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.MissingResourceException; +import java.util.StringTokenizer; + +import org.eclipse.emf.common.CommonPlugin; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; + +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.EObject; + +import org.eclipse.emf.ecore.xmi.XMLResource; + +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; + +import org.eclipse.core.runtime.IProgressMonitor; + +import org.eclipse.jface.dialogs.MessageDialog; + +import org.eclipse.jface.viewers.IStructuredSelection; + +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.ModifyEvent; + +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; + +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; + +import org.eclipse.ui.actions.WorkspaceModifyOperation; + +import org.eclipse.ui.dialogs.WizardNewFileCreationPage; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ISetSelectionTarget; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.provider.PropertylifecycleEditPlugin; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; + +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; + + +/** + * This is a simple wizard for creating a new model file. + * + * + * + * @generated + */ +public class PropertylifecycleModelWizard extends Wizard implements INewWizard { + /** + * The supported extensions for created files. + * + * + * + * @generated + */ + public static final List FILE_EXTENSIONS = Collections.unmodifiableList(Arrays.asList(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_PropertylifecycleEditorFilenameExtensions").split("\\s*,\\s*"))); //$NON-NLS-1$ //$NON-NLS-2$ + + /** + * A formatted list of supported file extensions, suitable for display. + * + * + * + * @generated + */ + public static final String FORMATTED_FILE_EXTENSIONS = PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_PropertylifecycleEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + /** + * This caches an instance of the model package. + * + * + * + * @generated + */ + protected PropertylifecyclePackage propertylifecyclePackage = PropertylifecyclePackage.eINSTANCE; + + /** + * This caches an instance of the model factory. + * + * + * + * @generated + */ + protected PropertylifecycleFactory propertylifecycleFactory = propertylifecyclePackage.getPropertylifecycleFactory(); + + /** + * This is the file creation page. + * + * + * + * @generated + */ + protected PropertylifecycleModelWizardNewFileCreationPage newFileCreationPage; + + /** + * This is the initial object creation page. + * + * + * + * @generated + */ + protected PropertylifecycleModelWizardInitialObjectCreationPage initialObjectCreationPage; + + /** + * Remember the selection during initialization for populating the default container. + * + * + * + * @generated + */ + protected IStructuredSelection selection; + + /** + * Remember the workbench during initialization. + * + * + * + * @generated + */ + protected IWorkbench workbench; + + /** + * Caches the names of the types that can be created as the root object. + * + * + * + * @generated + */ + protected List initialObjectNames; + + /** + * This just records the information. + * + * + * + * @generated + */ + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + setWindowTitle(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$ + setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(PropertylifecycleEditorPlugin.INSTANCE.getImage("full/wizban/NewPropertylifecycle"))); //$NON-NLS-1$ + } + + /** + * Returns the names of the types that can be created as the root object. + * + * + * + * @generated + */ + protected Collection getInitialObjectNames() { + if (initialObjectNames == null) { + initialObjectNames = new ArrayList(); + for (EClassifier eClassifier : propertylifecyclePackage.getEClassifiers()) { + if (eClassifier instanceof EClass) { + EClass eClass = (EClass) eClassifier; + if (!eClass.isAbstract()) { + initialObjectNames.add(eClass.getName()); + } + } + } + Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); + } + return initialObjectNames; + } + + /** + * Create a new model. + * + * + * + * @generated + */ + protected EObject createInitialModel() { + EClass eClass = (EClass) propertylifecyclePackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); + EObject rootObject = propertylifecycleFactory.create(eClass); + return rootObject; + } + + /** + * Do the work after everything is specified. + * + * + * + * @generated + */ + @Override + public boolean performFinish() { + try { + // Remember the file. + // + final IFile modelFile = getModelFile(); + + // Do the work within an operation. + // + WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { + @Override + protected void execute(IProgressMonitor progressMonitor) { + try { + // Create a resource set + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + // + URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); + + // Create a resource for this file. + // + Resource resource = resourceSet.createResource(fileURI, PropertylifecyclePackage.eCONTENT_TYPE); + + // Add the initial model object to the contents. + // + EObject rootObject = createInitialModel(); + if (rootObject != null) { + resource.getContents().add(rootObject); + } + + // Save the contents of the resource to the file system. + // + Map options = new HashMap(); + options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); + resource.save(options); + } catch (Exception exception) { + PropertylifecycleEditorPlugin.INSTANCE.log(exception); + } finally { + progressMonitor.done(); + } + } + }; + + getContainer().run(false, false, operation); + + // Select the new file resource in the current view. + // + IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + final IWorkbenchPart activePart = page.getActivePart(); + if (activePart instanceof ISetSelectionTarget) { + final ISelection targetSelection = new StructuredSelection(modelFile); + getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + ((ISetSelectionTarget) activePart).selectReveal(targetSelection); + } + }); + } + + // Open an editor on the new file. + // + try { + page.openEditor(new FileEditorInput(modelFile), + workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString(), + Platform.getContentTypeManager().getContentType(PropertylifecyclePackage.eCONTENT_TYPE)).getId()); + } catch (PartInitException exception) { + MessageDialog.openError(workbenchWindow.getShell(), PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ + return false; + } + + return true; + } catch (Exception exception) { + PropertylifecycleEditorPlugin.INSTANCE.log(exception); + return false; + } + } + + /** + * This is the one page of the wizard. + * + * + * + * @generated + */ + public class PropertylifecycleModelWizardNewFileCreationPage extends WizardNewFileCreationPage { + /** + * Pass in the selection. + * + * + * + * @generated + */ + public PropertylifecycleModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { + super(pageId, selection); + } + + /** + * The framework calls this to see if the file is correct. + * + * + * + * @generated + */ + @Override + protected boolean validatePage() { + if (super.validatePage()) { + String extension = new Path(getFileName()).getFileExtension(); + if (extension == null || !FILE_EXTENSIONS.contains(extension)) { + String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$ + setErrorMessage(PropertylifecycleEditorPlugin.INSTANCE.getString(key, new Object[] { FORMATTED_FILE_EXTENSIONS })); + return false; + } + return true; + } + return false; + } + + /** + * + * + * + * @generated + */ + public IFile getModelFile() { + return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); + } + } + + /** + * This is the page where the type of object to create is selected. + * + * + * + * @generated + */ + public class PropertylifecycleModelWizardInitialObjectCreationPage extends WizardPage { + /** + * + * + * + * @generated + */ + protected Combo initialObjectField; + + /** + * @generated + * + * + */ + protected List encodings; + + /** + * + * + * + * @generated + */ + protected Combo encodingField; + + /** + * Pass in the selection. + * + * + * + * @generated + */ + public PropertylifecycleModelWizardInitialObjectCreationPage(String pageId) { + super(pageId); + } + + /** + * + * + * + * @generated + */ + @Override + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + { + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.verticalSpacing = 12; + composite.setLayout(layout); + + GridData data = new GridData(); + data.verticalAlignment = GridData.FILL; + data.grabExcessVerticalSpace = true; + data.horizontalAlignment = GridData.FILL; + composite.setLayoutData(data); + } + + Label containerLabel = new Label(composite, SWT.LEFT); + { + containerLabel.setText(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$ + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + containerLabel.setLayoutData(data); + } + + initialObjectField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + initialObjectField.setLayoutData(data); + } + + for (String objectName : getInitialObjectNames()) { + initialObjectField.add(getLabel(objectName)); + } + + if (initialObjectField.getItemCount() == 1) { + initialObjectField.select(0); + } + initialObjectField.addModifyListener(validator); + + Label encodingLabel = new Label(composite, SWT.LEFT); + { + encodingLabel.setText(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$ + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + encodingLabel.setLayoutData(data); + } + encodingField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + encodingField.setLayoutData(data); + } + + for (String encoding : getEncodings()) { + encodingField.add(encoding); + } + + encodingField.select(0); + encodingField.addModifyListener(validator); + + setPageComplete(validatePage()); + setControl(composite); + } + + /** + * + * + * + * @generated + */ + protected ModifyListener validator = new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + setPageComplete(validatePage()); + } + }; + + /** + * + * + * + * @generated + */ + protected boolean validatePage() { + return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); + } + + /** + * + * + * + * @generated + */ + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + if (initialObjectField.getItemCount() == 1) { + initialObjectField.clearSelection(); + encodingField.setFocus(); + } else { + encodingField.clearSelection(); + initialObjectField.setFocus(); + } + } + } + + /** + * + * + * + * @generated + */ + public String getInitialObjectName() { + String label = initialObjectField.getText(); + + for (String name : getInitialObjectNames()) { + if (getLabel(name).equals(label)) { + return name; + } + } + return null; + } + + /** + * + * + * + * @generated + */ + public String getEncoding() { + return encodingField.getText(); + } + + /** + * Returns the label for the specified type name. + * + * + * + * @generated + */ + protected String getLabel(String typeName) { + try { + return PropertylifecycleEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$ + } catch (MissingResourceException mre) { + PropertylifecycleEditorPlugin.INSTANCE.log(mre); + } + return typeName; + } + + /** + * + * + * + * @generated + */ + protected Collection getEncodings() { + if (encodings == null) { + encodings = new ArrayList(); + for (StringTokenizer stringTokenizer = new StringTokenizer(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens();) //$NON-NLS-1$ + { + encodings.add(stringTokenizer.nextToken()); + } + } + return encodings; + } + } + + /** + * The framework calls this to create the contents of the wizard. + * + * + * + * @generated + */ + @Override + public void addPages() { + // Create a page, set the title, and the initial model file name. + // + newFileCreationPage = new PropertylifecycleModelWizardNewFileCreationPage("Whatever", selection); //$NON-NLS-1$ + newFileCreationPage.setTitle(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_PropertylifecycleModelWizard_label")); //$NON-NLS-1$ + newFileCreationPage.setDescription(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_PropertylifecycleModelWizard_description")); //$NON-NLS-1$ + newFileCreationPage.setFileName(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_PropertylifecycleEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ + addPage(newFileCreationPage); + + // Try and get the resource selection to determine a current directory for the file dialog. + // + if (selection != null && !selection.isEmpty()) { + // Get the resource... + // + Object selectedElement = selection.iterator().next(); + if (selectedElement instanceof IResource) { + // Get the resource parent, if its a file. + // + IResource selectedResource = (IResource) selectedElement; + if (selectedResource.getType() == IResource.FILE) { + selectedResource = selectedResource.getParent(); + } + + // This gives us a directory... + // + if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { + // Set this for the container. + // + newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); + + // Make up a unique new name here. + // + String defaultModelBaseFilename = PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_PropertylifecycleEditorFilenameDefaultBase"); //$NON-NLS-1$ + String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); + String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$ + for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) { + modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$ + } + newFileCreationPage.setFileName(modelFilename); + } + } + } + initialObjectCreationPage = new PropertylifecycleModelWizardInitialObjectCreationPage("Whatever2"); //$NON-NLS-1$ + initialObjectCreationPage.setTitle(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_PropertylifecycleModelWizard_label")); //$NON-NLS-1$ + initialObjectCreationPage.setDescription(PropertylifecycleEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$ + addPage(initialObjectCreationPage); + } + + /** + * Get the file from the page. + * + * + * + * @generated + */ + public IFile getModelFile() { + return newFileCreationPage.getModelFile(); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.classpath b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.classpath new file mode 100755 index 00000000000..50aae142c50 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.gitignore b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.gitignore new file mode 100755 index 00000000000..ae3c1726048 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.project b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.project new file mode 100755 index 00000000000..0badea84f49 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.propertylifecycle.model + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.settings/org.eclipse.jdt.core.prefs b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..0c68a61dca8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/META-INF/MANIFEST.MF b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..33e1b483228 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.propertylifecycle.model;singleton:=true +Bundle-Version: 0.0.1.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Export-Package: org.eclipse.papyrus.propertylifecycle, + org.eclipse.papyrus.propertylifecycle.impl, + org.eclipse.papyrus.propertylifecycle.model.registries, + org.eclipse.papyrus.propertylifecycle.util +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.emf.ecore;bundle-version="2.12.0";visibility:=reexport, + org.eclipse.emf.ecore.xmi;bundle-version="2.12.0";visibility:=reexport, + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.ui;bundle-version="3.107.0" +Bundle-ActivationPolicy: lazy diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/about.html b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/about.html new file mode 100755 index 00000000000..d35d5aed64c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/build.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/build.properties new file mode 100755 index 00000000000..e47d31cf85e --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/build.properties @@ -0,0 +1,21 @@ +# Copyright (c) 2016 CEA LIST and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# +# Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html,\ + schema/ +jars.compile.order = . +source.. = src-gen/ +output.. = bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.css b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.css new file mode 100755 index 00000000000..f93ba3e825c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.css @@ -0,0 +1,57 @@ +/*--- ClassDiagram > Class ---*/ +ClassDiagram Class { + fillcolor: #FFFFFF; + elementIcon: false; +} + +ClassDiagram Class > Compartment[kind="operations"], +ClassDiagram Class > Compartment[kind="nestedclassifiers"], +ClassDiagram Class > Compartment[kind="symbol"] { + visible:false; +} + +/*--- ClassDiagram > Enumeration ---*/ +ClassDiagram Enumeration { + fillcolor: white; + elementIcon: false; +} + +ClassDiagram Enumeration > Compartment[kind="symbol"] { + visible:false; +} + +/*--- ClassDiagram > Model ---*/ +ClassDiagram Model { + fillcolor: rgb(255, 255, 255); + elementIcon: false; +} + +/*--- ClassDiagram > Association ---*/ +ClassDiagram Association > Label:targetRole, +ClassDiagram Association > Label:sourceRole { + visible: false; +} + +ClassDiagram > Association { + targetDecoration: false; + sourceDecoration: false; +} + + +/*--- ClassDiagram > Property/EnumerationLiteral ---*/ +ClassDiagram Class > Compartment > Property, +ClassDiagram Enumeration > Compartment > EnumerationLiteral { + elementIcon: false; + maskLabel: name multiplicity; +} + + + +/*--- Tests ---*/ + + +/*--- Notes ---*/ +/* + * 1- maskLabel does not mask the attached label(s) but displays it and masks all others + * + * */ \ No newline at end of file diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.di b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.di new file mode 100755 index 00000000000..bf9abab340f --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.di @@ -0,0 +1,2 @@ + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.notation b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.notation new file mode 100755 index 00000000000..f790d31af0a --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.notation @@ -0,0 +1,3765 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + derived + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.uml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.uml new file mode 100755 index 00000000000..1d426776b1a --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/papyrus/propertylifecycle.uml @@ -0,0 +1,449 @@ + + + + + + These informations are used to select and edit the property + + + + Contains the standard informations needed to identify the strategy sets + + + + + + + + + + + + + + + + Root set containing the defined strategies + + + + + + + + + The element affected by this strategy + + + + + + + + + + + + + + Contains the standard informations needed to identify the elements affected by this strategy + + + + + + + + + + + + These informations are used to select and edit the property + + + + + + + + + + + + + + + + + + + + + + The informations defining the required immediate possible container(s) of the element + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + Processor from which to compute the new value of the property + + + + + Process the new vaue from the specified java class + + + + + + + + +
+ + + + + + Specify the basic triggers of an element's lifecycle + + + + + + + + + + + + + + + + + + Triggers specifying the lifecycle moment(s) from which to apply the processed value to the property + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/propertylifecycle.ecore b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/propertylifecycle.ecore new file mode 100755 index 00000000000..533039a39f0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/propertylifecycle.ecore @@ -0,0 +1,89 @@ + + + + +
+ + + + + + + +
+ + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + + + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/propertylifecycle.genmodel b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/propertylifecycle.genmodel new file mode 100755 index 00000000000..d7ea405d044 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/model/propertylifecycle.genmodel @@ -0,0 +1,56 @@ + + + propertylifecycle.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/plugin.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/plugin.properties new file mode 100755 index 00000000000..37c7ff58c31 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/plugin.properties @@ -0,0 +1,16 @@ +# Copyright (c) 2016 CEA LIST and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# +# Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + +pluginName = Propertylifecycle Model +providerName = www.example.org + +_UI_Propertylifecycle_content_type = Propertylifecycle File +_UI_UMLpropertylifecycle_content_type = UMLpropertylifecycle File diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/plugin.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/plugin.xml new file mode 100755 index 00000000000..d241dfe9767 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/plugin.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/pom.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/pom.xml new file mode 100755 index 00000000000..37c9f9d14bf --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.eclipse.papyrus.infra.propertylifecycle.model + 0.0.1.qualifier + org.eclipse.papyrus + eclipse-plugin + + org.eclipse.papyrus + org.eclipse.papyrus.infra.propertylifecycle + 0.0.1.qualifier + ../org.eclipse.papyrus.infra.propertylifecycle/pom.xml + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/schema/propertylifecyclestrategyset.exsd b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/schema/propertylifecyclestrategyset.exsd new file mode 100755 index 00000000000..bda9ed55387 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/schema/propertylifecyclestrategyset.exsd @@ -0,0 +1,106 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/AbstractTrigger.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/AbstractTrigger.java new file mode 100755 index 00000000000..575a6f6653f --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/AbstractTrigger.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Abstract Trigger'. + * + * + * + * Triggers specifying the lifecycle moment(s) from which to apply the processed value to the property + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getAbstractTrigger() + * @model abstract="true" + * @generated + */ +public interface AbstractTrigger extends EObject { +} // AbstractTrigger diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/AbstractValueProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/AbstractValueProcessor.java new file mode 100755 index 00000000000..1860a609377 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/AbstractValueProcessor.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Abstract Value Processor'. + * + * + * + * Processor from which to compute the new value of the property + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getAbstractValueProcessor() + * @model abstract="true" + * @generated + */ +public interface AbstractValueProcessor extends EObject { +} // AbstractValueProcessor diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/BasicTrigger.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/BasicTrigger.java new file mode 100755 index 00000000000..542af57d31f --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/BasicTrigger.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + + +/** + * + * A representation of the model object 'Basic Trigger'. + * + * + * + * Specify the basic triggers of an element's lifecycle + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnCreate On Create}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnDelete On Delete}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnOpen On Open}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnMove On Move}
  • + *
+ * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getBasicTrigger() + * @model + * @generated + */ +public interface BasicTrigger extends AbstractTrigger { + /** + * Returns the value of the 'On Create' attribute. + * + *

+ * If the meaning of the 'On Create' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'On Create' attribute. + * @see #setOnCreate(boolean) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getBasicTrigger_OnCreate() + * @model required="true" ordered="false" + * @generated + */ + boolean isOnCreate(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnCreate On Create}' attribute. + * + * + * + * @param value + * the new value of the 'On Create' attribute. + * @see #isOnCreate() + * @generated + */ + void setOnCreate(boolean value); + + /** + * Returns the value of the 'On Delete' attribute. + * + *

+ * If the meaning of the 'On Delete' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'On Delete' attribute. + * @see #setOnDelete(boolean) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getBasicTrigger_OnDelete() + * @model required="true" ordered="false" + * @generated + */ + boolean isOnDelete(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnDelete On Delete}' attribute. + * + * + * + * @param value + * the new value of the 'On Delete' attribute. + * @see #isOnDelete() + * @generated + */ + void setOnDelete(boolean value); + + /** + * Returns the value of the 'On Open' attribute. + * + *

+ * If the meaning of the 'On Open' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'On Open' attribute. + * @see #setOnOpen(boolean) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getBasicTrigger_OnOpen() + * @model required="true" ordered="false" + * @generated + */ + boolean isOnOpen(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnOpen On Open}' attribute. + * + * + * + * @param value + * the new value of the 'On Open' attribute. + * @see #isOnOpen() + * @generated + */ + void setOnOpen(boolean value); + + /** + * Returns the value of the 'On Move' attribute. + * + *

+ * If the meaning of the 'On Move' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'On Move' attribute. + * @see #setOnMove(boolean) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getBasicTrigger_OnMove() + * @model required="true" ordered="false" + * @generated + */ + boolean isOnMove(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnMove On Move}' attribute. + * + * + * + * @param value + * the new value of the 'On Move' attribute. + * @see #isOnMove() + * @generated + */ + void setOnMove(boolean value); + +} // BasicTrigger diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementContainer.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementContainer.java new file mode 100755 index 00000000000..0fa70d0bc2e --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementContainer.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + + +/** + * + * A representation of the model object 'Element Container'. + * + * + * + * The informations defining the required immediate possible container(s) of the element + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.ElementContainer#getContainersContainer Containers Container}
  • + *
+ * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementContainer() + * @model + * @generated + */ +public interface ElementContainer extends ElementTemplate { + /** + * Returns the value of the 'Containers Container' containment reference. + * + *

+ * If the meaning of the 'Containers Container' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Containers Container' containment reference. + * @see #setContainersContainer(ElementContainer) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementContainer_ContainersContainer() + * @model containment="true" ordered="false" + * @generated + */ + ElementContainer getContainersContainer(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.ElementContainer#getContainersContainer Containers Container}' containment reference. + * + * + * + * @param value + * the new value of the 'Containers Container' containment reference. + * @see #getContainersContainer() + * @generated + */ + void setContainersContainer(ElementContainer value); + +} // ElementContainer diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementProperty.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementProperty.java new file mode 100755 index 00000000000..29ccd839489 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementProperty.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Element Property'. + * + * + * + * These informations are used to select and edit the property + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getFeatureLabel Feature Label}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getPriority Priority}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getTriggers Triggers}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getValueProcessor Value Processor}
  • + *
+ * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementProperty() + * @model + * @generated + */ +public interface ElementProperty extends EObject { + /** + * Returns the value of the 'Feature Label' attribute. + * + *

+ * If the meaning of the 'Feature Label' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Feature Label' attribute. + * @see #setFeatureLabel(String) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementProperty_FeatureLabel() + * @model required="true" + * @generated + */ + String getFeatureLabel(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getFeatureLabel Feature Label}' attribute. + * + * + * + * @param value + * the new value of the 'Feature Label' attribute. + * @see #getFeatureLabel() + * @generated + */ + void setFeatureLabel(String value); + + /** + * Returns the value of the 'Priority' attribute. + * The default value is "0". + * + *

+ * If the meaning of the 'Priority' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Priority' attribute. + * @see #setPriority(Integer) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementProperty_Priority() + * @model default="0" required="true" + * @generated + */ + Integer getPriority(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getPriority Priority}' attribute. + * + * + * + * @param value + * the new value of the 'Priority' attribute. + * @see #getPriority() + * @generated + */ + void setPriority(Integer value); + + /** + * Returns the value of the 'Triggers' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.propertylifecycle.AbstractTrigger}. + * + *

+ * If the meaning of the 'Triggers' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Triggers' containment reference list. + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementProperty_Triggers() + * @model containment="true" required="true" ordered="false" + * @generated + */ + EList getTriggers(); + + /** + * Returns the value of the 'Value Processor' containment reference. + * + *

+ * If the meaning of the 'Value Processor' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Value Processor' containment reference. + * @see #setValueProcessor(AbstractValueProcessor) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementProperty_ValueProcessor() + * @model containment="true" required="true" ordered="false" + * @generated + */ + AbstractValueProcessor getValueProcessor(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getValueProcessor Value Processor}' containment reference. + * + * + * + * @param value + * the new value of the 'Value Processor' containment reference. + * @see #getValueProcessor() + * @generated + */ + void setValueProcessor(AbstractValueProcessor value); + +} // ElementProperty diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementTemplate.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementTemplate.java new file mode 100755 index 00000000000..99c4d468cf9 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/ElementTemplate.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Element Template'. + * + * + * + * Contains the standard informations needed to identify the elements affected by this strategy + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.ElementTemplate#getBaseType Base Type}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.ElementTemplate#getSpecializedType Specialized Type}
  • + *
+ * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementTemplate() + * @model abstract="true" + * @generated + */ +public interface ElementTemplate extends EObject { + /** + * Returns the value of the 'Base Type' attribute. + * + *

+ * If the meaning of the 'Base Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Base Type' attribute. + * @see #setBaseType(String) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementTemplate_BaseType() + * @model required="true" + * @generated + */ + String getBaseType(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.ElementTemplate#getBaseType Base Type}' attribute. + * + * + * + * @param value + * the new value of the 'Base Type' attribute. + * @see #getBaseType() + * @generated + */ + void setBaseType(String value); + + /** + * Returns the value of the 'Specialized Type' attribute. + * + *

+ * If the meaning of the 'Specialized Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Specialized Type' attribute. + * @see #setSpecializedType(String) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getElementTemplate_SpecializedType() + * @model + * @generated + */ + String getSpecializedType(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.ElementTemplate#getSpecializedType Specialized Type}' attribute. + * + * + * + * @param value + * the new value of the 'Specialized Type' attribute. + * @see #getSpecializedType() + * @generated + */ + void setSpecializedType(String value); + +} // ElementTemplate diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/JavaProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/JavaProcessor.java new file mode 100755 index 00000000000..69d736feef6 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/JavaProcessor.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + + +/** + * + * A representation of the model object 'Java Processor'. + * + * + * + * Process the new vaue from the specified java class + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.JavaProcessor#getClassName Class Name}
  • + *
+ * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getJavaProcessor() + * @model + * @generated + */ +public interface JavaProcessor extends AbstractValueProcessor { + /** + * Returns the value of the 'Class Name' attribute. + * + *

+ * If the meaning of the 'Class Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Class Name' attribute. + * @see #setClassName(String) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getJavaProcessor_ClassName() + * @model required="true" ordered="false" + * @generated + */ + String getClassName(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.JavaProcessor#getClassName Class Name}' attribute. + * + * + * + * @param value + * the new value of the 'Class Name' attribute. + * @see #getClassName() + * @generated + */ + void setClassName(String value); + +} // JavaProcessor diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/PropertylifecycleFactory.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/PropertylifecycleFactory.java new file mode 100755 index 00000000000..2ef95b8e206 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/PropertylifecycleFactory.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage + * @generated + */ +public interface PropertylifecycleFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * + * @generated + */ + PropertylifecycleFactory eINSTANCE = org.eclipse.papyrus.propertylifecycle.impl.PropertylifecycleFactoryImpl.init(); + + /** + * Returns a new object of class 'Strategy Set'. + * + * + * + * @return a new object of class 'Strategy Set'. + * @generated + */ + StrategySet createStrategySet(); + + /** + * Returns a new object of class 'Strategy Element'. + * + * + * + * @return a new object of class 'Strategy Element'. + * @generated + */ + StrategyElement createStrategyElement(); + + /** + * Returns a new object of class 'Element Container'. + * + * + * + * @return a new object of class 'Element Container'. + * @generated + */ + ElementContainer createElementContainer(); + + /** + * Returns a new object of class 'Element Property'. + * + * + * + * @return a new object of class 'Element Property'. + * @generated + */ + ElementProperty createElementProperty(); + + /** + * Returns a new object of class 'Java Processor'. + * + * + * + * @return a new object of class 'Java Processor'. + * @generated + */ + JavaProcessor createJavaProcessor(); + + /** + * Returns a new object of class 'Basic Trigger'. + * + * + * + * @return a new object of class 'Basic Trigger'. + * @generated + */ + BasicTrigger createBasicTrigger(); + + /** + * Returns the package supported by this factory. + * + * + * + * @return the package supported by this factory. + * @generated + */ + PropertylifecyclePackage getPropertylifecyclePackage(); + +} // PropertylifecycleFactory diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/PropertylifecyclePackage.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/PropertylifecyclePackage.java new file mode 100755 index 00000000000..948d9b9dfc3 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/PropertylifecyclePackage.java @@ -0,0 +1,1299 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory + * @model kind="package" + * @generated + */ +public interface PropertylifecyclePackage extends EPackage { + /** + * The package name. + * + * + * + * @generated + */ + String eNAME = "propertylifecycle"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * + * + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/papyrus/infra/propertylifecycle/1.0"; //$NON-NLS-1$ + + /** + * The package namespace name. + * + * + * + * @generated + */ + String eNS_PREFIX = "propertylifecycle"; //$NON-NLS-1$ + + /** + * The package content type ID. + * + * + * + * @generated + */ + String eCONTENT_TYPE = "org.eclipse.papyrus.infra.propertylifecycle"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * + * + * + * @generated + */ + PropertylifecyclePackage eINSTANCE = org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.StrategyTemplateImpl Strategy Template}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.StrategyTemplateImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getStrategyTemplate() + * @generated + */ + int STRATEGY_TEMPLATE = 0; + + /** + * The feature id for the 'Name' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_TEMPLATE__NAME = 0; + + /** + * The feature id for the 'Decription' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_TEMPLATE__DECRIPTION = 1; + + /** + * The feature id for the 'Id' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_TEMPLATE__ID = 2; + + /** + * The number of structural features of the 'Strategy Template' class. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_TEMPLATE_FEATURE_COUNT = 3; + + /** + * The number of operations of the 'Strategy Template' class. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_TEMPLATE_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.StrategySetImpl Strategy Set}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.StrategySetImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getStrategySet() + * @generated + */ + int STRATEGY_SET = 1; + + /** + * The feature id for the 'Name' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_SET__NAME = STRATEGY_TEMPLATE__NAME; + + /** + * The feature id for the 'Decription' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_SET__DECRIPTION = STRATEGY_TEMPLATE__DECRIPTION; + + /** + * The feature id for the 'Id' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_SET__ID = STRATEGY_TEMPLATE__ID; + + /** + * The feature id for the 'Strategies' containment reference list. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_SET__STRATEGIES = STRATEGY_TEMPLATE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Strategy Set' class. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_SET_FEATURE_COUNT = STRATEGY_TEMPLATE_FEATURE_COUNT + 1; + + /** + * The number of operations of the 'Strategy Set' class. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_SET_OPERATION_COUNT = STRATEGY_TEMPLATE_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.ElementTemplateImpl Element Template}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.ElementTemplateImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getElementTemplate() + * @generated + */ + int ELEMENT_TEMPLATE = 3; + + /** + * The feature id for the 'Base Type' attribute. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_TEMPLATE__BASE_TYPE = 0; + + /** + * The feature id for the 'Specialized Type' attribute. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_TEMPLATE__SPECIALIZED_TYPE = 1; + + /** + * The number of structural features of the 'Element Template' class. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_TEMPLATE_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Element Template' class. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_TEMPLATE_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl Strategy Element}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getStrategyElement() + * @generated + */ + int STRATEGY_ELEMENT = 2; + + /** + * The feature id for the 'Base Type' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT__BASE_TYPE = ELEMENT_TEMPLATE__BASE_TYPE; + + /** + * The feature id for the 'Specialized Type' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT__SPECIALIZED_TYPE = ELEMENT_TEMPLATE__SPECIALIZED_TYPE; + + /** + * The feature id for the 'Name' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT__NAME = ELEMENT_TEMPLATE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Decription' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT__DECRIPTION = ELEMENT_TEMPLATE_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Id' attribute. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT__ID = ELEMENT_TEMPLATE_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Element Containers' containment reference list. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT__ELEMENT_CONTAINERS = ELEMENT_TEMPLATE_FEATURE_COUNT + 3; + + /** + * The feature id for the 'Element Properties' containment reference list. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT__ELEMENT_PROPERTIES = ELEMENT_TEMPLATE_FEATURE_COUNT + 4; + + /** + * The number of structural features of the 'Strategy Element' class. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT_FEATURE_COUNT = ELEMENT_TEMPLATE_FEATURE_COUNT + 5; + + /** + * The number of operations of the 'Strategy Element' class. + * + * + * + * @generated + * @ordered + */ + int STRATEGY_ELEMENT_OPERATION_COUNT = ELEMENT_TEMPLATE_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.ElementContainerImpl Element Container}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.ElementContainerImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getElementContainer() + * @generated + */ + int ELEMENT_CONTAINER = 4; + + /** + * The feature id for the 'Base Type' attribute. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_CONTAINER__BASE_TYPE = ELEMENT_TEMPLATE__BASE_TYPE; + + /** + * The feature id for the 'Specialized Type' attribute. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_CONTAINER__SPECIALIZED_TYPE = ELEMENT_TEMPLATE__SPECIALIZED_TYPE; + + /** + * The feature id for the 'Containers Container' containment reference. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_CONTAINER__CONTAINERS_CONTAINER = ELEMENT_TEMPLATE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Element Container' class. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_CONTAINER_FEATURE_COUNT = ELEMENT_TEMPLATE_FEATURE_COUNT + 1; + + /** + * The number of operations of the 'Element Container' class. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_CONTAINER_OPERATION_COUNT = ELEMENT_TEMPLATE_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.ElementPropertyImpl Element Property}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.ElementPropertyImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getElementProperty() + * @generated + */ + int ELEMENT_PROPERTY = 5; + + /** + * The feature id for the 'Feature Label' attribute. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_PROPERTY__FEATURE_LABEL = 0; + + /** + * The feature id for the 'Priority' attribute. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_PROPERTY__PRIORITY = 1; + + /** + * The feature id for the 'Triggers' containment reference list. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_PROPERTY__TRIGGERS = 2; + + /** + * The feature id for the 'Value Processor' containment reference. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_PROPERTY__VALUE_PROCESSOR = 3; + + /** + * The number of structural features of the 'Element Property' class. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_PROPERTY_FEATURE_COUNT = 4; + + /** + * The number of operations of the 'Element Property' class. + * + * + * + * @generated + * @ordered + */ + int ELEMENT_PROPERTY_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.AbstractTriggerImpl Abstract Trigger}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.AbstractTriggerImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getAbstractTrigger() + * @generated + */ + int ABSTRACT_TRIGGER = 6; + + /** + * The number of structural features of the 'Abstract Trigger' class. + * + * + * + * @generated + * @ordered + */ + int ABSTRACT_TRIGGER_FEATURE_COUNT = 0; + + /** + * The number of operations of the 'Abstract Trigger' class. + * + * + * + * @generated + * @ordered + */ + int ABSTRACT_TRIGGER_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.AbstractValueProcessorImpl Abstract Value Processor}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.AbstractValueProcessorImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getAbstractValueProcessor() + * @generated + */ + int ABSTRACT_VALUE_PROCESSOR = 7; + + /** + * The number of structural features of the 'Abstract Value Processor' class. + * + * + * + * @generated + * @ordered + */ + int ABSTRACT_VALUE_PROCESSOR_FEATURE_COUNT = 0; + + /** + * The number of operations of the 'Abstract Value Processor' class. + * + * + * + * @generated + * @ordered + */ + int ABSTRACT_VALUE_PROCESSOR_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.JavaProcessorImpl Java Processor}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.JavaProcessorImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getJavaProcessor() + * @generated + */ + int JAVA_PROCESSOR = 8; + + /** + * The feature id for the 'Class Name' attribute. + * + * + * + * @generated + * @ordered + */ + int JAVA_PROCESSOR__CLASS_NAME = ABSTRACT_VALUE_PROCESSOR_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Java Processor' class. + * + * + * + * @generated + * @ordered + */ + int JAVA_PROCESSOR_FEATURE_COUNT = ABSTRACT_VALUE_PROCESSOR_FEATURE_COUNT + 1; + + /** + * The number of operations of the 'Java Processor' class. + * + * + * + * @generated + * @ordered + */ + int JAVA_PROCESSOR_OPERATION_COUNT = ABSTRACT_VALUE_PROCESSOR_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.propertylifecycle.impl.BasicTriggerImpl Basic Trigger}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.BasicTriggerImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getBasicTrigger() + * @generated + */ + int BASIC_TRIGGER = 9; + + /** + * The feature id for the 'On Create' attribute. + * + * + * + * @generated + * @ordered + */ + int BASIC_TRIGGER__ON_CREATE = ABSTRACT_TRIGGER_FEATURE_COUNT + 0; + + /** + * The feature id for the 'On Delete' attribute. + * + * + * + * @generated + * @ordered + */ + int BASIC_TRIGGER__ON_DELETE = ABSTRACT_TRIGGER_FEATURE_COUNT + 1; + + /** + * The feature id for the 'On Open' attribute. + * + * + * + * @generated + * @ordered + */ + int BASIC_TRIGGER__ON_OPEN = ABSTRACT_TRIGGER_FEATURE_COUNT + 2; + + /** + * The feature id for the 'On Move' attribute. + * + * + * + * @generated + * @ordered + */ + int BASIC_TRIGGER__ON_MOVE = ABSTRACT_TRIGGER_FEATURE_COUNT + 3; + + /** + * The number of structural features of the 'Basic Trigger' class. + * + * + * + * @generated + * @ordered + */ + int BASIC_TRIGGER_FEATURE_COUNT = ABSTRACT_TRIGGER_FEATURE_COUNT + 4; + + /** + * The number of operations of the 'Basic Trigger' class. + * + * + * + * @generated + * @ordered + */ + int BASIC_TRIGGER_OPERATION_COUNT = ABSTRACT_TRIGGER_OPERATION_COUNT + 0; + + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate Strategy Template}'. + * + * + * + * @return the meta object for class 'Strategy Template'. + * @see org.eclipse.papyrus.propertylifecycle.StrategyTemplate + * @generated + */ + EClass getStrategyTemplate(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getName Name}'. + * + * + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getName() + * @see #getStrategyTemplate() + * @generated + */ + EAttribute getStrategyTemplate_Name(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getDecription Decription}'. + * + * + * + * @return the meta object for the attribute 'Decription'. + * @see org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getDecription() + * @see #getStrategyTemplate() + * @generated + */ + EAttribute getStrategyTemplate_Decription(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getId Id}'. + * + * + * + * @return the meta object for the attribute 'Id'. + * @see org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getId() + * @see #getStrategyTemplate() + * @generated + */ + EAttribute getStrategyTemplate_Id(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.StrategySet Strategy Set}'. + * + * + * + * @return the meta object for class 'Strategy Set'. + * @see org.eclipse.papyrus.propertylifecycle.StrategySet + * @generated + */ + EClass getStrategySet(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.propertylifecycle.StrategySet#getStrategies Strategies}'. + * + * + * + * @return the meta object for the containment reference list 'Strategies'. + * @see org.eclipse.papyrus.propertylifecycle.StrategySet#getStrategies() + * @see #getStrategySet() + * @generated + */ + EReference getStrategySet_Strategies(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.StrategyElement Strategy Element}'. + * + * + * + * @return the meta object for class 'Strategy Element'. + * @see org.eclipse.papyrus.propertylifecycle.StrategyElement + * @generated + */ + EClass getStrategyElement(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.propertylifecycle.StrategyElement#getElementContainers Element Containers}'. + * + * + * + * @return the meta object for the containment reference list 'Element Containers'. + * @see org.eclipse.papyrus.propertylifecycle.StrategyElement#getElementContainers() + * @see #getStrategyElement() + * @generated + */ + EReference getStrategyElement_ElementContainers(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.propertylifecycle.StrategyElement#getElementProperties Element Properties}'. + * + * + * + * @return the meta object for the containment reference list 'Element Properties'. + * @see org.eclipse.papyrus.propertylifecycle.StrategyElement#getElementProperties() + * @see #getStrategyElement() + * @generated + */ + EReference getStrategyElement_ElementProperties(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.ElementTemplate Element Template}'. + * + * + * + * @return the meta object for class 'Element Template'. + * @see org.eclipse.papyrus.propertylifecycle.ElementTemplate + * @generated + */ + EClass getElementTemplate(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.ElementTemplate#getBaseType Base Type}'. + * + * + * + * @return the meta object for the attribute 'Base Type'. + * @see org.eclipse.papyrus.propertylifecycle.ElementTemplate#getBaseType() + * @see #getElementTemplate() + * @generated + */ + EAttribute getElementTemplate_BaseType(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.ElementTemplate#getSpecializedType Specialized Type}'. + * + * + * + * @return the meta object for the attribute 'Specialized Type'. + * @see org.eclipse.papyrus.propertylifecycle.ElementTemplate#getSpecializedType() + * @see #getElementTemplate() + * @generated + */ + EAttribute getElementTemplate_SpecializedType(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.ElementContainer Element Container}'. + * + * + * + * @return the meta object for class 'Element Container'. + * @see org.eclipse.papyrus.propertylifecycle.ElementContainer + * @generated + */ + EClass getElementContainer(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.papyrus.propertylifecycle.ElementContainer#getContainersContainer Containers Container}'. + * + * + * + * @return the meta object for the containment reference 'Containers Container'. + * @see org.eclipse.papyrus.propertylifecycle.ElementContainer#getContainersContainer() + * @see #getElementContainer() + * @generated + */ + EReference getElementContainer_ContainersContainer(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty Element Property}'. + * + * + * + * @return the meta object for class 'Element Property'. + * @see org.eclipse.papyrus.propertylifecycle.ElementProperty + * @generated + */ + EClass getElementProperty(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getFeatureLabel Feature Label}'. + * + * + * + * @return the meta object for the attribute 'Feature Label'. + * @see org.eclipse.papyrus.propertylifecycle.ElementProperty#getFeatureLabel() + * @see #getElementProperty() + * @generated + */ + EAttribute getElementProperty_FeatureLabel(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getPriority Priority}'. + * + * + * + * @return the meta object for the attribute 'Priority'. + * @see org.eclipse.papyrus.propertylifecycle.ElementProperty#getPriority() + * @see #getElementProperty() + * @generated + */ + EAttribute getElementProperty_Priority(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getTriggers Triggers}'. + * + * + * + * @return the meta object for the containment reference list 'Triggers'. + * @see org.eclipse.papyrus.propertylifecycle.ElementProperty#getTriggers() + * @see #getElementProperty() + * @generated + */ + EReference getElementProperty_Triggers(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty#getValueProcessor Value Processor}'. + * + * + * + * @return the meta object for the containment reference 'Value Processor'. + * @see org.eclipse.papyrus.propertylifecycle.ElementProperty#getValueProcessor() + * @see #getElementProperty() + * @generated + */ + EReference getElementProperty_ValueProcessor(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.AbstractTrigger Abstract Trigger}'. + * + * + * + * @return the meta object for class 'Abstract Trigger'. + * @see org.eclipse.papyrus.propertylifecycle.AbstractTrigger + * @generated + */ + EClass getAbstractTrigger(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor Abstract Value Processor}'. + * + * + * + * @return the meta object for class 'Abstract Value Processor'. + * @see org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor + * @generated + */ + EClass getAbstractValueProcessor(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.JavaProcessor Java Processor}'. + * + * + * + * @return the meta object for class 'Java Processor'. + * @see org.eclipse.papyrus.propertylifecycle.JavaProcessor + * @generated + */ + EClass getJavaProcessor(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.JavaProcessor#getClassName Class Name}'. + * + * + * + * @return the meta object for the attribute 'Class Name'. + * @see org.eclipse.papyrus.propertylifecycle.JavaProcessor#getClassName() + * @see #getJavaProcessor() + * @generated + */ + EAttribute getJavaProcessor_ClassName(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger Basic Trigger}'. + * + * + * + * @return the meta object for class 'Basic Trigger'. + * @see org.eclipse.papyrus.propertylifecycle.BasicTrigger + * @generated + */ + EClass getBasicTrigger(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnCreate On Create}'. + * + * + * + * @return the meta object for the attribute 'On Create'. + * @see org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnCreate() + * @see #getBasicTrigger() + * @generated + */ + EAttribute getBasicTrigger_OnCreate(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnDelete On Delete}'. + * + * + * + * @return the meta object for the attribute 'On Delete'. + * @see org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnDelete() + * @see #getBasicTrigger() + * @generated + */ + EAttribute getBasicTrigger_OnDelete(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnOpen On Open}'. + * + * + * + * @return the meta object for the attribute 'On Open'. + * @see org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnOpen() + * @see #getBasicTrigger() + * @generated + */ + EAttribute getBasicTrigger_OnOpen(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnMove On Move}'. + * + * + * + * @return the meta object for the attribute 'On Move'. + * @see org.eclipse.papyrus.propertylifecycle.BasicTrigger#isOnMove() + * @see #getBasicTrigger() + * @generated + */ + EAttribute getBasicTrigger_OnMove(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + PropertylifecycleFactory getPropertylifecycleFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.StrategyTemplateImpl Strategy Template}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.StrategyTemplateImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getStrategyTemplate() + * @generated + */ + EClass STRATEGY_TEMPLATE = eINSTANCE.getStrategyTemplate(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * + * @generated + */ + EAttribute STRATEGY_TEMPLATE__NAME = eINSTANCE.getStrategyTemplate_Name(); + + /** + * The meta object literal for the 'Decription' attribute feature. + * + * + * + * @generated + */ + EAttribute STRATEGY_TEMPLATE__DECRIPTION = eINSTANCE.getStrategyTemplate_Decription(); + + /** + * The meta object literal for the 'Id' attribute feature. + * + * + * + * @generated + */ + EAttribute STRATEGY_TEMPLATE__ID = eINSTANCE.getStrategyTemplate_Id(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.StrategySetImpl Strategy Set}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.StrategySetImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getStrategySet() + * @generated + */ + EClass STRATEGY_SET = eINSTANCE.getStrategySet(); + + /** + * The meta object literal for the 'Strategies' containment reference list feature. + * + * + * + * @generated + */ + EReference STRATEGY_SET__STRATEGIES = eINSTANCE.getStrategySet_Strategies(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl Strategy Element}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getStrategyElement() + * @generated + */ + EClass STRATEGY_ELEMENT = eINSTANCE.getStrategyElement(); + + /** + * The meta object literal for the 'Element Containers' containment reference list feature. + * + * + * + * @generated + */ + EReference STRATEGY_ELEMENT__ELEMENT_CONTAINERS = eINSTANCE.getStrategyElement_ElementContainers(); + + /** + * The meta object literal for the 'Element Properties' containment reference list feature. + * + * + * + * @generated + */ + EReference STRATEGY_ELEMENT__ELEMENT_PROPERTIES = eINSTANCE.getStrategyElement_ElementProperties(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.ElementTemplateImpl Element Template}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.ElementTemplateImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getElementTemplate() + * @generated + */ + EClass ELEMENT_TEMPLATE = eINSTANCE.getElementTemplate(); + + /** + * The meta object literal for the 'Base Type' attribute feature. + * + * + * + * @generated + */ + EAttribute ELEMENT_TEMPLATE__BASE_TYPE = eINSTANCE.getElementTemplate_BaseType(); + + /** + * The meta object literal for the 'Specialized Type' attribute feature. + * + * + * + * @generated + */ + EAttribute ELEMENT_TEMPLATE__SPECIALIZED_TYPE = eINSTANCE.getElementTemplate_SpecializedType(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.ElementContainerImpl Element Container}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.ElementContainerImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getElementContainer() + * @generated + */ + EClass ELEMENT_CONTAINER = eINSTANCE.getElementContainer(); + + /** + * The meta object literal for the 'Containers Container' containment reference feature. + * + * + * + * @generated + */ + EReference ELEMENT_CONTAINER__CONTAINERS_CONTAINER = eINSTANCE.getElementContainer_ContainersContainer(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.ElementPropertyImpl Element Property}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.ElementPropertyImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getElementProperty() + * @generated + */ + EClass ELEMENT_PROPERTY = eINSTANCE.getElementProperty(); + + /** + * The meta object literal for the 'Feature Label' attribute feature. + * + * + * + * @generated + */ + EAttribute ELEMENT_PROPERTY__FEATURE_LABEL = eINSTANCE.getElementProperty_FeatureLabel(); + + /** + * The meta object literal for the 'Priority' attribute feature. + * + * + * + * @generated + */ + EAttribute ELEMENT_PROPERTY__PRIORITY = eINSTANCE.getElementProperty_Priority(); + + /** + * The meta object literal for the 'Triggers' containment reference list feature. + * + * + * + * @generated + */ + EReference ELEMENT_PROPERTY__TRIGGERS = eINSTANCE.getElementProperty_Triggers(); + + /** + * The meta object literal for the 'Value Processor' containment reference feature. + * + * + * + * @generated + */ + EReference ELEMENT_PROPERTY__VALUE_PROCESSOR = eINSTANCE.getElementProperty_ValueProcessor(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.AbstractTriggerImpl Abstract Trigger}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.AbstractTriggerImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getAbstractTrigger() + * @generated + */ + EClass ABSTRACT_TRIGGER = eINSTANCE.getAbstractTrigger(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.AbstractValueProcessorImpl Abstract Value Processor}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.AbstractValueProcessorImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getAbstractValueProcessor() + * @generated + */ + EClass ABSTRACT_VALUE_PROCESSOR = eINSTANCE.getAbstractValueProcessor(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.JavaProcessorImpl Java Processor}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.JavaProcessorImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getJavaProcessor() + * @generated + */ + EClass JAVA_PROCESSOR = eINSTANCE.getJavaProcessor(); + + /** + * The meta object literal for the 'Class Name' attribute feature. + * + * + * + * @generated + */ + EAttribute JAVA_PROCESSOR__CLASS_NAME = eINSTANCE.getJavaProcessor_ClassName(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.propertylifecycle.impl.BasicTriggerImpl Basic Trigger}' class. + * + * + * + * @see org.eclipse.papyrus.propertylifecycle.impl.BasicTriggerImpl + * @see org.eclipse.papyrus.propertylifecycle.impl.PropertylifecyclePackageImpl#getBasicTrigger() + * @generated + */ + EClass BASIC_TRIGGER = eINSTANCE.getBasicTrigger(); + + /** + * The meta object literal for the 'On Create' attribute feature. + * + * + * + * @generated + */ + EAttribute BASIC_TRIGGER__ON_CREATE = eINSTANCE.getBasicTrigger_OnCreate(); + + /** + * The meta object literal for the 'On Delete' attribute feature. + * + * + * + * @generated + */ + EAttribute BASIC_TRIGGER__ON_DELETE = eINSTANCE.getBasicTrigger_OnDelete(); + + /** + * The meta object literal for the 'On Open' attribute feature. + * + * + * + * @generated + */ + EAttribute BASIC_TRIGGER__ON_OPEN = eINSTANCE.getBasicTrigger_OnOpen(); + + /** + * The meta object literal for the 'On Move' attribute feature. + * + * + * + * @generated + */ + EAttribute BASIC_TRIGGER__ON_MOVE = eINSTANCE.getBasicTrigger_OnMove(); + + } + +} // PropertylifecyclePackage diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategyElement.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategyElement.java new file mode 100755 index 00000000000..965e36e266a --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategyElement.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'Strategy Element'. + * + * + * + * The element affected by this strategy + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.StrategyElement#getElementContainers Element Containers}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.StrategyElement#getElementProperties Element Properties}
  • + *
+ * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategyElement() + * @model + * @generated + */ +public interface StrategyElement extends ElementTemplate, StrategyTemplate { + /** + * Returns the value of the 'Element Containers' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.propertylifecycle.ElementContainer}. + * + *

+ * If the meaning of the 'Element Containers' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Element Containers' containment reference list. + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategyElement_ElementContainers() + * @model containment="true" + * @generated + */ + EList getElementContainers(); + + /** + * Returns the value of the 'Element Properties' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.propertylifecycle.ElementProperty}. + * + *

+ * If the meaning of the 'Element Properties' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Element Properties' containment reference list. + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategyElement_ElementProperties() + * @model containment="true" required="true" + * @generated + */ + EList getElementProperties(); + +} // StrategyElement diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategySet.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategySet.java new file mode 100755 index 00000000000..7bd1ed22b0c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategySet.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'Strategy Set'. + * + * + * + * Root set containing the defined strategies + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.StrategySet#getStrategies Strategies}
  • + *
+ * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategySet() + * @model + * @generated + */ +public interface StrategySet extends StrategyTemplate { + /** + * Returns the value of the 'Strategies' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.propertylifecycle.StrategyElement}. + * + *

+ * If the meaning of the 'Strategies' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Strategies' containment reference list. + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategySet_Strategies() + * @model containment="true" required="true" + * @generated + */ + EList getStrategies(); + +} // StrategySet diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategyTemplate.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategyTemplate.java new file mode 100755 index 00000000000..ddebf5f0d30 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/StrategyTemplate.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Strategy Template'. + * + * + * + * Contains the standard informations needed to identify the strategy sets + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getName Name}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getDecription Decription}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getId Id}
  • + *
+ * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategyTemplate() + * @model abstract="true" + * @generated + */ +public interface StrategyTemplate extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategyTemplate_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getName Name}' attribute. + * + * + * + * @param value + * the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Decription' attribute. + * + *

+ * If the meaning of the 'Decription' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Decription' attribute. + * @see #setDecription(String) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategyTemplate_Decription() + * @model + * @generated + */ + String getDecription(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getDecription Decription}' attribute. + * + * + * + * @param value + * the new value of the 'Decription' attribute. + * @see #getDecription() + * @generated + */ + void setDecription(String value); + + /** + * Returns the value of the 'Id' attribute. + * + *

+ * If the meaning of the 'Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * @return the value of the 'Id' attribute. + * @see #setId(String) + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#getStrategyTemplate_Id() + * @model required="true" ordered="false" + * @generated + */ + String getId(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate#getId Id}' attribute. + * + * + * + * @param value + * the new value of the 'Id' attribute. + * @see #getId() + * @generated + */ + void setId(String value); + +} // StrategyTemplate diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/AbstractTriggerImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/AbstractTriggerImpl.java new file mode 100755 index 00000000000..696eefcd0c3 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/AbstractTriggerImpl.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.papyrus.propertylifecycle.AbstractTrigger; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * + * An implementation of the model object 'Abstract Trigger'. + * + * + * @generated + */ +public abstract class AbstractTriggerImpl extends MinimalEObjectImpl.Container implements AbstractTrigger { + /** + * + * + * + * @generated + */ + protected AbstractTriggerImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.ABSTRACT_TRIGGER; + } + +} // AbstractTriggerImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/AbstractValueProcessorImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/AbstractValueProcessorImpl.java new file mode 100755 index 00000000000..43fceb033ca --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/AbstractValueProcessorImpl.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * + * An implementation of the model object 'Abstract Value Processor'. + * + * + * @generated + */ +public abstract class AbstractValueProcessorImpl extends MinimalEObjectImpl.Container implements AbstractValueProcessor { + /** + * + * + * + * @generated + */ + protected AbstractValueProcessorImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.ABSTRACT_VALUE_PROCESSOR; + } + +} // AbstractValueProcessorImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/BasicTriggerImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/BasicTriggerImpl.java new file mode 100755 index 00000000000..d1a69ba6f1b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/BasicTriggerImpl.java @@ -0,0 +1,370 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.papyrus.propertylifecycle.BasicTrigger; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * + * An implementation of the model object 'Basic Trigger'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.BasicTriggerImpl#isOnCreate On Create}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.BasicTriggerImpl#isOnDelete On Delete}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.BasicTriggerImpl#isOnOpen On Open}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.BasicTriggerImpl#isOnMove On Move}
  • + *
+ * + * @generated + */ +public class BasicTriggerImpl extends AbstractTriggerImpl implements BasicTrigger { + /** + * The default value of the '{@link #isOnCreate() On Create}' attribute. + * + * + * + * @see #isOnCreate() + * @generated + * @ordered + */ + protected static final boolean ON_CREATE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isOnCreate() On Create}' attribute. + * + * + * + * @see #isOnCreate() + * @generated + * @ordered + */ + protected boolean onCreate = ON_CREATE_EDEFAULT; + + /** + * The default value of the '{@link #isOnDelete() On Delete}' attribute. + * + * + * + * @see #isOnDelete() + * @generated + * @ordered + */ + protected static final boolean ON_DELETE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isOnDelete() On Delete}' attribute. + * + * + * + * @see #isOnDelete() + * @generated + * @ordered + */ + protected boolean onDelete = ON_DELETE_EDEFAULT; + + /** + * The default value of the '{@link #isOnOpen() On Open}' attribute. + * + * + * + * @see #isOnOpen() + * @generated + * @ordered + */ + protected static final boolean ON_OPEN_EDEFAULT = false; + + /** + * The cached value of the '{@link #isOnOpen() On Open}' attribute. + * + * + * + * @see #isOnOpen() + * @generated + * @ordered + */ + protected boolean onOpen = ON_OPEN_EDEFAULT; + + /** + * The default value of the '{@link #isOnMove() On Move}' attribute. + * + * + * + * @see #isOnMove() + * @generated + * @ordered + */ + protected static final boolean ON_MOVE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isOnMove() On Move}' attribute. + * + * + * + * @see #isOnMove() + * @generated + * @ordered + */ + protected boolean onMove = ON_MOVE_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected BasicTriggerImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.BASIC_TRIGGER; + } + + /** + * + * + * + * @generated + */ + @Override + public boolean isOnCreate() { + return onCreate; + } + + /** + * + * + * + * @generated + */ + @Override + public void setOnCreate(boolean newOnCreate) { + boolean oldOnCreate = onCreate; + onCreate = newOnCreate; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.BASIC_TRIGGER__ON_CREATE, oldOnCreate, onCreate)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public boolean isOnDelete() { + return onDelete; + } + + /** + * + * + * + * @generated + */ + @Override + public void setOnDelete(boolean newOnDelete) { + boolean oldOnDelete = onDelete; + onDelete = newOnDelete; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.BASIC_TRIGGER__ON_DELETE, oldOnDelete, onDelete)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public boolean isOnOpen() { + return onOpen; + } + + /** + * + * + * + * @generated + */ + @Override + public void setOnOpen(boolean newOnOpen) { + boolean oldOnOpen = onOpen; + onOpen = newOnOpen; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.BASIC_TRIGGER__ON_OPEN, oldOnOpen, onOpen)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public boolean isOnMove() { + return onMove; + } + + /** + * + * + * + * @generated + */ + @Override + public void setOnMove(boolean newOnMove) { + boolean oldOnMove = onMove; + onMove = newOnMove; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.BASIC_TRIGGER__ON_MOVE, oldOnMove, onMove)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PropertylifecyclePackage.BASIC_TRIGGER__ON_CREATE: + return isOnCreate(); + case PropertylifecyclePackage.BASIC_TRIGGER__ON_DELETE: + return isOnDelete(); + case PropertylifecyclePackage.BASIC_TRIGGER__ON_OPEN: + return isOnOpen(); + case PropertylifecyclePackage.BASIC_TRIGGER__ON_MOVE: + return isOnMove(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PropertylifecyclePackage.BASIC_TRIGGER__ON_CREATE: + setOnCreate((Boolean) newValue); + return; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_DELETE: + setOnDelete((Boolean) newValue); + return; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_OPEN: + setOnOpen((Boolean) newValue); + return; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_MOVE: + setOnMove((Boolean) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.BASIC_TRIGGER__ON_CREATE: + setOnCreate(ON_CREATE_EDEFAULT); + return; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_DELETE: + setOnDelete(ON_DELETE_EDEFAULT); + return; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_OPEN: + setOnOpen(ON_OPEN_EDEFAULT); + return; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_MOVE: + setOnMove(ON_MOVE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.BASIC_TRIGGER__ON_CREATE: + return onCreate != ON_CREATE_EDEFAULT; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_DELETE: + return onDelete != ON_DELETE_EDEFAULT; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_OPEN: + return onOpen != ON_OPEN_EDEFAULT; + case PropertylifecyclePackage.BASIC_TRIGGER__ON_MOVE: + return onMove != ON_MOVE_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (onCreate: "); //$NON-NLS-1$ + result.append(onCreate); + result.append(", onDelete: "); //$NON-NLS-1$ + result.append(onDelete); + result.append(", onOpen: "); //$NON-NLS-1$ + result.append(onOpen); + result.append(", onMove: "); //$NON-NLS-1$ + result.append(onMove); + result.append(')'); + return result.toString(); + } + +} // BasicTriggerImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementContainerImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementContainerImpl.java new file mode 100755 index 00000000000..4419f253efc --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementContainerImpl.java @@ -0,0 +1,204 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.papyrus.propertylifecycle.ElementContainer; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * + * An implementation of the model object 'Element Container'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.ElementContainerImpl#getContainersContainer Containers Container}
  • + *
+ * + * @generated + */ +public class ElementContainerImpl extends ElementTemplateImpl implements ElementContainer { + /** + * The cached value of the '{@link #getContainersContainer() Containers Container}' containment reference. + * + * + * + * @see #getContainersContainer() + * @generated + * @ordered + */ + protected ElementContainer containersContainer; + + /** + * + * + * + * @generated + */ + protected ElementContainerImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.ELEMENT_CONTAINER; + } + + /** + * + * + * + * @generated + */ + @Override + public ElementContainer getContainersContainer() { + return containersContainer; + } + + /** + * + * + * + * @generated + */ + public NotificationChain basicSetContainersContainer(ElementContainer newContainersContainer, NotificationChain msgs) { + ElementContainer oldContainersContainer = containersContainer; + containersContainer = newContainersContainer; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER, oldContainersContainer, newContainersContainer); + if (msgs == null) { + msgs = notification; + } else { + msgs.add(notification); + } + } + return msgs; + } + + /** + * + * + * + * @generated + */ + @Override + public void setContainersContainer(ElementContainer newContainersContainer) { + if (newContainersContainer != containersContainer) { + NotificationChain msgs = null; + if (containersContainer != null) { + msgs = ((InternalEObject) containersContainer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER, null, msgs); + } + if (newContainersContainer != null) { + msgs = ((InternalEObject) newContainersContainer).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER, null, msgs); + } + msgs = basicSetContainersContainer(newContainersContainer, msgs); + if (msgs != null) { + msgs.dispatch(); + } + } else if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER, newContainersContainer, newContainersContainer)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER: + return basicSetContainersContainer(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER: + return getContainersContainer(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER: + setContainersContainer((ElementContainer) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER: + setContainersContainer((ElementContainer) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_CONTAINER__CONTAINERS_CONTAINER: + return containersContainer != null; + } + return super.eIsSet(featureID); + } + +} // ElementContainerImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementPropertyImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementPropertyImpl.java new file mode 100755 index 00000000000..287a9a17fc1 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementPropertyImpl.java @@ -0,0 +1,393 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.propertylifecycle.AbstractTrigger; +import org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * + * An implementation of the model object 'Element Property'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.ElementPropertyImpl#getFeatureLabel Feature Label}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.ElementPropertyImpl#getPriority Priority}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.ElementPropertyImpl#getTriggers Triggers}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.ElementPropertyImpl#getValueProcessor Value Processor}
  • + *
+ * + * @generated + */ +public class ElementPropertyImpl extends MinimalEObjectImpl.Container implements ElementProperty { + /** + * The default value of the '{@link #getFeatureLabel() Feature Label}' attribute. + * + * + * + * @see #getFeatureLabel() + * @generated + * @ordered + */ + protected static final String FEATURE_LABEL_EDEFAULT = null; + + /** + * The cached value of the '{@link #getFeatureLabel() Feature Label}' attribute. + * + * + * + * @see #getFeatureLabel() + * @generated + * @ordered + */ + protected String featureLabel = FEATURE_LABEL_EDEFAULT; + + /** + * The default value of the '{@link #getPriority() Priority}' attribute. + * + * + * + * @see #getPriority() + * @generated + * @ordered + */ + protected static final Integer PRIORITY_EDEFAULT = new Integer(0); + + /** + * The cached value of the '{@link #getPriority() Priority}' attribute. + * + * + * + * @see #getPriority() + * @generated + * @ordered + */ + protected Integer priority = PRIORITY_EDEFAULT; + + /** + * The cached value of the '{@link #getTriggers() Triggers}' containment reference list. + * + * + * + * @see #getTriggers() + * @generated + * @ordered + */ + protected EList triggers; + + /** + * The cached value of the '{@link #getValueProcessor() Value Processor}' containment reference. + * + * + * + * @see #getValueProcessor() + * @generated + * @ordered + */ + protected AbstractValueProcessor valueProcessor; + + /** + * + * + * + * @generated + */ + protected ElementPropertyImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.ELEMENT_PROPERTY; + } + + /** + * + * + * + * @generated + */ + @Override + public String getFeatureLabel() { + return featureLabel; + } + + /** + * + * + * + * @generated + */ + @Override + public void setFeatureLabel(String newFeatureLabel) { + String oldFeatureLabel = featureLabel; + featureLabel = newFeatureLabel; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.ELEMENT_PROPERTY__FEATURE_LABEL, oldFeatureLabel, featureLabel)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Integer getPriority() { + return priority; + } + + /** + * + * + * + * @generated + */ + @Override + public void setPriority(Integer newPriority) { + Integer oldPriority = priority; + priority = newPriority; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.ELEMENT_PROPERTY__PRIORITY, oldPriority, priority)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public EList getTriggers() { + if (triggers == null) { + triggers = new EObjectContainmentEList(AbstractTrigger.class, this, PropertylifecyclePackage.ELEMENT_PROPERTY__TRIGGERS); + } + return triggers; + } + + /** + * + * + * + * @generated + */ + @Override + public AbstractValueProcessor getValueProcessor() { + return valueProcessor; + } + + /** + * + * + * + * @generated + */ + public NotificationChain basicSetValueProcessor(AbstractValueProcessor newValueProcessor, NotificationChain msgs) { + AbstractValueProcessor oldValueProcessor = valueProcessor; + valueProcessor = newValueProcessor; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR, oldValueProcessor, newValueProcessor); + if (msgs == null) { + msgs = notification; + } else { + msgs.add(notification); + } + } + return msgs; + } + + /** + * + * + * + * @generated + */ + @Override + public void setValueProcessor(AbstractValueProcessor newValueProcessor) { + if (newValueProcessor != valueProcessor) { + NotificationChain msgs = null; + if (valueProcessor != null) { + msgs = ((InternalEObject) valueProcessor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR, null, msgs); + } + if (newValueProcessor != null) { + msgs = ((InternalEObject) newValueProcessor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR, null, msgs); + } + msgs = basicSetValueProcessor(newValueProcessor, msgs); + if (msgs != null) { + msgs.dispatch(); + } + } else if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR, newValueProcessor, newValueProcessor)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_PROPERTY__TRIGGERS: + return ((InternalEList) getTriggers()).basicRemove(otherEnd, msgs); + case PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR: + return basicSetValueProcessor(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_PROPERTY__FEATURE_LABEL: + return getFeatureLabel(); + case PropertylifecyclePackage.ELEMENT_PROPERTY__PRIORITY: + return getPriority(); + case PropertylifecyclePackage.ELEMENT_PROPERTY__TRIGGERS: + return getTriggers(); + case PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR: + return getValueProcessor(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_PROPERTY__FEATURE_LABEL: + setFeatureLabel((String) newValue); + return; + case PropertylifecyclePackage.ELEMENT_PROPERTY__PRIORITY: + setPriority((Integer) newValue); + return; + case PropertylifecyclePackage.ELEMENT_PROPERTY__TRIGGERS: + getTriggers().clear(); + getTriggers().addAll((Collection) newValue); + return; + case PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR: + setValueProcessor((AbstractValueProcessor) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_PROPERTY__FEATURE_LABEL: + setFeatureLabel(FEATURE_LABEL_EDEFAULT); + return; + case PropertylifecyclePackage.ELEMENT_PROPERTY__PRIORITY: + setPriority(PRIORITY_EDEFAULT); + return; + case PropertylifecyclePackage.ELEMENT_PROPERTY__TRIGGERS: + getTriggers().clear(); + return; + case PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR: + setValueProcessor((AbstractValueProcessor) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_PROPERTY__FEATURE_LABEL: + return FEATURE_LABEL_EDEFAULT == null ? featureLabel != null : !FEATURE_LABEL_EDEFAULT.equals(featureLabel); + case PropertylifecyclePackage.ELEMENT_PROPERTY__PRIORITY: + return PRIORITY_EDEFAULT == null ? priority != null : !PRIORITY_EDEFAULT.equals(priority); + case PropertylifecyclePackage.ELEMENT_PROPERTY__TRIGGERS: + return triggers != null && !triggers.isEmpty(); + case PropertylifecyclePackage.ELEMENT_PROPERTY__VALUE_PROCESSOR: + return valueProcessor != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (featureLabel: "); //$NON-NLS-1$ + result.append(featureLabel); + result.append(", priority: "); //$NON-NLS-1$ + result.append(priority); + result.append(')'); + return result.toString(); + } + +} // ElementPropertyImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementTemplateImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementTemplateImpl.java new file mode 100755 index 00000000000..cd1dc19cec5 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/ElementTemplateImpl.java @@ -0,0 +1,249 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.papyrus.propertylifecycle.ElementTemplate; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * + * An implementation of the model object 'Element Template'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.ElementTemplateImpl#getBaseType Base Type}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.ElementTemplateImpl#getSpecializedType Specialized Type}
  • + *
+ * + * @generated + */ +public abstract class ElementTemplateImpl extends MinimalEObjectImpl.Container implements ElementTemplate { + /** + * The default value of the '{@link #getBaseType() Base Type}' attribute. + * + * + * + * @see #getBaseType() + * @generated + * @ordered + */ + protected static final String BASE_TYPE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getBaseType() Base Type}' attribute. + * + * + * + * @see #getBaseType() + * @generated + * @ordered + */ + protected String baseType = BASE_TYPE_EDEFAULT; + + /** + * The default value of the '{@link #getSpecializedType() Specialized Type}' attribute. + * + * + * + * @see #getSpecializedType() + * @generated + * @ordered + */ + protected static final String SPECIALIZED_TYPE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSpecializedType() Specialized Type}' attribute. + * + * + * + * @see #getSpecializedType() + * @generated + * @ordered + */ + protected String specializedType = SPECIALIZED_TYPE_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected ElementTemplateImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.ELEMENT_TEMPLATE; + } + + /** + * + * + * + * @generated + */ + @Override + public String getBaseType() { + return baseType; + } + + /** + * + * + * + * @generated + */ + @Override + public void setBaseType(String newBaseType) { + String oldBaseType = baseType; + baseType = newBaseType; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.ELEMENT_TEMPLATE__BASE_TYPE, oldBaseType, baseType)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public String getSpecializedType() { + return specializedType; + } + + /** + * + * + * + * @generated + */ + @Override + public void setSpecializedType(String newSpecializedType) { + String oldSpecializedType = specializedType; + specializedType = newSpecializedType; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.ELEMENT_TEMPLATE__SPECIALIZED_TYPE, oldSpecializedType, specializedType)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_TEMPLATE__BASE_TYPE: + return getBaseType(); + case PropertylifecyclePackage.ELEMENT_TEMPLATE__SPECIALIZED_TYPE: + return getSpecializedType(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_TEMPLATE__BASE_TYPE: + setBaseType((String) newValue); + return; + case PropertylifecyclePackage.ELEMENT_TEMPLATE__SPECIALIZED_TYPE: + setSpecializedType((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_TEMPLATE__BASE_TYPE: + setBaseType(BASE_TYPE_EDEFAULT); + return; + case PropertylifecyclePackage.ELEMENT_TEMPLATE__SPECIALIZED_TYPE: + setSpecializedType(SPECIALIZED_TYPE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.ELEMENT_TEMPLATE__BASE_TYPE: + return BASE_TYPE_EDEFAULT == null ? baseType != null : !BASE_TYPE_EDEFAULT.equals(baseType); + case PropertylifecyclePackage.ELEMENT_TEMPLATE__SPECIALIZED_TYPE: + return SPECIALIZED_TYPE_EDEFAULT == null ? specializedType != null : !SPECIALIZED_TYPE_EDEFAULT.equals(specializedType); + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (baseType: "); //$NON-NLS-1$ + result.append(baseType); + result.append(", specializedType: "); //$NON-NLS-1$ + result.append(specializedType); + result.append(')'); + return result.toString(); + } + +} // ElementTemplateImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/JavaProcessorImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/JavaProcessorImpl.java new file mode 100755 index 00000000000..0f9ed8726dd --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/JavaProcessorImpl.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.papyrus.propertylifecycle.JavaProcessor; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; + +/** + * + * An implementation of the model object 'Java Processor'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.JavaProcessorImpl#getClassName Class Name}
  • + *
+ * + * @generated + */ +public class JavaProcessorImpl extends AbstractValueProcessorImpl implements JavaProcessor { + /** + * The default value of the '{@link #getClassName() Class Name}' attribute. + * + * + * + * @see #getClassName() + * @generated + * @ordered + */ + protected static final String CLASS_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getClassName() Class Name}' attribute. + * + * + * + * @see #getClassName() + * @generated + * @ordered + */ + protected String className = CLASS_NAME_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected JavaProcessorImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.JAVA_PROCESSOR; + } + + /** + * + * + * + * @generated + */ + @Override + public String getClassName() { + return className; + } + + /** + * + * + * + * @generated + */ + @Override + public void setClassName(String newClassName) { + String oldClassName = className; + className = newClassName; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.JAVA_PROCESSOR__CLASS_NAME, oldClassName, className)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PropertylifecyclePackage.JAVA_PROCESSOR__CLASS_NAME: + return getClassName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PropertylifecyclePackage.JAVA_PROCESSOR__CLASS_NAME: + setClassName((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.JAVA_PROCESSOR__CLASS_NAME: + setClassName(CLASS_NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.JAVA_PROCESSOR__CLASS_NAME: + return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className); + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (className: "); //$NON-NLS-1$ + result.append(className); + result.append(')'); + return result.toString(); + } + +} // JavaProcessorImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/PropertylifecycleFactoryImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/PropertylifecycleFactoryImpl.java new file mode 100755 index 00000000000..d2da6a58228 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/PropertylifecycleFactoryImpl.java @@ -0,0 +1,183 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.papyrus.propertylifecycle.*; + +/** + * + * An implementation of the model Factory. + * + * + * @generated + */ +public class PropertylifecycleFactoryImpl extends EFactoryImpl implements PropertylifecycleFactory { + /** + * Creates the default factory implementation. + * + * + * + * @generated + */ + public static PropertylifecycleFactory init() { + try { + PropertylifecycleFactory thePropertylifecycleFactory = (PropertylifecycleFactory) EPackage.Registry.INSTANCE.getEFactory(PropertylifecyclePackage.eNS_URI); + if (thePropertylifecycleFactory != null) { + return thePropertylifecycleFactory; + } + } catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new PropertylifecycleFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * + * @generated + */ + public PropertylifecycleFactoryImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case PropertylifecyclePackage.STRATEGY_SET: + return createStrategySet(); + case PropertylifecyclePackage.STRATEGY_ELEMENT: + return createStrategyElement(); + case PropertylifecyclePackage.ELEMENT_CONTAINER: + return createElementContainer(); + case PropertylifecyclePackage.ELEMENT_PROPERTY: + return createElementProperty(); + case PropertylifecyclePackage.JAVA_PROCESSOR: + return createJavaProcessor(); + case PropertylifecyclePackage.BASIC_TRIGGER: + return createBasicTrigger(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * + * + * + * @generated + */ + @Override + public StrategySet createStrategySet() { + StrategySetImpl strategySet = new StrategySetImpl(); + return strategySet; + } + + /** + * + * + * + * @generated + */ + @Override + public StrategyElement createStrategyElement() { + StrategyElementImpl strategyElement = new StrategyElementImpl(); + return strategyElement; + } + + /** + * + * + * + * @generated + */ + @Override + public ElementContainer createElementContainer() { + ElementContainerImpl elementContainer = new ElementContainerImpl(); + return elementContainer; + } + + /** + * + * + * + * @generated + */ + @Override + public ElementProperty createElementProperty() { + ElementPropertyImpl elementProperty = new ElementPropertyImpl(); + return elementProperty; + } + + /** + * + * + * + * @generated + */ + @Override + public JavaProcessor createJavaProcessor() { + JavaProcessorImpl javaProcessor = new JavaProcessorImpl(); + return javaProcessor; + } + + /** + * + * + * + * @generated + */ + @Override + public BasicTrigger createBasicTrigger() { + BasicTriggerImpl basicTrigger = new BasicTriggerImpl(); + return basicTrigger; + } + + /** + * + * + * + * @generated + */ + @Override + public PropertylifecyclePackage getPropertylifecyclePackage() { + return (PropertylifecyclePackage) getEPackage(); + } + + /** + * + * + * + * @deprecated + * @generated + */ + @Deprecated + public static PropertylifecyclePackage getPackage() { + return PropertylifecyclePackage.eINSTANCE; + } + +} // PropertylifecycleFactoryImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/PropertylifecyclePackageImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/PropertylifecyclePackageImpl.java new file mode 100755 index 00000000000..7fab87a1968 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/PropertylifecyclePackageImpl.java @@ -0,0 +1,659 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.papyrus.propertylifecycle.AbstractTrigger; +import org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor; +import org.eclipse.papyrus.propertylifecycle.BasicTrigger; +import org.eclipse.papyrus.propertylifecycle.ElementContainer; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.ElementTemplate; +import org.eclipse.papyrus.propertylifecycle.JavaProcessor; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.StrategyTemplate; + +/** + * + * An implementation of the model Package. + * + * + * @generated + */ +public class PropertylifecyclePackageImpl extends EPackageImpl implements PropertylifecyclePackage { + /** + * + * + * + * @generated + */ + private EClass strategyTemplateEClass = null; + + /** + * + * + * + * @generated + */ + private EClass strategySetEClass = null; + + /** + * + * + * + * @generated + */ + private EClass strategyElementEClass = null; + + /** + * + * + * + * @generated + */ + private EClass elementTemplateEClass = null; + + /** + * + * + * + * @generated + */ + private EClass elementContainerEClass = null; + + /** + * + * + * + * @generated + */ + private EClass elementPropertyEClass = null; + + /** + * + * + * + * @generated + */ + private EClass abstractTriggerEClass = null; + + /** + * + * + * + * @generated + */ + private EClass abstractValueProcessorEClass = null; + + /** + * + * + * + * @generated + */ + private EClass javaProcessorEClass = null; + + /** + * + * + * + * @generated + */ + private EClass basicTriggerEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

+ * 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. + * + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage#eNS_URI + * @see #init() + * @generated + */ + private PropertylifecyclePackageImpl() { + super(eNS_URI, PropertylifecycleFactory.eINSTANCE); + } + + /** + * + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

+ * This method is used to initialize {@link PropertylifecyclePackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static PropertylifecyclePackage init() { + if (isInited) { + return (PropertylifecyclePackage) EPackage.Registry.INSTANCE.getEPackage(PropertylifecyclePackage.eNS_URI); + } + + // Obtain or create and register package + PropertylifecyclePackageImpl thePropertylifecyclePackage = (PropertylifecyclePackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PropertylifecyclePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PropertylifecyclePackageImpl()); + + isInited = true; + + // Create package meta-data objects + thePropertylifecyclePackage.createPackageContents(); + + // Initialize created meta-data + thePropertylifecyclePackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thePropertylifecyclePackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(PropertylifecyclePackage.eNS_URI, thePropertylifecyclePackage); + return thePropertylifecyclePackage; + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getStrategyTemplate() { + return strategyTemplateEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getStrategyTemplate_Name() { + return (EAttribute) strategyTemplateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getStrategyTemplate_Decription() { + return (EAttribute) strategyTemplateEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getStrategyTemplate_Id() { + return (EAttribute) strategyTemplateEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getStrategySet() { + return strategySetEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getStrategySet_Strategies() { + return (EReference) strategySetEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getStrategyElement() { + return strategyElementEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getStrategyElement_ElementContainers() { + return (EReference) strategyElementEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getStrategyElement_ElementProperties() { + return (EReference) strategyElementEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getElementTemplate() { + return elementTemplateEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getElementTemplate_BaseType() { + return (EAttribute) elementTemplateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getElementTemplate_SpecializedType() { + return (EAttribute) elementTemplateEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getElementContainer() { + return elementContainerEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getElementContainer_ContainersContainer() { + return (EReference) elementContainerEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getElementProperty() { + return elementPropertyEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getElementProperty_FeatureLabel() { + return (EAttribute) elementPropertyEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getElementProperty_Priority() { + return (EAttribute) elementPropertyEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getElementProperty_Triggers() { + return (EReference) elementPropertyEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * + * @generated + */ + @Override + public EReference getElementProperty_ValueProcessor() { + return (EReference) elementPropertyEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getAbstractTrigger() { + return abstractTriggerEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getAbstractValueProcessor() { + return abstractValueProcessorEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getJavaProcessor() { + return javaProcessorEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getJavaProcessor_ClassName() { + return (EAttribute) javaProcessorEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EClass getBasicTrigger() { + return basicTriggerEClass; + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getBasicTrigger_OnCreate() { + return (EAttribute) basicTriggerEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getBasicTrigger_OnDelete() { + return (EAttribute) basicTriggerEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getBasicTrigger_OnOpen() { + return (EAttribute) basicTriggerEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * + * @generated + */ + @Override + public EAttribute getBasicTrigger_OnMove() { + return (EAttribute) basicTriggerEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * + * @generated + */ + @Override + public PropertylifecycleFactory getPropertylifecycleFactory() { + return (PropertylifecycleFactory) getEFactoryInstance(); + } + + /** + * + * + * + * @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. + * + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) { + return; + } + isCreated = true; + + // Create classes and their features + strategyTemplateEClass = createEClass(STRATEGY_TEMPLATE); + createEAttribute(strategyTemplateEClass, STRATEGY_TEMPLATE__NAME); + createEAttribute(strategyTemplateEClass, STRATEGY_TEMPLATE__DECRIPTION); + createEAttribute(strategyTemplateEClass, STRATEGY_TEMPLATE__ID); + + strategySetEClass = createEClass(STRATEGY_SET); + createEReference(strategySetEClass, STRATEGY_SET__STRATEGIES); + + strategyElementEClass = createEClass(STRATEGY_ELEMENT); + createEReference(strategyElementEClass, STRATEGY_ELEMENT__ELEMENT_CONTAINERS); + createEReference(strategyElementEClass, STRATEGY_ELEMENT__ELEMENT_PROPERTIES); + + elementTemplateEClass = createEClass(ELEMENT_TEMPLATE); + createEAttribute(elementTemplateEClass, ELEMENT_TEMPLATE__BASE_TYPE); + createEAttribute(elementTemplateEClass, ELEMENT_TEMPLATE__SPECIALIZED_TYPE); + + elementContainerEClass = createEClass(ELEMENT_CONTAINER); + createEReference(elementContainerEClass, ELEMENT_CONTAINER__CONTAINERS_CONTAINER); + + elementPropertyEClass = createEClass(ELEMENT_PROPERTY); + createEAttribute(elementPropertyEClass, ELEMENT_PROPERTY__FEATURE_LABEL); + createEAttribute(elementPropertyEClass, ELEMENT_PROPERTY__PRIORITY); + createEReference(elementPropertyEClass, ELEMENT_PROPERTY__TRIGGERS); + createEReference(elementPropertyEClass, ELEMENT_PROPERTY__VALUE_PROCESSOR); + + abstractTriggerEClass = createEClass(ABSTRACT_TRIGGER); + + abstractValueProcessorEClass = createEClass(ABSTRACT_VALUE_PROCESSOR); + + javaProcessorEClass = createEClass(JAVA_PROCESSOR); + createEAttribute(javaProcessorEClass, JAVA_PROCESSOR__CLASS_NAME); + + basicTriggerEClass = createEClass(BASIC_TRIGGER); + createEAttribute(basicTriggerEClass, BASIC_TRIGGER__ON_CREATE); + createEAttribute(basicTriggerEClass, BASIC_TRIGGER__ON_DELETE); + createEAttribute(basicTriggerEClass, BASIC_TRIGGER__ON_OPEN); + createEAttribute(basicTriggerEClass, BASIC_TRIGGER__ON_MOVE); + } + + /** + * + * + * + * @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. + * + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) { + return; + } + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + strategySetEClass.getESuperTypes().add(this.getStrategyTemplate()); + strategyElementEClass.getESuperTypes().add(this.getElementTemplate()); + strategyElementEClass.getESuperTypes().add(this.getStrategyTemplate()); + elementContainerEClass.getESuperTypes().add(this.getElementTemplate()); + javaProcessorEClass.getESuperTypes().add(this.getAbstractValueProcessor()); + basicTriggerEClass.getESuperTypes().add(this.getAbstractTrigger()); + + // Initialize classes, features, and operations; add parameters + initEClass(strategyTemplateEClass, StrategyTemplate.class, "StrategyTemplate", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getStrategyTemplate_Name(), ecorePackage.getEString(), "name", null, 0, 1, StrategyTemplate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getStrategyTemplate_Decription(), ecorePackage.getEString(), "decription", null, 0, 1, StrategyTemplate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getStrategyTemplate_Id(), ecorePackage.getEString(), "id", null, 1, 1, StrategyTemplate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$ + + initEClass(strategySetEClass, StrategySet.class, "StrategySet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getStrategySet_Strategies(), this.getStrategyElement(), null, "strategies", null, 1, -1, StrategySet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, //$NON-NLS-1$ + IS_ORDERED); + + initEClass(strategyElementEClass, StrategyElement.class, "StrategyElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getStrategyElement_ElementContainers(), this.getElementContainer(), null, "elementContainers", null, 0, -1, StrategyElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, //$NON-NLS-1$ + !IS_DERIVED, IS_ORDERED); + initEReference(getStrategyElement_ElementProperties(), this.getElementProperty(), null, "elementProperties", null, 1, -1, StrategyElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, //$NON-NLS-1$ + !IS_DERIVED, IS_ORDERED); + + initEClass(elementTemplateEClass, ElementTemplate.class, "ElementTemplate", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getElementTemplate_BaseType(), ecorePackage.getEString(), "baseType", null, 1, 1, ElementTemplate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getElementTemplate_SpecializedType(), ecorePackage.getEString(), "specializedType", null, 0, 1, ElementTemplate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(elementContainerEClass, ElementContainer.class, "ElementContainer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getElementContainer_ContainersContainer(), this.getElementContainer(), null, "containersContainer", null, 0, 1, ElementContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, //$NON-NLS-1$ + IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + initEClass(elementPropertyEClass, ElementProperty.class, "ElementProperty", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getElementProperty_FeatureLabel(), ecorePackage.getEString(), "featureLabel", null, 1, 1, ElementProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getElementProperty_Priority(), ecorePackage.getEIntegerObject(), "priority", "0", 1, 1, ElementProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ + initEReference(getElementProperty_Triggers(), this.getAbstractTrigger(), null, "triggers", null, 1, -1, ElementProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, //$NON-NLS-1$ + !IS_ORDERED); + initEReference(getElementProperty_ValueProcessor(), this.getAbstractValueProcessor(), null, "valueProcessor", null, 1, 1, ElementProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, //$NON-NLS-1$ + !IS_DERIVED, !IS_ORDERED); + + initEClass(abstractTriggerEClass, AbstractTrigger.class, "AbstractTrigger", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + initEClass(abstractValueProcessorEClass, AbstractValueProcessor.class, "AbstractValueProcessor", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + initEClass(javaProcessorEClass, JavaProcessor.class, "JavaProcessor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getJavaProcessor_ClassName(), ecorePackage.getEString(), "className", null, 1, 1, JavaProcessor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$ + + initEClass(basicTriggerEClass, BasicTrigger.class, "BasicTrigger", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getBasicTrigger_OnCreate(), ecorePackage.getEBoolean(), "onCreate", null, 1, 1, BasicTrigger.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getBasicTrigger_OnDelete(), ecorePackage.getEBoolean(), "onDelete", null, 1, 1, BasicTrigger.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getBasicTrigger_OnOpen(), ecorePackage.getEBoolean(), "onOpen", null, 1, 1, BasicTrigger.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getBasicTrigger_OnMove(), ecorePackage.getEBoolean(), "onMove", null, 1, 1, BasicTrigger.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); //$NON-NLS-1$ + + // Create resource + createResource(eNS_URI); + } + +} // PropertylifecyclePackageImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategyElementImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategyElementImpl.java new file mode 100755 index 00000000000..e27dded5853 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategyElementImpl.java @@ -0,0 +1,459 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.propertylifecycle.ElementContainer; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategyTemplate; + +/** + * + * An implementation of the model object 'Strategy Element'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl#getName Name}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl#getDecription Decription}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl#getId Id}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl#getElementContainers Element Containers}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategyElementImpl#getElementProperties Element Properties}
  • + *
+ * + * @generated + */ +public class StrategyElementImpl extends ElementTemplateImpl implements StrategyElement { + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #getDecription() Decription}' attribute. + * + * + * + * @see #getDecription() + * @generated + * @ordered + */ + protected static final String DECRIPTION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDecription() Decription}' attribute. + * + * + * + * @see #getDecription() + * @generated + * @ordered + */ + protected String decription = DECRIPTION_EDEFAULT; + + /** + * The default value of the '{@link #getId() Id}' attribute. + * + * + * + * @see #getId() + * @generated + * @ordered + */ + protected static final String ID_EDEFAULT = null; + + /** + * The cached value of the '{@link #getId() Id}' attribute. + * + * + * + * @see #getId() + * @generated + * @ordered + */ + protected String id = ID_EDEFAULT; + + /** + * The cached value of the '{@link #getElementContainers() Element Containers}' containment reference list. + * + * + * + * @see #getElementContainers() + * @generated + * @ordered + */ + protected EList elementContainers; + + /** + * The cached value of the '{@link #getElementProperties() Element Properties}' containment reference list. + * + * + * + * @see #getElementProperties() + * @generated + * @ordered + */ + protected EList elementProperties; + + /** + * + * + * + * @generated + */ + protected StrategyElementImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.STRATEGY_ELEMENT; + } + + /** + * + * + * + * @generated + */ + @Override + public String getName() { + return name; + } + + /** + * + * + * + * @generated + */ + @Override + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.STRATEGY_ELEMENT__NAME, oldName, name)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public String getDecription() { + return decription; + } + + /** + * + * + * + * @generated + */ + @Override + public void setDecription(String newDecription) { + String oldDecription = decription; + decription = newDecription; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.STRATEGY_ELEMENT__DECRIPTION, oldDecription, decription)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public String getId() { + return id; + } + + /** + * + * + * + * @generated + */ + @Override + public void setId(String newId) { + String oldId = id; + id = newId; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.STRATEGY_ELEMENT__ID, oldId, id)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public EList getElementContainers() { + if (elementContainers == null) { + elementContainers = new EObjectContainmentEList(ElementContainer.class, this, PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_CONTAINERS); + } + return elementContainers; + } + + /** + * + * + * + * @generated + */ + @Override + public EList getElementProperties() { + if (elementProperties == null) { + elementProperties = new EObjectContainmentEList(ElementProperty.class, this, PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_PROPERTIES); + } + return elementProperties; + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_CONTAINERS: + return ((InternalEList) getElementContainers()).basicRemove(otherEnd, msgs); + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_PROPERTIES: + return ((InternalEList) getElementProperties()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_ELEMENT__NAME: + return getName(); + case PropertylifecyclePackage.STRATEGY_ELEMENT__DECRIPTION: + return getDecription(); + case PropertylifecyclePackage.STRATEGY_ELEMENT__ID: + return getId(); + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_CONTAINERS: + return getElementContainers(); + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_PROPERTIES: + return getElementProperties(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_ELEMENT__NAME: + setName((String) newValue); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__DECRIPTION: + setDecription((String) newValue); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__ID: + setId((String) newValue); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_CONTAINERS: + getElementContainers().clear(); + getElementContainers().addAll((Collection) newValue); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_PROPERTIES: + getElementProperties().clear(); + getElementProperties().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_ELEMENT__NAME: + setName(NAME_EDEFAULT); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__DECRIPTION: + setDecription(DECRIPTION_EDEFAULT); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__ID: + setId(ID_EDEFAULT); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_CONTAINERS: + getElementContainers().clear(); + return; + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_PROPERTIES: + getElementProperties().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_ELEMENT__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case PropertylifecyclePackage.STRATEGY_ELEMENT__DECRIPTION: + return DECRIPTION_EDEFAULT == null ? decription != null : !DECRIPTION_EDEFAULT.equals(decription); + case PropertylifecyclePackage.STRATEGY_ELEMENT__ID: + return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_CONTAINERS: + return elementContainers != null && !elementContainers.isEmpty(); + case PropertylifecyclePackage.STRATEGY_ELEMENT__ELEMENT_PROPERTIES: + return elementProperties != null && !elementProperties.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { + if (baseClass == StrategyTemplate.class) { + switch (derivedFeatureID) { + case PropertylifecyclePackage.STRATEGY_ELEMENT__NAME: + return PropertylifecyclePackage.STRATEGY_TEMPLATE__NAME; + case PropertylifecyclePackage.STRATEGY_ELEMENT__DECRIPTION: + return PropertylifecyclePackage.STRATEGY_TEMPLATE__DECRIPTION; + case PropertylifecyclePackage.STRATEGY_ELEMENT__ID: + return PropertylifecyclePackage.STRATEGY_TEMPLATE__ID; + default: + return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * + * + * + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { + if (baseClass == StrategyTemplate.class) { + switch (baseFeatureID) { + case PropertylifecyclePackage.STRATEGY_TEMPLATE__NAME: + return PropertylifecyclePackage.STRATEGY_ELEMENT__NAME; + case PropertylifecyclePackage.STRATEGY_TEMPLATE__DECRIPTION: + return PropertylifecyclePackage.STRATEGY_ELEMENT__DECRIPTION; + case PropertylifecyclePackage.STRATEGY_TEMPLATE__ID: + return PropertylifecyclePackage.STRATEGY_ELEMENT__ID; + default: + return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); //$NON-NLS-1$ + result.append(name); + result.append(", decription: "); //$NON-NLS-1$ + result.append(decription); + result.append(", id: "); //$NON-NLS-1$ + result.append(id); + result.append(')'); + return result.toString(); + } + +} // StrategyElementImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategySetImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategySetImpl.java new file mode 100755 index 00000000000..bbf1596db53 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategySetImpl.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; + +/** + * + * An implementation of the model object 'Strategy Set'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategySetImpl#getStrategies Strategies}
  • + *
+ * + * @generated + */ +public class StrategySetImpl extends StrategyTemplateImpl implements StrategySet { + /** + * The cached value of the '{@link #getStrategies() Strategies}' containment reference list. + * + * + * + * @see #getStrategies() + * @generated + * @ordered + */ + protected EList strategies; + + /** + * + * + * + * @generated + */ + protected StrategySetImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.STRATEGY_SET; + } + + /** + * + * + * + * @generated + */ + @Override + public EList getStrategies() { + if (strategies == null) { + strategies = new EObjectContainmentEList(StrategyElement.class, this, PropertylifecyclePackage.STRATEGY_SET__STRATEGIES); + } + return strategies; + } + + /** + * + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_SET__STRATEGIES: + return ((InternalEList) getStrategies()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_SET__STRATEGIES: + return getStrategies(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_SET__STRATEGIES: + getStrategies().clear(); + getStrategies().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_SET__STRATEGIES: + getStrategies().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_SET__STRATEGIES: + return strategies != null && !strategies.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // StrategySetImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategyTemplateImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategyTemplateImpl.java new file mode 100755 index 00000000000..267622b8948 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/impl/StrategyTemplateImpl.java @@ -0,0 +1,310 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.StrategyTemplate; + +/** + * + * An implementation of the model object 'Strategy Template'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategyTemplateImpl#getName Name}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategyTemplateImpl#getDecription Decription}
  • + *
  • {@link org.eclipse.papyrus.propertylifecycle.impl.StrategyTemplateImpl#getId Id}
  • + *
+ * + * @generated + */ +public abstract class StrategyTemplateImpl extends MinimalEObjectImpl.Container implements StrategyTemplate { + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #getDecription() Decription}' attribute. + * + * + * + * @see #getDecription() + * @generated + * @ordered + */ + protected static final String DECRIPTION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDecription() Decription}' attribute. + * + * + * + * @see #getDecription() + * @generated + * @ordered + */ + protected String decription = DECRIPTION_EDEFAULT; + + /** + * The default value of the '{@link #getId() Id}' attribute. + * + * + * + * @see #getId() + * @generated + * @ordered + */ + protected static final String ID_EDEFAULT = null; + + /** + * The cached value of the '{@link #getId() Id}' attribute. + * + * + * + * @see #getId() + * @generated + * @ordered + */ + protected String id = ID_EDEFAULT; + + /** + * + * + * + * @generated + */ + protected StrategyTemplateImpl() { + super(); + } + + /** + * + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertylifecyclePackage.Literals.STRATEGY_TEMPLATE; + } + + /** + * + * + * + * @generated + */ + @Override + public String getName() { + return name; + } + + /** + * + * + * + * @generated + */ + @Override + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.STRATEGY_TEMPLATE__NAME, oldName, name)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public String getDecription() { + return decription; + } + + /** + * + * + * + * @generated + */ + @Override + public void setDecription(String newDecription) { + String oldDecription = decription; + decription = newDecription; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.STRATEGY_TEMPLATE__DECRIPTION, oldDecription, decription)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public String getId() { + return id; + } + + /** + * + * + * + * @generated + */ + @Override + public void setId(String newId) { + String oldId = id; + id = newId; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PropertylifecyclePackage.STRATEGY_TEMPLATE__ID, oldId, id)); + } + } + + /** + * + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_TEMPLATE__NAME: + return getName(); + case PropertylifecyclePackage.STRATEGY_TEMPLATE__DECRIPTION: + return getDecription(); + case PropertylifecyclePackage.STRATEGY_TEMPLATE__ID: + return getId(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_TEMPLATE__NAME: + setName((String) newValue); + return; + case PropertylifecyclePackage.STRATEGY_TEMPLATE__DECRIPTION: + setDecription((String) newValue); + return; + case PropertylifecyclePackage.STRATEGY_TEMPLATE__ID: + setId((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_TEMPLATE__NAME: + setName(NAME_EDEFAULT); + return; + case PropertylifecyclePackage.STRATEGY_TEMPLATE__DECRIPTION: + setDecription(DECRIPTION_EDEFAULT); + return; + case PropertylifecyclePackage.STRATEGY_TEMPLATE__ID: + setId(ID_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PropertylifecyclePackage.STRATEGY_TEMPLATE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case PropertylifecyclePackage.STRATEGY_TEMPLATE__DECRIPTION: + return DECRIPTION_EDEFAULT == null ? decription != null : !DECRIPTION_EDEFAULT.equals(decription); + case PropertylifecyclePackage.STRATEGY_TEMPLATE__ID: + return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); + } + return super.eIsSet(featureID); + } + + /** + * + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); //$NON-NLS-1$ + result.append(name); + result.append(", decription: "); //$NON-NLS-1$ + result.append(decription); + result.append(", id: "); //$NON-NLS-1$ + result.append(id); + result.append(')'); + return result.toString(); + } + +} // StrategyTemplateImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleAdapterFactory.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleAdapterFactory.java new file mode 100755 index 00000000000..9666a6ca629 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleAdapterFactory.java @@ -0,0 +1,318 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.propertylifecycle.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage + * @generated + */ +public class PropertylifecycleAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * + * @generated + */ + protected static PropertylifecyclePackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * + * @generated + */ + public PropertylifecycleAdapterFactory() { + if (modelPackage == null) { + modelPackage = PropertylifecyclePackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject) object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * + * @generated + */ + protected PropertylifecycleSwitch modelSwitch = new PropertylifecycleSwitch() { + @Override + public Adapter caseStrategyTemplate(StrategyTemplate object) { + return createStrategyTemplateAdapter(); + } + + @Override + public Adapter caseStrategySet(StrategySet object) { + return createStrategySetAdapter(); + } + + @Override + public Adapter caseStrategyElement(StrategyElement object) { + return createStrategyElementAdapter(); + } + + @Override + public Adapter caseElementTemplate(ElementTemplate object) { + return createElementTemplateAdapter(); + } + + @Override + public Adapter caseElementContainer(ElementContainer object) { + return createElementContainerAdapter(); + } + + @Override + public Adapter caseElementProperty(ElementProperty object) { + return createElementPropertyAdapter(); + } + + @Override + public Adapter caseAbstractTrigger(AbstractTrigger object) { + return createAbstractTriggerAdapter(); + } + + @Override + public Adapter caseAbstractValueProcessor(AbstractValueProcessor object) { + return createAbstractValueProcessorAdapter(); + } + + @Override + public Adapter caseJavaProcessor(JavaProcessor object) { + return createJavaProcessorAdapter(); + } + + @Override + public Adapter caseBasicTrigger(BasicTrigger object) { + return createBasicTriggerAdapter(); + } + + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * + * @param target + * the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject) target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.StrategyTemplate Strategy Template}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.StrategyTemplate + * @generated + */ + public Adapter createStrategyTemplateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.StrategySet Strategy Set}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.StrategySet + * @generated + */ + public Adapter createStrategySetAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.StrategyElement Strategy Element}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.StrategyElement + * @generated + */ + public Adapter createStrategyElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.ElementTemplate Element Template}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.ElementTemplate + * @generated + */ + public Adapter createElementTemplateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.ElementContainer Element Container}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.ElementContainer + * @generated + */ + public Adapter createElementContainerAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.ElementProperty Element Property}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.ElementProperty + * @generated + */ + public Adapter createElementPropertyAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.AbstractTrigger Abstract Trigger}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.AbstractTrigger + * @generated + */ + public Adapter createAbstractTriggerAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor Abstract Value Processor}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor + * @generated + */ + public Adapter createAbstractValueProcessorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.JavaProcessor Java Processor}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.JavaProcessor + * @generated + */ + public Adapter createJavaProcessorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.propertylifecycle.BasicTrigger Basic Trigger}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * + * @return the new adapter. + * @see org.eclipse.papyrus.propertylifecycle.BasicTrigger + * @generated + */ + public Adapter createBasicTriggerAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} // PropertylifecycleAdapterFactory diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleResourceFactoryImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleResourceFactoryImpl.java new file mode 100755 index 00000000000..be2b87b606e --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleResourceFactoryImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.util; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.resource.Resource; + +import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; + +/** + * + * The Resource Factory associated with the package. + * + * + * @see org.eclipse.papyrus.propertylifecycle.util.PropertylifecycleResourceImpl + * @generated + */ +public class PropertylifecycleResourceFactoryImpl extends ResourceFactoryImpl { + /** + * Creates an instance of the resource factory. + * + * + * + * @generated + */ + public PropertylifecycleResourceFactoryImpl() { + super(); + } + + /** + * Creates an instance of the resource. + * + * + * + * @generated + */ + @Override + public Resource createResource(URI uri) { + Resource result = new PropertylifecycleResourceImpl(uri); + return result; + } + +} // PropertylifecycleResourceFactoryImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleResourceImpl.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleResourceImpl.java new file mode 100755 index 00000000000..e617600629b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleResourceImpl.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.util; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; + +/** + * + * The Resource associated with the package. + * + * + * @see org.eclipse.papyrus.propertylifecycle.util.PropertylifecycleResourceFactoryImpl + * @generated + */ +public class PropertylifecycleResourceImpl extends XMIResourceImpl { + /** + * Creates an instance of the resource. + * + * + * + * @param uri + * the URI of the new resource. + * @generated + */ + public PropertylifecycleResourceImpl(URI uri) { + super(uri); + } + +} // PropertylifecycleResourceImpl diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleSwitch.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleSwitch.java new file mode 100755 index 00000000000..0937f20e5d4 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src-gen/org/eclipse/papyrus/propertylifecycle/util/PropertylifecycleSwitch.java @@ -0,0 +1,375 @@ +/** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.propertylifecycle.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; +import org.eclipse.papyrus.propertylifecycle.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * + * @see org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage + * @generated + */ +public class PropertylifecycleSwitch extends Switch { + /** + * The cached model package + * + * + * + * @generated + */ + protected static PropertylifecyclePackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * + * @generated + */ + public PropertylifecycleSwitch() { + if (modelPackage == null) { + modelPackage = PropertylifecyclePackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * + * @param ePackage + * the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case PropertylifecyclePackage.STRATEGY_TEMPLATE: { + StrategyTemplate strategyTemplate = (StrategyTemplate) theEObject; + T result = caseStrategyTemplate(strategyTemplate); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.STRATEGY_SET: { + StrategySet strategySet = (StrategySet) theEObject; + T result = caseStrategySet(strategySet); + if (result == null) { + result = caseStrategyTemplate(strategySet); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.STRATEGY_ELEMENT: { + StrategyElement strategyElement = (StrategyElement) theEObject; + T result = caseStrategyElement(strategyElement); + if (result == null) { + result = caseElementTemplate(strategyElement); + } + if (result == null) { + result = caseStrategyTemplate(strategyElement); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.ELEMENT_TEMPLATE: { + ElementTemplate elementTemplate = (ElementTemplate) theEObject; + T result = caseElementTemplate(elementTemplate); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.ELEMENT_CONTAINER: { + ElementContainer elementContainer = (ElementContainer) theEObject; + T result = caseElementContainer(elementContainer); + if (result == null) { + result = caseElementTemplate(elementContainer); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.ELEMENT_PROPERTY: { + ElementProperty elementProperty = (ElementProperty) theEObject; + T result = caseElementProperty(elementProperty); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.ABSTRACT_TRIGGER: { + AbstractTrigger abstractTrigger = (AbstractTrigger) theEObject; + T result = caseAbstractTrigger(abstractTrigger); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.ABSTRACT_VALUE_PROCESSOR: { + AbstractValueProcessor abstractValueProcessor = (AbstractValueProcessor) theEObject; + T result = caseAbstractValueProcessor(abstractValueProcessor); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.JAVA_PROCESSOR: { + JavaProcessor javaProcessor = (JavaProcessor) theEObject; + T result = caseJavaProcessor(javaProcessor); + if (result == null) { + result = caseAbstractValueProcessor(javaProcessor); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PropertylifecyclePackage.BASIC_TRIGGER: { + BasicTrigger basicTrigger = (BasicTrigger) theEObject; + T result = caseBasicTrigger(basicTrigger); + if (result == null) { + result = caseAbstractTrigger(basicTrigger); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + default: + return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Strategy Template'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Strategy Template'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseStrategyTemplate(StrategyTemplate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Strategy Set'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Strategy Set'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseStrategySet(StrategySet object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Strategy Element'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Strategy Element'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseStrategyElement(StrategyElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Element Template'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Element Template'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseElementTemplate(ElementTemplate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Element Container'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Element Container'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseElementContainer(ElementContainer object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Element Property'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Element Property'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseElementProperty(ElementProperty object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Abstract Trigger'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Abstract Trigger'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAbstractTrigger(AbstractTrigger object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Abstract Value Processor'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Abstract Value Processor'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAbstractValueProcessor(AbstractValueProcessor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Java Processor'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Java Processor'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseJavaProcessor(JavaProcessor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Basic Trigger'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Basic Trigger'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseBasicTrigger(BasicTrigger object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} // PropertylifecycleSwitch diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/Activator.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/Activator.java new file mode 100755 index 00000000000..4bf2a58d70d --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/Activator.java @@ -0,0 +1,73 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.model; + +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 { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.propertylifecycle.model"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** Logging helper */ + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + log = null; + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/extensionpoints/IStrategySetExtensionPoint.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/extensionpoints/IStrategySetExtensionPoint.java new file mode 100755 index 00000000000..010be1da3da --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/extensionpoints/IStrategySetExtensionPoint.java @@ -0,0 +1,30 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.model.extensionpoints; + +import org.eclipse.papyrus.propertylifecycle.model.Activator; + +/** + * The needed informations to identify and declare an extension that will be registered as a StrategySet + * + */ +public interface IStrategySetExtensionPoint { + + public final static String EXTENSION_POINT_ID = Activator.PLUGIN_ID + ".propertylifecyclestrategyset"; + + public static final String PATH = "path"; + + public static final String ID = "id"; + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/registries/StrategySetRegistry.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/registries/StrategySetRegistry.java new file mode 100755 index 00000000000..fcc724bea52 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.model/src/org/eclipse/papyrus/propertylifecycle/model/registries/StrategySetRegistry.java @@ -0,0 +1,172 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.model.registries; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +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.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.model.Activator; +import org.eclipse.papyrus.propertylifecycle.model.extensionpoints.IStrategySetExtensionPoint; + + +/** + * Convenience class used to get the informations on the strategy models referenced by extensions + * + * @author QL238289 + * + */ +public class StrategySetRegistry { + + /** The registry */ + private static StrategySetRegistry strategySetRegistry; + + /** The models */ + protected Map strategySets; + + /** ResourceSet hosting the registered strategySets */ + protected ResourceSet strategySetResourceSet; + + /** + * Retrieve the existing instance of the registry or create a new one + * + * @return + * The current strategy registry + */ + public static synchronized StrategySetRegistry getInstance() { + if (strategySetRegistry == null) { + strategySetRegistry = new StrategySetRegistry(); + strategySetRegistry.init(); + } + + return strategySetRegistry; + } + + /** + * Initialize the contents of the new instance of the registry + * + */ + protected void init() { + // Resets values + strategySetResourceSet = null; + strategySets = null; + // Creates the resource set + strategySetResourceSet = createResourceSet(); + // Creates the list only when registry is acceded for the first time, (or on reload?) + // TODO select the strategies models from the preference page activations, store the ids and retrieve them here + strategySets = readStrategySetModels(); + } + + /** + * Create a new {@link #org.eclipse.emf.ecore.resource.ResourceSet resourceSet} + * + * @return + * The resourceSet that will contain the strategy models + */ + protected ResourceSet createResourceSet() { + ResourceSet set = new ResourceSetImpl(); + return set; + } + + /** + * @return + * A non null map containing the models retrieved from {@link #readExtensionsStrategySet() readExtensionsStrategySet()} + */ + protected Map readStrategySetModels() { + Map localStrategySet = new HashMap(); + + // Retrieves from the platform, e.g. extension points + // The localSets argument is used to verify that we do not load the same model twice, i.e. from the local and extension + Map registeredSets = readExtensionsStrategySet(); + if (registeredSets != null && !registeredSets.isEmpty()) { + localStrategySet.putAll(registeredSets); + } + + return localStrategySet; + } + + /** + * @see org.eclipse.papyrus.propertylifecycle.model.extensionpoints.IStrategySetExtensionPoint + * + * @return + * A map containing the models referenced by the extensions containing the correct ID + */ + protected Map readExtensionsStrategySet() { + Map platformStrategySets = new HashMap(); + IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(IStrategySetExtensionPoint.EXTENSION_POINT_ID); + + for (IConfigurationElement extension : extensions) { + String modelPath = extension.getAttribute(IStrategySetExtensionPoint.PATH); + String renameSetID = extension.getAttribute(IStrategySetExtensionPoint.ID); + String contributorID = extension.getContributor().getName(); + StrategySet set = getStrategySetInBundle(modelPath, contributorID); + // Verify if the models are already loaded or not + if (set != null) { + if (platformStrategySets.containsKey(renameSetID)) { + continue; + } + platformStrategySets.put(renameSetID, set); + } + } + + return platformStrategySets; + } + + /** + * Load the resource based on the given parameters + * + * @param modelPath + * The path of the resource from the contained bundle + * @param bundleID + * The bundle ID used to form the URI + * @return + * The retrieved {@link #org.eclipse.emf.ecore.resource.ResourceSet resourceSet} or null + */ + protected StrategySet getStrategySetInBundle(String modelPath, String bundleID) { + String path = bundleID + IPath.SEPARATOR + modelPath; + Resource resource = strategySetResourceSet.createResource(URI.createPlatformPluginURI(path, true)); + try { + resource.load(null); + } catch (IOException e) { + Activator.log.error(e); + } + + EObject content = resource.getContents().get(0); + if (content instanceof StrategySet) { + return (StrategySet) content; + } + + return null; + } + + /** + * Convenience method + * + * @return + * The Map containing the successfully retrieved models, identified by their extensionPoint's ID + */ + public Map getStrategySets() { + return strategySets; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.classpath b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.classpath new file mode 100755 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.gitignore b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.gitignore new file mode 100755 index 00000000000..ae3c1726048 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.options b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.options new file mode 100755 index 00000000000..3d16767c9da --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.options @@ -0,0 +1,3 @@ +# Tracing options for the org.eclipse.papyrus.infra.propertylifecycle.preferences plug-in +org.eclipse.papyrus.infra.propertylifecycle.preferences/debug=true +org.eclipse.papyrus.infra.propertylifecycle.preferences/debug/lifecyclepreferences=true diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.project b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.project new file mode 100755 index 00000000000..69c889ad21c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.propertylifecycle.preferences + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.settings/org.eclipse.jdt.core.prefs b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..0c68a61dca8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/META-INF/MANIFEST.MF b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..a12006b22c6 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: PropertyLifecyclePreferences +Bundle-SymbolicName: org.eclipse.papyrus.propertylifecycle.preferences;singleton:=true +Bundle-Version: 0.0.1.qualifier +Bundle-Activator: org.eclipse.papyrus.propertylifecycle.preferences.Activator +Require-Bundle: org.eclipse.ui;bundle-version="3.107.0", + org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.propertylifecycle.model;bundle-version="0.0.1", + org.eclipse.papyrus.propertylifecycle.model.editor;bundle-version="0.0.1" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Export-Package: org.eclipse.papyrus.propertylifecycle.preferences.utils diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/about.html b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/about.html new file mode 100755 index 00000000000..d35d5aed64c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/build.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/build.properties new file mode 100755 index 00000000000..34d2e4d2dad --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/menu/removeStrategyModel_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/menu/removeStrategyModel_16x16.gif new file mode 100755 index 00000000000..8995a3057b5 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/menu/removeStrategyModel_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/menu/removeStrategy_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/menu/removeStrategy_16x16.gif new file mode 100755 index 00000000000..84f0315f2bd Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/menu/removeStrategy_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_left_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_left_16x16.gif new file mode 100755 index 00000000000..4fb41501036 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_left_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_left_double_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_left_double_16x16.gif new file mode 100755 index 00000000000..336b55cf08e Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_left_double_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_right_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_right_16x16.gif new file mode 100755 index 00000000000..19567890aa8 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_right_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_right_double_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_right_double_16x16.gif new file mode 100755 index 00000000000..c02db2c9df4 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/arrow_right_double_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/synced_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/synced_16x16.gif new file mode 100755 index 00000000000..870934b6934 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/navigation/synced_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/tableViewer/checked_12x12.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/tableViewer/checked_12x12.gif new file mode 100755 index 00000000000..a2669a8ea32 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/tableViewer/checked_12x12.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/tableViewer/unchecked_12x12.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/tableViewer/unchecked_12x12.gif new file mode 100755 index 00000000000..49094593b40 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/tableViewer/unchecked_12x12.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/container_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/container_16x16.gif new file mode 100755 index 00000000000..7ccc6a70317 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/container_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/property_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/property_16x16.gif new file mode 100755 index 00000000000..d11c996e570 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/property_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/resource_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/resource_16x16.gif new file mode 100755 index 00000000000..2e4de3d12a7 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/resource_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/strategySet_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/strategySet_16x16.gif new file mode 100755 index 00000000000..131c28da405 Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/strategySet_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/strategy_16x16.gif b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/strategy_16x16.gif new file mode 100755 index 00000000000..51e703b1b9c Binary files /dev/null and b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/icons/treeViewer/strategy_16x16.gif differ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/plugin.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/plugin.xml new file mode 100755 index 00000000000..1c36b4ad180 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/plugin.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/pom.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/pom.xml new file mode 100755 index 00000000000..dd53fbc2439 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.eclipse.papyrus.infra.propertylifecycle.preferences + 0.0.1.qualifier + org.eclipse.papyrus + eclipse-plugin + + org.eclipse.papyrus + org.eclipse.papyrus.infra.propertylifecycle + 0.0.1.qualifier + ../org.eclipse.papyrus.infra.propertylifecycle/pom.xml + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/Activator.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/Activator.java new file mode 100755 index 00000000000..75258b7f4cf --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/Activator.java @@ -0,0 +1,120 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.swt.graphics.Image; +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 { + + /** The plug-in ID */ + public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.propertylifecycle.preferences"; //$NON-NLS-1$ + + /** The shared instance */ + private static Activator plugin; + + /** Logging helper */ + public static LogHelper log; + + /** The tag to identify the trace when activating the messages in the .options file */ + public static String STRATEGY_PREFERENCES_TRACE = "lifecyclepreferences"; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + log = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Get the image from its path in the current plugin + * + * @param path + * @return + * The {@link #org.eclipse.swt.graphics.Image image} + */ + public Image getImage(String path) { + return getImage(PLUGIN_ID, path); + } + + /** + * Get the image from its path in the specified plugin + * + * @param pluginId + * @param path + * @return + * The {@link #org.eclipse.swt.graphics.Image image} + */ + public Image getImage(String pluginId, String path) { + final ImageRegistry registry = getImageRegistry(); + String key = pluginId + "/" + path; //$NON-NLS-1$ + Image image = registry.get(key); + if (image == null) { + registry.put(key, AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, path)); + image = registry.get(key); + } + return image; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path. + * + * @param path + * @return the image descriptor + */ + public ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/messages/Messages.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/messages/Messages.java new file mode 100755 index 00000000000..25b22283fd6 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/messages/Messages.java @@ -0,0 +1,129 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.messages; + +import org.eclipse.osgi.util.NLS; + +/** + * Messages Class + * + */ +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.propertylifecycle.preferences.messages.messages"; //$NON-NLS-1$ + + // Preference page + public static String PropertyLifecycle_PreferencePage_Title; + + public static String PropertyLifecycle_PreferencePage_Description; + + public static String Choose_Configuration; + + // ControlsComposite + public static String PropertyLifecycleStrategies; + + public static String Sync_Label; + + public static String Sync_IconPath; + + public static String Add_Label; + + public static String Add_IconPath; + + public static String Remove_Label; + + public static String Remove_IconPath; + + public static String RemoveAll_Label; + + public static String RemoveAll_IconPath; + + public static String AddAll_Label; + + public static String AddAll_IconPath; + + // TreeViewer + public static String Resource_IconPath; + + public static String StrategySet_IconPath; + + public static String Strategy_IconPath; + + public static String Property_IconPath; + + public static String ElementContainer_IconPath; + + // StrategiesComposite + public static String StrategyElement_Label; + + public static String ElementProperty_Label; + + public static String ElementContainer_Label; + + // SystemSelectionDialog + public static String SystemSelectionDialog_Title; + + public static String SystemSaveDialog_Title; + + // Menu + public static String AddStrategy_Label; + + public static String AddStrategy_IconPath; + + public static String RemoveStrategy_Label; + + public static String RemoveStrategy_IconPath; + + public static String RemoveStrategyModel_Label; + + public static String RemoveStrategyModel_IconPath; + + public static String RemoveAllStrategies_Label; + + public static String RemoveAllStrategies_IconPath; + + // Preferences + public static String BasicBrowsedModels_Node; + + public static String BasicSelectedStrategies_Node; + + public static String AdvancedBrowsedModels_Node; + + public static String AdvancedSelectedStrategies_Node; + + // Models buttons + public static String SaveButton_Label; + + public static String BrowseButton_Label; + + public static String CustomModel_DefaultName; + + // TableViewer + public static String SelectAllButton_Label; + + public static String DeselectAllButton_Label; + + public static String Checked_IconPath; + + public static String Unchecked_IconPath; + + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/messages/messages.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/messages/messages.properties new file mode 100755 index 00000000000..1485d31dabc --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/messages/messages.properties @@ -0,0 +1,52 @@ +PropertyLifecycle_PreferencePage_Title=Papyrus Property LifeCycle Strategies +PropertyLifecycle_PreferencePage_Description=Select one or more strategies to be applied on subsequent element creations: +Choose_Configuration=Choose the needed Strategy Configuration: + +PropertyLifecycleStrategies=PropertyLifeCycleStrategies + +Sync_Label=Link with Registered Models +Sync_IconPath=/icons/navigation/synced_16x16.gif +Add_Label=addButton +Add_IconPath=/icons/navigation/arrow_right_16x16.gif +Remove_Label=removeButton +Remove_IconPath=/icons/navigation/arrow_left_16x16.gif +AddAll_Label=addAllButton +AddAll_IconPath=/icons/navigation/arrow_right_double_16x16.gif +RemoveAll_Label=removeAllButton +RemoveAll_IconPath=/icons/navigation/arrow_left_double_16x16.gif + +Resource_IconPath=/icons/treeViewer/resource_16x16.gif +StrategySet_IconPath=/icons/treeViewer/strategySet_16x16.gif +Strategy_IconPath=/icons/treeViewer/Strategy_16x16.gif +Property_IconPath=/icons/treeViewer/property_16x16.gif +ElementContainer_IconPath=/icons/treeViewer/container_16x16.gif + +StrategyElement_Label=Element base type: +ElementProperty_Label=FeatureLabel: +ElementContainer_Label=Container base type: + +SystemSelectionDialog_Title=Select the models to load +SystemSaveDialog_Title=Select the directory for the new model + +AddStrategy_Label=Add selected Strategies +AddStrategy_IconPath=/icons/menu/addStrategy_16x16.gif +RemoveStrategy_Label=Remove selected strategies +RemoveStrategy_IconPath=/icons/menu/removeStrategy_16x16.gif +RemoveStrategyModel_Label=Remove selected Model +RemoveStrategyModel_IconPath=/icons/menu/removeStrategyModel_16x16.gif +RemoveAllStrategies_Label=Remove All strategies +RemoveAllStrategies_IconPath=/icons/menu/removeAll_16x16.gif + +BasicBrowsedModels_Node=basicBrowsedModelsURI +BasicSelectedStrategies_Node=basicSelectedStrategies +AdvancedBrowsedModels_Node=advancedBrowsedModelsURI +AdvancedSelectedStrategies_Node=advancedSelectedStrategies + +SaveButton_Label=Save Strategies +BrowseButton_Label=Browse Models +CustomModel_DefaultName=CustomModel + +SelectAllButton_Label=Select All +DeselectAllButton_Label= Deselect All +Checked_IconPath=/icons/tableViewer/checked_12x12.gif +Unchecked_IconPath=/icons/tableViewer/unchecked_12x12.gif diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTab.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTab.java new file mode 100755 index 00000000000..df03e5caaae --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTab.java @@ -0,0 +1,390 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.pages; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.BrowseButton; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.SaveButton; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; + +/** + * Handle the creation of the advanced Tab in the preference page + * + */ +public class AdvancedTab implements SelectionListener { + + /** Composite containing the left viewer representing the resources and strategies available for selection */ + protected AdvancedTabLeftViewerComposite leftViewerComposite; + + /** Composite containing the right viewer representing the current selection of strategies */ + protected AdvancedTabRightViewerComposite rightViewerComposite; + + /** Composite containing the middle buttons used to add, delete or sync the strategies between both viewers */ + private Composite controlComposite; + + /** Button used to synchronize the selection between both viewers */ + private Button syncButton; + + /** Button used to add a new set of strategies to the selected ones */ + private Button addButton; + + /** Button used to remove the selection from the selected strategies */ + private Button removeButton; + + /** Button used to add all the strategies from the left viewer to the right */ + private Button addAllButton; + + /** Button used to remove all the strategies from the right viewer */ + private Button removeAllButton; + + /** the selection in the viewer */ + private List viewerSelection = new LinkedList<>(); + + /** the IDs of the selected strategies to filter during synchronization */ + private List viewerSelectionIDs = new LinkedList<>(); + + /** List containing the strategies found on both viewers */ + private List twinViewerSelection = new LinkedList<>(); + + + /** + * + * Constructor. + * + * @param parent + * The containing Composite + * @param style + */ + public AdvancedTab(CTabFolder parent, int style) { + CTabItem advancedTabItem = new CTabItem(parent, SWT.NONE); + advancedTabItem.setText("Advanced Selection"); + + GridLayout compositeLayout = new GridLayout(3, false); + Composite advancedTabComposite = new Composite(parent, style); + advancedTabComposite.setLayout(compositeLayout); + advancedTabComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 3)); + advancedTabItem.setControl(advancedTabComposite); + + createStrategiesComposite(advancedTabComposite); + createControlsComposite(advancedTabComposite); + createSelectionComposite(advancedTabComposite); + + new BrowseButton(advancedTabComposite, leftViewerComposite.getViewer()); + new SaveButton(advancedTabComposite, getRightViewer()); + } + + + /** + * Creates the rightViewer containing all the possible choices + * + * @param parent + * this + */ + protected void createStrategiesComposite(Composite parent) { + leftViewerComposite = new AdvancedTabLeftViewerComposite(parent, SWT.NONE); + ((GridData) leftViewerComposite.getLayoutData()).verticalSpan = 2; + ((GridData) leftViewerComposite.getLayoutData()).horizontalSpan = 1; + } + + /** + * The selection buttons' composite + * + * @param parent + * this + */ + protected void createControlsComposite(Composite parent) { + controlComposite = new Composite(parent, SWT.NONE); + controlComposite.setLayout(new GridLayout(1, true)); + GridData controlLayoutData = new GridData(SWT.CENTER, SWT.CENTER, false, true, 1, 3); + controlComposite.setLayoutData(controlLayoutData); + + syncButton = new Button(controlComposite, SWT.TOGGLE); + syncButton.setImage(Activator.getDefault().getImage(Messages.Sync_IconPath)); + syncButton.addSelectionListener(this); + syncButton.setToolTipText(Messages.Sync_Label); + + addButton = new Button(controlComposite, SWT.PUSH); + addButton.setImage(Activator.getDefault().getImage(Messages.Add_IconPath)); + addButton.addSelectionListener(this); + addButton.setToolTipText(Messages.Add_Label); + + removeButton = new Button(controlComposite, SWT.PUSH); + removeButton.setImage(Activator.getDefault().getImage(Messages.Remove_IconPath)); + removeButton.addSelectionListener(this); + removeButton.setToolTipText(Messages.Remove_Label); + + addAllButton = new Button(controlComposite, SWT.PUSH); + addAllButton.setImage(Activator.getDefault().getImage(Messages.AddAll_IconPath)); + addAllButton.addSelectionListener(this); + addAllButton.setToolTipText(Messages.AddAll_Label); + + removeAllButton = new Button(controlComposite, SWT.PUSH); + removeAllButton.setImage(Activator.getDefault().getImage(Messages.RemoveAll_IconPath)); + removeAllButton.addSelectionListener(this); + removeAllButton.setToolTipText(Messages.RemoveAll_Label); + } + + /** + * Creates the left viewer containing the selected options + * + * @param parent + * this + */ + protected void createSelectionComposite(Composite parent) { + rightViewerComposite = new AdvancedTabRightViewerComposite(parent, SWT.NONE); + ((GridData) rightViewerComposite.getLayoutData()).horizontalSpan = 1; + ((GridData) rightViewerComposite.getLayoutData()).verticalSpan = 2; + } + + + /** + * Get the left Viewer + * + * @return + */ + public TreeViewer getLeftViewer() { + return leftViewerComposite.getViewer(); + } + + /** + * Get the right Viewer + * + * @return + */ + public TreeViewer getRightViewer() { + return rightViewerComposite.getViewer(); + } + + /** + * Method forwarding the selected configurations to the right viewer + * + * @param advancedTabStrategies + */ + public void addStrategies(Collection advancedTabStrategies) { + rightViewerComposite.addStrategies(advancedTabStrategies); + } + + /** + * Method removing all the right viewer strategies + */ + public void removeAllSelectionCompositeStrategies() { + rightViewerComposite.removeAllStrategies(); + } + + /** + * Method forwarding the resources to populate the left viewer + * + * @param resourceSet + */ + public void setRegisteredCompositeInput(ResourceSet resourceSet) { + leftViewerComposite.getViewer().setInput(resourceSet); + } + + /** + * Get the addresses of the resources containing the selected strategies + * + * @return + */ + public Collection getAdvancedParentModels() { + return rightViewerComposite.getParentModels(); + } + + /** + * Get the strategies selected in the right viewer + * + * @return + */ + public Collection getAdvancedStrategies() { + return rightViewerComposite.getViewerStrategies(); + } + + /** + * Handles the buttons' behavior + * + * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) + * + * @param e + * The selection event + */ + @Override + public void widgetSelected(SelectionEvent e) { + if (e.widget == addButton) { + addAction(); + } else if (e.widget == removeButton) { + removeAction(); + } else if (e.widget == addAllButton) { + addAllAction(); + } else if (e.widget == removeAllButton) { + removeAllAction(); + } else if (e.widget == syncButton) { + syncAction(); + } + } + + /** + * Add the selected preference(s) to the Viewer + */ + private void addAction() { + rightViewerComposite.addStrategies(leftViewerComposite.getStrategiesSelection()); + } + + /** + * Add all the possible preferences to the Viewer + */ + private void addAllAction() { + rightViewerComposite.addStrategies(leftViewerComposite.getViewerInput()); + } + + /** + * Remove the selected preference(s) from the Viewer + */ + private void removeAction() { + rightViewerComposite.removeSelectedStrategies(); + } + + /** + * Remove all the selected preferences from the Viewer + */ + private void removeAllAction() { + rightViewerComposite.removeAllStrategies(); + } + + /** + * Method handling the synchronization between the left and right viewer + * + * @param selectionViewer + * @param twinViewer + * @param twinStrategies + */ + private void doSync(TreeViewer selectionViewer, TreeViewer twinViewer, Collection twinStrategies) { + viewerSelection.clear(); + viewerSelectionIDs.clear(); + twinViewerSelection.clear(); + viewerSelection.addAll(selectionViewer.getStructuredSelection().toList()); + + if (viewerSelection.size() < 0) { + return; + } + + for (Object object : viewerSelection) { + if (!(object instanceof StrategyElement)) { + continue; + } + StrategyElement strategy = (StrategyElement) object; + viewerSelectionIDs.add(strategy.getId()); + } + + for (StrategyElement strategy : twinStrategies) { + if (viewerSelectionIDs.contains(strategy.getId())) { + twinViewerSelection.add(strategy); + } + } + + twinViewer.setSelection(new StructuredSelection(twinViewerSelection), true); + } + + /** Listener used to sync to the right to the left viewer */ + ISelectionChangedListener syncToRegisteredListener = new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + doSync(rightViewerComposite.getViewer(), leftViewerComposite.getViewer(), leftViewerComposite.getViewerStrategies()); + } + }; + + /** Listener used to sync the left to the right viewer */ + ISelectionChangedListener syncToSelectedListener = new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + doSync(leftViewerComposite.getViewer(), rightViewerComposite.getViewer(), rightViewerComposite.getViewerStrategies()); + } + }; + + /** @see org.eclipse.swt.events.FocusListener used to detect the synchronization and update the viewer accordingly */ + FocusListener selectedFocusListener = new FocusListener() { + + @Override + public void focusGained(FocusEvent e) { + Activator.log.trace(Activator.STRATEGY_PREFERENCES_TRACE, "selectedViewerFocus gained"); + if (syncButton.getSelection()) { + rightViewerComposite.getViewer().addSelectionChangedListener(syncToRegisteredListener); + } + } + + @Override + public void focusLost(FocusEvent e) { + Activator.log.trace(Activator.STRATEGY_PREFERENCES_TRACE, "selectedViewerFocus lost"); + rightViewerComposite.treeViewer.removeSelectionChangedListener(syncToRegisteredListener); + } + }; + + /** @see org.eclipse.swt.events.FocusListener used to detect the synchronization and update the viewer accordingly */ + FocusListener registeredFocusListener = new FocusListener() { + + @Override + public void focusGained(FocusEvent e) { + Activator.log.trace(Activator.STRATEGY_PREFERENCES_TRACE, "registeredViewerFocus gained"); + if (syncButton.getSelection()) { + leftViewerComposite.getViewer().addSelectionChangedListener(syncToSelectedListener); + } + } + + @Override + public void focusLost(FocusEvent e) { + Activator.log.trace(Activator.STRATEGY_PREFERENCES_TRACE, "registeredViewerFocus lost"); + leftViewerComposite.getViewer().removeSelectionChangedListener(syncToSelectedListener); + } + }; + + /** + * Method enabling the listeners used to detect the selected strategies on the viewers + */ + private void syncAction() { + if (syncButton.getSelection()) { + rightViewerComposite.getViewer().getTree().addFocusListener(selectedFocusListener); + leftViewerComposite.getViewer().getTree().addFocusListener(registeredFocusListener); + } else { + rightViewerComposite.getViewer().getTree().removeFocusListener(selectedFocusListener); + leftViewerComposite.getViewer().getTree().removeFocusListener(registeredFocusListener); + } + } + + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + // nothing + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTabLeftViewerComposite.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTabLeftViewerComposite.java new file mode 100755 index 00000000000..07529e62564 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTabLeftViewerComposite.java @@ -0,0 +1,258 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.pages; + +import java.util.Collection; +import java.util.LinkedList; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.AdvancedTabLabelProvider; +import org.eclipse.papyrus.propertylifecycle.presentation.PropertylifecycleEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MenuAdapter; +import org.eclipse.swt.events.MenuEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.dialogs.FilteredTree; +import org.eclipse.ui.dialogs.PatternFilter; + + +/** + * Class handling the left viewer of the advanced Tab + * + */ +public class AdvancedTabLeftViewerComposite extends Composite { + + /** Factory used to get the information on the elements to populate the viewer */ + protected AdapterFactory adapterFactory; + + /** the viewer showing the available strategies */ + protected FilteredTree filteredViewer; + + /** Listener used to detect a different selection */ + protected ISelectionChangedListener selectionChangedListener; + + /** Listener used to identify the selected strategies */ + protected ISelection viewerSelection = StructuredSelection.EMPTY; + + /** Filter used to... filter the displayed strategies */ + protected PatternFilter patternFilter; + + // protected String elementFilter; + + + /** + * + * Constructor. + * + * @param parent + * The parent composite + * @param style + */ + public AdvancedTabLeftViewerComposite(Composite parent, int style) { + super(parent, style); + this.setLayout(new GridLayout(1, true)); + this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + PropertylifecycleEditor contentEditor = new PropertylifecycleEditor(); + adapterFactory = contentEditor.getAdapterFactory(); + patternFilter = new PatternFilter(); + patternFilter.setIncludeLeadingWildcard(true); + + initStrategySelectionListener(); + createViewer(this); + } + + /** + * Create the viewer + * + * @param parent + * This composite + */ + protected void createViewer(Composite parent) { + filteredViewer = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, patternFilter, true); + getViewer().setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + getViewer().setLabelProvider(new AdvancedTabLabelProvider(adapterFactory)); + + getViewer().addSelectionChangedListener(selectionChangedListener); + + // Used to filter the elements in order to display the popup menu + Tree tree = getViewer().getTree(); + final Menu rightClickMenu = new Menu(tree); + tree.setMenu(rightClickMenu); + rightClickMenu.addMenuListener(new MenuAdapter() { + + @Override + public void menuShown(MenuEvent e) { + MenuItem[] items = rightClickMenu.getItems(); + for (int i = 0; i < items.length; i++) { + items[i].dispose(); + } + + if ((((StructuredSelection) viewerSelection).getFirstElement() instanceof Resource)) { + strategySetMenu(rightClickMenu); + } + } + }); + + } + + /** + * Create the menu item used to remove the selected model + * + * @param associatedMenu + */ + private void strategySetMenu(Menu associatedMenu) { + final MenuItem strategySetItem = new MenuItem(associatedMenu, SWT.NONE); + strategySetItem.setText(Messages.RemoveStrategyModel_Label); + strategySetItem.setImage(Activator.getDefault().getImage(Messages.RemoveStrategyModel_IconPath)); + strategySetItem.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + Collection viewerResources = new LinkedList(); + for (Object object : ((StructuredSelection) getViewer().getSelection()).toArray()) { + if (object instanceof Resource) { + viewerResources.add((Resource) object); + } + } + + getViewerInput().getResources().removeAll(viewerResources); + } + }); + } + + /** + * Initialize the SelectionChangedListener + */ + protected void initStrategySelectionListener() { + selectionChangedListener = new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + viewerSelection = event.getSelection(); + } + }; + } + + /** + * Method used to add new models + * + * @param resource + * The resource linked to the model + */ + public void addNewModel(Resource resource) { + if (getViewerInput() == null) { + getViewer().setInput(resource.getResourceSet()); + return; + } + + getViewerInput().getResources().add(resource); + } + + /** + * @return + * The current strategies selection + */ + public ISelection getStrategiesSelection() { + return viewerSelection; + } + + /** + * @return + * The viewer + */ + public TreeViewer getViewer() { + return filteredViewer.getViewer(); + } + + /** + * @return + * The names of the viewer's models + */ + public Collection getViewerResourcesNames() { + ResourceSet viewerInput = getViewerInput(); + if (viewerInput == null) { + return new LinkedList(); + } + + Collection existingResources = new LinkedList(); + for (Resource resource : viewerInput.getResources()) { + // List used to verify that the user is not adding an existing model in the viewer + existingResources.add(resource.getURI().lastSegment()); + } + + return existingResources; + } + + /** + * Get the viewer input, i.e. the elements contained in the tree + * + * @param viewer + * @return + * The resourceSet containing the models displayed in the viewer + */ + public ResourceSet getViewerInput() { + Object viewerInput = getViewer().getInput(); + if (viewerInput instanceof ResourceSet) { + return ((ResourceSet) viewerInput); + } + return null; + } + + /** + * Convenience method + * + * @return + * The list of the strategies in all the models present in the viewer + */ + public Collection getViewerStrategies() { + Collection viewerStrategies = new LinkedList(); + + for (Resource resource : getViewerInput().getResources()) { + EObject eObject = resource.getContents().get(0); + if (eObject instanceof StrategySet) { + StrategySet set = (StrategySet) eObject; + for (StrategyElement strategy : set.getStrategies()) { + viewerStrategies.add(strategy); + } + } + } + + return viewerStrategies; + } + + + // TODO implement dispose() + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTabRightViewerComposite.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTabRightViewerComposite.java new file mode 100755 index 00000000000..0856b5f3a56 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/AdvancedTabRightViewerComposite.java @@ -0,0 +1,568 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.pages; + +import java.util.ArrayList; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.CommonPlugin; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.util.URI; +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.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.PropertylifecyclePackage; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.AdvancedTabLabelProvider; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.AdvancedTabViewerUtils; +import org.eclipse.papyrus.propertylifecycle.presentation.PropertylifecycleEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MenuAdapter; +import org.eclipse.swt.events.MenuEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Tree; + +/** + * The Composite containing the right viewer of the advanced tab + * + */ +public class AdvancedTabRightViewerComposite extends Composite { + + /** The models containing the selected strategies */ + protected Map parentModels; + + /** Factory used to get the information on the elements to populate the viewer */ + protected AdapterFactory adapterFactory; + + /** The viewer containing the selected strategies */ + protected TreeViewer treeViewer; + + /** The resourceSet containing the advanced Tab's custom model constructed by the user selected strategies */ + protected ResourceSet customStrategySetResourceSet; + + /** The set containing the selected strategies */ + protected StrategySet customStrategySet; + + /** The model containing the selected strategies */ + protected Resource strategySetResource; + + /** Factory used to construct the new custom model */ + protected PropertylifecycleFactory newModelFactory = PropertylifecycleFactory.eINSTANCE; + + /** The list of the selected strategies */ + protected Map viewerStrategies; + + /** Listener used to detect a different selection */ + protected ISelectionChangedListener selectionChangedListener; + + /** Listener used to identify the selected strategies */ + protected ISelection viewerSelection; + + + /** + * + * Constructor. + * + * @param parent + * The containing composite + * @param style + */ + public AdvancedTabRightViewerComposite(Composite parent, int style) { + super(parent, style); + this.setLayout(new GridLayout(1, true)); + // this.setLayout(new GridLayout(2, false)); + this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + // parentModels = new LinkedList(); + parentModels = new HashMap(); + + PropertylifecycleEditor contentEditor = new PropertylifecycleEditor(); + adapterFactory = contentEditor.getAdapterFactory(); + viewerStrategies = new HashMap(); + + initStrategySelectionListener(); + createViewer(this); + initViewer(); + } + + /** + * Create the viewer and its associated popup menus + * + * @param parent + * this + */ + protected void createViewer(Composite parent) { + treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); + treeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewer.setLabelProvider(new AdvancedTabLabelProvider(adapterFactory)); + + treeViewer.addSelectionChangedListener(selectionChangedListener); + + Tree tree = getViewer().getTree(); + final Menu rightClickMenu = new Menu(tree); + tree.setMenu(rightClickMenu); + rightClickMenu.addMenuListener(new MenuAdapter() { + + @Override + public void menuShown(MenuEvent e) { + MenuItem[] items = rightClickMenu.getItems(); + for (int i = 0; i < items.length; i++) { + items[i].dispose(); + } + + if (((StructuredSelection) viewerSelection).getFirstElement() instanceof StrategyElement) { + strategyMenu(rightClickMenu); + } + + if (((StructuredSelection) viewerSelection).getFirstElement() instanceof StrategyElement) { + strategySetMenu(rightClickMenu); + } + + } + }); + + } + + /** + * Create the menu item controlling the removal of the selected strategies + * + * @param associatedMenu + * The parent menu + */ + private void strategyMenu(Menu associatedMenu) { + final MenuItem configurationItem = new MenuItem(associatedMenu, SWT.NONE); + configurationItem.setText(Messages.RemoveStrategy_Label); + configurationItem.setImage(Activator.getDefault().getImage(Messages.RemoveStrategy_IconPath)); + configurationItem.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + StrategySet customSet = (StrategySet) getViewerInput().getResources().get(0).getContents().get(0); + Collection strategiesToRemove = new LinkedList(); + + for (Object object : ((StructuredSelection) viewerSelection).toArray()) { + if (object instanceof StrategyElement) { + strategiesToRemove.add((StrategyElement) object); + } + } + + for (StrategyElement strategy : strategiesToRemove) { + customSet.getStrategies().remove(strategy); + viewerStrategies.remove(strategy.getId()); + } + + } + }); + } + + /** + * Create the menu item controlling the removal of the selected model + * + * @param associatedMenu + * The parent menu + */ + private void strategySetMenu(Menu associatedMenu) { + final MenuItem strategySetItem = new MenuItem(associatedMenu, SWT.NONE); + strategySetItem.setText(Messages.RemoveAllStrategies_Label); + strategySetItem.setImage(Activator.getDefault().getImage(Messages.RemoveAllStrategies_IconPath)); + strategySetItem.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + StrategySet customSet = (StrategySet) getViewerInput().getResources().get(0).getContents().get(0); + + for (StrategyElement strategy : getViewerStrategySet().getStrategies()) { + viewerStrategies.remove(strategy.getId()); + } + + customSet.getStrategies().clear(); + + } + }); + } + + /** + * @return + * The viewer + */ + public TreeViewer getViewer() { + return treeViewer; + } + + /** + * Initialize the listener used to retrieve the selected items + */ + protected void initStrategySelectionListener() { + selectionChangedListener = new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + viewerSelection = event.getSelection(); + } + }; + } + + /** + * Initialize the viewer contents + */ + protected void initViewer() { + customStrategySetResourceSet = new ResourceSetImpl(); + // configurationResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMLResourceFactoryImpl()); + // configurationResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl()); + + // Default behavior + initFromScratch(); + + getViewer().refresh(); + } + + /** + * Create the viewer contents if no previous activity/selection existed + */ + private void initFromScratch() { + // Only launch if there were no previously constructed resource + // Creates the root object for the custom model + customStrategySet = newModelFactory.createStrategySet(); + customStrategySet.setId("CustomConfiguration"); //$NON-NLS-1$ + // Empty resourceSet to be filled by the custom selection of the user + URI fileURI = CommonPlugin.resolve(URI.createFileURI(Platform.getLocation().toOSString() + "/Custom.propertylifecyclestrategyset")); //$NON-NLS-1$ + // URI fileURI = URI.createFileURI(Platform.getLocation().toOSString() + "/Custom.renamestrategiesconfigurations"); //$NON-NLS-1$ + strategySetResource = customStrategySetResourceSet.createResource(fileURI, PropertylifecyclePackage.eCONTENT_TYPE); + strategySetResource.getContents().add(customStrategySet); + + getViewer().setInput(customStrategySetResourceSet); + + expandToLevel(1); + } + + /** + * Utility method used to expand the tree + * + * @param level + * The required level + */ + private void expandToLevel(int level) { + // Search the tree for the Set and expand from there to reveal the strategies if any exists + getViewer().expandToLevel(getViewerInput().getResources().get(0), level); + } + + /** + * @return + * The viewer's contents + */ + public ResourceSet getViewerInput() { + Object viewerInput = getViewer().getInput(); + if (viewerInput instanceof ResourceSet) { + return ((ResourceSet) viewerInput); + } + return null; + } + + /** + * Add method, pointing to {@link #addStrategies(Collection)} + * + * @param selection + * The selected items from another viewer + */ + public void addStrategies(ISelection selection) { + if (!(selection instanceof StructuredSelection)) { + return; + } + Collection selectedElements = ((StructuredSelection) selection).toList(); + + addStrategies(selectedElements); + } + + /** + * Add method, pointing to {@link #addStrategies(Collection)} + * + * @param resourceSet + * The selected items from another source + */ + public void addStrategies(ResourceSet resourceSet) { + Collection resources = new LinkedList(); + for (Resource resource : resourceSet.getResources()) { + resources.add(resource); + } + + addStrategies(resources); + } + + /** + * Main add method + * + * @param selection + * The selected strategies + */ + public void addStrategies(Collection selection) { + // Copy of the selection to update as the cases are treated + Collection remainingSelection = new ArrayList(selection); + Collection selectedStrategies = new LinkedList(); + + // First - extract the strategies from the inputed resources and delete these from the remaining selection + for (Object object : selection) { + if (!(object instanceof Resource)) { + continue; + } + + for (Object resourceContent : ((Resource) object).getContents()) { + if (!(resourceContent instanceof StrategySet)) { + continue; + } + + // This will only be the case if the user has selected both the resource and the contained set + StrategySet strategySet = (StrategySet) resourceContent; + if (remainingSelection.contains(strategySet)) { + // In this case, the configurations of the set will be revealed by getContentConfigurations + remainingSelection.remove(strategySet); + } + + List newStrategies = getContentStrategies(resourceContent); + // This will only be the case if the user has selected both the resource and the contained configuration + for (StrategyElement strategy : newStrategies) { + if (remainingSelection.contains(strategy)) { + remainingSelection.remove(strategy); + } + } + + selectedStrategies.addAll(newStrategies); + } + + if (remainingSelection.contains(object)) { + remainingSelection.remove(object); + } + } + + // Second - extract the strategies from the inputed sets and delete those from the remaining selection + List postResourceSelection = new ArrayList(remainingSelection); + for (Object object : postResourceSelection) { + if (!(object instanceof StrategySet)) { + continue; + } + + List newStrategies = getNewStrategySetStrategies((StrategySet) object); + // This case will occur if the user has selected a set and some of its contained configurations + for (StrategyElement strategy : newStrategies) { + if (remainingSelection.contains(strategy)) { + remainingSelection.remove(strategy); + } + } + + selectedStrategies.addAll(newStrategies); + } + + // Lastly - extract the remaining strategies to complete the selection + for (Object object : remainingSelection) { + if (!(object instanceof StrategyElement)) { + continue; + } + + StrategyElement remainigStrategy = (StrategyElement) object; + if (!(viewerStrategies.containsKey(remainigStrategy.getId()))) { + viewerStrategies.put(remainigStrategy.getId(), remainigStrategy); + selectedStrategies.add(remainigStrategy); + } + } + + populateViewer(selectedStrategies); + } + + /** + * Used to extract the strategies from the set @see RenameSetConfiguration + * + * @param object + * The set + * @return + * The list of the contained strategies or an empty list + */ + private List getContentStrategies(Object object) { + List contentStrategies = new LinkedList(); + if (object instanceof StrategySet) { + return getNewStrategySetStrategies((StrategySet) object); + } + + return contentStrategies; + } + + /** + * Used to extract the strategies from the set @see RenameSetConfiguration + * + * @param strategySet + * The set + * @return + * The list of the contained strategies + */ + private List getNewStrategySetStrategies(StrategySet strategySet) { + List newStrategies = new LinkedList(); + for (StrategyElement strategy : strategySet.getStrategies()) { + if (viewerStrategies.containsKey(strategy.getId())) { + continue; + } + + viewerStrategies.put(strategy.getId(), strategy); + newStrategies.add(strategy); + } + + return newStrategies; + } + + /** + * Populates the viewer with the inputed strategies + * + * @param strategies + * The selected strategies + */ + private void populateViewer(Collection strategies) { + + for (StrategyElement strategy : strategies) { + setParentModelsURI(strategy); + + // This will remove the configuration from the left viewer to add it to the right one + // newRenameSetConfiguration.getConfigurations().add((RenameConfiguration) configuration); + + // getViewerStrategySet().getStrategies().add(AdvancedTabViewerUtils.getnewStrategy(strategy)); + getViewerStrategySet().getStrategies().add(AdvancedTabViewerUtils.cloneStrategy(strategy)); + viewerStrategies.put(strategy.getId(), strategy); + } + + // Search the tree for the Set and expand one more level from there + if (!getViewer().getExpandedState(getViewerStrategySet()) || !getViewer().getExpandedState(customStrategySetResourceSet)) { + getViewer().expandToLevel(getViewerStrategySet(), 1); + } + getViewer().refresh(); + } + + /** + * Add the URI of the model containing the added strategy to the list of handled models + * + * @param renameConfiguration + * The added strategy + */ + private void setParentModelsURI(StrategyElement strategy) { + StrategySet strategySet = (StrategySet) strategy.eContainer(); + String setURI = strategySet.eResource().getURI().toString(); + // if (!parentModels.contains(setURI)) { + // parentModels.add(setURI); + // } + if (!parentModels.containsKey(strategy.getId())) { + parentModels.put(strategy.getId(), setURI); + } + } + + /** + * @return + * The parent models of the selected strategies + */ + public Collection getParentModels() { + HashSet usedModels = new HashSet(); + for (String key : parentModels.keySet()) { + usedModels.add(parentModels.get(key)); + } + + return usedModels; + } + + /** + * Remove the selected configurations from the viewer and their associated model from the parent list of necessary + */ + protected void removeSelectedStrategies() { + @SuppressWarnings("unchecked") + List strategiesToRemove = viewerSelection instanceof StructuredSelection ? ((StructuredSelection) viewerSelection).toList() : new LinkedList(); + getViewerStrategySet().getStrategies().removeAll(strategiesToRemove); + for (StrategyElement renameConfiguration : strategiesToRemove) { + viewerStrategies.remove(renameConfiguration.getId()); + parentModels.keySet().removeAll(Collections.singleton(renameConfiguration.getId())); + } + + getViewer().refresh(); + } + + /** + * @return + * The strategy set build inside this viewer + */ + private StrategySet getViewerStrategySet() { + if (getViewerInput().getResources().get(0).getContents().get(0) instanceof StrategySet) { + return (StrategySet) getViewerInput().getResources().get(0).getContents().get(0); + } + return null; + } + + /** + * @return + * The strategies selected in this viewer + */ + public Collection getViewerStrategies() { + return getViewerStrategySet().getStrategies(); + } + + /** + * Clear all the strategies from the viewer and their associated lists + */ + protected void removeAllStrategies() { + getViewerStrategies().clear(); + viewerStrategies.clear(); + parentModels.clear(); + + getViewer().refresh(); + } + + /** + * @return + * The resource containing the strategy set build inside this viewer + */ + public Resource getStrategiesModelResource() { + return strategySetResource = getViewerInput().getResources().get(0); + } + + /** + * @return + * The state of the viewer + */ + protected boolean isEmpty() { + // The second condition can be achieved if the user added an empty selection to an empty tree + if (getViewer().getTree().getItems().length > 0 && customStrategySet != null) { + return false; + } + return true; + } + + + // TODO implement dispose() + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/BasicTab.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/BasicTab.java new file mode 100755 index 00000000000..72864d16d85 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/BasicTab.java @@ -0,0 +1,413 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.pages; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Map; +import java.util.Set; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CheckboxCellEditor; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.BrowseButton; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; + +/** + * Handle the creation of the basic tab of the preference page + * + */ +public class BasicTab implements SelectionListener { + + /** Viewer displaying the strategy models declared in the registry by extension or imported by the user */ + protected TableViewer tableViewer; + + /** The table contained in the viewer */ + protected Table table; + + /** The composite containing the buttons controlling the selection and browsing */ + protected Composite controlComposite; + + /** Select all the models */ + protected Button selectAllButton; + + /** Deselect all the models */ + protected Button deselectAllButton; + + /** Map of the selected models */ + protected Map selectedModels; + + /** Color indicating a selected model or used in the advanced tab */ + protected Color colorBlack = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); + + /** Color indicating an unselected model */ + protected Color colorGrey = Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY); + + /** + * + * Constructor. + * + * @param parent + * The parent composite + * @param style + */ + public BasicTab(CTabFolder parent, int style) { + CTabItem basicTabItem = new CTabItem(parent, SWT.NONE); + basicTabItem.setText("Basic Selection"); + + selectedModels = new HashMap(); + Composite basicTabComposite = new Composite(parent, style); + basicTabComposite.setLayout(new GridLayout(2, false)); + basicTabComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + basicTabItem.setControl(basicTabComposite); + + createTableViewer(basicTabComposite); + createControlsComposite(basicTabComposite); + } + + /** + * Create the viewer + * + * @param parent + * The parent composite + */ + private void createTableViewer(final Composite parent) { + table = new Table(parent, SWT.MULTI | SWT.BORDER); + tableViewer = new TableViewer(table); + table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + tableViewer.setContentProvider(new ArrayContentProvider() { + + @Override + /** Override used to get the list of the displayed resource in order to */ + public Object[] getElements(Object inputElement) { + Collection resources = new LinkedList(); + if (inputElement instanceof ResourceSet) { + for (Resource resource : ((ResourceSet) inputElement).getResources()) { + resources.add(resource); + } + return resources.toArray(); + } + return super.getElements(inputElement); + } + }); + + table.setHeaderVisible(true); + table.setLinesVisible(true); + + TableViewerColumn checkbox = createTableViewerColumn("", 22, tableViewer); + checkbox.getColumn().setResizable(false); + checkbox.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + return ""; //$NON-NLS-1$ + } + + @Override + // Set the toggle boxes + public Image getImage(Object element) { + if (selectedModels.containsKey(element)) { + return Activator.getDefault().getImage(Messages.Checked_IconPath); + } else { + return Activator.getDefault().getImage(Messages.Unchecked_IconPath); + } + } + }); + // Set the toggle boxes behavior + checkbox.setEditingSupport(new EditingSupport(tableViewer) { + + private CheckboxCellEditor checkboxCellEditor; + + @Override + protected CellEditor getCellEditor(Object element) { + // The new visual + checkboxCellEditor = new CheckboxCellEditor(parent, SWT.CHECK | SWT.READ_ONLY); + return checkboxCellEditor; + } + + @Override + protected boolean canEdit(Object element) { + // Always true + return true; + } + + @Override + protected Object getValue(Object element) { + // Check if the model is currently selected + return selectedModels.containsKey(element); + } + + @Override + protected void setValue(Object element, Object value) { + Resource resource = element instanceof Resource ? ((Resource) element) : null; + // This line's object object is not correctly formated + if (resource == null) { + return; + } + + // Update the list of selected models + if (checkboxCellEditor.getValue() == Boolean.TRUE) { + selectedModels.put(resource, resource.getURI().lastSegment()); + } else { + selectedModels.remove(resource); + } + + // Update the visual of the table + tableViewer.update(element, null); + } + }); + + + TableViewerColumn modelColumn = createTableViewerColumn("model", 300, tableViewer); + modelColumn.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + // Get the name of the file handled + return element instanceof Resource ? ((Resource) element).getURI().lastSegment().toString() : super.getText(element); + } + }); + + TableViewerColumn descriptionColumn = createTableViewerColumn("description", 300, tableViewer); + descriptionColumn.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + // Get the description, if any, of the model + Resource resource = element instanceof Resource ? ((Resource) element) : null; + Object setResource = resource.getContents().get(0); + return setResource instanceof StrategySet ? ((StrategySet) setResource).getDecription() : "N/A"; + } + }); + } + + /** + * Color scheme of the lines + * + * @param lastSegs + * The file names + */ + protected void setItemColor(Set lastSegs) { + for (TableItem item : table.getItems()) { + String lastSeg = item.getData() instanceof Resource ? ((Resource) item.getData()).getURI().lastSegment() : "NA"; + if (lastSegs.contains(lastSeg)) { + item.setForeground(1, colorBlack); + item.setForeground(2, colorBlack); + // item.setForeground(null); + } else { + item.setForeground(1, colorGrey); + item.setForeground(2, colorGrey); + } + } + } + + /** + * Generic creator of the columns + * + * @param header + * The name of the column + * @param width + * The width of the column + * @param parentViewer + * The associated viewer + * @return + * The new {@link #org.eclipse.jface.viewers.TableViewerColumn column} + */ + protected TableViewerColumn createTableViewerColumn(String header, int width, TableViewer parentViewer) { + TableViewerColumn newColumn = new TableViewerColumn(parentViewer, SWT.BORDER); + TableColumn column = newColumn.getColumn(); + column.setWidth(width); + column.setText(header); + column.setResizable(true); + column.setMoveable(false); + + return newColumn; + } + + /** + * Create the control composite containing the selection and browsing buttons + * + * @param parent + * The parent composite + */ + protected void createControlsComposite(Composite parent) { + controlComposite = new Composite(parent, SWT.NONE); + controlComposite.setLayout(new GridLayout(1, true)); + GridData controlLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + controlComposite.setLayoutData(controlLayoutData); + + selectAllButton = new Button(controlComposite, SWT.PUSH); + selectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + selectAllButton.addSelectionListener(this); + selectAllButton.setToolTipText(Messages.SelectAllButton_Label); + selectAllButton.setText(Messages.SelectAllButton_Label); + + deselectAllButton = new Button(controlComposite, SWT.PUSH); + deselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + deselectAllButton.addSelectionListener(this); + deselectAllButton.setToolTipText(Messages.DeselectAllButton_Label); + deselectAllButton.setText(Messages.DeselectAllButton_Label); + + new BrowseButton(controlComposite, getViewer()); + } + + /** + * Link the selection events with the correct methods + * + * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) + * + * @param e + * The selection event + */ + @Override + public void widgetSelected(SelectionEvent e) { + if (e.widget == selectAllButton) { + selectAllAction(); + } else if (e.widget == deselectAllButton) { + deselectAllAction(); + } + } + + /** + * Select all the items present in the viewer + */ + public void selectAllAction() { + for (TableItem item : table.getItems()) { + Resource resource = (Resource) item.getData(); + selectedModels.put(resource, resource.getURI().lastSegment()); + getViewer().update(resource, null); + } + } + + /** + * Deselect all the models present in the viewer + */ + public void deselectAllAction() { + for (TableItem item : table.getItems()) { + Resource resource = (Resource) item.getData(); + selectedModels.remove(resource); + getViewer().update(resource, null); + } + } + + /** + * Method used to initialize the selection in the viewer based on the current preferences + * + * @param filePaths + * The currently active strategy models' {@link #org.eclipse.emf.common.util.URI URI} + */ + public void initSelection(Collection filePaths) { + for (String filePath : filePaths) { + String preferenceKey = (URI.createPlatformPluginURI(filePath, true)).lastSegment(); + for (TableItem item : table.getItems()) { + Resource resource = (Resource) item.getData(); + String resourceKey = resource.getURI().lastSegment(); + + if (preferenceKey.equals(resourceKey)) { + selectedModels.put(resource, resourceKey); + getViewer().update(resource, null); + } + } + } + } + + /** + * Clear any selected models that are not declared in the registry and reset the selection to the default state + * + * @param registryResourceSet + * The {@link #org.eclipse.emf.ecore.resource.ResourceSet resourceSet} containing the models + */ + public void removeNonRegistryModels(ResourceSet registryResourceSet) { + table.clearAll(); + selectedModels.clear(); + tableViewer.setInput(registryResourceSet); + selectAllAction(); + } + + /** + * Convenience method used to initialize the viewer from the parent Composite + */ + public void defaultSelection() { + selectAllAction(); + } + + /** + * @return + * The selected models + */ + public Collection getSelectedModels() { + Collection selectedModelsURI = new LinkedList(); + for (Resource resource : selectedModels.keySet()) { + selectedModelsURI.add(resource.getURI().toString()); + } + + return selectedModelsURI; + } + + /** + * @return + * The selected models' strategies + */ + public HashSet getSelectedStrategies() { + HashSet selectedStrategies = new HashSet(); + for (Resource resource : selectedModels.keySet()) { + if (resource.getContents().get(0) instanceof StrategySet) { + selectedStrategies.addAll(((StrategySet) resource.getContents().get(0)).getStrategies()); + } + } + + return selectedStrategies; + } + + /** + * Convenience method + * + * @return + * This composite's Viewer + */ + public StructuredViewer getViewer() { + return tableViewer; + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + // nothing + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/PropertyLifecyclePageComposite.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/PropertyLifecyclePageComposite.java new file mode 100755 index 00000000000..5b1546a04aa --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/PropertyLifecyclePageComposite.java @@ -0,0 +1,248 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.pages; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.eclipse.emf.common.util.URI; +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.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.model.registries.StrategySetRegistry; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.BrowserUtils; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.PropertyLifecyclePreferencesManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; + + +/** + * This Composite is the root of the Basic and Advanced Tabs showing the selected and possible strategies + * + */ +public class PropertyLifecyclePageComposite extends CTabFolder { + + /** This collection contains the resources referenced in an extension and retrievable from the registry */ + private Collection registryResources; + + /** This tab will show the entire resources as a whole entity */ + protected BasicTab basicTab; + + /** In this tab the resources will display all the underlying strategies for the user to choose from */ + protected AdvancedTab advancedTab; + + // BEGIN TEST-GREYOUT + /** This set is used to visualize the currently selected strategies */ + private Set handledStrategyRepositories = new HashSet(); + // END TEST-GREYOUT + + + /** + * + * Constructor. + * + * @param parent + * The parent composite used to harbor this one + * @param style + * The border style of this composite + */ + public PropertyLifecyclePageComposite(Composite parent, int style) { + super(parent, style); + this.setLayout(new GridLayout()); + this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + createBasicTab(); + createAdvancedTab(); + + initViewers(); + this.setSelection(0); + } + + /** + * Creates the Basic selection tab + */ + private void createBasicTab() { + basicTab = new BasicTab(this, SWT.BORDER) { + // BEGIN TEST-GREYOUT + @Override + public void selectAllAction() { + super.selectAllAction(); + getSelectedStrategyRepositories(); + } + + @Override + public void deselectAllAction() { + super.deselectAllAction(); + getSelectedStrategyRepositories(); + } + }; + + basicTab.getViewer().addSelectionChangedListener(new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + getSelectedStrategyRepositories(); + } + }); + // END TEST-GREYOUT + } + + /** + * Creates the advanced selection tab + */ + private void createAdvancedTab() { + advancedTab = new AdvancedTab(this, SWT.BORDER) { + // BEGIN TEST-GREYOUT + @Override + public void widgetSelected(SelectionEvent e) { + super.widgetSelected(e); + getSelectedStrategyRepositories(); + } + // END TEST-GREYOUT + }; + } + + /** + * Call the necessary methods to populate the basic and advanced tabs + */ + private void initViewers() { + // clearViewers(); + + // Load the Registry strategySet models as a default behavior + addRegistryStrategiesToViewers(); + + // Retrieve the previous preferences + PropertyLifecyclePreferencesManager preferencesManager = new PropertyLifecyclePreferencesManager(); + BrowserUtils.addBrowsedModel(preferencesManager.retrieveAdvancedTabModelPaths(), advancedTab.getLeftViewer()); + BrowserUtils.addBrowsedModel(preferencesManager.retrieveBasicTabModelPaths(), basicTab.getViewer()); + + // Initialize the viewers' selections + basicTab.initSelection(preferencesManager.retrieveBasicTabModelPaths()); + if (!preferencesManager.nodeExists(Messages.BasicBrowsedModels_Node)) { + // The Default behavior, if the user has not deactivated all the models, is to preselect all + // basicTab.defaultSelection(); + } + advancedTab.addStrategies(preferencesManager.retrieveAdvancedTabStrategies()); + + getSelectedStrategyRepositories(); + } + + /** + * Retrieve the resources referenced in the registry + */ + private void addRegistryStrategiesToViewers() { + ResourceSet resourceSet = new ResourceSetImpl(); + registryResources = new HashSet(); + Map strategySets = StrategySetRegistry.getInstance().getStrategySets(); + if (strategySets != null) { + for (String setKey : strategySets.keySet()) { + StrategySet strategySet = strategySets.get(setKey); + resourceSet.getResources().add(strategySet.eResource()); + registryResources.add(strategySet.eResource()); + } + } + + advancedTab.getLeftViewer().setInput(resourceSet); + basicTab.getViewer().setInput(resourceSet); + } + + /** + * Clear the viewers to their default state + */ + public void resetViewers() { + ResourceSet resourceSet = new ResourceSetImpl(); + resourceSet.getResources().addAll(registryResources); + + advancedTab.removeAllSelectionCompositeStrategies(); + advancedTab.setRegisteredCompositeInput(resourceSet); + basicTab.removeNonRegistryModels(resourceSet); + } + + /** + * Get the adresses of the selected resources from the basic tab + * + * @return + */ + public Collection getBasicParentModels() { + return basicTab.getSelectedModels(); + } + + /** + * Get the resulting selected strategies from the selected resources + * + * @return + */ + public Collection getBasicStrategies() { + return basicTab.getSelectedStrategies(); + } + + /** + * Get the adresses of the selected resources from the advanced tab + * + * @return + */ + public Collection getAdvancedParentModels() { + return advancedTab.getAdvancedParentModels(); + } + + /** + * Get the resulting strategies from the selected resources + * + * @return + */ + public Collection getAdvancedStrategies() { + return advancedTab.getAdvancedStrategies(); + } + + /** + * Get the currently selected resources and initiate the corresponding visual representation + * + * @return + * The list of the selected addresses + */ + private Set getSelectedStrategyRepositories() { + handledStrategyRepositories.clear(); + if (advancedTab.rightViewerComposite == null || basicTab == null) { + return new HashSet(); + } + + for (String modelName : advancedTab.rightViewerComposite.getParentModels()) { + URI test = URI.createFileURI(modelName); + handledStrategyRepositories.add(test.lastSegment()); + } + for (String modelName : basicTab.getSelectedModels()) { + URI test = URI.createFileURI(modelName); + handledStrategyRepositories.add(test.lastSegment()); + } + + Activator.log.trace(Activator.STRATEGY_PREFERENCES_TRACE, handledStrategyRepositories.toString()); + basicTab.setItemColor(handledStrategyRepositories); + return handledStrategyRepositories; + } + + // TODO implement dispose() + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/PropertyLifecyclePreferencesPage.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/PropertyLifecyclePreferencesPage.java new file mode 100755 index 00000000000..1830ad5d441 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/pages/PropertyLifecyclePreferencesPage.java @@ -0,0 +1,113 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.pages; + + +//import org.eclipse.jface.action.Action; +//import org.eclipse.papyrus.infra.propertylifecycle.preferences.utils.ConvertEcoreToUML; + +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.PropertyLifecyclePreferencesManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * Preference Page initiating the creation of its contents and the update of the selected preferences + * + */ +public class PropertyLifecyclePreferencesPage extends PreferencePage implements IWorkbenchPreferencePage { + + /** The preferenceManager used to handle the previous and current preferences on the strategies */ + private PropertyLifecyclePreferencesManager preferencesManager = new PropertyLifecyclePreferencesManager(); + + /** The root composite containing the page's contents */ + private PropertyLifecyclePageComposite propertyLifecyclePageComposite; + + /** + * Constructor. + */ + public PropertyLifecyclePreferencesPage() { + super(Messages.PropertyLifecycle_PreferencePage_Title, Activator.getDefault().getImageDescriptor("/icons/papyrus.png")); //$NON-NLS-1$ + } + + /** + * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) + * + * @param workbench + */ + @Override + public void init(IWorkbench workbench) { + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + setDescription(Messages.Choose_Configuration); + } + + /** + * Method used to initialize the composite before applying the visual effects linked to the selected strategies + * + * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) + * + * @param parent + * @return + * parent + */ + @Override + public Control createContents(Composite parent) { + initializeDialogUnits(parent); + propertyLifecyclePageComposite = new PropertyLifecyclePageComposite(parent, SWT.NONE); + return parent; + } + + /** + * Get all the selected strategies and register them through the PreferenceManager + * + * @see org.eclipse.jface.preference.PreferencePage#performApply() + * + */ + @Override + protected void performApply() { + preferencesManager.registerCurrentPreferences( + propertyLifecyclePageComposite.getBasicParentModels(), + propertyLifecyclePageComposite.getAdvancedParentModels(), + propertyLifecyclePageComposite.getBasicStrategies(), + propertyLifecyclePageComposite.getAdvancedStrategies()); + + // ConvertEcoreToUML convertDialog = new ConvertEcoreToUML(); + // convertDialog.run(new Action() { + // }); + + super.performApply(); + } + + /** + * @see org.eclipse.jface.preference.PreferencePage#performDefaults() + * + */ + @Override + protected void performDefaults() { + preferencesManager.clearPreferences(); + propertyLifecyclePageComposite.resetViewers(); + + super.performDefaults(); + } + + @Override + public void performHelp() { + // do something ? + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/AdvancedTabLabelProvider.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/AdvancedTabLabelProvider.java new file mode 100755 index 00000000000..1bc58d072be --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/AdvancedTabLabelProvider.java @@ -0,0 +1,109 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.utils; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.papyrus.propertylifecycle.ElementContainer; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.swt.graphics.Image; + +/** + * Class used to specialize the label provider of the advanced tab viewers + * + */ +public class AdvancedTabLabelProvider extends AdapterFactoryLabelProvider { + + /** + * Constructor. + * + * @param adapterFactory + * The factory used as a base + */ + public AdvancedTabLabelProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider#getText(java.lang.Object) + * + * @param object + * The viewer element + * @return + * The labels to be displayed + */ + @Override + public String getText(Object object) { + StringBuilder label = new StringBuilder(); + + if (object instanceof Resource) { + return ((Resource) object).getURI().lastSegment(); + } + if (object instanceof StrategyElement) { + label.append(Messages.StrategyElement_Label); + String elementType = ((StrategyElement) object).getBaseType(); + label.append(elementType); + return label.toString(); + } + if (object instanceof ElementProperty) { + label.append(Messages.ElementProperty_Label); + String featureLabel = ((ElementProperty) object).getFeatureLabel(); + label.append(featureLabel); + return label.toString(); + } + if (object instanceof ElementContainer) { + label.append(Messages.ElementContainer_Label); + String containerType = ((ElementContainer) object).getBaseType(); + label.append(containerType); + return label.toString(); + } + + return super.getText(object); + } + + /** + * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider#getImage(java.lang.Object) + * + * @param object + * The viewer element + * @return + * The image to be displayed + */ + @Override + public Image getImage(Object object) { + if (object instanceof Resource) { + return Activator.getDefault().getImage(Messages.Resource_IconPath); + } + if (object instanceof StrategySet) { + return Activator.getDefault().getImage(Messages.StrategySet_IconPath); + } + if (object instanceof StrategyElement) { + return Activator.getDefault().getImage(Messages.Strategy_IconPath); + } + if (object instanceof ElementProperty) { + return Activator.getDefault().getImage(Messages.Property_IconPath); + } + if (object instanceof ElementContainer) { + return Activator.getDefault().getImage(Messages.ElementContainer_IconPath); + } + + return super.getDefaultImage(object); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/AdvancedTabViewerUtils.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/AdvancedTabViewerUtils.java new file mode 100755 index 00000000000..b56abf13c8d --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/AdvancedTabViewerUtils.java @@ -0,0 +1,43 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.utils; + +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; + +/** + * Convenience class used to create the custom model and its strategies + * + */ +public class AdvancedTabViewerUtils { + + /** The factory from which all the strategies are spawned */ + protected static PropertylifecycleFactory newModelFactory = PropertylifecycleFactory.eINSTANCE; + + /** + * Clone the selected strategy in the custom model + * + * @param selectedStrategy + * The selected strategy + * @return + * The cloned strategy + */ + public static StrategyElement cloneStrategy(StrategyElement selectedStrategy) { + StrategyElement clonedStrategy = EcoreUtil.copy(selectedStrategy); + + return clonedStrategy; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/BrowseButton.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/BrowseButton.java new file mode 100755 index 00000000000..cb69009f7ac --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/BrowseButton.java @@ -0,0 +1,117 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.utils; + +import java.io.File; +import java.util.Collection; +import java.util.LinkedList; + +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; + +/** + * Class used to create the browser button and its associated window + * + */ +public class BrowseButton { + + /** The file extensions */ + private static String[] filterExtensions = { "*.propertylifecycle", "*" }; //$NON-NLS-1$ //$NON-NLS-2$ + + /** Their associated names in the window's scrolling menu */ + private static String[] filterExtensionsNames = { "Strategies Sets", "All" }; //$NON-NLS-1$ //$NON-NLS-2$ + + /** The button's parent composite */ + protected Composite parent; + + /** The viewer to receive the fetched model */ + protected Viewer viewer; + + + /** + * Constructor. + * + * @param parent + * @param viewer + */ + public BrowseButton(final Composite parent, final Viewer viewer) { + this.parent = parent; + this.viewer = viewer; + + createBrowserButton(this.parent); + // TODO implement a link to grey-out the imported model + } + + /** + * @return + * The browser button used to fetch the strategy models from the user's disk and add it is not already loaded + */ + public Button createBrowserButton(Composite parent) { + Button browseButton = new Button(parent, SWT.NONE); + // browseButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); + browseButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + browseButton.setText(Messages.BrowseButton_Label); + + browseButton.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + + FileDialog dialog = new FileDialog(parent.getShell(), SWT.MULTI); + dialog.setText(Messages.SystemSelectionDialog_Title); + dialog.setFilterExtensions(filterExtensions); + dialog.setFilterNames(filterExtensionsNames); + + Collection newSystemPaths = new LinkedList(); + Collection existingResources = BrowserUtils.getViewerResources(viewer); + + String dialogResult = dialog.open(); + if (dialogResult == null) { + return; + } + // Settings - Store the last folder/directory visited + String[] names = dialog.getFileNames(); + + // Empty the list to avoid remembering old selections + for (int i = 0, n = names.length; i < n; i++) { + StringBuffer buf = new StringBuffer(dialog.getFilterPath()); + if (buf.charAt(buf.length() - 1) != File.separatorChar) { + buf.append(File.separatorChar); + } + buf.append(names[i]); + + if (existingResources.contains(names[i])) { + continue; + } + + newSystemPaths.add(buf.toString()); + } + + BrowserUtils.addBrowsedModel(newSystemPaths, viewer); + } + }); + + return browseButton; + } + + + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/BrowserUtils.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/BrowserUtils.java new file mode 100755 index 00000000000..bbe897953f0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/BrowserUtils.java @@ -0,0 +1,156 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.utils; + +import java.io.IOException; +import java.util.Collection; +import java.util.LinkedList; + +import org.eclipse.emf.common.CommonPlugin; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +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.jface.viewers.Viewer; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; + +/** + * Convenience class regrouping methods to retrieve model resources + * + */ +public class BrowserUtils { + + /** + * Add the browsed models to the viewer + * + * @param newSystemPaths + * The selected models' paths + * @param viewer + * The viewer that will receive these new models + */ + public static void addBrowsedModel(Collection newSystemPaths, Viewer viewer) { + + for (String filePath : newSystemPaths) { + Resource resource = getModelResource(filePath); + if (resource == null || getViewerResources(viewer).contains(resource.getURI().lastSegment())) { + continue; + } + + EObject content = resource.getContents().get(0); + if (content instanceof StrategySet) { + // Preferences browsedNode = renamePreferences.node(Messages.BrowsedModels_Node); + // browsedNode.putBoolean(filePath, true); + addNewModel(resource, viewer); + } + } + + viewer.refresh(); + } + + /** + * @param filePath + * The path of the selected model + * @return + * The resource associated to this path or null if none can be retrieved + */ + public static Resource getModelResource(String filePath) { + URI fileURI = CommonPlugin.resolve(URI.createFileURI(filePath)); + // URI fileURI = URI.createFileURI(filePath); + ResourceSet resourceSet = new ResourceSetImpl(); + Resource resource = resourceSet.createResource(fileURI); + + try { + resource.load(null); + return resource; + } catch (IOException ioerror) { + Activator.log.error(ioerror); + } + return null; + } + + /** + * @param filePath + * The path of the selected model + * @return + * The strategy set associated to this path or null if none can be found + */ + public static StrategySet getStrategySet(String filePath) { + Resource resource = getModelResource(filePath); + if (resource == null) { + return null; + } + EObject eObject = resource.getContents().get(0); + + if (eObject instanceof StrategySet) { + return (StrategySet) eObject; + } + + return null; + } + + /** + * @param viewer + * The viewer receiving the inputed resource + * @return + * The viewer's current contents @see org.eclipse.emf.ecore.resource.ResourceSet + */ + public static ResourceSet getViewerInput(Viewer viewer) { + Object viewerInput = viewer.getInput(); + if (viewerInput instanceof ResourceSet) { + return ((ResourceSet) viewerInput); + } + return null; + } + + /** + * @param viewer + * The viewer receiving the inputed resource + * @return + * The viewer's current contents' identifiers + */ + public static Collection getViewerResources(Viewer viewer) { + ResourceSet viewerInput = getViewerInput(viewer); + if (viewerInput == null) { + return new LinkedList(); + } + + Collection existingResources = new LinkedList(); + for (Resource resource : viewerInput.getResources()) { + // List used to verify that the user is not adding an existing model in the viewer + existingResources.add(resource.getURI().lastSegment()); + } + + return existingResources; + } + + /** + * Add the browsed resource to the viewer + * + * @param resource + * The selected resource + * @param viewer + * The viewer to receive this resource + */ + public static void addNewModel(Resource resource, Viewer viewer) { + if (getViewerInput(viewer) == null) { + viewer.setInput(resource.getResourceSet()); + return; + } + + getViewerInput(viewer).getResources().add(resource); + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/ConvertEcoreToUML.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/ConvertEcoreToUML.java new file mode 100755 index 00000000000..ee8385baf55 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/ConvertEcoreToUML.java @@ -0,0 +1,251 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.utils; + +// package org.eclipse.papyrus.rename.strategies.preferences.utils; +// +// import java.lang.reflect.InvocationTargetException; +// import java.util.ArrayList; +// import java.util.HashMap; +// import java.util.List; +// import java.util.Map; +// +// import org.eclipse.core.resources.IFile; +// import org.eclipse.core.runtime.IProgressMonitor; +// import org.eclipse.emf.common.command.UnexecutableCommand; +// import org.eclipse.emf.common.util.BasicDiagnostic; +// 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.EObject; +// import org.eclipse.emf.ecore.EPackage; +// import org.eclipse.emf.ecore.InternalEObject; +// 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.xmi.XMIResource; +// import org.eclipse.jface.action.IAction; +// import org.eclipse.jface.dialogs.ProgressMonitorDialog; +// import org.eclipse.jface.operation.IRunnableWithProgress; +// import org.eclipse.jface.viewers.ISelection; +// import org.eclipse.jface.viewers.StructuredSelection; +// import org.eclipse.jface.window.Window; +// import org.eclipse.swt.widgets.Shell; +// import org.eclipse.ui.PlatformUI; +// import org.eclipse.uml2.common.util.UML2Util; +// import org.eclipse.uml2.examples.uml.ui.UMLExamplesUIPlugin; +// import org.eclipse.uml2.examples.uml.ui.dialogs.Ecore2UMLConverterOptionsDialog; +// import org.eclipse.uml2.uml.Element; +// import org.eclipse.uml2.uml.UMLPlugin; +// import org.eclipse.uml2.uml.editor.dialogs.OptionsDialog; +// import org.eclipse.uml2.uml.resource.UMLResource; +// import org.eclipse.uml2.uml.util.UMLUtil; +// import org.eclipse.uml2.uml.util.UMLValidator; +// +// +// /** +// * Need only import org.eclipse.uml2.examples.uml.ui and activate the action in the RenameStrategiesPreferencePage +// * +// */ +// public class ConvertEcoreToUML extends org.eclipse.uml2.examples.uml.ui.actions.ConvertToUMLModelAction { +// +// @Override +// public void run(IAction action) { +// +// if (command != UnexecutableCommand.INSTANCE) { +// ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); +// +// IFile iFile = (IFile) ((StructuredSelection) selection).getFirstElement(); +// ResourceSet resourceSet = new ResourceSetImpl(); +// Resource resource = resourceSet.createResource(URI.createPlatformResourceURI(iFile.getFullPath().toString(), true)); +// +// EObject content = null; +// try { +// resource.load(null); +// content = resource.getContents().get(0); +// } catch (Exception e) { +// // do something +// } +// +// if (!(content instanceof EPackage)) { +// return; +// } +// +// final EPackage ePackage = (EPackage) content; +// +// final Shell shell = PlatformUI.getWorkbench() +// .getActiveWorkbenchWindow().getShell(); +// +// final Map options = new HashMap(); +// +// final String label = UMLExamplesUIPlugin.INSTANCE.getString( +// "_UI_ConvertToUMLActionCommand_label", //$NON-NLS-1$ +// new Object[] { getObjectLabel(ePackage) }); +// +// OptionsDialog optionsDialog = new Ecore2UMLConverterOptionsDialog( +// shell, label, UMLExamplesUIPlugin.INSTANCE +// .getString("_UI_OptionsDialog_message"), //$NON-NLS-1$ +// options); +// +// if (optionsDialog.open() == Window.OK) { +// IRunnableWithProgress runnableWithProgress = new IRunnableWithProgress() { +// +// @Override +// public void run(final IProgressMonitor progressMonitor) +// throws InvocationTargetException, +// InterruptedException { +// +// try { +// final BasicDiagnostic diagnostics = new BasicDiagnostic( +// UMLValidator.DIAGNOSTIC_SOURCE, 0, +// EcorePlugin.INSTANCE.getString( +// "_UI_DiagnosticRoot_diagnostic", //$NON-NLS-1$ +// new Object[] { getObjectLabel(ePackage) }), +// new Object[] { ePackage }); +// +// Map context = new HashMap(); +// context.put(UML2Util.QualifiedTextProvider.class, +// qualifiedTextProvider); +// +// progressMonitor.beginTask( +// UMLExamplesUIPlugin.INSTANCE.getString( +// "_UI_ConvertingToUML_message", //$NON-NLS-1$ +// new Object[] { getObjectLabel(ePackage) }), +// IProgressMonitor.UNKNOWN); +// +// Resource resource = ePackage.eResource(); +// ResourceSet resourceSet = resource.getResourceSet(); +// URI uri = resourceSet.getURIConverter().normalize( +// resource.getURI()).trimFileExtension() +// .trimSegments(1); +// +// List resources = new ArrayList(); +// +// for (org.eclipse.uml2.uml.Package package_ : UMLUtil +// .convertFromEcore(ePackage, options, +// diagnostics, context)) { +// +// resources.add(resource = resourceSet +// .createResource(uri.appendSegment( +// package_.getName()) +// .appendFileExtension( +// UMLResource.FILE_EXTENSION))); +// +// EList contents = resource +// .getContents(); +// +// contents.add(package_); +// +// for (TreeIterator allContents = UML2Util +// .getAllContents(package_, true, false); allContents +// .hasNext();) { +// +// EObject eObject = allContents.next(); +// +// if (eObject instanceof Element) { +// contents.addAll(((Element) eObject) +// .getStereotypeApplications()); +// } +// } +// +// if (UMLUtil.OPTION__PROCESS +// .equals(options +// .get(UMLUtil.Ecore2UMLConverter.OPTION__XMI_IDENTIFIERS)) +// && resource instanceof XMIResource) { +// +// XMIResource xmiResource = (XMIResource) resource; +// +// for (TreeIterator allContents = xmiResource +// .getAllContents(); allContents +// .hasNext();) { +// +// EObject eObject = allContents.next(); +// String xmiIdentifier = UML2Util +// .getXMIIdentifier((InternalEObject) eObject); +// +// if (diagnostics != null) { +// diagnostics +// .add(new BasicDiagnostic( +// Diagnostic.INFO, +// UMLValidator.DIAGNOSTIC_SOURCE, +// UMLUtil.Ecore2UMLConverter.XMI_IDENTIFIER, +// UMLPlugin.INSTANCE +// .getString( +// "_UI_Ecore2UMLConverter_ProcessXMIIdentifier_diagnostic", //$NON-NLS-1$ +// UML2Util +// .getMessageSubstitutions( +// context, +// eObject, +// xmiIdentifier)), +// new Object[] { eObject })); +// } +// +// xmiResource.setID(eObject, +// xmiIdentifier); +// } +// } +// } +// +// for (Resource r : resources) { +// +// try { +// r.save(null); +// } catch (Exception e) { +// UMLExamplesUIPlugin.INSTANCE.log(e); +// } +// } +// +// handleDiagnostic(progressMonitor.isCanceled() +// ? Diagnostic.CANCEL_INSTANCE +// : diagnostics, label); +// } finally { +// progressMonitor.done(); +// } +// } +// }; +// +// if (eclipseResourcesUtil != null) { +// runnableWithProgress = eclipseResourcesUtil +// .getWorkspaceModifyOperation(runnableWithProgress); +// } +// +// try { +// new ProgressMonitorDialog(shell).run(false, true, +// runnableWithProgress); +// } catch (Exception e) { +// UMLExamplesUIPlugin.INSTANCE.log(e); +// } +// } +// } +// } +// +// public String getObjectLabel(EObject eObject) { +// Resource eResource = eObject.eResource(); +// +// String text = ""; +// if (eResource != null) { +// String lastSegment = eResource.getURI() +// .lastSegment(); +// +// if (lastSegment != null) { +// text += " - " + lastSegment; //$NON-NLS-1$ +// } +// } +// +// return text; +// } +// +// } diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/PropertyLifecyclePreferencesManager.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/PropertyLifecyclePreferencesManager.java new file mode 100755 index 00000000000..dddfa8613f6 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/PropertyLifecyclePreferencesManager.java @@ -0,0 +1,359 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.utils; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import org.eclipse.core.runtime.preferences.ConfigurationScope; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.model.registries.StrategySetRegistry; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.osgi.service.prefs.BackingStoreException; +import org.osgi.service.prefs.Preferences; + +/** + * Convenience class used to handle the preferences in one place + * + */ +public class PropertyLifecyclePreferencesManager { + + /** Preference node containing the strategies informations */ + // private Preferences renamePreferences = InstanceScope.INSTANCE.getNode(Messages.PreferenceRenameStrategies); + // We need to retain the preferences through multiple restarts + private Preferences propertyLifecyclePreferences = ConfigurationScope.INSTANCE.getNode(Messages.PropertyLifecycleStrategies); + + // Basic Tab + /** Set containing the selected models in the basic tab viewer */ + private HashSet basicTabParentModels; + + /** Ids of the strategies contained in the selected models */ + private HashSet basicTabStrategiesIDs; + + /** Addresses of the selected models */ + private HashSet basicTabBrowsedModelsURI; + + /** strategies and their ids used to filter duplicates */ + private HashMap basicTabStrategies; + + // Advanced Tab + /** Set containing the selected models in the advanced tab viewer */ + private HashSet advancedTabParentModels; + + /** Ids of the selected strategies */ + private HashSet advancedTabStrategiesIDs; + + /** Addresses of the models containing the selected strategies */ + private HashSet advancedTabBrowsedModelsURI; + + /** Strategies and their ids used to filter duplicates */ + private HashMap advancedTabStrategies; + + + /** + * Build the skeleton of the future preference Node + * + * Constructor. + */ + public PropertyLifecyclePreferencesManager() { + basicTabParentModels = new HashSet(); + basicTabStrategiesIDs = new HashSet(); + basicTabBrowsedModelsURI = new HashSet(); + browseRegisteredPreferences(basicTabParentModels, basicTabStrategiesIDs, + basicTabBrowsedModelsURI, Messages.BasicBrowsedModels_Node, Messages.BasicSelectedStrategies_Node); + + advancedTabParentModels = new HashSet(); + advancedTabStrategiesIDs = new HashSet(); + advancedTabBrowsedModelsURI = new HashSet(); + browseRegisteredPreferences(advancedTabParentModels, advancedTabStrategiesIDs, + advancedTabBrowsedModelsURI, Messages.AdvancedBrowsedModels_Node, Messages.AdvancedSelectedStrategies_Node); + } + + /** + * + * @return + * The strategies preferences + */ + public Preferences getRenamePreferences() { + return propertyLifecyclePreferences; + } + + /** + * Parse the current preference Node and retrieve the associated informations on the models and their strategies + * + * @param parentModels + * The current models + * @param strategiesIDs + * The current strategies IDs + * @param browsedModelsURI + * The current models' URis + * @param modelNodePath + * The model node to parse + * @param strategiesNodePath + * The strategy node to parse + */ + private void browseRegisteredPreferences(HashSet parentModels, HashSet strategiesIDs, + HashSet browsedModelsURI, String modelNodePath, String strategiesNodePath) { + + try { + for (String childName : propertyLifecyclePreferences.childrenNames()) { + Preferences childNode = propertyLifecyclePreferences.node(childName); + if (childName.equalsIgnoreCase(modelNodePath)) { + for (String modelURI : childNode.keys()) { + browsedModelsURI.add(modelURI); + StrategySet model = BrowserUtils.getStrategySet(modelURI); + if (model != null) { + parentModels.add(model); + } + } + } + + if (childName.equalsIgnoreCase(strategiesNodePath)) { + for (String strategyID : childNode.keys()) { + strategiesIDs.add(strategyID); + } + } + + } + } catch (BackingStoreException bse) { + Activator.log.error(bse); + } + } + + /** + * Retrieve the strategy corresponding to an ID from the selected models + * + * @param strategyID + * The unique ID + * @param parentModels + * The selected models + * @param strategies + * The set containing the newly found pair + */ + private void getCorrespondigStrategy(String strategyID, HashSet parentModels, + HashMap strategies) { + for (StrategySet model : parentModels) { + for (StrategyElement strategy : model.getStrategies()) { + if (strategyID.equals(strategy.getId())) { + strategies.put(strategyID, strategy); + } + } + } + } + + /** + * @return + * The strategies from the basic tab + */ + public Collection retrieveBasicTabStrategies() { + basicTabStrategies = new HashMap(); + basicTabStrategiesIDs = new HashSet(); + basicTabBrowsedModelsURI = new HashSet(); + basicTabParentModels = new HashSet(); + + browseRegisteredPreferences(basicTabParentModels, basicTabStrategiesIDs, + basicTabBrowsedModelsURI, Messages.BasicBrowsedModels_Node, Messages.BasicSelectedStrategies_Node); + + for (String strategyID : basicTabStrategiesIDs) { + getCorrespondigStrategy(strategyID, basicTabParentModels, basicTabStrategies); + } + + // Activator.log.trace(Activator.RENAMING_PREFERENCES_TRACE, "basicTabStrategies.values(): " + basicTabStrategies.values().size()); + return basicTabStrategies.values(); + } + + /** + * @return + * The models' URI + */ + public Collection retrieveBasicTabModelPaths() { + return basicTabBrowsedModelsURI; + } + + /** + * @return + * The strategies from the advanced tab + */ + public Collection retrieveAdvancedTabStrategies() { + advancedTabStrategies = new HashMap(); + advancedTabStrategiesIDs = new HashSet(); + advancedTabBrowsedModelsURI = new HashSet(); + advancedTabParentModels = new HashSet(); + + browseRegisteredPreferences(advancedTabParentModels, advancedTabStrategiesIDs, + advancedTabBrowsedModelsURI, Messages.AdvancedBrowsedModels_Node, Messages.AdvancedSelectedStrategies_Node); + + for (String strategyID : advancedTabStrategiesIDs) { + getCorrespondigStrategy(strategyID, advancedTabParentModels, advancedTabStrategies); + } + + // Activator.log.trace(Activator.RENAMING_PREFERENCES_TRACE, "advancedTabStrategies.values(): " + advancedTabStrategies.values().size()); + return advancedTabStrategies.values(); + } + + /** + * @return + * All the strategies from the preference node and the selected strategies from both tabs + */ + public Collection retrieveAllStrategies() { + Map allStrategies = new HashMap<>(); + try { + Activator.log.trace(Activator.STRATEGY_PREFERENCES_TRACE, "childrenNodes: " + propertyLifecyclePreferences.childrenNames().length); + if (propertyLifecyclePreferences.childrenNames().length == 0) { + // The User still hasn't selected anything in the preference page + // Populate the preferences with the default models + Map renameSets = StrategySetRegistry.getInstance().getStrategySets(); + if (renameSets != null) { + for (String setKey : renameSets.keySet()) { + StrategySet renameSetConfiguration = renameSets.get(setKey); + String modelURI = renameSetConfiguration.eResource().getURI().toString(); + // Activator.log.trace(Activator.RENAMING_PREFERENCES_TRACE, "modelURI: " + modelURI); + + Preferences basicModelNode = propertyLifecyclePreferences.node(Messages.BasicBrowsedModels_Node); + basicModelNode.putBoolean(modelURI, true); + Preferences basicConfigurationNode = propertyLifecyclePreferences.node(Messages.BasicSelectedStrategies_Node); + for (StrategyElement configuration : renameSetConfiguration.getStrategies()) { + basicConfigurationNode.putBoolean(configuration.getId(), true); + } + } + } + + savePreferences(); + } + } catch (BackingStoreException e) { + Activator.log.error(e); + } + + // Get the preferences selected by the user + for (StrategyElement strategy : retrieveBasicTabStrategies()) { + allStrategies.put(strategy.getId(), strategy); + } + for (StrategyElement strategy : retrieveAdvancedTabStrategies()) { + allStrategies.put(strategy.getId(), strategy); + } + + Activator.log.trace(Activator.STRATEGY_PREFERENCES_TRACE, "allStrategies.size(): " + allStrategies.values().size()); + return allStrategies.values(); + } + + /** + * @return + * The models' URI + */ + public Collection retrieveAdvancedTabModelPaths() { + return advancedTabBrowsedModelsURI; + } + + /** + * Register the selected strategies and their models in the preference node + * + * @param basicModelsURIs + * {@link #retrieveBasicTabModelPaths() retieveBasicTabModelPaths()} + * @param advancedModelsURIs + * {@link #retrieveAdvancedTabModelPaths() retieveAdvancedTabModelPaths()} + * @param basicConfigurations + * {@link #retrieveBasicTabStrategies() retrieveBasicTabStrategies()} + * @param advancedConfigurations + * {@link #retrieveAdvancedTabStrategies() retrieveAdvancedTabStrategies()} + */ + public void registerCurrentPreferences(Collection basicModelsURIs, Collection advancedModelsURIs, + Collection basicConfigurations, Collection advancedConfigurations) { + + clearPreferences(); + // Create the Nodes to house the preferences + Preferences basicModelNode = propertyLifecyclePreferences.node(Messages.BasicBrowsedModels_Node); + Preferences basicConfigurationNode = propertyLifecyclePreferences.node(Messages.BasicSelectedStrategies_Node); + Preferences advancedModelNode = propertyLifecyclePreferences.node(Messages.AdvancedBrowsedModels_Node); + Preferences advancedConfigurationNode = propertyLifecyclePreferences.node(Messages.AdvancedSelectedStrategies_Node); + + // Save all the models (URIs) used to get the current configuration + if (basicModelsURIs != null) { + for (String modelURI : basicModelsURIs) { + basicModelNode.putBoolean(modelURI, true); + } + } + if (advancedModelsURIs != null) { + for (String modelURI : advancedModelsURIs) { + advancedModelNode.putBoolean(modelURI, true); + } + } + + // Save all the strategies (IDs) used in the current configuration + if (basicConfigurations != null) { + for (StrategyElement strategy : basicConfigurations) { + basicConfigurationNode.putBoolean(strategy.getId(), true); + } + + } + if (advancedConfigurations != null) { + for (StrategyElement strategy : advancedConfigurations) { + advancedConfigurationNode.putBoolean(strategy.getId(), true); + } + } + + savePreferences(); + } + + /** + * Clear the preference node completely + */ + public void clearPreferences() { + try { + // Deletes all the preference's children nodes + String[] childrenNames = propertyLifecyclePreferences.childrenNames(); + for (String childName : childrenNames) { + Preferences childNode = propertyLifecyclePreferences.node(childName); + childNode.removeNode(); + } + + savePreferences(); + } catch (BackingStoreException e) { + Activator.log.error(e); + } + } + + /** + * Save the amended preference node + */ + private void savePreferences() { + try { + // Save the current strategies model's informations + propertyLifecyclePreferences.flush(); + } catch (BackingStoreException e) { + Activator.log.error(e); + } + } + + /** + * Verify that the node exists + * + * @param pathName + * The node's name + * @return + * true or false + */ + public boolean nodeExists(String pathName) { + try { + return propertyLifecyclePreferences.nodeExists(pathName); + } catch (BackingStoreException e) { + Activator.log.error(e); + } + return false; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/SaveButton.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/SaveButton.java new file mode 100755 index 00000000000..327e0fd1c38 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.preferences/src/org/eclipse/papyrus/propertylifecycle/preferences/utils/SaveButton.java @@ -0,0 +1,140 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.propertylifecycle.preferences.utils; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.common.CommonPlugin; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.xmi.XMIResource; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.papyrus.propertylifecycle.preferences.Activator; +import org.eclipse.papyrus.propertylifecycle.preferences.messages.Messages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; + + +/** + * Class used to create the saver button, for the custom model in the advanced selection window, and its associated window + * + */ +public class SaveButton { + + private Composite parent; + + private TreeViewer parentViewer; + + public SaveButton(Composite parent, TreeViewer parentViewer) { + this.parent = parent; + this.parentViewer = parentViewer; + + createSaverButton(this.parent); + } + + /** + * Create a button that can be used to save the currently selected strategies as a new @see org.eclipse.emf.ecore.resource.Resource + * + * @param parent + * The parent Composite containing the button + */ + protected void createSaverButton(Composite parent) { + Button saveButton = new Button(parent, SWT.NONE); + saveButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + saveButton.setText(Messages.SaveButton_Label); + + saveButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // Initialize the default variable + saveModelResource(Messages.CustomModel_DefaultName); + } + }); + } + + /** + * Save the strategies inside a new @see org.eclipse.emf.ecore.resource.Resource + */ + private void saveModelResource(String modelName) { + FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE); + dialog.setText(Messages.SystemSaveDialog_Title); + // String filterPath = "/"; + // String platform = SWT.getPlatform(); + // if (platform.equals("win32")) { + // filterPath = "c:\\"; + // } + + // ConvertEcoreToUML convertDialog = new ConvertEcoreToUML(); + // convertDialog.run(new Action() { + // }); + + String[] filterExtensions = { "*.propertylifecycle" }; //$NON-NLS-1$ + String[] filterExtensionsNames = { "Strategies Models" }; //$NON-NLS-1$ + dialog.setFilterNames(filterExtensionsNames); + dialog.setFilterExtensions(filterExtensions); + // dialog.setFilterPath(filterPath); + dialog.setFileName(modelName); + + String dialogResult = dialog.open(); + if (dialogResult == null) { + return; + } + + Resource resource = getViewerModel(); + if (resource == null) { + return; + } + + URI resourceURI = CommonPlugin.resolve(URI.createFileURI(dialogResult)); + // URI resourceURI = URI.createFileURI(dialogResult); + resource.setURI(resourceURI); + + try { + Map options = new HashMap(); + options.put(XMIResource.OPTION_ENCODING, getEncoding()); + resource.save(options); + } catch (IOException e) { + // TODO display an error message in the preference window + Activator.log.error(e); + } + } + + public Resource getViewerModel() { + Object viewerInput = parentViewer.getInput(); + if (viewerInput != null && viewerInput instanceof ResourceSet) { + return ((ResourceSet) viewerInput).getResources().get(0); + } + + return null; + } + + /** + * The encoding used for the file + * + * @return + * UTF-8 + */ + public String getEncoding() { + return "UTF-8"; //$NON-NLS-1$ + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.classpath b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.classpath new file mode 100755 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.gitignore b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.gitignore new file mode 100755 index 00000000000..ae3c1726048 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.options b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.options new file mode 100755 index 00000000000..e986ef44417 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.options @@ -0,0 +1,7 @@ +# Tracing options for the org.eclipse.paprus.infra.propertylifecycle plug-in +org.eclipse.papyrus.infra.propertylifecycle/debug=true +org.eclipse.papyrus.infra.propertylifecycle/debug/PLCStrategy_Reorient=true +org.eclipse.papyrus.infra.propertylifecycle/debug/PLCStrategy_Configure=true +org.eclipse.papyrus.infra.propertylifecycle/debug/PLCStrategy=true +org.eclipse.papyrus.infra.propertylifecycle/debug/PLCStrategy_Supertypes=true +org.eclipse.papyrus.infra.propertylifecycle/debug/PLCStrategy_Types=false diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.project b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.project new file mode 100755 index 00000000000..01d404f369a --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.propertylifecycle + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.settings/org.eclipse.jdt.core.prefs b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..0c68a61dca8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/META-INF/MANIFEST.MF b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..b3a839cf739 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Propertylifecycle +Bundle-SymbolicName: org.eclipse.papyrus.propertylifecycle;singleton:=true +Bundle-Version: 0.0.1.qualifier +Bundle-Activator: org.eclipse.papyrus.propertylifecycle.Activator +Require-Bundle: org.eclipse.ui;bundle-version="3.107.0", + org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.propertylifecycle.model;bundle-version="0.0.1", + org.eclipse.papyrus.propertylifecycle.preferences;bundle-version="0.0.1", + org.eclipse.papyrus.infra.types.core;bundle-version="2.0.0", + org.eclipse.papyrus.infra.emf.gmf;bundle-version="1.2.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Export-Package: org.eclipse.papyrus.propertylifecycle.commands, + org.eclipse.papyrus.propertylifecycle.helper.advice, + org.eclipse.papyrus.propertylifecycle.messages, + org.eclipse.papyrus.propertylifecycle.utils diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/about.html b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/about.html new file mode 100755 index 00000000000..d35d5aed64c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/build.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/build.properties new file mode 100755 index 00000000000..c07aeb74d35 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + about.html,\ + model/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/model/PropertyLifecycle.elementtypesconfigurations b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/model/PropertyLifecycle.elementtypesconfigurations new file mode 100644 index 00000000000..5a3089e7c2a --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/model/PropertyLifecycle.elementtypesconfigurations @@ -0,0 +1,23 @@ + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/plugin.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/plugin.xml new file mode 100755 index 00000000000..3d0efbd5892 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/plugin.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/pom.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/pom.xml new file mode 100755 index 00000000000..8a60252dfe4 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/pom.xml @@ -0,0 +1,10 @@ + + + 4.0.0 + org.eclipse.papyrus.infra.propertylifecycle + 0.0.1.qualifier + org.eclipse.papyrus + eclipse-plugin + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/Activator.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/Activator.java new file mode 100755 index 00000000000..906b423896a --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/Activator.java @@ -0,0 +1,82 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle; + +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 { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.infra.papyrus.propertylifecycle"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + // The Log service + public static LogHelper log; + + public static String PLCSTRATEGY_TRACE = "PLCStrategy"; + + public static String PLCSTRATEGY_TYPES_TRACE = "PLCStrategy_Types"; + + public static String PLCSTRATEGY_SUPERTYPES_TRACE = "PLCStrategy_Supertypes"; + + public static String PLCSTRATEGY_REORIENT_TRACE = "PLCStrategy_Reorient"; + + public static String PLCSTRATEGY_CONFIGURE_TRACE = "PLCStrategy_Configure"; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(plugin); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/commands/LifeCycleEditElementCommand.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/commands/LifeCycleEditElementCommand.java new file mode 100755 index 00000000000..04f976f876e --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/commands/LifeCycleEditElementCommand.java @@ -0,0 +1,155 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.commands; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.papyrus.infra.tools.util.ClassLoaderHelper; +import org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.JavaProcessor; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; + +/** + * The command retrieved from the applicable strategies + */ +public class LifeCycleEditElementCommand extends EditElementCommand { + + private String featureLabel; + private ElementProperty featureStrategy; + // private Map accessedProcessors; + private AbstractEditCommandRequest request; + // private EObject elementToEdit; + + /** + * Constructor. + * + * @param commandLabel + * The label of the command + * @param elementToEdit + * The element to edit + * @param request + * The request to edit the element + * @param featureLabel + * The key used to sort through the possible strategies (the feature to edit) + * @param featureStrategy + * The {@link org.eclipse.papyrus.propertylifecycle.ElementProperty informations} used to calculate the new value + * @param accessedProcessors + * The accessed processors + */ + public LifeCycleEditElementCommand(String commandLabel, EObject elementToEdit, AbstractEditCommandRequest request, + String featureLabel, ElementProperty featureStrategy, Map accessedProcessors) { + super(commandLabel, elementToEdit, request); + // this.elementToEdit = elementToEdit; + this.request = request; + this.featureLabel = featureLabel; + this.featureStrategy = featureStrategy; + // this.accessedProcessors = accessedProcessors == null ? new HashMap() : accessedProcessors; + } + + /** + * Constructor. + * + * @param commandLabel + * The label of the command + * @param elementToEdit + * The element to edit + * @param request + * The request to edit the element + * @param featureLabel + * The key used to sort through the possible strategies (the feature to edit) + * @param featureStrategy + * The {@link org.eclipse.papyrus.propertylifecycle.ElementProperty informations} used to calculate the new value + */ + public LifeCycleEditElementCommand(String commandLabel, EObject elementToEdit, AbstractEditCommandRequest request, + String featureLabel, ElementProperty featureStrategy) { + this(commandLabel, elementToEdit, request, featureLabel, featureStrategy, null); + } + + /** + * Constructor. + * + * @param commandLabel + * The label of the command + * @param request + * The request to edit the element + * @param featureLabel + * The key used to sort through the possible strategies (the feature to edit) + * @param featureStrategy + * The {@link org.eclipse.papyrus.propertylifecycle.ElementProperty informations} used to calculate the new value + */ + public LifeCycleEditElementCommand(String commandLabel, AbstractEditCommandRequest request, + String featureLabel, ElementProperty featureStrategy) { + this(commandLabel, (EObject) request.getElementsToEdit().get(0), request, featureLabel, featureStrategy, null); + } + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + // Get the ICommand built in the processor and execute them in order to build the CommandResult + ICommand cmd = setProcessorValue(featureLabel, featureStrategy); + if (cmd == null || cmd instanceof UnexecutableCommand) { + throw new OperationCanceledException(); + } + + cmd.execute(monitor, info); + + return cmd.getCommandResult(); + } + + /** + * Filter the processors to return the correct {@link org.eclipse.gmf.runtime.common.core.command.Commandresult} + * + * @param property + * The {@link org.eclipse.papyrus.propertylifecycle.ElementProperty property} of the strategy + * @param elementType + * The element type of the element + * @return + * The {@link org.eclipse.gmf.runtime.common.core.command.Commandresult} of the element's edition + */ + private ICommand setProcessorValue(String featureLabel, ElementProperty property) { + AbstractValueProcessor propertyProcessor = property.getValueProcessor(); + + if (propertyProcessor instanceof JavaProcessor) { + // Cache the processor in order to limit the number of calls to the loader + Object processor; + String className = ((JavaProcessor) (property.getValueProcessor())).getClassName(); + // if (!accessedProcessors.containsKey(className)) { + processor = ClassLoaderHelper.newInstance(className); + // accessedProcessors.put(className, processor); + // } else { + // processor = accessedProcessors.get(className); + // } + + if (processor instanceof CommandValueProcessor) { + boolean isImmutable = property.getPriority() < 0 ? true : false; + return ((CommandValueProcessor) processor).setValueFromRequest(featureLabel, isImmutable, request); + } + } + + return null; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/commands/LifecycleSetCommand.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/commands/LifecycleSetCommand.java new file mode 100755 index 00000000000..2b9ca0bd6be --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/commands/LifecycleSetCommand.java @@ -0,0 +1,130 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.AbstractCommand; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; + +/** + * End command used to set the value of the edited element through the propertylifecycle strategies + */ +public class LifecycleSetCommand extends AbstractCommand { + + private TransactionalEditingDomain editingDomain; + private EObject eObject; + private EStructuralFeature feature; + private Object value; + + private SetRequest setRequest; + private GMFtoEMFCommandWrapper emfCommand; + + /** + * Constructor. + * + * @param editingDomain + * The editing domain + * @param label + * The label of the command + * @param eObject + * The object to edit + * @param feature + * The feature to edit + * @param value + * The new value to set + */ + public LifecycleSetCommand(TransactionalEditingDomain editingDomain, String label, + EObject eObject, EStructuralFeature feature, Object value) { + super(label); + this.editingDomain = editingDomain; + this.eObject = eObject; + this.feature = feature; + this.value = value; + } + + /** + * Constructor. + * + * @param label + * The label of the command + * @param eObject + * The object to edit + * @param feature + * The feature to edit + * @param value + * The new value to set + */ + public LifecycleSetCommand(String label, EObject eObject, EStructuralFeature feature, Object value) { + this(null, label, eObject, feature, value); + } + + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + if (editingDomain != null) { + setRequest = new SetRequest(editingDomain, eObject, feature, value); + } else { + setRequest = new SetRequest(eObject, feature, value); + } + + /** Final ! Should never call the service edit again or else risk a StackOverflow because of it will loop on itself */ + // IElementEditService provider = ElementEditServiceUtils.getCommandProvider(eObject); + // ICommand createGMFCommand = provider.getEditCommand(setRequest); + + ICommand gmfCommand = new SetValueCommand(setRequest); + if (gmfCommand == null || gmfCommand instanceof UnexecutableCommand) { + throw new OperationCanceledException(); + } + + emfCommand = new GMFtoEMFCommandWrapper(gmfCommand); + emfCommand.execute(); + + return gmfCommand.getCommandResult(); + } + + + @Override + protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + emfCommand.redo(); + return null; + } + + @Override + protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + emfCommand.undo(); + return null; + } + + @Override + public boolean canRedo() { + return emfCommand != null; + } + + @Override + public boolean canUndo() { + return emfCommand != null; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/helper/advice/PropertyLifecycleHelperAdvice.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/helper/advice/PropertyLifecycleHelperAdvice.java new file mode 100755 index 00000000000..c45342b696c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/helper/advice/PropertyLifecycleHelperAdvice.java @@ -0,0 +1,249 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.helper.advice; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand; +import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.propertylifecycle.Activator; +import org.eclipse.papyrus.propertylifecycle.utils.PropertyLifecycleManager; + +/** + * Advice used to handle the calls for the applications of the {@link org.eclipse.papyrus.propertylifecycle.StrategyElement strategies} + * + */ +public class PropertyLifecycleHelperAdvice extends AbstractEditHelperAdvice { + + // private HashMap nameMap; + + /** + * Access used to edit the contained elements in case of a new container + * + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) + * + * @param request + * The move request + * @return + * new IStatus.OK command result. + */ + @Override + protected ICommand getAfterMoveCommand(final MoveRequest request) { + return super.getAfterMoveCommand(request); + // return new MoveElementsCommand(request) { + // + // @Override + // protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + // Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "moveElements: " + request.getElementsToMove().keySet() + // + ", in: " + request.getElementsToEdit()); + // + // for (Object object : request.getElementsToMove().keySet()) { + // if (!(object instanceof EObject)) { + // return CommandResult.newOKCommandResult(); + // } + // EObject element = (EObject) object; + // + // if (!(element instanceof NamedElement)) { + // return CommandResult.newOKCommandResult(); + // } + // Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "ElementPreviousName: " + // + element.eGet(element.eClass().getEStructuralFeature("name"), true).toString()); + // + // NamedElement namedElement = (NamedElement) element; + // String name = PropertyLifecycleHelper.getAssociatedCreationName(request, element, null); + // + // if (name != null) { + // String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(name, element.eContainer().eContents(), element, ""); + // namedElement.setName(initializedName); + // Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "ElementNewName: " + // + element.eGet(element.eClass().getEStructuralFeature("name"), true).toString()); + // } else { + // Retrieves the default name in case there are no strategy for this (element, container) couple + // String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(element.eClass().getName(), element.eContainer().eContents()); + // namedElement.setName(initializedName); + // IElementType umlET = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml." + element.eClass().getName()); + // } + // + // } + // + // return super.doExecuteWithResult(progressMonitor, info); + //// return CommandResult.newOKCommandResult(); + // } + // }; + } + + + /** + * Access used to edit the values of a reoriented association + * + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterReorientRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) + * + * @param request + * The reorient request + * @return + * new IStatus.OK command result. + */ + @Override + protected ICommand getAfterReorientRelationshipCommand(ReorientRelationshipRequest request) { + + return new EditElementCommand("Lifecycle Reorient Relashionship", request.getRelationship(), request) { + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + PropertyLifecycleManager lifecycleManager = new PropertyLifecycleManager(request, 0); + ICommand lifecycleStrategyCommand = lifecycleManager.setAssociatedPropertyValues(); + if (lifecycleStrategyCommand != null) { + if (lifecycleStrategyCommand.canExecute()) { + lifecycleStrategyCommand.execute(monitor, info); + } + } + return CommandResult.newOKCommandResult(request.getRelationship()); + } + }; + + // ICommand compositeCommand = super.getAfterReorientRelationshipCommand(request); + // PropertyLifecycleManager lifecycleManager = new PropertyLifecycleManager(request, 0); + // ICommand lifecycleStrategyCommand = lifecycleManager.setAssociatedPropertyValues(); + // if (lifecycleStrategyCommand != null) { + // compositeCommand = CompositeCommand.compose(compositeCommand, lifecycleStrategyCommand); + // } + // + // return compositeCommand; + } + + + /** + * Access used to edit the values of the currently edited/created element + * + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) + * + * @param request + * The configure request + * @return + * new IStatus.OK command result. + */ + @Override + protected ICommand getAfterConfigureCommand(final ConfigureRequest request) { + // // TEST1 - BEGIN + // if (element.eResource() instanceof XMIResource) { + // String xmiID = ((XMIResource) element.eResource()).getID(element); + // System.err.println(xmiID); + // } + // // TEST1 - END + + // The stereotypes are not yet applied at this stage, i.e. wait until execution to filter based on the matchers + return new ConfigureElementCommand(request) { + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + PropertyLifecycleManager lifecycleManager = new PropertyLifecycleManager(request, 0); + ICommand lifecycleStrategyCommand = lifecycleManager.setAssociatedPropertyValues(); + if (lifecycleStrategyCommand != null) { + if (lifecycleStrategyCommand.canExecute()) { + lifecycleStrategyCommand.execute(monitor, info); + } + } + return CommandResult.newOKCommandResult(request.getElementToConfigure()); + } + }; + } + + + /** + * Access used to edit the values of the currently edited/created element + * + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) + * + * @param request + * The creation request + * @return + * new IStatus.OK command result. + */ + @Override + protected ICommand getAfterCreateCommand(final CreateElementRequest request) { + + // The stereotypes are not yet applied at this stage, i.e. wait until execution to filter based on the matchers + return new CreateElementCommand(request) { + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + PropertyLifecycleManager lifecycleManager = new PropertyLifecycleManager(request, 0); + ICommand lifecycleStrategyCommand = lifecycleManager.setAssociatedPropertyValues(); + if (lifecycleStrategyCommand != null) { + if (lifecycleStrategyCommand.canExecute()) { + lifecycleStrategyCommand.execute(monitor, info); + } + } + return CommandResult.newOKCommandResult(request.getNewElement()); + } + }; + } + + + /** + * Access used to edit the contained elements in case of a modified value of the container + * + * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) + * + * @param request + * The editing request + * @return + * The Command wrapping the strategy commands + */ + @Override + protected ICommand getAfterSetCommand(SetRequest request) { + // EObject element = request.getElementToEdit(); + // if (element instanceof NamedElement) { + // Activator.log.trace(Activator.PLCSTRATEGY_TRACE, ", name: " + ((NamedElement) element).getName()); + // }; + + return new SetValueCommand(request) { + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + PropertyLifecycleManager lifecycleManager = new PropertyLifecycleManager(request, 0); + ICommand lifecycleStrategyCommand = lifecycleManager.setAssociatedPropertyValues(); + if (lifecycleStrategyCommand != null) { + if (lifecycleStrategyCommand.canExecute()) { + lifecycleStrategyCommand.execute(monitor, info); + } + } + return CommandResult.newOKCommandResult(request.getElementToEdit()); + }; + }; + + // ICommand compositeCommand = super.getAfterSetCommand(request); + // PropertyLifecycleManager lifecycleManager = new PropertyLifecycleManager(request, 0); + // ICommand lifecycleStrategyCommand = lifecycleManager.setAssociatedPropertyValues(); + // compositeCommand = CompositeCommand.compose(compositeCommand, lifecycleStrategyCommand); + // if (lifecycleStrategyCommand != null) { + // compositeCommand = CompositeCommand.compose(compositeCommand, lifecycleStrategyCommand); + // } + // + // return compositeCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/messages/Messages.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/messages/Messages.java new file mode 100755 index 00000000000..bf9c7a351e6 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/messages/Messages.java @@ -0,0 +1,35 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.messages; + +import org.eclipse.osgi.util.NLS; + +/** + * + */ +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.propertylifecycle.messages.messages"; //$NON-NLS-1$ + + public static String FEATURELABEL_NAME; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/messages/messages.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/messages/messages.properties new file mode 100755 index 00000000000..974799064a2 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/messages/messages.properties @@ -0,0 +1 @@ +FEATURELABEL_NAME=name \ No newline at end of file diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/utils/CommandValueProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/utils/CommandValueProcessor.java new file mode 100755 index 00000000000..de14bfc7c6e --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/utils/CommandValueProcessor.java @@ -0,0 +1,26 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.utils; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; + +/** + * + */ +public interface CommandValueProcessor { + + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request); + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/utils/PropertyLifecycleManager.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/utils/PropertyLifecycleManager.java new file mode 100755 index 00000000000..9a71489714b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle/src/org/eclipse/papyrus/propertylifecycle/utils/PropertyLifecycleManager.java @@ -0,0 +1,575 @@ +/***************************************************************************** + * Copyright (c) 2015 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.utils; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Map; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.types.core.impl.ConfiguredHintedMetamodelElementType; +import org.eclipse.papyrus.infra.types.core.impl.ConfiguredHintedSpecializationElementType; +import org.eclipse.papyrus.propertylifecycle.Activator; +import org.eclipse.papyrus.propertylifecycle.ElementContainer; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.commands.LifeCycleEditElementCommand; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.PropertyLifecyclePreferencesManager; + + +/** + * Used to match the handled element against the selected strategies + * + */ +public class PropertyLifecycleManager { + + /** The manager containing all the strategies informations */ + private PropertyLifecyclePreferencesManager preferencesManager = new PropertyLifecyclePreferencesManager(); + + /** The element's type */ + private IElementType elementType; + + /** The handled element */ + private EObject element; + + /** The list of all loaded processors (reflexively accessed) */ + private Map accessedProcessors = new HashMap(); + + /** The command encompassing the changes to the handled element */ + private ICommand command; + + /** The request used to extract the element's contextual informations */ + private AbstractEditCommandRequest request; + + /** The depth to which the strategies will be matched against the handled element's contents */ + private int depth; + + + /** + * + * Constructor. Default depth set to -1 + * + * @param request + * The {@link org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest} of the edited element + */ + public PropertyLifecycleManager(AbstractEditCommandRequest request) { + this(request, -1); + } + + /** + * + * Constructor. + * + * @param request + * The {@link org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest} of the edited element + * @param depth + * The depth to which the strategies will be matched against the handled element's contents. Negative numbers for infinite depth. + */ + public PropertyLifecycleManager(AbstractEditCommandRequest request, int depth) { + this.request = request; + setElementsVariables(this.request); + this.depth = depth; + } + + /** + * Set the variables {@link #element} and {@link #elementType} used to filter the strategies + * + * @param request + * The manipulated {@link org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest} + */ + private void setElementsVariables(AbstractEditCommandRequest request) { + if (request instanceof CreateElementRequest) { + CreateElementRequest createRequest = (CreateElementRequest) request; + elementType = createRequest.getElementType(); + // TODO do a better job at fishing out the created element + // Object object = createRequest.getElementsToEdit().get(0); + // element = object instanceof EObject ? (EObject) object : null; + element = ((CreateElementRequest) request).getNewElement(); + } + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = ((ConfigureRequest) request); + elementType = confRequest.getTypeToConfigure(); + element = confRequest.getElementToConfigure(); + } + + if (request instanceof ReorientRelationshipRequest) { + ReorientRelationshipRequest reorientRequest = (ReorientRelationshipRequest) request; + element = reorientRequest.getRelationship(); + String testString = element.eClass().getInstanceClassName(); + // TODO find an alternative to this placeholder element type + IElementType papyrusType = ElementTypeRegistry.getInstance().getType(testString.replace("org.eclipse.uml2", "org.eclipse.papyrus")); + elementType = papyrusType != null ? papyrusType : ElementTypeRegistry.getInstance().getElementType(element.eClass()); + } + + if (request instanceof SetRequest) { + SetRequest setRequest = (SetRequest) request; + element = setRequest.getElementToEdit(); + String testString = element.eClass().getInstanceClassName(); + // TODO find an alternative to this placeholder element type + IElementType papyrusType = ElementTypeRegistry.getInstance().getType(testString.replace("org.eclipse.uml2", "org.eclipse.papyrus")); + elementType = papyrusType != null ? papyrusType : ElementTypeRegistry.getInstance().getElementType(element.eClass()); + } + + } + + + /** + * Construct the {@link org.eclipse.gmf.runtime.common.core.command.ICommand} of the edition + * + * @return + * The {@link org.eclipse.gmf.runtime.common.core.command.CompositeCommand} from the different changes brought by the current strategies + */ + public ICommand setAssociatedPropertyValues() { + + // This will avoid an NPE later and indicates that there is not yet a way to deal with the given request + if (elementType == null || element == null) { + return command; + } + + Collection matchingStrategies = new LinkedList(); + matchingStrategies.addAll(preferencesManager.retrieveAllStrategies()); + + matchingStrategies = filterOnContext(matchingStrategies, elementType, element); + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, matchingStrategies.size() + ": " + matchingStrategies); + + if (matchingStrategies.size() > 0) { + Set modifiableFeatures = getAllModifiableFeatures(matchingStrategies); + + if (modifiableFeatures.size() > 0) { + HashMap newFeatureValues = getNewFeatureValues(matchingStrategies, modifiableFeatures); + + for (EStructuralFeature elementFeature : element.eClass().getEAllStructuralFeatures()) { + String featureLabel = elementFeature.getName(); + if (newFeatureValues.keySet().contains(featureLabel)) { + ElementProperty featureStrategy = newFeatureValues.get(featureLabel); + if (command == null) { + command = getAssociatedCommand(featureLabel, featureStrategy, request); + } else { + command = CompositeCommand.compose(command, getAssociatedCommand(featureLabel, featureStrategy, request)); + } + } + } + } + } + + // Iterate on all the nested elements, if any, to match them against the current strategies + applyStrategiesToContents(element); + + return command; + } + + + /** + * Filter regrouping all the contextual information in which the element is created + * + * @param strategies + * The possible strategies + * @param elementType + * The element type of the element + * @param element + * The element + * @return + * The list of Strategies matching the element + */ + private Collection filterOnContext(Collection strategies, IElementType elementType, EObject element) { + Map matchingStrategies = new HashMap(); + // LinkedList elementSuperTypes = new LinkedList(Arrays.asList(elementType.getAllSuperTypes())); + String trimmedID = getTrimmedID(elementType); + if (elementType != null) { + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "IElementType_ID: " + elementType.getId()); + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "IElementType_trimmedID: " + trimmedID); + } + + for (StrategyElement strategy : strategies) { + + if (trimmedID == null) { + continue; + } + + // Filter on the specified element specializedType + if (!filterOnElement(elementType, element, strategy)) { + continue; + } + + // Verify that the user specified a container to the strategy element + if (!filterOnContainer(element, strategy)) { + continue; + } + + // Filtered list + matchingStrategies.put(strategy.getId(), strategy); + } + + return matchingStrategies.values(); + + } + + + /** + * Filter based on the element's {@link org.eclipse.gmf.runtime.emf.type.core.ElementType} + * and its possible {@link org.eclipse.gmf.runtime.emf.type.core.SpecializationType} + * + * @param elementType + * The element type of the element + * @param element + * The element's EObject + * @param strategy + * The strategy the element is being matched against + * @return + * If the element is a match to the strategy or not + */ + private boolean filterOnElement(IElementType elementType, EObject element, StrategyElement strategy) { + IElementType strategyBaseType = ElementTypeRegistry.getInstance().getType(strategy.getBaseType()); + IElementType strategySpeType = ElementTypeRegistry.getInstance().getType(strategy.getSpecializedType()); + + // 1- Filter on the element baseType + if (strategyBaseType == null) { + return false; + } + // TEST1 - BEGIN + if (strategyBaseType instanceof ConfiguredHintedMetamodelElementType) { + ConfiguredHintedMetamodelElementType metatype = (ConfiguredHintedMetamodelElementType) strategyBaseType; + Activator.log.trace(Activator.PLCSTRATEGY_TYPES_TRACE, "ConfiguredHintedMetamodelElementType: " + metatype); + } + if (strategyBaseType instanceof ConfiguredHintedSpecializationElementType) { + ConfiguredHintedSpecializationElementType spetype = (ConfiguredHintedSpecializationElementType) strategyBaseType; + Activator.log.trace(Activator.PLCSTRATEGY_TYPES_TRACE, "ConfiguredHintedSpecializationElementType: " + spetype); + } + // TEST1 - END + + if (strategyBaseType.equals(ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Element"))) { + return true; + } + // If the base type is a metamodel type, there are no matchers to use + if (strategyBaseType instanceof ConfiguredHintedMetamodelElementType) { + ConfiguredHintedMetamodelElementType metaType = (ConfiguredHintedMetamodelElementType) strategyBaseType; + Activator.log.trace(Activator.PLCSTRATEGY_TYPES_TRACE, "element: " + metaType.getEClass()); + Activator.log.trace(Activator.PLCSTRATEGY_TYPES_TRACE, "element: " + element.eClass()); + + if (!metaType.getEClass().equals(element.eClass())) { + return false; + } + } + // If the base type is a specialization type as the base type, there is a matcher available + if (strategyBaseType instanceof ConfiguredHintedSpecializationElementType) { + ConfiguredHintedSpecializationElementType speType = (ConfiguredHintedSpecializationElementType) strategyBaseType; + + if (speType.getMatcher() == null) { + // FIXME there are no matchers for: Extend(UseCase), + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, speType.getId() + ", hasNoMatcher"); + return false; + } else { + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, speType.getId()); + if (!speType.getMatcher().matches(element)) { + return false; + } + } + } + + // 2- Filter on the element specializedType + if (strategySpeType != null && elementType != null && !Arrays.asList(elementType.getAllSuperTypes()).contains(strategySpeType)) { + return false; + } + + + // All the previous conditions are met + return true; + } + + + /** + * Go through all the specified strategy's containers + * + * @param element + * The element + * @param strategy + * The strategy + * @return + * If the element's container is a match or not + */ + private boolean filterOnContainer(EObject element, StrategyElement strategy) { + Collection strategyContainers = strategy.getElementContainers(); + Boolean skip = true; + + // There were no specified containers hence the condition is always verified + if (strategyContainers == null || strategyContainers.size() < 1) { + return true; + } + + for (ElementContainer container : strategyContainers) { + // Filter on the possible element's container + skip = matchContainers(element.eContainer(), container); + if (skip) { + return true; + } + } + + // All the previous conditions are met + return false; + } + + + /** + * Go through all the specified strategy's container and its containers + * + * @param element + * The element + * @param container + * The {@link org.eclipse.papyrus.propertylifecycle.ElementContainer container} specified in the strategy + * @return + * If the element's container is a match or not + */ + private boolean matchContainers(EObject element, ElementContainer container) { + IElementType containerBaseType = ElementTypeRegistry.getInstance().getType(container.getBaseType()); + IElementType containerSpeType = ElementTypeRegistry.getInstance().getType(container.getSpecializedType()); + + // 1- Filter on the element baseType + if (containerBaseType == null) { + return false; + } + + // If the base type is a metamodel type, there are no matchers to use + if (containerBaseType instanceof ConfiguredHintedMetamodelElementType) { + ConfiguredHintedMetamodelElementType metaType = (ConfiguredHintedMetamodelElementType) containerBaseType; + Activator.log.trace(Activator.PLCSTRATEGY_TYPES_TRACE, "container: " + metaType.getEClass()); + Activator.log.trace(Activator.PLCSTRATEGY_TYPES_TRACE, "container: " + element.eClass()); + + if (!metaType.getEClass().equals(element.eClass())) { + return false; + } + } + // If the base type is a specialization type as the base type, there is a matcher available + if (containerBaseType instanceof ConfiguredHintedSpecializationElementType) { + ConfiguredHintedSpecializationElementType speType = (ConfiguredHintedSpecializationElementType) containerBaseType; + + if (!speType.getMatcher().matches(element)) { + return false; + } + } + + // 2- Filter on the element specializedType + // As there are no way to link an eObject to a specific elementType we only verify that the specialized type is contained by the baseType + if (containerSpeType != null && !Arrays.asList(containerBaseType.getAllSuperTypes()).contains(containerSpeType)) { + return false; + } + + // 3- Filter on the possible element's container + if (container.getContainersContainer() != null) { + if (!matchContainers(element.eContainer(), container.getContainersContainer())) { + return false; + } + } + + + // All the previous conditions are met + return true; + } + + + /** + * The possible changes brought by the current strategies + * + * @param strategies + * The strategies applicable to the element + * @return + * The list containing all the features affected by the applicable strategies + */ + private Set getAllModifiableFeatures(Collection strategies) { + Set modifiableFeatures = new HashSet(); + + for (StrategyElement strategy : strategies) { + for (ElementProperty property : strategy.getElementProperties()) { + // The user did not set a label + if (property.getFeatureLabel() == null) { + continue; + } + modifiableFeatures.add(property.getFeatureLabel()); + } + } + + return modifiableFeatures; + } + + + /** + * filter the possible strategies applicable to the features of the element and selecting them by their associated priorities + * + * @param strategies + * The strategies applicable to the element + * @param modifiableFeatures + * The features that can be modified by them + * @return + * The map detailing which changes will be applied to the modifiable features of the element + */ + private HashMap getNewFeatureValues(Collection strategies, Set modifiableFeatures) { + HashMap newFeatureValues = new HashMap(); + + for (String featureLabel : modifiableFeatures) { + ElementProperty priorityProperty = filterOnPriority(featureLabel, strategies); + newFeatureValues.put(featureLabel, priorityProperty); + } + + return newFeatureValues; + } + + + /** + * Filter the possible changes based on their priority + * + * @param featureLabel + * The label of the element's feature to change + * @param strategies + * The strategies applicable to the element + * @return + * The selected behavior + */ + private ElementProperty filterOnPriority(String featureLabel, Collection strategies) { + HashMap weightedStrategies = new HashMap(); + int priority = 0; + + for (StrategyElement strategy : strategies) { + for (ElementProperty property : strategy.getElementProperties()) { + if (featureLabel.equals(property.getFeatureLabel())) { + // The user did not set a priority + if (property.getPriority() == null) { + weightedStrategies.put(0, property); + continue; + } + + // The user defined this property value to be immutable + if (property.getPriority() < 0) { + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "Immutable priority: " + property.getPriority()); + return property; + } + + weightedStrategies.put(property.getPriority(), property); + priority = priority < property.getPriority() ? property.getPriority() : priority; + } + } + } + + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "Highest priority: " + priority); + return weightedStrategies.get(priority); + } + + + /** + * Get the associated {@link org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand} corresponding to the modifications on the element + * + * @param featureLabel + * The label of the feature to edit + * @param featureStrategy + * The strategy applied to this feature + * @return + * The {@link org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand} + * with its associated {@link org.eclipse.gmf.runtime.common.core.command.CommandResult} + */ + private EditElementCommand getAssociatedCommand(String featureLabel, ElementProperty featureStrategy, AbstractEditCommandRequest request) { + return new LifeCycleEditElementCommand("LifecycleEditCommand", element, request, featureLabel, featureStrategy, accessedProcessors); + } + + + /** + * This method calls on the {@link #setAssociatedPropertyValues()} for the contents of the edited element + * It will do so until the maximum depth has been reached (set in the constructor) + * + * @param element + * The edited element + */ + private void applyStrategiesToContents(EObject element) { + // The max depth has been reached + if (depth == 0) { + return; + } + + if (element.eContents().size() > 0) { + // Increase the depth of the matching + depth -= 1; + for (EObject eObject : element.eContents()) { + // Reinitialize the element to test against the current strategies + this.element = eObject; + // TODO find an alternative (more precise) to this default value + this.elementType = ElementTypeRegistry.getInstance().getElementType(eObject.eClass()); + setAssociatedPropertyValues(); + } + } + } + + + /** + * @param elementType + * The element's type + * @return + * The element type ID trimmed of any graphical extension + */ + private String getTrimmedID(IElementType elementType) { + if (elementType == null) { + return null; + } + + if (!graphicalIDMatcher(elementType.getId())) { + // The ID is already not a graphical one + return elementType.getId(); + } + + IElementType[] elementSuperTypes = elementType.getAllSuperTypes(); + LinkedList superTypes = new LinkedList(Arrays.asList(elementSuperTypes)); + for (int i = elementSuperTypes.length - 1; i > 0; i--) { + String typeID = superTypes.get(i).getId(); + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "typeID: " + typeID); + + if (!graphicalIDMatcher(typeID)) { + return typeID; + } + } + + // A chain of graphical IDs, albeit nigh impossible, could lead to this case + return null; + } + + + /** + * Detect the presence of a graphical extension in the element type ID + * + * @param typeID + * The element type ID + * @return + * isGraphical or not + */ + private boolean graphicalIDMatcher(String typeID) { + if (typeID.matches("[A-Za-z].+_[0-9]+")) { // $NON-NLS-1$ + // The type ID is graphical + return true; + } + + return false; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.classpath b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.classpath new file mode 100755 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.gitignore b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.gitignore new file mode 100755 index 00000000000..ae3c1726048 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.options b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.options new file mode 100755 index 00000000000..7e6399d8f73 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.options @@ -0,0 +1,3 @@ +# Tracing options for the org.eclipse.paprus.sysml.propertylifecycle plug-in +org.eclipse.papyrus.sysml.propertylifecycle/debug=true +org.eclipse.papyrus.sysml.propertylifecycle/debug/PLCStrategy_SYSMLproperty=true diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.project b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.project new file mode 100755 index 00000000000..87e7fb0ea85 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.sysml.propertylifecycle + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.settings/org.eclipse.jdt.core.prefs b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..0c68a61dca8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/META-INF/MANIFEST.MF b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..95c197e9742 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Propertylifecycle +Bundle-SymbolicName: org.eclipse.papyrus.sysml.propertylifecycle +Bundle-Version: 0.0.1.qualifier +Bundle-Activator: org.eclipse.papyrus.sysml.propertylifecycle.Activator +Require-Bundle: org.eclipse.ui;bundle-version="3.107.0", + org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.propertylifecycle;bundle-version="0.0.1", + org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.9.0", + org.eclipse.uml2.uml;bundle-version="5.2.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", + org.eclipse.papyrus.sysml +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/about.html b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/about.html new file mode 100755 index 00000000000..d35d5aed64c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/build.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/build.properties new file mode 100755 index 00000000000..17daa5b49ca --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/pom.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/pom.xml new file mode 100755 index 00000000000..840663ba8aa --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.eclipse.papyrus.sysml.propertylifecycle + 0.0.1.qualifier + org.eclipse.papyrus + eclipse-plugin + + org.eclipse.papyrus + org.eclipse.papyrus.infra.propertylifecycle + 0.0.1.qualifier + ../../../infra/propertylifecycle/org.eclipse.papyrus.infra.propertylifecycle/pom.xml + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/Activator.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/Activator.java new file mode 100755 index 00000000000..d6a4e567c78 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/Activator.java @@ -0,0 +1,76 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle; + +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 { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.propertylifecycle"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** Logging helper */ + public static LogHelper log; + + /** The tag to identify the trace when activating the messages in the .options file */ + public static String PLCSTRATEGY_TRACE = "PLCStrategy_SYSMLproperty"; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + log = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ActorPartPropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ActorPartPropertyProcessor.java new file mode 100755 index 00000000000..7a5b96740e4 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ActorPartPropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ActorPartPropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ActorPartPropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("actorPart", element.eContainer().eContents()); //$NON-NLS-1$ + LifecycleSetCommand setCommand = new LifecycleSetCommand("ActorPartProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/AllocateProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/AllocateProcessor.java new file mode 100755 index 00000000000..d0cb3974167 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/AllocateProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.allocations.AllocationsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class AllocateProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public AllocateProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(AllocationsPackage.eINSTANCE.getAllocate().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Allocate_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/BlockProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/BlockProcessor.java new file mode 100755 index 00000000000..d5a6f362f11 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/BlockProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.blocks.BlocksPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class BlockProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public BlockProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getBlock().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Block_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConformProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConformProcessor.java new file mode 100755 index 00000000000..b5ed7f98409 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConformProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.modelelements.ModelelementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ConformProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ConformProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ModelelementsPackage.eINSTANCE.getConform().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Conform_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockParameterProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockParameterProcessor.java new file mode 100755 index 00000000000..40275d05319 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockParameterProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ConstraintBlockParameterProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ConstraintBlockParameterProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("parameter", element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ConstraintBlockParameter_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockProcessor.java new file mode 100755 index 00000000000..af48c7914cb --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintBlockProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ConstraintBlockProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ConstraintBlockProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ConstraintsPackage.eINSTANCE.getConstraintBlock().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ConstraintBlock_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintPropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintPropertyProcessor.java new file mode 100755 index 00000000000..0e428f51989 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ConstraintPropertyProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ConstraintPropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ConstraintPropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ConstraintsPackage.eINSTANCE.getConstraintProperty().getName().toLowerCase(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ConstraintProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/CopyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/CopyProcessor.java new file mode 100755 index 00000000000..524b97cf174 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/CopyProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class CopyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public CopyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(RequirementsPackage.eINSTANCE.getCopy().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Copy_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/DimensionProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/DimensionProcessor.java new file mode 100755 index 00000000000..90464ba4a24 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/DimensionProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.blocks.BlocksPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class DimensionProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public DimensionProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getDimension().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Dimension_ConfR", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPortProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPortProcessor.java new file mode 100755 index 00000000000..776c0bcd66b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPortProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class FlowPortProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public FlowPortProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(PortandflowsPackage.eINSTANCE.getFlowPort().getName().toLowerCase(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("FlowPort_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPropertyProcessor.java new file mode 100755 index 00000000000..6026500a4fc --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowPropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class FlowPropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public FlowPropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(PortandflowsPackage.eINSTANCE.getFlowProperty().getName().toLowerCase(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("FlowProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowSpecificationprocessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowSpecificationprocessor.java new file mode 100755 index 00000000000..bfc47f6cf8b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/FlowSpecificationprocessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class FlowSpecificationprocessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public FlowSpecificationprocessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(PortandflowsPackage.eINSTANCE.getFlowSpecification().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("FlowSpecification_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ItemFlowProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ItemFlowProcessor.java new file mode 100755 index 00000000000..06ab7963676 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ItemFlowProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ItemFlowProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ItemFlowProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(PortandflowsPackage.eINSTANCE.getItemFlow().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ItemFlow_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/PartPropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/PartPropertyProcessor.java new file mode 100755 index 00000000000..0970ea6b0c4 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/PartPropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class PartPropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public PartPropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("part", element.eContainer().eContents()); //$NON-NLS-1$ + LifecycleSetCommand setCommand = new LifecycleSetCommand("PartProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ReferencePropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ReferencePropertyProcessor.java new file mode 100755 index 00000000000..91ad8adb0d0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ReferencePropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ReferencePropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ReferencePropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("reference", element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ReferenceProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/RequirementProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/RequirementProcessor.java new file mode 100755 index 00000000000..6115c79a3fc --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/RequirementProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class RequirementProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public RequirementProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(RequirementsPackage.eINSTANCE.getRequirement().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Requirement_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/SatisfyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/SatisfyProcessor.java new file mode 100755 index 00000000000..33f7a0aebe2 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/SatisfyProcessor.java @@ -0,0 +1,63 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class SatisfyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public SatisfyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (!(request instanceof ConfigureRequest)) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + // Initialize the element name based on the created IElementType + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(RequirementsPackage.eINSTANCE.getSatisfy().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Satisfy_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/UnitProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/UnitProcessor.java new file mode 100755 index 00000000000..1d1c88082da --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/UnitProcessor.java @@ -0,0 +1,63 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.blocks.BlocksPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class UnitProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public UnitProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + // Initialize the element name based on the created IElementType + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getUnit().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("UnitProcessor_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValuePropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValuePropertyProcessor.java new file mode 100755 index 00000000000..1e69fdb51f1 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValuePropertyProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ValuePropertyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ValuePropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("value", element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ValueProperty_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValueTypeProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValueTypeProcessor.java new file mode 100755 index 00000000000..2161e56752b --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ValueTypeProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.blocks.BlocksPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ValueTypeProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ValueTypeProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getValueType().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ValueType_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/VerifyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/VerifyProcessor.java new file mode 100755 index 00000000000..213579ac754 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/VerifyProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class VerifyProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public VerifyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(RequirementsPackage.eINSTANCE.getVerify().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("VerifyProcessor_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewPointProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewPointProcessor.java new file mode 100755 index 00000000000..412da66abd0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewPointProcessor.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.modelelements.ModelelementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ViewPointProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ViewPointProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ModelelementsPackage.eINSTANCE.getViewPoint().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ViewPointProcessor_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewProcessor.java new file mode 100755 index 00000000000..4bebed37eb8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.sysml.propertylifecycle/src/org/eclipse/papyrus/sysml/propertylifecycle/processors/ViewProcessor.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.sysml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.sysml.modelelements.ModelelementsPackage; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class ViewProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ViewProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + NamedElement element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + if (element != null && feature != null) { + + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(ModelelementsPackage.eINSTANCE.getView().getName(), element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("ViewProcessor_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.classpath b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.classpath new file mode 100755 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.gitignore b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.gitignore new file mode 100755 index 00000000000..ae3c1726048 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.options b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.options new file mode 100755 index 00000000000..2eaa5a2221a --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.options @@ -0,0 +1,3 @@ +# Tracing options for the org.eclipse.paprus.uml.propertylifecycle plug-in +org.eclipse.papyrus.uml.propertylifecycle/debug=true +org.eclipse.papyrus.uml.propertylifecycle/debug/PLCStrategy_UMLproperty=true diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.project b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.project new file mode 100755 index 00000000000..5a352e16884 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.uml.propertylifecycle + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.settings/org.eclipse.jdt.core.prefs b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..0c68a61dca8 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/META-INF/MANIFEST.MF b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..964982501af --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Propertylifecycle +Bundle-SymbolicName: org.eclipse.papyrus.uml.propertylifecycle +Bundle-Version: 0.0.1.qualifier +Bundle-Activator: org.eclipse.papyrus.uml.propertylifecycle.Activator +Require-Bundle: org.eclipse.ui;bundle-version="3.107.0", + org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.papyrus.propertylifecycle;bundle-version="0.0.1", + org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.9.0", + org.eclipse.uml2.uml;bundle-version="5.2.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/about.html b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/about.html new file mode 100755 index 00000000000..d35d5aed64c --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/build.properties b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/build.properties new file mode 100755 index 00000000000..17daa5b49ca --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/pom.xml b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/pom.xml new file mode 100755 index 00000000000..e634972ac9a --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.eclipse.papyrus.uml.propertylifecycle + 0.0.1.qualifier + org.eclipse.papyrus + eclipse-plugin + + org.eclipse.papyrus + org.eclipse.papyrus.infra.propertylifecycle + 0.0.1.qualifier + ../../../infra/propertylifecycle/org.eclipse.papyrus.infra.propertylifecycle/pom.xml + + diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/Activator.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/Activator.java new file mode 100755 index 00000000000..848ddd031d6 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/Activator.java @@ -0,0 +1,76 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.uml.propertylifecycle; + +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 { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.propertylifecycle"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** Logging helper */ + public static LogHelper log; + + /** The tag to identify the trace when activating the messages in the .options file */ + public static String PLCSTRATEGY_TRACE = "PLCStrategy_UMLproperty"; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + log = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/AssociationProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/AssociationProcessor.java new file mode 100755 index 00000000000..2b58fc63f94 --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/AssociationProcessor.java @@ -0,0 +1,150 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.uml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.propertylifecycle.Activator; +import org.eclipse.uml2.uml.Association; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Property; + +/** + * + */ +public class AssociationProcessor implements CommandValueProcessor { + + Association association; + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request, isImmutable); + } + + public AssociationProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request, boolean isImmutable) { + if (isImmutable) { + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "isJambon: " + isImmutable); + } else { + Activator.log.trace(Activator.PLCSTRATEGY_TRACE, "isJambon: " + isImmutable); + } + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + association = (Association) confRequest.getElementToConfigure(); + Classifier sourceType = getSourceOwnerType(confRequest); + Classifier targetType = getTargetOwnerType(confRequest); + + String initializedName = "A_" + sourceType.getName() + "_" + targetType.getName();//$NON-NLS-1$ //$NON-NLS-2$ + EStructuralFeature feature = association.eClass().getEStructuralFeature("name"); + + ICommand setCommand = new LifecycleSetCommand("AssociationConfigure", association, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + + if (request instanceof ReorientRelationshipRequest) { + ReorientRelationshipRequest reorientRequest = (ReorientRelationshipRequest) request; + + association = (Association) reorientRequest.getRelationship(); + EStructuralFeature feature = association.eClass().getEStructuralFeature("name"); + if (association == null || feature == null) { + return gmfCommand; + } + + Property sourceProperty = association.getMemberEnds().get(1); + Property targetProperty = association.getMemberEnds().get(0); + String initializedName = null; + + if (reorientRequest.getDirection() == ReorientRelationshipRequest.REORIENT_SOURCE) { + sourceProperty.setName(getReorientOwnerType(reorientRequest).getName().toLowerCase()); + initializedName = "A_" + getReorientOwnerType(reorientRequest).getName() + "_" + targetProperty.getType().getName(); + } + if (reorientRequest.getDirection() == ReorientRelationshipRequest.REORIENT_TARGET) { + targetProperty.setName(getReorientOwnerType(reorientRequest).getName().toLowerCase()); + initializedName = "A_" + sourceProperty.getType().getName() + "_" + getReorientOwnerType(reorientRequest).getName(); + } + + // The strategies will be browsed by this setRequest and a command will be constructed in the PropertyProcessor if any match + ICommand setCommand = new LifecycleSetCommand("AssociationReorient", association, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + + return gmfCommand; + } + + + /** + * This method provides the new owner type + * + * @param request + * The {@link ConfigureRequest} + * @return + * The Classifier owning the new end or null if none exists + */ + protected Classifier getReorientOwnerType(ReorientRelationshipRequest request) { + Object paramObject = request.getNewRelationshipEnd(); + if (paramObject instanceof Classifier) { + return (Classifier) paramObject; + } + + return null; + } + + /** + * This method provides the source type + * + * @param request + * The {@link ConfigureRequest} + * @return + * The Classifier owning the new end or null if none exists + */ + protected Classifier getSourceOwnerType(ConfigureRequest request) { + Object paramObject = request.getParameter(CreateRelationshipRequest.SOURCE); + if (paramObject instanceof Classifier) { + return (Classifier) paramObject; + } + + return null; + } + + /** + * This method provides the target type + * + * @param request + * The {@link ConfigureRequest} + * @return + * The Classifier owning the new end or null if none exists + */ + protected Classifier getTargetOwnerType(ConfigureRequest request) { + Object paramObject = request.getParameter(CreateRelationshipRequest.TARGET); + if (paramObject instanceof Classifier) { + return (Classifier) paramObject; + } + + return null; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/ExtendProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/ExtendProcessor.java new file mode 100755 index 00000000000..d8014a95dba --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/ExtendProcessor.java @@ -0,0 +1,86 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.uml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.Extend; +import org.eclipse.uml2.uml.ExtensionPoint; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UseCase; + +/** + * + */ +public class ExtendProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public ExtendProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + Extend extend = (Extend) confRequest.getElementToConfigure(); + UseCase target = getTarget(confRequest); + if ((target == null)) { + return gmfCommand; + } + + ExtensionPoint targetEnd = UMLFactory.eINSTANCE.createExtensionPoint(); + // Add extensionLocations references + extend.getExtensionLocations().add(targetEnd); + // Add end in the model + target.getExtensionPoints().add(targetEnd); + + EStructuralFeature feature = targetEnd.eClass().getEStructuralFeature("name"); + String nameValue = NamedElementUtil.getDefaultNameWithIncrement(targetEnd, targetEnd.getOwner().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Extend_Set", + targetEnd, feature, nameValue); + + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + + return gmfCommand; + } + + /** + * This method provides the target type provided as {@link ConfigureRequest} parameter. + * + * @return the target role + */ + protected UseCase getTarget(ConfigureRequest req) { + UseCase result = null; + Object paramObject = req.getParameter(CreateRelationshipRequest.TARGET); + if (paramObject instanceof UseCase) { + result = (UseCase) paramObject; + } + return result; + } +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/PropertyProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/PropertyProcessor.java new file mode 100755 index 00000000000..82bcd3ea9fd --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/PropertyProcessor.java @@ -0,0 +1,85 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.uml.propertylifecycle.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.messages.Messages; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +/** + * + */ +public class PropertyProcessor implements CommandValueProcessor { + + NamedElement element; + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request, isImmutable); + } + + public PropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request, boolean isImmutable) { + ICommand gmfCommand = null; + + if (request instanceof SetRequest) { + SetRequest setRequest = (SetRequest) request; + Object nameValue; + // TransactionalEditingDomain domain = request.getEditingDomain(); + + element = (NamedElement) setRequest.getElementToEdit(); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + if (element != null && feature != null && !isImmutable) { + // EStructuralFeature setFeature = setRequest.getFeature(); + Object newValue = setRequest.getValue(); + nameValue = newValue; + + // LifecycleSetCommand setCommand = new LifecycleSetCommand(domain, "Property_Set", + // element, feature, nameValue); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Property_Set", + element, feature, nameValue); + + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + + } + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + element = (NamedElement) confRequest.getElementToConfigure(); + EStructuralFeature feature = element.eClass().getEStructuralFeature(Messages.FEATURELABEL_NAME); + + if (element != null && feature != null && !isImmutable) { + // Set default name + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("Attribute", element.eContainer().eContents()); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Property_SetName", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/RoleBindingProcessor.java b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/RoleBindingProcessor.java new file mode 100755 index 00000000000..b7b762fbe4e --- /dev/null +++ b/extraplugins/propertylifecycle/org.eclipse.papyrus.uml.propertylifecycle/src/org/eclipse/papyrus/uml/propertylifecycle/processors/RoleBindingProcessor.java @@ -0,0 +1,52 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.uml.propertylifecycle.processors; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.uml2.uml.Dependency; + +/** + * + */ +public class RoleBindingProcessor implements CommandValueProcessor { + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request); + } + + public RoleBindingProcessor() { + + } + + public ICommand setName(final AbstractEditCommandRequest request) { + if (!(request instanceof CreateRelationshipRequest)) { + } + + CreateRelationshipRequest relRequest = (CreateRelationshipRequest) request; + + Dependency dependency = (Dependency) (relRequest).getNewElement(); + // NamedElement target = (NamedElement) request.getTarget(); + // ConnectableElement roleToBind = (ConnectableElement) dialog.getFirstResult(); + // // Create a Dependency (the binding) between selected role and a ConnectableElement (the target) + // dependency.setName("binding_" + roleToBind.getName() + "_" + target.getName()); + + + return null; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.classpath b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.classpath new file mode 100755 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.options b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.options new file mode 100755 index 00000000000..317cc0ddabc --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.options @@ -0,0 +1,3 @@ +# Tracing options for the org.eclipse.paprus.infra.propertylifecycle.tests plug-in +org.eclipse.papyrus.infra.propertylifecycle.tests/debug=true +org.eclipse.papyrus.infra.propertylifecycle.tests/debug/PLCStrategy_Tests=true diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.project b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.project new file mode 100755 index 00000000000..fe300e531ca --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.propertylifecycle.tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..0c68a61dca8 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..248bd0d3693 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/META-INF/MANIFEST.MF @@ -0,0 +1,31 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Tests +Bundle-SymbolicName: org.eclipse.papyrus.propertylifecycle.tests;singleton:=true +Bundle-Version: 0.0.1.qualifier +Bundle-Activator: org.eclipse.papyrus.propertylifecycle.tests.Activator +Require-Bundle: org.eclipse.ui;bundle-version="3.107.0", + org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.junit;bundle-version="4.12.0", + org.eclipse.papyrus.propertylifecycle.model;bundle-version="0.0.1", + org.eclipse.core.resources, + org.eclipse.papyrus.infra.core;bundle-version="1.2.0", + org.eclipse.emf.transaction, + org.eclipse.papyrus.uml.tools, + org.eclipse.papyrus.infra.services.edit, + org.eclipse.emf.validation, + org.eclipse.gmf.runtime.emf.type.core, + org.eclipse.papyrus.uml.tools.utils, + org.eclipse.papyrus.infra.ui, + org.eclipse.gmf.runtime.common.core, + org.eclipse.emf.ecore, + org.eclipse.papyrus.propertylifecycle.preferences, + org.eclipse.papyrus.propertylifecycle, + org.eclipse.papyrus.uml.diagram.wizards, + org.eclipse.papyrus.sysml +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Import-Package: org.eclipse.papyrus.infra.emf.gmf.command diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/about.html b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/about.html new file mode 100755 index 00000000000..82d49bf5f81 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/build.properties b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/build.properties new file mode 100755 index 00000000000..34d2e4d2dad --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/plugin.xml b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/plugin.xml new file mode 100755 index 00000000000..5535690d377 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/pom.xml b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/pom.xml new file mode 100755 index 00000000000..0b28a7e09a2 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + org.eclipse.papyrus.infra.propertylifecycle.tests + 0.0.1.qualifier + org.eclipse.papyrus + eclipse-plugin + + ../org.eclipse.papyrus.infra.propertylifecycle/pom.xml + 0.0.1.qualifier + org.eclipse.papyrus.infra.propertylifecycle + org.eclipse.papyrus + + diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/Activator.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/Activator.java new file mode 100755 index 00000000000..4a1955f6f49 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/Activator.java @@ -0,0 +1,63 @@ +package org.eclipse.papyrus.propertylifecycle.tests; + +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 { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.propertylifecycle.tests"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + // The logging helper + public static LogHelper log; + + // The traces for debug purposes (don't forget to add them in the .options and the debug configurations) + public static String PLCSTRATEGY_TESTS_TRACE = "PLCStrategy_Tests"; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + log = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/AllTests.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/AllTests.java new file mode 100755 index 00000000000..1cfbe3e3d5c --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/AllTests.java @@ -0,0 +1,27 @@ +/***************************************************************************** + * Copyright (c) 2016 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: + * Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.propertylifecycle.tests; + +import org.junit.runner.RunWith; +import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite; +import org.eclipse.papyrus.propertylifecycle.tests.tests.PropertyLifecycleTests; +import org.junit.runners.Suite.SuiteClasses; + + +/** + * All tests for this fragment + */ +@RunWith(ClassificationSuite.class) +@SuiteClasses({ PropertyLifecycleTests.class }) +public class AllTests { + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/model/UMLTestModel.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/model/UMLTestModel.java new file mode 100755 index 00000000000..93b875e8035 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/model/UMLTestModel.java @@ -0,0 +1,168 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.model; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.CommonPlugin; +import org.eclipse.emf.common.util.URI; +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.emf.ecore.xmi.XMIResource; +import org.eclipse.papyrus.propertylifecycle.tests.Activator; +import org.eclipse.papyrus.propertylifecycle.tests.utils.ITestConstants; +import org.eclipse.papyrus.sysml.util.SysmlResource; +import org.eclipse.papyrus.uml.tools.utils.CustomUMLUtil.StereotypeApplicationHelper; +import org.eclipse.papyrus.uml.tools.utils.PackageUtil; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Component; +import org.eclipse.uml2.uml.Model; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.PackageableElement; +import org.eclipse.uml2.uml.Profile; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + + +/** + * Initialize the test model with elements before the application of the strategySet + * + */ +public class UMLTestModel implements ITestConstants { + + public static Model rootModel; + + public static Model initUMLModel() { + createUMLModel(); + + return rootModel; + } + + public static ResourceSet initUMLModel(IProject parentProject) throws CoreException, IOException { + createUMLModel(); + + return saveUMLModel(rootModel, parentProject); + } + + + public static void createUMLModel() { + rootModel = UMLFactory.eINSTANCE.createModel(); + rootModel.setName(ROOTMODEL_NAME); + + createClassSubPackage(rootModel); + createComponentPackage(rootModel); + createSubModel(rootModel); + + } + + private static ResourceSet saveUMLModel(Model rootModel, IProject parentProject) throws CoreException, IOException { + ResourceSet umlResourceSet = new ResourceSetImpl(); + IFolder modelFolder = createRecursiveFolder(parentProject.getFolder(RESOURCES_FOLDERNAME)); + URI modelURI = URI.createPlatformResourceURI(modelFolder.getFullPath().toString() + "/" + RESOURCES_UMLMODELNAME, true); + Resource modelResource = umlResourceSet.createResource(modelURI); + modelResource.getContents().add(rootModel); + + try { + Map options = new HashMap<>(); + options.put(XMIResource.OPTION_ENCODING, RESOURCES_ENCODING); + modelResource.save(options); + + // String filePath = "~/Desktop/"; + // String localPath = filePath.replaceFirst("^~", System.getProperty("user.home").replace("\\", "/")); + // Resource desktopModelResource = modelResource; + // desktopModelResource.setURI(CommonPlugin.resolve(URI.createFileURI(localPath + "desktop.uml"))); + // desktopModelResource.save(options); + + return umlResourceSet; + } catch (IOException ioe) { + Activator.log.error(ioe); + } + + return null; + } + + public static IFolder createRecursiveFolder(IFolder folderToCreate) throws CoreException { + if (folderToCreate.exists()) { + return folderToCreate; + } + + folderToCreate.create(true, true, new NullProgressMonitor()); + return folderToCreate; + } + + + + private static Package createClassSubPackage(Model rootModel) { + Package classPackage = rootModel.createNestedPackage(CLASS_PACKAGE_NAME); + PackageableElement newClass = classPackage.createPackagedElement(CLASS_NAME, UMLFactory.eINSTANCE.createClass().eClass()); + Class beforeStrategyClass = (Class) newClass; + beforeStrategyClass.createOwnedAttribute(PROPERTY_CLASS_NAME, UMLFactory.eINSTANCE.createProperty().getType()); + + return classPackage; + } + + + private static Package createComponentPackage(Model rootModel) { + Package componentPackage = rootModel.createNestedPackage(COMPONENT_PACKAGE_NAME); + PackageableElement newComponent = componentPackage.createPackagedElement(COMPONENT_NAME, UMLFactory.eINSTANCE.createComponent().eClass()); + Component beforeStrategyComponent = (Component) newComponent; + beforeStrategyComponent.createOwnedAttribute(PROPERTY_COMPONENT_NAME, UMLFactory.eINSTANCE.createProperty().getType()); + + return componentPackage; + } + + private static Package createSubModel(Model rootModel) { + Model subModel = UMLFactory.eINSTANCE.createModel(); + Package subPackage = rootModel.createNestedPackage(SUBMODEL_NAME, subModel.eClass()); + + ResourceSet resourceSet = new ResourceSetImpl(); + Resource sysmlProfileResource = resourceSet.getResource(URI.createURI(SysmlResource.SYSML_PROFILE_URI), true); + Profile sysmlProfile = (Profile) EcoreUtil.getObjectByType(sysmlProfileResource.getContents(), UMLPackage.Literals.PACKAGE); + PackageUtil.applyProfile(subPackage, sysmlProfile, true); + + // TransactionalEditingDomain domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(); + // AbstractTransactionalCommand newCommand = new AbstractTransactionalCommand(domain, "ApplyProfile", Collections.EMPTY_LIST) { + // + // @Override + // protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + // if (PackageUtil.applyProfile((org.eclipse.uml2.uml.Package) subPackage, sysmlProfile, true)) { + // return CommandResult.newOKCommandResult(); + // } + // return CommandResult.newErrorCommandResult("Profile " + sysmlProfile.getName() + " could not be applied"); + // } + // }; + // try { + // newCommand.execute(new NullProgressMonitor(), null); + // } catch (ExecutionException e) { + // fail(e.getMessage()); + // } + PackageableElement newComponent = subPackage.createPackagedElement(COMPONENT_NAME, UMLFactory.eINSTANCE.createComponent().eClass()); + // StereotypeApplicationHelper.INSTANCE.applyStereotype(newComponent, UMLPackage.eINSTANCE.getComponent()); + PackageableElement newClass = subPackage.createPackagedElement(CLASS_NAME, UMLFactory.eINSTANCE.createClass().eClass()); + Class beforeStrategyClass = (Class) newClass; + beforeStrategyClass.createOwnedAttribute(PROPERTY_CLASS_NAME, UMLFactory.eINSTANCE.createProperty().getType()); + + return subPackage; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/StrategyTestModel.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/StrategyTestModel.java new file mode 100755 index 00000000000..365f76ae01f --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/StrategyTestModel.java @@ -0,0 +1,229 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.strategies; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.CommonPlugin; +import org.eclipse.emf.common.util.URI; +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.xmi.XMIResource; +import org.eclipse.papyrus.propertylifecycle.ElementContainer; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.JavaProcessor; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.tests.Activator; +import org.eclipse.papyrus.propertylifecycle.tests.utils.ITestConstants; +import org.eclipse.papyrus.propertylifecycle.tests.utils.StrategyFactory; +import org.junit.Assert; +import org.junit.Test; + +/** + * Initialize the test strategySet model + * + */ +public class StrategyTestModel implements ITestConstants { + + public static StrategySet strategySet; + + public static StrategyFactory strategyFactory = new StrategyFactory(); + + public static StrategySet initStrategyModel() { + strategySet = StrategyFactory.createStrategySet(STRATEGYSET_DESCRIPTION, STRATEGYSET_ID, STRATEGYSET_NAME); + addStrategies(strategySet); + + return strategySet; + } + + public static ResourceSet initStrategyModel(IProject parentProject) throws CoreException, IOException { + strategySet = StrategyFactory.createStrategySet(STRATEGYSET_DESCRIPTION, STRATEGYSET_ID, STRATEGYSET_NAME); + addStrategies(strategySet); + + return saveStrategyModel(strategySet, parentProject); + } + + private static ResourceSet saveStrategyModel(StrategySet strategyModel, IProject parentProject) throws CoreException, IOException { + ResourceSet strategyResourceSet = new ResourceSetImpl(); + String modelFileName = RESOURCES_STRATEGYMODELNAME; + IFolder modelFolder = createRecursiveFolder(parentProject.getFolder(RESOURCES_FOLDERNAME)); + URI modelURI = CommonPlugin.resolve(URI.createFileURI(modelFolder.getFullPath().toString() + "/" + modelFileName)); + Resource modelResource = strategyResourceSet.createResource(modelURI); + modelResource.getContents().add(strategyModel); + + try { + Map options = new HashMap<>(); + options.put(XMIResource.OPTION_ENCODING, RESOURCES_ENCODING); + modelResource.save(options); + // String filePath = "~/Desktop/"; + // String localPath = filePath.replaceFirst("^~", System.getProperty("user.home").replace("\\", "/")); + // modelResource.setURI(CommonPlugin.resolve(URI.createFileURI(localPath + RESOURCES_UMLMODELNAME))); + // modelResource.save(null); + return strategyResourceSet; + } catch (IOException ioe) { + Activator.log.error(ioe); + } + + return null; + } + + public static IFolder createRecursiveFolder(IFolder folderToCreate) throws CoreException { + if (folderToCreate.exists()) { + return folderToCreate; + } + + folderToCreate.create(true, true, new NullProgressMonitor()); + return folderToCreate; + } + + protected static void addStrategies(StrategySet strategySet) { + Collection strategies = new ArrayList<>(); + strategies.add(componentStrategy()); + strategies.add(classStrategy()); + strategies.add(propertyComponentStrategy()); + strategies.add(propertyClassStrategy()); + strategies.add(sysmlBlockStrategy()); + strategies.add(sysml14BlockStrategy()); + strategies.add(associationStrategy()); + + strategySet.getStrategies().addAll(strategies); + Assert.assertEquals("There should be 7 strategies created in the model", 7, strategySet.getStrategies().size()); + } + + /** The component strategy renames a Component when created */ + protected static StrategyElement componentStrategy() { + StrategyElement componentStrategy = strategyFactory.createStrategy(STRATEGYELEMENT_BASETYPE_COMPONENT, STRATEGYELEMENT_DESCRIPTION_COMPONENT, + STRATEGYELEMENT_ID_COMPONENT, STRATEGYELEMENT_NAME_COMPONENT, STRATEGYELEMENT_SPECIALIZEDTYPE_COMPONENT); + JavaProcessor valueProcessor = strategyFactory.createJavaProcessor(ELEMENTPROPERTY_PROCESSORPATH_COMPONENT); + ElementProperty componentProperty = strategyFactory.createProperty(STRATEGYPROPERTY_FEATURELABEL_COMPONENT, ELEMENTPROPERTY_PRIORITY_COMPONENT, + valueProcessor); + + componentStrategy.getElementProperties().add(componentProperty); + Assert.assertTrue("The properties should not be empty", componentStrategy.getElementProperties().size() > 0); + + return componentStrategy; + } + + /** The class strategy renames a Class created inside a Model */ + protected static StrategyElement classStrategy() { + StrategyElement classStrategy = strategyFactory.createStrategy(STRATEGYELEMENT_BASETYPE_CLASS, STRATEGYELEMENT_DESCRIPTION_CLASS, + STRATEGYELEMENT_ID_CLASS, STRATEGYELEMENT_NAME_CLASS, STRATEGYELEMENT_SPECIALIZEDTYPE_CLASS); + ElementContainer classContainer = strategyFactory.createContainer(STRATEGYCONTAINER_BASETYPE_CLASS, STRATEGYCONTAINER_SPECIALIZEDTYPE_CLASS, + null); + JavaProcessor valueProcessor = strategyFactory.createJavaProcessor(ELEMENTPROPERTY_PROCESSORPATH_CLASS); + ElementProperty classProperty = strategyFactory.createProperty(STRATEGYPROPERTY_FEATURELABEL_CLASS, ELEMENTPROPERTY_PRIORITY_CLASS, + valueProcessor); + + classStrategy.getElementContainers().add(classContainer); + Assert.assertTrue("The containers should not be empty", classStrategy.getElementContainers().size() > 0); + classStrategy.getElementProperties().add(classProperty); + Assert.assertTrue("The properties should not be empty", classStrategy.getElementProperties().size() > 0); + + return classStrategy; + } + + /** the property strategy renames a Property created inside a Class and when the Class changes its name afterwards */ + protected static StrategyElement propertyComponentStrategy() { + StrategyElement propertyStrategy = strategyFactory.createStrategy(STRATEGYELEMENT_BASETYPE_PROPERTY, STRATEGYELEMENT_DESCRIPTION_PROPERTY, + STRATEGYELEMENT_ID_COMPONENTPROPERTY, STRATEGYELEMENT_NAME_COMPONENTPROPERTY, STRATEGYELEMENT_SPECIALIZEDTYPE_PROPERTY); + ElementContainer propertyContainer = strategyFactory.createContainer(STRATEGYCONTAINER_BASETYPE_COMPONENTPROPERTY, STRATEGYCONTAINER_SPECIALIZEDTYPE_PROPERTY, + null); + JavaProcessor valueProcessor = strategyFactory.createJavaProcessor(ELEMENTPROPERTY_PROCESSORPATH_PROPERTY); + ElementProperty propertyProperty = strategyFactory.createProperty(STRATEGYPROPERTY_FEATURELABEL_PROPERTY, ELEMENTPROPERTY_PRIORITY_PROPERTY, + valueProcessor); + + propertyStrategy.getElementContainers().add(propertyContainer); + Assert.assertTrue("The containers should not be empty", propertyStrategy.getElementContainers().size() > 0); + propertyStrategy.getElementProperties().add(propertyProperty); + Assert.assertTrue("The properties should not be empty", propertyStrategy.getElementProperties().size() > 0); + + return propertyStrategy; + } + + + /** the property strategy renames a Property created inside a Class and when the Class changes its name afterwards */ + protected static StrategyElement propertyClassStrategy() { + StrategyElement propertyStrategy = strategyFactory.createStrategy(STRATEGYELEMENT_BASETYPE_PROPERTY, STRATEGYELEMENT_DESCRIPTION_PROPERTY, + STRATEGYELEMENT_ID_CLASSPROPERTY, STRATEGYELEMENT_NAME_CLASSPROPERTY, STRATEGYELEMENT_SPECIALIZEDTYPE_PROPERTY); + ElementContainer propertyContainer = strategyFactory.createContainer(STRATEGYCONTAINER_BASETYPE_CLASSPROPERTY, STRATEGYCONTAINER_SPECIALIZEDTYPE_PROPERTY, + null); + JavaProcessor valueProcessor = strategyFactory.createJavaProcessor(ELEMENTPROPERTY_PROCESSORPATH_PROPERTY); + ElementProperty propertyProperty = strategyFactory.createProperty(STRATEGYPROPERTY_FEATURELABEL_PROPERTY, ELEMENTPROPERTY_PRIORITY_CLASSPROPERTY, + valueProcessor); + + propertyStrategy.getElementContainers().add(propertyContainer); + Assert.assertTrue("The containers should not be empty", propertyStrategy.getElementContainers().size() > 0); + propertyStrategy.getElementProperties().add(propertyProperty); + Assert.assertTrue("The properties should not be empty", propertyStrategy.getElementProperties().size() > 0); + + return propertyStrategy; + } + + + /** the sysmlblock strategy renames a sysml Block when created */ + protected static StrategyElement sysmlBlockStrategy() { + StrategyElement sysmlBlockStrategy = strategyFactory.createStrategy(STRATEGYELEMENT_BASETYPE_SYSMLBLOCK, STRATEGYELEMENT_DESCRIPTION_SYSMLBLOCK, + STRATEGYELEMENT_ID_SYSMLBLOCK, STRATEGYELEMENT_NAME_SYSMLBLOCK, STRATEGYELEMENT_SPECIALIZEDTYPE_SYSMLBLOCK); + JavaProcessor valueProcessor = strategyFactory.createJavaProcessor(ELEMENTPROPERTY_PROCESSORPATH_SYSMLBLOCK); + ElementProperty sysmlBlockProperty = strategyFactory.createProperty(STRATEGYPROPERTY_FEATURELABEL_SYSMLBLOCK, ELEMENTPROPERTY_PRIORITY_SYSMLBLOCK, + valueProcessor); + + Assert.assertTrue("The containers should be empty", sysmlBlockStrategy.getElementContainers().size() == 0); + sysmlBlockStrategy.getElementProperties().add(sysmlBlockProperty); + Assert.assertTrue("The properties should not be empty", sysmlBlockStrategy.getElementProperties().size() > 0); + + return sysmlBlockStrategy; + } + + /** the sysml14block strategy renames a sysml14 Block when created */ + protected static StrategyElement sysml14BlockStrategy() { + StrategyElement sysml14BlockStrategy = strategyFactory.createStrategy(STRATEGYELEMENT_BASETYPE_SYSML14BLOCK, STRATEGYELEMENT_DESCRIPTION_SYSML14BLOCK, + STRATEGYELEMENT_ID_SYSML14BLOCK, STRATEGYELEMENT_NAME_SYSML14BLOCK, STRATEGYELEMENT_SPECIALIZEDTYPE_SYSML14BLOCK); + JavaProcessor valueProcessor = strategyFactory.createJavaProcessor(ELEMENTPROPERTY_PROCESSORPATH_SYSML14BLOCK); + ElementProperty sysml14BlockProperty = strategyFactory.createProperty(STRATEGYPROPERTY_FEATURELABEL_SYSML14BLOCK, ELEMENTPROPERTY_PRIORITY_SYSML14BLOCK, + valueProcessor); + + Assert.assertTrue("The containers should be empty", sysml14BlockStrategy.getElementContainers().size() == 0); + sysml14BlockStrategy.getElementProperties().add(sysml14BlockProperty); + Assert.assertTrue("The properties should not be empty", sysml14BlockStrategy.getElementProperties().size() > 0); + + return sysml14BlockStrategy; + } + + /** the association strategy renames an Association when created and when reoriented afterwards */ + protected static StrategyElement associationStrategy() { + StrategyElement associationStrategy = strategyFactory.createStrategy(STRATEGYELEMENT_BASETYPE_ASSOCIATION, STRATEGYELEMENT_DESCRIPTION_ASSOCIATION, + STRATEGYELEMENT_ID_ASSOCIATION, STRATEGYELEMENT_NAME_ASSOCIATION, STRATEGYELEMENT_SPECIALIZEDTYPE_ASSOCIATION); + JavaProcessor valueProcessor = strategyFactory.createJavaProcessor(ELEMENTPROPERTY_PROCESSORPATH_ASSOCIATION); + ElementProperty associationProperty = strategyFactory.createProperty(STRATEGYPROPERTY_FEATURELABEL_ASSOCIATION, ELEMENTPROPERTY_PRIORITY_ASSOCIATION, + valueProcessor); + + Assert.assertTrue("The containers should be empty", associationStrategy.getElementContainers().size() == 0); + associationStrategy.getElementProperties().add(associationProperty); + Assert.assertTrue("The properties should not be empty", associationStrategy.getElementProperties().size() > 0); + + return associationStrategy; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/AssociationProcessor.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/AssociationProcessor.java new file mode 100755 index 00000000000..75e90e33900 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/AssociationProcessor.java @@ -0,0 +1,147 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.strategies.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.tests.Activator; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.uml2.uml.Association; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Property; + +/** + * + * + */ +public class AssociationProcessor implements CommandValueProcessor { + + Association association; + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request, isImmutable); + } + + public AssociationProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request, boolean isImmutable) { + if (isImmutable) { + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, "isJambon: " + isImmutable); + } else { + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, "isJambon: " + isImmutable); + } + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + + association = (Association) confRequest.getElementToConfigure(); + Classifier sourceType = getSourceOwnerType(confRequest); + Classifier targetType = getTargetOwnerType(confRequest); + + String initializedName = "A_" + sourceType.getName() + "_" + targetType.getName();//$NON-NLS-1$ //$NON-NLS-2$ + EStructuralFeature feature = association.eClass().getEStructuralFeature("name"); + + ICommand setCommand = new LifecycleSetCommand("AssociationConfigure", association, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + + if (request instanceof ReorientRelationshipRequest) { + ReorientRelationshipRequest reorientRequest = (ReorientRelationshipRequest) request; + + association = (Association) reorientRequest.getRelationship(); + Property sourceProperty = association.getMemberEnds().get(1); + Property targetProperty = association.getMemberEnds().get(0); + EStructuralFeature feature = association.eClass().getEStructuralFeature("name"); + String initializedName = null; + + if (reorientRequest.getDirection() == ReorientRelationshipRequest.REORIENT_SOURCE) { + sourceProperty.setName(getReorientOwnerType(reorientRequest).getName().toLowerCase()); + initializedName = "A_" + getReorientOwnerType(reorientRequest).getName() + "_" + targetProperty.getType().getName(); + } + if (reorientRequest.getDirection() == ReorientRelationshipRequest.REORIENT_TARGET) { + targetProperty.setName(getReorientOwnerType(reorientRequest).getName().toLowerCase()); + initializedName = "A_" + sourceProperty.getType().getName() + "_" + getReorientOwnerType(reorientRequest).getName(); + } + + // The strategies will be browsed by this setRequest and a command will be constructed in the PropertyProcessor if any match + ICommand setCommand = new LifecycleSetCommand("AssociationReorient", association, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + + return gmfCommand; + } + + + /** + * This method provides the new owner type + * + * @param request + * The {@link ConfigureRequest} + * @return + * The Classifier owning the new end or null if none exists + */ + protected Classifier getReorientOwnerType(ReorientRelationshipRequest request) { + Object paramObject = request.getNewRelationshipEnd(); + if (paramObject instanceof Classifier) { + return (Classifier) paramObject; + } + + return null; + } + + /** + * This method provides the source type + * + * @param request + * The {@link ConfigureRequest} + * @return + * The Classifier owning the new end or null if none exists + */ + protected Classifier getSourceOwnerType(ConfigureRequest request) { + Object paramObject = request.getParameter(CreateRelationshipRequest.SOURCE); + if (paramObject instanceof Classifier) { + return (Classifier) paramObject; + } + + return null; + } + + /** + * This method provides the target type + * + * @param request + * The {@link ConfigureRequest} + * @return + * The Classifier owning the new end or null if none exists + */ + protected Classifier getTargetOwnerType(ConfigureRequest request) { + Object paramObject = request.getParameter(CreateRelationshipRequest.TARGET); + if (paramObject instanceof Classifier) { + return (Classifier) paramObject; + } + + return null; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/ClassProcessor.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/ClassProcessor.java new file mode 100755 index 00000000000..e1af4415c3d --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/ClassProcessor.java @@ -0,0 +1,103 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.strategies.processors; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Property; + + +public class ClassProcessor implements CommandValueProcessor { + + NamedElement element; + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request, isImmutable); + } + + public ClassProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request, boolean isImmutable) { + ICommand gmfCommand = null; + + if (request instanceof SetRequest) { + SetRequest setRequest = (SetRequest) request; + element = (NamedElement) setRequest.getElementToEdit(); + TransactionalEditingDomain domain = request.getEditingDomain(); + LifecycleSetCommand classSetCommand = new LifecycleSetCommand(domain, "Class_Set", + element, setRequest.getFeature(), setRequest.getValue()); + gmfCommand = CompositeCommand.compose(gmfCommand, classSetCommand); + + for (EObject eObject : element.eContents()) { + if (eObject instanceof Property) { + EStructuralFeature feature = eObject.eClass().getEStructuralFeature("name"); + String value = "afterSetClassNamePropertyName"; + + // The strategies will be browsed by this setRequest and a command will be constructed in the PropertyProcessor if any match + SetRequest setPropRequest = new SetRequest(domain, eObject, feature, value); + + // SubRequest, outside of the current service edit (element) hence we can call on it again (eObject) without fear of loops + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(eObject); + ICommand createGMFCommand = provider.getEditCommand(setPropRequest); + + gmfCommand = CompositeCommand.compose(gmfCommand, createGMFCommand); + } + } + + if (gmfCommand != null) { + gmfCommand.reduce(); + } + + } else { + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + element = (NamedElement) confRequest.getElementToConfigure(); + } + if (request instanceof CreateElementRequest) { + CreateElementRequest createRequest = (CreateElementRequest) request; + element = (NamedElement) createRequest.getNewElement(); + } + + if (element != null && !isImmutable) { + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("NewClassName", element.eContainer().eContents()); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + + LifecycleSetCommand setCommand = new LifecycleSetCommand("Class_Conf&Create", + element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + + } + + return gmfCommand; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/ComponentProcessor.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/ComponentProcessor.java new file mode 100755 index 00000000000..7e199a1cb34 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/ComponentProcessor.java @@ -0,0 +1,101 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.strategies.processors; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Property; + + +public class ComponentProcessor implements CommandValueProcessor { + + NamedElement element; + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request, isImmutable); + } + + public ComponentProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request, boolean isImmutable) { + ICommand gmfCommand = null; + + if (request instanceof SetRequest) { + SetRequest setRequest = (SetRequest) request; + element = (NamedElement) setRequest.getElementToEdit(); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Component_Set", + element, setRequest.getFeature(), setRequest.getValue()); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + + // We want the name of the properties inside the element to change as well + for (EObject eObject : element.eContents()) { + if (eObject instanceof Property) { + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(element.getName() + "_property", element.eContents()); + EStructuralFeature feature = eObject.eClass().getEStructuralFeature("name"); + + // The strategies will be browsed by this setRequest and a command will be constructed in the PropertyProcessor if any match + SetRequest setPropRequest = new SetRequest(eObject, feature, initializedName); + + // SubRequest, outside of the current service edit (element) hence we can call on it again (eObject) without fear of loops + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(eObject); + ICommand createGMFCommand = provider.getEditCommand(setPropRequest); + + gmfCommand = CompositeCommand.compose(gmfCommand, createGMFCommand); + } + } + + if (gmfCommand != null) { + gmfCommand.reduce(); + } + + } else { + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + element = (NamedElement) confRequest.getElementToConfigure(); + } + if (request instanceof CreateElementRequest) { + CreateElementRequest createRequest = (CreateElementRequest) request; + element = (NamedElement) createRequest.getNewElement(); + } + + if (element != null && !isImmutable) { + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("NewComponentName", element.eContainer().eContents()); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + + ICommand setCommand = new LifecycleSetCommand("Component_Conf&Create", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} + diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/PropertyProcessor.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/PropertyProcessor.java new file mode 100755 index 00000000000..ef3fbab9e12 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/PropertyProcessor.java @@ -0,0 +1,92 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.strategies.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +public class PropertyProcessor implements CommandValueProcessor { + + NamedElement element; + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request, isImmutable); + } + + public PropertyProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request, boolean isImmutable) { + ICommand gmfCommand = null; + + if (request instanceof SetRequest) { + SetRequest setRequest = (SetRequest) request; + Object nameValue; + TransactionalEditingDomain domain = request.getEditingDomain(); + + element = (NamedElement) setRequest.getElementToEdit(); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + if (isImmutable) { + nameValue = "propertyNameIsImmutable"; + } else { + // EStructuralFeature setFeature = setRequest.getFeature(); + Object newValue = setRequest.getValue(); + nameValue = newValue; + } + + // LifecycleSetCommand setCommand = new LifecycleSetCommand(domain, "Property_Set", + // element, feature, nameValue); + LifecycleSetCommand setCommand = new LifecycleSetCommand("Property_Set", + element, feature, nameValue); + + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + + } else { + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + element = (NamedElement) confRequest.getElementToConfigure(); + } + if (request instanceof CreateElementRequest) { + CreateElementRequest createRequest = (CreateElementRequest) request; + element = (NamedElement) createRequest.getNewElement(); + } + + if (element != null /* && !isImmutable */) { + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("Attribute", element.eContainer().eContents()); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + // SetRequest setRequest = new SetRequest(element, feature, initializedName); + // return new SetValueCommand(setRequest); + + ICommand setCommand = new LifecycleSetCommand("Property_Conf&Create", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + } + + return gmfCommand; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/Sysml14BlockProcessor.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/Sysml14BlockProcessor.java new file mode 100755 index 00000000000..729cc1f567a --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/Sysml14BlockProcessor.java @@ -0,0 +1,58 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.strategies.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +public class Sysml14BlockProcessor implements CommandValueProcessor { + + NamedElement element; + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request, isImmutable); + } + + public Sysml14BlockProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request, boolean isImmutable) { + ICommand gmfCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + element = (NamedElement) confRequest.getElementToConfigure(); + } + + if (element != null && !isImmutable) { + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("NewSysml14BlockName", element.eContainer().eContents()); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + + ICommand setCommand = new LifecycleSetCommand("Sysml14Block", element, feature, initializedName); + gmfCommand = CompositeCommand.compose(gmfCommand, setCommand); + } + + return gmfCommand; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/SysmlBlockProcessor.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/SysmlBlockProcessor.java new file mode 100755 index 00000000000..97e18807090 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/strategies/processors/SysmlBlockProcessor.java @@ -0,0 +1,64 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.strategies.processors; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.papyrus.propertylifecycle.commands.LifecycleSetCommand; +import org.eclipse.papyrus.propertylifecycle.utils.CommandValueProcessor; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.NamedElement; + +public class SysmlBlockProcessor implements CommandValueProcessor { + + NamedElement element; + + @Override + public ICommand setValueFromRequest(String featureLabel, boolean isImmutable, AbstractEditCommandRequest request) { + return setName(request, isImmutable); + } + + public SysmlBlockProcessor() { + + } + + public ICommand setName(AbstractEditCommandRequest request, boolean isImmutable) { + ICommand compositeCommand = null; + + if (request instanceof ConfigureRequest) { + ConfigureRequest confRequest = (ConfigureRequest) request; + element = (NamedElement) confRequest.getElementToConfigure(); + } + + if (request instanceof CreateElementRequest) { + CreateElementRequest createRequest = (CreateElementRequest) request; + element = (NamedElement) createRequest.getNewElement(); + } + + if (element != null && !isImmutable) { + String initializedName = NamedElementUtil.getDefaultNameWithIncrementFromBase("NewSysmlBlockName", element.eContainer().eContents()); + EStructuralFeature feature = element.eClass().getEStructuralFeature("name"); + + ICommand setCommand = new LifecycleSetCommand("SysmlBlock_Conf&Create", element, feature, initializedName); + compositeCommand = CompositeCommand.compose(compositeCommand, setCommand); + } + + return compositeCommand; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/tests/AbstractPropertyLifecycleTests.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/tests/AbstractPropertyLifecycleTests.java new file mode 100755 index 00000000000..c5676b967c5 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/tests/AbstractPropertyLifecycleTests.java @@ -0,0 +1,316 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.tests; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.CommonPlugin; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.common.util.URI; +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.Diagnostician; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.xmi.XMIResource; +import org.eclipse.emf.edit.command.CommandParameter; +import org.eclipse.emf.edit.command.OverrideableCommand; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.ResourceSetListener; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IClientContext; +import org.eclipse.papyrus.infra.core.resource.ModelException; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.ModelUtils; +import org.eclipse.papyrus.infra.core.resource.NotFoundException; +import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.papyrus.junit.utils.EditorUtils; +import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; +import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.eclipse.papyrus.propertylifecycle.preferences.utils.PropertyLifecyclePreferencesManager; +import org.eclipse.papyrus.propertylifecycle.tests.model.UMLTestModel; +import org.eclipse.papyrus.propertylifecycle.tests.strategies.StrategyTestModel; +import org.eclipse.papyrus.propertylifecycle.tests.utils.ITestConstants; +import org.eclipse.papyrus.uml.diagram.wizards.Activator; +import org.eclipse.papyrus.uml.tools.commands.ApplyProfileCommand; +import org.eclipse.papyrus.uml.tools.model.UmlModel; +import org.eclipse.papyrus.uml.tools.model.UmlUtils; +import org.eclipse.papyrus.uml.tools.utils.PackageUtil; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PartInitException; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.Profile; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.Component; +import org.eclipse.uml2.uml.Model; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.osgi.framework.Bundle; + + + +public abstract class AbstractPropertyLifecycleTests extends AbstractPapyrusTest implements ITestConstants { + + @ClassRule + public static HouseKeeper.Static houseKeeper = new HouseKeeper.Static(); + + public static IProgressMonitor monitor = new NullProgressMonitor(); + + public static ResourceSet umlResourceSet; + + public static ResourceSet strategyResourceSet; + + public static StrategySet strategyModel; + + public static Model umlModel; + + public static IProject lifecycleProject; + + public static IFile lifecycleModelFile; + + public static IMultiDiagramEditor openPapyrusEditor; + + public static TransactionalEditingDomain transactionalEditingDomain; + + // public static IClientContext papyrusContext; + + public static Package componentPackage; + + public static Component component_ComponentPacakge; + + public static Package classPackage; + + public static org.eclipse.uml2.uml.Class class_ClassPackage; + + public static Model subModel; + + public static Component component_subModel; + + public static org.eclipse.uml2.uml.Class class_subModel; + + public static Property property_class_subModel; + + public static ModelSet modelset; + + public static UmlModel umlIModel; + + public static Model rootModel; + + public static Resource umlModelResource; + + + @BeforeClass + public static void initProject() { + + // Create the project and its models + lifecycleProject = houseKeeper.createProject(RESOURCES_PROJECTNAME); + try { + umlResourceSet = UMLTestModel.initUMLModel(lifecycleProject); + strategyResourceSet = StrategyTestModel.initStrategyModel(lifecycleProject); + Assert.assertNotNull("the modelResourceSet should not be null", umlResourceSet); + Assert.assertNotNull("The strategyResourceSet should not be null", strategyResourceSet); + + umlModelResource = umlResourceSet.getResources().get(0); + + umlModel = (Model) umlModelResource.getContents().get(0); + Diagnostic umlDiagnostic = Diagnostician.INSTANCE.validate(umlModel); + Assert.assertTrue("The umlModel should be validated", umlDiagnostic.getSeverity() == Diagnostic.OK); + strategyModel = (StrategySet) strategyResourceSet.getResources().get(0).getContents().get(0); + Diagnostic strategyDiagnostic = Diagnostician.INSTANCE.validate(strategyModel); + Assert.assertTrue("The strategyModel should be validated", strategyDiagnostic.getSeverity() == Diagnostic.OK); + + // Register the test strategies to call upon them during the tests + PropertyLifecyclePreferencesManager preferenceManager = new PropertyLifecyclePreferencesManager(); + preferenceManager.registerCurrentPreferences( + Collections.singleton(strategyResourceSet.getResources().get(0).getURI().toString()), null, + strategyModel.getStrategies(), null); + + // Check created models and project + checkExistingElements(umlModel); + Assert.assertTrue(lifecycleProject.getFolder(RESOURCES_FOLDERNAME).exists()); + Assert.assertTrue(lifecycleProject.getFolder(RESOURCES_FOLDERNAME).getFile(RESOURCES_UMLMODELNAME).exists()); + Assert.assertTrue(lifecycleProject.getFolder(RESOURCES_FOLDERNAME).getFile(RESOURCES_STRATEGYMODELNAME).exists()); + + // Create a new papyrus model + ServicesRegistry registry = createServicesRegistry(); + Assert.assertNotNull("The service registry should not be null", registry); + ModelSet modelSet = registry.getService(ModelSet.class); + lifecycleModelFile = lifecycleProject.getFolder(RESOURCES_FOLDERNAME).getFile(RESOURCES_UMLMODELNAME); + // modelSet.createsModels(lifecycleModelFile); + modelSet.createModels(URI.createPlatformResourceURI(lifecycleModelFile.getFullPath().toString(), true)); + modelSet.save(monitor); + lifecycleModelFile = lifecycleProject.getFolder(RESOURCES_FOLDERNAME).getFile(RESOURCES_DIMODELNAME); + + + } catch (CoreException ce) { + fail(ce.getMessage()); + } catch (IOException ioe) { + fail(ioe.getMessage()); + } catch (ServiceException se) { + fail(se.getMessage()); + } + + // Open the project + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + try { + openPapyrusEditor = houseKeeper.cleanUpLater(EditorUtils.openPapyrusEditor(lifecycleModelFile)); + } catch (PartInitException pie) { + fail(pie.getMessage()); + } + } + }); + + // Get the transactional editing domain used to create the edit requests + transactionalEditingDomain = openPapyrusEditor.getAdapter(TransactionalEditingDomain.class); + assertTrue("Impossible to init editing domain", transactionalEditingDomain instanceof TransactionalEditingDomain); + + // Retrieve UML model from this editor + try { + modelset = ModelUtils.getModelSetChecked(openPapyrusEditor.getServicesRegistry()); + umlIModel = UmlUtils.getUmlModel(modelset); + rootModel = (Model) umlIModel.lookupRoot(); + subModel = (Model) rootModel.getNestedPackage(SUBMODEL_NAME); + + Assert.assertNotNull("root model should not be null", rootModel); + + } catch (ServiceException e) { + fail(e.getMessage()); + } catch (NotFoundException e) { + fail(e.getMessage()); + } catch (ClassCastException e) { + fail(e.getMessage()); + } + + // Check the contents of the new project + try { + checkExistingElements(rootModel); + } catch (Exception e) { + fail(e.getMessage()); + } + + // try { + // papyrusContext = org.eclipse.papyrus.infra.services.edit.internal.context.TypeContext.getContext(); + // } catch (ServiceException se) { + // fail(se.getMessage()); + // } + + } + + protected static void checkExistingElements(Model lifecycleRootModel) { + componentPackage = lifecycleRootModel.getNestedPackage(COMPONENT_PACKAGE_NAME); + Assert.assertNotNull(COMPONENT_PACKAGE_NAME + ", should not be null", componentPackage); + Assert.assertTrue(COMPONENT_PACKAGE_NAME + ", should be a package", componentPackage instanceof Package); + + classPackage = lifecycleRootModel.getNestedPackage(CLASS_PACKAGE_NAME); + Assert.assertNotNull(CLASS_PACKAGE_NAME + ", should not be null", classPackage); + Assert.assertTrue(CLASS_PACKAGE_NAME + ", should be a package", classPackage instanceof Package); + + Package subModelPackage = lifecycleRootModel.getNestedPackage(SUBMODEL_NAME); + Assert.assertTrue("The subModel package should be a Model", subModelPackage instanceof Model); + subModel = (Model) subModelPackage; + + component_ComponentPacakge = (Component) componentPackage.getPackagedElement(COMPONENT_NAME); + Assert.assertNotNull(COMPONENT_NAME + ", should not be null", component_ComponentPacakge); + + class_ClassPackage = (org.eclipse.uml2.uml.Class) classPackage.getPackagedElement(CLASS_NAME); + Assert.assertNotNull(CLASS_NAME + ", should not be null", class_ClassPackage); + + component_subModel = (Component) subModel.getPackagedElement(COMPONENT_NAME); + Assert.assertNotNull(COMPONENT_NAME + ", should not be null", component_ComponentPacakge); + class_subModel = (org.eclipse.uml2.uml.Class) subModel.getPackagedElement(CLASS_NAME); + Assert.assertNotNull(CLASS_NAME + ", should not be null", class_ClassPackage); + + property_class_subModel = class_subModel.getAttribute(PROPERTY_CLASS_NAME, UMLFactory.eINSTANCE.createProperty().getType()); + Assert.assertNotNull("the property of the subModel's class should exist", property_class_subModel); + } + + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + } + + protected static ServicesRegistry createServicesRegistry() { + ServicesRegistry result = null; + + try { + result = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID); + } catch (ServiceException e) { + // couldn't create the registry? Fatal problem + Activator.log.error(e); + } + + try { + // have to create the model set and populate it with the DI model + // before initializing other services that actually need the DI + // model, such as the SashModel Manager service + result.startServicesByClassKeys(ModelSet.class); + } catch (ServiceException ex) { + // Ignore this exception: some services may not have been loaded, + // which is probably normal at this point + } + + return result; + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/tests/PropertyLifecycleTests.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/tests/PropertyLifecycleTests.java new file mode 100755 index 00000000000..f64f617ad9e --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/tests/PropertyLifecycleTests.java @@ -0,0 +1,434 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.tests; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.propertylifecycle.tests.Activator; +import org.eclipse.papyrus.propertylifecycle.tests.utils.ITestConstants; +import org.junit.Assert; +import org.junit.Test; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.Profile; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Stereotype; +import org.eclipse.uml2.uml.Association; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Component; +import org.eclipse.uml2.uml.NamedElement; + +public class PropertyLifecycleTests extends AbstractPropertyLifecycleTests implements ITestConstants { + + public static ICommand createCommand; + + public static EObject newElement; + + public static String SysmlProfile_URI = "http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks"; + + // @Test + // public void testInitialization() { + // Assert.assertTrue(true); + // } + + // @Test + // public void testCreateSysML14BlockInModel() throws ExecutionException { + // IElementType blockType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.SysML14.Block"); + // Profile sysml14Profile = ProfileUtil.getProfile(org.eclipse.papyrus.sysml14.definition.SysmlPackage.eINSTANCE); + // subModel.applyProfile(sysml14Profile); + // Assert.assertTrue("The sysml14 profile should be applied to the subModel", subModel.getAllAppliedProfiles().contains(sysml14Profile)); + // createElementInPackage(subModel, blockType); + // Assert.assertTrue("The new element should be a Block", newElement instanceof org.eclipse.papyrus.SysML14.Block); + // String newName = ((NamedElement) newElement).getName(); + // Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, newName); + // Assert.assertTrue("The name of the new Componenet should be NewSysml14BlockName", + // "NewSysml14BlockName".equalsIgnoreCase(((NamedElement) newElement).getName().replaceAll("[0-9]", ""))); + // createCommand.undo(monitor, null); + // subModel.unapplyProfile(sysml14Profile); + // } + + @Test + public void testCreateComponentInPackage() throws ExecutionException { + IElementType componentType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Component"); + Assert.assertTrue("componentPackage is instanceof Package", componentPackage instanceof Package); + createElementInPackage(componentPackage, componentType); + Assert.assertTrue("The new element should be a Component", newElement instanceof Component); + String newName = ((NamedElement) newElement).getName(); + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, newName); + Assert.assertTrue("The name of the new Componenet should be NewComponentName", + "NewComponentName".equalsIgnoreCase(newName.replaceAll("[0-9]", ""))); + createCommand.undo(monitor, null); + } + + @Test + public void testCreateComponentInModel() throws ExecutionException { + IElementType componentType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Component"); + createElementInPackage(subModel, componentType); + Assert.assertTrue("The new element should be a Component", newElement instanceof Component); + String newName = ((NamedElement) newElement).getName(); + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, newName); + Assert.assertTrue("The name of the new Componenet should be NewComponentName", + "NewComponentName".equalsIgnoreCase(((NamedElement) newElement).getName().replaceAll("[0-9]", ""))); + createCommand.undo(monitor, null); + } + + @Test + public void testCreateClassInPackage() throws ExecutionException { + IElementType componentType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Class"); + Assert.assertTrue("classPackage is instanceof Package", classPackage instanceof Package); + createElementInPackage(componentPackage, componentType); + Assert.assertTrue("The new element should be a Class", newElement instanceof org.eclipse.uml2.uml.Class); + String newName = ((NamedElement) newElement).getName(); + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, newName); + Assert.assertTrue("The name of the new Class should be Class", + "Class".equalsIgnoreCase(newName.replaceAll("[0-9]", ""))); + createCommand.undo(monitor, null); + } + + @Test + public void testCreateClassInModel() throws ExecutionException { + IElementType componentType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Class"); + createElementInPackage(subModel, componentType); + Assert.assertTrue("The new element should be a Class", newElement instanceof org.eclipse.uml2.uml.Class); + String newName = ((NamedElement) newElement).getName(); + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, newName); + Assert.assertTrue("The name of the new Class should be NewClassName", + "NewClassName".equalsIgnoreCase(((NamedElement) newElement).getName().replaceAll("[0-9]", ""))); + createCommand.undo(monitor, null); + } + + @Test + public void testCreateSysmlBlockInModel() throws ExecutionException { + IElementType blockType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.sysml.Block"); + Assert.assertTrue("The sysml profile should be applied to the subModel", subModel.getAllAppliedProfiles().size() > 0); + createElementInPackage(subModel, blockType); + Stereotype blockStereotype = null; + for (Profile appliedProfile : subModel.getAppliedProfiles()) { + if (appliedProfile.getURI() != null && appliedProfile.getURI().compareTo(SysmlProfile_URI) == 0) { + blockStereotype = appliedProfile.getOwnedStereotype("Block", true); + break; + } + } + + Assert.assertTrue("The new element should be a block", ((NamedElement) newElement).isStereotypeApplied(blockStereotype)); + String newName = ((NamedElement) newElement).getName(); + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, newName); + Assert.assertTrue("The name of the new Componenet should be NewSysmlBlockName", + "NewSysmlBlockName".equalsIgnoreCase(((NamedElement) newElement).getName().replaceAll("[0-9]", ""))); + createCommand.undo(monitor, null); + } + + + @Test + public void testCreatePropertyInComponent() throws ExecutionException { + IElementType propertyType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Property"); + createPropertyInClassifier((Classifier) component_ComponentPacakge, propertyType); + Assert.assertTrue("The new element should be a Component", newElement instanceof Property); + String newName = ((NamedElement) newElement).getName(); + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, newName); + Assert.assertTrue("The name of the new Componenet should be Attribute", + "Attribute".equalsIgnoreCase(((NamedElement) newElement).getName().replaceAll("[0-9]", ""))); + createCommand.undo(monitor, null); + } + + @Test + public void testCreatePropertyInClass() throws ExecutionException { + IElementType propertyType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Property"); + createPropertyInClassifier((Classifier) class_ClassPackage, propertyType); + Assert.assertTrue("The new element should be a Component", newElement instanceof Property); + String newName = ((NamedElement) newElement).getName(); + Activator.log.trace(Activator.PLCSTRATEGY_TESTS_TRACE, newName); + Assert.assertTrue("The name of the new Componenet should be Attribute", + "Attribute".equalsIgnoreCase(((NamedElement) newElement).getName().replaceAll("[0-9]", ""))); + createCommand.undo(monitor, null); + } + + + @Test + public void testRenameContainer() throws ExecutionException { + EStructuralFeature nameFeature = component_ComponentPacakge.eClass().getEStructuralFeature("name"); + SetRequest request = new SetRequest(transactionalEditingDomain, component_ComponentPacakge, nameFeature, "afterSetComponentName"); + IElementEditService service = ElementEditServiceUtils.getCommandProvider(component_ComponentPacakge); + ICommand setCommand = service.getEditCommand(request); + Assert.assertTrue("The set command should be executable", setCommand.canExecute()); + IStatus status = setCommand.execute(monitor, null); + Assert.assertTrue("The command should return OK", status.isOK()); + + // 1- Verify that the set command did work + Assert.assertTrue("The component name should be afterSetComponentName", + "afterSetComponentName".equalsIgnoreCase(component_ComponentPacakge.getName().replaceAll("[0-9]", ""))); + + // 2- Verify that the property strategy worked as excpected + Property componentProperty = component_ComponentPacakge.getAttributes().get(0); + Assert.assertTrue("The component's property name should be afterSetComponentName", + "afterSetComponentName_Property".equalsIgnoreCase(componentProperty.getName().replaceAll("[0-9]", ""))); + + // 3- Test the Undo/Redo + Assert.assertTrue("The set command should be undoable", setCommand.canUndo()); + status = setCommand.undo(monitor, null); + Assert.assertTrue("The undo status should return OK", status.isOK()); + Assert.assertTrue("The component name should be beforeStrategyComponent", + "beforeStrategyComponent".equalsIgnoreCase(component_ComponentPacakge.getName().replaceAll("[0-9]", ""))); + Assert.assertTrue("The component's property name should be beforeStrategyComponentProperty", + "beforeStrategyComponentProperty".equalsIgnoreCase(componentProperty.getName().replaceAll("[0-9]", ""))); + + Assert.assertTrue("The set command should be redoable", setCommand.canRedo()); + status = setCommand.redo(monitor, null); + Assert.assertTrue("The redo status should return OK", status.isOK()); + Assert.assertTrue("The component name should be afterSetComponentName", + "afterSetComponentName".equalsIgnoreCase(component_ComponentPacakge.getName().replaceAll("[0-9]", ""))); + Assert.assertTrue("The component's property name should be afterSetComponentName", + "afterSetComponentName_Property".equalsIgnoreCase(componentProperty.getName().replaceAll("[0-9]", ""))); + + } + + + @Test + public void testReorientAssociation() throws ExecutionException { + IElementType associationType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Association"); + IElementType classType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Class"); + IElementType componentType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Component"); + createElementInPackage(subModel, classType); + EObject sourceClass = newElement; + createElementInPackage(subModel, componentType); + EObject targetComponent = newElement; + + Classifier sourceClassifier = (Classifier) sourceClass; + List originalElements = new ArrayList(sourceClassifier.getOwnedElements()); + + CreateRelationshipRequest request = new CreateRelationshipRequest(transactionalEditingDomain, sourceClass, targetComponent, associationType); + IElementEditService service = ElementEditServiceUtils.getCommandProvider(subModel); + createCommand = service.getEditCommand(request); + Assert.assertTrue("The created command should be executable", createCommand.canExecute()); + IStatus status = createCommand.execute(monitor, null); + Assert.assertTrue("The command should return OK", status.isOK()); + + List afterCreateElements = new ArrayList(sourceClassifier.getOwnedElements()); + afterCreateElements.removeAll(originalElements); + Assert.assertEquals("There should have been two created elements in the source: the owned association " + + "and the property pointing to the target", 2, afterCreateElements.size()); + for (EObject eobject : afterCreateElements) { + newElement = eobject instanceof Association ? eobject : null; + } + Assert.assertNotNull("There should have been an Association created", newElement); + + // 2- Test the Undo/Redo + Assert.assertTrue("The creation command should be undoable", createCommand.canUndo()); + status = createCommand.undo(monitor, null); + Assert.assertTrue("The undo status should return OK", status.isOK()); + List afterUndoElements = new ArrayList(sourceClassifier.getOwnedElements()); + afterUndoElements.removeAll(originalElements); + Assert.assertEquals("The model should return in the same state as before the creation command", 0, + afterUndoElements.size()); + + Assert.assertTrue("The creation command should be redoable", createCommand.canRedo()); + status = createCommand.redo(monitor, null); + Assert.assertTrue("The redo status should return OK", status.isOK()); + List afterRedoElements = new ArrayList(sourceClassifier.getOwnedElements()); + afterRedoElements.removeAll(originalElements); + Assert.assertEquals("There should be one element added afer the redo of the creation command", 2, afterRedoElements.size()); + + // 3- Cache the memeberEnds + Association currentAssociation = (Association) newElement; + String beforeMoveName = currentAssociation.getLabel(); + Property targetProperty = currentAssociation.getMemberEnds().get(0); + String targetPropertyName = targetProperty.getType().getName(); + Property sourceProperty = currentAssociation.getMemberEnds().get(1); + String sourcePropertyName = sourceProperty.getType().getName(); + + // 4- Create a new Target and move the relationship + createElementInPackage(subModel, classType); + EObject newTarget = newElement; + ReorientRelationshipRequest reorientRequest = new ReorientRelationshipRequest(transactionalEditingDomain, currentAssociation, + newTarget, targetComponent, ReorientRelationshipRequest.REORIENT_TARGET); + createCommand = service.getEditCommand(reorientRequest); + Assert.assertTrue("The created command should be executable", createCommand.canExecute()); + IStatus reorientStatus = createCommand.execute(monitor, null); + Assert.assertTrue("The command should return OK", reorientStatus.isOK()); + String afterMoveName = currentAssociation.getLabel(); + + // 4.1 - Test the new association name + Assert.assertFalse("The new association should have a different label after the move", beforeMoveName.equals(afterMoveName)); + + // 4.2- Test the new target name + Association reorientedAssociation = currentAssociation; + Property reorientTargetProperty = reorientedAssociation.getMemberEnds().get(0); + String reorientTargetPropertyName = reorientTargetProperty.getType().getName(); + Assert.assertFalse("The name of the target should have changed", reorientTargetPropertyName.equalsIgnoreCase(targetPropertyName)); + Property reorientSourceProperty = reorientedAssociation.getMemberEnds().get(1); + String reorientSourcePropertyName = reorientSourceProperty.getType().getName(); + Assert.assertTrue("The name of the source should not have changed", reorientSourcePropertyName.equalsIgnoreCase(sourcePropertyName)); + + } + + + @Test + public void testRenameImmutableProperty() throws ExecutionException { + EStructuralFeature nameFeature = property_class_subModel.eClass().getEStructuralFeature("name"); + SetRequest request = new SetRequest(transactionalEditingDomain, property_class_subModel, nameFeature, "afterSetPropertyName"); + IElementEditService service = ElementEditServiceUtils.getCommandProvider(property_class_subModel); + ICommand setCommand = service.getEditCommand(request); + Assert.assertTrue("The set command should be executable", setCommand.canExecute()); + IStatus status = setCommand.execute(monitor, null); + Assert.assertTrue("The command should return OK", status.isOK()); + + // 1- Verify that the property strategy worked as excpected + Assert.assertTrue("The class' property name should be propertyNameIsImmutable", + "propertyNameIsImmutable".equalsIgnoreCase(property_class_subModel.getName().replaceAll("[0-9]", ""))); + + // 2- Test the Undo/Redo + setCommand.undo(monitor, null); + Assert.assertTrue("The class' property name should return to beforeStrategyClassProperty", + "beforeStrategyClassProperty".equalsIgnoreCase(property_class_subModel.getName().replaceAll("[0-9]", ""))); + + setCommand.redo(monitor, null); + Assert.assertTrue("The class' property name should return to propertyNameIsImmutable", + "propertyNameIsImmutable".equalsIgnoreCase(property_class_subModel.getName().replaceAll("[0-9]", ""))); + + // 3- Return to initial state + setCommand.undo(monitor, null); + Assert.assertTrue("The class' property name should return to beforeStrategyClassProperty", + "beforeStrategyClassProperty".equalsIgnoreCase(property_class_subModel.getName().replaceAll("[0-9]", ""))); + } + + @Test + public void testRenameImmutablePropertyInClass() throws ExecutionException { + EStructuralFeature nameFeature = class_subModel.eClass().getEStructuralFeature("name"); + CommandStack commandStack = transactionalEditingDomain.getCommandStack(); + commandStack.flush(); + SetRequest request = new SetRequest(transactionalEditingDomain, class_subModel, nameFeature, "afterSetClassName"); + IElementEditService service = ElementEditServiceUtils.getCommandProvider(class_subModel); + ICommand setCommand = service.getEditCommand(request); + Assert.assertTrue("The set command should be executable", setCommand.canExecute()); + // The command needs to be executed inside the commandStack first has it has nested commands and the undo on the + // setCommand will only affect the first setRequest + commandStack.execute(new GMFtoEMFCommandWrapper(setCommand)); + + // 1- Verify that the set command did work + Assert.assertTrue("The class name should be afterSetClassName", + "afterSetClassName".equalsIgnoreCase(class_subModel.getName().replaceAll("[0-9]", ""))); + + // 2- Verify that the property strategy worked as excpected + Assert.assertTrue("The class' property name should be propertyNameIsImmutable", + "propertyNameIsImmutable".equalsIgnoreCase(property_class_subModel.getName().replaceAll("[0-9]", ""))); + + // 3- Test the Undo/Redo + commandStack.undo(); + Assert.assertTrue("The class name should return to beforeStrategyClass", + "beforeStrategyClass".equalsIgnoreCase(class_subModel.getName().replaceAll("[0-9]", ""))); + Assert.assertTrue("The class' property name should return to beforeStrategyClassProperty", + "beforeStrategyClassProperty".equalsIgnoreCase(property_class_subModel.getName().replaceAll("[0-9]", ""))); + + commandStack.redo(); + Assert.assertTrue("The class name should be afterSetClassName", + "afterSetClassName".equalsIgnoreCase(class_subModel.getName().replaceAll("[0-9]", ""))); + Assert.assertTrue("The class' property name should return to propertyNameIsImmutable", + "propertyNameIsImmutable".equalsIgnoreCase(property_class_subModel.getName().replaceAll("[0-9]", ""))); + + // 4- Return to initial state + commandStack.undo(); + + } + + + public void createPropertyInClassifier(Classifier container, IElementType elementType) throws ExecutionException { + List originalElements = new ArrayList(container.getAttributes()); + CreateElementRequest request = new CreateElementRequest(transactionalEditingDomain, container, elementType); + IElementEditService service = ElementEditServiceUtils.getCommandProvider(container); + createCommand = service.getEditCommand(request); + Assert.assertTrue("The created command should be executable", createCommand.canExecute()); + IStatus status = createCommand.execute(monitor, null); + Assert.assertTrue("The command should return OK", status.isOK()); + + List afterCreateElements = new ArrayList(container.getAttributes()); + afterCreateElements.removeAll(originalElements); + Assert.assertEquals("There should have been only one created element", 1, afterCreateElements.size()); + + // 2- Test the Undo/Redo + assertUndoRedo(status, originalElements, container); + + } + + public void createElementInPackage(Package container, IElementType elementType) throws ExecutionException { + // 1- Test the Creation of the new element + List originalElements = new ArrayList(container.getPackagedElements()); + CreateElementRequest request = new CreateElementRequest(transactionalEditingDomain, container, elementType); + IElementEditService service = ElementEditServiceUtils.getCommandProvider(container); + createCommand = service.getEditCommand(request); + Assert.assertTrue("The created command should be executable", createCommand.canExecute()); + IStatus status = createCommand.execute(monitor, null); + Assert.assertTrue("The command should return OK", status.isOK()); + + List afterCreateElements = new ArrayList(container.getPackagedElements()); + afterCreateElements.removeAll(originalElements); + Assert.assertEquals("There should have been only one created element", 1, afterCreateElements.size()); + + // 2- Test the Undo/Redo + assertUndoRedo(status, originalElements, container); + + } + + public static void assertUndoRedo(IStatus status, List originalElements, Classifier container) throws ExecutionException { + Assert.assertTrue("The creation command should be undoable", createCommand.canUndo()); + status = createCommand.undo(monitor, null); + Assert.assertTrue("The undo status should return OK", status.isOK()); + List afterUndoElements = new ArrayList(container.getAttributes()); + afterUndoElements.removeAll(originalElements); + Assert.assertEquals("The model should return in the same state as before the creation command", 0, + afterUndoElements.size()); + + Assert.assertTrue("The creation command should be redoable", createCommand.canRedo()); + status = createCommand.redo(monitor, null); + Assert.assertTrue("The redo status should return OK", status.isOK()); + List afterRedoElements = new ArrayList(container.getAttributes()); + afterRedoElements.removeAll(originalElements); + Assert.assertEquals("There should be one element added afer the redo of the creation command", 1, afterRedoElements.size()); + newElement = afterRedoElements.get(0); + } + + public static void assertUndoRedo(IStatus status, List originalElements, Package container) throws ExecutionException { + Assert.assertTrue("The creation command should be undoable", createCommand.canUndo()); + status = createCommand.undo(monitor, null); + Assert.assertTrue("The undo status should return OK", status.isOK()); + List afterUndoElements = new ArrayList(container.getPackagedElements()); + afterUndoElements.removeAll(originalElements); + Assert.assertEquals("The model should return in the same state as before the creation command", 0, + afterUndoElements.size()); + + Assert.assertTrue("The creation command should be redoable", createCommand.canRedo()); + status = createCommand.redo(monitor, null); + Assert.assertTrue("The redo status should return OK", status.isOK()); + List afterRedoElements = new ArrayList(container.getPackagedElements()); + afterRedoElements.removeAll(originalElements); + Assert.assertEquals("There should be one element added afer the redo of the creation command", 1, afterRedoElements.size()); + newElement = afterRedoElements.get(0); + } + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/utils/ITestConstants.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/utils/ITestConstants.java new file mode 100755 index 00000000000..b8dca29ff02 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/utils/ITestConstants.java @@ -0,0 +1,179 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.utils; + + +public interface ITestConstants { + + // Saving Created Resources + public static String RESOURCES_PROJECTNAME = "PropertyLifecycle"; + + public static String RESOURCES_FOLDERNAME = "resources"; + + public static String RESOURCES_ENCODING = "UTF-8"; + + public static String RESOURCES_UMLMODELNAME = "testmodel.uml"; + + public static String RESOURCES_DIMODELNAME = "testmodel.di"; + + public static String RESOURCES_STRATEGYMODELNAME = "teststrategy.propertylifecycle"; + + + // Init UML Test model + public static String ROOTMODEL_NAME = "PropertyLifecycleTestModel"; + + public static String SUBMODEL_NAME = "SubModel"; + + public static String COMPONENT_PACKAGE_NAME = "ComponentPackage"; + + public static String COMPONENT_NAME = "beforeStrategyComponent"; + + public static String CLASS_PACKAGE_NAME = "ClassPackage"; + + public static String CLASS_NAME = "beforeStrategyClass"; + + public static String PROPERTY_CLASS_NAME = "beforeStrategyClassProperty"; + + public static String PROPERTY_COMPONENT_NAME = "beforeStrategyComponentProperty"; + + // Init Strategy test model + static final String STRATEGYSET_DESCRIPTION = "this is a strategySet containing strategies applicable to the Elements"; + + static final String STRATEGYSET_ID = "org.eclipse.papyrus.infra.propertylifecycle.tests.propertylifecycletest"; + + static final String STRATEGYSET_NAME = "test strategySet"; + + /** Component strategy initialization variables */ + static final String STRATEGYELEMENT_BASETYPE_COMPONENT = "org.eclipse.papyrus.uml.Component"; + + static final String STRATEGYELEMENT_DESCRIPTION_COMPONENT = "comonent description"; + + static final String STRATEGYELEMENT_ID_COMPONENT = "org.eclipse.papyrus.uml.Component.Tests"; + + static final String STRATEGYELEMENT_NAME_COMPONENT = "org.eclipse.papyrus.uml.Component.Tests"; + + static final String STRATEGYELEMENT_SPECIALIZEDTYPE_COMPONENT = null; + + static final String STRATEGYPROPERTY_FEATURELABEL_COMPONENT = "name"; + + static final Integer ELEMENTPROPERTY_PRIORITY_COMPONENT = 0; + + static final String ELEMENTPROPERTY_PROCESSORPATH_COMPONENT = "org.eclipse.papyrus.infra.propertylifecycle.tests.strategies.processors.ComponentProcessor"; + + /** Class strategy initialization variables */ + static final String STRATEGYELEMENT_BASETYPE_CLASS = "org.eclipse.papyrus.uml.Class"; + + static final String STRATEGYELEMENT_DESCRIPTION_CLASS = "class description"; + + static final String STRATEGYELEMENT_ID_CLASS = "org.eclipse.papyrus.uml.Class.Tests"; + + static final String STRATEGYELEMENT_NAME_CLASS = "org.eclipse.papyrus.uml.Class.Tests"; + + static final String STRATEGYELEMENT_SPECIALIZEDTYPE_CLASS = null; + + static final String STRATEGYCONTAINER_BASETYPE_CLASS = "org.eclipse.papyrus.uml.Model"; + + static final String STRATEGYCONTAINER_SPECIALIZEDTYPE_CLASS = null; + + static final String STRATEGYPROPERTY_FEATURELABEL_CLASS = "name"; + + static final Integer ELEMENTPROPERTY_PRIORITY_CLASS = 0; + + static final String ELEMENTPROPERTY_PROCESSORPATH_CLASS = "org.eclipse.papyrus.infra.propertylifecycle.tests.strategies.processors.ClassProcessor"; + + /** Property strategy initialization variables */ + // 0- Shared variables + static final String STRATEGYELEMENT_BASETYPE_PROPERTY = "org.eclipse.papyrus.uml.Property"; + + static final String STRATEGYELEMENT_DESCRIPTION_PROPERTY = "property description"; + + static final String STRATEGYELEMENT_SPECIALIZEDTYPE_PROPERTY = null; + + static final String STRATEGYCONTAINER_SPECIALIZEDTYPE_PROPERTY = null; + + static final String STRATEGYPROPERTY_FEATURELABEL_PROPERTY = "name"; + + static final String ELEMENTPROPERTY_PROCESSORPATH_PROPERTY = "org.eclipse.papyrus.infra.propertylifecycle.tests.strategies.processors.PropertyProcessor"; + + // 1- Component property + + static final String STRATEGYELEMENT_ID_COMPONENTPROPERTY = "org.eclipse.papyrus.uml.ComponentProperty.Tests"; + + static final String STRATEGYELEMENT_NAME_COMPONENTPROPERTY = "org.eclipse.papyrus.uml.ComponentProperty.Tests"; + + static final String STRATEGYCONTAINER_BASETYPE_COMPONENTPROPERTY = "org.eclipse.papyrus.uml.Component"; + + static final Integer ELEMENTPROPERTY_PRIORITY_PROPERTY = 0; + + // 2- Class property + static final String STRATEGYELEMENT_ID_CLASSPROPERTY = "org.eclipse.papyrus.uml.ClassProperty.Tests"; + + static final String STRATEGYELEMENT_NAME_CLASSPROPERTY = "org.eclipse.papyrus.uml.ClassProperty.Tests"; + + static final String STRATEGYCONTAINER_BASETYPE_CLASSPROPERTY = "org.eclipse.papyrus.uml.Class"; + + static final Integer ELEMENTPROPERTY_PRIORITY_CLASSPROPERTY = -1; + + /** SysML Block strategy initialization variables */ + static final String STRATEGYELEMENT_BASETYPE_SYSMLBLOCK = "org.eclipse.papyrus.sysml.Block"; + + static final String STRATEGYELEMENT_DESCRIPTION_SYSMLBLOCK = "SysML Block description"; + + static final String STRATEGYELEMENT_ID_SYSMLBLOCK = "org.eclipse.papyrus.sysml.Block.Tests"; + + static final String STRATEGYELEMENT_NAME_SYSMLBLOCK = "org.eclipse.papyrus.sysml.Block.Tests"; + + static final String STRATEGYELEMENT_SPECIALIZEDTYPE_SYSMLBLOCK = "org.eclipse.papyrus.uml.Class"; + + static final String STRATEGYPROPERTY_FEATURELABEL_SYSMLBLOCK = "name"; + + static final Integer ELEMENTPROPERTY_PRIORITY_SYSMLBLOCK = 0; + + static final String ELEMENTPROPERTY_PROCESSORPATH_SYSMLBLOCK = "org.eclipse.papyrus.infra.propertylifecycle.tests.strategies.processors.SysmlBlockProcessor"; + + /** SysML14 Block strategy initialization variables */ + static final String STRATEGYELEMENT_BASETYPE_SYSML14BLOCK = "org.eclipse.papyrus.SysML14.Block"; + + static final String STRATEGYELEMENT_DESCRIPTION_SYSML14BLOCK = "SysML14 Block description"; + + static final String STRATEGYELEMENT_ID_SYSML14BLOCK = "org.eclipse.papyrus.SysML14.Block.Tests"; + + static final String STRATEGYELEMENT_NAME_SYSML14BLOCK = "org.eclipse.papyrus.SysML14.Block.Tests"; + + static final String STRATEGYELEMENT_SPECIALIZEDTYPE_SYSML14BLOCK = "org.eclipse.papyrus.uml.Class"; + + static final String STRATEGYPROPERTY_FEATURELABEL_SYSML14BLOCK = "name"; + + static final Integer ELEMENTPROPERTY_PRIORITY_SYSML14BLOCK = 0; + + static final String ELEMENTPROPERTY_PROCESSORPATH_SYSML14BLOCK = "org.eclipse.papyrus.infra.propertylifecycle.tests.strategies.processors.Sysml14BlockProcessor"; + + /** Association strategy initialization variables */ + static final String STRATEGYELEMENT_BASETYPE_ASSOCIATION = "org.eclipse.papyrus.uml.Association"; + + static final String STRATEGYELEMENT_DESCRIPTION_ASSOCIATION = "association description"; + + static final String STRATEGYELEMENT_ID_ASSOCIATION = "org.eclipse.papyrus.uml.Association.Tests"; + + static final String STRATEGYELEMENT_NAME_ASSOCIATION = "org.eclipse.papyrus.uml.Association.Tests"; + + static final String STRATEGYELEMENT_SPECIALIZEDTYPE_ASSOCIATION = null; + + static final String STRATEGYPROPERTY_FEATURELABEL_ASSOCIATION = "name"; + + static final Integer ELEMENTPROPERTY_PRIORITY_ASSOCIATION = 0; + + static final String ELEMENTPROPERTY_PROCESSORPATH_ASSOCIATION = "org.eclipse.papyrus.infra.propertylifecycle.tests.strategies.processors.AssociationProcessor"; + +} diff --git a/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/utils/StrategyFactory.java b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/utils/StrategyFactory.java new file mode 100755 index 00000000000..e01beab45c3 --- /dev/null +++ b/tests/junit/extraplugins/propertylifecycle/org.eclipse.papyrus.propertylifecycle.tests/src/org/eclipse/papyrus/propertylifecycle/tests/utils/StrategyFactory.java @@ -0,0 +1,183 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 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.propertylifecycle.tests.utils; + +import org.eclipse.papyrus.propertylifecycle.AbstractValueProcessor; +import org.eclipse.papyrus.propertylifecycle.BasicTrigger; +import org.eclipse.papyrus.propertylifecycle.ElementContainer; +import org.eclipse.papyrus.propertylifecycle.ElementProperty; +import org.eclipse.papyrus.propertylifecycle.JavaProcessor; +import org.eclipse.papyrus.propertylifecycle.PropertylifecycleFactory; +import org.eclipse.papyrus.propertylifecycle.StrategyElement; +import org.eclipse.papyrus.propertylifecycle.StrategySet; +import org.junit.Assert; +import org.junit.Test; + +/** + * Class used to facilitate the creation of the test strategies + * + */ +public class StrategyFactory { + + public static PropertylifecycleFactory strategyModelFactory = PropertylifecycleFactory.eINSTANCE; + + public StrategyFactory() { + + } + + /** + * Handle the creation of the strategySet containing the test strategies + * + * @param description + * user informations about the set + * @param id + * the unique id of the set + * @param name + * the name of the set + * @return + * The {@link org.eclipse.papyrus.propertylifecycle.StrategySet StrategySet} + */ + public static StrategySet createStrategySet(String description, String id, String name) { + StrategySet strategySet = strategyModelFactory.createStrategySet(); + Assert.assertNotNull("The strategySet should not be null", strategySet); + + strategySet.setDecription(description); + strategySet.setId(id); + Assert.assertNotNull("The strategySet ID should not be null", strategySet.getId()); + strategySet.setName(name); + + return strategySet; + } + + /** + * Handle the creation of the core of the new strategy, allowing the manager to match it against the model's elements. + * For the strategy to be complete there still needs to specify the properties affected and their triggers and processors + * + * @param baseType + * The base elementtype of the element this strategy will affect + * @param description + * The user information explaining the strategy + * @param id + * The unique id of the strategy + * @param name + * The name of the strategy + * @param specializedType + * The specialized elementtype, if any, of the element + * @return + * The created new strategy's {@link org.eclipse.papyrus.propertylifecycle.StrategyElement core} + */ + public StrategyElement createStrategy(String baseType, String description, String id, String name, String specializedType) { + StrategyElement strategyElement = strategyModelFactory.createStrategyElement(); + Assert.assertNotNull("The strategyElement should not be null", strategyElement); + + strategyElement.setBaseType(baseType); + Assert.assertNotNull("The strategyElement baseType should not be null", strategyElement.getBaseType()); + strategyElement.setDecription(description); + strategyElement.setId(id); + Assert.assertNotNull("The strategyElement id should not be null", strategyElement.getId()); + strategyElement.setName(name); + strategyElement.setSpecializedType(specializedType); + + return strategyElement; + } + + /** + * Handle the creation of the containers used to specify a more specific context to the application of the strategy + * + * @param baseType + * The base elementtype of the container + * @param specializedType + * The specialized elementtype, if any, of the container + * @param container + * The container's container, if any + * @return + * The identified container {@link org.eclipse.papyrus.propertylifecycle.ElementContainer context} of the element affected by the strategy + */ + public ElementContainer createContainer(String baseType, String specializedType, ElementContainer container) { + ElementContainer elementContainer = strategyModelFactory.createElementContainer(); + Assert.assertNotNull("The elementContainer should not be null", elementContainer); + + elementContainer.setBaseType(baseType); + Assert.assertNotNull("The elementContainer baseType should not be null", elementContainer.getBaseType()); + elementContainer.setSpecializedType(specializedType); + elementContainer.setContainersContainer(container); + + return elementContainer; + } + + /** + * Handle the specification of the property to be affected by the strategy + * + * @param featureLabel + * The label of the property + * @param priority + * The priority in case of multiple strategies affecting the same property + * @param valueProcessor + * The processor returning the new value of the property + * @return + * The property {@link org.eclipse.papyrus.propertylifecycle.ElementProperty specification} + */ + public ElementProperty createProperty(String featureLabel, Integer priority, AbstractValueProcessor valueProcessor) { + ElementProperty elementProperty = strategyModelFactory.createElementProperty(); + Assert.assertNotNull("The elementProperty should not be null", elementProperty); + + elementProperty.setFeatureLabel(featureLabel); + Assert.assertNotNull("The elementProperty featureLabel should not be null", elementProperty.getFeatureLabel()); + elementProperty.setPriority(priority); + Assert.assertNotNull("The elementProperty should not be null", elementProperty.getPriority()); + + elementProperty.setValueProcessor(valueProcessor); + Assert.assertNotNull("The valueProcessor should not be null", elementProperty.getValueProcessor()); + Assert.assertNotNull("The processorPath should not be null nor empty", ((JavaProcessor) elementProperty.getValueProcessor()).getClassName() != null + && ((JavaProcessor) elementProperty.getValueProcessor()).getClassName() != ""); + elementProperty.getTriggers().add(createBasicTrigger()); + Assert.assertNotNull("The trigger list should not be empty", elementProperty.getTriggers().size() > 0); + + return elementProperty; + } + + /** + * Handle the specification of the processor used for this property + * + * @param processorPath + * The path of the processor used to call on it + * @return + * The {@link org.eclipse.papyrus.propertylifecycle.JavaProcessor processor} + */ + public JavaProcessor createJavaProcessor(String processorPath) { + JavaProcessor javaProcessor = strategyModelFactory.createJavaProcessor(); + Assert.assertNotNull("The javaProcessor should not be null", javaProcessor); + javaProcessor.setClassName(processorPath); + + return javaProcessor; + } + + /** + * Handle the creation of the trigger used to apply the strategy based on the lifecycle + * + * @return + * The {@link org.eclipse.papyrus.propertylifecycle.BasicTrigger trigger} + */ + public BasicTrigger createBasicTrigger() { + BasicTrigger basicTrigger = strategyModelFactory.createBasicTrigger(); + Assert.assertNotNull("The basicTrigger should not be null", basicTrigger); + basicTrigger.setOnCreate(true); + basicTrigger.setOnMove(true); + basicTrigger.setOnDelete(true); + basicTrigger.setOnOpen(true); + + return basicTrigger; + } + +} -- cgit v1.2.3