Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-03-07 12:46:03 +0000
committerptessier2014-03-07 12:46:03 +0000
commit7e718ad89e3cb484c4643c98e0a8d97218911858 (patch)
tree52b4232a07f100bf87da320f42deb441f9767d95
parent0c4da7c9bb907a7a57822264b8dd49fe76571e63 (diff)
parent6f332093a09441066c01c24f8f6389dfcf514384 (diff)
downloadorg.eclipse.papyrus-7e718ad89e3cb484c4643c98e0a8d97218911858.tar.gz
org.eclipse.papyrus-7e718ad89e3cb484c4643c98e0a8d97218911858.tar.xz
org.eclipse.papyrus-7e718ad89e3cb484c4643c98e0a8d97218911858.zip
Merge branch 'master' into bugs/386118-emf-facet
Conflicts: plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/ui/CreateUmlElementDialog.java plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorSymbolEditPolicy.java plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InterfaceManagerDialog.java plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java16
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java21
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/build.acceleo2
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/build.acceleo2
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java24
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.doc/build.properties2
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.doc/plugin.xml4
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml/META-INF/MANIFEST.MF2
-rw-r--r--extraplugins/tablemigration/org.eclipse.papyrus.infra.table.instance/build.properties3
-rw-r--r--features/papyrus-extra-features/org.eclipse.papyrus.extra.robotml.feature/feature.xml146
-rw-r--r--features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml120
-rw-r--r--features/papyrus-main-features/org.eclipse.papyrus.uml.properties.feature/feature.xml37
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.feature/feature.xml16
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml2
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml82
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/entries1
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/format1
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/17/17abd4bc6ef97a97f83cb30ad2c96618897f07fa.svn-base791
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1b/1bb398d311a4854a3cc8567eeb1d22b414d83816.svn-base51
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1c/1c359b6f8d0b5e153c81681f2505703c6b234b9a.svn-base85
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1f/1ffb0daa92013b65e6fefbeac09dd90c5a015256.svn-base36
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/22/2280df8d24f4ed194ab58ce07022034bfeef1886.svn-base9
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/23/230fc08b4b700ee5957583b2c63380deda2fe91f.svn-base87
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/25/253dfc5c84dc27b53ffece1e75dcb3b3d90eb61e.svn-base83
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base141
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/29/2957f0d214ef6507462de791cad7713da2c513f4.svn-base24
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/29/29a863df38b8b7d386209b5981260f6b1b2a2f18.svn-base196
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2a/2ab05e04fde792be1061d2b6fa451904c77fae46.svn-base7
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2c/2c3e08a103e27ad154d87e25654a08fe0ff280f4.svn-base52
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2e/2e21a91bffdf6c1e5226acf0b2eafa8deeee4275.svn-base196
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/31/31089146ffe2d474f997a43b792a059cec62977c.svn-base99
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/37/37265057354d3b1013c3956ca12fa87f769c170c.svn-base49
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/37/37841dfdbe51c0c3f1757e2cd73552d56fcc9d1d.svn-base175
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/3a/3ab04d9cd1002ef66c46e9082cae89d5c4b8613d.svn-base78
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/3b/3b15b134252e65b9ae730a9c2ccddda21593145e.svn-base32
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/44/44d8eb69ff7c5ae90080409b844c61650d1ae571.svn-base50
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/45/45b4f589d4f287bde7e42cf3de1ee46706345d9f.svn-base60
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/46/46028ee590e03ed6ac3fad67d507fa0979b9c615.svn-base125
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/48/482dcd50cfd3c6948675bc4c63516e5a13796c02.svn-base138
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/4c/4c90bfbed3b973467ca8415363f8dc0879eb5a80.svn-base362
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/4c/4cb57098ba5d9aff9247403ad73f5219093c880e.svn-base107
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/54/54940e1c93da73d1cf5e8d1372cdd8f67ca05b6f.svn-base302
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/54/5494e72458ba7e3301156bd60ca5693668624a0d.svn-base65
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/5a/5afdbc287df7154742f089f7c5ca3665afa4d545.svn-base17
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/5f/5f4750ce80f24c49cec932a191152ece3cdc82e3.svn-base75
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/62/6254b0339ffd29a11b090e1f5122d57f80cc901e.svn-base53
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/63/63f0e60ffb383ac2ea494848f7c8bda0601ca3e8.svn-base87
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/67/67d6c11df8dd3991882c2706b24d197f977b4889.svn-base607
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/68/68cf81d13a1eac7a52b8efc91ab715422c53e5fa.svn-base78
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/6d/6d4b00ccc131e8e81955ab34ce957a56a395c03e.svn-base50
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/70/70cc736d12847a299f37824ae6f64835f93deee3.svn-base216
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/74/74b403b644fe4e2197a98ed21023af7972dca87a.svn-base494
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/7d/7d6dca497cf17f43bbc232b272eb3f8b4162fcfe.svn-base594
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/82/82a84bec6211ec021be7c1f271748ac850d85672.svn-base108
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8a/8a48c6e4f72f76dbe242ac74d66e00b4f5b82873.svn-base200
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8a/8a9fdb76c0cf294c4d296302d9ff598f69f9c942.svn-base153
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/97/97d26d80a17575cffbd4c3200f4e884e1aca8f60.svn-base472
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/99/99388398773c5c8e8f54d7a557e06b13112b816c.svn-base47
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/9a/9a6a4197f568b5a6e62cf7f7e553c39f08bd2205.svn-base30
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a3/a30ba49520cd4422b5c9f06287b57e289598c73a.svn-base183
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a3/a3d3b59e723b0720aaa9e2e6c082fe64d79ed203.svn-base86
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a5/a5fd704ebde78022af2bfd356d7b5552aa329e24.svn-base67
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a8/a86eae6b32f2c7743ef2f4a9d3845afea4dede3c.svn-base687
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a9/a9b212f26b5ec57463b1ed7a45079fd6b7b945b9.svn-base65
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/b0/b082b2b5f5250a8cf738252a10c80de728fc180c.svn-base33
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/b6/b62e687ec906dda03be33162b7bd04ecf3ce18da.svn-base162
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/be/be1e40b5e44bfdc113f8f82c370717e2dfabdc69.svn-base22
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/c2/c2d6ad233b42312dc8086155fb281965af5d8e66.svn-base72
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/c5/c57033b015cad0de9a6559ffdab2525a3faa0ea4.svn-base118
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/cc/ccf4bdd705b3248573b41874b0fec21f65a2ce06.svn-base27
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/d6/d6232533461a5d52a9b83dfc71866442743cfd94.svn-base92
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/dc/dc446fa4cb140a4935fd5819e7384f4708896060.svn-base63
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/de/de73f8aecf873153fda5a4ee311dbdb0628b0e58.svn-base64
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e1/e1fce7de68e74dd7cad362ec6b8015734c8d7454.svn-base50
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e2/e2541063afa0f72d551f6d30770becdc043c6797.svn-base64
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e5/e554fc779411e493e0eea8654a79c0fae9cb5b8d.svn-base141
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f6/f6e57f83dd1af212101f5c0a53e887a854e46ef7.svn-base286
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f8/f8124f7b164c2e1970a03fff1b315505be9b7c1a.svn-base273
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f8/f84763c5f1cafb42cb07641f66bbc428a97bab75.svn-base309
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/fc/fc4ec2263955524c1de89e3897b4930f097503f2.svn-base123
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/pristine/fd/fdf81d668dbe088e50840b0361ab5b32283d7955.svn-base7
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/.svn/wc.dbbin123904 -> 0 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/ChildNodeLabelEditPart.xpt2
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/NodeLabelEditPart.xpt4
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/impl/diagram/editparts/TextAware.xpt1
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java97
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IReadOnlyHandler2.java45
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IRollbackStatus.java41
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java186
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/NestingTransactionalCommandStack.java263
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/RollbackStatus.java166
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/TransactionalEditingDomainManager.java7
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java47
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModelUtils.java16
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EMFHelper.java12
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml7
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/AbstractReadOnlyHandler.java21
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ControlledResourceTracker.java287
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java79
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java145
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainProvider.java7
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java53
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyOneFileApprover.java76
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java71
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java192
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteCommandHandler.java13
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/Messages.java34
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/messages.properties14
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF1
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml36
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/EObjectAdapterFactory.java85
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/ResourceSetRootsAdapter.java107
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/ReadOnlyObjectEditAdvice.java328
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java11
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/NestedEditingDialogContext.java132
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java28
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties19
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ResourceFilteredLabelProvider.java135
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java85
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java25
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java11
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.properties6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/schema/historyListeners.exsd91
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java23
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStack.java231
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF5
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/shortcut.gifbin0 -> 93 bytes
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml370
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/advice/GMFDiagramDuplicateEditHelperAdvice.java70
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleObservableValue.java12
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/decoration/ExternalReferenceDecoration.java70
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/decoration/ExternalReferenceMarker.java135
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java76
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/IControlParserForDirectEdit.java32
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ExternalReferenceEditPolicy.java121
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/PapyrusResizableShapeEditPolicy.java25
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ShapeCompartmentEditPolicy.java119
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java38
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java40
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/listener/RollbackNotificationHistoryListener.java143
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java28
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties20
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java18
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java55
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/BorderNodeSnapHelper.java36
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/NodeSnapHelper.java459
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/PapyrusDragEditPartsTrackerEx.java50
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/ResizeTrackerWithPreferences.java195
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/SnapUtils.java59
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafe.java317
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java18
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/DecoratedModelElement.java12
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GradientDataModelElement.java40
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java10
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/PopupEditorConfiguration.java3
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java10
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TransactionalCommandHandler.java118
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TransactionalEditCellCommandHandler.java197
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java30
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java17
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java2
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.edit/plugin.xml17
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/internal/ElementEditServiceProvider.java7
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/MarkersMonitorService.java25
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/providers/MarkerProviderRegistry.java134
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/util/MarkerListenerUtils.java18
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java100
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java39
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java26
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/BooleanEditionFactory.java14
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IAtomicOperationExecutor.java91
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IntegerEditionFactory.java15
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/ReferenceValueFactory.java9
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java6
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/UnlimitedNaturalEditionFactory.java15
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractEditor.java37
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java11
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java12
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/CompactMultipleValueEditor.java5
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueEditor.java113
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueSelectorDialog.java46
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java48
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java12
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties20
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/ui/CreateUmlElementDialog.java8
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java44
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java19
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java17
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java41
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/ui/CreateUmlElementDialog.java38
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomConstraintEditPart.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomConstraintEditPartCN.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLeditPartFactory.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPart.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPartCN.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml63
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java279
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java23
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java31
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java45
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/RenamedElementHandler.java13
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java41
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecorator.java34
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecoratorProvider.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java23
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/Util.java117
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/ui/CreateUmlElementDialog.java43
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomConstraintEditPart.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomConstraintEditPartCN.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java85
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorSymbolEditPolicy.java45
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CreateUmlElementDialog.java38
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InterfaceManagerDialog.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/CollaborationUseNameEditPart.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PropertyPartNameEditPartCN.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/providers/UMLViewProvider.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/part/CallBehaviorActionAsInteractionEditPart.java40
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/plugin.xml15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomSemanticCreateCommand.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/edit/parts/CustomConstraintEditPart.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/edit/parts/CustomConstraintEditPartCN.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/factory/CustomUMLeditPartFactory.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/messages.properties1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBodyEditPart.java43
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBodyEditPartCN.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBondyEditPartCN.java)47
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintEditPartCN.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPart.java42
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPartCN.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/UMLEditPartFactory.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLParserProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLViewProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java93
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/EMFCustomTransitionRetargetContainerCommand.java74
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomConstraintEditPart.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomTransitionEditPart.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java172
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java106
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java30
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/PapyrusModelFromExistingDomainModelCommand.java42
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java16
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java11
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/AbstractUMLMultiValueCellEditor.java4
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java3
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java69
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/utils/Util.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/META-INF/MANIFEST.MF6
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/plugin.xml11
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/AbstractImportHandler.java90
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportPackageFromUserModelHandler.java22
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java39
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java12
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/ui/PackageImportDialog.java24
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java321
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/PackageImportTreeSelectionDialog.java20
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/META-INF/MANIFEST.MF6
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/about.html28
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/build.properties5
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml7
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java165
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java21
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/ModelListener.java46
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/UndoRedoStack.java49
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx18
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/ExpressionLanguageFactory.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/MessageValueSpecificationFactory.java11
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeAppearanceObservableValue.java12
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeApplicationObservableList.java11
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/expression/ExpressionList.java14
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java10
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java12
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppearanceDecoratedTreeComposite.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java24
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java13
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java37
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java12
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/plugin.xml2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUseEditor.java (renamed from plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUsePopupEditor.java)35
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java26
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/META-INF/MANIFEST.MF5
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/src/org/eclipse/papyrus/uml/textedit/common/xtext/scoping/UmlCommonScopeProvider.java82
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/plugin.xml2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/src/org/eclipse/papyrus/uml/textedit/connectionpointreference/xtext/ui/contributions/ConnectionPointReferenceEditorConfiguration.java (renamed from plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/src/org/eclipse/papyrus/uml/textedit/connectionpointreference/xtext/ui/contributions/ConnectionPointReferencePopupEditorConfiguration.java)30
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF8
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/plugin.xml2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java217
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPartialModelEditor.java68
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupEditorConfiguration.java210
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupPlugin.java71
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupRuntimeModule.java25
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupUiModule.java35
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/IXtextEMFReconcilerWithContext.java33
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java95
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java42
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/.classpath2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/plugin.xml2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterPopupEditor.java7
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterXtextDirectEditorConfiguration.java238
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/validation/SemanticValidator.java37
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src-gen/org/eclipse/papyrus/uml/textedit/port/xtext/ui/internal/UmlPortActivator.java2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contentassist/UmlPortProposalProvider.java16
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java14
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/UMLPortEditorPropertyUtil.java2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/src/org/eclipse/papyrus/uml/textedit/port/xtext/scoping/UmlPortScopeProvider.java80
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contentassist/UmlPropertyProposalProvider.java189
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java90
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/UMLPropertyEditorPropertyUtil.java2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/src/org/eclipse/papyrus/uml/textedit/property/xtext/scoping/UmlPropertyScopeProvider.java97
-rwxr-xr-xplugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF1
-rwxr-xr-xplugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF1
-rwxr-xr-xplugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java301
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/plugin.xml2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/StringConstants.java20
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contentassist/AppliedStereotypePropertyProposalProvider.java24
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contributions/StereotypePropertyEditorConfigurationContribution.java (renamed from plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contributions/StereotypePropertyPopupEditorConfigurationContribution.java)23
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/META-INF/MANIFEST.MF6
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/plugin.xml2
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contentassist/UmlTransitionProposalProvider.java66
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contributions/TransitionEditorConfigurationContribution.java (renamed from plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contributions/TransitionPopupEditorConfigurationContribution.java)222
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/src/org/eclipse/papyrus/uml/textedit/transition/xtext/scoping/UmlTransitionScopeProvider.java60
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ElementUtil.java64
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java6
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtensionRequiredObservableValue.java10
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageExpressionObservableValue.java10
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageKindObservableValue.java10
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageNameObservableValue.java10
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java11
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/NavigationObservableValue.java11
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/OwnerObservableValue.java11
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java11
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/importsources/PackageImportSourceDialog.java37
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java169
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.core/src/org/eclipse/papyrus/uml/xtext/integration/core/ContextElementAdapter.java14
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF6
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalAdapter.java33
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalUtils.java152
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CustomCompletionProposal.java132
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java159
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DirectEditManagerEx.java12
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java9
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextXtextAdapter.java15
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextDirectEditManager.java56
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextFakeResourceContext.java1
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextStyledTextCellEditor.java80
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/src/org/eclipse/papyrus/uml/xtext/integration/validation/ExistsAnnotationConstraint.java4
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java3
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java22
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java71
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/EcorePropertyEditorFactory.java73
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/PropertyEditorFactory.java79
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java9
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java26
-rw-r--r--releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly-tests/build.rmap2
-rw-r--r--releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly/build.rmap2
-rw-r--r--releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly-tests/build.rmap9
-rw-r--r--releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly/build.rmap2
-rw-r--r--releng/rcp/org.eclipse.papyrus.rcp/splash.bmpbin483054 -> 483054 bytes
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependencies.zipbin4856 -> 4022 bytes
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependents.zipbin2389 -> 2203 bytes
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/isolated.zipbin4718 -> 3881 bytes
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.di251
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.notation1719
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.uml272
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/Bug402525.ecore6
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/NestingTransactionalCommandStackTest.java513
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java6
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF2
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF5
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java13
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.classpath (renamed from plugins/developer/org.eclipse.papyrus.def/.svn/pristine/05/05c7b36fbab4ca0d1ab135dea6de98a858e98957.svn-base)1
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.project28
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.settings/org.eclipse.jdt.core.prefs (renamed from plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8d/8d296e7c27efbc530279b585ece27327bfd35b37.svn-base)1
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF15
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/about.html (renamed from plugins/developer/org.eclipse.papyrus.def/.svn/pristine/21/213758e5da3272ec26a8760b23415abcebba4ed3.svn-base)26
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties20
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/fragment.properties (renamed from plugins/developer/org.eclipse.papyrus.def/.svn/pristine/7b/7b03b446fd8d23e4e34d8e0597bfd2021129c1f8.svn-base)7
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/org.eclipse.papyrus.infra.emf.readonly.tests.launch43
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.di17
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.notation39
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.uml5
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.di17
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.notation95
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.uml22
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/Bug323802.uml6
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainTest.java199
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManagerTest.java131
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandlerTest.java343
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/tests/AllTests.java32
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF8
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/build.properties6
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/org.eclipse.papyrus.infra.emf.tests.launch43
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/resources/readonly.uml4
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/resources/writable.uml6
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/advice/ReadOnlyObjectEditAdviceTest.java631
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/tests/AllTests.java37
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.classpath7
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.project28
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF13
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/about.html28
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties8
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/fragment.properties14
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/org.eclipse.papyrus.infra.gmfdiag.commands.tests.launch42
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/Bug402525.ecore6
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStackTest.java522
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/infra/gmfdiag/commands/tests/AllTests.java29
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.classpath7
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.project28
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF10
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/about.html28
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties8
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.properties14
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/org.eclipse.papyrus.infra.gmfdiag.common.tests.launch42
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AllTests.java29
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafeTest.java219
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/model.uml4
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF1
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/Condition.java33
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ConditionRule.java139
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/Conditional.java41
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ProjectFixture.java125
-rw-r--r--tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/Activator.java10
-rw-r--r--tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/ModelExplorerViewTests.java24
485 files changed, 16629 insertions, 14808 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java
index e57e64cadac..a94616e64a5 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.resource;
@@ -19,7 +20,7 @@ import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.ResourceSetChangeEvent;
-import org.eclipse.papyrus.commands.NotifyingWorkspaceCommandStack;
+import org.eclipse.papyrus.commands.NestingNotifyingWorkspaceCommandStack;
import com.google.common.collect.Sets;
@@ -28,12 +29,21 @@ import com.google.common.collect.Sets;
* A CDO-specific command-stack that attaches undo contexts describing object-level
* details of the scope of a change.
*/
-public class CDOAwareCommandStack extends NotifyingWorkspaceCommandStack {
+public class CDOAwareCommandStack extends NestingNotifyingWorkspaceCommandStack {
public CDOAwareCommandStack(IOperationHistory history) {
super(history);
}
+ protected CDOAwareCommandStack(boolean nested, IOperationHistory history) {
+ super(nested, history);
+ }
+
+ @Override
+ protected NestingNotifyingWorkspaceCommandStack createNestedCommandStack(IOperationHistory history) {
+ return new CDOAwareCommandStack(true, history);
+ }
+
@Override
protected void hookUndoContexts(IUndoableOperation operation, ResourceSetChangeEvent event) {
super.hookUndoContexts(operation, event);
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java
index 723ae2fc3dd..c1583658bb6 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.resource;
@@ -19,6 +20,7 @@ import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.NotificationFilter;
import org.eclipse.emf.transaction.ResourceSetChangeEvent;
import org.eclipse.emf.transaction.ResourceSetListener;
import org.eclipse.emf.transaction.Transaction;
@@ -39,8 +41,20 @@ public class CDOAwareTransactionalEditingDomain extends PapyrusROTransactionalEd
}
@Override
- protected TransactionChangeRecorder createChangeRecorder(ResourceSet rset) {
- return new DawnTransactionChangeRecorder(this, rset);
+ protected TransactionChangeRecorder doCreateChangeRecorder(ResourceSet rset) {
+ return new DawnTransactionChangeRecorder(this, rset) {
+
+ @Override
+ protected void appendNotification(Notification notification) {
+ // Append to the transaction first
+ super.appendNotification(notification);
+
+ if(!NotificationFilter.READ.matches(notification)) {
+ // Check whether we are modifying a read-only object
+ assertNotReadOnly(notification.getNotifier());
+ }
+ }
+ };
}
protected void fireResourceSetChanged(CDOViewInvalidationEvent event) {
@@ -53,6 +67,7 @@ public class CDOAwareTransactionalEditingDomain extends PapyrusROTransactionalEd
CDOUtils.notify(this, new Runnable() {
+ @Override
public void run() {
for(ResourceSetListener element : listeners) {
try {
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
index fee539f50f8..ae5d907111e 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
@@ -18,7 +18,7 @@
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
- dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;"
+ dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.uml.diagram.common;${target.folder}/../../org.eclipse.papyrus.extensionpoints.editors;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.common;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/build.acceleo b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/build.acceleo
index 832ffe921d7..5065c7657c5 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/build.acceleo
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/build.acceleo
@@ -18,7 +18,7 @@
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
- dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.qompass.designer.core;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;"
+ dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.uml.diagram.common;${target.folder}/../../org.eclipse.papyrus.extensionpoints.editors;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.common;${target.folder}/../../org.eclipse.papyrus.qompass.designer.core;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/build.acceleo b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/build.acceleo
index 3fe5cf5246d..c17ba204b24 100644
--- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/build.acceleo
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/build.acceleo
@@ -18,7 +18,7 @@
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
- dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.qompass.modellibs.core;${target.folder}/../../org.eclipse.papyrus.qompass.designer.core;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.infra.services.tracepoints;${target.folder}/../../org.eclipse.papyrus.qompass.designer.ui;"
+ dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.uml.diagram.common;${target.folder}/../../org.eclipse.papyrus.extensionpoints.editors;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.common;${target.folder}/../../org.eclipse.papyrus.qompass.modellibs.core;${target.folder}/../../org.eclipse.papyrus.qompass.designer.core;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;${target.folder}/../../org.eclipse.papyrus.infra.services.tracepoints;${target.folder}/../../org.eclipse.papyrus.qompass.designer.ui;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java
index 4f0bebf5341..2b79a800891 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/utils/RobotmlSelectionTester.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,7 +14,6 @@ package org.eclipse.papyrus.robotml.diagram.common.utils;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.RobotML.RobotMLPackage;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -24,8 +23,6 @@ import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.util.UMLUtil;
/**
* This class is a Property tester used to check if current model (meaning the model currently opened in Papyrus) is a Proteus Model.
@@ -65,20 +62,21 @@ public class RobotmlSelectionTester extends PropertyTester {
return false;
}
- /** True is root object is a UML Model with Proteus Profile (and sub profiles) applied */
+ /** True is root object is a UML Model with RobotML Profile (and sub profiles) applied */
protected boolean testRobotmlModelNature(Object receiver) {
boolean isRobotmlModel = false;
-
-
EObject root = getRoot(receiver);
if(root instanceof Package) {
-
- Profile robotml = UMLUtil.getProfile(RobotMLPackage.eINSTANCE, root);
-
- if(((Package)root).isProfileApplied(robotml)) {
- isRobotmlModel = true;
- }
+ return (((Package)root).getAppliedProfile("RobotML") != null);
+
+ //FIX: UMLUtil.getProfile() loads the profile into the resource set. This is not desired.
+ //
+ // Profile robotml = UMLUtil.getProfile(RobotMLPackage.eINSTANCE, root);
+ //
+ // if(((Package)root).isProfileApplied(robotml)) {
+ // isRobotmlModel = true;
+ // }
}
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.doc/build.properties b/extraplugins/robotml/org.eclipse.papyrus.robotml.doc/build.properties
index 47632c9a216..184355672a4 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.doc/build.properties
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.doc/build.properties
@@ -5,7 +5,5 @@ bin.includes = META-INF/,\
plugin.xml,\
plugin.properties,\
cheatsheets/,\
- help/,\
- html/,\
about.html
src.includes = about.html
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.doc/plugin.xml b/extraplugins/robotml/org.eclipse.papyrus.robotml.doc/plugin.xml
index fccee65fbb2..50099cfff7e 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.doc/plugin.xml
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.doc/plugin.xml
@@ -18,13 +18,13 @@
</description>
</cheatsheet>
</extension>
- <extension
+ <!--extension
point="org.eclipse.help.toc">
<toc
file="help/toc.xml"
primary="true">
</toc>
- </extension>
+ </extension-->
</plugin>
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml/META-INF/MANIFEST.MF b/extraplugins/robotml/org.eclipse.papyrus.robotml/META-INF/MANIFEST.MF
index b8d6c5022d3..5eb7f1ddab1 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml/META-INF/MANIFEST.MF
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml/META-INF/MANIFEST.MF
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
-Require-Bundle: org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.0",
+Require-Bundle: org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0",
org.eclipse.core.runtime,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi;visibility:=reexport,
diff --git a/extraplugins/tablemigration/org.eclipse.papyrus.infra.table.instance/build.properties b/extraplugins/tablemigration/org.eclipse.papyrus.infra.table.instance/build.properties
index 854052f66d4..f3a90b7326c 100644
--- a/extraplugins/tablemigration/org.eclipse.papyrus.infra.table.instance/build.properties
+++ b/extraplugins/tablemigration/org.eclipse.papyrus.infra.table.instance/build.properties
@@ -4,5 +4,6 @@ output..=bin/
bin.includes=.,model/,META-INF/,plugin.xml,plugin.properties,about.html
jars.compile.order=.
src.includes = about.html
-source..=src/
+source.. = src/,\
+ custom-src/
bin..=bin/
diff --git a/features/papyrus-extra-features/org.eclipse.papyrus.extra.robotml.feature/feature.xml b/features/papyrus-extra-features/org.eclipse.papyrus.extra.robotml.feature/feature.xml
index 26949a4184c..653ea9625ef 100644
--- a/features/papyrus-extra-features/org.eclipse.papyrus.extra.robotml.feature/feature.xml
+++ b/features/papyrus-extra-features/org.eclipse.papyrus.extra.robotml.feature/feature.xml
@@ -1,16 +1,21 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><feature id="org.eclipse.papyrus.extra.robotml.feature" label="%featureName" provider-name="%providerName" version="1.0.0.qualifier">
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.papyrus.extra.robotml.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%providerName">
<description>
RobotML Modelling Tools
</description>
<copyright>
- Copyright (c) 2013 CEA LIST.
-
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Eclipse Public License
-v1.0
-which accompanies this distribution, and is available at
+ Copyright (c) 2013 CEA LIST.
+
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License
+v1.0
+which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
</copyright>
@@ -18,32 +23,101 @@ http://www.eclipse.org/legal/epl-v10.html
%license
</license>
- <plugin download-size="0" id="org.eclipse.papyrus.robotml" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.diagram.architecture" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.diagram.common" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.diagram.componentdef" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.diagram.datatypedef" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.diagram.interfacedef" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.templaterepository" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.diagram.ui" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.doc" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.validation" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.modelexplorer" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.perspective" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.generators.common" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.robotml.deployment" install-size="0" version="0.0.0"/>
-
-</feature> \ No newline at end of file
+ <plugin
+ id="org.eclipse.papyrus.robotml"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.diagram.architecture"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.diagram.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.diagram.componentdef"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.diagram.datatypedef"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.diagram.interfacedef"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.templaterepository"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.diagram.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.validation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.modelexplorer"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.perspective"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.generators.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.deployment"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.papyrus.robotml.doc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml b/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml
index ab71672010a..cdf2faaa73f 100644
--- a/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml
+++ b/features/papyrus-main-features/org.eclipse.papyrus.infra.feature/feature.xml
@@ -1,11 +1,16 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><feature id="org.eclipse.papyrus.infra.feature" label="Papyrus infra (Incubation)" provider-name="Eclipse Modeling Project" version="0.10.2.qualifier">
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.papyrus.infra.feature"
+ label="Papyrus infra (Incubation)"
+ version="1.0.0.qualifier"
+ provider-name="Eclipse Modeling Project">
<copyright url="http://www.eclipse.org/legal/epl-v10.html">
- Copyright (c) 2012 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
+ Copyright (c) 2012 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
</copyright>
@@ -13,32 +18,101 @@ http://www.eclipse.org/legal/epl-v10.html
%license
</license>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.export" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.export"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.extendedtypes" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.infra.extendedtypes.edit" install-size="0" unpack="false" version="0.0.0"/>
-
- <plugin download-size="0" id="org.eclipse.papyrus.infra.extendedtypes.emf" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.extendedtypes"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.onefile" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.extendedtypes.edit"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.ui.resources" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.extendedtypes.emf"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.tools" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.onefile"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.constraints" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.ui.resources"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.constraints.edit" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.tools"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.constraints.editor" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.constraints"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.hyperlink" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.constraints.edit"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.doc" install-size="0" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.constraints.editor"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.psf" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.hyperlink"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
- <plugin download-size="0" id="org.eclipse.papyrus.infra.newchild" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.infra.doc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
-</feature> \ No newline at end of file
+ <plugin
+ id="org.eclipse.papyrus.infra.psf"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.infra.newchild"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/papyrus-main-features/org.eclipse.papyrus.uml.properties.feature/feature.xml b/features/papyrus-main-features/org.eclipse.papyrus.uml.properties.feature/feature.xml
index 7f785c49dbe..e4357b1c009 100644
--- a/features/papyrus-main-features/org.eclipse.papyrus.uml.properties.feature/feature.xml
+++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.properties.feature/feature.xml
@@ -1,18 +1,35 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><feature id="org.eclipse.papyrus.uml.properties.feature" label="%featureName" provider-name="%providerName" version="1.0.0.qualifier">
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.papyrus.uml.properties.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%providerName">
<copyright url="http://www.eclipse.org/legal/epl-v10.html">
- Copyright (c) 2012 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
+ Copyright (c) 2012 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
</copyright>
<license url="%licenseURL">
- %license
- </license>
+ %license
+ </license>
- <plugin download-size="0" id="org.eclipse.papyrus.uml.properties" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin
+ id="org.eclipse.papyrus.uml.properties"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
-</feature> \ No newline at end of file
+ <plugin
+ id="org.eclipse.papyrus.uml.properties.xtext"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.feature/feature.xml
index f5e84893ace..9e4b255e711 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.feature/feature.xml
@@ -56,6 +56,22 @@ http://www.eclipse.org/legal/epl-v10.html
id="org.eclipse.papyrus.tests.uml.nattable.feature"
version="0.0.0"/>
+ <includes
+ id="org.eclipse.papyrus.tests.infra.feature"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.papyrus.tests.infra.core.feature"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.papyrus.tests.infra.queries.feature"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.papyrus.tests.uml.tools.feature"
+ version="0.0.0"/>
+
<plugin
id="org.eclipse.papyrus.tests"
download-size="0"
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml
index 6edb28681f4..a740052d0c2 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml
@@ -14,6 +14,6 @@ http://www.eclipse.org/legal/epl-v10.html
<license url="%licenseURL">
%license
</license>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.core.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.infra.core.tests" install-size="0" unpack="false" version="0.0.0"/>
</feature> \ No newline at end of file
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml
index fa00df248a4..a0cc9d36611 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml
@@ -1,20 +1,62 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><feature id="org.eclipse.papyrus.tests.infra.feature" label="%featureName" provider-name="%providerName" version="1.0.0.qualifier">
-
- <copyright url="http://www.eclipse.org/legal/epl-v10.html">
- Copyright (c) 2008-2012 CEA LIST, Atos Origin, Conselleria de
-Infraestructuras y Transporte, Generalitat de la Comunitat Valenciana
-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
- </copyright>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.extendedtypes.tests" install-size="0" unpack="false" version="0.0.0"/>
-
-</feature> \ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.papyrus.tests.infra.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%providerName">
+
+ <copyright url="http://www.eclipse.org/legal/epl-v10.html">
+ Copyright (c) 2008-2014 CEA LIST, Atos Origin, Conselleria de
+Infraestructuras y Transporte, Generalitat de la Comunitat Valenciana
+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
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.papyrus.infra.extendedtypes.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.infra.gmfdiag.commands.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.infra.gmfdiag.common.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.infra.emf.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.infra.emf.readonly.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+</feature>
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/entries b/plugins/developer/org.eclipse.papyrus.def/.svn/entries
deleted file mode 100644
index 3cacc0b93c9..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/entries
+++ /dev/null
@@ -1 +0,0 @@
-12 \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/format b/plugins/developer/org.eclipse.papyrus.def/.svn/format
deleted file mode 100644
index 3cacc0b93c9..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/format
+++ /dev/null
@@ -1 +0,0 @@
-12 \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/17/17abd4bc6ef97a97f83cb30ad2c96618897f07fa.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/17/17abd4bc6ef97a97f83cb30ad2c96618897f07fa.svn-base
deleted file mode 100644
index 00cb8c698ab..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/17/17abd4bc6ef97a97f83cb30ad2c96618897f07fa.svn-base
+++ /dev/null
@@ -1,791 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»This template has been modified to take in account the possibility to have extended direct editors«ENDREM»
-
-«DEFINE fields FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.tools.DirectEditManager manager;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «EXPAND CodeStyle::G('java.util.List', '?')» parserElements;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private String defaultText;
-
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM»Add attributes to manage extended editors«ENDREM»
- «EXPAND xpt::Common::generatedMemberComment('direct edition mode (default, undefined, registered editor, etc.)')»
- protected int directEditionMode = org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- «EXPAND xpt::Common::generatedMemberComment('configuration from a registered edit dialog')»
- protected org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration configuration;
- «REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-«ENDDEFINE»
-
-«DEFINE methods(needsRefreshBounds : Boolean, readOnly : Boolean, useElementIcon : Boolean, viewmap : gmfgen::Viewmap,
- modelFacet : gmfgen::LabelModelFacet, host : gmfgen::GenCommonBase, diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
- «EXPAND getLabelTextHelper-»
-
- «EXPAND setLabelTextHelper-»
-
- «EXPAND getLabelIconHelper-»
-
- «EXPAND setLabelIconHelper-»
-
- «EXPAND labelSetter-»
-
- «EXPAND getModelChildren-»
-
- «EXPAND getChildBySemanticHint-»
- «REM»ITEMIS CHANGES«ENDREM»
- «EXPAND setParser -»
- «REM»ITEMIS CHANGES END«ENDREM»
- «EXPAND getParserElement(modelFacet)-»
-
- «EXPAND getLabelIcon(useElementIcon, diagram)-»
-
- «EXPAND getLabelText-»
-
- «EXPAND setLabelText(diagram)-»
-
- «EXPAND getEditText-»
-
- «EXPAND isEditable(readOnly)-»
-
- «EXPAND getEditTextValidator-»
-
- «EXPAND getCompletionProcessor-»
-
- «EXPAND getParserOptions-»
-
- «EXPAND getParser(modelFacet, diagram, host)-»
-
- «EXPAND getManager(diagram)-»
-
- «EXPAND setManager-»
-
- «EXPAND performDirectEdit-»
-
- «EXPAND performDirectEditAtPoint-»
-
- «EXPAND performDirectEditWithInitialChar-»
-
- «EXPAND performDirectEditRequest(diagram)-»
-
- «EXPAND initializeDirectEditManager-»
-
- «EXPAND refreshVisuals(needsRefreshBounds)-»
-
- «EXPAND refreshLabel(diagram)-»
-
- «EXPAND refreshUnderline-»
-
- «EXPAND refreshStrikeThrough-»
-
- «EXPAND refreshFont-»
-
- «EXPAND setFontColor-»
-
- «EXPAND addSemanticListeners-»
-
- «EXPAND removeSemanticListeners-»
-
- «EXPAND getAccessibleEditPart-»
-
- «EXPAND getFontStyleOwnerView(viewmap)-»
-
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM»Add extended editors management for direct edit«ENDREM»
- «EXPAND getDirectEditionType(readOnly)-»
-
- «EXPAND checkExtendedEditor-»
-
- «EXPAND checkDefaultEdition-»
-
- «EXPAND initExtendedEditorConfiguration -»
-
- «EXPAND updateExtendedEditorConfiguration -»
-
- «EXPAND performDefaultDirectEditorEdit-»
-
- «REM»END: PapyrusGenCode«ENDREM»
-«ENDDEFINE»
-
-«DEFINE labelSetterName FOR gmfgen::ParentAssignedViewmap-»
-«IF setterName <> null»«setterName»«ELSE»setLabel«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE labelSetterName FOR gmfgen::Viewmap»setLabel«ENDDEFINE»
-
-«DEFINE getLabelTextHelper FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText();
- } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
- return ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).getText();
- } else {
- return ((org.eclipse.draw2d.Label) figure).getText();
- }
- }
-«ENDDEFINE»
-
-«DEFINE setLabelTextHelper FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text);
- } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
- ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).setText(text);
- } else {
- ((org.eclipse.draw2d.Label) figure).setText(text);
- }
- }
-«ENDDEFINE»
-
-«DEFINE getLabelIconHelper FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon();
- } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
- return ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).getIcon();
- } else {
- return ((org.eclipse.draw2d.Label) figure).getIcon();
- }
- }
-«ENDDEFINE»
-
-«DEFINE setLabelIconHelper FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) {
- if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) {
- ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).setIcon(icon);
- } else {
- ((org.eclipse.draw2d.Label) figure).setIcon(icon);
- }
- }
-«ENDDEFINE»
-
-«DEFINE labelSetter FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void «EXPAND labelSetterName FOR viewmap»(«EXPAND labelSetterFigureClassName FOR viewmap» figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-«ENDDEFINE»
-
-«DEFINE labelSetterFigureClassName FOR gmfgen::ParentAssignedViewmap-»
- «IF figureQualifiedClassName <> null-»
- «figureQualifiedClassName»
- «ELSE-»
- org.eclipse.draw2d.IFigure
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE labelSetterFigureClassName FOR gmfgen::Viewmap-»
- org.eclipse.draw2d.IFigure
-«ENDDEFINE»
-
-«DEFINE getModelChildren FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List getModelChildren() {
- return java.util.Collections.EMPTY_LIST;
- }
-«ENDDEFINE»
-
-«DEFINE getChildBySemanticHint FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE setParser FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-«ENDDEFINE»
-
-«DEFINE getParserElement(modelFacet : gmfgen::LabelModelFacet) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.emf.ecore.EObject getParserElement() {
-«IF modelFacet = null»
- org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
- return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel();
-«ELSE»«EXPAND getParserElement FOR modelFacet»«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE getParserElement FOR gmfgen::LabelModelFacet-»
- return resolveSemanticElement();
-«ENDDEFINE»
-
-«DEFINE getParserElement FOR gmfgen::DesignLabelModelFacet-»
- return (org.eclipse.gmf.runtime.notation.View) getModel();
-«ENDDEFINE»
-
-«DEFINE getLabelIcon(useElementIcon : Boolean, diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.swt.graphics.Image getLabelIcon() {
- «IF useElementIcon-»
- org.eclipse.emf.ecore.EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- «REM»START: PapyrusGenCode«ENDREM»
- java.util.List<org.eclipse.gmf.runtime.notation.View> views = org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for (org.eclipse.gmf.runtime.notation.View view : views) {
- if (org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper.showLabelIcon(view)) {
- return «diagram.getElementTypesQualifiedClassName()».getImage(parserElement.eClass());
- }
- }
- return null;
- «REM»END: PapyrusGenCode«ENDREM»
- «ELSE-»
- return null;
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE getLabelText FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getLabelText() {
- String text = null;
- org.eclipse.emf.ecore.EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(parserElement),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-«ENDDEFINE»
-
-«DEFINE setLabelText(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
- }
- }
-«ENDDEFINE»
-
-«DEFINE getEditText FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; «EXPAND xpt::Common::nonNLS»
- }
- return getParser().getEditString(
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-«ENDDEFINE»
-
-«DEFINE isEditable(readOnly : Boolean) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean isEditable() {
- «IF readOnly-»
- return false;
- «ELSE-»
- return getParser() != null;
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE getEditTextValidator FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
- return new org.eclipse.jface.viewers.ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if (value instanceof String) {
- final org.eclipse.emf.ecore.EObject element = getParserElement();
- final org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = getParser();
- try {
- org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus valid =
- (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive(
- new org.eclipse.emf.transaction.RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-«ENDDEFINE»
-
-«DEFINE getCompletionProcessor FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()));
- }
-«ENDDEFINE»
-
-«DEFINE getParserOptions FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() {
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE;
- }
-«ENDDEFINE»
-
-«DEFINE getParser(modelFacet : gmfgen::LabelModelFacet, diagram : gmfgen::GenDiagram, host : gmfgen::GenCommonBase) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() {
- if (parser == null) {
- parser = «EXPAND parsers::ParserProvider::accessorCall(host, modelFacet, 'getParserElement()')»;
- }
- return parser;
- }
-«ENDDEFINE»
-
-«DEFINE getManager(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.tools.DirectEditManager getManager() {
- if (manager == null) {
- setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this,
- org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
- }
- return manager;
- }
-«ENDDEFINE»
-
-«DEFINE setManager FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) {
- this.manager = manager;
- }
-«ENDDEFINE»
-
-«DEFINE performDirectEdit FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void performDirectEdit() {
- getManager().show();
- }
-«ENDDEFINE»
-
-«DEFINE performDirectEditAtPoint FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) {
- if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
- ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-«ENDDEFINE»
-
-«DEFINE performDirectEditWithInitialChar FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
- ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-«ENDDEFINE»
-
-«DEFINE performDirectEditRequest(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void performDirectEditRequest(org.eclipse.gef.Request request) {
-
- final org.eclipse.gef.Request theRequest = request;
-
- if (org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this,
- org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- org.eclipse.jface.dialogs.Dialog dialog = null;
- if (configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) {
- setManager(((org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- setParser(((org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) configuration).createParser(this.resolveSemanticElement()));
- initializeDirectEditManager(theRequest);
- return;
- } else if (configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration) {
- org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper helper = ((org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration)configuration).createPopupEditorHelper(this) ;
- helper.showEditor() ;
- return ;
- }
- else if(configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration) {
- dialog = ((org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration)configuration).createDialog(org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration) {
- dialog = new org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final org.eclipse.jface.dialogs.Dialog finalDialog = dialog;
-
- if (org.eclipse.jface.window.Window.OK == dialog.open()) {
- org.eclipse.emf.transaction.TransactionalEditingDomain domain = getEditingDomain();
- org.eclipse.emf.transaction.RecordingCommand command = new org.eclipse.emf.transaction.RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog)finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-«ENDDEFINE»
-
-«DEFINE initializeDirectEditManager FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if ((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) request;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-«ENDDEFINE»
-
-«DEFINE refreshVisuals(needsRefreshBounds : Boolean) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- «IF needsRefreshBounds-»
- refreshBounds();
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE refreshLabel(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshLabel() {
- org.eclipse.gef.EditPolicy maskLabelPolicy = getEditPolicy(org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
- }
- }
-«ENDDEFINE»
-
-«DEFINE refreshUnderline FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshUnderline() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if(resolveSemanticElement() instanceof org.eclipse.uml2.uml.Feature){
- if(((org.eclipse.uml2.uml.Feature)resolveSemanticElement()).isStatic()){
- ((WrappingLabel)getFigure()).setTextUnderline(true);
- }
- else{((WrappingLabel)getFigure()).setTextUnderline(false);}
- }
- }
-«ENDDEFINE»
-
-«DEFINE refreshStrikeThrough FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshStrikeThrough() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-«ENDDEFINE»
-
-«DEFINE refreshFont FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshFont() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) |
- (style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL));
- setFont(fontData);
- }
- }
-«ENDDEFINE»
-
-«DEFINE setFontColor FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setFontColor(org.eclipse.swt.graphics.Color color) {
- getFigure().setForegroundColor(color);
- }
-«ENDDEFINE»
-
-«DEFINE addSemanticListeners FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addSemanticListeners() {
- if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
- org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
- parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «EXPAND xpt::Common::nonNLS»
- }
- } else {
- super.addSemanticListeners();
- }
- }
-«ENDDEFINE»
-
-«DEFINE removeSemanticListeners FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); «EXPAND xpt::Common::nonNLS»
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-«ENDDEFINE»
-
-«DEFINE getAccessibleEditPart FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-«ENDDEFINE»
-
-«DEFINE getFontStyleOwnerView(viewmap : gmfgen::Viewmap) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() {
- «IF viewmap.isFixedFont()-»
- return (org.eclipse.gmf.runtime.notation.View) getModel();
- «ELSE-»
- return getPrimaryView();
- «ENDIF-»
- }
-«ENDDEFINE»
-
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Methods for advanced direct edition«ENDREM»
-
-«DEFINE getDirectEditionType(readOnly : Boolean) FOR gmfgen::GenCommonBase-»
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- «IF readOnly-»
- // The label is read-only (defined in GMFGen model)
- return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION;
- «ELSE-»
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION;
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE checkExtendedEditor FOR gmfgen::GenCommonBase-»
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE checkDefaultEdition FOR gmfgen::GenCommonBase-»
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-«ENDDEFINE»
-
-«DEFINE initExtendedEditorConfiguration FOR gmfgen::GenCommonBase-»
- /**
- * Initializes the extended editor configuration
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = org.eclipse.papyrus.extensionpoints.editors.Activator.getDefault().getPreferenceStore().getString(org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE updateExtendedEditorConfiguration FOR gmfgen::GenCommonBase-»
- /**
- * Updates the preference configuration
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = org.eclipse.papyrus.extensionpoints.editors.Activator.getDefault().getPreferenceStore().getString(
- org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-«ENDDEFINE»
-
-«DEFINE performDefaultDirectEditorEdit FOR gmfgen::GenCommonBase-»
- /**
- * Performs the direct edit usually used by GMF editors.
- * @param theRequest the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final org.eclipse.gef.Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if (isActive() && isEditable()) {
- if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) theRequest.getExtendedData().get(
- org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1b/1bb398d311a4854a3cc8567eeb1d22b414d83816.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1b/1bb398d311a4854a3cc8567eeb1d22b414d83816.svn-base
deleted file mode 100644
index 8d77c5f4d4a..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1b/1bb398d311a4854a3cc8567eeb1d22b414d83816.svn-base
+++ /dev/null
@@ -1,51 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation bug 335987: [General][Enhancement] Show/Hide Connectors Labels https://bugs.eclipse.org/bugs/show_bug.cgi?id=335987
- *****************************************************************************/
-
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM» this template add the interface ILabelRoleProvider for the label EditPart. This interface is used in by the Manage Label Action «ENDREM»
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-
-«REM» we add the interface ILabelRoleProvider «ENDREM»
-«AROUND implementsList FOR gmfgen::GenLinkLabel»
- «targetDef.proceed()»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(self))->size()<>0-»
- , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider
- «ENDIF-»
- «REM»END: PapyrusGenCode«ENDREM»
-«ENDAROUND»
-
-«REM» we add the methods provided by the interface «ENDREM»
-«AROUND additions FOR gmfgen::GenLinkLabel-»
-«targetDef.proceed()»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(self))->size()<>0»
- «EXPAND xpt::Common::generatedClassComment»
- public String getLabelRole(){
- return "«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(self))->asSequence()->first().role»";//$NON-NLS-1$
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public String getIconPathRole(){
- return "«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(self))->asSequence()->first().iconPathRole»";//$NON-NLS-1$
- }
- «ENDIF»
- «REM»END: PapyrusGenCode«ENDREM»
-«ENDAROUND»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»patches the super type of the link label edit part in case the controlled object represents a UML element«ENDREM»
-«DEFINE extendsList FOR gmfgen::GenLinkLabel»extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1c/1c359b6f8d0b5e153c81681f2505703c6b234b9a.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1c/1c359b6f8d0b5e153c81681f2505703c6b234b9a.svn-base
deleted file mode 100644
index dc4e936301d..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1c/1c359b6f8d0b5e153c81681f2505703c6b234b9a.svn-base
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- */
-
-import xpt.StringOperations;
-
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2009/GenModel";
-
-library Utils;
-
-helper gmfgen::Palette::activatorFQN() : String {
- return self.diagram.editorGen.plugin.getActivatorQualifiedClassName()
-}
-
-helper gmfgen::AbstractToolEntry::activatorFQN() : String {
- return self.group.palette.activatorFQN()
-}
-
-helper gmfgen::ToolGroup::activatorFQN() : String {
- return self.palette.activatorFQN()
-}
-
-helper i18nKey(group : gmfgen::EntryBase) : String {
- return let rv = group.createMethodName in (if rv.xpandStartsWith('get') then rv.xpandSubstring(3) else (if rv.xpandStartsWith('create') then rv.xpandSubstring(6) else rv endif) endif)
-}
-
-helper i18nTitleKey(group : gmfgen::EntryBase) : String {
- return i18nKey(group) + '_title'
-}
-
-helper i18nDescKey(group : gmfgen::EntryBase) : String {
- return i18nKey(group) + '_desc'
-}
-
-helper collectGroups(palette : gmfgen::Palette) : Sequence(gmfgen::ToolGroup) {
- return palette.groups->asSequence()->union(palette.groups->collect(it | collectSubGroups(it)))->asOrderedSet()->asSequence()
-}
-
-helper collectSubGroups(group : gmfgen::ToolGroup) : Sequence(gmfgen::ToolGroup) {
- return let rv = (group.entries)[gmfgen::ToolGroup] in rv->union(rv->collect(g | collectSubGroups(g))->flatten()->asSet())->asSequence()
-}
-
-/**
- * collect all tools availables and valid to generate the palette. A tool is not valid when it does not create either a link or a node
- */
-helper collectTools(palette : gmfgen::Palette) : Sequence(gmfgen::AbstractToolEntry) {
- return collectGroups(palette).entries[gmfgen::AbstractToolEntry]->select(tool | tool.isValidTool())
-}
-
-helper gmfgen::AbstractToolEntry::isValidTool() : Boolean {
- return if(self.oclIsKindOf(ToolEntry)) then ( self[gmfgen::ToolEntry].genNodes->size()+self[gmfgen::ToolEntry].genLinks->size() ) <> 0 else true endif
-}
-
-helper needsNodeToolEntryClass(palette : gmfgen::Palette) : Boolean {
- return collectTools(palette)[gmfgen::ToolEntry]->exists(genNodes->notEmpty())
-}
-
-helper needsLinkToolEntryClass(palette : gmfgen::Palette) : Boolean {
- return collectTools(palette)[gmfgen::ToolEntry]->exists(genLinks->notEmpty())
-}
-
-helper String::getToolPath() : String {
- /** returns the '/' separator and then the id of the parent group path */
- return "/".concat(if(self.isQuoted('\"')) then self.substring(2, self.size()-1) else self endif)
-}
-
-helper String::getConstantIDName() : String {
- return if(self.isQuoted('\"')) then getUpperAndUnderscoreString(self.substring(2, self.size()-1)) else getUpperAndUnderscoreString(self) endif
-}
-
-helper getUpperAndUnderscoreString(value:String) : String {
- return getUpper(value).replace(".", "_")
-}
-
-helper getUpper(value:String) : String {
- return value.toUpper();
-} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1f/1ffb0daa92013b65e6fefbeac09dd90c5a015256.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1f/1ffb0daa92013b65e6fefbeac09dd90c5a015256.svn-base
deleted file mode 100644
index 7695b0b91c7..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/1f/1ffb0daa92013b65e6fefbeac09dd90c5a015256.svn-base
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-
-«REM»DOCUMENTATION: PapyrusGenCode«ENDREM»
-«REM»Overload only the creation of editPolicies in order to add the paste edit policy«ENDREM»
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-
-
-«AROUND createDefaultEditPoliciesBody FOR gmfgen::GenCompartment-»
- super.createDefaultEditPolicies();
- «IF canCollapse-»
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy());
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
- «IF childNodes->size() > 0-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy());
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
- installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy());
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
- «EXPAND xpt::diagram::editparts::Common::behaviour-»
-«ENDAROUND»
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/22/2280df8d24f4ed194ab58ce07022034bfeef1886.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/22/2280df8d24f4ed194ab58ce07022034bfeef1886.svn-base
deleted file mode 100644
index 379a5d86d15..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/22/2280df8d24f4ed194ab58ce07022034bfeef1886.svn-base
+++ /dev/null
@@ -1,9 +0,0 @@
-import library qvtlib.SampleLibrary;
-
-library file;
-modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
-
-
-helper dump(model: ecore::EPackage): OclAny {
- model.dumpErr('model: ');
-} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/23/230fc08b4b700ee5957583b2c63380deda2fe91f.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/23/230fc08b4b700ee5957583b2c63380deda2fe91f.svn-base
deleted file mode 100644
index 667d59d19dd..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/23/230fc08b4b700ee5957583b2c63380deda2fe91f.svn-base
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
-
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Thibault Landre (Atos Origin) - add Papyrus dependencies to Papyrus GMF diagram*
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr : add the dependencyorg.eclipse.papyrus.infra.services.edit
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::Utils»
-
-«DEFINE manifest FOR gmfgen::GenPlugin-»
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: «iD»; singleton:=true
-Bundle-Version: «version»
-Bundle-ClassPath: .
-Bundle-Activator: «getActivatorQualifiedClassName()»
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: «editorGen.diagram.editPartsPackageName»,
- «editorGen.editor.packageName»,
- «editorGen.diagram.providersPackageName»
-Require-Bundle: org.eclipse.core.runtime,
-«IF editorGen.application = null-»
- org.eclipse.core.resources,
-«ENDIF-»
-«IF editorGen.diagram.generateShortcutIcon() or (editorGen.navigator <> null and editorGen.navigator.generateDomainModelNavigator)-»
- org.eclipse.core.expressions,
-«ENDIF-»
- org.eclipse.jface,
-«IF editorGen.application = null-»
- org.eclipse.ui.ide,
-«ENDIF-»
- org.eclipse.ui.views,
-«IF editorGen.navigator <> null-»
- org.eclipse.ui.navigator,
- org.eclipse.ui.navigator.resources,
-«ENDIF-»
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.uml.diagram.common,
- org.eclipse.papyrus.infra.gmfdiag.common,
- org.eclipse.papyrus.uml.service.types,
- org.eclipse.papyrus.infra.widgets,
-«IF printingEnabled-»
- org.eclipse.gmf.runtime.diagram.ui.printing,
- org.eclipse.gmf.runtime.diagram.ui.printing.render,
-«ENDIF-»
-«IF editorGen.propertySheet <> null-»
- org.eclipse.gmf.runtime.diagram.ui.properties,
-«ENDIF-»
- org.eclipse.gmf.runtime.diagram.ui.providers,
-«IF editorGen.application = null-»
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
-«ENDIF-»
- org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
-«IF editorGen.application = null-»
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
-«ENDIF-»
-«FOREACH getAllRequiredPlugins()->asSequence() AS id-»
- «id»;visibility:=reexport,
-«ENDFOREACH-»
- org.eclipse.gef,
- org.eclipse.papyrus.infra.gmfdiag.preferences,
- org.eclipse.papyrus.extensionpoints.editors
-«IF papyrusgmfgenextension::EditPartUsingDeleteService.allInstances()->size()<>0 or papyrusgmfgenextension::EditPartUsingReorientService.allInstances()->size()<>0-»
- ,org.eclipse.papyrus.infra.services.edit
-«ENDIF-»
-Eclipse-LazyStart: true
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/25/253dfc5c84dc27b53ffece1e75dcb3b3d90eb61e.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/25/253dfc5c84dc27b53ffece1e75dcb3b3d90eb61e.svn-base
deleted file mode 100644
index e4da19f4bdf..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/25/253dfc5c84dc27b53ffece1e75dcb3b3d90eb61e.svn-base
+++ /dev/null
@@ -1,83 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::editpolicies::Utils»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::editpolicies::linkCommands»
-
-
-«REM»
-We overwrite the reorientTypeLinkCommands to manages the links which use the ReorientCommand provided by the EditService
-«ENDREM»
-«AROUND reorientTypeLinkCommands FOR gmfgen::GenLinkEnd-»
-«EXPAND xpt::Common::generatedMemberComment(
- 'Returns command to reorient EClass based link. New link target or source\n' +
- 'should be the domain model element associated with this node.\n'
-)»
-protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- «EXPAND reorientLinkCommandWithService FOREACH getReroutableTypeLinks(self)-»
- «EXPAND callReorientCommand-»
- «EXPAND reorientLinkCommandWithoutService FOREACH getReroutableTypeLinks(self)-»
- }
- return super.getReorientRelationshipCommand(req);
- }
-«ENDAROUND»
-
-«REM»
-This function writes only : "case myLinkEditPart.VISUAL_ID:"
-for the link which uses the ReorientCommand provided by the EditService
-«ENDREM»
-«DEFINE reorientLinkCommandWithService FOR gmfgen::GenLink-»
- «IF papyrusgmfgenextension::EditPartUsingReorientService.allInstances()->select(v:papyrusgmfgenextension::EditPartUsingReorientService|v.genView->includes(self))->size()<>0-»
- «EXPAND xpt::Common::caseVisualID-»
- «ENDIF-»
-«ENDDEFINE»
-
-«REM»
-This function writes the code to call the ReorientCommand provided by the ReorientService
-«ENDREM»
-«DEFINE callReorientCommand FOR gmfgen::GenLinkEnd-»
- «LET papyrusgmfgenextension::EditPartUsingReorientService.allInstances() AS rServiceNodes-»
- «IF rServiceNodes->notEmpty()-»
- «IF rServiceNodes->asSequence()
- ->select(rServiceNode | rServiceNode.genView->select(view | getReroutableTypeLinks(self)->includes(view))->notEmpty())
- ->notEmpty()-»
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if(provider == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- org.eclipse.gmf.runtime.common.core.command.ICommand reorientCommand = provider.getEditCommand(req);
- if(reorientCommand == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- «ENDIF-»
- «ENDIF-»
- «ENDLET-»
-«ENDDEFINE»
-
-«REM»
-This function writes the code for the Links which uses their own ReorientCommand (the initial code)
-«ENDREM»
-«DEFINE reorientLinkCommandWithoutService FOR gmfgen::GenLink-»
- «IF papyrusgmfgenextension::EditPartUsingReorientService.allInstances()->select(v:papyrusgmfgenextension::EditPartUsingReorientService|v.genView->includes(self))->size()=0-»
- «EXPAND xpt::diagram::editpolicies::linkCommands::reorientLinkCommand-»
- «ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base
deleted file mode 100644
index f8788ab488d..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/28/283d1edb1fc4e752755b3e7e2e6aa2d324a8135c.svn-base
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2007, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«EXTENSION xpt::diagram::Utils»
-
-«REM»
- Check whether link may be created.
-«ENDREM»
-«DEFINE canCreate(link : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && «EXPAND MetaModel::NotInstance('source') FOR getSourceType()») {
- return false;
- }
- if (target != null && «EXPAND MetaModel::NotInstance('target') FOR getTargetType()») {
- return false;
- }
- if (getSource() == null) {
- return true; // link creation is in progress; source is not defined yet
- }
- // target may be null here but it's possible to check constraint
- «EXPAND canCreateElement(link)-»
- }
-«ENDDEFINE»
-
-«DEFINE canCreateElement(link : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE canCreateElement(link : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet-»
-«IF hasContainerOtherThanSource(self)-»
- if (getContainer() == null) {
- return false;
- }
-«ENDIF-»
- return «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::canCreateCall(link, 'getContainer()', 'getSource()', 'getTarget()')»;
-«ENDDEFINE»
-
-«DEFINE canCreateElement(link : gmfgen::GenLink) FOR gmfgen::FeatureLinkModelFacet-»
- return «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::canCreateCall(link, 'getSource()', 'getTarget()')»;
-«ENDDEFINE»
-
-«REM»
- Fields of command that creates link.
-«ENDREM»
-«DEFINE fields FOR gmfgen::LinkModelFacet»
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EObject source;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EObject target;
-«ENDDEFINE»
-
-«DEFINE fields FOR gmfgen::TypeLinkModelFacet»
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EObject source;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EObject target;
-«IF hasContainerOtherThanSource(self)»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container;
-«ENDIF-»
-«ENDDEFINE»
-
-«REM»
- Field accessors of command that creates link.
-«ENDREM»
-«DEFINE accessors FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getSource() {
- return «EXPAND MetaModel::CastEObject('source') FOR getSourceType()»;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» getTarget() {
- return «EXPAND MetaModel::CastEObject('target') FOR getTargetType()»;
- }
- «EXPAND containerAccessor-»
-«ENDDEFINE»
-
-«DEFINE containerAccessor FOR gmfgen::LinkModelFacet»«ENDDEFINE»
-
-«DEFINE containerAccessor FOR gmfgen::TypeLinkModelFacet-»
-«IF hasContainerOtherThanSource(self)-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» getContainer() {
- return container;
- }
-
- «EXPAND xpt::Common::generatedMemberComment(
- 'Default approach is to traverse ancestors of the source to find instance of container.\n' +
- 'Modify with appropriate logic.'
- )»
- protected «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» deduceContainer(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) {
- // Find container element for the new link.
- // Climb up by containment hierarchy starting from the source
- // and return the first element that is instance of the container class.
- for (org.eclipse.emf.ecore.EObject element = source; element != null; element = element.eContainer()) {
- if («EXPAND MetaModel::IsInstance('element') FOR containmentMetaFeature.genClass») {
- return «EXPAND MetaModel::CastEObject('element') FOR containmentMetaFeature.genClass»;
- }
- }
- return null;
- }
-«ENDIF-»
-
-«ENDDEFINE»
-
-«REM»
- Part of the constructor that performs initialization.
-«ENDREM»
-«DEFINE _init FOR gmfgen::LinkModelFacet-»
- this.source = source;
- this.target = target;
-«ENDDEFINE»
-
-«DEFINE _init FOR gmfgen::TypeLinkModelFacet-»
- this.source = source;
- this.target = target;
-«IF hasContainerOtherThanSource(self)-»
- container = deduceContainer(source, target);
-«ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/29/2957f0d214ef6507462de791cad7713da2c513f4.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/29/2957f0d214ef6507462de791cad7713da2c513f4.svn-base
deleted file mode 100644
index d609b158d19..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/29/2957f0d214ef6507462de791cad7713da2c513f4.svn-base
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-«EXTENSION xpt::diagram::Utils»
-
-«AROUND offset(String viewVar) FOR gmfgen::GenExternalNodeLabel»
-«IF labelOffsetX(viewmap, 0) <> 0 or labelOffsetY(viewmap, 0) <> 0-»
- «EXPAND xpt::diagram::views::Utils::offset(viewVar, labelOffsetX(viewmap, 0), labelOffsetY(viewmap, 0))-»
-«ELSE-»
- «targetDef.proceed()-»
-«ENDIF-»
-«ENDAROUND»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/29/29a863df38b8b7d386209b5981260f6b1b2a2f18.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/29/29a863df38b8b7d386209b5981260f6b1b2a2f18.svn-base
deleted file mode 100644
index bd803606476..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/29/29a863df38b8b7d386209b5981260f6b1b2a2f18.svn-base
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * modified by Patrick Tessier (CEA LIST)
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::Utils»
-«EXTENSION xpt::diagram::commands::file»
-«EXTENSION xpt::diagram::commands::NodeConstraintUtils»
-«EXTENSION xpt::OclMigrationProblems»
-
-«DEFINE CreateNodeCommand FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editCommandsPackageName»;
-«EXPAND xpt::Common::generatedClassComment»
-public class «createCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
- «REM» Mutating canvas auxiliary «ENDREM»
- «EXPAND xpt::Common::generatedMemberComment-»
- private org.eclipse.emf.ecore.EClass eClass = null;
- «EXPAND xpt::Common::generatedMemberComment-»
- private org.eclipse.emf.ecore.EObject eObject = null;
- «REM» Mutating canvas auxiliary constructor «ENDREM»
- «EXPAND xpt::Common::generatedMemberComment-»
- public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
- «REM» Mutating canvas auxiliary builder «ENDREM»
- «EXPAND xpt::Common::generatedMemberComment-»
- public static «createCommandClassName» create(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) {
- return new «createCommandClassName»(req, eObject);
- }
- «EXPAND _constructor-»
- «EXPAND getElementToEdit-»
- «EXPAND canExecuteMethod-»
- «EXPAND doExecuteWithResultMethod»
- «EXPAND doConfigureMethod»
-}
-«ENDDEFINE»
-«DEFINE _constructor FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-«ENDDEFINE»
-/*
- * TODO: either use setElementToEdit, or generate downcasted version (which may be troublesome if containment and child features point to a different parent)
- */
-«DEFINE getElementToEdit FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment('FIXME: replace with setElementToEdit()')»
-protected org.eclipse.emf.ecore.EObject getElementToEdit() {
-
- «REM» Mutating canvas helper «ENDREM»
- org.eclipse.emf.ecore.EObject container =
- ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer();
- if (container instanceof org.eclipse.gmf.runtime.notation.View) {
- container = ((org.eclipse.gmf.runtime.notation.View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
-}
-«ENDDEFINE»
-
-«REM» [AbstractElement] Modified for Abstract domain element «ENDREM»
-«DEFINE doExecuteWithResultMethod FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
-«REM» [AbstractElement] START «ENDREM»
-
-«IF modelFacet.metaClass.ecoreClass._abstract <> true-»
-«REM» [AbstractElement] END «ENDREM»
-«IF modelFacet.isPhantomElement()-»
- «EXPAND phantomElementCreation(self, 'newElement') FOR modelFacet»
-«ELSE-»
- «EXPAND normalElementCreation(self, 'newElement') FOR modelFacet»
-«ENDIF»
- «EXPAND initialize(self, 'newElement') FOR modelFacet-»
-«IF true/*FIXME boolean needsExternalConfiguration*/»
- doConfigure(newElement, monitor, info);
-«ENDIF»
- ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«EXPAND MetaModel::DowncastToEObject('newElement') FOR modelFacet.metaClass»);
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(newElement);
- }
-«REM» [AbstractElement] START «ENDREM»
-«ELSE-»
- throw new UnsupportedOperationException("Unimplemented operation (abstract domain element).");
- }
-«ENDIF»
-«REM» [AbstractElement] END «ENDREM»
-«ENDDEFINE»
-/*
- * Unlike original CreateElementCommand, we don't keep track of IStatus from configureCommand.execute,
- * nor allow status setting from doDefaultCreation. The reason is ICommandProxy#execute implementation,
- * which ignores any status from wrapped ICommand. Besides, both CommandResult and IStatus seems too much to me.
- */
-«DEFINE doConfigureMethod FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void doConfigure(«EXPAND MetaModel::QualifiedClassName FOR modelFacet.metaClass» newElement, org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getElementType();
- org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest configureRequest = new org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest(getEditingDomain(), «EXPAND MetaModel::DowncastToEObject('newElement') FOR modelFacet.metaClass», elementType);
- configureRequest.setClientContext(((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- org.eclipse.gmf.runtime.common.core.command.ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-«ENDDEFINE»
-«DEFINE canExecuteMethod FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean canExecute() {
-«IF modelFacet.isPhantomElement()-»
- return true;
-«ELSE-»
- «EXPAND canExecute_Normal FOR modelFacet»
-«ENDIF-»
- }
-«ENDDEFINE»
-«DEFINE canExecute_Normal FOR gmfgen::TypeModelFacet-»
-«IF not containmentMetaFeature.oclIsUndefined()-»
- «IF not containmentMetaFeature.ecoreFeature.oclIsUndefined()-»
- «IF not isUnbounded(containmentMetaFeature.ecoreFeature) or (childMetaFeature <> containmentMetaFeature and not isUnbounded(childMetaFeature.ecoreFeature))-»
- «EXPAND MetaModel::DeclareAndAssign('container', 'getElementToEdit()') FOR containmentMetaFeature.genClass-»
- «IF not isUnbounded(containmentMetaFeature.ecoreFeature)-»
- «IF isSingleValued(containmentMetaFeature.ecoreFeature)»
- if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR containmentMetaFeature» != null) {
- «ELSE-»
- if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR containmentMetaFeature».size() >= «containmentMetaFeature.ecoreFeature.upperBound») {
- «ENDIF-»
- return false;
- }
- «ENDIF-»
- «IF childMetaFeature <> containmentMetaFeature and not isUnbounded(childMetaFeature.ecoreFeature)-»
- «IF isSingleValued(childMetaFeature.ecoreFeature)-»
- if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR childMetaFeature» != null) {
- «ELSE-»
- if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR childMetaFeature».size() >= «childMetaFeature.ecoreFeature.upperBound») {
- «ENDIF-»
- return false;
- }
- «ENDIF-»
- «ENDIF-»
- «ENDIF-»
-«ENDIF-»
-«REM» [NodeCreationConstraint] START «ENDREM»
-«IF getOwningGenNode().hasNodeCreationConstraint()-»
- «getOwningGenNode().getNodeCreationConstraintBody()-»
-«ELSE-»
-«REM» [NodeCreationConstraint] END «ENDREM»
-return true;
-«REM» [NodeCreationConstraint] START «ENDREM»
-«ENDIF-»
-«REM» [NodeCreationConstraint] END «ENDREM»
-«ENDDEFINE»
-«DEFINE phantomElementCreation(node : gmfgen::GenNode, varName : String) FOR gmfgen::TypeModelFacet-»
- // Uncomment to put "phantom" objects into the diagram file.
- // org.eclipse.emf.ecore.resource.Resource resource =
- // ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer().eResource();
- // if (resource == null) {
- // return null;
- // }
- org.eclipse.emf.ecore.resource.Resource resource = getElementToEdit().eResource();
- «EXPAND MetaModel::NewInstance(varName) FOR metaClass»
- resource.getContents().add(«EXPAND MetaModel::DowncastToEObject(varName) FOR metaClass»);
-«ENDDEFINE»
-«DEFINE normalElementCreation(node : gmfgen::GenNode, varName : String) FOR gmfgen::TypeModelFacet-»
- «EXPAND MetaModel::NewInstance(varName) FOR metaClass»
-«IF not containmentMetaFeature.oclIsUndefined()-»
- «EXPAND MetaModel::DeclareAndAssign('owner', 'getElementToEdit()') FOR containmentMetaFeature.genClass»
- «EXPAND MetaModel::modifyFeature('owner', containmentMetaFeature.genClass, varName) FOR containmentMetaFeature-»
-«ELSE-»
- //
- // FIXME no containment feature found in the genmodel, toolsmith need to manually write code here to add «varName» to a parent
- //
-«ENDIF»
-«IF hasExplicitChildFeature(self)-»
- «EXPAND MetaModel::DeclareAndAssign('childHolder', 'getElementToEdit()') FOR childMetaFeature.genClass»
- «EXPAND MetaModel::modifyFeature('childHolder', childMetaFeature.genClass, varName) FOR childMetaFeature»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE initialize(node : gmfgen::GenNode, newElementVar : String) FOR gmfgen::TypeModelFacet»«EXPAND xpt::providers::ElementInitializers::initMethodCall(self, newElementVar) FOR node»«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2a/2ab05e04fde792be1061d2b6fa451904c77fae46.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2a/2ab05e04fde792be1061d2b6fa451904c77fae46.svn-base
deleted file mode 100644
index 234da03e945..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2a/2ab05e04fde792be1061d2b6fa451904c77fae46.svn-base
+++ /dev/null
@@ -1,7 +0,0 @@
-bin.includes = META-INF/,\
- .,\
- about.html,\
- dynamic-templates3.5/,\
- plugin.properties
-src.includes = dynamic-templates3.5,\
- about.html
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2c/2c3e08a103e27ad154d87e25654a08fe0ff280f4.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2c/2c3e08a103e27ad154d87e25654a08fe0ff280f4.svn-base
deleted file mode 100644
index 8adc5f8cc91..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2c/2c3e08a103e27ad154d87e25654a08fe0ff280f4.svn-base
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»change the superclass and the initialization «ENDREM»
-
-«DEFINE Main FOR gmfgen::GenStandardPreferencePage-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «getClassName()»«EXPAND extendsList»«EXPAND implementsList» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «getClassName()»() {
- setPreferenceStore(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
- «IF gmfgen::StandardPreferencePages::General = kind-»
- setPreferenceKey(«getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID);
- «ENDIF»
- }
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenStandardPreferencePage-»
-«IF gmfgen::StandardPreferencePages::General = kind-»
- extends org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage«-»
-«ELSEIF gmfgen::StandardPreferencePages::Appearance = kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage«-»
-«ELSEIF gmfgen::StandardPreferencePages::Connections = kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage«-»
-«ELSEIF gmfgen::StandardPreferencePages::Printing = kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage«-»
-«ELSEIF gmfgen::StandardPreferencePages::RulersAndGrid = kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage«-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenStandardPreferencePage»«REM»no-op«ENDREM»«ENDDEFINE»
-
-«DEFINE call_initDefaults(storeVarName : String) FOR gmfgen::GenStandardPreferencePage»«IF kind <> gmfgen::StandardPreferencePages::Pathmaps»«getQualifiedClassName()».initDefaults(«storeVarName»);«ENDIF»«ENDDEFINE»
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2e/2e21a91bffdf6c1e5226acf0b2eafa8deeee4275.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2e/2e21a91bffdf6c1e5226acf0b2eafa8deeee4275.svn-base
deleted file mode 100644
index fa85a2fcc7e..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/2e/2e21a91bffdf6c1e5226acf0b2eafa8deeee4275.svn-base
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2008 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Vincent Lorenzo (CEA-LIST) - Add templates to manage the display of the compartments in the preferences pages
- * Vincent Lorenzo (CEA-LIST) - bug 335987: [General][Enhancement] Show/Hide Connectors Labels https://bugs.eclipse.org/bugs/show_bug.cgi?id=335987
- * Vincent Lorenzo (CEA-LIST) - bug 342954: [Preferences] Add the possibility to define the visibility of the compartments using the GmfGen
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«DEFINE className FOR gmfgen::GenNode-»«IF "UNDEFINED" <> elementType.displayName.toUpper()-»«elementType.displayName-»«getPreferencePageSuffix()-»«ENDIF»
-«ENDDEFINE»
-
-«DEFINE compartmentsList FOR gmfgen::GenNode-»
- «FOREACH compartments AS cpt SEPARATOR ','-»
- "«cpt.title»"
- «ENDFOREACH-»
-«ENDDEFINE»
-
-«DEFINE NodePreferencePage FOR gmfgen::GenNode-»
-package «getDiagram().preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage {
-
- «IF compartments->size() <> 0-»
- «EXPAND xpt::Common::generatedClassComment»
- public static final String compartments[] ={«EXPAND compartmentsList»};
- «ENDIF»
-
- «EXPAND xpt::Common::generatedClassComment»
- public «EXPAND className»() {
- super();
- setPreferenceKey( «getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID+"_«elementType.displayName»");
- }
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getBundleId() {
- return «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».ID;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public static void initDefaults(org.eclipse.jface.preference.IPreferenceStore store) {
-
- String key = «getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID+"_«elementType.displayName»";
- store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(key, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.WIDTH),«defaultSizeWidth(self.viewmap, 40)»);
- store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(key, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.HEIGHT),«defaultSizeHeight(self.viewmap, 40)»);
-
- «IF compartments->size() <> 0-»
- java.util.Map<String, Boolean> map = getStaticCompartmentVisibilityPreferences();
- for(String name : map.keySet()){
- String preferenceName = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getLabelElementConstant(key, name, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
- store.setDefault(preferenceName, map.get(name));
- }
-
- map = getStaticCompartmentTitleVisibilityPreferences();
- for(String name : map.keySet()){
- String preferenceName = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getLabelElementConstant(key, name, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
- store.setDefault(preferenceName, map.get(name));
- }
- «ENDIF-»
-
- «REM» executed, only if the element has labels with defined role (using papyrusgmfgenextension::LabelVisibilityPreference) «ENDREM»
- «IF self.labels->exists(lbl : gmfgen::GenExternalNodeLabel | (papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl))->size()<>0))-»
- «IF compartments->size() <> 0-»
- map = getStaticLabelVisibilityPreferences();
- «ELSE»
- java.util.Map<String, Boolean> map = getStaticLabelVisibilityPreferences();
- «ENDIF»
- for(String role : map.keySet()){
- String preferenceName = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getLabelElementConstant(key, role, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.LABEL_VISIBILITY);
- store.setDefault(preferenceName, map.get(role));
- }
- «ENDIF-»
- «REM» end of the add for papyrusgmfgenextension::LabelVisibilityPreference «ENDREM»
-
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));
-
- // Set the default for the gradient
- //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
- // new org.eclipse.swt.graphics.RGB(255, 255, 255),
- // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
- //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
- «IF compartments->size() <> 0-»
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected void initializeCompartmentsList() {
- for(String name : compartments) {
- this.compartmentsList.add(name);
- }
- }
-
-
- «EXPAND xpt::Common::generatedClassComment»
- private static java.util.TreeMap<String,Boolean> getStaticCompartmentVisibilityPreferences(){
- java.util.TreeMap<String,Boolean> map = new java.util.TreeMap<String,Boolean>();
- «FOREACH compartments AS cpt-»
- «IF papyrusgmfgenextension::CompartmentVisibilityPreference.allInstances()->select(cptPref : papyrusgmfgenextension::CompartmentVisibilityPreference | cptPref.compartments->includes(cpt))->size()<>0-»
- «IF papyrusgmfgenextension::CompartmentVisibilityPreference.allInstances()->select(cptPref : papyrusgmfgenextension::CompartmentVisibilityPreference | cptPref.compartments->includes(cpt))->asSequence()->first().visibleByDefault=true-»
- map.put("«cpt.title»", Boolean.TRUE);
- «ELSE-»
- map.put("«cpt.title»", Boolean.FALSE);
- «ENDIF-»
- «ELSE-»
- map.put("«cpt.title»",Boolean.TRUE);
- «ENDIF-»
- «ENDFOREACH-»
- return map;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- private static java.util.TreeMap<String, Boolean> getStaticCompartmentTitleVisibilityPreferences(){
- java.util.TreeMap<String,Boolean> map = new java.util.TreeMap<String,Boolean>();
- «FOREACH compartments AS cpt-»
- «IF cpt.needsTitle-» «REM» we set in the map only the compartment which needs a title «ENDREM»
- «IF papyrusgmfgenextension::CompartmentTitleVisibilityPreference.allInstances()->select(cptPref : papyrusgmfgenextension::CompartmentTitleVisibilityPreference | cptPref.compartments->includes(cpt))->size()<>0-»
- «IF papyrusgmfgenextension::CompartmentTitleVisibilityPreference.allInstances()->select(cptPref : papyrusgmfgenextension::CompartmentTitleVisibilityPreference | cptPref.compartments->includes(cpt))->asSequence()->first().visibleByDefault=true-»
- map.put("«cpt.title»", Boolean.TRUE);
- «ELSE-»
- map.put("«cpt.title»", Boolean.FALSE);
- «ENDIF-»
- «ELSE-»
- map.put("«cpt.title»",Boolean.TRUE);
- «ENDIF-»
- «ENDIF-»
- «ENDFOREACH-»
- return map;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- protected java.util.TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
- return getStaticCompartmentTitleVisibilityPreferences();
- }
-
- «ENDIF-»
- «REM» executed, only if the element has labels with defined role (using papyrusgmfgenextension::LabelVisibilityPreference) «ENDREM»
- «IF self.labels->exists(lbl0 : gmfgen::GenExternalNodeLabel | (papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label0 : papyrusgmfgenextension::LabelVisibilityPreference | label0.externalNodeLabels->includes(lbl0))->size()<>0))-»
- «EXPAND xpt::Common::generatedClassComment»
- private static java.util.TreeMap<String,String> getStaticLabelRole(){
- java.util.TreeMap<String,String> map = new java.util.TreeMap<String, String>(new org.eclipse.papyrus.uml.diagram.common.util.StringComparator());
- «FOREACH labels AS lbl-»
- «IF lbl.oclIsKindOf(gmfgen::GenExternalNodeLabel)-»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl.oclAsType(gmfgen::GenExternalNodeLabel)))->size()<>0-»
- map.put(
- "«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl.oclAsType(gmfgen::GenExternalNodeLabel)))->asSequence()->first().role»"
- ,"«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl.oclAsType(gmfgen::GenExternalNodeLabel)))->asSequence()->first().iconPathRole»"
- );//$NON-NLS-1$
- «ENDIF-»
- «ENDIF-»
- «ENDFOREACH-»
- return map;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- private static java.util.TreeMap<String,Boolean> getStaticLabelVisibilityPreferences(){
- java.util.TreeMap<String,Boolean> map = new java.util.TreeMap<String,Boolean>();
- «FOREACH labels AS lbl-»
- «IF lbl.oclIsKindOf(gmfgen::GenExternalNodeLabel)-»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl.oclAsType(gmfgen::GenExternalNodeLabel)))->size()<>0-»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl.oclAsType(gmfgen::GenExternalNodeLabel)))->asSequence()->first().visibleByDefault=true-»
- map.put("«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl.oclAsType(gmfgen::GenExternalNodeLabel)))->asSequence()->first().role»"
- , Boolean.TRUE);
- «ELSE-»
- map.put("«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl.oclAsType(gmfgen::GenExternalNodeLabel)))->asSequence()->first().role»"
- , Boolean.FALSE);
- «ENDIF-»
- «ENDIF-»
- «ENDIF-»
- «ENDFOREACH-»
- return map;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- protected java.util.TreeMap<String,String> getLabelRole(){
- return getStaticLabelRole();
- }
- «ENDIF-»
- «REM» end of the code used to managed papyrusgmfgenextension::LabelVisibilityPreference«ENDREM»
-}
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/31/31089146ffe2d474f997a43b792a059cec62977c.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/31/31089146ffe2d474f997a43b792a059cec62977c.svn-base
deleted file mode 100644
index 147263ac179..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/31/31089146ffe2d474f997a43b792a059cec62977c.svn-base
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2008 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- * modified by Patrick Tessier(CEA LIST)
- */
-
-import org.eclipse.papyrus.codegen.utils.PapyrusGenConstants;
-
-modeltype genModel uses "http://www.eclipse.org/gmf/2009/GenModel";
-modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
-
-library PrefsConstant;
-
-helper getPreferenceConstantFileName() : String {
-return getIDiagramPreferenceConstantJavaClassName()
-}
-
-helper getDiagramPreferencePageFileName( diagramName: String) : String{
- return getDiagramPreferencePageJavaClassName(diagramName)
-}
-
-helper getDiagramPreferencePageCategory() : String{
- return "org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams"
-}
-
-helper getPreferenceConstant() : String{
-return "_PREF_"
-}
-
-helper getPreferenceGradientPolicyConstant(_element: String) : String{
-return _element + getPreferenceConstant() + "GRADIENT_POLICY"
-}
-
-helper getPreferenceGradientColorConstant(_element: String) : String{
-return _element + getPreferenceConstant() + "GRADIENT_COLOR"
-}
-
-helper getPreferenceFillColorConstant(_element: String ) : String{
-return _element + getPreferenceConstant() + "FILL_COLOR"
-}
-
-helper getPreferenceFontColorConstant(_element: String ) : String{
-return _element + getPreferenceConstant() + "FONT_COLOR"
-}
-
-helper getPreferenceFontConstant(_element: String ) : String{
-return _element + getPreferenceConstant() + "FONT"
-}
-
-helper getPreferenceLineColorConstant(_element: String ): String{
-return _element + getPreferenceConstant() + "LINE_COLOR"
-}
-
-helper getPreferenceJumpLinkConstant(): String{
-return getPreferenceConstant() + "JUMPLINK_"
-}
-
-helper getPreferenceJumpLinkReverseConstant(_element: String ): String{
-return _element + getPreferenceJumpLinkConstant() + "REVERSE"
-}
-
-helper getPreferenceJumpLinkStatusConstant(_element: String ): String{
-return _element + getPreferenceJumpLinkConstant() + "STATUS"
-}
-
-helper getPreferenceJumpLinkTypeConstant(_element: String ): String{
-return _element + getPreferenceJumpLinkConstant() + "TYPE"
-}
-
-helper getPreferenceRoutingConstant(): String{
-return getPreferenceConstant() + "ROUTING_"
-}
-
-helper getPreferenceRoutingDistancePolicyConstant(_element: String ): String{
-return _element + getPreferenceRoutingConstant() + "DISTANCE_POLICY"
-}
-
-helper getPreferenceRoutingObstructionPolicyConstant(_element: String ): String{
-return _element + getPreferenceRoutingConstant() + "OBSTRUCTION_POLICY"
-}
-
-helper getPreferenceRoutingStyleConstant(_element: String ): String{
-return _element + getPreferenceRoutingConstant() + "STYLE"
-}
-
-helper getPreferenceSmoothnessConstant(_element: String ): String{
-return _element + getPreferenceConstant() + "SMOOTHNESS"
-}
-
-helper getPreferencePageSuffix(): String{
-return "PreferencePage"
-} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/37/37265057354d3b1013c3956ca12fa87f769c170c.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/37/37265057354d3b1013c3956ca12fa87f769c170c.svn-base
deleted file mode 100644
index 5a61f9bdca7..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/37/37265057354d3b1013c3956ca12fa87f769c170c.svn-base
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 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:
- * Yann Tanguy (CEA LIST) - initial API and implementation
- *
- */
-
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2009/GenModel";
-modeltype papyrusgmfgenextension uses "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension";
-
-library EditPartsUtils;
-
-helper gmfgen::GenExternalNodeLabel::hasSpecificLocator() : Boolean {
- return (papyrusgmfgenextension::SpecificLocatorExternalLabel.allInstances()
- ->select(loc : papyrusgmfgenextension::SpecificLocatorExternalLabel
- | loc.genExternalNodeLabel->includes(self))
- ->size() <> 0);
-}
-
-helper gmfgen::GenExternalNodeLabel::getSpecificLocator() : String {
- if self.hasSpecificLocator() then {
- return papyrusgmfgenextension::SpecificLocatorExternalLabel.allInstances()
- ->select(loc : papyrusgmfgenextension::SpecificLocatorExternalLabel
- | loc.genExternalNodeLabel->includes(self))
- ->asSequence()->first().classpath
- } endif;
-
- return null;
-}
-
-helper gmfgen::GenNode::getExternalLabelsWithoutSpecificLocator() : Sequence(gmfgen::GenExternalNodeLabel) {
- return (self.labels)[gmfgen::GenExternalNodeLabel]
- ->select(l : gmfgen::GenExternalNodeLabel
- | not l.hasSpecificLocator())
- ->asSequence();
-}
-
-helper gmfgen::GenNode::getExternalLabelsWithSpecificLocator() : Sequence(gmfgen::GenExternalNodeLabel) {
- return (self.labels)[gmfgen::GenExternalNodeLabel]
- ->select(l : gmfgen::GenExternalNodeLabel
- | l.hasSpecificLocator())
- ->asSequence();
-}
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/37/37841dfdbe51c0c3f1757e2cd73552d56fcc9d1d.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/37/37841dfdbe51c0c3f1757e2cd73552d56fcc9d1d.svn-base
deleted file mode 100644
index d14b383d5c1..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/37/37841dfdbe51c0c3f1757e2cd73552d56fcc9d1d.svn-base
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * modified by Patrick Tessier (CEA LIST)
- */
-
-«REM»Documentation: PapyrusGenCode«ENDREM»
-«REM»This template has been modified in order to remove canonical ediPolicies«ENDREM»
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::StringOperations»
-«EXTENSION xpt::editor::Utils»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-«EXTENSION xpt::expressions::ValueExpression»
-
-
-«DEFINE visualIDConstant FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static final int VISUAL_ID = «visualID»;
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::GenCommonBase-»
- «EXPAND behaviour FOREACH behaviour-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::Behaviour-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::CustomBehaviour-»
-«IF editPolicyQualifiedClassName = null or editPolicyQualifiedClassName.trim().length() = 0-»
- removeEditPolicy(«key»); «IF key.startsWith('\"') and key.xpandEndsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ELSE-»
- installEditPolicy(«key», new «getEditPolicyQualifiedClassName()»()); «IF key.startsWith('\"') and key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::OpenDiagramBehaviour-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.OPEN_ROLE,
- new «getEditPolicyQualifiedClassName()»());
-«ENDDEFINE»
-
-«DEFINE labelFigure FOR gmfgen::ParentAssignedViewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- // Parent should assign one using «EXPAND impl::diagram::editparts::TextAware::labelSetterName»() method
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE labelFigure FOR gmfgen::Viewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- org.eclipse.draw2d.IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigurePrim() {
- «EXPAND labelFigurePrim FOR self-»
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::FigureViewmap-»
-«IF figureQualifiedClassName = null-»
- return new org.eclipse.draw2d.Label();
-«ELSE-»
- return new «figureQualifiedClassName»();
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::SnippetViewmap-»
- return «body»;
- }
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::InnerClassViewmap-»
- return new «className»();
- }
-
- «classBody»
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::Viewmap-»
- «ERROR 'Unknown viewmap: ' + self.repr()-»
- }
-«ENDDEFINE»
-
-«DEFINE notationalListeners FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); «EXPAND xpt::Common::nonNLS»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); «EXPAND xpt::Common::nonNLS»
- }
-«ENDDEFINE»
-
-«DEFINE handleBounds FOR gmfgen::GenCommonBase-»
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
- refreshBounds();
- }
-«ENDDEFINE»
-
-«DEFINE handleText FOR gmfgen::GenCommonBase-»
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry.getInstance().getColor(c));
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
- org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser modelParser =
- (org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE installSemanticEditPolicy FOR gmfgen::GenCommonBase-»
- «IF sansDomain-»
-removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE);
- «ELSE-»
-installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «getItemSemanticEditPolicyQualifiedClassName()»());
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE installCanonicalEditPolicy FOR gmfgen::GenContainerBase-»
- «IF needsCanonicalEditPolicy()-»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM»Used to remove at each time canonical editpolicies«ENDREM»
-//in Papyrus diagrams are not strongly synchronised
-//installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»());
- «REM»END: PapyrusGenCode«ENDREM»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE installCreationEditPolicy FOR gmfgen::GenCommonBase-»
-installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, «EXPAND _creationEditPolicyNewInstance»);
-«ENDDEFINE»
-«DEFINE _creationEditPolicyNewInstance FOR gmfgen::GenCommonBase-»
-new org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy()«-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/3a/3ab04d9cd1002ef66c46e9082cae89d5c4b8613d.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/3a/3ab04d9cd1002ef66c46e9082cae89d5c4b8613d.svn-base
deleted file mode 100644
index 6b98eb20d0b..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/3a/3ab04d9cd1002ef66c46e9082cae89d5c4b8613d.svn-base
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::editparts::Utils»
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»Dthis template changes only the redefine the superclass and add code to manage the size the and the refresh visual «ENDREM»
-
-
-«AROUND extendsList FOR gmfgen::GenCompartment-»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Add own extension«ENDREM»
-«IF papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null)->size()<>0»
- extends «FOREACH papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null) AS extendedObject»«EXPAND specifyInheritance FOR extendedObject»«ENDFOREACH-»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-«ELSE»
- «targetDef.proceed()»
-«ENDIF»
-«ENDAROUND»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»definition of the inheritance «ENDREM»
-«DEFINE specifyInheritance FOR papyrusgmfgenextension::ExtendedGenView-»«superOwnedEditPart»«ENDDEFINE»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-«AROUND additions FOR gmfgen::GenCompartment»
- «EXPAND handleSize-»
- «EXPAND refreshbound-»
- «EXPAND refreshvisual-»
-«ENDAROUND»
-
-«DEFINE handleSize FOR gmfgen::GenCompartment»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification notification) {
- Object feature = notification.getFeature();
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
- refreshBounds();
- }
- super.handleNotificationEvent(notification);
- }
-«ENDDEFINE»
-«DEFINE refreshbound FOR gmfgen::GenCompartment»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshBounds() {
- int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
- org.eclipse.draw2d.geometry.Dimension size = new org.eclipse.draw2d.geometry.Dimension(width, height);
- int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- org.eclipse.draw2d.geometry.Point loc = new org.eclipse.draw2d.geometry.Point(x, y);
- ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(
- this,
- getFigure(),
- new org.eclipse.draw2d.geometry.Rectangle(loc, size));
- }
-«ENDDEFINE»
-«DEFINE refreshvisual FOR gmfgen::GenCompartment»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void refreshVisuals() {
- super.refreshVisuals();
- refreshBounds();
- }
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/3b/3b15b134252e65b9ae730a9c2ccddda21593145e.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/3b/3b15b134252e65b9ae730a9c2ccddda21593145e.svn-base
deleted file mode 100644
index 2a4787cc31e..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/3b/3b15b134252e65b9ae730a9c2ccddda21593145e.svn-base
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2009 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-
-«AROUND handleNotificationEventBody FOR gmfgen::GenNodeLabel-»
- Object feature = event.getFeature();
- «IF isStoringChildPositions(node)-»
- «EXPAND xpt::diagram::editparts::Common::handleBounds FOR self-»
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::handleText FOR self-»
- «REM»START Papyrus Code«ENDREM»
- «IF elementIcon-»
- if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
- refreshLabel();
- }
- «ENDIF-»
- «REM»End Papyrus Code«ENDREM»
- super.handleNotificationEvent(event);
-«ENDAROUND» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/44/44d8eb69ff7c5ae90080409b844c61650d1ae571.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/44/44d8eb69ff7c5ae90080409b844c61650d1ae571.svn-base
deleted file mode 100644
index 866c6054943..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/44/44d8eb69ff7c5ae90080409b844c61650d1ae571.svn-base
+++ /dev/null
@@ -1,50 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-
-
-«REM» Command for the EditPart which use the Delete Service «ENDREM»
- «DEFINE getDestroyElementCommandByService FOR gmfgen::GenNode-»
- protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- org.eclipse.emf.ecore.EObject selectedEObject = req.getElementToDestroy();
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if(provider != null) {
- // Retrieve delete command from the Element Edit service
- org.eclipse.gmf.runtime.common.core.command.ICommand deleteCommand = provider.getEditCommand(req);
-
- if(deleteCommand != null) {
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(deleteCommand);
- }
- }
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- «ENDDEFINE»
-
- «DEFINE getDestroyElementCommandByService FOR gmfgen::TypeLinkModelFacet-»
- protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- org.eclipse.emf.ecore.EObject selectedEObject = req.getElementToDestroy();
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if(provider != null) {
- // Retrieve delete command from the Element Edit service
- org.eclipse.gmf.runtime.common.core.command.ICommand deleteCommand = provider.getEditCommand(req);
-
- if(deleteCommand != null) {
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(deleteCommand);
- }
- }
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- «ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/45/45b4f589d4f287bde7e42cf3de1ee46706345d9f.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/45/45b4f589d4f287bde7e42cf3de1ee46706345d9f.svn-base
deleted file mode 100644
index 5663d5d1a43..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/45/45b4f589d4f287bde7e42cf3de1ee46706345d9f.svn-base
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2007 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Emilien Perico (Atos Origin) - update template from ext to qvto for GMF 2.2 compliance
- */
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2009/GenModel";
-
-library ViewInfoUtils;
-
-
-helper diagramViewInfoGetterName(diagram : gmfgen::GenDiagram) : String {
- return cleanString("get"+diagram.domainDiagramElement.ecoreClass.name+"_"+diagram.visualID.toString()+"ViewInfo")
-}
-
-helper nodeViewInfoGetterName(node : gmfgen::GenNode) : String {
- return cleanString("get"+node.modelFacet.metaClass.ecoreClass.name+"_"+node.visualID.toString()+"ViewInfo")
-}
-
-helper nodeViewInfoGetterName(compartment : gmfgen::GenCompartment) : String {
- return cleanString("get"+compartment.title+"_"+compartment.visualID.toString()+"ViewInfo")
-}
-
-helper linkViewInfoGetterName(link : gmfgen::GenLink) : String {
- return cleanString("get"+linkEClass(link.modelFacet)+"_"+link.visualID.toString()+"ViewInfo")
-}
-
-helper linkEClass(facet : gmfgen::TypeModelFacet) : String {
- return cleanString(facet.metaClass.ecoreClass.name)
-}
-
-helper linkEClass(facet : gmfgen::ModelFacet) : String {
- return ""
-}
-
-helper featureForLinkGetter(facet : gmfgen::ModelFacet) : String {
- return ""
-}
-
-helper featureForLinkGetter(facet : gmfgen::FeatureLinkModelFacet) : String {
- return cleanString(facet.metaFeature.ecoreFeature.name)
-}
-
-helper cleanString(string : String) : String {
- return string.replace(" ", "_")
-}
-
-helper getContainerVidualID(node : gmfgen::GenNode) : String {
- return node.visualID.toString()
-}
-
-helper getContainerVidualID(compartment : gmfgen::GenCompartment) : String {
- return compartment.node.visualID.toString()
-}
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/46/46028ee590e03ed6ac3fad67d507fa0979b9c615.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/46/46028ee590e03ed6ac3fad67d507fa0979b9c615.svn-base
deleted file mode 100644
index df7c608b754..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/46/46028ee590e03ed6ac3fad67d507fa0979b9c615.svn-base
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2006, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * modified by Patrick Tessier (CEA LIST)
- */
-
-
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»This template has been modify to allow the drag and drop«ENDREM»
-
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»computes super type of the link edit part in case the edit part manages a representation of a UML element«ENDREM»
-«DEFINE extendsListContents FOR gmfgen::GenDiagram-»
-org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart
-«ENDDEFINE»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-
-«DEFINE _constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenDiagram-»
- super.createDefaultEditPolicies();
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy());
- installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy());
-
- «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
- «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
-
- «IF generateCreateShortcutAction() and null = editorGen.application-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy() {
- public org.eclipse.gef.commands.Command getDropObjectsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest) {
- «EXPAND CodeStyle::newGenericInstance('viewDescriptors', 'java.util.ArrayList', 'org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor')»();
- for («EXPAND CodeStyle::G('java.util.Iterator', '?')» it = dropRequest.getObjects().iterator(); it.hasNext();) {
- Object nextObject = it.next();
- if (false == nextObject instanceof org.eclipse.emf.ecore.EObject) {
- continue;
- }
- viewDescriptors.add(new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter((org.eclipse.emf.ecore.EObject) nextObject), org.eclipse.gmf.runtime.notation.Node.class, null, getDiagramPreferencesHint()));
- }
- return createShortcutsCommand(dropRequest, viewDescriptors);
- }
-
- private org.eclipse.gef.commands.Command createShortcutsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest, «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor')» viewDescriptors) {
- org.eclipse.gef.commands.Command command = createViewsAndArrangeCommand(dropRequest, viewDescriptors);
- if (command != null) {
- return command.chain(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new «getCreateShortcutDecorationsCommandQualifiedClassName()»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors)));
- }
- return null;
- }
- });
- «ENDIF-»
- «IF shouldGenerateDiagramViewmap(self)-»
- // diagram figure does layout; need to install child editpolicy to show selection feedback
- installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
- final org.eclipse.gef.editpolicies.NonResizableEditPolicy p = new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
- p.setDragAllowed(false);
- return p;
- }
- protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
- return null;
- }
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
- return null;
- }
- });
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
-«ENDDEFINE»
-
-«DEFINE createFigure FOR gmfgen::GenDiagram-»
- «IF shouldGenerateDiagramViewmap(self)-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- org.eclipse.draw2d.FreeformLayer l = new org.eclipse.draw2d.FreeformLayer();
- l.setBorder(new org.eclipse.draw2d.MarginBorder(50));
- «EXPAND initLayout('lm') FOR viewmap.layoutType-»
- l.setLayoutManager(lm);
- return l;
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE initLayout(varName : String) FOR gmfgen::ViewmapLayoutType-»
- «IF self = gmfgen::ViewmapLayoutType::TOOLBAR_LAYOUT-»
- org.eclipse.draw2d.ToolbarLayout «varName» = new org.eclipse.draw2d.ToolbarLayout();
- «varName».setSpacing(10);
- «ELSEIF self = gmfgen::ViewmapLayoutType::FLOW_LAYOUT-»
- org.eclipse.draw2d.FlowLayout «varName» = new org.eclipse.draw2d.FlowLayout();
- «varName».setMajorSpacing(10);
- «varName».setMinorSpacing(10);
- «ELSE-»
- org.eclipse.draw2d.LayoutManager «varName» = null; /*FIXME - unknown layout type*/
- «ENDIF-»
-«ENDDEFINE»
-
-
-
-
-«DEFINE featureForMetaclass FOR gmfgen::GenNode-»
- if («EXPAND MetaModel::MetaClass FOR modelFacet.metaClass».equals(class1)) {
- return «EXPAND MetaModel::MetaFeature FOR modelFacet.containmentMetaFeature»;
- }
-«ENDDEFINE»
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/48/482dcd50cfd3c6948675bc4c63516e5a13796c02.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/48/482dcd50cfd3c6948675bc4c63516e5a13796c02.svn-base
deleted file mode 100644
index 164ecc93f2e..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/48/482dcd50cfd3c6948675bc4c63516e5a13796c02.svn-base
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION MetaModel»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::EMFUtils»
-«EXTENSION xpt::mutatingUtils»
-«REM» [Mutating] new getCreatecommand with an element switch «ENDREM»
-«AROUND DiagramItemSemanticEditPolicy FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «editPoliciesPackageName»;
- «EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «getBaseItemSemanticEditPolicyQualifiedClassName()» {
- «EXPAND childMutatingContainerCreateCommand FOR self-»
- «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
-
-
- «EXPAND getDuplicateCommand-»
-
- «EXPAND DuplicateAnythingCommand-»
-
- «EXPAND additions-»
-}
-«ENDAROUND»
-«REM» Mutating canvas create commands «ENDREM»
-«DEFINE childMutatingContainerCreateCommand FOR gmfgen::GenDiagram»
- «IF not self.topLevelNodes->isEmpty()-»
- «EXPAND createMutatingSwitch FOR self»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- «REM»fjcano:: we set a parameter in the request to pass the Diagram «ENDREM»
- org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil.findDiagramFromEditPart(getHost());
- if (diagram != null) {
- req.getParameters().put(MultiDiagramUtil.BelongToDiagramSource, diagram);
- }
- org.eclipse.emf.ecore.EObject canvasElement = org.eclipse.papyrus.uml.diagram.common.part.DiagramCanvasSwitch.getCanvasElement(this);
- if (canvasElement == null) {
- return null;
- }
- aSwitch.setInfo(req.getElementType());
- req.setContainmentFeature(aSwitch.doSwitch(canvasElement));
- «EXPAND childNodeCreateCommand FOREACH topLevelNodes-»
- return super.getCreateCommand(req);
- }
- «ENDIF-»
-«ENDDEFINE»
-«DEFINE childNodeCreateCommand FOR gmfgen::GenNode-»
- «EXPAND childNodeCreateCommand(self) FOR modelFacet-»
-«ENDDEFINE»
-«DEFINE childNodeCreateCommand(gmfgen::GenNode node) FOR gmfgen::TypeModelFacet-»
- if («node.getDiagram().getElementTypesQualifiedClassName()».«node.getUniqueIdentifier()» == req.getElementType()) {
- return getGEFWrapper(«node.getCreateCommandQualifiedClassName()».create(req, canvasElement));
- }
-«ENDDEFINE»
-«REM» Mutating canvas Switch to create command «ENDREM»
-«DEFINE createMutatingSwitch FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- static class EReferenceDiagramSwitch extends org.eclipse.papyrus.uml.diagram.common.util.BasicEcoreSwitch<org.eclipse.emf.ecore.EReference, org.eclipse.gmf.runtime.emf.type.core.IElementType> {
- @Override
- public org.eclipse.emf.ecore.EReference doSwitch(org.eclipse.emf.ecore.EObject modelElement) {
- «REM»getInfo provides the View«ENDREM»
- final org.eclipse.gmf.runtime.emf.type.core.IElementType type = getInfo();
- if (type == null) {
- return null;
- }
- «getModelSwitchQualifiedName(domainDiagramElement)»<org.eclipse.emf.ecore.EReference> aSwitch = new «getModelSwitchQualifiedName(domainDiagramElement)»<org.eclipse.emf.ecore.EReference>() {
- @Override
- public org.eclipse.emf.ecore.EReference case«domainDiagramElement.ecoreClass.name»(«getQualifiedInterfaceName(domainDiagramElement)» modelElement) {
- org.eclipse.emf.ecore.EReference reference = null;
- «FOREACH topLevelNodes AS node-»
- if (type.equals(«node.getDiagram().getElementTypesQualifiedClassName()».«node.getUniqueIdentifier()»)) {
- reference = «EXPAND MetaModel::MetaFeature FOR node.modelFacet.containmentMetaFeature»;
- }
- «ENDFOREACH-»
- return reference;
- }
- «FOREACH getReferencingObjects().typeSelect(AlternateCanvas) AS referencer»
- @Override
- public org.eclipse.emf.ecore.EReference case«referencer.domainDiagramElement.ecoreClass.name»(«getQualifiedInterfaceName(referencer.domainDiagramElement)» modelElement) {
- org.eclipse.emf.ecore.EReference reference = null;
- «FOREACH referencer.alternateTopLevelNodes AS node-»
- if (type.equals(«node.genTopLevelNode.getDiagram().getElementTypesQualifiedClassName()».«node.genTopLevelNode.getUniqueIdentifier()»)) {
- reference = «EXPAND MetaModel::MetaFeature FOR node.typeModelFacet.containmentMetaFeature-»;
- }
- «ENDFOREACH-»
- return reference;
- }
- «ENDFOREACH-»
- };
-
- return aSwitch.doSwitch(modelElement);
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private EReferenceDiagramSwitch aSwitch = new EReferenceDiagramSwitch();
-«ENDDEFINE»
-«DEFINE getDuplicateCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- org.eclipse.gmf.runtime.notation.Diagram currentDiagram = null;
- if(getHost()instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) {
- currentDiagram = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)getHost()).getNotationView().getDiagram();
- }
- return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req, currentDiagram));
-}
-«ENDDEFINE»
-«DEFINE DuplicateAnythingCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private static class DuplicateAnythingCommand extends org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand {
-«EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.gmf.runtime.notation.Diagram diagram;
- «EXPAND DAC_constructor-»
- «EXPAND DAC_additions-»
-}
-«ENDDEFINE»
-«DEFINE DAC_constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public DuplicateAnythingCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req,org.eclipse.gmf.runtime.notation.Diagram currentDiagram) {
- super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap(),currentDiagram);
-this.diagram = currentDiagram;
-}
-«ENDDEFINE»
-«DEFINE DAC_additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/4c/4c90bfbed3b973467ca8415363f8dc0879eb5a80.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/4c/4c90bfbed3b973467ca8415363f8dc0879eb5a80.svn-base
deleted file mode 100644
index aaecdf9e48a..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/4c/4c90bfbed3b973467ca8415363f8dc0879eb5a80.svn-base
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Artem Tikhomirov (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::editor::palette::Utils»
-
-«DEFINE Factory FOR gmfgen::Palette»
-«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter {
-
-«REM»RS: New Palette generation«ENDREM»
-
-«REM» Generates the ID for the tool elements«ENDREM»
-«REM» Generate the tool factory (if(ID) createtool...)«ENDREM»
-«EXPAND generateIDAttribute FOREACH collectTools(self)»
-
-«REM» Generates the default constructor«ENDREM»
-«EXPAND xpt::Common::generatedMemberComment»
- public «factoryClassName»() {
-
- }
-
-«REM» Generates the main method to create tool«ENDREM»
-«EXPAND generateCreateTool»
-
-«REM» Generates the main method to create template«ENDREM»
-«EXPAND generateGetTemplate»
-
-«REM» Generates each method for tool creation«ENDREM»
-«EXPAND createTool FOREACH collectTools(self)»
-
-}
-«ENDDEFINE»
-
-«DEFINE generateCreateTool FOR gmfgen::Palette»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.Tool createTool(String toolId) {
- «EXPAND checkToolID FOREACH collectTools(self)»
- // default return: null
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE checkToolID FOR gmfgen::AbstractToolEntry-»
- if (toolId.equals(«id.getConstantIDName()»)) {
- return «createMethodName»();
- }
-«ENDDEFINE»
-
-
-«DEFINE generateGetTemplate FOR gmfgen::Palette»
- «EXPAND xpt::Common::generatedMemberComment»
- public Object getTemplate(String templateId) {
-
- // default return: null
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE generateIDAttribute FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private final static String «id.getConstantIDName()» = «id»;«IF id.isQuoted('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDDEFINE»
-
-
-«DEFINE createTool FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.Tool «createMethodName»() {
- «EXPAND newTool('entry')-»
- }
-«ENDDEFINE»
-
-«DEFINE newTool(toolVarName : String) FOR gmfgen::ToolEntry-»
- «IF elements->isEmpty()-»
- «ERROR 'no elements for tool generation (Palette)'»
- «ELSE-»
- java.util.List<org.eclipse.gmf.runtime.emf.type.core.IElementType> types = new java.util.ArrayList<org.eclipse.gmf.runtime.emf.type.core.IElementType>(«elements->size()»);
- «FOREACH elements->asSequence() AS e-»
- types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR e»);
- «ENDFOREACH-»
- «REM»RS: modified tool creation to have stereotypes-aware tools«ENDREM»
- org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF self.genNodes->isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types);
- return tool;
- «ENDIF-»
-«ENDDEFINE»
-
-
-
-
-
-«REM»RS: Old Palette generation
-«EXPAND createGroup FOREACH collectGroups(self)»
-«EXPAND createEntry FOREACH collectTools(self)»
-
-«IF needsNodeToolEntryClass(self)»«EXPAND nodeToolEntry»«ENDIF-»
-«IF needsLinkToolEntryClass(self)»«EXPAND linkToolEntry»«ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE generateIDAttribute FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private final static String «id.getConstantIDName()» = «id»;«IF id.isQuoted('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDDEFINE»
-
-«DEFINE createGroup FOR gmfgen::ToolGroup-»
- «EXPAND xpt::Common::generatedMemberComment('Creates \"' + title + '\" palette tool group')»
- private org.eclipse.gef.palette.PaletteContainer «createMethodName»() {
- «EXPAND newContainer('paletteContainer')-»
- «EXPAND setIdentity('paletteContainer')-»
- «EXPAND setDescription('paletteContainer', self) FOR description-»
- «EXPAND setSmallImage('paletteContainer', palette)-»
- «EXPAND setLargeImage('paletteContainer', palette)-»
- «EXPAND addEntry('paletteContainer') FOREACH entries-»
- return paletteContainer;
- }
-«ENDDEFINE»
-
-«DEFINE newContainer(varName : String) FOR gmfgen::ToolGroup-»
-«IF collapse and toolsOnly-»
- org.eclipse.gef.palette.PaletteDrawer «varName» = new org.eclipse.gef.palette.PaletteDrawer(«EXPAND i18nTitle»);
-«ELSEIF stack-»
- org.eclipse.gef.palette.PaletteStack «varName» = new org.eclipse.gef.palette.PaletteStack(«EXPAND i18nTitle», null, null);
-«ELSE-»
- org.eclipse.gef.palette.PaletteGroup «varName» = new org.eclipse.gef.palette.PaletteGroup(«EXPAND i18nTitle»);
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setDescription(varName : String, gr : gmfgen::ToolGroup) FOR String-»
-«varName».setDescription(«EXPAND i18nDesc FOR gr»);
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::ToolGroupItem»
-«ERROR 'abstract addEntry(ToolGroupItem,String) template'»
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::AbstractToolEntry-»
-«varName».add(«createMethodName»());
-«IF _default and group.stack-»
-«varName».setActiveEntry((org.eclipse.gef.palette.ToolEntry) paletteContainer.getChildren().get(paletteContainer.getChildren().size() - 1));
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::Separator-»
-«varName».add(new org.eclipse.gef.palette.PaletteSeparator());
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::ToolGroup-»
-«varName».add(«createMethodName»());
-«ENDDEFINE»
-
-«DEFINE createEntry FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.palette.ToolEntry «createMethodName»() {
- «EXPAND newEntry('entry')-»
- «EXPAND setIdentity('entry')-»
- «EXPAND setSmallImage('entry', group.palette)-»
- «EXPAND setLargeImage('entry', group.palette)-»
- «EXPAND setToolClass('entry')-»
- «EXPAND setToolProperty('entry') FOREACH properties-»
- return entry;
- }
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::AbstractToolEntry-»
-«ERROR 'abstract newEntry(AbstractToolEntry,String) template'»
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::ToolEntry-»
-«IF elements->isEmpty()-»
-org.eclipse.gef.palette.ToolEntry «toolVarName» = new org.eclipse.gef.palette.ToolEntry(«EXPAND i18nTitle», «EXPAND i18nDesc», null, null) {};
-«ELSE-»
-«LET (if genNodes->isEmpty() then 'LinkToolEntry' else 'NodeToolEntry' endif) AS toolEntryClass-»
-java.util.List/*<IElementType>*/ types = new java.util.ArrayList/*<IElementType>*/(«elements->size()»);
-«FOREACH elements->asSequence() AS e-»
-types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR e»);
-«ENDFOREACH-»
-«toolEntryClass» «toolVarName» = new «toolEntryClass»(«EXPAND i18nTitle», «EXPAND i18nDesc», types);
-«ENDLET-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-«IF gmfgen::StandardEntryKind::SELECT = kind -»
-«EXPAND newStdSelectEntry(toolVarName)-»
-«ELSEIF kind = gmfgen::StandardEntryKind::MARQUEE-»
-«EXPAND newStdMarqueeEntry(toolVarName)-»
-«ELSEIF kind = gmfgen::StandardEntryKind::ZOOM-»
-«EXPAND newStdZoomEntry(toolVarName)-»
-«ELSE-»
-«EXPAND newStdOtherEntry(toolVarName)-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE newStdSelectEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-org.eclipse.gef.palette.PanningSelectionToolEntry «toolVarName» = new org.eclipse.gef.palette.PanningSelectionToolEntry();
-«ENDDEFINE»
-
-«DEFINE newStdMarqueeEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-org.eclipse.gef.palette.MarqueeToolEntry «toolVarName» = new org.eclipse.gef.palette.MarqueeToolEntry();
-«ENDDEFINE»
-
-«DEFINE newStdZoomEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-FIXME
-«ENDDEFINE»
-
-«DEFINE newStdOtherEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-«ERROR 'override newStdOtherEntry(StandardEntry, String) for kind ' + kind.repr()»
-«ENDDEFINE»
-
-// FIXME: odd code - FOR EntryBase, while most of the template is valid for ToolEntry only!!!
-«DEFINE setSmallImage(toolVarName : String, palette : gmfgen::Palette) FOR gmfgen::EntryBase-»
-«IF null <> smallIconPath-»
-«toolVarName».setSmallIcon(«palette.activatorFQN()».findImageDescriptor("«smallIconPath»"));«EXPAND xpt::Common::nonNLS»
-«ELSEIF not (Sequence { self })[gmfgen::ToolEntry].elements->isEmpty()-»
-«LET self.oclAsType(gmfgen::ToolEntry) AS toolEntry-»
-«toolVarName».setSmallIcon(«palette.diagram.getElementTypesQualifiedClassName()».getImageDescriptor(«EXPAND xpt::providers::ElementTypes::accessElementType FOR toolEntry.elements->first().oclAsType(gmfgen::GenCommonBase)»));
-«ENDLET-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setLargeImage(toolVarName : String, palette : gmfgen::Palette) FOR gmfgen::EntryBase-»
-«IF null <> largeIconPath-»
-«toolVarName».setLargeIcon(«palette.activatorFQN()».findImageDescriptor("«largeIconPath»")); «EXPAND xpt::Common::nonNLS»
-«ELSEIF not (Sequence { self })[gmfgen::ToolEntry].elements->isEmpty()-»
-«toolVarName».setLargeIcon(«toolVarName».getSmallIcon());
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setToolClass(toolVarName : String) FOR gmfgen::AbstractToolEntry-»
-«IF null <> qualifiedToolName-»
-«toolVarName».setToolClass(«qualifiedToolName».class);
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setToolProperty(toolVarName : String) FOR ecore::EStringToStringMapEntry-»
-«toolVarName».setToolProperty(«key», «value»);
-«ENDDEFINE»
-
-«DEFINE i18nTitle FOR gmfgen::ToolEntry-»
-«IF title = null»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nTitleKey(self)) FOR group.palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nTitle FOR gmfgen::ToolGroup-»
-«IF title = null»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nTitleKey(self)) FOR palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nDesc FOR gmfgen::ToolEntry-»
-«IF null = description»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nDescKey(self)) FOR group.palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nDesc FOR gmfgen::ToolGroup-»
-«IF null = description»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nDescKey(self)) FOR palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::Palette-»
-«EXPAND internal_i18n_accessors FOREACH collectGroups(self)-»
-«EXPAND internal_i18n_accessors FOREACH collectTools(self)-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::Palette-»
-«EXPAND internal_i18n_values FOREACH collectGroups(self)-»
-«EXPAND internal_i18n_values FOREACH collectTools(self)-»
-«ENDDEFINE»
-
-«DEFINE internal_i18n_accessors FOR gmfgen::EntryBase-»
-«IF null <> title»«EXPAND xpt::Externalizer::accessorField(i18nTitleKey(self))»«ENDIF-»
-«IF null <> description»«EXPAND xpt::Externalizer::accessorField(i18nDescKey(self))»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE internal_i18n_values FOR gmfgen::EntryBase-»
-«IF null <> title»«EXPAND xpt::Externalizer::messageEntry(i18nTitleKey(self), title)»«ENDIF-»
-«IF null <> description»«EXPAND xpt::Externalizer::messageEntry(i18nDescKey(self), description)»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE cleanStandardToolsHack FOR gmfgen::Palette»
- «EXPAND xpt::Common::generatedMemberComment('Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=159289')»
- private void cleanStandardTools(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
- for (java.util.Iterator it = paletteRoot.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gef.palette.PaletteEntry entry = (org.eclipse.gef.palette.PaletteEntry) it.next();
- if (!"standardGroup".equals(entry.getId())) { «EXPAND xpt::Common::nonNLS»
- continue;
- }
- for (java.util.Iterator it2 = ((org.eclipse.gef.palette.PaletteContainer) entry).getChildren().iterator(); it2.hasNext();) {
- org.eclipse.gef.palette.PaletteEntry entry2 = (org.eclipse.gef.palette.PaletteEntry) it2.next();
- if ("zoomTool".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- } else if ("noteStack".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- } else if ("selectionTool".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- }
- if (paletteRoot.getDefaultEntry() == entry2) {
- paletteRoot.setDefaultEntry(null);
- }
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE nodeToolEntry FOR OclAny»
- «EXPAND xpt::Common::generatedClassComment»
- private static class NodeToolEntry extends org.eclipse.gef.palette.ToolEntry {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final java.util.List elementTypes;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private NodeToolEntry(String title, String description, java.util.List elementTypes) {
- super(title, description, null, null);
- this.elementTypes = elementTypes;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.Tool createTool() {
- org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool(elementTypes);
- tool.setProperties(getToolProperties());
- return tool;
- }
- }
-«ENDDEFINE»
-
-«DEFINE linkToolEntry FOR OclAny»
- «EXPAND xpt::Common::generatedClassComment»
- private static class LinkToolEntry extends org.eclipse.gef.palette.ToolEntry {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final java.util.List relationshipTypes;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private LinkToolEntry(String title, String description, java.util.List relationshipTypes) {
- super(title, description, null, null);
- this.relationshipTypes = relationshipTypes;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.Tool createTool() {
- org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool(relationshipTypes);
- tool.setProperties(getToolProperties());
- return tool;
- }
- }
-«ENDDEFINE»
-
-«DEFINE setIdentity(toolVarName : String) FOR gmfgen::EntryBase-»
-«IF id <> null and id.size() != 0-»
- «toolVarName».setId(«id»);«IF id.isQuoted('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDIF-»
-«ENDDEFINE»
-«ENDREM» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/4c/4cb57098ba5d9aff9247403ad73f5219093c880e.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/4c/4cb57098ba5d9aff9247403ad73f5219093c880e.svn-base
deleted file mode 100644
index 3ee0d445d08..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/4c/4cb57098ba5d9aff9247403ad73f5219093c880e.svn-base
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-«REM»DOCUMENTATION: PapyrusGenCode«ENDREM»
-«REM»add in the addition codes in order to refresh the labels«ENDREM»
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE Main FOR gmfgen::GenNodeLabel-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::_constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::TextAware::methods(isStoringChildPositions(node), readOnly, elementIcon, viewmap, modelFacet, node, getDiagram())-»
-
- «EXPAND xpt::diagram::editparts::Common::notationalListeners-»
-
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::refreshBounds-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Definition of the inheritance«ENDREM»
-«DEFINE extendsList FOR gmfgen::GenNodeLabel»extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-
-«DEFINE implementsList FOR gmfgen::GenNodeLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNodeLabel-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR self-»
-
- «EXPAND impl::diagram::editparts::TextAware::fields FOR self-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- refreshLabel();
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::handleNotificationEventBody-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNodeLabel-»
-«REM»Code to refresh icon«ENDREM»
-
-«EXPAND xpt::Common::generatedMemberComment»
-private static final String ADD_PARENT_MODEL = "AddParentModel";
-
-
-«EXPAND xpt::Common::generatedMemberComment»
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((org.eclipse.gmf.runtime.notation.View) getParent().getModel())); //$NON-NLS-1$
-
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
-«REM»END: PapyrusGenCode«ENDREM»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/54/54940e1c93da73d1cf5e8d1372cdd8f67ca05b6f.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/54/54940e1c93da73d1cf5e8d1372cdd8f67ca05b6f.svn-base
deleted file mode 100644
index 145d08b7fe4..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/54/54940e1c93da73d1cf5e8d1372cdd8f67ca05b6f.svn-base
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright (c) 2009 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA) - initial API and implementation
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Vincent Lorenzo (CEA-LIST) - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-«EXTENSION xpt::diagram::editparts::Utils»
-«EXTENSION xpt::diagram::Utils»
-«EXTENSION xpt::EMFUtils»
-«EXTENSION xpt::preferences::PrefsConstant»
-«EXTENSION aspects::impl::diagram::editparts::EditPartsUtils»
-
-«REM»-----«ENDREM»
-«REM» GMF «ENDREM»
-«REM»-----«ENDREM»
-
-
-
-«DEFINE extendsListContents FOR gmfgen::GenNode-»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Add own extension«ENDREM»
-«IF papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null)->size()<>0»
- «FOREACH papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null) AS extendedObject»«EXPAND specifyInheritance FOR extendedObject»«ENDFOREACH-»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-«ELSE-»
- «IF hasBorderItems(self)»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart«ENDIF-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE extendsListContents FOR gmfgen::GenChildSideAffixedNode-»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Add own eextension«ENDREM»
-«IF papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null)->size()<>0»
- «FOREACH papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null) AS extendedObject»«EXPAND specifyInheritance FOR extendedObject»«ENDFOREACH-»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-«ELSE-»
- «IF hasBorderItems(self)»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE borderItemSelectionEP FOR gmfgen::GenNode-»
-new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy() {
-
- protected java.util.List createSelectionHandles() {
- org.eclipse.gef.handles.MoveHandle mh = new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
- mh.setBorder(null);
- return java.util.Collections.singletonList(mh);
- }
-}
-«ENDDEFINE»
-
-
-«AROUND addFixedChild FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
-«FOREACH getInnerFixedLabels(self) AS label»«LET label.viewmap.oclAsType(gmfgen::ParentAssignedViewmap) AS childViewmap-»
- if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
- ((«label.getEditPartQualifiedClassName()») childEditPart).«EXPAND impl::diagram::editparts::TextAware::labelSetterName FOR childViewmap»(getPrimaryShape().«childViewmap.getterName»());
- return true;
- }
-«ENDLET»«ENDFOREACH-»
-
-«FOREACH getPinnedCompartments(self) AS compartment»«LET compartment.viewmap.oclAsType(gmfgen::ParentAssignedViewmap) AS childViewmap-»
-
- if (childEditPart instanceof «compartment.getEditPartQualifiedClassName()») {
- org.eclipse.draw2d.IFigure pane = getPrimaryShape().«childViewmap.getterName»();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure());
- return true;
- }
-«ENDLET»«ENDFOREACH-»
-
-«FOREACH getSideAffixedChildren(self) AS child-»
- «REM»BEGIN PapyrusGencode«ENDREM»
- «REM»adding IF else end in order to take in account the case where a specific locator is added«ENDREM»
- «IF papyrusgmfgenextension::SpecificLocator.allInstances()->select(v:papyrusgmfgenextension::SpecificLocator | v.genChildSideAffixedNode->includes(child))->size()<>0»
- «FOREACH papyrusgmfgenextension::SpecificLocator.allInstances()->select(v:papyrusgmfgenextension::SpecificLocator | v.genChildSideAffixedNode->includes(child)) AS extendedObject»
- «EXPAND genSpecificLocator(child) FOR extendedObject-»
- «ENDFOREACH-»
-
- «ELSE»
- «REM»END PapyrusGencode«ENDREM»
- if (childEditPart instanceof «child.getEditPartQualifiedClassName()») {
- org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»);
- getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator);
- return true;
- }
- «REM»BEGIN PapyrusGencode«ENDREM»
- «ENDIF»
- «REM»END PapyrusGencode«ENDREM»
-«ENDFOREACH-»
- return false;
- }
-
-«ENDAROUND»
-
-
-«AROUND createNodePlate FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
- String prefElementId="«elementType.displayName»";
- org.eclipse.jface.preference.IPreferenceStore store =«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore();
- String preferenceConstantWitdh=org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight=org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.HEIGHT);
- org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result = new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- «EXPAND setupNodePlate-»
- return result;
- }
-«ENDAROUND»
-«AROUND borderItemSelectionEditPolicy FOR gmfgen::GenNode-»
-«IF hasBorderItems(self)-»
-org.eclipse.gmf.runtime.notation.View childView = (org.eclipse.gmf.runtime.notation.View) child.getModel();
-switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(childView)) {
-«IF getExternalLabels(self)->size() > 0-»
-«FOREACH getExternalLabels(self) AS nextLabel-»
-«EXPAND xpt::Common::caseVisualID FOR nextLabel-»
-«ENDFOREACH-»
- return «EXPAND borderItemSelectionEP»;
-«ENDIF-»
-«IF getSideAffixedChildren(self)->size() > 0-»
-«FOREACH getSideAffixedChildren(self) AS nextBorderItem-»
-«EXPAND xpt::Common::caseVisualID FOR nextBorderItem-»
-«ENDFOREACH-»
- «REM»BEGIN PapyrusGenCode«ENDREM»
- «REM»The puRprose is to add replace GMF edit prolicy by an new editPolicy that allows to resize BorderItem«ENDREM»
- return new org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy();
- «REM»END PapyrusGenCode«ENDREM»
-«ENDIF-»
-}
-«ENDIF-»
-«ENDAROUND»
-
-«REM»---------«ENDREM»
-«REM» PAPYRUS «ENDREM»
-«REM»---------«ENDREM»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»definition of the inheritance «ENDREM»
-«DEFINE specifyInheritance FOR papyrusgmfgenextension::ExtendedGenView-»«superOwnedEditPart»«ENDDEFINE»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-
-«REM»BEGIN PapyrusGencode «ENDREM»
-«REM» Adding line of template to manange code thanks to a spcific locator«ENDREM»
-«DEFINE genSpecificLocator(gmfgen::GenChildSideAffixedNode child) FOR gmfgen::GenCommonBase-»
-«ENDDEFINE»
-
-«DEFINE genSpecificLocator(gmfgen::GenChildSideAffixedNode child) FOR gmfgen::ToolEntry-»
-«ENDDEFINE»
-
-«DEFINE genSpecificLocator(gmfgen::GenChildSideAffixedNode child) FOR gmfgen::GenNavigatorChildReference-»
-«ENDDEFINE»
-
-«DEFINE genSpecificLocator(gmfgen::GenChildSideAffixedNode child) FOR papyrusgmfgenextension::SpecificLocator-»
-//Papyrus Gencode :«self.comment»
- if (childEditPart instanceof «child.getEditPartQualifiedClassName()») {
- org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «self.classpath»(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»);
- getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator);
- return true;
- }
-
-«ENDDEFINE»
-«REM»END PapyrusGencode «ENDREM»
-
-«REM»BEGIN PapyrusGencode «ENDREM»
-«REM» Overwrite an existing method to set the preference value in the editpart«ENDREM»
-«DEFINE genPreferredValue FOR gmfgen::GenNode-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- @Override
- public Object getPreferredValue(org.eclipse.emf.ecore.EStructuralFeature feature) {
- org.eclipse.jface.preference.IPreferenceStore preferenceStore = (org.eclipse.jface.preference.IPreferenceStore) getDiagramPreferencesHint()
- .getPreferenceStore();
- Object result = null;
-
- if(feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
- .getFontStyle_FontColor() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
- .getFillStyle_FillColor()){
- String prefColor = null;
- if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
- prefColor = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE);
- } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
- .getFontStyle_FontColor()) {
- prefColor = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FONT);
- } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
- .getFillStyle_FillColor()) {
- prefColor = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL);
- }
- result = org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities
- .RGBToInteger(org.eclipse.jface.preference.PreferenceConverter
- .getColor(
- (org.eclipse.jface.preference.IPreferenceStore) preferenceStore, prefColor));
- } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
- .getFillStyle_Transparency() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
- .getFillStyle_Gradient()) {
- String prefGradient = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT);
- org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
- preferenceStore.getString(prefGradient));
- if(feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
- .getFillStyle_Transparency()){
- result = new Integer(gradientPreferenceConverter
- .getTransparency());
- } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE
- .getFillStyle_Gradient()){
- result = gradientPreferenceConverter.getGradientData();
- }
- }
-
- if(result == null){
- result = getStructuralFeatureValue(feature);
- }
- return result;
- }
-«ENDDEFINE»
-«REM»END PapyrusGencode «ENDREM»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»CreateGenerator to refresh figure by taking account of event of UML element or graphical element «ENDREM»
-«DEFINE specificHandleNotificationEvent FOR gmfgen::GenNode-»
- «IF papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self))->size()<>0»
-/**
-*Papyrus codeGen
-*@generated
-**/
-protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
-«IF self.labels->exists(oclIsKindOf(gmfgen::GenExternalNodeLabel))-»
- /*
- * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
- * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
- */
- if(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
- Object notifier = event.getNotifier();
- java.util.List<?> modelChildren = ((org.eclipse.gmf.runtime.notation.View)getModel()).getChildren();
- if(!(notifier instanceof org.eclipse.gmf.runtime.notation.Edge)) {
- if(modelChildren.contains(event.getNotifier())) {
- return;
- }
- }
- }
- «ENDIF-»
- super.handleNotificationEvent(event);
- «FOREACH papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self)) AS extendedObject»
- «EXPAND specificHandleNotificationEventBody FOR extendedObject.propRefreshHook-»
- «ENDFOREACH-»
- }
- «ENDIF»
-
-«ENDDEFINE»
-
-«DEFINE specificHandleNotificationEventBody FOR papyrusgmfgenextension::PropertyRefreshHook-»
-//«self.comment»
-if (resolveSemanticElement() != null) {
-if(«self.triggeringCondition»){
- «self.action»;
- refreshVisuals();
-}
-}
-«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-
-«DEFINE addBorderItem FOR gmfgen::GenNode-»
- «IF getExternalLabels(self)->size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addBorderItem(org.eclipse.draw2d.IFigure borderItemContainer, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart borderItemEditPart) {
- «IF self.getExternalLabelsWithoutSpecificLocator()->size() > 0-»
- if («FOREACH self.getExternalLabelsWithoutSpecificLocator() AS label SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOREACH») {
- org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.SOUTH);
- locator.setBorderItemOffset(new org.eclipse.draw2d.geometry.Dimension(-20, -20));
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else
- «ENDIF-»
- «FOREACH self.getExternalLabelsWithSpecificLocator() AS label-»
- if (borderItemEditPart instanceof «label.getEditPartQualifiedClassName()») {
- org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «label.getSpecificLocator()»(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else
- «ENDFOREACH-»
- {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setupNodePlate FOR gmfgen::GenNode»«ENDDEFINE»
-
-«DEFINE setupNodePlate FOR gmfgen::GenChildSideAffixedNode»
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/54/5494e72458ba7e3301156bd60ca5693668624a0d.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/54/5494e72458ba7e3301156bd60ca5693668624a0d.svn-base
deleted file mode 100644
index 05587872452..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/54/5494e72458ba7e3301156bd60ca5693668624a0d.svn-base
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::EMFUtils»
-«EXTENSION xpt::diagram::updater::Utils»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION gmf::GenModelUtils»
-
-«REM»Mutating Canvas :: semantic children of diagram must select the correct features depending on the element that is the actual canvas«ENDREM»
-«REM»@author :: fjcano (C) 2008«ENDREM»
-«AROUND getSemanticChildrenOfView FOR gmfgen::GenContainerBase-»
- «REM»«IF GenDiagram.isInstance(this) && getReferencingObjects().typeSelect(AlternateCanvas).size() > 0»«ENDREM»
- «IF self.oclIsKindOf(gmfgen::GenDiagram) and papyrusgmfgenextension::AlternateCanvas.allInstances()->select(v:papyrusgmfgenextension::AlternateCanvas|v.diagram=self)->size()<>0»
-«REM»
- The switch that performs the correct job according to the canvas' EObject
-«ENDREM»
- «EXPAND createUpdaterSwitch FOR self»
- «REM»The canvas get method that depends on the Switch«ENDREM»
- «EXPAND xpt::Common::generatedMemberComment»
- public static java.util.List «EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- «IF getSemanticChildrenChildFeatures(self)->size() > 0 or getPhantomNodes(self)->size() > 0-»
- «EXPAND defineModelElement-»
- aSwitch.setInfo(view);
- java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> result = aSwitch.doSwitch(modelElement);
- if (result == null || result.size() <= 0) {
- return java.util.Collections.EMPTY_LIST;
- }
- «IF not getPhantomNodes(self)->isEmpty()-»
- org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
- for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) {
- org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next();
- if (childElement == modelElement) {
- continue;
- }
- «EXPAND addNextIfPhantom FOREACH getPhantomNodes(self)-»
- }
- «ENDIF-»
- return result;
- «ELSE-»
- return java.util.Collections.EMPTY_LIST;
- «ENDIF-»
- }
- «ELSEIF papyrusgmfgenextension::SpecificDiagramUpdater.allInstances()->select(updater: papyrusgmfgenextension::SpecificDiagramUpdater | (updater.genNode = self) and (updater.classpath <> null))->size()<>0»
- «FOREACH papyrusgmfgenextension::SpecificDiagramUpdater.allInstances()->select(updater: papyrusgmfgenextension::SpecificDiagramUpdater | (updater.genNode = self) and (updater.classpath <> null)) AS updater»
- public static java.util.List «EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater customUpdater = new «updater.classpath»();
- return customUpdater.getSemanticChildren(view);
- }
- «ENDFOREACH»
- «ELSE»
- «targetDef.proceed()-»
- «ENDIF»
-«ENDAROUND»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/5a/5afdbc287df7154742f089f7c5ca3665afa4d545.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/5a/5afdbc287df7154742f089f7c5ca3665afa4d545.svn-base
deleted file mode 100644
index 961d3c2adc1..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/5a/5afdbc287df7154742f089f7c5ca3665afa4d545.svn-base
+++ /dev/null
@@ -1,17 +0,0 @@
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2009/GenModel";
-modeltype gmfgenextension uses "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension";
-
-library EditHelperUtils;
-
-/*
- */
-helper getBaseEditHelperFullName(diagram : gmfgen::GenDiagram) : String {
- if (gmfgenextension::AdditionalEditPartCandies.allInstances()->notEmpty()) then {
- return gmfgenextension::AdditionalEditPartCandies.allInstances()
- ->asSequence()
- ->first().baseEditHelperPackage + '.' + diagram.baseEditHelperClassName;
- } endif;
-
- return diagram.getBaseEditHelperQualifiedClassName();
-}
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/5f/5f4750ce80f24c49cec932a191152ece3cdc82e3.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/5f/5f4750ce80f24c49cec932a191152ece3cdc82e3.svn-base
deleted file mode 100644
index 975c4e92fe3..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/5f/5f4750ce80f24c49cec932a191152ece3cdc82e3.svn-base
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- * modified by Vincent Lorenzo (CEA-LIST)
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-«EXTENSION xpt::diagram::editpolicies::UtilsItemSemanticEditPolicy»
-
-«DEFINE LinkItemSemanticEditPolicy FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::copyright FOR diagram.editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «diagram.getBaseItemSemanticEditPolicyQualifiedClassName()» {
-
- «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
-
- «EXPAND classBody-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE classBody FOR gmfgen::GenLink-»
- «EXPAND getDestroySemanticCommand(self) FOR modelFacet -»
- «IF isTypeLink()»«EXPAND xpt::diagram::editpolicies::linkCommands::linkCommands»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
- «ERROR 'Unsupported model facet: ' + self.repr()-»
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand(gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
- return getGEFWrapper(«EXPAND impl::diagram::commands::DeleteLinkCommand::newDeleteReferenceLinkCommand(genLink, 'req')»);
- }
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
-
-«REM»
-Test to know which delete command should be used in the generated code : "Traditional Delete Command" or the Delete Service
-«ENDREM»
-
- «IF papyrusgmfgenextension::EditPartUsingDeleteService.allInstances()->select(v:papyrusgmfgenextension::EditPartUsingDeleteService|v.genView->includes(genLink))->size()<>0»
- «EXPAND xpt::Common::generatedMemberComment»
- «EXPAND xpt::diagram::editpolicies::UtilsItemSemanticEditPolicy::getDestroyElementCommandByService-»
- «ELSE»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
- java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy )));
- return getGEFWrapper(cmd.reduce());
- //return getGEFWrapper(«EXPAND impl::diagram::commands::DeleteLinkCommand::newDeleteLinkWithClassCommand(genLink, 'req')»);
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/62/6254b0339ffd29a11b090e1f5122d57f80cc901e.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/62/6254b0339ffd29a11b090e1f5122d57f80cc901e.svn-base
deleted file mode 100644
index bfae168b26d..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/62/6254b0339ffd29a11b090e1f5122d57f80cc901e.svn-base
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2010 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:
- * Yann Tanguy (CEA LIST) - initial API and implementation
- *
- */
-
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2009/GenModel";
-modeltype papyrusgmfgenextension uses "http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension";
-
-library NodeConstraintUtils;
-
-helper gmfgen::GenNode::hasNodeCreationConstraint() : Boolean {
- return papyrusgmfgenextension::GenNodeConstraint.allInstances()
- ->select(v : papyrusgmfgenextension::GenNodeConstraint
- | v.genNode->includes(self) and v.genConstraint <> null)
- ->size()<>0
-}
-
-helper gmfgen::GenNode::getNodeCreationConstraint() : papyrusgmfgenextension::GenNodeConstraint {
-
- if(self.hasNodeCreationConstraint()) then {
- return papyrusgmfgenextension::GenNodeConstraint.allInstances()
- ->select(v : papyrusgmfgenextension::GenNodeConstraint
- | v.genNode->includes(self) and v.genConstraint <> null)
- ->asSequence()->first()
- } endif;
-
- return null;
-}
-
-helper gmfgen::TypeModelFacet::getOwningGenNode() : gmfgen::GenNode {
- return gmfgen::GenNode.allInstances()
- ->select(v : gmfgen::GenNode | v.modelFacet = self)
- ->asSequence()->first()
-}
-
-helper gmfgen::GenNode::getNodeCreationConstraintBody() : String {
- let nodeConstraint = self.getNodeCreationConstraint() in
- if (self.hasNodeCreationConstraint() <> null) then {
- if ((nodeConstraint.genConstraint <> null) and (nodeConstraint.genConstraint._body <> null)) then {
- return nodeConstraint.genConstraint._body;
- } endif;
- } endif;
-
- return "No GenNodeConstraint found.";
-} \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/63/63f0e60ffb383ac2ea494848f7c8bda0601ca3e8.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/63/63f0e60ffb383ac2ea494848f7c8bda0601ca3e8.svn-base
deleted file mode 100644
index 5ce327cd843..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/63/63f0e60ffb383ac2ea494848f7c8bda0601ca3e8.svn-base
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE extensions FOR gmfgen::GenEditorGenerator»
-«REM»YT (not used):
- <extension point="org.eclipse.ui.editors" id="gmf-editor">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <editor
- id="«editor.iD»"
- name="%editorName"
- icon="«editor.iconPathX»"
- extensions="«diagramFileExtension»"
- default="true"
- class="«editor.getQualifiedClassName()»"
- matchingStrategy="«diagram.getMatchingStrategyQualifiedClassName()»"
- contributorClass="«editor.getActionBarContributorQualifiedClassName()»">
- </editor>
- </extension>
-«ENDREM»
- <extension point="org.eclipse.ui.contexts" id="ui-context">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <context
- description="%context.description"
- id="«editor.contextID»"
- name="%context.name"
- parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
- </context>
- </extension>
-«REM»YT (not used):
- <extension point="org.eclipse.ui.newWizards" id="creation-wizard">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <wizard
- name="%newWizardName"
- icon="«diagram.creationWizardIconPathX»"
- category="«diagram.creationWizardCategoryID»"
- class="«diagram.getCreationWizardQualifiedClassName()»"
- id="«diagram.getCreationWizardQualifiedClassName()»ID">
- <description>%newWizardDesc</description>
- </wizard>
- </extension>
-
-«IF diagram.generateInitDiagramAction()-»
- «IF null = application»<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <objectContribution
- id="«plugin.iD».InitDiagram"
- nameFilter="*.«domainFileExtension»"
- objectClass="org.eclipse.core.resources.IFile">
- <action
- label="%initDiagramActionLabel"
- class="«diagram.getInitDiagramFileActionQualifiedClassName()»"
- menubarPath="additions"
- enablesFor="1"
- id="«plugin.iD».InitDiagramAction">
- </action>
- </objectContribution>
- </extension>
- «ELSE-»
- <extension point="org.eclipse.ui.actionSets" id="init-diagram-action">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <actionSet
- label="%initDiagramActionLabel"
- visible="true"
- id="«plugin.iD».InitDiagram">
- <action
- label="%initDiagramActionLabel"
- class="«diagram.getInitDiagramFileActionQualifiedClassName()»"
- menubarPath="file/additions"
- id="«plugin.iD».InitDiagramAction">
- </action>
- </actionSet>
- </extension>
- «ENDIF-»
-«ENDIF-»
-«ENDREM»
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/67/67d6c11df8dd3991882c2706b24d197f977b4889.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/67/67d6c11df8dd3991882c2706b24d197f977b4889.svn-base
deleted file mode 100644
index a91ee8002a8..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/67/67d6c11df8dd3991882c2706b24d197f977b4889.svn-base
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * modified by Patrick Tessier (CEA LIST)
- */
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::editpolicies::Utils»
-«EXTENSION xpt::diagram::Utils»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::expressions::ValueExpression»
-«EXTENSION xpt::StringOperations»
-«EXTENSION xpt::OclMigrationProblems»
-
-«REM»Documentation: PapyrusGenCode«ENDREM»
-«REM»This tamplate has been modified in order to allow the moving command«ENDREM»
-«DEFINE BaseItemSemanticEditPolicy FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-«EXPAND xpt::Common::generatedClassComment»
-public class «baseItemSemanticEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy {
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
- «EXPAND xpt::Common::generatedMemberComment(
- 'Extended request data key to hold editpart visual id.\n' +
- 'Add visual id of edited editpart to extended data of the request\n' +
- 'so command switch can decide what kind of diagram element is being edited.\n' +
- 'It is done in those cases when it\'s not possible to deduce diagram\n' +
- 'element kind from domain element.\n' +
- 'Add the reoriented view to the request extended data so that the view\n ' +
- 'currently edited can be distinguished from other views of the same element\n ' +
- 'and these latter possibly removed if they become inconsistent after reconnect\n'
- )»
- @SuppressWarnings("unchecked")
- public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) {
- if (request instanceof org.eclipse.gef.requests.ReconnectRequest) {
- Object view = ((org.eclipse.gef.requests.ReconnectRequest) request).getConnectionEditPart().getModel();
- if (view instanceof org.eclipse.gmf.runtime.notation.View) {
- Integer id = new Integer(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»((org.eclipse.gmf.runtime.notation.View) view));
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, (org.eclipse.gmf.runtime.notation.View)view);
- }
- }
- return super.getCommand(request);
- }
-
- «EXPAND xpt::Common::generatedMemberComment('Returns visual id from request parameters.')»
- protected int getVisualID(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
- Object id = request.getParameter(VISUAL_ID_KEY);
- return id instanceof Integer ? ((Integer) id).intValue() : -1;
- }
- «EXPAND semanticPart-»
- «EXPAND xpt::Common::generatedMemberComment('Returns editing domain from the host edit part.')»
- protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- return ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- }
- «EXPAND addDestroyShortcutsCommand-»
-
-«IF links->exists(not sansDomain) -»
- «EXPAND linkConstraints-»
-«ENDIF-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment('Extended request data key to hold editpart visual id.')»
- public static final String VISUAL_ID_KEY = "visual_id"; «EXPAND xpt::Common::nonNLS»
- «EXPAND xpt::Common::generatedMemberComment('Extended request data key to hold the edge view during a reconnect request.')»
- public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; «EXPAND xpt::Common::nonNLS»
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.gmf.runtime.emf.type.core.IElementType myElementType;
-«ENDDEFINE»
-«DEFINE _constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected «baseItemSemanticEditPolicyClassName»(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
- myElementType = elementType;
- }
-«ENDDEFINE»
-«DEFINE addDestroyShortcutsCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment('Clean all shortcuts to the host element from the same diagram')»
- protected void addDestroyShortcutsCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd, org.eclipse.gmf.runtime.notation.View view) {
- «EXPAND xpt::Common::_assert('view.getEAnnotation(\"Shortcut\") == null')-»
- for (java.util.Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) {«EXPAND xpt::Common::nonNLS»
- continue;
- }
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), nextView));
- }
- }
-«ENDDEFINE»
-«DEFINE semanticPart FOR gmfgen::GenDiagram-»
- «EXPAND getSemanticCommand-»
-
- «EXPAND addDeleteViewCommand-»
-
- «EXPAND getEditHelperCommand-»
-
- «EXPAND getContextElementType-»
-
- «EXPAND getSemanticCommandSwitch-»
-
- «EXPAND getConfigureCommand-»
- «EXPAND getCreateRelationshipCommand-»
- «EXPAND getCreateCommand-»
- // RS: add code for extended types
- «EXPAND getCreateExtendedTypeCommand-»
- «EXPAND getExtendedStartCreateRelationshipCommand-»
- «EXPAND getExtendedCompleteCreateRelationshipCommand-»
- // RS: End of add code for extended types
- «EXPAND getCreateSemanticServiceEditCommand-»
- «EXPAND getSetCommand-»
- «EXPAND getEditContextCommand-»
- «EXPAND getDestroyElementCommand-»
- «EXPAND getDestroyReferenceCommand-»
- «EXPAND getDuplicateCommand-»
- «EXPAND getMoveCommand-»
- «EXPAND getReorientReferenceRelationshipCommand-»
- «EXPAND getReorientRelationshipCommand-»
-
- «EXPAND getGEFWrapper-»
-
-«ENDDEFINE»
-«DEFINE getEditHelperCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.commands.Command getEditHelperCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request, org.eclipse.gef.commands.Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- org.eclipse.gmf.runtime.common.core.command.ICommand command = editPolicyCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) editPolicyCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(editPolicyCommand);
- request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::editPolicyCommandConstant», command);
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::contextElementTypeConstant», requestContextElementType);
- org.eclipse.gmf.runtime.common.core.command.ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::editPolicyCommandConstant», null);
- request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::contextElementTypeConstant», null);
- if (command != null) {
- if (!(command instanceof org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)) {
- command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
- }
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
- }
- return editPolicyCommand;
- }
-«ENDDEFINE»
-«DEFINE getContextElementType FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.emf.type.core.IElementType getContextElementType(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «getElementTypesQualifiedClassName()».getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
-«ENDDEFINE»
-«DEFINE getSemanticCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getSemanticCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
- org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest completedRequest = completeRequest(request);
- org.eclipse.gef.commands.Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
- if (completedRequest instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) {
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest destroyRequest = (org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
- }
- return semanticCommand;
- }
-«ENDDEFINE»
-«DEFINE addDeleteViewCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command addDeleteViewCommand(org.eclipse.gef.commands.Command mainCommand, org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest completedRequest){
- org.eclipse.gef.commands.Command deleteViewCommand = getGEFWrapper(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
-}
-«ENDDEFINE»
-«DEFINE getSemanticCommandSwitch FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getSemanticCommandSwitch(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
- if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest) {
- return getCreateRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) {
- return getCreateCommand((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) {
- return getConfigureCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) {
- return getDestroyElementCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest) {
- return getDestroyReferenceCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest) {
- return getDuplicateCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) {
- return getEditContextCommand((org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) {
- return getMoveCommand((org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) {
- return getSetCommand((org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) req);
- }
- return null;
-}
-«ENDDEFINE»
-«DEFINE getConfigureCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest req) {
- return null;
-}
-«ENDDEFINE»
-«DEFINE getCreateRelationshipCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- «IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()<1-»
- return null;
- «ENDIF»
- «IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()>0-»
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)getHost()).resolveSemanticElement());
- if(req.getElementType() != null) {
- commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getElementType());
- }
-
- if(commandService == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
-
- org.eclipse.gmf.runtime.common.core.command.ICommand semanticCommand = commandService.getEditCommand(req);
-
- if((semanticCommand != null) && (semanticCommand.canExecute())) {
- return getGEFWrapper(semanticCommand);
- }
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- «ENDIF»
-}
-«ENDDEFINE»
-«DEFINE getCreateCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- // no more usage of the extended types here.
- return null;
- }
-«ENDDEFINE»
-«DEFINE getCreateExtendedTypeCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getExtendedTypeCreationCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest request, org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType requestElementType) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(request.getContainer());
- if(provider == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- // Retrieve create command from the Element Edit service
- org.eclipse.gmf.runtime.common.core.command.ICommand createGMFCommand = provider.getEditCommand(request);
- return getGEFWrapper(createGMFCommand);
- }
-«ENDDEFINE»
-«DEFINE getExtendedStartCreateRelationshipCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getExtendedStartCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest request, org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType requestElementType) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(requestElementType);
- if(provider == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- // Retrieve create command from the Element Edit service
- org.eclipse.gmf.runtime.common.core.command.ICommand createGMFCommand = provider.getEditCommand(request);
- return getGEFWrapper(createGMFCommand);
-}
-«ENDDEFINE»
-«DEFINE getExtendedCompleteCreateRelationshipCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getExtendedCompleteCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest request, org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType requestElementType) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(requestElementType);
- if(provider == null) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- // Retrieve create command from the Element Edit service
- org.eclipse.gmf.runtime.common.core.command.ICommand createGMFCommand = provider.getEditCommand(request);
- return getGEFWrapper(createGMFCommand);
-}
-«ENDDEFINE»
-«DEFINE getSetCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest req) {
- return null;
-}
-«ENDDEFINE»
-«DEFINE getEditContextCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getEditContextCommand(org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest req) {
- return null;
-}
-«ENDDEFINE»
-«DEFINE getDestroyElementCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- return null;
-}
-«ENDDEFINE»
-«DEFINE getDestroyReferenceCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
- return null;
-}
-«ENDDEFINE»
-«DEFINE getDuplicateCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
- return null;
-}
-«ENDDEFINE»
-«DEFINE getMoveCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest req) {
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM»add move command«ENDREM»
- org.eclipse.emf.ecore.EObject targetCEObject = req.getTargetContainer();
- if(targetCEObject != null) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(targetCEObject);
- if(provider != null) {
- org.eclipse.gmf.runtime.common.core.command.ICommand moveCommand = provider.getEditCommand(req);
- if(moveCommand != null) {
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(moveCommand);
- }
- }
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- } else {
- return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand(req));
- }
- «REM»END: PapyrusGenCode«ENDREM»
-
-}
-«ENDDEFINE»
-«DEFINE getReorientReferenceRelationshipCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getReorientReferenceRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest req) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
-}
-«ENDDEFINE»
-«DEFINE getReorientRelationshipCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
-}
-«ENDDEFINE»
-«DEFINE getGEFWrapper FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.gef.commands.Command getGEFWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) {
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(cmd);
- }
-«ENDDEFINE»
-
-«DEFINE _accessLinkConstraints FOR gmfgen::GenDiagram-»
-«getBaseItemSemanticEditPolicyQualifiedClassName()».getLinkConstraints()«-»
-«ENDDEFINE»
-
-«DEFINE canExistCall(gmfgen::GenLink link, String sourceVar, String targetVar) FOR gmfgen::FeatureLinkModelFacet-»
-«EXPAND _accessLinkConstraints FOR link.diagram».canExist«link.getUniqueIdentifier()»(«sourceVar», «targetVar»)«-»
-«ENDDEFINE»
-// NOTE, containerVar will be used only when link has other container than its source. It's safe to pass variable/method name that doesn't exist
-«DEFINE canExistCall(gmfgen::GenLink link, String containerVar, String linkVar, String sourceVar, String targetVar) FOR gmfgen::TypeLinkModelFacet-»
-«EXPAND _accessLinkConstraints FOR link.diagram».canExist«link.getUniqueIdentifier()»(«IF hasContainerOtherThanSource(self)»«containerVar», «ENDIF»«linkVar», «sourceVar», «targetVar»)«-»
-«ENDDEFINE»
-
-«DEFINE canCreateCall(gmfgen::GenLink link, String sourceVar, String targetVar) FOR gmfgen::FeatureLinkModelFacet-»
-«EXPAND _accessLinkConstraints FOR link.diagram».canCreate«link.getUniqueIdentifier()»(«sourceVar», «targetVar»)«-»
-«ENDDEFINE»
-// NOTE, containerVar will be used only when link has other container than its source. It's safe to pass variable/method name that doesn't exist
-// Yes, this is sorta hack, but no idea of better approach right now. Perhaps, CreateLinkUtils may always define getContainer() for TypeLinkModelFacet, and use getSource() by default?
-«DEFINE canCreateCall(gmfgen::GenLink link, String containerVar, String sourceVar, String targetVar) FOR gmfgen::TypeLinkModelFacet-»
-«EXPAND _accessLinkConstraints FOR link.diagram».canCreate«link.getUniqueIdentifier()»(«IF hasContainerOtherThanSource(self)»«containerVar», «ENDIF»«sourceVar», «targetVar»)«-»
-«ENDDEFINE»
-
-
-
-«REM»
- FIXME need to check constraint's provider to ensure we don't generate a field
- for e.g. Java (or Literal, which is unlikely, though) expressions
-
- [Papyrus Quick Fix] Do not generate field when the expression is provided
- by a GenJavaExpressionProvider.
-«ENDREM»
-«DEFINE linkConstraints FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static «getLinkCreationConstraintsClassName()» getLinkConstraints() {
- «getLinkCreationConstraintsClassName()» cached = «EXPAND plugin::Activator::instanceAccess FOR editorGen».getLinkConstraints();
- if (cached == null) {
- «EXPAND plugin::Activator::instanceAccess FOR editorGen».setLinkConstraints(cached = new «getLinkCreationConstraintsClassName()»());
- }
- return cached;
- }
-
-
-«EXPAND xpt::Common::generatedClassComment»
-public static class «getLinkCreationConstraintsClassName()» {
-
-«EXPAND xpt::Common::generatedMemberComment»
- public «getLinkCreationConstraintsClassName()»() {«REM»package-local for the BaseItemSemanticEditPolicy to instantiate. Perhaps, protected is better (i.e. if someone subclasses it?)«ENDREM»
- // use static method #getLinkConstraints() to access instance
- }
-
- «EXPAND canCreate FOREACH links-»
- «EXPAND canExist FOREACH links-»
-}
-«ENDDEFINE»
-«DEFINE canCreate FOR gmfgen::GenLink»
-«EXPAND xpt::Common::generatedMemberComment»
-public boolean canCreate«getUniqueIdentifier()»(«EXPAND canCreateParameters FOR modelFacet») {
- «EXPAND checkEMFConstraints FOR modelFacet-»
- return canExist«getUniqueIdentifier()»(«EXPAND canCreateValues FOR modelFacet»);
-}
-
-«ENDDEFINE»
-
-«REM»
- XXX for now, both constraints are injected into single method
- which may not be suitable for modification especially when mixing
- java and ocl constraints (former requires manual code).
- Better approach would be:
- if either is non-null and providers are not the same - introduce two methods,
- to check source and target separately. Otherwize, do it inplace.
-«ENDREM»
-«DEFINE canExist FOR gmfgen::GenLink»
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean canExist«getUniqueIdentifier()»(«EXPAND canExistParameters FOR modelFacet») {
-«IF creationConstraints <> null and (creationConstraints.isValid() and null <> getDiagram().editorGen.expressionProviders)-»
- try {
-«IF null <> creationConstraints.sourceEnd-»
- «EXPAND _checkAdditionalConstraint(creationConstraints.sourceEnd, 'source', 'target', creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass()) FOR creationConstraints.sourceEnd.provider-»
-«ENDIF-»
-«IF null <> creationConstraints.targetEnd-»
- «EXPAND _checkAdditionalConstraint(creationConstraints.targetEnd, 'target', 'source', creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass()) FOR creationConstraints.targetEnd.provider-»
-«ENDIF-»
- return true;
- } catch(Exception e) {
- «EXPAND plugin::Activator::instanceAccess FOR getDiagram().editorGen».logError("Link constraint evaluation error", e);«EXPAND xpt::Common::nonNLS»
- return false;
- }
-«ELSE-»
- return true;
-«ENDIF-»
- }
-«ENDDEFINE»
-
-// FIXME mark as private (_) and move to impl::<find proper place>::LinkConstraints.xpt
-«DEFINE canCreateParameters FOR gmfgen::LinkModelFacet»«EXPAND sourceTargetParameters»«ENDDEFINE»// source and target are reasonable defaults
-«DEFINE canCreateParameters FOR gmfgen::TypeLinkModelFacet»«IF hasContainerOtherThanSource(self)»«EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container, «ENDIF»«EXPAND sourceTargetParameters»«ENDDEFINE»
-
-«DEFINE canExistParameters FOR gmfgen::LinkModelFacet»«EXPAND sourceTargetParameters»«ENDDEFINE»// source and target are reasonable defaults
-«DEFINE canExistParameters FOR gmfgen::TypeLinkModelFacet»«IF hasContainerOtherThanSource(self)»«EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container, «ENDIF»«EXPAND MetaModel::QualifiedClassName FOR metaClass» linkInstance, «EXPAND sourceTargetParameters»«ENDDEFINE»
-
-«DEFINE sourceTargetParameters FOR gmfgen::LinkModelFacet»«EXPAND MetaModel::QualifiedClassName FOR getSourceType()» source, «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» target«ENDDEFINE»
-
-// these are in fact 'canExist' values
-«DEFINE canCreateValues FOR gmfgen::LinkModelFacet»source, target«ENDDEFINE» // defaults
-«DEFINE canCreateValues FOR gmfgen::TypeLinkModelFacet»«IF hasContainerOtherThanSource(self)»container, «ENDIF»null, source, target«ENDDEFINE»
-
-
-«DEFINE checkEMFConstraints FOR gmfgen::LinkModelFacet»«ERROR 'Unrecognized link model facet in checkEMFConstraints: ' + self.repr()»«ENDDEFINE»
-
-
-«DEFINE checkEMFConstraints FOR gmfgen::TypeLinkModelFacet-»
-«IF not containmentMetaFeature.ecoreFeature.oclIsUndefined()-»
- «LET childMetaFeature <> containmentMetaFeature and not isUnbounded(childMetaFeature.ecoreFeature) AS checkChildFeatureBounds-»
- «IF not isUnbounded(containmentMetaFeature.ecoreFeature) or checkChildFeatureBounds-»
-if («getContainerVariable(self)» != null) {
- «EXPAND checkEMFConstraints(self) FOR containmentMetaFeature-»
- «IF checkChildFeatureBounds-»
- «EXPAND checkEMFConstraints(self) FOR childMetaFeature-»
- «ENDIF-»
-}
- «ENDIF-»
- «ENDLET-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkEMFConstraints(modelFacet : gmfgen::TypeLinkModelFacet) FOR genmodel::GenFeature-»
-«IF not containmentMetaFeature.ecoreFeature.oclIsUndefined()-»
-«IF not isUnbounded(ecoreFeature)-»
-if («EXPAND featureBoundComparator(getContainerVariable(modelFacet), modelFacet.getSourceType())») {
- return false;
-}
-«ENDIF-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkEMFConstraints FOR gmfgen::FeatureLinkModelFacet-»
-if (source != null) {
- if («EXPAND featureBoundsConditionClause('source', getSourceType()) FOR metaFeature») {
- return false;
- }
- «IF isContains(metaFeature)-»
- if (source == target) {
- return false;
- }
- «ENDIF-»
-}
-«IF getReverse(metaFeature) <> null-»
-if (target != null && («EXPAND featureBoundsConditionClause('target', getTargetType()) FOR getReverse(metaFeature)»)) {
- return false;
-}
-«ENDIF»
-«ENDDEFINE»
-
-«DEFINE featureBoundsConditionClause(targetVar : String, targetType : genmodel::GenClass) FOR genmodel::GenFeature-»
-«REM»Checking upper bounds if was specified in MM«ENDREM»«-»
-«IF not ecoreFeature.oclIsUndefined()»
- «IF not isUnbounded(ecoreFeature)»«EXPAND featureBoundComparator(targetVar, targetType)»«ENDIF-»
- «REM»Checking uniqueness in addition if upper bounds != 1«ENDREM»«-»
- «IF not isSingleValued(ecoreFeature) and not isUnbounded(ecoreFeature)» || «ENDIF-»
- «REM»Checking uniqueness in if upper bounds !- 1«ENDREM»«-»
- «IF not isSingleValued(ecoreFeature)»«EXPAND featureUniquenessComparator(targetVar, targetType)»«ENDIF»
-«ENDIF»
-«ENDDEFINE»
-
-«DEFINE featureBoundComparator(featureVar : String, featureVarGenClass : genmodel::GenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass)»«IF ecoreFeature.upperBound.oclAsType(Integer) = 1» != null«ELSE».size() >= «ecoreFeature.upperBound.oclAsType(Integer)»«ENDIF»«ENDDEFINE»
-«DEFINE featureUniquenessComparator(featureVar : String, featureVarGenClass : genmodel::GenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass) FOR self».contains(target)«ENDDEFINE»
-
-
-«DEFINE _checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String sourceEndVar, String targetEndVar, genmodel::GenClass context, genmodel::GenClass oppositeEndContext) FOR gmfgen::GenExpressionProviderBase»
-«ERROR 'Have no idea what extra constraints to check for ' + self.repr()»
-«ENDDEFINE»
-
-«DEFINE _checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String sourceEndVar, String targetEndVar, genmodel::GenClass context, genmodel::GenClass oppositeEndContext) FOR gmfgen::GenExpressionInterpreter-»
- if («sourceEndVar» == null) {
- return true;
- } else {«REM»else is important here as it gives scope for the env variable«ENDREM»
- java.util.Map«EXPAND CodeStyle::G2('String', 'org.eclipse.emf.ecore.EClassifier') FOR container.editorGen.diagram» env = java.util.Collections.«EXPAND CodeStyle::G2('String', 'org.eclipse.emf.ecore.EClassifier') FOR container.editorGen.diagram»singletonMap(«EXPAND oppositeEndVariableNameValue», «EXPAND MetaModel::MetaClass FOR oppositeEndContext»);«EXPAND xpt::Common::nonNLS»
- Object «sourceEndVar»Val = «EXPAND xpt::expressions::getExpression::getExpression(valueExpr, context, 'env')».evaluate(«sourceEndVar», java.util.Collections.singletonMap(«EXPAND oppositeEndVariableNameValue», «targetEndVar»));«EXPAND xpt::Common::nonNLS»
- if (false == «sourceEndVar»Val instanceof Boolean || !((Boolean) «sourceEndVar»Val).booleanValue()) {
- return false;
- } // else fall-through
- }
-«ENDDEFINE»
-
-«DEFINE _checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String sourceEndVar, String targetEndVar, genmodel::GenClass context, genmodel::GenClass oppositeEndContext) FOR gmfgen::GenJavaExpressionProvider-»
-«IF injectExpressionBody and (valueExpr.body <> null and valueExpr.body.size() <> 0)-»
- «valueExpr.body»
-«ELSEIF throwException or (injectExpressionBody and (valueExpr.body = null or valueExpr.body.size() = 0))-»
- // TODO: implement this method, using «sourceEndVar» and «targetEndVar»
- // to access link source and target, respectively
- // Ensure that you remove @generated or mark it @generated NOT
- if (Boolean.TRUE.booleanValue()) {
- throw new java.lang.UnsupportedOperationException("No java implementation provided");«EXPAND xpt::Common::nonNLS»
- }
-«ELSE-»
- if (Boolean.TRUE.booleanValue()) {«REM»just in case there are two consecutive java expression with neither throw nor inject - avoid unreachable code.«ENDREM»
- return false;
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE oppositeEndVariableNameValue FOR OclAny»"oppositeEnd"«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE defaultConstructor FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «itemSemanticEditPolicyClassName»() {
- «EXPAND defaultConstructorBody-»
- }
-«ENDDEFINE»
-
-«REM»
- This method should be called only with diagram, node or link used as a parameter
- (then elementType != null)
-«ENDREM»
-«DEFINE defaultConstructorBody FOR gmfgen::GenCommonBase-»
- «IF elementType = null-»
- «ERROR 'No element type in the passed node. Only diagram, node or link are supported in this template: ' + self.repr()-»
- «ENDIF-»
- super(«EXPAND xpt::providers::ElementTypes::accessElementType»);
-«ENDDEFINE»
-
-«REM»
- Generate generic method if using semantic creation command based on element types framework.
-«ENDREM»
-«DEFINE getCreateSemanticServiceEditCommand FOR gmfgen::GenDiagram-»
-«IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()>0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getSemanticCreationCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if(commandService == null) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- return commandService.getEditCommand(req);
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getCreateSemanticServiceEditCommand FOR gmfgen::GenDiagram-»
-«IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()>0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getSemanticCreationCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if(commandService == null) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- return commandService.getEditCommand(req);
- }
-«ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/68/68cf81d13a1eac7a52b8efc91ab715422c53e5fa.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/68/68cf81d13a1eac7a52b8efc91ab715422c53e5fa.svn-base
deleted file mode 100644
index 692d33924e6..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/68/68cf81d13a1eac7a52b8efc91ab715422c53e5fa.svn-base
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2008, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * modified by Vincent Lorenzo (CEA LIST) - Vincent Lorenzo
- */
-«REM»We remove the dependance with DeleteElementAction. Now this action is added to the popup menu with the extension point org.eclipse.ui.popup
-in org.eclipse.papyrus.uml.diagram.common «ENDREM»
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE className FOR gmfgen::GenDiagram»DiagramEditorContextMenuProvider«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE DiagramEditorContextMenuProvider FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.IWorkbenchPart part;
- «REM»
- «EXPAND xpt::Common::generatedMemberComment»
- private «EXPAND xpt::editor::DeleteElementAction::qualifiedClassName» deleteAction;
- «ENDREM»
- «EXPAND xpt::Common::generatedMemberComment»
- public DiagramEditorContextMenuProvider(org.eclipse.ui.IWorkbenchPart part, org.eclipse.gef.EditPartViewer viewer) {
- super(part, viewer);
- this.part = part;
- «REM»
- deleteAction = new «EXPAND xpt::editor::DeleteElementAction::qualifiedClassName»(part);
- deleteAction.init();
- «ENDREM»
- }
- «REM»
- «EXPAND xpt::Common::generatedMemberComment»
- public void dispose() {
- if (deleteAction != null) {
- deleteAction.dispose();
- deleteAction = null;
- }
- super.dispose();
- }
- «ENDREM»
- «EXPAND xpt::Common::generatedMemberComment»
- public void buildContextMenu(final org.eclipse.jface.action.IMenuManager menu) {
- getViewer().flush();
- try {
- org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(
- (org.eclipse.emf.ecore.EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
-
- public void run() {
- org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService.getInstance().contributeToPopupMenu(
- DiagramEditorContextMenuProvider.this, part);
- menu.remove(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_DELETE_FROM_MODEL);
- «REM»
- menu.appendToGroup("editGroup", deleteAction);
- «ENDREM»
- }
- });
- } catch (Exception e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Error building context menu", e);
- }
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/6d/6d4b00ccc131e8e81955ab34ce957a56a395c03e.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/6d/6d4b00ccc131e8e81955ab34ce957a56a395c03e.svn-base
deleted file mode 100644
index 7ae5e972639..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/6d/6d4b00ccc131e8e81955ab34ce957a56a395c03e.svn-base
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.def</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.openarchitectureware.base.oawBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.gmf.xpand.oawBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.gmf.xpand.xpandBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.xtend.shared.ui.xtendBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.openarchitectureware.base.oawNature</nature>
- <nature>org.eclipse.xtend.shared.ui.xtendXPandNature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/70/70cc736d12847a299f37824ae6f64835f93deee3.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/70/70cc736d12847a299f37824ae6f64835f93deee3.svn-base
deleted file mode 100644
index 167f968a019..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/70/70cc736d12847a299f37824ae6f64835f93deee3.svn-base
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 2007, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257632] do not rely on EditPart presence for element deletion
- * modified by Vincent Lorenzo (CEA-LIST)
- */
-
-«REM»
- This template should be called only for non-design nodes (modelFacet != null)
- because *ItemSemanticEditPolicy responsible for dealing with semantic model
- elements and meaningless (should not be generated) for pure design nodes.
-«ENDREM»
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::editpolicies::Utils»
-«EXTENSION xpt::diagram::editpolicies::UtilsItemSemanticEditPolicy»
-
-«DEFINE NodeItemSemanticEditPolicy FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «getDiagram().getBaseItemSemanticEditPolicyQualifiedClassName()» {
-
- «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
-
- «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes->asSequence()-»
-
-«REM»
-Papyrus REM :
-Test to know how the delete of this EditPart is done : we used the DeleteService or the "Traditional method"
-«ENDREM»
- «IF papyrusgmfgenextension::EditPartUsingDeleteService.allInstances()->select(v:papyrusgmfgenextension::EditPartUsingDeleteService|v.genView->includes(self))->size()<>0»
- «EXPAND xpt::Common::generatedMemberComment»
- «EXPAND xpt::diagram::editpolicies::UtilsItemSemanticEditPolicy::getDestroyElementCommandByService-»
- «ELSE»
- «EXPAND getDestroyElementCommand-»
- «IF hasChildrenOrCompartments(self)-»
- «EXPAND addDestroyChildNodesCommand-»
- «ENDIF-»
- «ENDIF-»
-
- «EXPAND xpt::diagram::editpolicies::linkCommands::linkCommands-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE getDestroyElementCommand FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
- «REM»«EXPAND destroyEdges('view')-»«ENDREM»
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut");«EXPAND xpt::Common::nonNLS»
- if (annotation == null) {
- // there are indirectly referenced children, need extra commands: «childNodes->union(compartments.childNodes->asBag())->exists(not isDirectlyOwned(self))»
- «IF hasChildrenOrCompartments(self)-»
- addDestroyChildNodesCommand(cmd);
- «ENDIF-»
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy )));
- } else {«REM»Here, we may play smart and don't generate else for non-toplevel nodes(which can't be shortcuts). Is it worth doing?«ENDREM»
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
-}
-«ENDDEFINE»
-
-«DEFINE addDestroyChildNodesCommand FOR gmfgen::GenNode-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addDestroyChildNodesCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» nit = view.getChildren().iterator(); nit.hasNext();) {
- org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) nit.next();
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(node)) {
- «EXPAND destroyChildNodes('node', self) FOREACH childNodes-»
- «IF compartments->notEmpty()»«FOREACH compartments AS compartment-»
- «EXPAND xpt::Common::caseVisualID FOR compartment»
- for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» cit = node.getChildren().iterator(); cit.hasNext();) {
- org.eclipse.gmf.runtime.notation.Node cnode = (org.eclipse.gmf.runtime.notation.Node) cit.next();
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(cnode)) {
- «EXPAND destroyChildNodes('cnode', self) FOREACH compartment.childNodes-»
- }
- }
- break;
- «ENDFOREACH»«ENDIF-»
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE destroyChildNodes(nodeVar : String, gmfgen::GenNode genNode) FOR gmfgen::GenChildNode-»
-«EXPAND xpt::Common::caseVisualID»
- «EXPAND destroyEdges(nodeVar)-»
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(getEditingDomain(), «nodeVar».getElement(), false))); // directlyOwned: «self.isDirectlyOwned(genNode)»
- // don't need explicit deletion of «nodeVar» as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), «nodeVar»));
- break;
-«ENDDEFINE»
-
-// @param view - Notation element for the passed node
-// assumes 'cmd' to point to composite command
-«DEFINE destroyEdges(String view) FOR gmfgen::GenNode-»
-«REM»
- XXX: Though semantic editpolicy is supposed to create commands that operate with semantic elements only,
- old code used to delegate child/link deletion to respective editparts, which in turn led to semantic commands
- being combined with notational commands (BaseItemSemanticEditPolicy#addDeleteViewCommand()).
- ---
- Use DiagramUpdater.get[Incoming|Outgoing]View instead, to clean links that are not present on a diagram
- (but don't forget to clean corresponding Edge, if any)
-«ENDREM-»
-
-«REM»
-
-// This part is commented for Papyrus
-// Some Papyrus diagrams with lots of elements are reaching the 65K Java limit for method size.
-// The following change is not supposed to modify the method behavior, just propose a slight more
-// compact code to avoid size limit.
-
-«IF genIncomingLinks->notEmpty()-»
- for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getTargetEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
-«FOREACH genIncomingLinks AS il-»
- if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(incomingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il») {
- «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'incomingLink') FOR il-»
- cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR il»);
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- continue;
- }
-«ENDFOREACH-»
- }
-«ENDIF-»
-«IF genOutgoingLinks->notEmpty()-»
- for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getSourceEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
-«FOREACH genOutgoingLinks AS ol-»
- if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(outgoingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol») {
- «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'outgoingLink') FOR ol-»
- cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR ol»);
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
- continue;
- }
-«ENDFOREACH-»
- }
-«ENDIF-»
-«ENDREM-»
-
-«IF genIncomingLinks->notEmpty()-»
- for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getTargetEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- switch(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(incomingLink)) {
-«IF genIncomingLinks->select(l | l.modelFacet.oclIsKindOf(gmfgen::FeatureLinkModelFacet))->notEmpty()-»
-«FOREACH genIncomingLinks->select(l | l.modelFacet.oclIsKindOf(gmfgen::FeatureLinkModelFacet)) AS il-»
- case «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il»:
-«ENDFOREACH-»
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
-«ENDIF-»
-«IF genIncomingLinks->select(l | l.modelFacet.oclIsKindOf(gmfgen::TypeLinkModelFacet))->notEmpty()-»
-«FOREACH genIncomingLinks->select(l | l.modelFacet.oclIsKindOf(gmfgen::TypeLinkModelFacet)) AS il-»
- case «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il»:
-«ENDFOREACH-»
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
-«ENDIF-»
- }
- }
-«ENDIF-»
-
-«IF genOutgoingLinks->notEmpty()-»
- for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getSourceEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- switch(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(outgoingLink)) {
-«IF genOutgoingLinks->select(l | l.modelFacet.oclIsKindOf(gmfgen::FeatureLinkModelFacet))->notEmpty()-»
-«FOREACH genOutgoingLinks->select(l | l.modelFacet.oclIsKindOf(gmfgen::FeatureLinkModelFacet)) AS ol-»
- case «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol»:
-«ENDFOREACH-»
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(outgoingLink.getSource().getElement(), null, outgoingLink.getTarget().getElement(), false);
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
- break;
-«ENDIF-»
-«IF genOutgoingLinks->select(l | l.modelFacet.oclIsKindOf(gmfgen::TypeLinkModelFacet))->notEmpty()-»
-«FOREACH genOutgoingLinks->select(l | l.modelFacet.oclIsKindOf(gmfgen::TypeLinkModelFacet)) AS ol-»
- case «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol»:
-«ENDFOREACH-»
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
- break;
-«ENDIF-»
- }
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/74/74b403b644fe4e2197a98ed21023af7972dca87a.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/74/74b403b644fe4e2197a98ed21023af7972dca87a.svn-base
deleted file mode 100644
index 391603667e0..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/74/74b403b644fe4e2197a98ed21023af7972dca87a.svn-base
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * Copyright (c) 2007, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #372479
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
-
-«EXTENSION xpt::editor::Utils»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-«EXTENSION xpt::diagram::updater::Utils»
-
-
-«DEFINE VisualIDRegistry FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment(
- 'This registry is used to determine which type of visual object should be\n' +
- 'created for the corresponding Diagram, Node, ChildNode or Link represented\n' +
- 'by a domain model object.\n'
- )»
-public class «visualIDRegistryClassName» {
-
- «EXPAND attributes-»
-
- «EXPAND getViewVisualID-»
-
- «EXPAND getModelID-»
-
- «EXPAND getVisualID-»
-
- «EXPAND getType-»
-
- «EXPAND getDiagramVisualID-»
-
- «EXPAND getNodeVisualID-»
-
- «EXPAND canCreateNode-»
-
- «EXPAND getLinkWithClassVisualID-»
-
- «EXPAND isDiagram-»
-
- «EXPAND _constraintMethods-»
-
- «EXPAND checkNodeVisualID-»
-
- «EXPAND isCompartmentVisualID-»
-
- «EXPAND isSemanticLeafVisualID-»
-
- «EXPAND runtimeTypedInstance-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«REM»
- <Definitions of templates for outside usage>
-«ENDREM»
-
-«DEFINE visualID FOR gmfgen::GenCommonBase»«getEditPartQualifiedClassName()».VISUAL_ID«ENDDEFINE»
-
-«DEFINE modelID FOR gmfgen::GenDiagram»«getEditPartQualifiedClassName()».MODEL_ID«ENDDEFINE»
-
-«DEFINE getVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getVisualIdMethodName»«ENDDEFINE»
-
-«DEFINE getModelIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getModelIDMethodName»«ENDDEFINE»
-
-«REM»
- XXX looks like these methods would produce incorrect result for visualID of GenDiagram itself - ask Vano if
- getType() method shouldn't be fixed similar to getVisualID, i.e. map diagram's visual id to MODEL_ID instead plain String.valueOf()
-«ENDREM»
-«DEFINE typeMethodCall(visualIdVar : String) FOR gmfgen::GenCommonBase»«getDiagram().getVisualIDRegistryQualifiedClassName()».«EXPAND getTypeMethodName FOR getDiagram()»(«visualIdVar»)«ENDDEFINE»
-«DEFINE typeMethodCall FOR gmfgen::GenCommonBase»«getDiagram().getVisualIDRegistryQualifiedClassName()».«EXPAND getTypeMethodName FOR getDiagram()»(«EXPAND visualID»)«ENDDEFINE»
-
-«DEFINE getDiagramVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getDiagramVisualIDMethodName»«ENDDEFINE»
-
-«DEFINE getNodeVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getNodeVisualIDMethodName»«ENDDEFINE»
-
-«DEFINE canCreateNodeMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND canCreateNodeMethodName»«ENDDEFINE»
-
-«DEFINE getLinkWithClassVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getLinkWithClassVisualIDMethodName»«ENDDEFINE»
-
-«REM»
- </Definitions of templates for outside usage>
-«ENDREM»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static final String DEBUG_KEY = "«editorGen.plugin.iD»/debug/visualID"; «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE getViewVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getVisualIdMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- if (view instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- if («EXPAND modelID».equals(view.getType())) {
- return «EXPAND visualID»;
- } else {
- «EXPAND unrecognizedVID-»
- }
- }
- return «EXPAND getVisualIDMethodCall»(view.getType());
-}
-«ENDDEFINE»
-
-«DEFINE getVisualIdMethodName FOR gmfgen::GenDiagram»getVisualID«ENDDEFINE»
-
-«DEFINE getModelID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static String «EXPAND getModelIDMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.gmf.runtime.notation.View diagram = view.getDiagram();
- while (view != diagram) {
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
- if (annotation != null) {
- return (String) annotation.getDetails().get("modelID"); «EXPAND xpt::Common::nonNLS»
- }
- view = (org.eclipse.gmf.runtime.notation.View) view.eContainer();
- }
- return diagram != null ? diagram.getType() : null;
-}
-«ENDDEFINE»
-
-«DEFINE getModelIDMethodName FOR gmfgen::GenDiagram»getModelID«ENDDEFINE»
-
-«DEFINE getVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getVisualIdMethodName»(String type) {
- try {
- return Integer.parseInt(type);
- } catch (NumberFormatException e) {
- if (Boolean.TRUE.toString().equalsIgnoreCase(org.eclipse.core.runtime.Platform.getDebugOption(DEBUG_KEY))) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to parse view type as a visualID number: " + type);
- }
- }
- «EXPAND unrecognizedVID-»
-}
-«ENDDEFINE»
-
-«REM»
- XXX getType may be optimized not to return new string each time, instead, cache known visual ids, e.g. with LinkedHashMap with removeEldestEntry?
- However, even intern() seems too much, as in most usecases returned value is not kept, and unlikely to survive Eden (or whatever name it has) heap space
-«ENDREM»
-«DEFINE getType FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-public static String «EXPAND getTypeMethodName»(int visualID) {
- return Integer.toString(visualID);
-}
-«ENDDEFINE»
-
-«DEFINE getTypeMethodName FOR gmfgen::GenDiagram»getType«ENDDEFINE»
-
-«DEFINE getDiagramVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getDiagramVisualIDMethodName»(org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «EXPAND unrecognizedVID-»
- }
-«IF null <> domainDiagramElement-»
- «EXPAND returnVisualID-»
-«ENDIF-»
- «EXPAND unrecognizedVID-»
-}
-«ENDDEFINE»
-
-«DEFINE getDiagramVisualIDMethodName FOR gmfgen::GenDiagram»getDiagramVisualID«ENDDEFINE»
-
-«DEFINE returnVisualID FOR gmfgen::GenCommonBase-»
-if («EXPAND checkSemanticElement») {
- return «EXPAND visualID»;
-}
-«ENDDEFINE»
-
-«DEFINE checkSemanticElement FOR gmfgen::GenCommonBase-»
- «ERROR 'checkSemanticElement not supported for: ' + self.repr()-»
-«ENDDEFINE»
-
-«DEFINE checkSemanticElement FOR gmfgen::GenDiagram»«EXPAND checkDomainElementMetaclass FOR domainDiagramElement» && isDiagram(«EXPAND MetaModel::CastEObject('domainElement') FOR domainDiagramElement»)«ENDDEFINE»
-«DEFINE checkSemanticElement FOR gmfgen::GenNode»«EXPAND checkDomainElementMetaclass FOR modelFacet.metaClass»«EXPAND checkDomainElementConstraints(self) FOR modelFacet»«ENDDEFINE»
-«DEFINE checkSemanticElement FOR gmfgen::GenLink»«EXPAND checkSemanticElement(self) FOR modelFacet»«ENDDEFINE»
-
-«DEFINE checkDomainElementMetaclass FOR genmodel::GenClass»«EXPAND MetaModel::MetaClass».isSuperTypeOf(domainElement.eClass())«ENDDEFINE»
-
-«REM» [ExtendedConstraint] Model selector constraint «ENDREM»
-«DEFINE checkDomainElementConstraints(commonBase : gmfgen::GenCommonBase) FOR gmfgen::TypeModelFacet-»
-«REM» [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) «ENDREM»
-«IF commonBase.oclIsTypeOf(gmfgen::GenLink)-»
-«REM» [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) «ENDREM»
-«IF null <> modelElementSelector» && «EXPAND _domainElementConstraintMethodName FOR commonBase»(«EXPAND MetaModel::CastEObject('domainElement') FOR metaClass»)«ENDIF-»
-«REM» [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) «ENDREM»
-«ELSE-»
-«IF null <> modelElementSelector» && «EXPAND _domainElementConstraintMethodName FOR commonBase»(containerView, «EXPAND MetaModel::CastEObject('domainElement') FOR metaClass»)«ENDIF-»
-«ENDIF-»
-«REM» [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) «ENDREM»
-«ENDDEFINE»
-
-«DEFINE checkSemanticElement(genLink : gmfgen::GenLink) FOR gmfgen::LinkModelFacet»«ERROR 'checkSemanticElement is supported only for TypeLinkModelFacet: ' + self.repr()»«ENDDEFINE»
-«DEFINE checkSemanticElement(genLink : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet»«EXPAND checkDomainElementMetaclass FOR metaClass»«EXPAND checkDomainElementConstraints(genLink)»«ENDDEFINE»
-
-
-«DEFINE getNodeVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getNodeVisualIDMethodName»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «EXPAND unrecognizedVID-»
- }
- String containerModelID = «EXPAND getModelIDMethodCall»(containerView);
- if (!«EXPAND modelID».equals(containerModelID)«EXPAND checkContainerModelID FOREACH shortcutsProvidedFor») { «EXPAND xpt::Common::nonNLS FOR shortcutsProvidedFor->asSequence()»
- «EXPAND unrecognizedVID-»
- }
- int containerVisualID;
- if («EXPAND modelID».equals(containerModelID)) {
- containerVisualID = «EXPAND getVisualIDMethodCall»(containerView);
- } else {
- if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- containerVisualID = «EXPAND visualID»;
- } else {
- «EXPAND unrecognizedVID-»
- }
- }
- switch (containerVisualID) {
- «EXPAND caseDomainContainerVisualID FOREACH getAllContainers()-»
- }
- «EXPAND unrecognizedVID-»
-}
-«ENDDEFINE»
-
-«DEFINE getNodeVisualIDMethodName FOR gmfgen::GenDiagram»getNodeVisualID«ENDDEFINE»
-
-«DEFINE caseDomainContainerVisualID FOR gmfgen::GenContainerBase-»
- «IF getContainedSemanticNodes(self)->size() > 0-»
-«EXPAND xpt::Common::caseVisualID»
- «EXPAND returnVisualID FOREACH getContainedSemanticNodes(self)-»
- break;
- «ENDIF-»
-«ENDDEFINE»
-
-
-«DEFINE canCreateNode FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static boolean «EXPAND canCreateNodeMethodName»(org.eclipse.gmf.runtime.notation.View containerView, int nodeVisualID) {
- String containerModelID = «EXPAND getModelIDMethodCall»(containerView);
- if (!«EXPAND modelID».equals(containerModelID)«EXPAND checkContainerModelID FOREACH shortcutsProvidedFor») { «EXPAND xpt::Common::nonNLS FOR shortcutsProvidedFor->asSequence()»
- return false;
- }
- int containerVisualID;
- if («EXPAND modelID».equals(containerModelID)) {
- containerVisualID = «EXPAND getVisualIDMethodCall»(containerView);
- } else {
- if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- containerVisualID = «EXPAND visualID»;
- } else {
- return false;
- }
- }
- switch (containerVisualID) {
- «EXPAND caseVisualID FOREACH getAllContainers()->select(e | not e.getEssentialVisualChildren()->isEmpty())-»
- «EXPAND caseVisualID FOREACH links->select(e | not e.getEssentialVisualChildren()->isEmpty())-»
- }
- return false;
-}
-«ENDDEFINE»
-
-«DEFINE canCreateNodeMethodName FOR gmfgen::GenDiagram»canCreateNode«ENDDEFINE»
-
-«DEFINE checkContainerModelID FOR String» && !"«self»".equals(containerModelID)«ENDDEFINE»
-
-«DEFINE caseVisualID FOR gmfgen::GenCommonBase-»
-«EXPAND xpt::Common::caseVisualID»
- «EXPAND checkEssentialChild FOREACH self.getEssentialVisualChildren()-»
- break;
-«ENDDEFINE»
-
-«DEFINE checkEssentialChild FOR gmfgen::GenCommonBase-»
-if («EXPAND visualID» == nodeVisualID) {
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE getLinkWithClassVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getLinkWithClassVisualIDMethodName»(org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «EXPAND unrecognizedVID-»
- }
- «EXPAND returnVisualID FOREACH links->select(isTypeLink())-»
- «EXPAND unrecognizedVID-»
-}
-«ENDDEFINE»
-
-«DEFINE getLinkWithClassVisualIDMethodName FOR gmfgen::GenDiagram»getLinkWithClassVisualID«ENDDEFINE»
-
-
-«DEFINE isDiagram FOR gmfgen::GenDiagram-»
- «IF null <> domainDiagramElement-»
- «EXPAND xpt::Common::generatedMemberComment(
- 'User can change implementation of this method to handle some specific\n' +
- 'situations not covered by default logic.\n'
- )»
-private static boolean isDiagram(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» element) {
- return true;
-}
- «ENDIF-»
-«ENDDEFINE»
-
-
-«REM»
-
- Support for extra contstraints to check about model element.
- Includes expression fields for interpreted constrains (like ocl or regexp).
- For each model element that has an associated constraint, there's a method is<DomainElement>_<UID>()
- that performs extra specification as defined by value expression
-
- FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator)
-«ENDREM»
-
-«DEFINE _constraintMethods FOR gmfgen::GenDiagram-»
-«IF null <> editorGen.expressionProviders-»
- «EXPAND _constraintMethod FOREACH topLevelNodes->select(n | n.modelFacet.modelElementSelector <> null and n.sansDomain = false)-»
- «EXPAND _constraintMethod FOREACH childNodes->select(n | n.modelFacet.modelElementSelector <> null and n.sansDomain = false)-»
- «FOREACH links AS l»«EXPAND _constraintMethod(l) FOR l.modelFacet»«ENDFOREACH»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE _constraintMethod FOR gmfgen::GenNode-»
-«EXPAND _domainElementConstraintMethod(self, modelFacet.modelElementSelector, modelFacet.metaClass) FOR modelFacet.modelElementSelector.provider»
-«ENDDEFINE»
-
-«DEFINE _constraintMethod(l : gmfgen::GenLink) FOR gmfgen::LinkModelFacet»«ENDDEFINE» // no-op
-«DEFINE _constraintMethod(l : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet-»
-«IF modelElementSelector <> null»«EXPAND _domainElementConstraintMethod(l, modelElementSelector, metaClass) FOR modelElementSelector.provider»«ENDIF-»
-«ENDDEFINE»
-
-
-«DEFINE _domainElementConstraintMethodName FOR gmfgen::GenCommonBase»is«getUniqueIdentifier()»«ENDDEFINE»
-
-«DEFINE _domainElementConstraintMethod(diagramElement : gmfgen::GenCommonBase, expression : gmfgen::ValueExpression, context : genmodel::GenClass) FOR gmfgen::GenExpressionProviderBase»«ERROR 'Constraint method is not supported for ' + self.repr()»«ENDDEFINE»
-
-«REM» [ExtendedConstraint] Model selector constraint «ENDREM»
-«DEFINE _domainElementConstraintMethod(diagramElement : gmfgen::GenCommonBase, expression : gmfgen::ValueExpression, context : genmodel::GenClass) FOR gmfgen::GenJavaExpressionProvider-»
- «EXPAND xpt::Common::generatedMemberComment»
- «REM» [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) «ENDREM»
- «IF diagramElement.oclIsTypeOf(gmfgen::GenLink)-»
- «REM» [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) «ENDREM»
- private static boolean «EXPAND _domainElementConstraintMethodName FOR diagramElement»(«EXPAND MetaModel::QualifiedClassName FOR context» domainElement) {
- «REM» [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) «ENDREM»
- «ELSE-»
- private static boolean «EXPAND _domainElementConstraintMethodName FOR diagramElement»(org.eclipse.gmf.runtime.notation.View containerView, «EXPAND MetaModel::QualifiedClassName FOR context» domainElement) {
- «ENDIF-»
- «REM» [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) «ENDREM»
-«IF injectExpressionBody and (expression.body <> null and expression.body.length() <> 0)-»
- «expression.body»
-«ELSEIF throwException or (injectExpressionBody and (expression.body = null or expression.body.length() = 0))-»
- // FIXME: implement this method
- // Ensure that you remove @generated or mark it @generated NOT
- throw new java.lang.UnsupportedOperationException("No java implementation provided in '«EXPAND _domainElementConstraintMethodName FOR diagramElement»' operation");«EXPAND xpt::Common::nonNLS»
-«ELSE-»
- return false;
-«ENDIF-»
- }
-«ENDDEFINE»
-
-// FIXME move these methods to ElementInitializers or any other more suitable place
-«DEFINE _domainElementConstraintMethod(diagramElement : gmfgen::GenCommonBase, expression : gmfgen::ValueExpression, context : genmodel::GenClass) FOR gmfgen::GenExpressionInterpreter-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static boolean «EXPAND _domainElementConstraintMethodName FOR diagramElement»(«EXPAND MetaModel::QualifiedClassName FOR context» domainElement) {
- Object result = «EXPAND xpt::expressions::getExpression::getExpression(expression, context)».evaluate(domainElement);
- return result instanceof Boolean && ((Boolean)result).booleanValue();
- }
-«ENDDEFINE»
-
-«REM»
- Constraints support end.
-«ENDREM»
-
-
-«DEFINE unrecognizedVID FOR gmfgen::GenDiagram-»
-return -1;
-«ENDDEFINE»
-
-«DEFINE checkNodeVisualIDMethodName FOR gmfgen::GenDiagram»checkNodeVisualID«ENDDEFINE»
-«DEFINE checkNodeVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND checkNodeVisualIDMethodName»«ENDDEFINE»
-
-«DEFINE checkNodeVisualID FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- public static boolean «EXPAND checkNodeVisualIDMethodName»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, int candidate) {
- if (candidate == -1){
- //unrecognized id is always bad
- return false;
- }
- «REM»For now there are only one possibility, but this may be changed in moderately near future«ENDREM»«-»
- int basic = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodName»(containerView, domainElement);
- return basic == candidate;
- }
-«ENDDEFINE»
-
-«DEFINE isCompartmentVisualIDMethodName FOR gmfgen::GenDiagram»isCompartmentVisualID«ENDDEFINE»
-«DEFINE isCompartmentVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND isCompartmentVisualIDMethodName»«ENDDEFINE»
-
-«DEFINE isCompartmentVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static boolean «EXPAND isCompartmentVisualIDMethodName»(int visualID) {
- «IF not compartments->isEmpty()-»
- switch (visualID) {
- «EXPAND xpt::Common::caseVisualID FOREACH compartments»
- return true;
- default:
- break;
- }
- «ENDIF-»
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE isSemanticLeafVisualIDMethodName FOR gmfgen::GenDiagram»isSemanticLeafVisualID«ENDDEFINE»
-«DEFINE isSemanticLeafVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND isSemanticLeafVisualIDMethodName»«ENDDEFINE»
-
-«DEFINE isSemanticLeafVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static boolean «EXPAND isSemanticLeafVisualIDMethodName»(int visualID) {
- switch (visualID) {
- «REM»We need to ensure at last one case, this is legitimate way«ENDREM»«-»
- «EXPAND xpt::Common::caseVisualID FOR self»
- return false;
- «FOREACH self.getAllNodes()->asSequence()->sortedBy(n | n.visualID) AS nextNode-»
- «IF getSemanticChildren(nextNode)->isEmpty()-»
- «IF not nextNode.oclIsKindOf(gmfgen::GenNode) or nextNode.oclAsType(gmfgen::GenNode).compartments->select(c | not getSemanticChildren(c)->isEmpty())->isEmpty()-»
- «EXPAND xpt::Common::caseVisualID FOR nextNode»
- «ENDIF-»
- «ENDIF-»
- «ENDFOREACH-»
- return true;
- default:
- break;
- }
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE runtimeTypedInstanceName FOR gmfgen::GenDiagram»TYPED_INSTANCE«ENDDEFINE»
-«DEFINE runtimeTypedInstanceCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND runtimeTypedInstanceName»«ENDDEFINE»
-
-«DEFINE runtimeTypedInstance FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
- public static final org.eclipse.gmf.tooling.runtime.structure.DiagramStructure «EXPAND runtimeTypedInstanceName» = new org.eclipse.gmf.tooling.runtime.structure.DiagramStructure() {
- «EXPAND xpt::Common::generatedMemberComment»
- «EXPAND CodeStyle::override»
- public int «EXPAND xpt::editor::VisualIDRegistry::getVisualIdMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- return «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- «EXPAND CodeStyle::override»
- public String «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- return «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- «EXPAND CodeStyle::override»
- public int «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodName»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
- return «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(containerView, domainElement);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- «EXPAND CodeStyle::override»
- public boolean «EXPAND checkNodeVisualIDMethodName»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, int candidate) {
- return «EXPAND checkNodeVisualIDMethodCall»(containerView, domainElement, candidate);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- «EXPAND CodeStyle::override»
- public boolean «EXPAND isCompartmentVisualIDMethodName»(int visualID) {
- return «EXPAND isCompartmentVisualIDMethodCall»(visualID);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- «EXPAND CodeStyle::override»
- public boolean «EXPAND isSemanticLeafVisualIDMethodName»(int visualID) {
- return «EXPAND isSemanticLeafVisualIDMethodCall»(visualID);
- }
- };
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/7d/7d6dca497cf17f43bbc232b272eb3f8b4162fcfe.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/7d/7d6dca497cf17f43bbc232b272eb3f8b4162fcfe.svn-base
deleted file mode 100644
index cde5e12ddf2..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/7d/7d6dca497cf17f43bbc232b272eb3f8b4162fcfe.svn-base
+++ /dev/null
@@ -1,594 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Emilien Perico (Atos Origin) - add code to refactor some classes
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«EXTENSION xpt::editor::Utils»
-
-
-«AROUND Editor FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «className» extends org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor«EXPAND implementsList FOR getEditorImplementsList(self)» {
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND getContextID-»
- «EXPAND createPaletteRoot FOR editorGen.diagram.palette-»
-
- «EXPAND getPreferencesHint-»
-
- «EXPAND getContributorId-»
- «EXPAND getAdapter-»
-
- «EXPAND getDocumentProvider-»
-
- «EXPAND getEditingDomain-»
-
- «EXPAND setDocumentProvider-»
- «IF isIDEMode(self)-»
-
- «EXPAND gotoMarker-»
-
- «EXPAND isSaveAsAllowed-»
-
- «EXPAND doSaveAs-»
-
- «EXPAND performSaveAs-»
-
- «EXPAND getShowInContext-»
- «EXPAND getNavigatorSelection FOR editorGen.navigator-»
- «ENDIF-»
-
- «EXPAND configureGraphicalViewer-»
-
- «IF editorGen.diagram.generateCreateShortcutAction()-»
-
- «EXPAND initializeGraphicalViewer-»
-
- «EXPAND DropTargetListener-»
- «ENDIF-»
-
- «EXPAND additions-»
-}
-«ENDAROUND»
-
-«DEFINE attributes FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static final String ID = "«iD»"; «EXPAND xpt::Common::nonNLS»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public static final String CONTEXT_ID = "«contextID»"; «EXPAND xpt::Common::nonNLS»
-
-
- «REM»Documentation. adds listener for papyrus editors«ENDREM»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.KeyHandler paletteKeyHandler = null;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.swt.events.MouseListener paletteMouseListener = null;
-
- «REM»Helps to handle correctly the dirty state«ENDREM»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.core.commands.operations.IUndoableOperation savedOperation = null;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider documentProvider;
-
-
- «REM»«ENDREM»
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «className»(org.eclipse.papyrus.infra.core.services.ServicesRegistry servicesRegistry, org.eclipse.gmf.runtime.notation.Diagram diagram) throws org.eclipse.papyrus.infra.core.services.ServiceException{
- super(servicesRegistry, diagram);
-
- «REM»Documentation. adds listener for papyrus palette service«ENDREM»
- // adds a listener to the palette service, which reacts to palette customizations
- org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.getInstance().addProviderChangeListener(this);
-
- «REM»Share the same editing domain«ENDREM»
- // Share the same editing provider
- editingDomain = servicesRegistry.getService(org.eclipse.emf.transaction.TransactionalEditingDomain.class);
- documentProvider = new org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider(editingDomain);
-
- // overrides editing domain created by super constructor
- setDocumentProvider(documentProvider);
-
- «REM»end of listeners addition«ENDREM»
- }
-«ENDDEFINE»
-
-«DEFINE createPaletteRoot FOR gmfgen::Palette-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot(org.eclipse.gef.palette.PaletteRoot existingPaletteRoot) {
- org.eclipse.gef.palette.PaletteRoot paletteRoot;
- if (existingPaletteRoot == null) {
- paletteRoot = org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent());
- } else {
- org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent());
- paletteRoot = existingPaletteRoot;
- }
- applyCustomizationsToPalette(paletteRoot);
- return paletteRoot;
- }
-«ENDDEFINE»
-
-«DEFINE createPaletteCustomizer FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.ui.palette.PaletteCustomizer createPaletteCustomizer() {
- return new org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteCustomizer(getPreferenceStore());
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenEditorView-»
-
- «EXPAND createEditingDomain-»
-
- «EXPAND configureDiagramEditDomain-»
-
- «EXPAND doSave-»
-
- «EXPAND isDirty-»
-
- «REM»Documentation. adds method to handle palette changes«ENDREM»
- «EXPAND handlePaletteChange-»
-
- «EXPAND dispose-»
-
- «EXPAND getPaletteViewer-»
-
- «REM»Documentation: (RS) advanced customization abilities
- «EXPAND createPaletteCustomizer-»
- «ENDREM»
-
- «EXPAND constructPaletteViewer -»
-
- «EXPAND createPaletteviewerProvider-»
-
- «EXPAND getGraphicalViewer-»
-
- «EXPAND initializeGraphicalViewer-»
-
- «EXPAND selectionChanged-»
-«ENDDEFINE»
-
-«DEFINE handlePaletteChange FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void providerChanged(org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent event) {
- // update the palette if the palette service has changed
- if (org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.getInstance().equals(event.getSource())) {
- org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this,
- getDefaultPaletteContent());
- }
- }
-«ENDDEFINE»
-
-«DEFINE constructPaletteViewer FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.ui.palette.PaletteViewer constructPaletteViewer() {
- return new org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteViewer();
- }
-«ENDDEFINE»
-
-«DEFINE dispose FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void dispose() {
- // remove palette service listener
- // remove preference listener
- org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
-
- super.dispose();
- }
-«ENDDEFINE»
-
-«DEFINE getPaletteViewer FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.ui.palette.PaletteViewer getPaletteViewer() {
- return getEditDomain().getPaletteViewer();
- }
-«ENDDEFINE»
-
-«DEFINE implementsList FOR Sequence(String)-»
- implements org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener
-«IF not self->isEmpty()», «EXPAND implementsListEntry FOREACH self SEPARATOR ', '»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE implementsListEntry FOR String»«self»«ENDDEFINE»
-
-«DEFINE createPaletteviewerProvider FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerProvider() {
- getEditDomain().setPaletteRoot(createPaletteRoot(null));
- return new org.eclipse.gef.ui.palette.PaletteViewerProvider(getEditDomain()) {
-
- /**
- * Override to provide the additional behavior for the tools. Will intialize with a
- * PaletteEditPartFactory that has a TrackDragger that understand how to handle the
- * mouseDoubleClick event for shape creation tools. Also will initialize the palette
- * with a defaultTool that is the SelectToolEx that undestands how to handle the enter
- * key which will result in the creation of the shape also.
- */
- protected void configurePaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer viewer) {
- super.configurePaletteViewer(viewer);
-
- // customize menu...
- viewer.setContextMenu(new org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteContextMenuProvider(viewer));
-
- viewer.getKeyHandler().setParent(getPaletteKeyHandler());
- viewer.getControl().addMouseListener(getPaletteMouseListener());
-
- // Add a transfer drag target listener that is supported on
- // palette template entries whose template is a creation tool.
- // This will enable drag and drop of the palette shape creation
- // tools.
- viewer.addDragSourceListener(new org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener(viewer));
- viewer.setCustomizer(createPaletteCustomizer());
- }
-
- public org.eclipse.gef.ui.palette.PaletteViewer createPaletteViewer(org.eclipse.swt.widgets.Composite parent) {
- org.eclipse.gef.ui.palette.PaletteViewer pViewer = constructPaletteViewer();
- pViewer.createControl(parent);
- configurePaletteViewer(pViewer);
- hookPaletteViewer(pViewer);
- return pViewer;
- }
-
- /**
- * @return Palette Key Handler for the palette
- */
- private org.eclipse.gef.KeyHandler getPaletteKeyHandler() {
-
- if (paletteKeyHandler == null) {
-
- paletteKeyHandler = new org.eclipse.gef.KeyHandler() {
-
- /**
- * Processes a <i>key released </i> event. This method is called by the Tool
- * whenever a key is released, and the Tool is in the proper state. Override
- * to support pressing the enter key to create a shape or connection
- * (between two selected shapes)
- *
- * @param event
- * the KeyEvent
- * @return <code>true</code> if KeyEvent was handled in some way
- */
- public boolean keyReleased(org.eclipse.swt.events.KeyEvent event) {
-
- if (event.keyCode == org.eclipse.swt.SWT.Selection) {
-
- org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool();
-
- if (toolSupportsAccessibility(tool)) {
-
- tool.keyUp(event, getDiagramGraphicalViewer());
-
- // deactivate current selection
- getPaletteViewer().setActiveTool(null);
-
- return true;
- }
-
- }
- return super.keyReleased(event);
- }
-
- };
-
- }
- return paletteKeyHandler;
- }
-
- /**
- * @return Palette Mouse listener for the palette
- */
- private org.eclipse.swt.events.MouseListener getPaletteMouseListener() {
-
- if (paletteMouseListener == null) {
-
- paletteMouseListener = new org.eclipse.swt.events.MouseListener() {
-
- /**
- * Flag to indicate that the current active tool should be cleared after a
- * mouse double-click event.
- */
- private boolean clearActiveTool = false;
-
- /**
- * Override to support double-clicking a palette tool entry to create a
- * shape or connection (between two selected shapes).
- *
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) {
- org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool();
-
- if (toolSupportsAccessibility(tool)) {
-
- tool.setViewer(getDiagramGraphicalViewer());
- tool.setEditDomain(getDiagramGraphicalViewer().getEditDomain());
- tool.mouseDoubleClick(e, getDiagramGraphicalViewer());
-
- // Current active tool should be deactivated,
- // but if it is down here it will get
- // reactivated deep in GEF palette code after
- // receiving mouse up events.
- clearActiveTool = true;
- }
- }
-
- public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
- // do nothing
- }
-
- public void mouseUp(org.eclipse.swt.events.MouseEvent e) {
- // Deactivate current active tool here if a
- // double-click was handled.
- if (clearActiveTool) {
- getPaletteViewer().setActiveTool(null);
- clearActiveTool = false;
- }
-
- }
- };
-
- }
- return paletteMouseListener;
- }
-
- };
- }
-«ENDDEFINE»
-
-«REM»Not used«ENDREM»
-«DEFINE performSaveAs FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- // Nothing
-}
-«ENDDEFINE»
-
-«REM»Share the same editing domain«ENDREM»
-«DEFINE getEditingDomain FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- return editingDomain;
- }
-«ENDDEFINE»
-
-«DEFINE createEditingDomain FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() {
- // Already configured
- return editingDomain;
- }
-«ENDDEFINE»
-
-
-«DEFINE configureDiagramEditDomain FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::generatedMemberComment»
- protected void configureDiagramEditDomain() {
- super.configureDiagramEditDomain();
- getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new org.eclipse.gef.commands.CommandStackListener() {
-
- public void commandStackChanged(java.util.EventObject event) {
- firePropertyChange( org.eclipse.ui.IEditorPart.PROP_DIRTY);
- }
- });
- }
-«ENDDEFINE»
-
-«DEFINE doSave FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::generatedMemberComment»
- public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- // The saving of the resource is done by the CoreMultiDiagramEditor
- savedOperation = getOperationHistory().getUndoOperation(getUndoContext());
- }
-«ENDDEFINE»
-
-«REM»Fix the dirty state«ENDREM»
-«DEFINE isDirty FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::generatedMemberComment»
- public boolean isDirty() {
- org.eclipse.core.commands.operations.IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext());
- return savedOperation != op;
- }
-«ENDDEFINE»
-
-«REM»Code refactoring moved in UMLDiagramEditor«ENDREM»
-«DEFINE getDocumentProvider FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider getDocumentProvider(org.eclipse.ui.IEditorInput input) {
- return documentProvider;
- }
-«ENDDEFINE»
-
-«DEFINE setDocumentProvider FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected final void setDocumentProvider(org.eclipse.ui.IEditorInput input) {
- // Already set in the constructor
- }
-«ENDDEFINE»
-
-«DEFINE getGraphicalViewer FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::generatedMemberComment»
- @Override
- public org.eclipse.gef.GraphicalViewer getGraphicalViewer() {
- return super.getGraphicalViewer();
- }
-«ENDDEFINE»
-
-
-«DEFINE initializeGraphicalViewer FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::generatedMemberComment»
- @Override
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
-
- // Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(
- new org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener(getDiagramGraphicalViewer(), org.eclipse.jface.util.LocalSelectionTransfer.getTransfer()) {
-
- @Override
- protected Object getJavaObject(org.eclipse.swt.dnd.TransferData data) {
- return LocalSelectionTransfer.getTransfer().nativeToJava(data);
- }
-
- @Override
- protected org.eclipse.emf.transaction.TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
-
- }
-«ENDDEFINE»
-
-«DEFINE selectionChanged FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::generatedMemberComment»
- @Override
- public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) {
- if (getSite().getPage().getActiveEditor() instanceof org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor) {
- org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor editor = (org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor) getSite().getPage().getActiveEditor();
- // If not the active editor, ignore selection changed.
- if (this.equals(editor.getActiveEditor())) {
- updateActions(getSelectionActions());
- super.selectionChanged(part, selection);
- } else {
- super.selectionChanged(part, selection);
- }
- } else {
- super.selectionChanged(part, selection);
- }
- // from
- // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart,
- // ISelection)
- if (part == this) {
- rebuildStatusLine();
- }
- }
-«ENDDEFINE»
-
-«DEFINE getContextID FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected String getContextID() {
- return CONTEXT_ID;
-}
-«ENDDEFINE»
-
-«DEFINE getPreferencesHint FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint getPreferencesHint() {
-«REM»
- XXX seems better we use preference store directly (in configureGraphicalViewer) instead all these indirect ids
-«ENDREM»«-»
- return «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»;
-}
-«ENDDEFINE»
-
-«DEFINE getContributorId FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getContributorId() {
- return «editorGen.plugin.getActivatorQualifiedClassName()».ID;
-}
-«ENDDEFINE»
-
-«DEFINE getAdapter FOR gmfgen::GenEditorView-»
- «IF not hasPropertySheet(self) or hasNavigator(self)-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public Object getAdapter(Class type) {
- «IF not hasPropertySheet(self)-»
- if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) {
- return null;
- }
- «ENDIF-»
- «IF hasNavigator(self)-»
- if (type == org.eclipse.ui.part.IShowInTargetList.class) {
- return new org.eclipse.ui.part.IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID };
- }
- };
- }
- «ENDIF-»
- return super.getAdapter(type);
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE gotoMarker FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void gotoMarker(org.eclipse.core.resources.IMarker marker) {
- org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService.getInstance().gotoMarker(this, marker);
-}
-«ENDDEFINE»
-
-«DEFINE isSaveAsAllowed FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isSaveAsAllowed() {
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE doSaveAs FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void doSaveAs() {
- performSaveAs(new org.eclipse.core.runtime.NullProgressMonitor());
-}
-«ENDDEFINE»
-
-«DEFINE getShowInContext FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.ui.part.ShowInContext getShowInContext() {
- return new org.eclipse.ui.part.ShowInContext(getEditorInput(), «IF hasNavigator(self)»getNavigatorSelection()«ELSE»getGraphicalViewer().getSelection()«ENDIF»);
-}
-«ENDDEFINE»
-«DEFINE getNavigatorSelection FOR gmfgen::GenNavigator-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.jface.viewers.ISelection getNavigatorSelection() {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument();
- «EXPAND xpt::navigator::NavigatorLinkHelper::findSelectionBody-»
-}
-«ENDDEFINE»
-«DEFINE configureGraphicalViewer FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void configureGraphicalViewer() {
- super.configureGraphicalViewer();
- «EXPAND xpt::editor::DiagramEditorContextMenuProvider::qualifiedClassName FOR editorGen.diagram» provider =
- new «EXPAND xpt::editor::DiagramEditorContextMenuProvider::qualifiedClassName FOR editorGen.diagram»(this, getDiagramGraphicalViewer());
- getDiagramGraphicalViewer().setContextMenu(provider);
- getSite().registerContextMenu(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
- }
-«ENDDEFINE»
-
-«DEFINE DropTargetListener FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedClassComment»
-private abstract class DropTargetListener extends org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener {
-
- «EXPAND DTL_constructor-»
-
- «EXPAND DTL_getObjectsBeingDropped-»
-
- «EXPAND DTL_getJavaObject-»
-
- «EXPAND DTL_additions-»
-}
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/82/82a84bec6211ec021be7c1f271748ac850d85672.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/82/82a84bec6211ec021be7c1f271748ac850d85672.svn-base
deleted file mode 100644
index 063ddf4759f..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/82/82a84bec6211ec021be7c1f271748ac850d85672.svn-base
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»Dthis template changes only the define implementsList line 64«ENDREM»
-
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE Main FOR gmfgen::GenChildLabelNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::contsructor-»
-
- «EXPAND getDragTracker-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::TextAware::methods(false, labelReadOnly, labelElementIcon, viewmap, labelModelFacet, self, getDiagram())-»
-
- «EXPAND xpt::diagram::editparts::Common::notationalListeners-»
-
-«IF getAssistantOutgoingLinks(self)->size() > 0-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnSource-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnSourceAndTarget-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMATypesForTarget-»
-«ENDIF-»
-
-«IF getAssistantIncomingLinks(self)->size() > 0-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnTarget-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMATypesForSource-»
-«ENDIF-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenChildLabelNode»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Add own extension«ENDREM»
-«IF papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null)->size()<>0»
- extends «FOREACH papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null) AS extendedObject»«EXPAND specifyInheritance FOR extendedObject»«ENDFOREACH-»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-«ELSE»
- extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart
-«ENDIF»
-«ENDDEFINE»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»definition of the inheritance «ENDREM»
-«DEFINE specifyInheritance FOR papyrusgmfgenextension::ExtendedGenView-»«superOwnedEditPart»«ENDDEFINE»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-«DEFINE implementsList FOR gmfgen::GenChildLabelNode»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR self-»
-
- «EXPAND impl::diagram::editparts::TextAware::fields FOR self-»
-«ENDDEFINE»
-
-«DEFINE getDragTracker FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request) {
- «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::getDragTrackerBody-»
-}
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::createDefaultEditPoliciesBody-»
-}
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::handleNotificationEventBody-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenChildLabelNode»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8a/8a48c6e4f72f76dbe242ac74d66e00b4f5b82873.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8a/8a48c6e4f72f76dbe242ac74d66e00b4f5b82873.svn-base
deleted file mode 100644
index af3243fbe9e..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8a/8a48c6e4f72f76dbe242ac74d66e00b4f5b82873.svn-base
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2007, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::Utils»
-
-«DEFINE extensions FOR gmfgen::GenDiagram-»
-
- <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <viewProvider class="«getNotationViewProviderQualifiedClassName()»">
- <Priority name="«notationViewProviderPriority»"/>
-«IF shortcutsProvidedFor->notEmpty() /*allow provider activation when another diagram tries to create a node, perhaps ours*/-»
- <object id="referencing-diagrams" class="org.eclipse.gmf.runtime.notation.Diagram">
- <method name="getType()" value="«FOREACH shortcutsProvidedFor AS s SEPARATOR ','»«s»«ENDFOREACH»"/>
- </object>
- <context viewClass="org.eclipse.gmf.runtime.notation.Node" containerViews="referencing-diagrams"/>
-«ENDIF-»
- <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="«editorGen.modelID»"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="«FOREACH getAllNodes() /*XXX can further improve selection using containerViews attribute, however, when top-node is created, provider is activated and this xml is not consulted any longer*/ AS n SEPARATOR ','»«n.visualID»«ENDFOREACH»"/>
-«IF links->notEmpty() /*it is unlikely there would be a diagram without a node, but a diagram without links deemed possible */-»
- <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="«FOREACH links AS l SEPARATOR ','»«l.visualID»«ENDFOREACH»"/>
-«ENDIF-»
- </viewProvider>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <editpartProvider class="«getEditPartProviderQualifiedClassName()»">
- <Priority name="«editPartProviderPriority»"/>
- <object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram">
- <method name="getType()" value="«editorGen.modelID»"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes">
- <method name="getType()" value="«FOREACH getAllNodes() AS n SEPARATOR ','»«n.visualID»«ENDFOREACH»"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links">
- <method name="getType()" value="«FOREACH links AS l SEPARATOR ','»«l.visualID»«ENDFOREACH»"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels">
- <method name="getType()" value="«FOREACH getAllNodes().labels AS lb SEPARATOR ','»«lb.visualID»«ENDFOREACH»"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments">
- <method name="getType()" value="«FOREACH compartments AS c SEPARATOR ','»«c.visualID»«ENDFOREACH»"/>
- </object>
- <context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/>
- </editpartProvider>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders" id="modelassist-provider">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <modelingAssistantProvider class="«getModelingAssistantProviderQualifiedClassName()»">
- <Priority name="«modelingAssistantProviderPriority»"/>
- <object class="«getEditPartQualifiedClassName()»" id="«getUniqueIdentifier()»"/>
-«FOREACH topLevelNodes AS n-»
- <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/>
-«ENDFOREACH-»
-«FOREACH childNodes AS n-»
- <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/>
-«ENDFOREACH-»
- <context elements="«getUniqueIdentifier()»,«FOREACH topLevelNodes AS n SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOREACH»,«FOREACH childNodes AS n SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOREACH»"/>
- </modelingAssistantProvider>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <IconProvider class="«getIconProviderQualifiedClassName()»">
- <Priority name="«iconProviderPriority»"/>
- </IconProvider>
- </extension>
-«IF editorGen.labelParsers <> null and editorGen.labelParsers.extensibleViaService»
- <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <ParserProvider class="«editorGen.labelParsers.getQualifiedClassName()»">
- <Priority name="«editorGen.labelParsers.providerPriority»"/>
- </ParserProvider>
- </extension>
-«ENDIF-»
-«IF generateShortcutIcon()»
- <extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders" id="decorator-provider">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <decoratorProvider class="«getShortcutsDecoratorProviderQualifiedClassName()»">
- <Priority name="«shortcutsDecoratorProviderPriority»"/>
- <object class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)" id="generated-top-nodes">
- <method name="getType()" value="«FOREACH topLevelNodes->asSequence() /*generated code supports shortcuts only to top-level nodes*/ AS n SEPARATOR ','»«n.visualID»«ENDFOREACH»"/>
- </object>
- <context decoratorTargets="generated-top-nodes"/>
- </decoratorProvider>
- </extension>
-«ENDIF-»
-
- <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«FOREACH getAllTypedElements() AS e-»
-«EXPAND elementTypeSafe FOR e.elementType-»
-«ENDFOREACH-»
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings">
- «EXPAND xpt::Common::xmlGeneratedTag»
- «IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()<1»
- <clientContext id="«editorGen.plugin.iD».TypeContext">
- <enablement>
- <test
- property="org.eclipse.gmf.runtime.emf.core.editingDomain"
- value="«editingDomainID»"/>
- </enablement>
- </clientContext>
- <binding context="«editorGen.plugin.iD».TypeContext">
- «ENDIF»
- «IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()>0»
- <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
- «ENDIF»
-«FOREACH getAllTypedElements() AS e-»
- <elementType ref="«e.elementType.uniqueIdentifier»"/>
-«ENDFOREACH-»
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
- </binding>
- </extension>
-«ENDDEFINE»
-
-«DEFINE elementTypeSafe FOR gmfgen::ElementType-»
-«IF not definedExternally-»
-«EXPAND elementType-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE elementType FOR gmfgen::ElementType»
-«ERROR 'Unknown element type: ' + self.repr()»
-«ENDDEFINE»
-
-«DEFINE elementType FOR gmfgen::MetamodelType-»
- <metamodel nsURI="«getMetaClass().genPackage.ecorePackage.nsURI»">
- <metamodelType
- id="«uniqueIdentifier»"
-«IF null <> displayName-»
- name="%metatype.name.«diagramElement.getUniqueIdentifier()»"
-«ENDIF-»
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="«getMetaClass().ecoreClass.name»"
- edithelper="«getEditHelperQualifiedClassName()»">
- <param name="semanticHint" value="«diagramElement.visualID»"/>
- </metamodelType>
- </metamodel>
-«ENDDEFINE»
-
-«DEFINE elementType FOR gmfgen::SpecializationType-»
-«IF null = getMetamodelClass()-»
-«EXPAND specializationType-»
-«ELSE-»
- <metamodel nsURI="«getMetamodelClass().genPackage.ecorePackage.nsURI»">
-«EXPAND specializationType-»
- </metamodel>
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE specializationType FOR gmfgen::SpecializationType-»
- <specializationType
- id="«uniqueIdentifier»"
-«IF null <> displayName-»
- name="%metatype.name.«diagramElement.getUniqueIdentifier()»"
-«ENDIF-»
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"«IF editHelperAdviceClassName <> null»
- edithelperadvice="«getEditHelperAdviceQualifiedClassName()»"«ENDIF»>
- <specializes id="«(if null = metamodelType then 'org.eclipse.gmf.runtime.emf.type.core.null' else metamodelType.uniqueIdentifier endif)»"/>
- <param name="semanticHint" value="«diagramElement.visualID»"/>
- </specializationType>
-«ENDDEFINE»
-
-«DEFINE elementType FOR gmfgen::NotationType-»
- <specializationType
- id="«uniqueIdentifier»"
-«IF null <> displayName-»
- name="%metatype.name.«diagramElement.getUniqueIdentifier()»"
-«ENDIF-»
- kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="«diagramElement.visualID»"/>
- </specializationType>
-«ENDDEFINE»
-
-«DEFINE i18n FOR gmfgen::GenDiagram-»
-
-# Providers
-«EXPAND internal_i18n FOREACH getAllTypedElements().elementType»
-«ENDDEFINE»
-
-«DEFINE internal_i18n FOR gmfgen::ElementType-»
-«IF null <> displayName and not definedExternally»metatype.name.«diagramElement.getUniqueIdentifier()»=«displayName»«ENDIF»
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8a/8a9fdb76c0cf294c4d296302d9ff598f69f9c942.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8a/8a9fdb76c0cf294c4d296302d9ff598f69f9c942.svn-base
deleted file mode 100644
index 44861a7ba45..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8a/8a9fdb76c0cf294c4d296302d9ff598f69f9c942.svn-base
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2006, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE visualIDConstant FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static final int VISUAL_ID = «visualID»;
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::GenCommonBase-»
- «EXPAND behaviour FOREACH behaviour-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::Behaviour-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::CustomBehaviour-»
-«IF editPolicyQualifiedClassName = null or editPolicyQualifiedClassName.trim().size() = 0-»
- removeEditPolicy(«key»); «IF key.startsWith('\"') and key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ELSE-»
- installEditPolicy(«key», new «getEditPolicyQualifiedClassName()»()); «IF key.startsWith('\"') and key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::OpenDiagramBehaviour-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.OPEN_ROLE,
- new «getEditPolicyQualifiedClassName()»());
-«ENDDEFINE»
-
-«DEFINE labelFigure FOR gmfgen::ParentAssignedViewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- // Parent should assign one using «EXPAND impl::diagram::editparts::TextAware::labelSetterName»() method
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE labelFigure FOR gmfgen::Viewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- org.eclipse.draw2d.IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigurePrim() {
- «EXPAND labelFigurePrim FOR self-»
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::FigureViewmap-»
-«IF figureQualifiedClassName = null-»
- return new org.eclipse.draw2d.Label();
-«ELSE-»
- return new «figureQualifiedClassName»();
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::SnippetViewmap-»
- return «body»;
- }
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::InnerClassViewmap-»
- return new «className»();
- }
-
- «classBody»
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::Viewmap-»
- «ERROR 'Unknown viewmap: ' + self.repr()-»
- }
-«ENDDEFINE»
-
-«DEFINE notationalListeners FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); «EXPAND xpt::Common::nonNLS»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); «EXPAND xpt::Common::nonNLS»
- }
-«ENDDEFINE»
-
-«DEFINE handleBounds FOR gmfgen::GenCommonBase-»
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
- refreshBounds();
- }
-«ENDDEFINE»
-
-«DEFINE handleText FOR gmfgen::GenCommonBase-»
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry.getInstance().getColor(c));
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
- org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser modelParser =
- (org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE installSemanticEditPolicy FOR gmfgen::GenCommonBase-»
- «IF sansDomain-»
-removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE);
- «ELSE-»
-installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «getItemSemanticEditPolicyQualifiedClassName()»());
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE installCanonicalEditPolicy FOR gmfgen::GenContainerBase-»
- «IF needsCanonicalEditPolicy()-»
-installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»());
- «ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/97/97d26d80a17575cffbd4c3200f4e884e1aca8f60.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/97/97d26d80a17575cffbd4c3200f4e884e1aca8f60.svn-base
deleted file mode 100644
index 8446696d89f..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/97/97d26d80a17575cffbd4c3200f4e884e1aca8f60.svn-base
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Modified by Patrick Tessier (CEA LIST)
- * Emilien Perico (Atos Origin) - update template for GMF 2.2 compliance
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::navigator::Utils»
-«EXTENSION gmf::CodeGenerationUtils»
-«DEFINE NavigatorContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-«EXPAND xpt::Common::generatedClassComment»
-public class «contentProviderClassName» implements org.eclipse.ui.navigator.ICommonContentProvider {
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
- «EXPAND genAllMethodNodeCase-»
- «EXPAND iContentProvider-»
-
- «EXPAND iStructuredContentProvider-»
-
- «EXPAND iMementoAware-»
-
- «EXPAND iCommonContentProvider-»
-
- «EXPAND iTreeContentProvider-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private static final Object[] EMPTY_ARRAY = new Object[0];
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.jface.viewers.Viewer myViewer;
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain myEditingDomain;
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.workspace.util.WorkspaceSynchronizer myWorkspaceSynchronizer;
- «EXPAND xpt::Common::generatedMemberComment»
-private Runnable myViewerRefreshRunnable;
-«ENDDEFINE»
-«DEFINE _constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-«EXPAND CodeStyle::SuppressWarnings('{ "unchecked", "serial", "rawtypes" }') FOR editorGen.diagram-»
-public «contentProviderClassName»() {
- «EXPAND initCommonAttributes-»
-}
-«ENDDEFINE»
-«DEFINE initCommonAttributes FOR gmfgen::GenNavigator-»
-org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «EXPAND createEditingDomain»;
-myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain;
-myEditingDomain.setResourceToReadOnlyMap(new java.util.HashMap() {
- public Object get(Object key) {
- if (!containsKey(key)) {
- put(key, Boolean.TRUE);
- }
- return super.get(key);
- }
-});
-myViewerRefreshRunnable = new Runnable() {
- public void run() {
- if (myViewer != null) {
- myViewer.refresh();
- }
- }
-};
-myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() {
- public void dispose() {
- }
- public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
- «EXPAND processChanges-»
- }
-
- public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
- «EXPAND processChanges-»
- }
-
- public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
- «EXPAND processChanges-»
- }
-});
-«ENDDEFINE»
-«DEFINE processChanges FOR gmfgen::GenNavigator-»
-for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- nextResource.unload();
-}
-if (myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
-}
-return true;
-«ENDDEFINE»
-«DEFINE iContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND dispose-»
-
- «EXPAND inputChanged-»
-«ENDDEFINE»
-«DEFINE dispose FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
- myWorkspaceSynchronizer.dispose();
- myWorkspaceSynchronizer = null;
- myViewerRefreshRunnable = null;
- for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- resource.unload();
- }
- ((org.eclipse.emf.transaction.TransactionalEditingDomain) myEditingDomain).dispose();
- myEditingDomain = null;
-}
-«ENDDEFINE»
-«DEFINE inputChanged FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
- myViewer = viewer;
-}
-«ENDDEFINE»
-«DEFINE iStructuredContentProvider FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
-}
-«ENDDEFINE»
-«DEFINE iMementoAware FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public void restoreState(org.eclipse.ui.IMemento aMemento) {
-}
-«EXPAND xpt::Common::generatedMemberComment»
-public void saveState(org.eclipse.ui.IMemento aMemento) {
-}
-«ENDDEFINE»
-«DEFINE iCommonContentProvider FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
-}
-«ENDDEFINE»
-«DEFINE iTreeContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND getChildren-»
-
- «EXPAND getParent-»
-
- «EXPAND hasChildren-»
-«ENDDEFINE»
-«DEFINE getChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof org.eclipse.core.resources.IFile) {
- «EXPAND getFileChildren-»
- }
-
- if (parentElement instanceof «getNavigatorGroupQualifiedClassName()») {
- «EXPAND getGroupChildren-»
- }
-
- if (parentElement instanceof «getNavigatorItemQualifiedClassName()») {
- «EXPAND getItemChildren-»
- }
-
- «IF editorGen.diagram.generateShortcutIcon()-»
- «EXPAND getAdaptableChildren»
- «ENDIF-»
- «EXPAND getOtherChildren-»
-}
-
- «EXPAND getViewChildren-»
-
- «EXPAND utilityMethods-»
-«ENDDEFINE»
-«DEFINE getParent FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object getParent(Object element) {
- if (element instanceof «getAbstractNavigatorItemQualifiedClassName()») {
- «getAbstractNavigatorItemQualifiedClassName()» abstractNavigatorItem = («getAbstractNavigatorItemQualifiedClassName()») element;
- return abstractNavigatorItem.getParent();
- }
- return null;
-}
-«ENDDEFINE»
-«DEFINE hasChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public boolean hasChildren(Object element) {
- return element instanceof org.eclipse.core.resources.IFile || getChildren(element).length > 0;
-}
-«ENDDEFINE»
-«DEFINE getFileChildren FOR gmfgen::GenNavigator-»
- «EXPAND getFileResoruce-»
-java.util.Collection result = new java.util.ArrayList();
- «LET getChildReferencesFrom(self, null) AS _references-»
- «EXPAND initGroupVariables(self, _references, 'file', null) FOREACH getGroupNames(_references)-»
- «FOREACH _references AS ref-»
- «EXPAND addNavigatorItemsPrefix FOR ref»selectViewsByType(resource.getContents(), «EXPAND getChildViewType FOR ref.child»)«EXPAND addNavigatorItemsSuffix('file', false) FOR ref-»
- «ENDFOREACH-»
- «EXPAND addGroups(_references) FOREACH getGroupNames(_references)-»
- «ENDLET-»
-return result.toArray();
-«ENDDEFINE»
-«DEFINE getFileResoruce FOR gmfgen::GenNavigator-»
-org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) parentElement;
-org.eclipse.emf.common.util.URI fileURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
-org.eclipse.emf.ecore.resource.Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
-«ENDDEFINE»
-«DEFINE getGroupChildren FOR gmfgen::GenNavigator-»
-«getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») parentElement;
-return group.getChildren();
-«ENDDEFINE»
-«DEFINE getItemChildren FOR gmfgen::GenNavigator-»
-«getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») parentElement;
-if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
- return EMPTY_ARRAY;
-}
-return getViewChildren(navigatorItem.getView(), parentElement);
-«ENDDEFINE»
-«DEFINE getAdaptableChildren FOR gmfgen::GenNavigator-»
-/*
- * Due to plugin.xml restrictions this code will be called only for views representing
- * shortcuts to this diagram elements created on other diagrams.
-*/
-if (parentElement instanceof org.eclipse.core.runtime.IAdaptable) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) parentElement).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- if (view != null) {
- return getViewChildren(view, parentElement);
- }
-}
-«ENDDEFINE»
-«DEFINE getOtherChildren FOR gmfgen::GenNavigator-»
-return EMPTY_ARRAY;
-«ENDDEFINE»
-«DEFINE getViewChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) {
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM» Restructuration of the case «ENDREM»
- «EXPAND caseNavigatorNode(self) FOREACH getNavigatorContainerNodes(self)-»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- }
- return EMPTY_ARRAY;
-}
-«ENDDEFINE»
-«DEFINE utilityMethods FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getLinksSourceByType(java.util.Collection edges, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- org.eclipse.gmf.runtime.notation.View nextEdgeSource = nextEdge.getSource();
- if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
- result.add(nextEdgeSource);
- }
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
- private java.util.Collection getLinksTargetByType(java.util.Collection edges, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- org.eclipse.gmf.runtime.notation.View nextEdgeTarget = nextEdge.getTarget();
- if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
- result.add(nextEdgeTarget);
- }
- }
- return result;
-}
-«EXPAND xpt::Common::generatedMemberComment»
- private java.util.Collection getOutgoingLinksByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getIncomingLinksByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getChildrenByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getChildren(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getDiagramLinksByType(java.util.Collection diagrams, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = diagrams.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Diagram nextDiagram = (org.eclipse.gmf.runtime.notation.Diagram) it.next();
- result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
- }
- return result;
-}
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection selectViewsByType(java.util.Collection views, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = views.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (type.equals(nextView.getType()) && isOwnView(nextView)) {
- result.add(nextView);
- }
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
- return «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(view));
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection createNavigatorItems(java.util.Collection views, Object parent, boolean isLeafs) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = views.iterator(); it.hasNext();) {
- result.add(new «getNavigatorItemQualifiedClassName()»((org.eclipse.gmf.runtime.notation.View) it.next(), parent, isLeafs));
- }
- return result;
-}
-«EXPAND getForeignShortcuts-»
-«ENDDEFINE»
-«DEFINE getForeignShortcuts FOR gmfgen::GenNavigator-»
- «IF editorGen.diagram.generateCreateShortcutAction() and getChildReferencesFrom(self, editorGen.diagram)->size() > 0-»
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = diagram.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
- result.add(nextView);
- }
- }
- return createNavigatorItems(result, parent, false);
-}
- «ENDIF-»
-«ENDDEFINE»
-«DEFINE createEditingDomain FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain()«ENDDEFINE»
-«DEFINE initGroupVariables(navigator : gmfgen::GenNavigator, _references : Sequence(gmfgen::GenNavigatorChildReference), parentVarName : String, contextElement : gmfgen::GenCommonBase) FOR String-»
- «navigator.getNavigatorGroupQualifiedClassName()» «validJavaIdentifier(self)» = new «navigator.getNavigatorGroupQualifiedClassName()»(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForGroup(self, contextElement)) FOR navigator.editorGen»,
- "«getNavigatorReference(self, _references).groupIcon»", «parentVarName»); «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-«DEFINE addNavigatorItemsPrefix FOR gmfgen::GenNavigatorChildReference»«IF isInsideGroup()»«validJavaIdentifier(groupName)».addChildren(«ELSE»result.addAll(«ENDIF»createNavigatorItems(«ENDDEFINE»
-«DEFINE addNavigatorItemsSuffix(parentVarName : String, isLeaf : Boolean) FOR gmfgen::GenNavigatorChildReference-»
-, «IF isInsideGroup()»«validJavaIdentifier(groupName)»«ELSE»«parentVarName»«ENDIF», «isLeaf»));
-«ENDDEFINE»
-«DEFINE addGroups(_references : Sequence(gmfgen::GenNavigatorChildReference)) FOR String-»
- «LET getNavigatorReference(self, _references) AS ref-»
- «IF ref.hideIfEmpty-»
- if (!«validJavaIdentifier(self)».isEmpty()) {«ENDIF-»
- result.add(«validJavaIdentifier(self)»);
- «IF ref.hideIfEmpty-»
- }«ENDIF-»
- «ENDLET-»
-«ENDDEFINE»
-«DEFINE getChildViewType FOR gmfgen::GenDiagram»«EXPAND xpt::editor::VisualIDRegistry::modelID»«ENDDEFINE»
-«DEFINE getChildViewType FOR gmfgen::GenCommonBase»«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»«ENDDEFINE»
-«DEFINE caseNavigatorNode(navigator : gmfgen::GenNavigator) FOR gmfgen::GenCommonBase»
-«EXPAND xpt::Common::caseVisualID» {
- «REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM» this code has been modified to call directly submethods«ENDREM»
-//modification of the template to avoid mistake of 65kb.
-return getViewChildrenFor«self.editPartClassName»(view, parentElement);
-«REM»END: PapyrusGenCode«ENDREM»
-}
-«ENDDEFINE»
-«DEFINE addForeignShortcuts FOR gmfgen::GenDiagram-»
- «IF generateCreateShortcutAction()-»
-result.addAll(getForeignShortcuts((org.eclipse.gmf.runtime.notation.Diagram) view, parentElement));
- «ENDIF-»
-«ENDDEFINE»
-«DEFINE addForeignShortcuts FOR gmfgen::GenCommonBase»«ENDDEFINE»
-«DEFINE childrenMethodName(referenceType : gmfgen::GenNavigatorReferenceType, segment : gmfgen::GenNavigatorPathSegment) FOR gmfgen::GenLink-»
- «IF referenceType = gmfgen::GenNavigatorReferenceType::out_target»getLinksTargetByType«ELSE»getLinksSourceByType«ENDIF-»
-«ENDDEFINE»
-«DEFINE childrenMethodName(referenceType : gmfgen::GenNavigatorReferenceType, segment : gmfgen::GenNavigatorPathSegment) FOR gmfgen::GenCommonBase-»
- «IF referenceType = gmfgen::GenNavigatorReferenceType::out_target-»
- getOutgoingLinksByType«ELSEIF referenceType = gmfgen::GenNavigatorReferenceType::in_source-»
- getIncomingLinksByType«ELSE-»
- «IF (Sequence { segment._from })[gmfgen::GenDiagram]->size() > 0 and (Sequence { segment.to })[gmfgen::GenLink]->size() > 0-»
- getDiagramLinksByType«ELSE-»
- getChildrenByType«ENDIF-»
- «ENDIF-»
-«ENDDEFINE»
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE»
-«DEFINE i18nAccessors FOR gmfgen::GenNavigator-»
- «LET getChildReferencesFrom(self, null) AS _references-»
- «EXPAND internal_i18nAccessors(null) FOREACH getGroupNames(_references)-»
- «ENDLET-»
- «FOREACH getNavigatorContainerNodes(self) AS contextElement-»
- «LET getChildReferencesFrom(self, contextElement) AS _references-»
- «EXPAND internal_i18nAccessors(contextElement) FOREACH getGroupNames(_references)-»
- «ENDLET-»
- «ENDFOREACH-»
-«ENDDEFINE»
-«DEFINE internal_i18nAccessors(contextElement : gmfgen::GenCommonBase) FOR String-»
-«IF null <> self»«EXPAND xpt::Externalizer::accessorField(i18nKeyForGroup(self, contextElement))»«ENDIF-»
-«ENDDEFINE»
-«DEFINE i18nValues FOR gmfgen::GenNavigator-»
-«LET getChildReferencesFrom(self, null) AS _references-»
-«EXPAND internal_i18nValues(null) FOREACH getGroupNames(_references)-»
-«ENDLET-»
-«FOREACH getNavigatorContainerNodes(self) AS contextElement-»
-«LET getChildReferencesFrom(self, contextElement) AS _references-»
-«EXPAND internal_i18nValues(contextElement) FOREACH getGroupNames(_references)-»
-«ENDLET-»
-«ENDFOREACH-»
-«ENDDEFINE»
-«DEFINE internal_i18nValues(contextElement : gmfgen::GenCommonBase) FOR String-»
-«IF null <> self»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForGroup(self, contextElement), self)»«ENDIF-»
-«ENDDEFINE»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Loop to call generator of each method«ENDREM»
-«DEFINE genAllMethodNodeCase FOR gmfgen::GenNavigator-»
-«EXPAND caseMethodNodeNode(self) FOREACH getNavigatorContainerNodes(self)-»
-«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»this template has been modified to fixe bug generation by GMF framework.«ENDREM»
-«REM»Is avoid generated method that are greater than 64Kb«ENDREM»
-«DEFINE caseMethodNodeNode(gmfgen::GenNavigator navigator) FOR gmfgen::GenCommonBase»
-/**
- *
- *Papyrus Template
- *this method is a modification of gmf code in order to avoid getViewChidreen() method becoming greater than 64kb.
- *@generated
-**/
-private Object[] getViewChildrenFor«self.editPartClassName»(org.eclipse.gmf.runtime.notation.View view, Object parentElement){
- java.util.Collection result = new java.util.ArrayList();
- «EXPAND addForeignShortcuts FOR self-»
- «LET getChildReferencesFrom(navigator, self) AS _references-»
- «EXPAND initGroupVariables(navigator, _references, 'parentElement', self) FOREACH getGroupNames(_references)-»
- «FOREACH _references AS reference ITERATOR referencesIterator-»
- «FOREACH reference.findConnectionPaths() AS path ITERATOR pathsIterator-»
- «FOREACH path.segments AS segment ITERATOR segmentsIterator-»
- «IF referencesIterator.isFirstIteration() and pathsIterator.isFirstIteration() and segmentsIterator.isFirstIteration()»java.util.Collection «ENDIF-»
- connectedViews = «EXPAND childrenMethodName(reference.referenceType, segment) FOR segment._from-»
- («IF segmentsIterator.isFirstIteration()»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF-»
- , «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR segment.to»);
- «ENDFOREACH-»
- «EXPAND addNavigatorItemsPrefix FOR reference»connectedViews«EXPAND addNavigatorItemsSuffix('parentElement', reference.referenceType <> gmfgen::GenNavigatorReferenceType::children) FOR reference-»
- «ENDFOREACH-»
- «ENDFOREACH-»
- «EXPAND addGroups(_references) FOREACH getGroupNames(_references)-»
- «ENDLET-»
- return result.toArray();
-}
-«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/99/99388398773c5c8e8f54d7a557e06b13112b816c.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/99/99388398773c5c8e8f54d7a557e06b13112b816c.svn-base
deleted file mode 100644
index 2708a7f48ec..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/99/99388398773c5c8e8f54d7a557e06b13112b816c.svn-base
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2009 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-
-«EXTENSION xpt::diagram::Utils»
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«AROUND extensions FOR gmfgen::GenDiagram-»
-
-«IF preferencePages->size() > 0-»
- <extension point="org.eclipse.ui.preferencePages" id="prefpages">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«EXPAND papyrusPreferencePage FOREACH allPreferencePages(self)-»
- </extension>
-«ENDIF-»
-«ENDAROUND»
-
-«DEFINE papyrusPreferencePage FOR gmfgen::GenStandardPreferencePage-»
-«IF gmfgen::StandardPreferencePages::General = kind -»
- <page
- id="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»"
- name="«getDiagram().editorGen.modelID» Diagram"
- category="«getDiagramPreferencePageCategory()»"
- class="«getQualifiedClassName()»">
- </page>
- «ELSEIF gmfgen::StandardPreferencePages::Printing = kind or gmfgen::StandardPreferencePages::RulersAndGrid = kind -»
- <page
- id="«getQualifiedClassName()»"
- name="%prefpage.«iD»"
- category="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»"
- class="«getQualifiedClassName()»">
- </page>
-«ENDIF»
-«ENDDEFINE»
-
-«DEFINE papyrusPreferencePage FOR gmfgen::GenCustomPreferencePage-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/9a/9a6a4197f568b5a6e62cf7f7e553c39f08bd2205.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/9a/9a6a4197f568b5a6e62cf7f7e553c39f08bd2205.svn-base
deleted file mode 100644
index 7018c14aecc..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/9a/9a6a4197f568b5a6e62cf7f7e553c39f08bd2205.svn-base
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2009 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«REM»DOCUMENTATION: PapyrusGenCode«ENDREM»
-«REM»Overload only the handle notification«ENDREM»
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-
-«AROUND handleNotificationEventBody FOR gmfgen::GenChildLabelNode-»
- Object feature = event.getFeature();
- «EXPAND xpt::diagram::editparts::Common::handleText FOR self-»
- «IF labelElementIcon-»
- if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
- refreshLabel();
- }
- «ENDIF-»
- if (org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) {
- refreshUnderline();
- }
- super.handleNotificationEvent(event);
-«ENDAROUND» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a3/a30ba49520cd4422b5c9f06287b57e289598c73a.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a3/a30ba49520cd4422b5c9f06287b57e289598c73a.svn-base
deleted file mode 100644
index fa0416046b0..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a3/a30ba49520cd4422b5c9f06287b57e289598c73a.svn-base
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Dmitry Stadnik (Borland) - creation logic was moved in commands
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::editpolicies::Utils»
-
-«REM»
- * Start start of link creation.
- * User click to this editpart and start dragging with link tool.
- * Complete end of the command
- * User points to this editpart as a link target and release mouse button.
- *
- * Outgoing the node is link source
- * This element could be a source for this type of link.
- * Incoming the node is link destination
- * This element could be a target for this type of link.
- *
- * Parameters:
- *
- * diagram GenDiagram used to collect all defined links
- *
- * this Instance of GenLinkEnd for the element link could be creates to/from.
- * This could be GenNode or GenLink in case of links to links,
- * in the latter case it is assumed that its a TypeLink (so its model facet is LinkTypeModelFacet),
- * because RefLinks don't have underlying semantic identity
- *
-«ENDREM»
-
-«DEFINE linkCommands FOR gmfgen::GenLinkEnd-»
- «IF getAllPotentialLinks(self)->size() > 0-»
- «EXPAND createLinkCommands -»
- «ENDIF-»
- «IF getReroutableTypeLinks(self)->size() > 0-»
- «EXPAND reorientTypeLinkCommands -»
- «ENDIF-»
- «IF getReroutableRefLinks(self)->size() > 0-»
- «EXPAND reorientRefLinkCommands -»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE createLinkCommands FOR gmfgen::GenLinkEnd-»
-
-«IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()<1»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- org.eclipse.gef.commands.Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
-}
-«ENDIF»
-
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getStartCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if(requestElementType instanceof org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType) {
- baseElementType = org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils.getClosestDiagramType(requestElementType);
- if(baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils.findClosestNonExtendedElementType((org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType)requestElementType);
- isExtendedType = true;
- }
- }
- «EXPAND startLinkCommands(self) FOREACH getAllPotentialLinks(self)-»
- return null;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getCompleteCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return null;
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if(requestElementType instanceof org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType) {
- baseElementType = org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils.getClosestDiagramType(requestElementType);
- if(baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils.findClosestNonExtendedElementType((org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType)requestElementType);
- isExtendedType = true;
- }
- }
- «EXPAND completeLinkCommands(self) FOREACH getAllPotentialLinks(self)-»
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE startLinkCommands(linkEnd : gmfgen::GenLinkEnd) FOR gmfgen::GenLink-»
-if («EXPAND xpt::providers::ElementTypes::accessElementType» == baseElementType) {
- «IF createStartLinkCommand(self, linkEnd)-»
- if(isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType)requestElementType);
- }
- return getGEFWrapper(new «getCreateCommandQualifiedClassName()»(req,
- «IF createStartIncomingLinkCommand(self, linkEnd)-»
- req.getTarget(), req.getSource()
- «ELSE-»
- req.getSource(), req.getTarget()
- «ENDIF-»
- ));
- «ELSE-»
- return null;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE completeLinkCommands(linkEnd : gmfgen::GenLinkEnd) FOR gmfgen::GenLink-»
-if («EXPAND xpt::providers::ElementTypes::accessElementType» == baseElementType) {
- «IF createCompleteLinkCommand(self, linkEnd)-»
- if(isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType)requestElementType);
- }
- return getGEFWrapper(new «getCreateCommandQualifiedClassName()»(req,
- «IF createCompleteOutgoingLinkCommand(self, linkEnd)-»
- req.getTarget(), req.getSource()
- «ELSE-»
- req.getSource(), req.getTarget()
- «ENDIF-»
- ));
- «ELSE-»
- return null;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE reorientTypeLinkCommands FOR gmfgen::GenLinkEnd-»
-
-«EXPAND xpt::Common::generatedMemberComment(
- 'Returns command to reorient EClass based link. New link target or source\n' +
- 'should be the domain model element associated with this node.\n'
-)»
-protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- «EXPAND reorientLinkCommand FOREACH getReroutableTypeLinks(self)-»
- }
- return super.getReorientRelationshipCommand(req);
-}
-«ENDDEFINE»
-
-«DEFINE reorientRefLinkCommands FOR gmfgen::GenLinkEnd-»
-
-«EXPAND xpt::Common::generatedMemberComment(
- 'Returns command to reorient EReference based link. New link target or source\n' +
- 'should be the domain model element associated with this node.\n'
-)»
-protected org.eclipse.gef.commands.Command getReorientReferenceRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- «EXPAND reorientLinkCommand FOREACH getReroutableRefLinks(self)-»
- }
- return super.getReorientReferenceRelationshipCommand(req);
-}
-«ENDDEFINE»
-
-«DEFINE reorientLinkCommand FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::caseVisualID»
- return getGEFWrapper(new «getReorientCommandQualifiedClassName()»(req));
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a3/a3d3b59e723b0720aaa9e2e6c082fe64d79ed203.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a3/a3d3b59e723b0720aaa9e2e6c082fe64d79ed203.svn-base
deleted file mode 100644
index 2f07726ece5..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a3/a3d3b59e723b0720aaa9e2e6c082fe64d79ed203.svn-base
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2010 Artem Tikhomirov 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:
- * Artem Tikhomirov (independent) - initial API and implementation
- * modificiation by Patrick Tessier (CEA LIST)
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«EXTENSION xpt::GenEditorGenerator»
-// Generic types
-«DEFINE G(String type) FOR gmfgen::GenCommonBase»«IF self.jdkComplianceLevel() > 4»<«type»>«ELSE»/*[«type»]*/«ENDIF»«ENDDEFINE»
-«DEFINE G2(String type1, String type2) FOR gmfgen::GenCommonBase»«IF self.jdkComplianceLevel() > 4»<«type1», «type2»>«ELSE»/*[«type1», «type2»]*/«ENDIF»«ENDDEFINE»
-«DEFINE _g2_3(String t, String a, String b, String c) FOR gmfgen::GenCommonBase»«t»«IF self.jdkComplianceLevel() > 4»<«a», «b»<«c»>>«ELSE»/*[«a», «b»[«c»]]*/«ENDIF»«ENDDEFINE»
-
-// e.g. java.util.List<String>
-«DEFINE G(String type, String typeArgument) FOR gmfgen::GenCommonBase»«type»«EXPAND G(typeArgument)»«ENDDEFINE»
-// e.g. java.util.Map<String, Integer>
-«DEFINE G2(String type, String typeArgument1, String typeArgument2) FOR gmfgen::GenCommonBase»«type»«EXPAND G2(typeArgument1, typeArgument2)»«ENDDEFINE»
-
-// java.util.List<String> varName = new Type<TypeArgument>
-// note, no constructor parameters, callers should add (); or whatever they think is reasonable
-// XXX perhaps, varName should go first, to be consistent with iterate?
-«DEFINE newGenericInstance(String varName, String type, String typeArgument) FOR gmfgen::GenCommonBase»«EXPAND G(type, typeArgument)» «varName» = new «EXPAND G(type, typeArgument)»«ENDDEFINE»
-
-// new HashMap<Object, String>
-«DEFINE newGenericInstance2(String varName, String type, String typeArgument1, String typeArgument2) FOR gmfgen::GenCommonBase»«EXPAND G2(type, typeArgument1, typeArgument2)» «varName»= new «EXPAND G2(type, typeArgument1, typeArgument2)»«ENDDEFINE»
-
-// new HashMap<Object, List<String>>
-«DEFINE newGenericInstance2(String varName, String type, String typeArgument1, String typeArgument2, String typeArgument3) FOR gmfgen::GenCommonBase»«EXPAND _g2_3(type, typeArgument1, typeArgument2, typeArgument3)» «varName»= new «EXPAND _g2_3(type, typeArgument1, typeArgument2, typeArgument3)»«ENDDEFINE»
-
-// iterate cycle with explicit iterator variable
-// use this one if you need access to iterator (i.e. remove elements) or when there's no java.lang.Iterable source (i.e. some API gives Iterator right away)
-«DEFINE iterate(String elementVar, String elementType, String iteratorVar, String iterationSource) FOR gmfgen::GenCommonBase-»
-for («EXPAND G('java.util.Iterator', elementType)» «iteratorVar» = «iterationSource»; «iteratorVar».hasNext();) {
- «elementType» «elementVar» = «IF 'Object' <> elementType /*cast to Object is implicit*/ and not (self.jdkComplianceLevel() > 4) /*generics are not used then, should cast. Using 'not greater 4' instead of 'less than 5' to handle null/undefined case correctly*/»(«elementType») «ENDIF»«iteratorVar».next();
-«ENDDEFINE»
-
-//
-// generates Java5-style iterate cycle (no explicit iterator), if possibl, otherwise uses default iterator name, 'it'
-// beware of nested cycles using same 'it' name (relevant for Java 1.4)
-«DEFINE iterate(String elementVar, String elementType, String iterable /*java.lang.Iterable*/) FOR gmfgen::GenCommonBase-»
-«IF self.jdkComplianceLevel() > 4 -»
-for («elementType» «elementVar» : «iterable») {
-«ELSE-»
-«EXPAND iterate(elementVar, elementType, 'it', iterable.concat('.iterator()'))-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE emptyList FOR gmfgen::GenCommonBase-»
-«IF self.jdkComplianceLevel() > 4 -»
-java.util.Collections.emptyList()«ELSE-»
-java.util.Collections.EMPTY_LIST«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE emptyMap(String genericTypes) FOR gmfgen::GenCommonBase-»
-«IF self.jdkComplianceLevel() > 4 -»
-java.util.Collections.<«genericTypes»>emptyMap()«ELSE-»
-java.util.Collections.EMPTY_MAP«ENDIF-»
-«ENDDEFINE»
-
-// when need to cast 1.5-typed variable to be usable in 1.4 code. does nothing for 1.5 and greater. I.e.
-// List/*[String]*/ coll = ...
-// String aaa = (String) coll.get(0);
-// cast to string is needed in 1.4
-«DEFINE castTyped(String type) FOR gmfgen::GenCommonBase»«IF not (self.jdkComplianceLevel() > 4)»(«type») «ENDIF»«ENDDEFINE»
-
-// annotations are from Java 5 and above
-«DEFINE SuppressWarnings(String warnToken) FOR gmfgen::GenEditorGenerator»«EXPAND SuppressWarnings(warnToken) FOR diagram»«ENDDEFINE»
-«DEFINE SuppressWarnings(String warnToken) FOR gmfgen::GenCommonBase-»
-«IF self.jdkComplianceLevel() > 4 -»
-@SuppressWarnings(«warnToken»)
-«ENDIF-»
-«ENDDEFINE»
-
-
-«AROUND override FOR gmfgen::GenCommonBase-»
-«IF self.jdkComplianceLevel() > 5-»
-@Override
-«ENDIF-»
-«ENDAROUND» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a5/a5fd704ebde78022af2bfd356d7b5552aa329e24.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a5/a5fd704ebde78022af2bfd356d7b5552aa329e24.svn-base
deleted file mode 100644
index dfc24d8624c..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a5/a5fd704ebde78022af2bfd356d7b5552aa329e24.svn-base
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»Dthis template changes only the define extendsList line 48«ENDREM»
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE Main FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::_constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::addFixedChild-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::addChildVisual-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::removeFixedChild-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::removeChildVisual-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::createLinkFigure-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»patches the super type of the link edit part in case the controlled object represents a UML element«ENDREM»
-«DEFINE extendsList FOR gmfgen::GenLink»extends «EXPAND impl::diagram::editparts::LinkEditPart::extendsListContents»«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-
-«DEFINE implementsList FOR gmfgen::GenLink-»
- «IF treeBranch»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenLink-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::LinkEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLink-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a8/a86eae6b32f2c7743ef2f4a9d3845afea4dede3c.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a8/a86eae6b32f2c7743ef2f4a9d3845afea4dede3c.svn-base
deleted file mode 100644
index 27b507e9869..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a8/a86eae6b32f2c7743ef2f4a9d3845afea4dede3c.svn-base
+++ /dev/null
@@ -1,687 +0,0 @@
-/*
- * Copyright (c) 2009 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Vincent Lorenzo (CEA-LIST) Add a line to initialize the display of the compartments to true
- * Vincent Lorenzo (CEA-LIST) - Add lines to initialize the display of the labels - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-«EXTENSION xpt::diagram::Utils»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-
-
-«AROUND ViewProvider FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «providersPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «notationViewProviderClassName»«EXPAND xpt::providers::ViewProvider::extendsList»«EXPAND xpt::providers::ViewProvider::implementsList» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public final boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
- if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) operation);
- }
- «EXPAND xpt::Common::_assert('operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation')-»
- if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) operation);
- } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) operation);
- } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) {
- return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) operation);
- }
- return false;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation op) {
-/*
- if (op.getViewKind() == Node.class)
- return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- if (op.getViewKind() == Edge.class)
- return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
-*/
-
- // check Diagram Type should be the class diagram
- String modelID = «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(op.getContainerView());
- if(!getDiagramProvidedId().equals(modelID)) {
- return false;
- }
-
- int visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(op.getSemanticHint());
- if(org.eclipse.gmf.runtime.notation.Node.class.isAssignableFrom(op.getViewKind())) {
- return «EXPAND xpt::editor::VisualIDRegistry::canCreateNodeMethodCall»(op.getContainerView(), visualID);
- }
-
- return true;
- }
-
-
-«EXPAND xpt::Common::generatedMemberComment»
- protected String getDiagramProvidedId() {
- /*
- * Indicates for which diagram this provider works for.
- * <p>
- * This method can be overloaded when diagram editor inherits from another one, but should never be <code>null</code>
- * </p>
- *
- * @return the unique identifier of the diagram for which views are provided.
- */
- return «EXPAND xpt::editor::VisualIDRegistry::modelID»;
- }
-
-
- «EXPAND xpt::Common::generatedMemberComment»«REM»When diagram domain element is null only diagram kind is checked«ENDREM»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation op) {
- return «EXPAND xpt::editor::VisualIDRegistry::modelID».equals(op.getSemanticHint())«IF domainDiagramElement <> null» && «EXPAND xpt::editor::VisualIDRegistry::getDiagramVisualIDMethodCall»(getSemanticElement(op.getSemanticAdapter())) != -1«ENDIF»;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation op) {
- if (op.getContainerView() == null) {
- return false;
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- int visualID;
- if (op.getSemanticHint() == null) {
- // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
- // In this situation there should be NO elementType, visualID will be determined
- // by VisualIDRegistry.getNodeVisualID() for domainElement.
- if (elementType != null || domainElement == null) {«REM»XXX Perhaps, better to fix CanonicalEP instead of this hack?«ENDREM»
- return false;
- }
- visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(op.getContainerView(), domainElement);
- } else {
- visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(op.getSemanticHint());
- if (elementType != null) {«REM»
- Semantic hint is specified together with element type.
- Both parameters should describe exactly the same diagram element.
- In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for
- domainElement (if specified) is the same as in element type.«ENDREM»
- if(elementType instanceof org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType closestNonExtendedType = org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils.getClosestDiagramType(elementType);
- if(!«getElementTypesQualifiedClassName()».isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- return false; // foreign element type.
- }
- } else {
- if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- return false; // foreign element type
- }
- }
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- if (!op.getSemanticHint().equals(elementTypeHint)) {
- return false; // if semantic hint is specified it should be the same as in element type
- }
- if (domainElement != null && visualID != «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(op.getContainerView(), domainElement)) {
- return false; // visual id for node EClass should match visual id from element type
- }
- } else {«REM»
- Element type is not specified. Domain element should be present (except pure design elements).
- This method is called with EObjectAdapter as parameter from:
- - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint)
- - generated ViewFactory.decorateView() for parent element«ENDREM»
-«IF getAllTypedElements()->select(e | e.elementType <> null)->size() > 0-»
- if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(op.getContainerView()))) {
- return false; // foreign diagram
- }
- switch (visualID) {
- «IF getAllNodes().elementType[gmfgen::NotationType]->size() > 0-»
- «EXPAND caseVisualID FOREACH getAllNodes().elementType[gmfgen::NotationType]-»
- break; // pure design element
- «ENDIF-»
- «IF getAllNodes().elementType[gmfgen::MetamodelType]->size() > 0 or getAllNodes().elementType[gmfgen::SpecializationType]->size() > 0-»
- «EXPAND xpt::providers::ViewProvider::caseVisualID FOREACH getAllNodes().elementType[gmfgen::MetamodelType]-»
- «EXPAND xpt::providers::ViewProvider::caseVisualID FOREACH getAllNodes().elementType[gmfgen::SpecializationType]-»
- if (domainElement == null || visualID != «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(op.getContainerView(), domainElement)) {
- return false; // visual id in semantic hint should match visual id for domain element
- }
- break;«REM»FIXME: Perhaps, can return true or false right away, without any further check?«ENDREM»
- «ENDIF-»
- default:
- return false;
- }
-«ELSE-»
- return false;
-«ENDIF-»
- }
- }
- «IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()>0-»
- return «EXPAND xpt::editor::VisualIDRegistry::canCreateNodeMethodCall»(op.getContainerView(), visualID);
- «ELSE-»
- return «FOREACH getAllNodes() AS n SEPARATOR '||'»«EXPAND xpt::editor::VisualIDRegistry::visualID FOR n» == visualID«ENDFOREACH»;
- «ENDIF»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»«REM»XXX: unlike createNode, we don't check op.containerView() for null here. On purpose?«ENDREM»
- protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation op) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- //RS: add code for extended types creation
- if(elementType instanceof org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType closestNonExtendedType = org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils.getClosestDiagramType(elementType);
- if(!«getElementTypesQualifiedClassName()».isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- return false; // foreign element type.
- }
- } else {
- if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- return false; // foreign element type
- }
- }
- //if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- // return false; // foreign element type
- //}
- // END R.S.
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
- return false; // our hint is visual id and must be specified, and it should be the same as in element type
- }
- int visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(elementTypeHint);
- org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- if (domainElement != null && visualID != «EXPAND xpt::editor::VisualIDRegistry::getLinkWithClassVisualIDMethodCall»(domainElement)) {
- return false; // visual id for link EClass should match visual id from element type
- }
- return true; «REM»Does it make sense to check visualID here, like we did for nodes?«ENDREM»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Diagram createDiagram(org.eclipse.core.runtime.IAdaptable semanticAdapter, String diagramKind, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();«REM»FIXME instantiate diagramRunTimeClass instead«ENDREM»
- diagram.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle());
- «EXPAND xpt::diagram::views::Utils::addCustomStyles('diagram.getStyles()')-»
- diagram.setType(«EXPAND xpt::editor::VisualIDRegistry::modelID»);
- diagram.setElement(«IF domainDiagramElement <> null»getSemanticElement(semanticAdapter)«ELSE»null«ENDIF»);
-«IF units <> null-»
- diagram.setMeasurementUnit(org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpper()»_LITERAL);
-«ENDIF-»
-«IF styles->notEmpty()-»
- // initializeFromPreferences
- org.eclipse.jface.preferences.IPreferenceStore store = (org.eclipse.jface.preferences.IPreferenceStore) preferencesHint.getPreferenceStore();
- «EXPAND initializeStyles('diagram', 'store', false, false, false)-»
-«ENDIF-»
- return diagram;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node createNode(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- final org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(semanticAdapter);
- final int visualID;
- if (semanticHint == null) {
- visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(containerView, domainElement);
- } else {
- visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(semanticHint);
- }
- switch(visualID) {
- «FOREACH getAllNodes() AS n-»
- «EXPAND xpt::Common::caseVisualID FOR n» return create«n.getUniqueIdentifier()»(domainElement, containerView, index, persisted, preferencesHint);
- «ENDFOREACH-»
- }
- // can't happen, provided #provides(CreateNodeViewOperation) is correct
- return null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Edge createEdge(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(semanticAdapter);
- String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(elementTypeHint)) {
- «FOREACH links AS link-»
- «EXPAND xpt::Common::caseVisualID FOR link» return create«link.getUniqueIdentifier()»(«IF link.isTypeLink()» getSemanticElement(semanticAdapter), «ENDIF»containerView, index, persisted, preferencesHint);
- «ENDFOREACH-»
- }
- // can never happen, provided #provides(CreateEdgeViewOperation) is correct
- return null;
- }
-
-«EXPAND xpt::providers::ViewProvider::createNodeMethod FOREACH getAllNodes()»
-«EXPAND xpt::providers::ViewProvider::createEdgeMethod FOREACH links»
-
-«IF topLevelNodes->notEmpty()»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void stampShortcut(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.Node target) {
- if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(containerView))) {
- «EXPAND xpt::Common::addShortcutAnnotation('target')-»
- }
- }
-«ENDIF-»
-
-«IF links.labels->notEmpty() or topLevelNodes.labels->notEmpty() or childNodes.labels->notEmpty()»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.notation.Node createLabel(org.eclipse.gmf.runtime.notation.View owner, String hint) {
- org.eclipse.gmf.runtime.notation.DecorationNode rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDecorationNode();
- rv.setType(hint);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true);
- return rv;
- }
-«ENDIF-»
-
-«IF getAllNodes().compartments->notEmpty()»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.notation.Node createCompartment(org.eclipse.gmf.runtime.notation.View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) {
- //SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
- //rv.setShowTitle(showTitle);
- //rv.setCollapsed(isCollapsed);
- org.eclipse.gmf.runtime.notation.Node rv;
- if (canCollapse) {
- rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBasicCompartment();
- } else {
- rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDecorationNode();
- }
- rv.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
-
- if (hasTitle) {
- org.eclipse.gmf.runtime.notation.TitleStyle ts = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle();
- ts.setShowTitle(true);
- rv.getStyles().add(ts);
- }
- if (canSort) {
- rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createSortingStyle());
- }
- if (canFilter) {
- rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFilteringStyle());
- }
- rv.setType(hint);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true);
- return rv;
- }
-«ENDIF-»
- «EXPAND xpt::providers::ViewProvider::getSemanticElementMethod»
- «EXPAND xpt::providers::ViewProvider::getSemanticElementTypeMethod-»
- «EXPAND xpt::providers::ViewProvider::additions-»
-}
-«ENDAROUND»
-
-«DEFINE createNodeMethod FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node create«getUniqueIdentifier()»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
-«IF viewmap.canUseShapeStyle()-»
- org.eclipse.gmf.runtime.notation.Shape node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape();
-«ELSE-»
- org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape();
- node.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());«REM»FIXME Contionally add this style, whether toolsmith needs Notes or not«ENDREM»
- «EXPAND xpt::diagram::views::Utils::addFontLineFillStylesConditionally('node.getStyles()') FOR viewmap-»
-«ENDIF-»
- «EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle('node.getStyles()')-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles('node.getStyles()')-»
- node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
- node.setType(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
-«IF self.oclIsTypeOf(gmfgen::GenTopLevelNode)-»
- stampShortcut(containerView, node);
-«ENDIF-»
- // initializeFromPreferences «REM»XXX Perhaps, do init only once, for complete figure?«ENDREM»
- final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «EXPAND initializeStyles('node', 'prefStore', not viewmap.isFixedForeground(), not viewmap.isFixedBackground(), not viewmap.isFixedFont())-»
- «EXPAND initLabel('node', 'prefStore') FOREACH labels-»
- «EXPAND initCompartment('node', 'prefStore') FOREACH compartments-»
- «REM» BEGIN Papyrus Modification «ENDREM»
-«IF compartments->size() <> 0-»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(«'node'», «'prefStore'», "«elementType.displayName»");
-«ENDIF-»
- «REM» END Papyrus Modification «ENDREM»
- return node;
- }
-«ENDDEFINE»
-
-// Location as layoutConstraint, no children
-«DEFINE createNodeMethod FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Node create«getUniqueIdentifier()»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());«REM»[artem] XXX not sure, why LabelNode needs location«ENDREM»
- «EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle('node.getStyles()')-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles('node.getStyles()')-»
- node.setType(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
-
- final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «EXPAND initFontFromPrefs('node', 'prefStore')-»
- «EXPAND initForegroundFromPrefs('node', 'prefStore')-»
- return node;
- }
-«ENDDEFINE»
-
-// looks for Font/Line/Fill styles in customStyles and initializes, if any (may be forced with boolean params)
-// params has*Style are to force respective style initialization (when callee knows certain style was added)
-«DEFINE initializeStyles(String viewVar, String prefStoreVar, Boolean hasLineStyle, Boolean hasFillStyle, Boolean hasFontStyle) FOR gmfgen::GenCommonBase-»
-«IF hasLineStyle or self.hasLineStyleInCustom()-»
- «REM»FIXME ColorAttributes is deprecated, should remove and clean the second branch of the disjunction«ENDREM»
- «IF viewmap.isFixedForeground() or viewmap.attributes[gmfgen::ColorAttributes]->notEmpty()-»
- «EXPAND xpt::diagram::views::Utils::foregroundColour(viewVar) FOR viewmap-»
- «ELSE-»
- «EXPAND initForegroundFromPrefs(viewVar, prefStoreVar)-»
- «ENDIF-»
-«ENDIF-»
-«IF (hasFontStyle or self.hasFontStyleInCustom()) and not viewmap.isFixedFont()-»
- «EXPAND initFontFromPrefs(viewVar, prefStoreVar)-»
-«ENDIF-»
-«IF hasFillStyle or self.hasFillStyleInCustom()-»
- «IF viewmap.isFixedBackground() or viewmap.attributes[gmfgen::ColorAttributes]->notEmpty()-»
- «EXPAND xpt::diagram::views::Utils::backgroundColour(viewVar) FOR viewmap-»
- «ELSE-»
- «EXPAND initBackgroundFromPrefs(viewVar, prefStoreVar)-»
- «ENDIF-»
-«ENDIF-»
-«ENDDEFINE»
-
-// FIXME check if there's need for a variable name, see initCompartment for a hint
-«DEFINE initLabel(String nodeVar, String prefStoreVar) FOR gmfgen::GenLabel-»
-«LET 'label' + self.visualID.repr() AS labelVar-»
- org.eclipse.gmf.runtime.notation.Node «labelVar» = createLabel(«nodeVar», «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»);
- «EXPAND xpt::diagram::views::Utils::addTextStyle(labelVar + '.getStyles()') FOR modelFacet-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles(labelVar + '.getStyles()')-»
-«IF self.oclIsKindOf(gmfgen::GenExternalNodeLabel) or self.oclIsKindOf(gmfgen::GenLinkLabel)-»
- «labelVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());
- «EXPAND xpt::diagram::views::Utils::offset(labelVar)-»
-«ENDIF-»
- «EXPAND initializeStyles(labelVar, prefStoreVar, false, false, false)-»
-«ENDLET-»
-«ENDDEFINE»
-
-«DEFINE initCompartment(String nodeVar, String prefStoreVar) FOR gmfgen::GenCompartment-»
-«LET 'compartment' + self.visualID.repr() AS compartmentVar-»
- «IF styles->notEmpty() or isStoringChildPositions(getLayoutType())»org.eclipse.gmf.runtime.notation.Node «compartmentVar» = «ENDIF»createCompartment(«nodeVar», «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall», «canCollapse», «needsTitle», «listLayout», «listLayout»);
- «EXPAND xpt::diagram::views::Utils::addCustomStyles(compartmentVar + '.getStyles()')-»
-«IF isStoringChildPositions(getLayoutType())-»
- «IF viewmap.canUseShapeStyle()-»
- «compartmentVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle());
- «ELSE-»
-«REM»Intentionally not adding Description style, as it deemed to be useless for compartments (can't avoid for ShapeStyle - benefits of a single style overwheight drawbacks of Description presence)«ENDREM»
- «EXPAND xpt::diagram::views::Utils::addFontLineFillStylesConditionally(compartmentVar + '.getStyles()') FOR viewmap-»
- «ENDIF-»
- «compartmentVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds());
- «EXPAND initializeStyles(compartmentVar, prefStoreVar, not viewmap.isFixedForeground(), not viewmap.isFixedBackground(), not viewmap.isFixedFont())-»
-«ELSE-»
- «EXPAND initializeStyles(compartmentVar, prefStoreVar, false, false, false)-»
-«ENDIF-»
-«ENDLET-»
-«ENDDEFINE»
-
-«DEFINE initForegroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase-»
- org.eclipse.swt.graphics.RGB lineRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(«prefStoreVar», org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_COLOR);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar», org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(lineRGB));
-«ENDDEFINE»
-
-«DEFINE initBackgroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase-»
- org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(«prefStoreVar», org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_FILL_COLOR);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar», org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB));
-«ENDDEFINE»
-
-«DEFINE initFontFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase-»
- org.eclipse.gmf.runtime.notation.FontStyle «viewVar»FontStyle = (org.eclipse.gmf.runtime.notation.FontStyle) «viewVar».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FONT_STYLE);
- if («viewVar»FontStyle != null) {«REM»Given this template is invoked only when FontStyle is present, no need to check fontStyle for null, but at least this gives a scope for fontData var«ENDREM»
- org.eclipse.swt.graphics.FontData fontData = org.eclipse.jface.preference.PreferenceConverter.getFontData(«prefStoreVar», org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_DEFAULT_FONT);
- «viewVar»FontStyle.setFontName(fontData.getName());
- «viewVar»FontStyle.setFontHeight(fontData.getHeight());
- «viewVar»FontStyle.setBold((fontData.getStyle() & org.eclipse.swt.SWT.BOLD) != 0);
- «viewVar»FontStyle.setItalic((fontData.getStyle() & org.eclipse.swt.SWT.ITALIC) != 0);
- org.eclipse.swt.graphics.RGB fontRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(«prefStoreVar», org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_FONT_COLOR);
- «viewVar»FontStyle.setFontColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
-«ENDDEFINE»
-
-
-«DEFINE createEdgeMethod FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.Edge create«getUniqueIdentifier()»(«IF isTypeLink()»org.eclipse.emf.ecore.EObject domainElement, «ENDIF»org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
- «IF viewmap.isFixedForeground()-»
- org.eclipse.gmf.runtime.notation.Edge edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createEdge();
- edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRoutingStyle());
- «ELSE-»
- org.eclipse.gmf.runtime.notation.Connector edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createConnector();
- «ENDIF-»
- «IF not viewmap.isFixedFont()-»
- edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle());
- «ENDIF-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles('edge.getStyles()')-»
- org.eclipse.gmf.runtime.notation.RelativeBendpoints bendpoints = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRelativeBendpoints();
- «EXPAND CodeStyle::newGenericInstance('points', 'java.util.ArrayList', 'org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint')»(2);
- points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint());
- points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint());
- bendpoints.setPoints(points);
- edge.setBendpoints(bendpoints);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, edge, index, persisted);
- edge.setType(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»);
- edge.setElement(«IF isTypeLink()»domainElement«ELSE»null«ENDIF»);
- // initializePreferences
- final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore();
- «EXPAND initializeStyles('edge', 'prefStore', not viewmap.isFixedForeground(), false, not viewmap.isFixedFont())-»
- //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- //if (routing != null) {
- // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- //}
- «EXPAND initRountingFromPrefs('edge', 'prefStore')-»
- «EXPAND initLabel('edge', 'prefStore') FOREACH labels-»
- «EXPAND initLabelVisibility('edge', 'prefStore') FOR self-»
- return edge;
- }
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenDiagram» extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider«ENDDEFINE»
-«DEFINE implementsList FOR gmfgen::GenDiagram» implements org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider«ENDDEFINE»
-
-«DEFINE caseVisualID FOR gmfgen::ElementType»«EXPAND xpt::Common::caseVisualID FOR diagramElement»«ENDDEFINE»
-
-«DEFINE getSemanticElementMethod FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.emf.ecore.EObject getSemanticElement(org.eclipse.core.runtime.IAdaptable semanticAdapter) {
- if (semanticAdapter == null) {
- return null;
- }
- org.eclipse.emf.ecore.EObject eObject = (org.eclipse.emf.ecore.EObject) semanticAdapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- if (eObject != null) {
- return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.resolve(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(eObject), eObject);
- }
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE getSemanticElementTypeMethod FOR gmfgen::GenDiagram»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gmf.runtime.emf.type.core.IElementType getSemanticElementType(org.eclipse.core.runtime.IAdaptable semanticAdapter) {
- if (semanticAdapter == null) {
- return null;
- }
- return (org.eclipse.gmf.runtime.emf.type.core.IElementType) semanticAdapter.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-
-«AROUND additions FOR gmfgen::GenDiagram»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private void initFontStyleFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
- {
- String fontConstant = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.FONT);
- String fontColorConstant = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FONT);
-
- org.eclipse.gmf.runtime.notation.FontStyle viewFontStyle = (org.eclipse.gmf.runtime.notation.FontStyle) view.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FONT_STYLE);
- if (viewFontStyle != null)
- {
- org.eclipse.swt.graphics.FontData fontData = org.eclipse.jface.preference.PreferenceConverter.getFontData(store, fontConstant);
- viewFontStyle.setFontName(fontData.getName());
- viewFontStyle.setFontHeight(fontData.getHeight());
- viewFontStyle.setBold((fontData.getStyle() & org.eclipse.swt.SWT.BOLD) != 0);
- viewFontStyle.setItalic((fontData.getStyle() & org.eclipse.swt.SWT.ITALIC) != 0);
-
- org.eclipse.swt.graphics.RGB fontRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, fontColorConstant);
- viewFontStyle.setFontColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private void initForegroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
- {
- String lineColorConstant = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE);
- org.eclipse.swt.graphics.RGB lineRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, lineColorConstant);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(lineRGB));
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private void initBackgroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName)
- {
- String fillColorConstant = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL);
- String gradientColorConstant = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT);
- String gradientPolicyConstant = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName,org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY);
-
-
- org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, fillColorConstant);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB));
-
-
- org.eclipse.gmf.runtime.notation.FillStyle fillStyle = (org.eclipse.gmf.runtime.notation.FillStyle) view
- .getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FILL_STYLE);
- fillStyle
- .setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());
-
- ;
- if (store.getBoolean(gradientPolicyConstant)) {
- org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
- store.getString(gradientColorConstant));
- fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
- fillStyle
- .setTransparency(gradientPreferenceConverter.getTransparency());
- }
- }
-
-
-«ENDAROUND»
-
-«AROUND initFontFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase-»
- «EXPAND specificInitFontFromPrefs(viewVar, prefStoreVar) FOR self-»
-«ENDAROUND»
-
-«DEFINE specificInitFontFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenNode-»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitFontFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenChildNode-»
-«IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitFontFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenLink-»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitFontFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase-»
-«IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-
-
-«AROUND initForegroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase-»
- «EXPAND specificInitForegroundFromPrefs(viewVar, prefStoreVar) FOR self-»
-«ENDAROUND»
-
-«DEFINE specificInitForegroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenNode-»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitForegroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenChildNode-»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitForegroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenLink-»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitForegroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase»
-«ENDDEFINE»
-
-
-
-
-
-«AROUND initBackgroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase-»
- «EXPAND specificInitBackgroundFromPrefs(viewVar, prefStoreVar) FOR self-»
-«ENDAROUND»
-
-«DEFINE specificInitBackgroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenNode»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitBackgroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenChildNode»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitBackgroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenLink»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitBackgroundFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase»
-«ENDDEFINE»
-
-
-«DEFINE initRountingFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase-»
- «EXPAND specificInitRountingFromPrefs(viewVar, prefStoreVar) FOR self-»
-«ENDDEFINE»
-
-«DEFINE specificInitRountingFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenNode»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitRountingFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenChildNode»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitRountingFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenLink»
- «IF "UNDEFINED" <> elementType.displayName.toUpper()»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE specificInitRountingFromPrefs(String viewVar, String prefStoreVar) FOR gmfgen::GenCommonBase»
-«ENDDEFINE»
-
-«REM» write the line to initialize the property isVisible for the label of the link «ENDREM»
-«DEFINE initLabelVisibility(String viewVar, String prefStoreVar) FOR gmfgen::GenLink»
- «IF self.labels->exists(lbl : gmfgen::GenLinkLabel | (papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(lbl))->size()<>0))»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE»
-
-«REM» write the line to initialize the property isVisible for the label of the link «ENDREM»
-«DEFINE initLabelVisibility(String viewVar, String prefStoreVar) FOR gmfgen::GenNode»
- «IF self.labels->exists(lbl : gmfgen::GenExternalNodeLabel | (papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(lbl))->size()<>0))»
- org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»");
- «ENDIF»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a9/a9b212f26b5ec57463b1ed7a45079fd6b7b945b9.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a9/a9b212f26b5ec57463b1ed7a45079fd6b7b945b9.svn-base
deleted file mode 100644
index 30781e0be44..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/a9/a9b212f26b5ec57463b1ed7a45079fd6b7b945b9.svn-base
+++ /dev/null
@@ -1,65 +0,0 @@
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»this template is a copy of the original«ENDREM»
-
-/*
- * Copyright (c) 2006, 2009, 2012 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #368169 - extract common code to GMFT-specific runtime
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE extendsClause FOR gmfgen::GenDiagram»extends «EXPAND superClass»«ENDDEFINE»
-«DEFINE superClass FOR gmfgen::GenDiagram»org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase«ENDDEFINE»
-
-«DEFINE BaseEditHelper FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editHelpersPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «baseEditHelperClassName» «EXPAND extendsClause» {
-
- «EXPAND attributes-»
-
- «EXPAND getEditHelperAdvice-»
-
- «EXPAND getInsteadCommand-»
-
- «EXPAND getCreateCommand-»
-
- «EXPAND getCreateRelationshipCommand-»
-
- «EXPAND getDestroyElementCommand-»
-
- «EXPAND getDestroyReferenceCommand-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE editPolicyCommandConstant FOR gmfgen::GenDiagram»org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase.EDIT_POLICY_COMMAND«ENDDEFINE»
-
-«DEFINE contextElementTypeConstant FOR gmfgen::GenDiagram»org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«REM»
-All empty DEFINE's below are still here for backward compatibilty of AROUND's.
-However we don't have anything to generate here since common code had extracted to GMFT-runtime as part of #368169
-«ENDREM»
-«DEFINE getEditHelperAdvice FOR gmfgen::GenDiagram»«ENDDEFINE»
-«DEFINE getInsteadCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
-«DEFINE getCreateCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
-«DEFINE getCreateRelationshipCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
-«DEFINE getDestroyElementCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
-«DEFINE getDestroyReferenceCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/b0/b082b2b5f5250a8cf738252a10c80de728fc180c.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/b0/b082b2b5f5250a8cf738252a10c80de728fc180c.svn-base
deleted file mode 100644
index c751a2bd9c3..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/b0/b082b2b5f5250a8cf738252a10c80de728fc180c.svn-base
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2009 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»Overlaod only the method handlenotificationEventBody«ENDREM»
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-
-«AROUND handleNotificationEventBody FOR gmfgen::GenLinkLabel-»
- Object feature = event.getFeature();
- «EXPAND xpt::diagram::editparts::Common::handleText FOR self-»
-
- «REM»START Papyrus Code«ENDREM»
- «IF elementIcon-»
- if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){
- refreshLabel();
- }
- «ENDIF-»
- «REM»End Papyrus Code«ENDREM»
-
- super.handleNotificationEvent(event);
-«ENDAROUND» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/b6/b62e687ec906dda03be33162b7bd04ecf3ce18da.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/b6/b62e687ec906dda03be33162b7bd04ecf3ce18da.svn-base
deleted file mode 100644
index a0595abc8b2..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/b6/b62e687ec906dda03be33162b7bd04ecf3ce18da.svn-base
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * Remi Schnekenburger (CEA LIST) - modification for Papyrus MDT
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»computes super type of the link edit part in case the edit part manages a representation of a UML element«ENDREM»
-«DEFINE extendsListContents FOR gmfgen::GenLink-»
-
-«IF papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null)->size()<>0»
- «FOREACH papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null) AS extendedObject»«EXPAND specifyInheritance FOR extendedObject»«ENDFOREACH-»
-«ELSE»org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart
-«ENDIF»
-«ENDDEFINE»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»definition of the inheritance «ENDREM»
-«DEFINE specifyInheritance FOR papyrusgmfgenextension::ExtendedGenView-»«superOwnedEditPart»«ENDDEFINE»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-«DEFINE _constructor FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenLink-»
- super.createDefaultEditPolicies();
- «IF null = modelFacet-»
- installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy());
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
-«ENDDEFINE»
-
-«DEFINE addFixedChild FOR gmfgen::GenLink-»
- «IF labels->size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
- «FOREACH labels->asSequence() AS label-»
- «EXPAND addLabel(label) FOR label.viewmap-»
- «ENDFOREACH-»
- return false;
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE addLabel(label : gmfgen::GenLinkLabel) FOR gmfgen::Viewmap-»
-«ENDDEFINE»
-
-«DEFINE addLabel(label : gmfgen::GenLinkLabel) FOR gmfgen::ParentAssignedViewmap-»
- if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
- ((«label.getEditPartQualifiedClassName()») childEditPart).«EXPAND impl::diagram::editparts::TextAware::labelSetterName»(
- getPrimaryShape().«getterName»());
- return true;
- }
-«ENDDEFINE»
-
-«DEFINE removeFixedChild FOR gmfgen::GenLink-»
- «IF labels->size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
- «FOREACH labels->asSequence() AS label-»
- «EXPAND removeLabel(label) FOR label.viewmap-»
- «ENDFOREACH-»
- return false;
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE removeLabel(label : gmfgen::GenLinkLabel) FOR gmfgen::Viewmap-»
-«ENDDEFINE»
-
-«DEFINE removeLabel(label : gmfgen::GenLinkLabel) FOR gmfgen::ParentAssignedViewmap-»
- if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
- return true;
- }
-«ENDDEFINE»
-
-«DEFINE addChildVisual FOR gmfgen::GenLink-»
- «IF labels->size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE removeChildVisual FOR gmfgen::GenLink-»
- «IF labels->size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE createLinkFigure FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::generatedMemberComment(
- 'Creates figure for this edit part.\n' +
- '\n' +
- 'Body of this method does not depend on settings in generation model\n' +
- 'so you may safely remove <i>generated</i> tag and modify it.\n'
- )»
- «EXPAND createLinkFigure(self) FOR viewmap-»
-«ENDDEFINE»
-
-«DEFINE createLinkFigure(link : gmfgen::GenLink) FOR gmfgen::Viewmap-»
- «ERROR 'Unknown viewmap: ' + self.repr()-»
-«ENDDEFINE»
-
-«DEFINE createLinkFigure(link : gmfgen::GenLink) FOR gmfgen::FigureViewmap-»
- «LET (if figureQualifiedClassName = null then 'org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx' else figureQualifiedClassName endif) AS fqn-»
- protected org.eclipse.draw2d.Connection createConnectionFigure() {
- return new «fqn»();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «fqn» getPrimaryShape() {
- return («fqn») getFigure();
- }
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE createLinkFigure(link : gmfgen::GenLink) FOR gmfgen::SnippetViewmap»
- protected org.eclipse.draw2d.Connection createConnectionFigure() {
- return «body»;
- }
-«ENDDEFINE»
-
-«DEFINE createLinkFigure(link : gmfgen::GenLink) FOR gmfgen::InnerClassViewmap»
- protected org.eclipse.draw2d.Connection createConnectionFigure() {
- return new «className»();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «className» getPrimaryShape() {
- return («className») getFigure();
- }
-
- «classBody»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/be/be1e40b5e44bfdc113f8f82c370717e2dfabdc69.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/be/be1e40b5e44bfdc113f8f82c370717e2dfabdc69.svn-base
deleted file mode 100644
index 9d1d5f79cad..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/be/be1e40b5e44bfdc113f8f82c370717e2dfabdc69.svn-base
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2008, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * modified by Vincent Lorenzo (CEA LIST) - Vincent Lorenzo
- */
-«REM» This class is not used, now we use org.eclipse.papyrus.common.actions.DeleteFromModelAction «ENDREM»
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE DeleteElementAction FOR gmfgen::GenDiagram-»
-//This file is not used.
-//The DeleteElementAction is removed from the plugin and replaced by DeleteFromModelAction in the plugin org.eclipse.diagram.common.
-«ENDDEFINE»
-
-
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/c2/c2d6ad233b42312dc8086155fb281965af5d8e66.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/c2/c2d6ad233b42312dc8086155fb281965af5d8e66.svn-base
deleted file mode 100644
index 52ec49907bd..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/c2/c2d6ad233b42312dc8086155fb281965af5d8e66.svn-base
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * modified by Patrick Tessier (CEA LIST)
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»This template has been modify to allow the drag and drop«ENDREM»
-«REM»and install the mecanism of "filters views..." view for subelements«ENDREM»
-«REM»modification have been only done in the additions«ENDREM»
-
-«AROUND Main FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::DiagramEditPart::_constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::DiagramEditPart::createFigure-»
-«IF getAllNodes()->exists(n | n.labels->exists(not oclIsKindOf(gmfgen::GenExternalNodeLabel))) /*iow, NodeLabelEditPart template (GenNodeLabel target) will require this EditPolicy*/-»
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::nodeLabelDragPolicyClass»
-«ENDIF-»
-
-«IF links->exists(labels->notEmpty())-»
- «EXPAND impl::diagram::editparts::LinkLabelEditPart::linkLabelDragPolicyClass»
-«ENDIF-»
-
-
-}
-«ENDAROUND»
-
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»patches the super type of the diagram edit part in case the controlled object represents a UML element«ENDREM»
-«DEFINE extendsList FOR gmfgen::GenDiagram»extends «EXPAND impl::diagram::editparts::DiagramEditPart::extendsListContents»«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-
-«DEFINE implementsList FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public final static String MODEL_ID = "«editorGen.modelID»"; «EXPAND xpt::Common::nonNLS»
-
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR self-»
-
-
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::DiagramEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/c5/c57033b015cad0de9a6559ffdab2525a3faa0ea4.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/c5/c57033b015cad0de9a6559ffdab2525a3faa0ea4.svn-base
deleted file mode 100644
index 1f45d22a2af..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/c5/c57033b015cad0de9a6559ffdab2525a3faa0ea4.svn-base
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2006, 2010 Borland Software Corporation and others
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-«REM»DOCUMENTATION: PapyrusGencode«ENDREM»
-«REM»change to manage the figure of the comment«ENDREM»
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE EditPartFactory FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartFactoryClassName» implements org.eclipse.gef.EditPartFactory {
-
- «EXPAND createEditPartMethod-»
-
- «EXPAND createUnrecognizedEditPart-»
-
- «EXPAND getTextCellEditorLocator-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE createEditPartMethod FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.EditPart createEditPart(org.eclipse.gef.EditPart context, Object model) {
- if (model instanceof org.eclipse.gmf.runtime.notation.View) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) model;
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view)) {
- «EXPAND createEditPart FOR self-»
- «FOREACH getAllNodes()->asSequence() AS node-»
- «EXPAND createEditPart FOR node-»
- «EXPAND createEditPart FOREACH node.labels-»
- «ENDFOREACH-»
- «EXPAND createEditPart FOREACH compartments-»
- «FOREACH links->asSequence() AS link-»
- «EXPAND createEditPart FOR link-»
- «EXPAND createEditPart FOREACH link.labels»
- «ENDFOREACH-»
- }
- }
- return createUnrecognizedEditPart(context, model);
- }
-«ENDDEFINE»
-
-«DEFINE createEditPart FOR gmfgen::GenCommonBase»
- «EXPAND xpt::Common::caseVisualID»
- return new «getEditPartQualifiedClassName()»(view);
-«ENDDEFINE»
-
-«DEFINE createUnrecognizedEditPart FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.EditPart createUnrecognizedEditPart(org.eclipse.gef.EditPart context, Object model) {
- // Handle creation of unrecognized child node EditParts here
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE getTextCellEditorLocator FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator(
- org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart source) {
- if (source.getFigure() instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure){
- return new MultilineCellEditorLocator(
- (org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure) source.getFigure());
- }
- else {
- return org.eclipse.gmf.tooling.runtime.directedit.locator.CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
-
- }
- }
-
-
- «EXPAND xpt::Common::generatedClassComment»
- static private class MultilineCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
-
- «EXPAND xpt::Common::generatedClassComment»
- private org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure multilineEditableFigure;
-
- «EXPAND xpt::Common::generatedClassComment»
- public MultilineCellEditorLocator(org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure figure) {
- this.multilineEditableFigure = figure;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure getMultilineEditableFigure() {
- return multilineEditableFigure;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
- org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl();
- org.eclipse.draw2d.geometry.Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
- rect.x=getMultilineEditableFigure().getEditionLocation().x;
- rect.y=getMultilineEditableFigure().getEditionLocation().y;
- getMultilineEditableFigure().translateToAbsolute(rect);
- if (getMultilineEditableFigure().getText().length() > 0) {
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(text.computeSize(rect.width,
- SWT.DEFAULT)));
- }
- if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/cc/ccf4bdd705b3248573b41874b0fec21f65a2ce06.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/cc/ccf4bdd705b3248573b41874b0fec21f65a2ce06.svn-base
deleted file mode 100644
index 6179f525e54..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/cc/ccf4bdd705b3248573b41874b0fec21f65a2ce06.svn-base
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::edithelpers::EditHelperUtils»
-
-«DEFINE EditHelper FOR gmfgen::MetamodelType-»
-«EXPAND xpt::Common::copyright FOR diagramElement.getDiagram().editorGen-»
-package «diagramElement.getDiagram().editHelpersPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editHelperClassName» extends «getBaseEditHelperFullName(diagramElement.getDiagram())» {
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::MetamodelType»«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/d6/d6232533461a5d52a9b83dfc71866442743cfd94.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/d6/d6232533461a5d52a9b83dfc71866442743cfd94.svn-base
deleted file mode 100644
index ca7b58c8dfd..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/d6/d6232533461a5d52a9b83dfc71866442743cfd94.svn-base
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2008 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- * Vincent Lorenzo (CEA-LIST) - 335987: [General][Enhancement] Show/Hide Connectors Labels https://bugs.eclipse.org/bugs/show_bug.cgi?id=335987
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«DEFINE className FOR gmfgen::GenLink»«elementType.displayName»«getPreferencePageSuffix()»«ENDDEFINE»
-
-«DEFINE LinkPreferencePage FOR gmfgen::GenLink-»
-package «getDiagram().preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage {
-
-«EXPAND xpt::Common::generatedClassComment»
- public «EXPAND className»() {
- super();
- setPreferenceKey( «getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID+"_«elementType.displayName»");
- }
- «EXPAND xpt::Common::generatedClassComment»
- @Override
- protected String getBundleId() {
- return «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».ID;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public static void initDefaults(org.eclipse.jface.preference.IPreferenceStore store) {
- «REM» executed, only if the element has labels with defined role (using papyrusgmfgenextension::LabelVisibilityPreference) «ENDREM»
- «IF self.labels->exists(lbl0 : gmfgen::GenLinkLabel | (papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label0 : papyrusgmfgenextension::LabelVisibilityPreference | label0.linkLabels->includes(lbl0))->size()<>0))-»
- String key = «getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID+"_«elementType.displayName»";
- java.util.Map<String, Boolean> map = getStaticLabelVisibilityPreferences();
- for(String role : map.keySet()){
- String preferenceName = org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getLabelElementConstant(key, role, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.LABEL_VISIBILITY);
- store.setDefault(preferenceName, map.get(role));
- }
- «ENDIF-»
- «REM» end of the add for papyrusgmfgenextension::LabelVisibilityPreference«ENDREM»
- }
-
- «REM» executed, only if the element has labels with defined role (using papyrusgmfgenextension::LabelVisibilityPreference) «ENDREM»
- «IF self.labels->exists(lbl0 : gmfgen::GenLinkLabel | (papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label0 : papyrusgmfgenextension::LabelVisibilityPreference | label0.linkLabels->includes(lbl0))->size()<>0))-»
- «EXPAND xpt::Common::generatedClassComment»
- private static java.util.TreeMap<String,String> getStaticLabelRole(){
- java.util.TreeMap<String,String> map = new java.util.TreeMap<String, String>(new org.eclipse.papyrus.uml.diagram.common.util.StringComparator());
- «FOREACH labels AS lbl-»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(lbl))->size()<>0-»
- map.put(
- "«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(lbl))->asSequence()->first().role»"
- ,"«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(lbl))->asSequence()->first().iconPathRole»"
- );//$NON-NLS-1$ //$NON-NLS-2$
- «ENDIF-»
- «ENDFOREACH-»
- return map;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- private static java.util.TreeMap<String,Boolean> getStaticLabelVisibilityPreferences(){
- java.util.TreeMap<String,Boolean> map = new java.util.TreeMap<String,Boolean>();
- «FOREACH labels AS lbl-»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(lbl))->size()<>0-»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(lbl))->asSequence()->first().visibleByDefault=true-»
- map.put("«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(lbl))->asSequence()->first().role»"
- ,Boolean.TRUE);
- «ELSE»
- map.put("«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.linkLabels->includes(lbl))->asSequence()->first().role»"
- ,Boolean.FALSE);//$NON-NLS-1$
- «ENDIF»
- «ENDIF-»
- «ENDFOREACH-»
- return map;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- protected java.util.TreeMap<String,String> getLabelRole(){
- return getStaticLabelRole();
- }
- «ENDIF»
- «REM» end of the code used to managed papyrusgmfgenextension::LabelVisibilityPreference«ENDREM»
-}
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/dc/dc446fa4cb140a4935fd5819e7384f4708896060.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/dc/dc446fa4cb140a4935fd5819e7384f4708896060.svn-base
deleted file mode 100644
index eba77907a96..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/dc/dc446fa4cb140a4935fd5819e7384f4708896060.svn-base
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * modified by Patrick Tessier (CEA LIST, patch from Vincent Lorenzo)
- * Vincent Lorenzo (CEA-LIST) - bug 335987: [General][Enhancement] Show/Hide Connectors Labels https://bugs.eclipse.org/bugs/show_bug.cgi?id=335987
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::diagram::editparts::Utils»
-«REM»DOCUMENTATION: PapyrusGenCode«ENDREM»
-«REM»Overloads only superclasseses and the interfaces that implements this class«ENDREM»
-
-«AROUND extendsList FOR gmfgen::GenExternalNodeLabel-»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»specify a java super class for external nodes«ENDREM»
-«IF papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null)->size()<>0»
- extends «FOREACH papyrusgmfgenextension::ExtendedGenView.allInstances()->select(v:papyrusgmfgenextension::ExtendedGenView|v.genView->includes(self) and v.superOwnedEditPart<>null) AS extendedObject»«EXPAND specifyInheritance FOR extendedObject»«ENDFOREACH-»
-«ELSE»
- «targetDef.proceed()»
-«ENDIF»
-«REM»END: PapyrusGenCode«ENDREM»
-«ENDAROUND»
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»definition of the inheritance «ENDREM»
-«DEFINE specifyInheritance FOR papyrusgmfgenextension::ExtendedGenView-»«superOwnedEditPart»«ENDDEFINE»
-«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-
-«REM» we add the interface ILabelRoleProvider «ENDREM»
-«AROUND implementsList FOR gmfgen::GenExternalNodeLabel-»
- «targetDef.proceed()»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(self))->size()<>0-»
- , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider
- «ENDIF-»
- «REM»END: PapyrusGenCode«ENDREM»
-«ENDAROUND»
-
-«REM» we add the methods provided by the interface «ENDREM»
-«AROUND additions FOR gmfgen::GenExternalNodeLabel-»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «IF papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(self))->size()<>0»
- «EXPAND xpt::Common::generatedClassComment»
- public String getLabelRole(){
- return "«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(self))->asSequence()->first().role»";//$NON-NLS-1$
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- public String getIconPathRole(){
- return "«papyrusgmfgenextension::LabelVisibilityPreference.allInstances()->select(label : papyrusgmfgenextension::LabelVisibilityPreference | label.externalNodeLabels->includes(self))->asSequence()->first().iconPathRole»";//$NON-NLS-1$
- }
- «ENDIF»
- «REM»END: PapyrusGenCode«ENDREM»
-«ENDAROUND» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/de/de73f8aecf873153fda5a4ee311dbdb0628b0e58.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/de/de73f8aecf873153fda5a4ee311dbdb0628b0e58.svn-base
deleted file mode 100644
index 16cf63832b6..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/de/de73f8aecf873153fda5a4ee311dbdb0628b0e58.svn-base
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-
-«EXTENSION xpt::diagram::updater::Utils»
-
-«DEFINE childContainerCreateCommand FOR Sequence(gmfgen::GenNode)-»
-«IF not self->isEmpty()-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
- if(requestElementType == null) {
- return super.getCreateCommand(req);
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if(requestElementType instanceof org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType) {
- baseElementType = org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils.getClosestDiagramType(requestElementType);
- if(baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils.findClosestNonExtendedElementType((org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType)requestElementType);
- isExtendedType = true;
- }
- }
- «FOREACH self AS n-»
- «EXPAND childNodeCreateCommand(n) FOR n.modelFacet-»
- «ENDFOREACH-»
- return super.getCreateCommand(req);
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE childNodeCreateCommand(node : gmfgen::GenNode) FOR gmfgen::TypeModelFacet-»
-if («EXPAND xpt::providers::ElementTypes::accessElementType FOR node» == baseElementType) {
- «IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()>0-»
- // adjust the containment feature
- org.eclipse.emf.ecore.EReference containmentFeature = «EXPAND MetaModel::MetaFeature FOR self.childMetaFeature»;
- req.setContainmentFeature(containmentFeature);
- «ENDIF»
- if(isExtendedType) {
- return getExtendedTypeCreationCommand(req, (org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType)requestElementType);
- }
- «IF papyrusgmfgenextension::GenerateUsingElementTypeCreationCommand.allInstances()->size()>0»
- return getGEFWrapper(getSemanticCreationCommand(req));
- «ELSE-»
- return getGEFWrapper(new «node.getCreateCommandQualifiedClassName()»(req));
- «ENDIF»
-
-}
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e1/e1fce7de68e74dd7cad362ec6b8015734c8d7454.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e1/e1fce7de68e74dd7cad362ec6b8015734c8d7454.svn-base
deleted file mode 100644
index 15b7757ec06..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e1/e1fce7de68e74dd7cad362ec6b8015734c8d7454.svn-base
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2008 Atos Origin
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Thibault Landre (Atos Origin) - initial API and implementation
- * modified by Patrick Tessier
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-
-«DEFINE className FOR gmfgen::GenDiagram»DiagramPreferenceInitializer«ENDDEFINE»
-
-«AROUND PreferenceInitializer FOR gmfgen::GenDiagram-»
-
-package «preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void initializeDefaultPreferences() {
- org.eclipse.jface.preference.IPreferenceStore store = getPreferenceStore();
- «FOREACH getAllNodes().elementType.displayName->asSet() AS string -»
- «IF 'UNDEFINED' <> string.toUpper()»
- «self.preferencesPackageName».«string»PreferencePage.initDefaults(store);
- «ENDIF»
- «ENDFOREACH»
-
- «FOREACH links.elementType.displayName->asSet() AS string -»
- «IF 'UNDEFINED' <> string.toUpper()»
- «self.preferencesPackageName».«string»PreferencePage.initDefaults(store);
- «ENDIF»
- «ENDFOREACH»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() {
- return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore();
- }
-}
-«ENDAROUND»
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e2/e2541063afa0f72d551f6d30770becdc043c6797.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e2/e2541063afa0f72d551f6d30770becdc043c6797.svn-base
deleted file mode 100644
index 4cfc8ddcaf9..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e2/e2541063afa0f72d551f6d30770becdc043c6797.svn-base
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Ansgar Radermacher (CEA LIST) - added support for EMF validation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE ValidationDecoratorProvider FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «providersPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «validationDecoratorProviderClassName»
- extends org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider
- implements org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) {
- org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) decoratorTarget.getAdapter(org.eclipse.gef.EditPart.class);
- if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart ||
- editPart instanceof org.eclipse.gef.editparts.AbstractConnectionEditPart) {
- Object model = editPart.getModel();
- if ((model instanceof org.eclipse.gmf.runtime.notation.View)) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) model;
- if (!(view instanceof org.eclipse.gmf.runtime.notation.Edge) && !view.isSetElement()) {
- return;
- }
- }
- org.eclipse.gef.EditDomain ed = editPart.getViewer().getEditDomain();
- if (!(ed instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain)) {
- return;
- }
- if (((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain) ed).getEditorPart() instanceof
- «editorGen.editor.getQualifiedClassName()») {
- decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
- }
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
- if (!(operation instanceof org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation)) {
- return false;
- }
- org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget =
- ((org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation) operation).getDecoratorTarget();
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) decoratorTarget.getAdapter(
- org.eclipse.gmf.runtime.notation.View.class);
- return view != null && «EXPAND xpt::editor::VisualIDRegistry::modelID».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view));
- }
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e5/e554fc779411e493e0eea8654a79c0fae9cb5b8d.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e5/e554fc779411e493e0eea8654a79c0fae9cb5b8d.svn-base
deleted file mode 100644
index 2c72f699c08..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/e5/e554fc779411e493e0eea8654a79c0fae9cb5b8d.svn-base
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- * modified by Patrick Tessier (CEA LIST)
- */
-
-«REM»DOCUMENTATION: PapyrusGenCode«ENDREM»
-«REM»add call template in order to generate handlenotification in order to refresh figure by taking account event«ENDREM»
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE Main FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::_constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM»call tamplate to paste code for refresh figure by taking account event«ENDREM»
- «EXPAND impl::diagram::editparts::NodeEditPart::specificHandleNotificationEvent-»
- «REM»BEGIN: PapyrusGenCode«ENDREM»
-
-
- «EXPAND impl::diagram::editparts::NodeEditPart::createLayoutEditPolicy-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::createNodeShape(self) FOR viewmap-»
-
-«IF hasFixedChildren(self)-»
- «EXPAND impl::diagram::editparts::NodeEditPart::addFixedChild-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::removeFixedChild-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::addChildVisual-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::removeChildVisual-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getContentPaneFor-»
-«ENDIF-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::addBorderItem-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::createNodePlate-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getPrimaryDragEditPolicy-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::createFigure-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setupContentPane-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getContentPane-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setForegroundColor-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setLineWidth-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setLineStyle-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getPrimaryChildEditPart-»
-
-«IF getAssistantOutgoingLinks(self)->size() > 0-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnSource-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnSourceAndTarget-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMATypesForTarget-»
-«ENDIF-»
-
-«IF getAssistantIncomingLinks(self)->size() > 0-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnTarget-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMATypesForSource-»
-«ENDIF-»
-
-«IF hasChildrenInListCompartments(self)-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getTargetEditPartMethod-»
-«ENDIF-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::innerClassDeclaration FOR viewmap-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»patches the super type of the node edit part in case the controlled object represents a UML element«ENDREM»
-«DEFINE extendsList FOR gmfgen::GenNode»extends «EXPAND impl::diagram::editparts::NodeEditPart::extendsListContents»«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
-«DEFINE implementsList FOR gmfgen::GenNode»«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNode-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR self-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure contentPane;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure primaryShape;
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::NodeEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenNode-»
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenTopLevelNode-»
- «REM»This code is important for refreshing shortcut decoration
- on adding corresponding annotation to the View instance.«ENDREM»
- «IF getDiagram().generateShortcutIcon()-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- «EXPAND impl::diagram::editparts::NodeEditPart::handleNotificationEventBody-»
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNode-»
- «EXPAND impl::diagram::editparts::NodeEditPart::genPreferredValue-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f6/f6e57f83dd1af212101f5c0a53e887a854e46ef7.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f6/f6e57f83dd1af212101f5c0a53e887a854e46ef7.svn-base
deleted file mode 100644
index 2996685cf1a..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f6/f6e57f83dd1af212101f5c0a53e887a854e46ef7.svn-base
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
-«DEFINE Activator FOR gmfgen::GenPlugin-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «activatorClassName» extends org.eclipse.ui.plugin.AbstractUIPlugin {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static final String ID = "«iD»"; //$NON-NLS-1$
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static final org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint DIAGRAM_PREFERENCES_HINT =
- new org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint(ID);
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static «activatorClassName» instance;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.emf.edit.provider.ComposedAdapterFactory adapterFactory;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «editorGen.diagram.getDocumentProviderQualifiedClassName()» documentProvider;
-
-«IF editorGen.diagram.links->exists(not sansDomain)-»
- «EXPAND xpt::Common::generatedMemberComment»
- private «editorGen.diagram.getLinkCreationConstraintsQualifiedClassName()» linkConstraints;
-
-«ENDIF-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «editorGen.diagram.getElementInitializersPackageName()».«editorGen.diagram.getElementInitializersClassName()» initializers;
-
-«IF not editorGen.expressionProviders.oclIsUndefined() -»
-«FOREACH editorGen.expressionProviders.providers[gmfgen::GenExpressionInterpreter] AS p-»
- «EXPAND xpt::Common::generatedMemberComment»
- private «p.getQualifiedClassName()» «p.language»Factory;
-«ENDFOREACH-»
-«ENDIF-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «activatorClassName»() {
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void start(org.osgi.framework.BundleContext context) throws Exception {
- super.start(context);
- instance = this;
- org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
- adapterFactory = createAdapterFactory();
- «self.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer diagramPreferenceInitializer = new «self.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer();
- diagramPreferenceInitializer.initializeDefaultPreferences();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void stop(org.osgi.framework.BundleContext context) throws Exception {
- adapterFactory.dispose();
- adapterFactory = null;
-«IF editorGen.diagram.links->exists(not sansDomain)-»
- linkConstraints = null;
-«ENDIF-»
- initializers = null;
-«IF not editorGen.expressionProviders.oclIsUndefined() -»
-«FOREACH editorGen.expressionProviders.providers[gmfgen::GenExpressionInterpreter] AS p-»
- «p.language»Factory = null;
-«ENDFOREACH-»
-«ENDIF-»
- instance = null;
- super.stop(context);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static «activatorClassName» getInstance() {
- return instance;
- }
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() {
- org.eclipse.jface.preference.IPreferenceStore store=org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
- return store;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.emf.edit.provider.ComposedAdapterFactory createAdapterFactory() {
- «EXPAND CodeStyle::newGenericInstance('factories', 'java.util.ArrayList', 'org.eclipse.emf.common.notify.AdapterFactory') FOR editorGen.diagram»();
- fillItemProviderFactories(factories);
- return new org.eclipse.emf.edit.provider.ComposedAdapterFactory(factories);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void fillItemProviderFactories(«EXPAND CodeStyle::G('java.util.List', 'org.eclipse.emf.common.notify.AdapterFactory') FOR editorGen.diagram» factories) {
-«EXPAND MetaModel::PopulateItemProviderFactories('factories') FOR editorGen-»
- factories.add(new org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory());
- factories.add(new org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory());
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.common.notify.AdapterFactory getItemProvidersAdapterFactory() {
- return adapterFactory;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.resource.ImageDescriptor getItemImageDescriptor(Object item) {
- org.eclipse.emf.edit.provider.IItemLabelProvider labelProvider =
- (org.eclipse.emf.edit.provider.IItemLabelProvider) adapterFactory.adapt(
- item, org.eclipse.emf.edit.provider.IItemLabelProvider.class);
- if (labelProvider != null) {
- return org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getInstance().getImageDescriptor(
- labelProvider.getImage(item));
- }
- return null;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @generated
- * @param path the path
- * @return the image descriptor
- */
- public static org.eclipse.jface.resource.ImageDescriptor getBundledImageDescriptor(String path) {
- return org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
- }
-
- /**
- * Respects images residing in any plug-in. If path is relative,
- * then this bundle is looked up for the image, otherwise, for absolute
- * path, first segment is taken as id of plug-in with image
- *
- * @generated
- * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
- * @return the image descriptor
- */
- public static org.eclipse.jface.resource.ImageDescriptor findImageDescriptor(String path) {
- final org.eclipse.core.runtime.IPath p = new org.eclipse.core.runtime.Path(path);
- if (p.isAbsolute() && p.segmentCount() > 1) {
- return org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(
- p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
- } else {
- return getBundledImageDescriptor(p.makeAbsolute().toString());
- }
- }
-
- /**
- * Returns an image for the image file at the given plug-in relative path.
- * Client do not need to dispose this image. Images will be disposed automatically.
- *
- * @generated
- * @param path the path
- * @return image instance
- */
- public org.eclipse.swt.graphics.Image getBundledImage(String path) {
- org.eclipse.swt.graphics.Image image = getImageRegistry().get(path);
- if (image == null) {
- getImageRegistry().put(path, getBundledImageDescriptor(path));
- image = getImageRegistry().get(path);
- }
- return image;
- }
-
- /**
- * Returns string from plug-in's resource bundle
- *
- * @generated
- */
- public static String getString(String key) {
- return org.eclipse.core.runtime.Platform.getResourceString(
- getInstance().getBundle(), "%" + key); //$NON-NLS-1$
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «editorGen.diagram.getDocumentProviderQualifiedClassName()» getDocumentProvider() {
- if (documentProvider == null) {
- documentProvider = new «editorGen.diagram.getDocumentProviderQualifiedClassName()»();
- }
- return documentProvider;
- }
-
-«IF editorGen.diagram.links->exists(not sansDomain) -»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editorGen.diagram.getLinkCreationConstraintsQualifiedClassName()» getLinkConstraints() {
- return linkConstraints;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setLinkConstraints(«editorGen.diagram.getLinkCreationConstraintsQualifiedClassName()» lc) {
- this.linkConstraints = lc;
- }
-
-«ENDIF-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editorGen.diagram.getElementInitializersPackageName()».«editorGen.diagram.getElementInitializersClassName()» getElementInitializers() {
- return initializers;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setElementInitializers(«editorGen.diagram.getElementInitializersPackageName()».«editorGen.diagram.getElementInitializersClassName()» i) {
- this.initializers = i;
- }
-
-«IF not editorGen.expressionProviders.oclIsUndefined() -»
-«FOREACH editorGen.expressionProviders.providers[gmfgen::GenExpressionInterpreter] AS p-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «p.getQualifiedClassName()» get«p.className»() {
- return «p.language»Factory;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void set«p.className»(«p.getQualifiedClassName()» f) {
- this.«p.language»Factory = f;
- }
-
-«ENDFOREACH-»
-«ENDIF-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void logError(String error) {
- logError(error, null);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void logError(String error, Throwable throwable) {
- if (error == null && throwable != null) {
- error = throwable.getMessage();
- }
- getLog().log(new org.eclipse.core.runtime.Status(
- org.eclipse.core.runtime.IStatus.ERROR,
- «activatorClassName».ID,
- org.eclipse.core.runtime.IStatus.OK,
- error, throwable));
- debug(error, throwable);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void logInfo(String message) {
- logInfo(message, null);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void logInfo(String message, Throwable throwable) {
- if (message == null && throwable != null) {
- message = throwable.getMessage();
- }
- getLog().log(new org.eclipse.core.runtime.Status(
- org.eclipse.core.runtime.IStatus.INFO,
- «activatorClassName».ID,
- org.eclipse.core.runtime.IStatus.OK,
- message, throwable));
- debug(message, throwable);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private void debug(String message, Throwable throwable) {
- if (!isDebugging()) {
- return;
- }
- if (message != null) {
- System.err.println(message);
- }
- if (throwable != null) {
- throwable.printStackTrace();
- }
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-// Perhaps, xpt:editor::Editor or some xpt::CommonCode would be better place for
-// this accessor.
-// XXX besides, consider using preference store directly, without a hint (see comment in Editor.xpt#getPreferencesHint)
-«DEFINE preferenceHintAccess FOR gmfgen::GenEditorGenerator»«plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenPlugin»«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f8/f8124f7b164c2e1970a03fff1b315505be9b7c1a.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f8/f8124f7b164c2e1970a03fff1b315505be9b7c1a.svn-base
deleted file mode 100644
index e12a3b7641b..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f8/f8124f7b164c2e1970a03fff1b315505be9b7c1a.svn-base
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-«EXTENSION xpt::EMFUtils»
-«EXTENSION xpt::diagram::updater::Utils»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION gmf::GenModelUtils»
-
-«DEFINE checkChildElementVisualID(inLoop : Boolean) FOR gmfgen::GenNode-»
-if (visualID == «EXPAND xpt::editor::VisualIDRegistry::visualID») {
- result.add(new «getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(«IF null <> modelFacet.childMetaFeature»«EXPAND MetaModel::DowncastToEObject('childElement') FOR getTypeGenClassX(modelFacet.childMetaFeature)»«ENDIF», visualID));
-«IF inLoop-»
- continue;
-«ENDIF-»
-}
-«ENDDEFINE»
-
-«REM»TEST «ENDREM»
-«DEFINE getSemanticChildrenOfView FOR gmfgen::GenContainerBase-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public static «EXPAND CodeStyle::G('java.util.List', getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName())» «EXPAND getSemanticChildrenMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- «IF getSemanticChildrenChildFeatures(self)->size() > 0 or self.getPhantomNodes()->size() > 0-»
- «EXPAND defineModelElement-»
- «EXPAND CodeStyle::newGenericInstance('result', 'java.util.LinkedList', getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName())»();
-«REM»childMetaFeature can be null here!«ENDREM»«-»
- «FOREACH getSemanticChildrenChildFeatures(self) AS childMetaFeature-»
- «IF null = childMetaFeature-»
- { /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify Class here manually*/ childElement = /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/;
- «ELSEIF isListType(childMetaFeature)-»
- for («EXPAND CodeStyle::G('java.util.Iterator', '?')» it = «EXPAND MetaModel::getFeatureValue('modelElement', self.getModelElementType()) FOR childMetaFeature».iterator(); it.hasNext();) {
- «EXPAND MetaModel::DeclareAndAssign('childElement', 'it.next()', true) FOR getTypeGenClassX(childMetaFeature)»
- «ELSE-»
- { «EXPAND MetaModel::DeclareAndAssign('childElement', 'modelElement', self.getModelElementType(), childMetaFeature) FOR getTypeGenClassX(childMetaFeature)»
- «ENDIF-»
- int visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, «EXPAND MetaModel::DowncastToEObject('childElement') FOR getTypeGenClassX(childMetaFeature)»);
- «EXPAND checkChildElementVisualID(null <> childMetaFeature and isListType(childMetaFeature)) FOREACH getSemanticChildren(self, childMetaFeature)-»
- }
- «ENDFOREACH-»
-«IF self.getPhantomNodes()->notEmpty()-»
- org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
- for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) {
- org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next();
-
- if (childElement == modelElement) {
- continue;
- }
- «EXPAND addNextIfPhantom FOREACH self.getPhantomNodes()-»
- }
-«ENDIF-»
- return result;
- «ELSE-»
- return «EXPAND CodeStyle::emptyList»;
- «ENDIF-»
-}
-«ENDDEFINE»
-«REM»FIN TEST «ENDREM»
-
-
-
-«REM»The EcoreSwitch that will navigate the proper features according to the canvas' EObject«ENDREM»
-«DEFINE createUpdaterSwitch FOR gmfgen::GenDiagram»
-«EXPAND xpt::Common::generatedMemberComment»
- static class ThisDiagramUpdaterSwitch extends es.cv.gvcase.mdt.common.util.BasicEcoreSwitch<java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>, org.eclipse.gmf.runtime.notation.View> {
- @Override
- public java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> doSwitch(org.eclipse.emf.ecore.EObject modelElement) {
- «REM»getInfo provides the View«ENDREM»
- final org.eclipse.gmf.runtime.notation.View view = getInfo();
- if (view == null) {
- return java.util.Collections.EMPTY_LIST;
- }
-
- «getModelSwitchQualifiedName(domainDiagramElement)»<java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>> aSwitch = new «getModelSwitchQualifiedName(domainDiagramElement)»<java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>>() {
- «REM»Start of cases«ENDREM»
- @Override
- public java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> case«domainDiagramElement.ecoreClass.name»(«EXPAND MetaModel::MetaClass FOR domainDiagramElement» modelElement) {
- java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> result = new java.util.LinkedList<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>();
- «FOREACH getSemanticChildrenChildFeatures(self) AS childMetaFeature-»
- «IF null = childMetaFeature-»
- { /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify Class here manually*/ childElement = /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/;
- «ELSEIF isListType(childMetaFeature)-»
- for (java.util.Iterator it = «EXPAND xpt::Common::getFeatureValue('modelElement', getModelElementType()) FOR childMetaFeature».iterator(); it.hasNext();) {
- «EXPAND MetaModel::MetaClass FOR getTypeGenClassX(childMetaFeature)» childElement = («getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))») it.next();
- «ELSE-»
- { «getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))» childElement = «EXPAND xpt::Common::getFeatureValue('modelElement', getModelElementType()) FOR childMetaFeature»;
- «ENDIF-»
- int visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, «EXPAND xpt::Common::castToEObject FOR getTypeGenClassX(childMetaFeature)»childElement);
- «EXPAND checkChildElementVisualID(null <> childMetaFeature and isListType(childMetaFeature)) FOREACH getSemanticChildren(self, childMetaFeature)-»
- }
- «ENDFOREACH-»
- «IF not getPhantomNodes(self).isEmpty()-»
- org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
- for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) {
- org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next();
- if (childElement == modelElement) {
- continue;
- }
- «EXPAND addNextIfPhantom FOREACH getPhantomNodes(self)-»
- }
- «ENDIF-»
- return result;
- }
-
- «FOREACH getReferencingObjects().typeSelect(AlternateCanvas) AS referencer»
- @Override
- public java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> case«referencer.domainDiagramElement.ecoreClass.name»(«getQualifiedInterfaceName(referencer.domainDiagramElement)» modelElement) {
- java.util.List<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»> result = new java.util.LinkedList<«editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»>();
- «REM»«FOREACH getSemanticChildrenChildFeatures(this) AS childMetaFeature-»«ENDREM»
- «FOREACH getMutatingChildrenFeatures(referencer) AS childMetaFeature-»
- «IF null = childMetaFeature-»
- { /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify Class here manually*/ childElement = /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/;
- «ELSEIF isListType(childMetaFeature)-»
- for (java.util.Iterator it = «EXPAND xpt::Common::getFeatureValue('modelElement', referencer.domainDiagramElement) FOR childMetaFeature».iterator(); it.hasNext();) {
- «getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))» childElement = («getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))») it.next();
- «ELSE-»
- { «getQualifiedInterfaceName(getTypeGenClassX(childMetaFeature))» childElement = «EXPAND xpt::Common::getFeatureValue('modelElement', referencer.domainDiagramElement) FOR childMetaFeature»;
- «ENDIF-»
- int visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, «EXPAND xpt::Common::castToEObject FOR getTypeGenClassX(childMetaFeature)»childElement);
- «REM»«EXPAND checkChildElementVisualID(null != childMetaFeature && isListType(childMetaFeature)) FOREACH getSemanticChildren(this, childMetaFeature)-»«ENDREM»
- «EXPAND checkMutatingChildElementVisualID(null <> childMetaFeature and isListType(childMetaFeature)) FOREACH getMutatingSemanticChildren(referencer, childMetaFeature)-»
- }
- «ENDFOREACH-»
- «REM»«IF !getPhantomNodes(this).isEmpty()-»
- org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
- for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) {
- org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next();
- if (childElement == modelElement) {
- continue;
- }
- «EXPAND addNextIfPhantom FOREACH getPhantomNodes(this)-»
- }
- «ENDIF-»
- «ENDREM»
- return result;
- }
- «ENDFOREACH»
-
- «REM»End of cases«ENDREM»
- };
- return aSwitch.doSwitch(modelElement);
- }
- };
- «REM»The global variable for a Switch«ENDREM»
- «EXPAND xpt::Common::generatedMemberComment»
- private static ThisDiagramUpdaterSwitch aSwitch = new ThisDiagramUpdaterSwitch();
-«ENDDEFINE»
-«REM» Mutating check Visual ID «ENDREM»
-«DEFINE checkMutatingChildElementVisualID(boolean inLoop) FOR papyrusgmfgenextension::AlternateGenTopLevelNode-»
- if (visualID == «EXPAND visualID») {
- result.add(new «genTopLevelNode.getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(«IF null <> typeModelFacet.childMetaFeature»«EXPAND xpt::Common::castToEObject FOR getTypeGenClassX(typeModelFacet.childMetaFeature)»«ENDIF»childElement, visualID));
- «IF inLoop-»
- continue;
- «ENDIF-»
- }
-«ENDDEFINE»
-«REM» Mutating VisualID espansion «ENDREM»
-«DEFINE visualID FOR papyrusgmfgenextension::AlternateGenTopLevelNode»
- «EXPAND xpt::editor::VisualIDRegistry::visualID FOR genTopLevelNode»
-«ENDDEFINE»
-«DEFINE defineModelElement FOR gmfgen::GenContainerBase-»
-if (!view.isSetElement()) {
- return java.util.Collections.EMPTY_LIST;
-}
-«EXPAND MetaModel::DeclareAndAssign('modelElement', 'view.getElement()') FOR getModelElementType()»
-«ENDDEFINE»
-«DEFINE getContainedLinksByTypeMethodBody(genLink : gmfgen::GenLink, sourceVarDefined : Boolean) FOR gmfgen::TypeLinkModelFacet-»
-java.util.Collection result = new java.util.LinkedList();
- «LET isListType(childMetaFeature) AS inLoop-»
-«IF inLoop-»
-for (java.util.Iterator links = «EXPAND MetaModel::getFeatureValue('container', childMetaFeature.genClass) FOR childMetaFeature».iterator(); links.hasNext();) {
- org.eclipse.emf.ecore.EObject linkObject = (org.eclipse.emf.ecore.EObject ) links.next();
- if («EXPAND MetaModel::NotInstance('linkObject') FOR metaClass») {
- continue;
- }
- «EXPAND MetaModel::DeclareAndAssign('link', 'linkObject') FOR metaClass»
-«ELSE-»
- «IF getTypeGenClassX(childMetaFeature) = metaClass-»
- «EXPAND MetaModel::DeclareAndAssign('link', 'container', getSourceType(), childMetaFeature) FOR metaClass»
- «ELSE-»
- «EXPAND MetaModel::DeclareAndAssign('linkObject', 'container', getSourceType(), childMetaFeature) FOR getTypeGenClassX(childMetaFeature)»
- if («EXPAND MetaModel::NotInstance('linkObject') FOR metaClass») {
- return result;
- }
- «EXPAND MetaModel::DeclareAndAssign('link', 'linkObject') FOR metaClass»
- «ENDIF-»
-«ENDIF-»
- «EXPAND checkLinkVisualID(genLink, inLoop)-»
-
- «REM»BEGIN: PapyrusGenCode«ENDREM»
- «REM»Test if the source and target reference the same feature, in this case generation with collection«ENDREM»
-
- «IF self.sourceMetaFeature=self.targetMetaFeature»
- //Papyrus GenCode
- «EXPAND defineLinkDestinationForSet(inLoop) FOR self-»
- «IF null <> sourceMetaFeature-»
- «EXPAND defineLinkSource(inLoop)-»
- «IF sourceVarDefined-»
- «EXPAND checkLinkSource(inLoop)-»
- «ENDIF-»
- «EXPAND addLinkDescriptor(genLink, 'src', 'dst')-»
- «ELSE-»
- «EXPAND addLinkDescriptor(genLink, 'container', 'dst')-»
- «ENDIF-»
- «ELSE»
- «REM»END: PapyrusGenCode«ENDREM»
- «EXPAND defineLinkDestination(inLoop)-»
- «IF null <> sourceMetaFeature-»
- «EXPAND defineLinkSource(inLoop)-»
- «IF sourceVarDefined-»
- «EXPAND checkLinkSource(inLoop)-»
- «ENDIF-»
- «EXPAND addLinkDescriptor(genLink, 'src', 'dst')-»
- «ELSE-»
- «EXPAND addLinkDescriptor(genLink, 'container', 'dst')-»
- «ENDIF-»
-«REM»BEGIN: PapyrusGenCode«ENDREM»
- «ENDIF-»
- «REM»END: PapyrusGenCode«ENDREM»
-«IF inLoop-»
-}
-«ENDIF-»
- «ENDLET-»
-return result;
-«ENDDEFINE»
-«DEFINE defineLinkSource(inLoop : Boolean) FOR gmfgen::TypeLinkModelFacet-»
- «IF isListType(sourceMetaFeature)-»
-java.util.List sources = «EXPAND MetaModel::getFeatureValue('link', metaClass) FOR sourceMetaFeature»;
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»In the case of set greater that 1! not equal«ENDREM»
-Object theSource = sources.size() >= 1 ? sources.get(0) : null;
-«REM»END: PapyrusGenCode«ENDREM»
-if («EXPAND MetaModel::NotInstance('theSource') FOR getSourceType()») {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«EXPAND MetaModel::DeclareAndAssign('src', 'theSource', true) FOR getSourceType()»
- «ELSE-»
-«EXPAND MetaModel::DeclareAndAssign('src', 'link', metaClass, sourceMetaFeature) FOR getSourceType()»
- «ENDIF-»
-«ENDDEFINE»
-«DEFINE checkLinkSource(inLoop : Boolean) FOR gmfgen::TypeLinkModelFacet-»
-if (src != source) {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«ENDDEFINE»
-
-
-«REM»BEGIN: PapyrusGenCode«ENDREM»
-«REM»Define target and source that can manage set«ENDREM»
-«DEFINE defineLinkDestinationForSet(inLoop:Boolean) FOR gmfgen::TypeLinkModelFacet-»
- «IF isListType(targetMetaFeature)-»
-java.util.List targets = «EXPAND MetaModel::getFeatureValue('link', metaClass) FOR targetMetaFeature»;
-Object theTarget = targets.size() >=2 ? targets.get(1) : null;
-if («EXPAND MetaModel::NotInstance('theTarget') FOR getTargetType()») {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«EXPAND MetaModel::DeclareAndAssign('dst', 'theTarget', true) FOR getTargetType()»
- «ELSE-»
-«EXPAND MetaModel::DeclareAndAssign('dst', 'link', metaClass, targetMetaFeature) FOR getTargetType()»
- «ENDIF-»
-«ENDDEFINE»
-«REM»END: PapyrusGenCode«ENDREM»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f8/f84763c5f1cafb42cb07641f66bbc428a97bab75.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f8/f84763c5f1cafb42cb07641f66bbc428a97bab75.svn-base
deleted file mode 100644
index 3dd05b1d7b7..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/f8/f84763c5f1cafb42cb07641f66bbc428a97bab75.svn-base
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
-
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Thibault Landre (Atos Origin) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::diagram::Utils»
-«EXTENSION xpt::GenEditorGenerator»
-
-«EXTENSION xpt::preferences::PrefsConstant»
-«EXTENSION xpt::editor::palette::Utils»
-
-«DEFINE category FOR gmfgen::GenDiagram»«getDiagramPreferencePageCategory()».«editorGen.modelID»«ENDDEFINE»
-
-
-
-«AROUND plugin FOR gmfgen::GenPlugin-»
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-«EXPAND xpt::Common::xcopyright FOR editorGen-»
-<plugin>
-«REM»YT (not used): «EXPAND fileTypes-»«ENDREM»
-«REM»YT (not used): «EXPAND extension_parser-»«ENDREM»
-«EXPAND xpt::editor::extensions::extensions FOR editorGen-»
-«REM» global actions handled in the diagram.common plugin
-«EXPAND xpt::plugin::plugin::menu-»«ENDREM»
-«EXPAND xpt::plugin::plugin::validation FOR editorGen.diagram-»
-«EXPAND xpt::plugin::plugin::metrics FOR editorGen.metrics-»
-«REM»RS: redefine palette generation«ENDREM»
-«EXPAND palettePredefinedEntries FOR editorGen-»
-«EXPAND paletteEntries FOR editorGen-»
-«EXPAND xpt::diagram::preferences::extensions::extensions FOR editorGen.diagram-»
-«EXPAND xpt::propsheet::extensions::extensions FOR editorGen.propertySheet-»
-«EXPAND preferencePages FOR editorGen.diagram-»
-«EXPAND preferencePageInitializer FOR editorGen.diagram-»
-«EXPAND xpt::providers::extensions::extensions FOR editorGen.diagram-»
-«EXPAND xpt::navigator::extensions::extensions FOR editorGen.navigator-»
-«EXPAND xpt::application::extensions::extensions FOR editorGen.application-»
-«EXPAND xpt::ConstraintProviders::extensions FOR editorGen-»
-«EXPAND xpt::diagram::updater::extensions::extensions FOR editorGen.diagramUpdater-»
-«EXPAND impl::actions::extensions::Main FOR editorGen-»
-«EXPAND xpt::plugin::plugin::additions-»
-</plugin>
-«ENDAROUND»
-
-«DEFINE fileTypes FOR gmfgen::GenPlugin»
- <extension point="org.eclipse.team.core.fileTypes" id="repo-ftype">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <fileTypes type="text" extension="«editorGen.diagramFileExtension»"/>
- </extension>
-«ENDDEFINE»
-
-«DEFINE extension_parser FOR gmfgen::GenPlugin»
- <extension point="org.eclipse.emf.ecore.extension_parser" id="resource-factory">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <parser
- type="«editorGen.diagramFileExtension»"
- class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
- </parser>
- </extension>
-«ENDDEFINE»
-
-«DEFINE menu FOR gmfgen::GenPlugin»
- <extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders" id="global-actions">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <GlobalActionHandlerProvider
- class="org.eclipse.papyrus.uml.diagram.common.providers.PapyrusGlobalActionHandlerProvider"
- id="«editorGen.modelID»Presentation">
- <Priority name="Highest"/>
- <ViewId id="org.eclipse.papyrus.infra.core.papyrusEditor">
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
- <GlobalActionId actionId="delete"/>
- </ElementType>
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart">
- <GlobalActionId actionId="save"/>
- </ElementType>
- </ViewId>
- </GlobalActionHandlerProvider>
-«IF printingEnabled-»
- <GlobalActionHandlerProvider
- class="org.eclipse.gmf.runtime.diagram.ui.printing.render.providers.DiagramWithPrintGlobalActionHandlerProvider"
- id="«editorGen.modelID»PresentationPrint">
- <Priority name="Low"/>
- <ViewId id="org.eclipse.papyrus.infra.core.papyrusEditor">
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
- <GlobalActionId actionId="print"/>
- </ElementType>
- </ViewId>
- </GlobalActionHandlerProvider>
-«ENDIF-»
-«IF null = editorGen.application-»
- <GlobalActionHandlerProvider
- class="org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider"
- id="«editorGen.modelID»PresentationIDE">
- <Priority name="Low"/>
- <ViewId id="org.eclipse.papyrus.infra.core.papyrusEditor">
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
- <GlobalActionId actionId="bookmark"/>
- </ElementType>
- </ViewId>
- </GlobalActionHandlerProvider>
-«ENDIF-»
- <GlobalActionHandlerProvider
- class="org.eclipse.papyrus.uml.diagram.common.providers.PapyrusGlobalActionHandlerProvider"
- id="«editorGen.modelID»Render">
- <Priority name="Highest"/>
- <ViewId id="org.eclipse.papyrus.infra.core.papyrusEditor">
- <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
- <GlobalActionId actionId="cut"/>
- <GlobalActionId actionId="copy"/>
- <GlobalActionId actionId="paste"/>
- </ElementType>
- </ViewId>
- </GlobalActionHandlerProvider>
- </extension>
-
-«ENDDEFINE»
-
-«DEFINE metrics FOR gmfgen::GenMetricContainer-»
-«IF metrics->size() > 0»
- <extension id="metrics-view" point="org.eclipse.ui.views">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <view class="«editorGen.diagram.getMetricProviderQualifiedClassName()»$ResultView"
- id="«editorGen.diagram.getMetricViewID()»"
- name="«editorGen.modelID» Diagram Metrics"/>
- </extension>
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE validation FOR gmfgen::GenDiagram-»
-«IF validationEnabled or hasAudits(editorGen)-»
-«IF null = editorGen.application-»
-
- <extension point="org.eclipse.gmf.runtime.common.ui.services.markerNavigationProviders" id="markers-navigation">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <MarkerNavigationProvider class="«getMarkerNavigationProviderQualifiedClassName()»">
- <MarkerType name="«editorGen.plugin.iD + '.' + getValidationDiagnosticMarkerType()»"/>
- <Priority name="«markerNavigationProviderPriority»"/>
- </MarkerNavigationProvider>
- </extension>
-
- <extension id="«getValidationDiagnosticMarkerType()»" name="«editorGen.plugin.name» problems" point="org.eclipse.core.resources.markers">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <super type="org.eclipse.core.resources.problemmarker"/>
- <super type="org.eclipse.gmf.runtime.common.ui.services.marker"/>
- <persistent value="true"/>
- </extension>
-«ENDIF-»
-«IF validationDecorators-»
-
- <extension id="validationDecoratorProvider" name="ValidationDecorations" point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <decoratorProvider class="«getValidationDecoratorProviderQualifiedClassName()»">
- <Priority name="«validationDecoratorProviderPriority»"/>
- <object class="org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui)" id="PRIMARY_VIEW"/>
- <context decoratorTargets="PRIMARY_VIEW"/>
- </decoratorProvider>
- </extension>
-«ENDIF-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenPlugin»«ENDDEFINE»
-
-«DEFINE preferencePageInitializer FOR gmfgen::GenDiagram»
- <extension point="org.eclipse.core.runtime.preferences">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <initializer class="«preferencesPackageName».DiagramPreferenceInitializer"/>
- </extension>
-«ENDDEFINE»
-
-«DEFINE preferencePages FOR gmfgen::GenDiagram»
-«REM»Generate Diagram Preference Page«ENDREM»
-«EXPAND xpt::Common::xmlGeneratedTag»
-<extension point="org.eclipse.ui.preferencePages">
-
-«REM»Generate Nodes Preference Pages«ENDREM»
-«FOREACH getAllNodes().elementType.displayName->asSet() AS node -»
- «EXPAND preferencePageNodeExtension(self) FOR node-»
-«ENDFOREACH»
-«REM»Generate Links Preference Pages«ENDREM»
-«FOREACH links.elementType.displayName->asSet() AS link -»
- «EXPAND preferencePageLinkExtension(self) FOR link-»
-«ENDFOREACH»
-</extension>
-«ENDDEFINE»
-
-«DEFINE preferencePageNodeExtension(gmfgen::GenDiagram diagram) FOR String-»
-«IF 'UNDEFINED' <> self.toUpper()»
- «EXPAND xpt::Common::xmlGeneratedTag»
- <page category="«EXPAND category FOR diagram»"
- class="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
- id="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
- name="«self» Node" />
-«ENDIF»
-«ENDDEFINE»
-«DEFINE preferencePageLinkExtension(gmfgen::GenDiagram diagram) FOR String-»
-
-«IF 'UNDEFINED' <> self.toUpper()»
- «EXPAND xpt::Common::xmlGeneratedTag»
- <page category="«EXPAND category FOR diagram»"
- class="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
- id="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
- name="«self» Link" />
-«ENDIF»
-«ENDDEFINE»
-«DEFINE preferencePageExtension(gmfgen::GenDiagram diagram) FOR gmfgen::GenLink-»
-«IF "UNDEFINED" <> self.elementType.displayName.toUpper()»
- «EXPAND xpt::Common::xmlGeneratedTag»
- <page category="«EXPAND category FOR diagram»"
- class="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
- id="«diagram.preferencesPackageName».«self»«getPreferencePageSuffix()»"
- name="«self.elementType.displayName» Link" />
-«ENDIF»
-«ENDDEFINE»
-
-«REM»RS: redefine palette generation, using predefined entries«ENDREM»
-«DEFINE palettePredefinedEntries FOR gmfgen::GenEditorGenerator»
- «EXPAND xpt::Common::xmlGeneratedTag»
- <extension
- id="«plugin.name».palettedefinition"
- name="«plugin.name» Predefined Entries"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- «EXPAND xpt::Common::xmlGeneratedTag»
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Lowest"/>
- <contribution
- factoryClass="«self.diagram.palette.packageName».«self.diagram.palette.factoryClassName»">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- «EXPAND predefinedEntryDefinition FOREACH collectTools(diagram.palette)»
- </contribution>
- </paletteProvider>
-
- </extension>
-«ENDDEFINE»
-
-«DEFINE predefinedEntryDefinition FOR gmfgen::AbstractToolEntry-»
- <entry
- defineOnly="true"
- description="«self.description»"
- id=«IF id.isQuoted('\"')»«id»«ELSE»"«id»"«ENDIF»
- kind="tool"
- label="«self.title»"
- large_icon="«largeIconPath»"
- path=""
- small_icon="«smallIconPath»">
- </entry>
-«ENDDEFINE»
-
-«REM»RS: redefine palette generation, using predefined entries«ENDREM»
-«DEFINE paletteEntries FOR gmfgen::GenEditorGenerator»
- «EXPAND xpt::Common::xmlGeneratedTag»
- <extension
- id="«plugin.name».standard"
- name="«plugin.name» Standard Palette"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- «EXPAND xpt::Common::xmlGeneratedTag»
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Low"/>
- <contribution
- factoryClass="«self.diagram.palette.packageName».«self.diagram.palette.factoryClassName»">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- «EXPAND groupUsage FOREACH collectGroups(diagram.palette)»
- </contribution>
- <editor id="«plugin.iD»"/>
- </paletteProvider>
-
- </extension>
-«ENDDEFINE»
-
-«DEFINE groupUsage FOR gmfgen::ToolGroup-»
- <entry
- description="«self.description»"
- id=«IF id.isQuoted('\"')»«id»«ELSE»"«id»"«ENDIF»
- kind="drawer"
- label="«self.title»"
- large_icon="«largeIconPath»"
- path="/"
- small_icon="«smallIconPath»">
- <expand
- force="true">
- </expand>
- </entry>
- «REM» TODO: call sub entries...«ENDREM»
- «EXPAND toolUsage(self) FOREACH self.entries»
-«ENDDEFINE»
-
-«DEFINE toolUsage (gmfgen::ToolGroup group) FOR gmfgen::ToolEntry-»
- <predefinedEntry
- id=«IF id.isQuoted('\"')»«id»«ELSE»"«id»"«ENDIF»
- path="«group.id.getToolPath()»">
- </predefinedEntry>
-«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/fc/fc4ec2263955524c1de89e3897b4930f097503f2.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/fc/fc4ec2263955524c1de89e3897b4930f097503f2.svn-base
deleted file mode 100644
index 80e0e1ae349..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/fc/fc4ec2263955524c1de89e3897b4930f097503f2.svn-base
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * modified by Arthur Daussyt - arthur.daussy@atos.net (Atos)
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'»
-
-«DEFINE CompartmentItemSemanticEditPolicy FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «getDiagram().getBaseItemSemanticEditPolicyQualifiedClassName()» {
-
- «EXPAND _constructor-»
-
- «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes->asSequence()-»
-
- «EXPAND additions-»
- «REM»
- Papyrus REM :
- Test if this compartment edit policy should used a referenced constraint for the move command.
- «ENDREM»
- «IF papyrusgmfgenextension::ConstrainedByReferenceCompartmentItemSemanticEditPolicy.allInstances()->select(v:papyrusgmfgenextension::ConstrainedByReferenceCompartmentItemSemanticEditPolicy|v.genView->includes(self))->size()<>0»
-
- «EXPAND getChildNodeReference FOR childNodes->asSequence()-»
-
- «EXPAND isCorrectCompartment-»
-
- «EXPAND constraintedMoveCommand-»
-
- «ENDIF»
-}
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «itemSemanticEditPolicyClassName»() {
- «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructorBody FOR node-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenCompartment-»
-«ENDDEFINE»
-
-«DEFINE getChildNodeReference FOR Sequence(gmfgen::GenNode)-»
-«IF not self->isEmpty()-»
-«EXPAND xpt::Common::generatedMemberComment»
-private static Set<EReference> compartmentReferences;
-
-«EXPAND xpt::Common::generatedMemberComment»
-static {
- compartmentReferences = new HashSet<EReference>(«self.modelFacet->size()»);
-
- «FOREACH self AS n-»
- «EXPAND childRef(n) FOR n.modelFacet-»
- «ENDFOREACH-»
-}
-«EXPAND xpt::Common::generatedMemberComment»
-protected Iterable<EReference> getCompartmentReferences() {
- return compartmentReferences;
-}
-«ENDIF-»
-
-«ENDDEFINE»
-
-«DEFINE childRef(node : gmfgen::GenNode) FOR gmfgen::TypeModelFacet-»
-compartmentReferences.add(«EXPAND MEtaModel::MetaFeature FOR node.modelFacet.containmentMetaFeature»);
-«ENDDEFINE»
-
-
-«DEFINE isCorrectCompartment FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean isMovedIntoCorrectCompartment(MoveRequest req){
- for(Object entry : req.getElementsToMove().entrySet()) {
- if(entry instanceof Map.Entry<?, ?>) {
- Map.Entry<?, ?> mapEntry = (Map.Entry<?, ?>)entry;
- Object key = mapEntry.getKey();
- if(key instanceof EObject) {
- EObject dropppedObject = (EObject)key;
- EObject semanticHost = ((IGraphicalEditPart)getHost()).resolveSemanticElement();
- boolean foundERefrences = false;
- if(semanticHost != null) {
- for(EReference ref : getCompartmentReferences()) {
- if(ref.isContainment()) {
- foundERefrences = PackageUtil.canContain(semanticHost.eClass(), ref, dropppedObject.eClass(), false);
- } else {
- foundERefrences = PackageUtil.canReference(semanticHost.eClass(), ref, dropppedObject.eClass());
- }
- if(foundERefrences) {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE constraintedMoveCommand FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::generatedMemberComment»
- @Override
- protected Command getMoveCommand(MoveRequest req) {
- if (isMovedIntoCorrectCompartment(req)){
- return super.getMoveCommand(req);
- } else {
- return UnexecutableCommand.INSTANCE;
- }
- }
-«ENDDEFINE»
-
-
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/fd/fdf81d668dbe088e50840b0361ab5b32283d7955.svn-base b/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/fd/fdf81d668dbe088e50840b0361ab5b32283d7955.svn-base
deleted file mode 100644
index 52c2a40e2ca..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/fd/fdf81d668dbe088e50840b0361ab5b32283d7955.svn-base
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.def; singleton:=true
-Bundle-Version: 0.10.1.qualifier
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: %providerName
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/wc.db b/plugins/developer/org.eclipse.papyrus.def/.svn/wc.db
deleted file mode 100644
index 766dc88e796..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/wc.db
+++ /dev/null
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/ChildNodeLabelEditPart.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/ChildNodeLabelEditPart.xpt
index 063ddf4759f..20564c3cb9a 100644
--- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/ChildNodeLabelEditPart.xpt
+++ b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/ChildNodeLabelEditPart.xpt
@@ -76,7 +76,7 @@ public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsLis
«DEFINE specifyInheritance FOR papyrusgmfgenextension::ExtendedGenView-»«superOwnedEditPart»«ENDDEFINE»
«REM»END: BEGIN: PapyrusGenCode«ENDREM»
-«DEFINE implementsList FOR gmfgen::GenChildLabelNode»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart«ENDDEFINE»
+«DEFINE implementsList FOR gmfgen::GenChildLabelNode»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit«ENDDEFINE»
«DEFINE attributes FOR gmfgen::GenChildLabelNode-»
«EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR self-»
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/NodeLabelEditPart.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/NodeLabelEditPart.xpt
index 41c452226e1..5e38a2226f9 100644
--- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/NodeLabelEditPart.xpt
+++ b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/diagram/editparts/NodeLabelEditPart.xpt
@@ -47,7 +47,7 @@ public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsLis
«DEFINE extendsList FOR gmfgen::GenNodeLabel»extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart«ENDDEFINE»
«REM»END: PapyrusGenCode«ENDREM»
-«DEFINE implementsList FOR gmfgen::GenNodeLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart«ENDDEFINE»
+«DEFINE implementsList FOR gmfgen::GenNodeLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit«ENDDEFINE»
«DEFINE attributes FOR gmfgen::GenNodeLabel-»
«EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR self-»
@@ -104,4 +104,4 @@ private static final String ADD_PARENT_MODEL = "AddParentModel";
}
«REM»END: PapyrusGenCode«ENDREM»
-«ENDDEFINE» \ No newline at end of file
+«ENDDEFINE»
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/impl/diagram/editparts/TextAware.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/impl/diagram/editparts/TextAware.xpt
index b94c0a95635..3261779ec0d 100644
--- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/impl/diagram/editparts/TextAware.xpt
+++ b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/aspects/impl/diagram/editparts/TextAware.xpt
@@ -458,7 +458,6 @@
org.eclipse.jface.dialogs.Dialog dialog = null;
if (configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) {
setManager(((org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- setParser(((org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) configuration).createParser(this.resolveSemanticElement()));
initializeDirectEditManager(theRequest);
return;
} else if (configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration) {
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
index e08edd9824b..15b64868042 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -97,15 +97,15 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* implementation allows to register editors and context separately. An editor
* should specify which context it need to run. This multi diagram editor allows
* to show editor side by side in one or more sash windows.
- *
+ *
* The real implementation for the generic type T of SashMultiPageEditorPart is
* actually di2.Diagram
- *
+ *
* @author cedric dumoulin
* @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
* @author <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a>
* Refactoring.
- *
+ *
* TODO : remove GMF dependency !
*/
public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implements IMultiDiagramEditor, ITabbedPropertySheetPageContributor, IGotoMarker {
@@ -149,9 +149,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* This method is called when the editor input is changed from the
* ISaveAndDirtyService.
- *
+ *
* @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#editorInputChanged(org.eclipse.ui.part.FileEditorInput)
- *
+ *
* @param fileEditorInput
*/
@Override
@@ -163,9 +163,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* The isDirty flag has changed, reflect its new value
- *
+ *
* @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#isDirtyChanged()
- *
+ *
*/
@Override
public void isDirtyChanged() {
@@ -176,8 +176,8 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
@Override
public void run() {
// editor can be null if this object has been finalized, but
- // still queued in the asyncExec queue.
- // This can happen if the editor is disposed, but some run still in
+ // still queued in the asyncExec queue.
+ // This can happen if the editor is disposed, but some run still in
// the exec queue.
// When the method is executed asynchronously, the object is already finalized, and so
// editor is null.
@@ -268,7 +268,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Get the contentOutlineRegistry. Create it if needed.
- *
+ *
* @return the contentOutlineRegistry
*/
protected ContentOutlineRegistry getContentOutlineRegistry() {
@@ -288,7 +288,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Returns the service registry associated to the editor.
- *
+ *
* @return the servicesRegistry The registry.
*/
@Override
@@ -301,7 +301,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Create the ServicesRegistry.
- *
+ *
* @return
*/
private ServicesRegistry createServicesRegistry() {
@@ -320,7 +320,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Do nothing as we create the provider before any calls to this method.
* Should not be called by subclasses.
- *
+ *
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#createPageProvider()
*/
@Override
@@ -330,14 +330,14 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Create the pageContentProvider.
- *
+ *
* Removed since 0.10.0
- *
+ *
* @param pageFactory
* @param diResource
* Resource used to load/save the SashModel.
- *
- *
+ *
+ *
*/
// protected ISashWindowsContentProvider createPageProvider(IPageModelFactory pageFactory, Resource diResource, TransactionalEditingDomain editingDomain) {
//
@@ -352,7 +352,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
* Get The {@link IPageMngr} used to add, open, remove or close a diagram in
* the SashWindow. This method is available as soon as the {@link CoreMultiDiagramEditor#init(IEditorSite, IEditorInput)} method is
* called.
- *
+ *
* @return
*/
protected IPageManager getIPageManager() throws IllegalStateException {
@@ -365,7 +365,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Get the ActionBarContributorRegistry. Creates it if necessary.
- *
+ *
* @return
*/
protected ActionBarContributorRegistry getActionBarContributorRegistry() {
@@ -389,7 +389,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Create the ActionBarContributorRegistry.
- *
+ *
* @return
*/
private ActionBarContributorRegistry createActionBarContributorRegistry() {
@@ -397,10 +397,10 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
}
/**
- *
- *
+ *
+ *
* @param adapter
- *
+ *
* @return
*/
@SuppressWarnings("rawtypes")
@@ -493,6 +493,11 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
@Override
public void run() {
+ //Because we are asynchronous, the editor may already have been disposed
+ //(Especially in the case of tests running in the UI Thread)
+ if(servicesRegistry == null) {
+ return;
+ }
getLifecycleManager().firePostDisplay(CoreMultiDiagramEditor.this);
}
});
@@ -628,6 +633,10 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
}
private InternalEditorLifecycleManager getLifecycleManager() {
+ //I've been disposed
+ if(servicesRegistry == null) {
+ return null;
+ }
try {
return (InternalEditorLifecycleManager)servicesRegistry.getService(EditorLifecycleManager.class);
} catch (ServiceException ex) {
@@ -739,9 +748,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getPropertySheetPage.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getPropertySheetPage()
*/
public IPropertySheetPage getPropertySheetPage() {
@@ -752,7 +761,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#dispose()
- *
+ *
*/
@Override
public void dispose() {
@@ -819,9 +828,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides doSave.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
@@ -845,9 +854,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides doSaveAs.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#doSaveAs()
*/
@Override
@@ -858,9 +867,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides isSaveAsAllowed.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
*/
@Override
@@ -870,9 +879,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getContributorId.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId()
*/
@Override
@@ -887,9 +896,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getDiagram.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagram()
*/
// public org.eclipse.gmf.runtime.notation.Diagram getDiagram() {
@@ -926,9 +935,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getDiagramGraphicalViewer.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagramGraphicalViewer()
*/
// public IDiagramGraphicalViewer getDiagramGraphicalViewer() {
@@ -942,9 +951,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getEditingDomain.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.edit.domain.IEditingDomainProvider#getEditingDomain()
*/
public EditingDomain getEditingDomain() {
@@ -953,7 +962,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Throws an UnsupportedOperationException.
- *
+ *
* @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getDiagramEditDomain()
*/
// public DiagramEditDomain getDiagramEditDomain() {
@@ -964,9 +973,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Change the editor input.<BR>
* <U>Note</U>: that method should be called within the UI-Thread.
- *
+ *
* @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#setEditorInput(org.eclipse.ui.IEditorInput)
- *
+ *
* @param newInput
* The new input
* @deprecated Not used anymore
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IReadOnlyHandler2.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IReadOnlyHandler2.java
new file mode 100644
index 00000000000..8c266376d1c
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IReadOnlyHandler2.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.core.resource;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * An optional extension interface for {@linkplain IReadOnlyHandler read-only handlers} that support making files writable.
+ */
+public interface IReadOnlyHandler2 extends IReadOnlyHandler {
+
+ /**
+ * Queries whether I can make the resources indicated by the given URIs writable.
+ *
+ * @param uris
+ * indicate a set of resources (presumed read-only)
+ * @return a {@linkplain Optional#isPresent() present} boolean indicating either that I can make the resources writable or that I handle these
+ * kinds of resources and they cannot be made writable; an {@linkplain Optional#absent() absent} value, otherwise
+ */
+ Optional<Boolean> canMakeWritable(URI[] uris);
+
+ /**
+ * Queries whether I can make the given {@code object} writable.
+ *
+ * @param object
+ * a model element (presumed read-only)
+ * @return a {@linkplain Optional#isPresent() present} boolean indicating either that I can make the {@code object writable or that I handle its
+ * kind of resources and it cannot be made writable; an {@linkplain Optional#absent() absent} value, otherwise
+ */
+ Optional<Boolean> canMakeWritable(EObject object);
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IRollbackStatus.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IRollbackStatus.java
new file mode 100644
index 00000000000..8451f1ce2c6
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/IRollbackStatus.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.core.resource;
+
+import java.util.Collection;
+
+import org.eclipse.core.runtime.IStatus;
+
+
+/**
+ * A specialized status that indicates that execution of a command was rolled back. Additional context that it provides includes model elements that
+ * triggered rollback.
+ */
+public interface IRollbackStatus extends IStatus {
+
+ /** A {@linkplain IStatus#getCode() status code} indicating that the reason for the rollback could not be determined or is otherwise unclassified. */
+ int UNKNOWN_REASON = 0;
+
+ /** A {@linkplain IStatus#getCode() status code} indicating that rollback occurred because of an uncaught exception in command execution. */
+ int UNCAUGHT_EXCEPTION = 1;
+
+ /** A {@linkplain IStatus#getCode() status code} indicating that rollback occurred to revert modifications to an object that is read-only. */
+ int READ_ONLY_OBJECT = 2;
+
+ /**
+ * Queries the set of objects (if known) that caused the rollback, such as because they are are {@linkplain #READ_ONLY_OBJECT read-only}.
+ *
+ * @return the set (possibly empty, but not {@code null}) of objects that caused the rollback
+ */
+ Collection<?> getCausalObjects();
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
index ab35daa7cf7..fcfbae771dd 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008, 2013 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
@@ -61,7 +61,7 @@ import com.google.common.base.Optional;
/**
* This class is used to manage a set of {@link IModel}.
- *
+ *
* <h2>>Usage</h2>
* <ul>
* <li>First, register associated model. A loader can be used.</li>
@@ -69,16 +69,16 @@ import com.google.common.base.Optional;
* <li>Then, it is possible to get associated models</li>
* <li>Finally, call save()</li>
* </ul>
- *
+ *
* Please note that indirectly referenced models are loaded on demand. If a
* model contains a cross reference towards another model (e.g. an import in
* case of UML) the referenced resource does not appear initially in the set.
* However, it is added once the referenced model is resolved.
- *
+ *
* TODO Modify ModelSetSnippet in order to inform them of model addition.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class ModelSet extends ResourceSetImpl {
@@ -115,18 +115,18 @@ public class ModelSet extends ResourceSetImpl {
*/
protected Set<URI> toDeleteOnSave = new HashSet<URI>();
- /** list of listeners of resources to know if the resource are loaded or not */
+ /** list of listeners of resources to know if the resource are loaded or not */
protected ArrayList<IResourceLoadStateListener> resourceLoadStateListeners;
/** map of resource loaded in the resource set, with resource as the key and a boolean indicating if the resource is loaded or not has the valuer */
protected Map<Resource, Boolean> resourcesToLoadState = new HashMap<Resource, Boolean>();
-
-
+
+
/**
- *
+ *
* Constructor.
- *
+ *
*/
public ModelSet() {
registerModel(additional);
@@ -144,7 +144,7 @@ public class ModelSet extends ResourceSetImpl {
* Register the specified model under its associated key. The key is defined
* in the model itself. It is usually the model type from
* (ModelPackage.eCONTENT_TYPE).
- *
+ *
* @param model
* the model
*/
@@ -164,7 +164,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Get a model by its key. TODO throw an exception if not found.
- *
+ *
* @param key
* the key
* @return the model
@@ -175,7 +175,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Get a model by its key. TODO throw an exception if not found.
- *
+ *
* @param key
* the key
* @return the model
@@ -213,7 +213,8 @@ public class ModelSet extends ResourceSetImpl {
throw e;
}
}
- return setResourceOptions(r);
+
+ return r != null && r.isLoaded() ? r : setResourceOptions(r);
}
@Override
@@ -246,7 +247,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* @deprecated please use {@link #getAssociatedResource(EObject, String, boolean)} instead
- *
+ *
* @param modelElement
* @param associatedResourceExtension
* @return
@@ -258,7 +259,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* @deprecated please use {@link #getAssociatedResource(Resource, String, boolean)} instead
- *
+ *
* @param modelResource
* @param associatedResourceExtension
* @return
@@ -270,7 +271,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Retrieve and load the associated resource which have the given extension.
- *
+ *
* @param modelElement
* @param associatedResourceExtension
* @param loadOnDemand
@@ -286,7 +287,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Retrieve and load the associated resource which have the given extension.
- *
+ *
* @param modelResource
* @param associatedResourceExtension
* @param loadOnDemand
@@ -305,7 +306,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* This method is called by getResource, createResource and demandLoad before returning
* the resource to the caller so we can set options on the resource.
- *
+ *
* @param r
* , can be null
* @return the same resource for convenience
@@ -326,7 +327,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Create the transactional editing domain.
- *
+ *
* @return the transactional editing domain
*/
public synchronized TransactionalEditingDomain getTransactionalEditingDomain() {
@@ -342,7 +343,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* @return the filenameWithoutExtension
- *
+ *
* @deprecated Use the {@link #getURIWithoutExtension()} API, instead.
*/
@Deprecated
@@ -387,11 +388,11 @@ public class ModelSet extends ResourceSetImpl {
/**
* Create all the associated models. This creates the models, regardless if
* they already exist.
- *
+ *
* @param newFile
* The file from which path is extracted to create the new
* resources
- *
+ *
* @deprecated Use the {@link #createModels(URI)} API, instead.
*/
@Deprecated
@@ -402,7 +403,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Create all the associated models. This creates the models, regardless if
* they already exist.
- *
+ *
* @param newFile
* The file from which path is extracted to create the new
* resources
@@ -424,9 +425,9 @@ public class ModelSet extends ResourceSetImpl {
/**
* Create the model specified by the identifiers. Other models are
* untouched, unless they are sharing something with specified models.
- *
+ *
* This creates the models, regardless if they already exist.
- *
+ *
* @param newFile
* The file from which path is extracted to create the new
* resources
@@ -448,7 +449,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Load only the specified model. ModelSetSnippets are not called. Model is
* loaded using the ModelSet Path.
- *
+ *
* @param modelIdentifier
* the model identifier
* @param file
@@ -468,7 +469,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Import only the specified model. ModelSetSnippets are not called.
- *
+ *
* @param modelIdentifier
* the model identifier
* @param file
@@ -489,7 +490,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Load all the associated models from a handle on one of the associated
* file.
- *
+ *
* @param file
* The file to load (no matter the extension)
* @deprecated Use the {@link #loadModels(URI)} API, instead.
@@ -506,7 +507,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Load all the associated models from a URI identifying one of the associated
* files.
- *
+ *
* @param uri
* The URI to load (no matter the extension)
*/
@@ -517,7 +518,7 @@ public class ModelSet extends ResourceSetImpl {
ModelMultiException exceptions = null;
List<IModel> orderedModelsForLoading = getOrderedModelsForLoading();
-
+
// Walk all registered models
for(IModel model : orderedModelsForLoading) {
// Try to load each model. Catch exceptions in order to load other
@@ -544,8 +545,9 @@ public class ModelSet extends ResourceSetImpl {
}
/**
- * Returns the models to be loaded, in order according to their dependencies
- * @return the models to be loaded, in order according to their dependencies
+ * Returns the models to be loaded, in order according to their dependencies
+ *
+ * @return the models to be loaded, in order according to their dependencies
*/
protected List<IModel> getOrderedModelsForLoading() {
return ModelUtils.getOrderedModelsForLoading(models);
@@ -555,14 +557,14 @@ public class ModelSet extends ResourceSetImpl {
* Import specified models into the ModelSet. The models are imported using
* the specified IFile. After import, the models are associated with the
* ModelSet Path.
- *
+ *
* @param modelIdentifiers
* The model to import from the specified IFile.
* @param file
* The IFile used to import the model.
* @throws ModelException
* If an error occur during import.
- *
+ *
* @deprecated Use the {@link #importModels(ModelIdentifiers, URI)} API, instead
*/
@Deprecated
@@ -575,7 +577,7 @@ public class ModelSet extends ResourceSetImpl {
* Import specified models into the ModelSet. The models are imported using
* the specified IFile. After import, the models are associated with the
* ModelSet Path.
- *
+ *
* @param modelIdentifiers
* The model to import from the specified IFile.
* @param file
@@ -602,14 +604,14 @@ public class ModelSet extends ResourceSetImpl {
* Import only the specified model. ModelSetSnippets are not called. An
* import can be performed after model are loaded. Normally, it should not
* be done before a model is loaded.
- *
+ *
* @param modelIdentifier
* the model identifier
* @param file
* the file
* @throws ModelException
* @returns The loaded model.
- *
+ *
* @deprecated Use the {@link #importModel(String, URI)} API, instead.
*/
@Deprecated
@@ -622,7 +624,7 @@ public class ModelSet extends ResourceSetImpl {
* Import only the specified model. ModelSetSnippets are not called. An
* import can be performed after model are loaded. Normally, it should not
* be done before a model is loaded.
- *
+ *
* @param modelIdentifier
* the model identifier
* @param file
@@ -655,7 +657,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Save the resources.
- *
+ *
* @param monitor
* The monitor.
* @throws IOException
@@ -728,19 +730,19 @@ public class ModelSet extends ResourceSetImpl {
protected void handleResourcesToDelete() {
Iterator<URI> uriIterator = getResourcesToDeleteOnSave().iterator();
while(uriIterator.hasNext()) {
- URI uri = (URI)uriIterator.next();
-
- if (validateDeleteResource(uri)) {
- if (deleteResource(uri)) {
+ URI uri = uriIterator.next();
+
+ if(validateDeleteResource(uri)) {
+ if(deleteResource(uri)) {
uriIterator.remove();
}
}
}
}
-
+
protected boolean validateDeleteResource(URI uri) {
boolean result = true;
-
+
Resource resource = getResource(uri, false);
if(resource != null) {
String warMessage = "The resource " + resource.getURI().lastSegment() + " was about to deleted but was still contained in the resource set. The will not be deleted";
@@ -748,19 +750,19 @@ public class ModelSet extends ResourceSetImpl {
result = false;
}
-
+
return result;
}
-
+
protected boolean deleteResource(URI uri) {
boolean result = false;
-
+
try {
getURIConverter().delete(uri, null);
result = true;
} catch (IOException e) {
Activator.log.error(e);
-
+
// hope it's a file that we can delete from the workspace!
IFile file = getFile(uri);
if(file != null && file.exists()) {
@@ -772,19 +774,19 @@ public class ModelSet extends ResourceSetImpl {
}
}
}
-
+
return result;
}
/**
* Finds the file corresponding to the specified URI, using a URI converter
* if necessary (and provided) to normalize it.
- *
+ *
* @param uri
* a URI
* @param converter
* an optional URI converter (may be <code>null</code>)
- *
+ *
* @return the file, if available in the workspace
*/
protected IFile getFile(URI uri) {
@@ -838,12 +840,12 @@ public class ModelSet extends ResourceSetImpl {
/**
* The resources are already loaded, but we want to save them under another
* name.
- *
+ *
* @param path
* the path
* @throws IOException
* Signals that an I/O exception has occurred.
- *
+ *
* @deprecated Use the {@link #saveAs(URI)} API, instead.
*/
@Deprecated
@@ -854,7 +856,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* The resources are already loaded, but we want to save them under another
* name.
- *
+ *
* @param path
* the path
* @throws IOException
@@ -882,8 +884,8 @@ public class ModelSet extends ResourceSetImpl {
snippets.performDispose(this);
snippets.clear();
-
- // FIXME RS: handle the unload ordering as indicated in the model extension point
+
+ // FIXME RS: handle the unload ordering as indicated in the model extension point
// Walk all registered models
for(IModel model : models.values()) {
if(!(model instanceof AdditionalResourcesModel)) {
@@ -926,16 +928,18 @@ public class ModelSet extends ResourceSetImpl {
/**
* Obtains my internal API adapter.
- *
+ *
* @return my internal API adapter
*/
public Internal getInternal() {
return new Internal() {
+ @Override
public void setPrimaryModelResourceURI(URI uri) {
setURIWithoutExtension(uri.trimFileExtension());
}
+ @Override
public void registerModel(IModel model, boolean force) {
if(force) {
doRegisterModel(model);
@@ -949,7 +953,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Add a {@link IModelSetSnippet}. A snippet allows to add code that will
* perform additional operations on the ModelSet.
- *
+ *
* @param snippet
* The snippet to add.
*/
@@ -959,11 +963,11 @@ public class ModelSet extends ResourceSetImpl {
/**
* A list of {@link IModelSetSnippet}.
- *
+ *
* Used by Models to maintain their list of Snippets.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class ModelSetSnippetList extends ArrayList<IModelSetSnippet> {
@@ -972,7 +976,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Call the start method on all registered snippets.
- *
+ *
* @param modelsManager
* The model that is starting
*/
@@ -984,7 +988,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Call the start method on all registered snippets.
- *
+ *
* @param modelsManager
* The model that is stopping
*/
@@ -1003,10 +1007,10 @@ public class ModelSet extends ResourceSetImpl {
/**
* Sets the {@link ModelSet}'s primary resource URI.
- *
+ *
* @param uri
* the URI
- *
+ *
* @see ModelSet#createModels(URI)
* @see ModelSet#saveAs(URI)
*/
@@ -1015,7 +1019,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* Register a model with the option to force it (in case a more specific
* implementation of the model is already registered).
- *
+ *
* @param model
* a model to register
* @param force
@@ -1025,7 +1029,7 @@ public class ModelSet extends ResourceSetImpl {
}
/**
- *
+ *
* @param target
*/
public void saveCopy(IPath targetPathWithoutExtension) {
@@ -1045,36 +1049,37 @@ public class ModelSet extends ResourceSetImpl {
model.saveCopy(targetPathWithoutExtension, targetMap);
}
}
-
+
public boolean addResourceLoadStateListener(IResourceLoadStateListener listener) {
return resourceLoadStateListeners.add(listener);
}
-
+
public boolean removeResourceLoadStateListener(IResourceLoadStateListener listener) {
return resourceLoadStateListeners.remove(listener);
}
-
+
public void notifyResourceLoadState(Resource resource, boolean newState) {
- if(resourceLoadStateListeners !=null) {
+ if(resourceLoadStateListeners != null) {
for(IResourceLoadStateListener listener : resourceLoadStateListeners) {
try {
listener.notifyLoadStateChanged(resource, newState);
- } catch(Throwable e) {
+ } catch (Throwable e) {
Activator.log.error(e);
}
}
}
}
-
+
public boolean isUserModelResource(URI uri) {
return uri.isPlatformResource() || uri.isFile();
}
-
+
public class ResourceAddRemoveTracker implements Adapter {
/**
* {@inheritDoc}
*/
+ @Override
public void notifyChanged(Notification notification) {
// if notification = add, add many or remove/remove many resource(s) to list of resources, process..
if(RESOURCE_SET__RESOURCES == notification.getFeatureID(ResourceSet.class)) {
@@ -1083,33 +1088,34 @@ public class ModelSet extends ResourceSetImpl {
Object object = notification.getNewValue();
if(object instanceof Resource) {
resourcesToLoadState.put(((Resource)object), ((Resource)object).isLoaded());
- }
+ }
break;
case Notification.REMOVE:
object = notification.getNewValue();
if(object instanceof Resource) {
- resourcesToLoadState.remove(((Resource)object));
- }
+ resourcesToLoadState.remove((object));
+ }
break;
case Notification.ADD_MANY:
-
+
break;
-
+
case Notification.REMOVE_MANY:
-
+
+ break;
+
+ default:
+ // nothing to do
break;
-
- default:
- // nothing to do
- break;
}
-
+
}
}
/**
* {@inheritDoc}
*/
+ @Override
public Notifier getTarget() {
return ModelSet.this;
}
@@ -1117,6 +1123,7 @@ public class ModelSet extends ResourceSetImpl {
/**
* {@inheritDoc}
*/
+ @Override
public void setTarget(Notifier newTarget) {
// nothing here
}
@@ -1124,9 +1131,10 @@ public class ModelSet extends ResourceSetImpl {
/**
* {@inheritDoc}
*/
+ @Override
public boolean isAdapterForType(Object type) {
return false;
}
-
+
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/NestingTransactionalCommandStack.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/NestingTransactionalCommandStack.java
new file mode 100644
index 00000000000..87976894389
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/NestingTransactionalCommandStack.java
@@ -0,0 +1,263 @@
+/*****************************************************************************
+ * Copyright (c) 2013, 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - adapted for self-nesting behaviour
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.resource;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RollbackException;
+import org.eclipse.emf.transaction.impl.InternalTransaction;
+import org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl;
+import org.eclipse.emf.transaction.util.ConditionalRedoCommand;
+
+
+public class NestingTransactionalCommandStack extends TransactionalCommandStackImpl {
+
+ private NestingTransactionalCommandStack childCommandStack;
+
+ private final boolean nested;
+
+ private boolean executing;
+
+ public NestingTransactionalCommandStack() {
+ this(false);
+ }
+
+ protected NestingTransactionalCommandStack(boolean nested) {
+ this.nested = nested;
+ }
+
+ protected NestingTransactionalCommandStack getTopMostCommandStack() {
+ if(childCommandStack == null) {
+ return this;
+ }
+ return childCommandStack.getTopMostCommandStack();
+ }
+
+ protected void startNestedTransaction(Command command) {
+ if(childCommandStack != null) {
+ //Forwards to the current stack
+ childCommandStack.startNestedTransaction(command);
+ } else {
+ //Start a new nested transaction in a new nested Stack
+ childCommandStack = new NestingTransactionalCommandStack(true);
+ childCommandStack.setEditingDomain(getDomain());
+
+ childCommandStack.execute(command);
+ }
+ }
+
+ public void commit() {
+ if(childCommandStack != null) {
+ disposeLastCommandStack();
+ }
+ }
+
+ private boolean disposeLastCommandStack() {
+ if(childCommandStack == null) {
+ //I'm the last command stack
+ dispose();
+ return true;
+ }
+
+ //Propagates
+ if(childCommandStack.disposeLastCommandStack()) {
+ childCommandStack = null;
+ }
+
+ return false;
+ }
+
+ public void rollback() {
+ if(childCommandStack != null) {
+ while(canUndo()) {
+ undo();
+ }
+ disposeLastCommandStack();
+ }
+ }
+
+ @Override
+ public void execute(Command command) {
+ if(childCommandStack == null) {
+ if(!executing) {
+ executing = true;
+
+ try {
+ super.execute(command);
+ } finally {
+ executing = false;
+ }
+ } else {
+ // Re-entrant command execution goes on a nested stack
+ try {
+ startNestedTransaction(command);
+ commit();
+ } catch (OperationCanceledException e) {
+ rollback();
+ // Propagate
+ throw e;
+ }
+ }
+ } else {
+ childCommandStack.execute(command);
+ }
+ }
+
+ @Override
+ protected void handleError(Exception exception) {
+ if(nested && (exception instanceof RollbackException)) {
+ //A nested transaction rolled back
+ RollbackException rbe = (RollbackException)exception;
+ if(rbe.getStatus().getSeverity() == IStatus.CANCEL) {
+ // Propagate
+ throw new OperationCanceledException();
+ }
+ }
+
+ if(exception instanceof OperationCanceledException) {
+ rollback();
+ // Propagate
+ throw (OperationCanceledException)exception;
+ } else {
+ super.handleError(exception);
+ }
+ }
+
+ @Override
+ public Command getMostRecentCommand() {
+ if(childCommandStack == null) {
+ return super.getMostRecentCommand();
+ } else {
+ return childCommandStack.getMostRecentCommand();
+ }
+ }
+
+ @Override
+ public Command getRedoCommand() {
+ if(childCommandStack == null) {
+ return super.getRedoCommand();
+ } else {
+ return childCommandStack.getRedoCommand();
+ }
+ }
+
+ @Override
+ public Command getUndoCommand() {
+ if(childCommandStack == null) {
+ return super.getUndoCommand();
+ } else {
+ return childCommandStack.getUndoCommand();
+ }
+ }
+
+ @Override
+ public void undo() {
+ if(childCommandStack == null) {
+ super.undo();
+ } else {
+ childCommandStack.undo();
+ }
+ }
+
+ @Override
+ public boolean canUndo() {
+ if(childCommandStack == null) {
+ return super.canUndo();
+ } else {
+ return childCommandStack.canUndo();
+ }
+ }
+
+ @Override
+ public boolean canRedo() {
+ if(childCommandStack == null) {
+ return super.canRedo();
+ } else {
+ return childCommandStack.canRedo();
+ }
+ }
+
+ @Override
+ public void redo() {
+ if(childCommandStack == null) {
+ super.redo();
+ } else {
+ childCommandStack.redo();
+ }
+ }
+
+ @Override
+ protected void doExecute(Command command, Map<?, ?> options) throws InterruptedException, RollbackException {
+ InternalTransaction tx = createTransaction(command, options);
+ boolean completed = false;
+
+ try {
+ basicExecute(command);
+
+ // new in EMF 2.4: AbortExecutionException can cause the
+ // command not to be added to the undo stack
+ completed = mostRecentCommand == command;
+
+ // commit the transaction now
+ tx.commit();
+ } catch (OperationCanceledException e) {
+ // snuff the exception, because this is expected (user asked to
+ // cancel the model change). We will rollback, below
+ if(nested) {
+ // Propagate to the nesting context
+ throw e;
+ }
+ } finally {
+ if((tx != null) && (tx.isActive())) {
+ // roll back (some exception, possibly being thrown now or
+ // an operation cancel, has occurred)
+ rollback(tx);
+ handleRollback(command, null);
+ } else {
+ // the transaction has already incorporated the triggers
+ // into its change description, so the recording command
+ // doesn't need them again
+ if(!(command instanceof RecordingCommand) && completed) {
+ Command triggerCommand = tx.getTriggers();
+
+ if(triggerCommand != null) {
+ // replace the executed command by a compound of the
+ // original and the trigger commands
+ CompoundCommand compound = new ConditionalRedoCommand.Compound();
+ compound.append(mostRecentCommand);
+ compound.append(triggerCommand);
+ mostRecentCommand = compound;
+ commandList.set(top, mostRecentCommand);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void basicExecute(Command command) {
+ try {
+ super.basicExecute(command);
+ } catch (OperationCanceledException e) {
+ // Ensure disposal of the command (when handleException() propagates a cancel, we will miss the chance)
+ command.dispose();
+ throw e;
+ }
+ }
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/RollbackStatus.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/RollbackStatus.java
new file mode 100644
index 00000000000..256de09aa96
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/RollbackStatus.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.core.resource;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.transaction.RollbackException;
+
+import com.google.common.collect.ImmutableSet;
+
+
+/**
+ * An useful default implementation of the {@link IRollbackStatus} interface.
+ * Rollback is always an {@linkplain IStatus#ERROR error} condition, so the constructors do not require the severity.
+ */
+public class RollbackStatus extends Status implements IRollbackStatus {
+
+ private final Set<?> causalObjects;
+
+ /**
+ * Initializes me with the source bundle ID, reason code, and message.
+ *
+ * @param pluginId
+ * the source bundle ID
+ * @param reason
+ * the {@linkplain IRollbackStatus#UNKNOWN_REASON reason code} indicating why rollback occurred
+ * @param message
+ * the human-readable message
+ */
+ public RollbackStatus(String pluginId, int reason, String message) {
+ this(pluginId, reason, message, null, null);
+ }
+
+ /**
+ * Initializes me with the source bundle ID, reason code, and message.
+ *
+ * @param pluginId
+ * the source bundle ID
+ * @param reason
+ * the {@linkplain IRollbackStatus#UNKNOWN_REASON reason code} indicating why rollback occurred
+ * @param message
+ * the human-readable message
+ * @param exception
+ * an exception that somehow caused the rollback to occur
+ */
+ public RollbackStatus(String pluginId, int reason, String message, Throwable exception) {
+ this(pluginId, reason, message, null, exception);
+ }
+
+ /**
+ * Initializes me with the source bundle ID, reason code, and message.
+ *
+ * @param pluginId
+ * the source bundle ID
+ * @param reason
+ * the {@linkplain IRollbackStatus#UNKNOWN_REASON reason code} indicating why rollback occurred
+ * @param message
+ * the human-readable message
+ * @param causalObjects
+ * the objects that caused the rollback (may be {@code null} if not needed)
+ */
+ public RollbackStatus(String pluginId, int reason, String message, Iterable<?> causalObjects) {
+ this(pluginId, reason, message, causalObjects, null);
+ }
+
+ /**
+ * Initializes me with the source bundle ID, reason code, and message.
+ *
+ * @param pluginId
+ * the source bundle ID
+ * @param reason
+ * the {@linkplain IRollbackStatus#UNKNOWN_REASON reason code} indicating why rollback occurred
+ * @param message
+ * the human-readable message
+ * @param causalObjects
+ * the objects that caused the rollback (may be {@code null} if not needed)
+ * @param exception
+ * an exception that somehow caused the rollback to occur
+ */
+ public RollbackStatus(String pluginId, int reason, String message, Iterable<?> causalObjects, Throwable exception) {
+ super(IStatus.ERROR, pluginId, reason, message, exception);
+
+ this.causalObjects = (causalObjects == null) ? Collections.emptySet() : ImmutableSet.copyOf(causalObjects);
+ }
+
+ @Override
+ public Collection<?> getCausalObjects() {
+ return causalObjects;
+ }
+
+ /**
+ * Dig through a possibly {@linkplain #isMultiStatus() multi} status to get a rollback status out of it.
+ *
+ * @param status
+ * a status
+ *
+ * @return the embedded rollback status, if any (which could be the {@code status}, itself, in the simplest case)
+ */
+ public static IRollbackStatus findRollbackStatus(IStatus status) {
+ IRollbackStatus result = null;
+
+ if(status != null) {
+ if(status instanceof IRollbackStatus) {
+ result = (IRollbackStatus)status;
+ } else if(status.isMultiStatus()) {
+ IStatus[] children = status.getChildren();
+ for(int i = 0; (result == null) && (i < children.length); i++) {
+ result = findRollbackStatus(children[i]);
+ }
+ }
+
+ if((result == null) && (status.getException() instanceof RollbackException)) {
+ // The RollbackStatus may be rolled up in a generic Status created from the RollbackException that originally carried it
+ result = findRollbackStatus(((RollbackException)status.getException()).getStatus());
+ }
+ }
+
+ return result;
+ }
+
+ //
+ // Nested types
+ //
+
+ public static class Multi extends MultiStatus implements IRollbackStatus {
+
+ private IRollbackStatus rollback;
+
+ public Multi(String pluginId, int code, IStatus[] newChildren, String message, Throwable exception) {
+ super(pluginId, code, newChildren, message, exception);
+ }
+
+ public Multi(String pluginId, int code, String message, Throwable exception) {
+ super(pluginId, code, message, exception);
+ }
+
+ IRollbackStatus getRollback() {
+ if(rollback == null) {
+ rollback = findRollbackStatus(this);
+ }
+
+ return rollback;
+ }
+
+ @Override
+ public Collection<?> getCausalObjects() {
+ IRollbackStatus rollback = getRollback();
+ return (rollback == null) ? Collections.emptySet() : rollback.getCausalObjects();
+ }
+ }
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/TransactionalEditingDomainManager.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/TransactionalEditingDomainManager.java
index 845968f067a..73dd38fc2da 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/TransactionalEditingDomainManager.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/TransactionalEditingDomainManager.java
@@ -1,7 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2011-2012 Atos.
+ * Copyright (c) 2011, 2014 Atos, CEA, 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
@@ -9,6 +8,7 @@
*
* Contributors:
* Mathieu Velten mathieu.velten@atos.net - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.resource;
@@ -99,7 +99,8 @@ public class TransactionalEditingDomainManager {
// NotifyingWorkspaceCommandStack stack = new NotifyingWorkspaceCommandStack(CheckedOperationHistory.getInstance());
// stack.setResourceUndoContextPolicy(IResourceUndoContextPolicy.DEFAULT);
- TransactionalEditingDomain result = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE), resourceSet);
+ NestingTransactionalCommandStack stack = new NestingTransactionalCommandStack();
+ TransactionalEditingDomain result = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, resourceSet);
WorkspaceEditingDomainFactory.INSTANCE.mapResourceSet(result);
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
index 994e4a145ca..ebfd4abe0f2 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModel.java
@@ -1,19 +1,16 @@
/**
- *
+ *
*/
package org.eclipse.papyrus.infra.core.resource.sasheditor;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
-import org.eclipse.papyrus.infra.core.resource.IModel;
/**
* @author dumoulin
- *
+ *
+ * @deprecated Use {@link SashModel} instead
*/
-public class DiModel extends AbstractBaseModel implements IModel {
+@Deprecated
+public class DiModel {
/**
* File extension used for notation.
@@ -30,38 +27,4 @@ public class DiModel extends AbstractBaseModel implements IModel {
*/
public static final String MODEL_ID = "org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel"; //$NON-NLS-1$
- /**
- * Get the file extension used for this model.
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
- *
- * @return
- */
- @Override
- protected String getModelFileExtension() {
- return MODEL_FILE_EXTENSION;
- }
-
- /**
- * Get the identifier used to register this model.
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
- *
- * @return
- */
- @Override
- public String getIdentifier() {
- return MODEL_FILE_EXTENSION;
- }
-
- @Override
- protected Map<Object, Object> getSaveOptions() {
- Map<Object, Object> saveOptions = super.getSaveOptions();
-
- saveOptions.put(XMIResource.OPTION_USE_XMI_TYPE, Boolean.FALSE);
- saveOptions.put(XMIResource.OPTION_SAVE_TYPE_INFORMATION, Boolean.FALSE);
-
- return saveOptions;
- }
-
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModelUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModelUtils.java
index b909472e632..3c410693165 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModelUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/DiModelUtils.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.eclipse.papyrus.infra.core.resource.sasheditor;
@@ -11,16 +11,16 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet;
/**
* Set of utility methods linked to Di resource.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class DiModelUtils {
/**
* Returns the related di file. Warning : this method is here for historical
* reasons. It should be removed asap.
- *
+ *
* @param file
* A file (di, model or notation).
* @return The associated DI file.
@@ -32,11 +32,11 @@ public class DiModelUtils {
return null;
}
IFile diFile;
- if(DiModel.DI_FILE_EXTENSION.equalsIgnoreCase(file.getFileExtension())) {
+ if(SashModel.MODEL_FILE_EXTENSION.equalsIgnoreCase(file.getFileExtension())) {
diFile = file;
} else {
// Find the correct file
- IPath diPath = file.getFullPath().removeFileExtension().addFileExtension(DiModel.DI_FILE_EXTENSION);
+ IPath diPath = file.getFullPath().removeFileExtension().addFileExtension(SashModel.MODEL_FILE_EXTENSION);
diFile = file.getParent().getFile(diPath.makeRelativeTo(file.getParent().getFullPath()));
}
return diFile;
@@ -44,12 +44,12 @@ public class DiModelUtils {
/**
* Returns the DI Resource associated to the model set. May be null.
- *
+ *
* @param modelSet
* @return
*/
public static Resource getDiResource(ModelSet modelSet) {
- IModel diModel = modelSet.getModel(DiModel.MODEL_ID);
+ IModel diModel = modelSet.getModel(SashModel.MODEL_ID);
if(diModel instanceof SashModel) {
return ((SashModel)diModel).getResource();
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EMFHelper.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EMFHelper.java
index 9c6337f672d..d8d8a0790b0 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EMFHelper.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/utils/EMFHelper.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - filter out EObjects that are Resources (CDO)
* Christian W. Damus (CEA) - Support read-only state at object level (CDO)
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.core.utils;
@@ -23,17 +23,17 @@ import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
/**
* @deprecated Please use {@link org.eclipse.papyrus.infra.emf.utils.EMFHelper} instead
- * (which inherit this one) for architectural reason.
+ * (which inherit this one) for architectural reason.
*/
@Deprecated
public class EMFHelper {
/**
* Gets the usages.
- *
+ *
* @param source
* the source
- *
+ *
* @return the usages or null if there is no usages
*/
public static Collection<Setting> getUsages(EObject source) {
@@ -56,7 +56,7 @@ public class EMFHelper {
}
}
- return crossReferencer.getInverseReferences(source, true);
+ return crossReferencer.getInverseReferences(source, false);
}
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
index 9fce2312a6b..9fe993c7ac9 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
@@ -5,6 +5,11 @@
<extension
point="org.eclipse.papyrus.infra.emf.readonly.readOnlyHandler">
<readOnlyHandler
+ class="org.eclipse.papyrus.infra.emf.readonly.ReferencedModelReadOnlyHandler"
+ id="org.eclipse.papyrus.infra.emf.readonly.ReferencedModelReadOnlyHandler"
+ priority="15">
+ </readOnlyHandler>
+ <readOnlyHandler
class="org.eclipse.papyrus.infra.emf.readonly.FSReadOnlyHandler"
id="org.eclipse.papyrus.infra.emf.readonly.FSReadOnlyHandler"
priority="10">
@@ -106,7 +111,7 @@
class="org.eclipse.papyrus.infra.emf.readonly.ReadOnlyTester"
id="org.eclipse.papyrus.infra.emf.readonly.tester"
namespace="org.eclipse.papyrus.infra.emf.readonly.tester"
- properties="isReadOnly"
+ properties="isReadOnly,canMakeWritable"
type="org.eclipse.jface.viewers.IStructuredSelection">
</propertyTester>
</extension>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/AbstractReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/AbstractReadOnlyHandler.java
index 91c9168e20a..e378e43c022 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/AbstractReadOnlyHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/AbstractReadOnlyHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 Atos
+ * Copyright (c) 2013, 2014 Atos Origin, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
@@ -17,11 +18,11 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import com.google.common.base.Optional;
-public abstract class AbstractReadOnlyHandler implements IReadOnlyHandler {
+public abstract class AbstractReadOnlyHandler implements IReadOnlyHandler2 {
private EditingDomain editingDomain;
@@ -49,4 +50,18 @@ public abstract class AbstractReadOnlyHandler implements IReadOnlyHandler {
return Optional.absent();
}
+ /**
+ * By default, we do not handle writability of these resources.
+ */
+ public Optional<Boolean> canMakeWritable(URI[] uris) {
+ return Optional.absent();
+ }
+
+ public Optional<Boolean> canMakeWritable(EObject object) {
+ Resource res = object.eResource();
+ if((res != null) && (res.getURI() != null)) {
+ return canMakeWritable(new URI[]{ res.getURI() });
+ }
+ return Optional.absent();
+ }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ControlledResourceTracker.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ControlledResourceTracker.java
new file mode 100644
index 00000000000..34212fe77d5
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ControlledResourceTracker.java
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.readonly;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomainEvent;
+import org.eclipse.emf.transaction.TransactionalEditingDomainListener;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+
+/**
+ * A resource-set listener that tracks controlled resource connectivity structure. It adds controlled-resource links immediately that they occur
+ * and removes them after a transaction has committed that removes them. This makes it reasonably efficient to determine that a referenced model
+ * is logically a component of the referencing model and thus not to be treated as read-only. The transactional nature of updates to this mapping
+ * is necessary to ensure that the ephemeral states during controlling and uncontrolling a sub-model don't fool the editing domain into thinking
+ * we're making changes to a read-only resource, triggering roll-back.
+ */
+class ControlledResourceTracker extends AdapterImpl implements TransactionalEditingDomainListener {
+
+ private Map<URI, URI> unitMap = new HashMap<URI, URI>();
+
+ private Map<URI, URI> pending;
+
+ /**
+ * Obtains the single tracker instance associated with the specified editing {@code domain}.
+ *
+ * @param domain
+ * an editing domain
+ *
+ * @return its tracker
+ */
+ static ControlledResourceTracker getInstance(EditingDomain domain) {
+ ControlledResourceTracker result = null;
+
+ for(Object next : domain.getResourceSet().eAdapters()) {
+ if(next instanceof ControlledResourceTracker) {
+ result = (ControlledResourceTracker)next;
+ break;
+ }
+ }
+
+ if(result == null) {
+ result = new ControlledResourceTracker(domain);
+ }
+
+ return result;
+ }
+
+ private ControlledResourceTracker(EditingDomain domain) {
+ domain.getResourceSet().eAdapters().add(this);
+
+ if(domain instanceof TransactionalEditingDomain) {
+ TransactionUtil.getAdapter((TransactionalEditingDomain)domain, TransactionalEditingDomain.Lifecycle.class).addTransactionalEditingDomainListener(this);
+ }
+
+ // commit the initial discovery
+ commit();
+ }
+
+ /**
+ * Queries the URI of the resource in the root unit of the model of the same kind as the given potential sub-model unit.
+ *
+ * @param uri
+ * the URI of a resource that potentially is in a sub-model unit
+ *
+ * @return the URI of the corresponding resource in the model's root unit, which could be the same {@code uri} if this is the root unit
+ */
+ URI getRootResourceURI(URI uri) {
+ URI result = uri.trimFileExtension();
+
+ for(URI parent = get(result); parent != null; parent = get(parent)) {
+ if(parent != null) {
+ result = parent;
+ }
+ }
+
+ return (uri.fileExtension() == null) ? result : result.appendFileExtension(uri.fileExtension());
+ }
+
+ private URI get(URI potentialUnit) {
+ URI result = unitMap.get(potentialUnit);
+
+ if((result == null) && (pending != null)) {
+ // Look here, too, in case the current transaction is adding the relationship
+ result = pending.get(potentialUnit);
+ }
+
+ return result;
+ }
+
+ private void ensurePending() {
+ if(pending == null) {
+ pending = new HashMap<URI, URI>(unitMap);
+ }
+ }
+
+ private void map(URI controlledUnit, URI parentUnit) {
+ ensurePending();
+ pending.put(controlledUnit.trimFileExtension(), parentUnit.trimFileExtension());
+ }
+
+ private void unmap(URI controlledUnit) {
+ ensurePending();
+ pending.remove(controlledUnit.trimFileExtension());
+ }
+
+ private void commit() {
+ if(pending != null) {
+ unitMap = pending;
+ pending = null;
+ }
+ }
+
+ private void rollback() {
+ pending = null;
+ }
+
+ //
+ // Adapter protocol
+ //
+
+ @Override
+ public void setTarget(Notifier newTarget) {
+ if(newTarget instanceof ResourceSet) {
+ // Discover existing resources
+ for(Resource next : ((ResourceSet)newTarget).getResources()) {
+ addAdapter(next);
+ }
+ } else if(newTarget instanceof Resource) {
+ handleResource((Resource)newTarget);
+ }
+ }
+
+ protected void addAdapter(Notifier notifier) {
+ notifier.eAdapters().add(this);
+ }
+
+ protected void removeAdapter(Notifier notifier) {
+ notifier.eAdapters().remove(this);
+ }
+
+ @Override
+ public void unsetTarget(Notifier oldTarget) {
+ if(oldTarget instanceof ResourceSet) {
+ for(Resource next : ((ResourceSet)oldTarget).getResources()) {
+ removeAdapter(next);
+ }
+ }
+ }
+
+ /**
+ * Discover existing parent-unit relationship in a resource.
+ */
+ protected void handleResource(Resource resource) {
+ if(!resource.getContents().isEmpty()) {
+ EObject root = resource.getContents().get(0);
+ EObject container = ((InternalEObject)root).eInternalContainer();
+ if(container != null) {
+ // Found cross-resource containment
+ URI parentURI = container.eIsProxy() ? ((InternalEObject)container).eProxyURI().trimFragment() : container.eResource().getURI();
+ if(parentURI != null) {
+ map(resource.getURI(), parentURI);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ Object notifier = msg.getNotifier();
+
+ if(notifier instanceof ResourceSet) {
+ switch(msg.getFeatureID(ResourceSet.class)) {
+ case ResourceSet.RESOURCE_SET__RESOURCES:
+ switch(msg.getEventType()) {
+ case Notification.ADD:
+ addAdapter((Resource)msg.getNewValue());
+ break;
+ case Notification.ADD_MANY:
+ for(Object next : (Collection<?>)msg.getNewValue()) {
+ addAdapter((Resource)next);
+ }
+ break;
+ case Notification.SET:
+ removeAdapter((Resource)msg.getOldValue());
+ addAdapter((Resource)msg.getNewValue());
+ break;
+ case Notification.REMOVE:
+ removeAdapter((Resource)msg.getOldValue());
+ break;
+ case Notification.REMOVE_MANY:
+ for(Object next : (Collection<?>)msg.getOldValue()) {
+ removeAdapter((Resource)next);
+ }
+ break;
+ }
+ break;
+ }
+ } else if(notifier instanceof Resource) {
+ switch(msg.getFeatureID(Resource.class)) {
+ case Resource.RESOURCE__CONTENTS:
+ switch(msg.getEventType()) {
+ case Notification.ADD:
+ case Notification.ADD_MANY:
+ // Only process the resource when the first root is added
+ if(msg.getPosition() == 0) {
+ handleResource((Resource)notifier);
+ }
+ break;
+ case Notification.SET:
+ // Only process the resource when the first root is replaced
+ if(msg.getPosition() == 0) {
+ Resource resource = (Resource)notifier;
+ unmap(resource.getURI());
+ handleResource(resource);
+ }
+ break;
+ case Notification.REMOVE:
+ case Notification.REMOVE_MANY:
+ // Only process the resource when the first root is removed
+ if(msg.getPosition() == 0) {
+ unmap(((Resource)msg.getNotifier()).getURI());
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ //
+ // TransactionalEditingDomainListener protocol
+ //
+
+ public void transactionClosed(TransactionalEditingDomainEvent event) {
+ if(event.getTransaction().getStatus().getSeverity() >= IStatus.ERROR) {
+ // Transaction rolled back
+ rollback();
+ } else {
+ // Transaction committed
+ commit();
+ }
+ }
+
+ public void editingDomainDisposing(TransactionalEditingDomainEvent event) {
+ removeAdapter(event.getSource().getResourceSet());
+ }
+
+ public void transactionStarting(TransactionalEditingDomainEvent event) {
+ // pass
+ }
+
+ public void transactionInterrupted(TransactionalEditingDomainEvent event) {
+ // pass
+ }
+
+ public void transactionStarted(TransactionalEditingDomainEvent event) {
+ // pass
+ }
+
+ public void transactionClosing(TransactionalEditingDomainEvent event) {
+ // pass
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java
index 3f8957536bf..f035f201423 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
+ * Copyright (c) 2011, 2014 Atos Origin, CEA, and otherw.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,10 +9,13 @@
*
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.resources.IFile;
@@ -27,7 +30,7 @@ import org.eclipse.swt.widgets.Display;
import com.google.common.base.Optional;
-public class FSReadOnlyHandler extends AbstractReadOnlyHandler {
+public class FSReadOnlyHandler extends AbstractReadOnlyHandler {
public FSReadOnlyHandler(EditingDomain editingDomain) {
super(editingDomain);
@@ -54,32 +57,42 @@ public class FSReadOnlyHandler extends AbstractReadOnlyHandler {
public Optional<Boolean> makeWritable(final URI[] uris) {
final AtomicBoolean doEnableWrite = new AtomicBoolean();
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
- String message = "Do you want to remove read only flag on those files ?\n\n";
- for(URI uri : uris) {
- IFile file = getFile(uri);
- if(file != null && file.isReadOnly()) {
- message += file.getName() + "\n";
+
+ // We can't make a file writable if it already is (there are read-only handlers that treat files that
+ // are filesystem-writable as read-only for other reasons)
+ Collection<IFile> readOnlyFiles = new ArrayList<IFile>(uris.length);
+ for(int i = 0; i < uris.length; i++) {
+ IFile file = getFile(uris[i]);
+ if((file != null) && file.isReadOnly()) {
+ readOnlyFiles.add(file);
+ }
+ }
+
+ if (!readOnlyFiles.isEmpty()) {
+ Display.getCurrent().syncExec(new Runnable() {
+
+ public void run() {
+ String message = "Do you want to remove read only flag on those files ?\n\n";
+ for(URI uri : uris) {
+ IFile file = getFile(uri);
+ if(file != null && file.isReadOnly()) {
+ message += file.getName() + "\n";
+ }
}
+ doEnableWrite.set(MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Enable Write", message));
}
- doEnableWrite.set(MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Enable write", message));
- }
- });
-
+ });
+ }
+
if(doEnableWrite.get()) {
Boolean ok = true;
- for(URI uri : uris) {
- IFile file = getFile(uri);
- if(file != null && file.isReadOnly()) {
- try {
- ResourceAttributes att = file.getResourceAttributes();
- att.setReadOnly(false);
- file.setResourceAttributes(att);
- } catch (CoreException e) {
- ok = false;
- }
+ for(IFile file : readOnlyFiles) {
+ try {
+ ResourceAttributes att = file.getResourceAttributes();
+ att.setReadOnly(false);
+ file.setResourceAttributes(att);
+ } catch (CoreException e) {
+ ok = false;
}
}
return Optional.of(ok);
@@ -88,4 +101,22 @@ public class FSReadOnlyHandler extends AbstractReadOnlyHandler {
}
}
+ /**
+ * I can make workspace resources writable.
+ */
+ @Override
+ public Optional<Boolean> canMakeWritable(URI[] uris) {
+ Optional<Boolean> result = Optional.absent();
+
+ for(int i = 0; (!result.isPresent() || result.get()) && (i < uris.length); i++) {
+ if(uris[i].isPlatformResource()) {
+ result = Optional.of(true);
+ } else if(uris[i].isFile()) {
+ // We don't make non-workspace (external but local) files writable
+ result = Optional.of(false);
+ }
+ }
+
+ return result;
+ }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
index 3beab6d2fac..de7b67ec2eb 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2013 Atos Origin, CEA, and others.
+ * Copyright (c) 2011, 2014 Atos Origin, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,17 +10,39 @@
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
* Christian W. Damus (CEA) - Support object-level read/write controls (CDO)
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
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.util.EcoreUtil;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalCommandStack;
+import org.eclipse.emf.transaction.impl.InternalTransaction;
+import org.eclipse.emf.transaction.impl.TransactionChangeRecorder;
import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
+import org.eclipse.papyrus.infra.core.resource.IRollbackStatus;
+import org.eclipse.papyrus.infra.core.resource.RollbackStatus;
+import org.eclipse.papyrus.infra.onefile.model.IPapyrusFile;
+import org.eclipse.papyrus.infra.onefile.model.PapyrusModelHelper;
+import org.eclipse.papyrus.infra.onefile.utils.OneFileUtils;
public class PapyrusROTransactionalEditingDomain extends TransactionalEditingDomainImpl {
@@ -40,6 +62,127 @@ public class PapyrusROTransactionalEditingDomain extends TransactionalEditingDom
public boolean isReadOnly(EObject eObject) {
return ReadOnlyManager.getReadOnlyHandler(this).isReadOnly(eObject).get();
}
+
+ @Override
+ protected TransactionChangeRecorder createChangeRecorder(ResourceSet rset) {
+ // Ensure that the ControlledResourceTracker gets in ahead of the change recorder so that it processes
+ // notifications pertaining to sub-model unit structure, first, to ensure correct determination of
+ // read-only state for cross-model-referenced objects
+ ControlledResourceTracker.getInstance(this);
+
+ return doCreateChangeRecorder(rset);
+ }
+
+ protected TransactionChangeRecorder doCreateChangeRecorder(ResourceSet rset) {
+ return new TransactionChangeRecorder(this, rset) {
+ @Override
+ protected void appendNotification(Notification notification) {
+ // Append to the transaction first
+ super.appendNotification(notification);
+
+ if (!NotificationFilter.READ.matches(notification)) {
+ // Check whether we are modifying a read-only object
+ assertNotReadOnly(notification.getNotifier());
+ }
+ }
+ };
+ }
+
+ protected void assertNotReadOnly(Object object) {
+ InternalTransaction tx = getActiveTransaction();
+
+ // If there's no transaction, then there will be nothing to roll back. And if it's unprotected, let the client do whatever.
+ // And, of course, don't interfere with rollback!
+ if((tx != null) && !tx.isRollingBack() && !Boolean.TRUE.equals(tx.getOptions().get(Transaction.OPTION_UNPROTECTED))) {
+ boolean readOnly;
+
+ // Check for Resource first because CDO resources *are* EObjects
+ if(object instanceof Resource) {
+ Resource.Internal resource = (Resource.Internal)object;
+ if(resource.isLoading()) {
+ // We must be able to modify read-only resources in order to load them
+ return;
+ }
+ readOnly = isReadOnly(resource) && !makeWritable(resource);
+ } else if(object instanceof EObject) {
+ EObject eObject = (EObject)object;
+ readOnly = isReadOnly(eObject) && !makeWritable(eObject);
+ } else {
+ // If it's not an EMF-managed object, we don't care
+ readOnly = false;
+ }
+
+ if(readOnly) {
+ String message = "Attempt to modify object(s) in a read-only model."; //$NON-NLS-1$
+ Collection<?> offenders = Collections.singleton(object);
+ tx.abort(new RollbackStatus(Activator.PLUGIN_ID, IRollbackStatus.READ_ONLY_OBJECT, message, offenders));
+ }
+ }
+ }
+
+ protected boolean makeWritable(Resource resource) {
+ URI[] uris = getCompositeModelURIs(resource.getURI());
+ IReadOnlyHandler handler = ReadOnlyManager.getReadOnlyHandler(this);
+
+ if(handler instanceof IReadOnlyHandler2) {
+ if(!((IReadOnlyHandler2)handler).canMakeWritable(uris).or(false)) {
+ return false;
+ }
+ }
+
+ return handler.makeWritable(uris).get();
+ }
+
+ protected boolean makeWritable(EObject object) {
+ boolean result;
+
+ URI uri = EcoreUtil.getURI(object);
+
+ // If it's a workspace resource, we don't have to worry about object-level read-only state
+ if(uri.isPlatformResource()) {
+ result = makeWritable(object.eResource());
+ } else {
+ IReadOnlyHandler handler = ReadOnlyManager.getReadOnlyHandler(this);
+
+ if((handler instanceof IReadOnlyHandler2) && !((IReadOnlyHandler2)handler).canMakeWritable(object).or(false)) {
+ result = false;
+ } else {
+ result = handler.makeWritable(object).get();
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Obtains the complete set of URIs for members of the composite model resource of which the given URI is one member.
+ *
+ * @param memberURI a member of a composite Papyrus model
+ *
+ * @return the complete set of member resources (which could just be the original {@code memberURI})
+ */
+ protected URI[] getCompositeModelURIs(URI memberURI) {
+ URI[] result = null;
+
+ if(memberURI.isPlatformResource()) {
+ // We don't have object-level read-only state in the workspace (perhaps in CDO repositories)
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(memberURI.trimFragment().toPlatformString(true)));
+ if((file != null) && file.exists()) {
+ IPapyrusFile composite = PapyrusModelHelper.getPapyrusModelFactory().createIPapyrusFile(file);
+ Set<URI> memberURIs = new HashSet<URI>();
+ for(IFile member : OneFileUtils.getAssociatedFiles(composite)) {
+ memberURIs.add(URI.createPlatformResourceURI(member.getFullPath().toString(), true));
+ }
+ result = memberURIs.toArray(new URI[memberURIs.size()]);
+ }
+ }
+
+ if(result == null) {
+ result = new URI[]{ memberURI };
+ }
+
+ return result;
+ }
@Override
public void dispose() {
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainProvider.java
index 19233543070..d9fe778ec6d 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainProvider.java
@@ -1,7 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
+ * Copyright (c) 2011, 2014 Atos Origin, CEA, 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
@@ -9,6 +8,7 @@
*
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
@@ -19,6 +19,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.workspace.IResourceUndoContextPolicy;
import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
+import org.eclipse.papyrus.commands.NestingNotifyingWorkspaceCommandStack;
import org.eclipse.papyrus.commands.NotifyingWorkspaceCommandStack;
import org.eclipse.papyrus.infra.core.resource.ITransactionalEditingDomainProvider;
@@ -32,7 +33,7 @@ import org.eclipse.papyrus.infra.core.resource.ITransactionalEditingDomainProvid
public class PapyrusROTransactionalEditingDomainProvider implements ITransactionalEditingDomainProvider {
public TransactionalEditingDomain createTransactionalEditingDomain(ResourceSet resourceSet) {
- NotifyingWorkspaceCommandStack stack = new NotifyingWorkspaceCommandStack(CheckedOperationHistory.getInstance());
+ NotifyingWorkspaceCommandStack stack = new NestingNotifyingWorkspaceCommandStack(CheckedOperationHistory.getInstance());
stack.setResourceUndoContextPolicy(IResourceUndoContextPolicy.DEFAULT);
TransactionalEditingDomain result = new PapyrusROTransactionalEditingDomain(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, resourceSet);
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
index 779bf21b8f6..f09bd0e39df 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2013 Atos Origin, CEA, and others.
+ * Copyright (c) 2011, 2014 Atos Origin, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
* Christian W. Damus (CEA) - support non-IFile resources and object-level permissions (CDO)
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
@@ -28,12 +29,13 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import com.google.common.base.Optional;
@SuppressWarnings("deprecation")
-public class ReadOnlyManager implements IReadOnlyHandler {
+public class ReadOnlyManager implements IReadOnlyHandler2 {
//Using a WeakHashMap leads to a Memory Leak, because only the Key is weak.
//The IReadOnlyHandler typically has a reference to its editingDomain,
@@ -184,10 +186,11 @@ public class ReadOnlyManager implements IReadOnlyHandler {
Optional<Boolean> isRO = orderedHandlersArray[i].anyReadOnly(uris);
if(isRO.isPresent() && isRO.get()) {
Optional<Boolean> result = orderedHandlersArray[i].makeWritable(uris);
- // makeWritable should provide an answer since anyReadOnly returned a positive value
- // if no answer consider it fails
+ // makeWritable should provide an answer since anyReadOnly returned a positive value.
+ // If no answer consider it a failure
if(!result.isPresent() || !result.get()) {
finalResult = false;
+ break;
}
}
}
@@ -212,6 +215,46 @@ public class ReadOnlyManager implements IReadOnlyHandler {
return Optional.of(finalResult);
}
+
+ public Optional<Boolean> canMakeWritable(URI[] uris) {
+ Boolean result = false;
+
+ for(int i = 0; (i < orderedHandlersArray.length); i++) {
+ if(orderedHandlersArray[i] instanceof IReadOnlyHandler2) {
+ IReadOnlyHandler2 h2 = (IReadOnlyHandler2)orderedHandlersArray[i];
+ if (h2.anyReadOnly(uris).or(false)) {
+ // Only ask a handler about making writable what it considers to be read-only
+ Optional<Boolean> canMakeWritable = h2.canMakeWritable(uris);
+ if(canMakeWritable.isPresent()) {
+ result = canMakeWritable.get();
+ break;
+ }
+ }
+ }
+ }
+
+ return Optional.of(result);
+ }
+
+ public Optional<Boolean> canMakeWritable(EObject object) {
+ Boolean result = false;
+
+ for(int i = 0; (i < orderedHandlersArray.length); i++) {
+ if(orderedHandlersArray[i] instanceof IReadOnlyHandler2) {
+ IReadOnlyHandler2 h2 = (IReadOnlyHandler2)orderedHandlersArray[i];
+ if (h2.isReadOnly(object).or(false)) {
+ // Only ask a handler about making writable what it considers to be read-only
+ Optional<Boolean> canMakeWritable = h2.canMakeWritable(object);
+ if(canMakeWritable.isPresent()) {
+ result = canMakeWritable.get();
+ break;
+ }
+ }
+ }
+ }
+
+ return Optional.of(result);
+ }
private static final class HandlerAdapter extends AbstractReadOnlyHandler {
@@ -242,4 +285,4 @@ public class ReadOnlyManager implements IReadOnlyHandler {
return delegateResult ? Optional.<Boolean> absent() : Optional.of(Boolean.FALSE);
}
}
-}
+} \ No newline at end of file
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyOneFileApprover.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyOneFileApprover.java
index b65196de99d..03a5388e717 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyOneFileApprover.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyOneFileApprover.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
+ * Copyright (c) 2011, 2014 Atos Origin, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,14 +9,17 @@
*
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
import java.io.File;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
+import java.util.Set;
import org.eclipse.core.commands.operations.IOperationApprover2;
import org.eclipse.core.commands.operations.IOperationHistory;
@@ -26,13 +29,17 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.emf.workspace.EMFCommandOperation;
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.ICompositeCommand;
import org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.onefile.model.IPapyrusFile;
import org.eclipse.papyrus.infra.onefile.model.PapyrusModelHelper;
import org.eclipse.papyrus.infra.onefile.utils.OneFileUtils;
@@ -52,10 +59,9 @@ public class ReadOnlyOneFileApprover implements IOperationApprover2 {
public IStatus proceedExecuting(IUndoableOperation operation, IOperationHistory history, IAdaptable info) {
HashSet<URI> filesToCheckForLock = new HashSet<URI>();
- if(operation instanceof ICommand) {
- ICommand command = (ICommand)operation;
- List<IFile> affectedFiles = command.getAffectedFiles();
-
+ Set<IFile> affectedFiles = getAffectedFiles(operation);
+
+ if(!affectedFiles.isEmpty()) {
for(IFile affectedFile : affectedFiles) {
if(affectedFile == null)
continue;
@@ -71,14 +77,18 @@ public class ReadOnlyOneFileApprover implements IOperationApprover2 {
IPath path = affectedFile.getRawLocation();
if(path == null) {
// cancel if we can't find the file
- setCommandResult(command, Status.CANCEL_STATUS);
+ if(operation instanceof ICommand) {
+ setCommandResult((ICommand)operation, Status.CANCEL_STATUS);
+ }
return Status.CANCEL_STATUS;
}
File file = path.toFile();
if(file != null && file.exists() && !file.canWrite()) {
// cancel if we find a read-only file outside the
// workspace
- setCommandResult(command, Status.CANCEL_STATUS);
+ if(operation instanceof ICommand) {
+ setCommandResult((ICommand)operation, Status.CANCEL_STATUS);
+ }
return Status.CANCEL_STATUS;
}
}
@@ -130,4 +140,54 @@ public class ReadOnlyOneFileApprover implements IOperationApprover2 {
}
}
+ protected Set<IFile> getAffectedFiles(IUndoableOperation operation) {
+ Set<IFile> result = getAffectedFiles(operation, null);
+ return (result == null) ? Collections.<IFile> emptySet() : result;
+ }
+
+ protected Set<IFile> getAffectedFiles(IUndoableOperation operation, Set<IFile> result) {
+ if(operation instanceof ICommand) {
+ result = appendFiles(result, ((ICommand)operation).getAffectedFiles());
+ } else if(operation instanceof GMFtoEMFCommandWrapper) {
+ result = getAffectedFiles(((GMFtoEMFCommandWrapper)operation).getGMFCommand(), result);
+ } else if(operation instanceof EMFCommandOperation) {
+ result = getAffectedFiles(((EMFCommandOperation)operation).getCommand(), result);
+ }
+
+ return result;
+ }
+
+ private Set<IFile> appendFiles(Set<IFile> result, Collection<IFile> files) {
+ if((files != null) && !files.isEmpty()) {
+ if(result == null) {
+ result = new HashSet<IFile>(files);
+ } else {
+ result.addAll(files);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Dig into an EMF command to find wrapped GMF commands and get their affected files. As commands are generally provided by GMF edit-helpers, this
+ * should turn up useful results.
+ *
+ * @param command
+ * a command to mine for affected files
+ * @param result
+ * an accumulator of affected files
+ * @return the {@code result} if it already exists, a non-empty set containing affected files, or {@code null}
+ */
+ protected Set<IFile> getAffectedFiles(Command command, Set<IFile> result) {
+ if(command instanceof CompoundCommand) {
+ for(Command next : ((CompoundCommand)command).getCommandList()) {
+ // accumulate affected files
+ result = getAffectedFiles(next, result);
+ }
+ } else if(command instanceof GMFtoEMFCommandWrapper) {
+ result = getAffectedFiles(((GMFtoEMFCommandWrapper)command).getGMFCommand(), result);
+ }
+
+ return result;
+ }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
index 5e2dadd3410..eaef7d7c325 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2013 Atos Origin, CEA, and others.
+ * Copyright (c) 2011, 2014 Atos Origin, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
* Christian W. Damus (CEA) - Support read-only state at object level (CDO)
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
@@ -21,33 +22,69 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
+import com.google.common.base.Objects;
+
public class ReadOnlyTester extends PropertyTester {
public static final String IS_READ_ONLY = "isReadOnly"; //$NON-NLS-1$
+ public static final String CAN_MAKE_WRITABLE = "canMakeWritable"; //$NON-NLS-1$
+
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (IS_READ_ONLY.equals(property) && receiver instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection)receiver;
-
- Iterator<?> it = selection.iterator();
- while (it.hasNext()) {
- Object obj = it.next();
- Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(obj);
-
- if (businessObject instanceof EObject) {
- EObject eObject = (EObject) businessObject;
- Resource resource = eObject.eResource();
- if ((resource != null) && (resource.getResourceSet() != null)) {
- return ReadOnlyManager.getReadOnlyHandler(WorkspaceEditingDomainFactory.INSTANCE.getEditingDomain(resource.getResourceSet()))
- .isReadOnly(eObject).get();
- }
+ if(receiver instanceof IStructuredSelection) {
+ Iterator<?> objects = ((IStructuredSelection)receiver).iterator();
+
+ if(IS_READ_ONLY.equals(property)) {
+ return testIsReadOnly(objects, asBoolean(expectedValue));
+ } else if(CAN_MAKE_WRITABLE.equals(property)) {
+ return canMakeWritable(objects, asBoolean(expectedValue));
+ }
+ }
+
+ return false;
+ }
+
+ protected Boolean asBoolean(Object expectedValue) {
+ // true is the implied expected value for booleans
+ return (expectedValue instanceof Boolean) ? (Boolean)expectedValue : true;
+ }
+
+ protected boolean testIsReadOnly(Iterator<?> objects, Boolean expectedValue) {
+ while(objects.hasNext()) {
+ Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(objects.next());
+
+ if(businessObject instanceof EObject) {
+ EObject eObject = (EObject)businessObject;
+ Resource resource = eObject.eResource();
+ if((resource != null) && (resource.getResourceSet() != null)) {
+ return Objects.equal(ReadOnlyManager.getReadOnlyHandler(WorkspaceEditingDomainFactory.INSTANCE.getEditingDomain(resource.getResourceSet())).isReadOnly(eObject).get(), expectedValue);
}
}
}
-
+
return false;
}
+ protected boolean canMakeWritable(Iterator<?> objects, Boolean expectedValue) {
+ while(objects.hasNext()) {
+ Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(objects.next());
+
+ if(businessObject instanceof EObject) {
+ EObject eObject = (EObject)businessObject;
+ Resource resource = eObject.eResource();
+ if((resource != null) && (resource.getResourceSet() != null)) {
+ IReadOnlyHandler handler = ReadOnlyManager.getReadOnlyHandler(WorkspaceEditingDomainFactory.INSTANCE.getEditingDomain(resource.getResourceSet()));
+ boolean isAlreadyOrCanMakeWritable = !handler.isReadOnly(eObject).or(false) //
+ || ((handler instanceof IReadOnlyHandler2) && ((IReadOnlyHandler2)handler).canMakeWritable(eObject).or(false));
+ return Objects.equal(isAlreadyOrCanMakeWritable, expectedValue);
+ }
+ }
+ }
+
+ return false;
+ }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java
new file mode 100644
index 00000000000..6d909461712
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.readonly;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.emf.readonly.internal.messages.Messages;
+import org.eclipse.swt.widgets.Display;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+
+
+/**
+ * A {@linkplain IReadOnlyHandler read-only handler} for objects in referenced models, which by default shouldn't be editable in the context of the
+ * model referencing them.
+ */
+public class ReferencedModelReadOnlyHandler extends AbstractReadOnlyHandler {
+
+ private final ControlledResourceTracker controlledResourceTracker;
+
+ private final Set<URI> readableReferencedModels = new HashSet<URI>();
+
+ private boolean interactive = true;
+
+ public ReferencedModelReadOnlyHandler(EditingDomain editingDomain) {
+ super(editingDomain);
+
+ controlledResourceTracker = ControlledResourceTracker.getInstance(editingDomain);
+ }
+
+ /**
+ * Queries whether I interact with the user to confirm making resources writable. I am interactive by default.
+ *
+ * @return whether I am interactive
+ */
+ public boolean isInteractive() {
+ return interactive;
+ }
+
+ /**
+ * Sets whether I interact with the user to confirm making resources writable.
+ *
+ * @param interactive
+ * whether I am interactive
+ */
+ public void setInteractive(boolean interactive) {
+ this.interactive = interactive;
+ }
+
+ public Optional<Boolean> anyReadOnly(URI[] uris) {
+ Optional<Boolean> result = Optional.absent();
+
+ final URIConverter converter = getEditingDomain().getResourceSet().getURIConverter();
+
+ for(int i = 0; i < uris.length; i++) {
+ // Clients may pass object URIs (including fragments), so trim to a resource URI because we operate on the resource level
+ URI next = uris[i].trimFragment();
+
+ // If the resource doesn't exist, then it can't be opened in some other editor, so
+ // we needn't be concerned about editing it in the context of a referencing model
+ if(!readableReferencedModels.contains(next.trimFileExtension()) && isNotModelSetMainModel(next) && converter.exists(next, null)) {
+ result = Optional.of(true);
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public Optional<Boolean> canMakeWritable(URI[] uris) {
+ Optional<Boolean> result = Optional.absent();
+
+ for(int i = 0; i < uris.length; i++) {
+ // Clients may pass object URIs (including fragments), so trim to a resource URI because we operate on the resource level
+ URI next = uris[i].trimFragment();
+
+ if(isNotModelSetMainModel(next)) {
+ result = Optional.of(true);
+ } else {
+ // If it's not something I handle, then bomb
+ result = Optional.of(false);
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ public Optional<Boolean> makeWritable(URI[] uris) {
+ Optional<Boolean> result = Optional.absent();
+
+ final List<URI> toMakeWritable = new ArrayList<URI>(uris.length);
+
+ for(int i = 0; i < uris.length; i++) {
+ // Clients may pass object URIs (including fragments), so trim to a resource URI because we operate on the resource level
+ URI next = uris[i].trimFragment();
+
+ if(isNotModelSetMainModel(next)) {
+ toMakeWritable.add(next);
+ }
+ }
+
+ if(!toMakeWritable.isEmpty()) {
+ final boolean[] enableWrite = { !isInteractive() };
+
+ if(isInteractive()) {
+ Display.getCurrent().syncExec(new Runnable() {
+
+ public void run() {
+ StringBuilder message = new StringBuilder(Messages.ReferencedModelReadOnlyHandler_promptMsg);
+ for(URI uri : toMakeWritable) {
+ String path;
+ if(uri.isPlatformResource()) {
+ path = uri.toPlatformString(true);
+ } else if(uri.isFile()) {
+ path = uri.toFileString();
+ } else {
+ path = uri.toString();
+ }
+
+ message.append(path);
+ message.append("\n"); //$NON-NLS-1$
+ }
+ enableWrite[0] = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), Messages.ReferencedModelReadOnlyHandler_promptTitle, message.toString());
+ }
+ });
+ }
+
+ if(enableWrite[0]) {
+ for(URI next : toMakeWritable) {
+ readableReferencedModels.add(next.trimFileExtension());
+ }
+ }
+
+ result = Optional.of(enableWrite[0]);
+ }
+
+ return result;
+ }
+
+ protected boolean isNotModelSetMainModel(URI uri) {
+ // Default to false result because, if the context is not a ModelSet, the question doesn't make sense and we should not restrict editing
+ boolean result = false;
+
+ ResourceSet rset = getEditingDomain().getResourceSet();
+ if(rset instanceof ModelSet) {
+ ModelSet modelSet = (ModelSet)rset;
+ uri = resolveRootResourceURI(modelSet, uri);
+
+ result = modelSet.isUserModelResource(uri) && !Objects.equal(modelSet.getURIWithoutExtension(), uri.trimFileExtension());
+ }
+
+ return result;
+ }
+
+ /**
+ * Trace a potential controlled unit's root resource.
+ *
+ * @param modelSet
+ * the contextual model-set
+ * @param uri
+ * a resource URI
+ *
+ * @return the corresponding root resource URI, which is just the original {@code uri} if either it isn't a controlled unit or we cannot tell
+ */
+ protected URI resolveRootResourceURI(ModelSet modelSet, URI uri) {
+ return controlledResourceTracker.getRootResourceURI(uri);
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteCommandHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteCommandHandler.java
index f90850f4ff1..8d6dd98630c 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteCommandHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteCommandHandler.java
@@ -1,7 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2011 Atos Origin
+ * Copyright (c) 2011, 2014 Atos Origin, CEA, 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
@@ -9,6 +8,7 @@
*
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly.handlers;
@@ -23,11 +23,13 @@ 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.edit.domain.EditingDomain;
import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager;
import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.onefile.model.IPapyrusFile;
import org.eclipse.papyrus.infra.onefile.model.PapyrusModelHelper;
import org.eclipse.papyrus.infra.onefile.utils.OneFileUtils;
@@ -82,4 +84,11 @@ public class EnableWriteCommandHandler extends AbstractHandler {
}
return null;
}
+
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ EObject selected = getSelectedElement();
+ EditingDomain domain = (selected == null) ? null : EMFHelper.resolveEditingDomain(selected);
+ setBaseEnabled((domain != null) && EMFHelper.canMakeWritable(selected, domain));
+ }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/Messages.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/Messages.java
new file mode 100644
index 00000000000..4e1141a773d
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/Messages.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.readonly.internal.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * This is the Messages type. Enjoy.
+ */
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.readonly.internal.messages.messages"; //$NON-NLS-1$
+
+ public static String ReferencedModelReadOnlyHandler_promptMsg;
+
+ public static String ReferencedModelReadOnlyHandler_promptTitle;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/messages.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/messages.properties
new file mode 100644
index 00000000000..92baf6bdc1c
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/messages.properties
@@ -0,0 +1,14 @@
+#
+# Copyright (c) 2014 CEA 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:
+# Christian W. Damus (CEA) - Initial API and implementation
+#
+
+ReferencedModelReadOnlyHandler_promptMsg=Do you want to make these referenced library model files writable?\n\n
+ReferencedModelReadOnlyHandler_promptTitle=Enable Write
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
index 7650aed5854..d2c37127ece 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
@@ -24,6 +24,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.2.0",
org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0"
Export-Package: org.eclipse.papyrus.infra.emf,
+ org.eclipse.papyrus.infra.emf.adapters,
org.eclipse.papyrus.infra.emf.commands,
org.eclipse.papyrus.infra.emf.databinding,
org.eclipse.papyrus.infra.emf.dialog,
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
index a5a77a29959..201411fb724 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2012, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension
point="org.eclipse.papyrus.infra.core.service">
@@ -17,6 +30,10 @@
<extension
point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
<labelProvider
+ priority="110"
+ provider="org.eclipse.papyrus.infra.emf.providers.ResourceFilteredLabelProvider">
+ </labelProvider>
+ <labelProvider
priority="100"
provider="org.eclipse.papyrus.infra.emf.providers.EMFFilteredLabelProvider">
</labelProvider>
@@ -41,6 +58,15 @@
id="org.eclipse.papyrus.infra.emf.page">
</metamodelType>
</metamodel>
+ <metamodel
+ nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <adviceBinding
+ id="org.eclipse.papyrus.infra.emf.readOnlyAdvice"
+ class="org.eclipse.papyrus.infra.emf.advice.ReadOnlyObjectEditAdvice"
+ typeId="*"
+ inheritance="none">
+ </adviceBinding>
+ </metamodel>
</extension>
<extension
point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
@@ -57,5 +83,15 @@
</elementType>
</binding>
</extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.emf.ecore.EObject"
+ class="org.eclipse.papyrus.infra.emf.adapters.EObjectAdapterFactory">
+ <adapter
+ type="org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor">
+ </adapter>
+ </factory>
+ </extension>
</plugin>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/EObjectAdapterFactory.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/EObjectAdapterFactory.java
new file mode 100644
index 00000000000..e16b485fc3b
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/EObjectAdapterFactory.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.papyrus.infra.emf.dialog.NestedEditingDialogContext;
+import org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor;
+
+
+/**
+ * This is the EObjectAdapterFactory type. Enjoy.
+ */
+public class EObjectAdapterFactory implements IAdapterFactory {
+
+ private final Class<?>[] adapterTypes = { IAtomicOperationExecutor.class };
+
+ public EObjectAdapterFactory() {
+ super();
+ }
+
+ public Object getAdapter(Object adaptable, @SuppressWarnings("rawtypes") Class adapterType) {
+ Object result = null;
+
+ if(adaptable instanceof EObject) {
+ if(adapterType == IAtomicOperationExecutor.class) {
+ TransactionalEditingDomain domain = TransactionUtil.getEditingDomain((EObject)adaptable);
+ if(domain == null) {
+ ResourceSet rset = NestedEditingDialogContext.getInstance().getResourceSet();
+ if(rset != null) {
+ domain = TransactionUtil.getEditingDomain(rset);
+ }
+ }
+ if(domain != null) {
+ result = new EMFAtomicOperationExecutor(domain);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Class[] getAdapterList() {
+ return adapterTypes;
+ }
+
+ //
+ // Nested types
+ //
+
+ private static final class EMFAtomicOperationExecutor extends IAtomicOperationExecutor.Default {
+
+ private final TransactionalEditingDomain domain;
+
+ EMFAtomicOperationExecutor(TransactionalEditingDomain domain) {
+ this.domain = domain;
+ }
+
+ @Override
+ public void execute(final Runnable operation, String label) {
+ domain.getCommandStack().execute(new RecordingCommand(domain, label) {
+
+ @Override
+ protected void doExecute() {
+ operation.run();
+ }
+ });
+ }
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/ResourceSetRootsAdapter.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/ResourceSetRootsAdapter.java
new file mode 100644
index 00000000000..99ebd3839aa
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/ResourceSetRootsAdapter.java
@@ -0,0 +1,107 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.adapters;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+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.util.EContentAdapter;
+
+/**
+ * An EMF Adapter which listens on Resource Set root elements
+ *
+ * @author Camille Letavernier
+ *
+ */
+public abstract class ResourceSetRootsAdapter extends EContentAdapter {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ switch(msg.getEventType()) {
+ case Notification.ADD:
+ case Notification.ADD_MANY:
+ case Notification.REMOVE:
+ case Notification.REMOVE_MANY:
+ case Notification.UNSET:
+ doNotify(msg);
+ break;
+ }
+
+ super.notifyChanged(msg);
+ }
+
+ @Override
+ protected void setTarget(ResourceSet target) {
+ if(target instanceof ResourceSet) {
+ ResourceSet resourceSet = target;
+ if(!resourceSet.eAdapters().contains(this)) {
+ addAdapter(resourceSet);
+ }
+ }
+ super.setTarget(target);
+ }
+
+ @Override
+ protected void setTarget(Resource target) {
+ //Ignore
+ }
+
+ @Override
+ protected void setTarget(EObject target) {
+ //Ignore
+ }
+
+ @Override
+ protected void unsetTarget(EObject target) {
+ //Ignore
+ }
+
+ @Override
+ protected void unsetTarget(Resource target) {
+ //Ignore
+ }
+
+ @Override
+ protected void addAdapter(Notifier notifier) {
+ super.addAdapter(notifier);
+ }
+
+ @Override
+ protected void removeAdapter(Notifier notifier) {
+ super.removeAdapter(notifier);
+ }
+
+ @Override
+ protected void unsetTarget(ResourceSet target) {
+ if(target != null) {
+ removeAdapter(target);
+ }
+ super.unsetTarget(target);
+ }
+
+ @Override
+ protected void handleContainment(Notification notification) {
+ if(notification.getEventType() == Notification.ADD || notification.getEventType() == Notification.ADD_MANY) {
+ //Do not propagate listeners to EObjects. We're only interested on events on the ResourceSet (Add/remove resources) and Resources (Add/remove EObjects)
+ if(notification.getNotifier() == getTarget()) {
+ super.handleContainment(notification);
+ }
+ } else {
+ super.handleContainment(notification);
+ }
+ }
+
+ protected abstract void doNotify(Notification msg);
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/ReadOnlyObjectEditAdvice.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/ReadOnlyObjectEditAdvice.java
new file mode 100644
index 00000000000..5c7c1b62fb4
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/ReadOnlyObjectEditAdvice.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.advice;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+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.edithelper.AbstractEditHelperAdvice;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
+
+/**
+ * Advice that vetoes edits that would modify objects that are read-only and could not reasonably be made writable.
+ */
+public class ReadOnlyObjectEditAdvice extends AbstractEditHelperAdvice {
+
+ public ReadOnlyObjectEditAdvice() {
+ super();
+ }
+
+ protected boolean isContainerUneditable(IEditCommandRequest request, EObject object) {
+ boolean result = false;
+ EObject container = object.eContainer();
+
+ if(container == null) {
+ // Resource root. Is the resource editable?
+ Resource resource = object.eResource();
+ result = (resource != null) && isUneditable(request, resource);
+ } else {
+ result = isUneditable(request, container);
+ }
+
+ return result;
+ }
+
+ protected boolean isUneditable(IEditCommandRequest request, EObject object) {
+ boolean result = false;
+
+ EditingDomain domain = request.getEditingDomain();
+ if(EMFHelper.isReadOnly(object, domain)) {
+ // Check whether we have some means of making it writable
+ result = !EMFHelper.canMakeWritable(object, domain);
+ }
+
+ return result;
+ }
+
+ protected boolean isUneditable(IEditCommandRequest request, Resource resource) {
+ boolean result = false;
+
+ EditingDomain domain = request.getEditingDomain();
+ if(EMFHelper.isReadOnly(resource, domain)) {
+ // Check whether we have some means of making it writable
+ result = !EMFHelper.canMakeWritable(resource, domain);
+ }
+
+ return result;
+ }
+
+ protected ICommand getRefusal() {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected ICommand getBeforeCreateCommand(CreateElementRequest request) {
+ EObject container = request.getContainer();
+
+ if((container != null) && isUneditable(request, container)) {
+ return getRefusal();
+ }
+
+ return super.getBeforeCreateCommand(request);
+ }
+
+ @Override
+ protected ICommand getBeforeCreateRelationshipCommand(CreateRelationshipRequest request) {
+ EObject container = request.getContainer();
+
+ if((container != null) && isUneditable(request, container)) {
+ return getRefusal();
+ }
+
+ if(isUneditable(request, request.getSource())) {
+ return getRefusal();
+ }
+ // Assume that the target (as in most cases) will not have an inverse reference to the new relationship
+
+ return super.getBeforeCreateRelationshipCommand(request);
+ }
+
+ @Override
+ protected ICommand getBeforeDestroyElementCommand(DestroyElementRequest request) {
+ EObject container = request.getContainer();
+
+ if((container != null) && isUneditable(request, container)) {
+ return getRefusal();
+ }
+ // Cross-resource containment to a read-only resource? Unlikely. Don't need to look at the object-to-be-destroyed
+
+ return super.getBeforeDestroyElementCommand(request);
+ }
+
+ @Override
+ protected ICommand getBeforeDestroyReferenceCommand(DestroyReferenceRequest request) {
+ EObject container = request.getContainer();
+
+ // Simple case is when the owner object is read-only
+ if((container != null) && isUneditable(request, container)) {
+ return getRefusal();
+ }
+
+ // Handle the case where the reference has an opposite
+ EReference ref = request.getContainingFeature();
+ if(ref.getEOpposite() != null) {
+ // The object being removed will have its inverse reference removed, also
+ EObject referenced = request.getReferencedObject();
+ if((referenced != null) && isUneditable(request, referenced)) {
+ return getRefusal();
+ }
+ }
+
+ return super.getBeforeDestroyReferenceCommand(request);
+ }
+
+ @Override
+ protected ICommand getBeforeDuplicateCommand(DuplicateElementsRequest request) {
+ List<?> elements = request.getElementsToBeDuplicated();
+
+ // Elements are duplicated in their containers, so the container must not be read-only
+ for(EObject next : Iterables.filter(elements, EObject.class)) {
+ EObject container = next.eContainer();
+ if((container != null) && isUneditable(request, container)) {
+ return getRefusal();
+ }
+ }
+
+ return super.getBeforeDuplicateCommand(request);
+ }
+
+ @Override
+ protected ICommand getBeforeMoveCommand(MoveRequest request) {
+ // Is any of the former containers read-only?
+ for(EObject next : Iterables.filter(request.getElementsToMove().keySet(), EObject.class)) {
+ if(isContainerUneditable(request, next)) {
+ return getRefusal();
+ }
+ }
+
+ if(isUneditable(request, request.getTargetContainer())) {
+ return getRefusal();
+ }
+
+ return super.getBeforeMoveCommand(request);
+ }
+
+ @Override
+ protected ICommand getBeforeReorientRelationshipCommand(ReorientRelationshipRequest request) {
+ EObject relationship = request.getRelationship();
+
+ // Simple case is when the owner object is read-only
+ if((relationship != null) && isUneditable(request, relationship)) {
+ return getRefusal();
+ }
+
+ // Assume that changing the target would not affect the target object because it would not have an inverse reference
+ if(request.getDirection() == ReorientRequest.REORIENT_SOURCE) {
+ if(isUneditable(request, request.getOldRelationshipEnd())) {
+ return getRefusal();
+ }
+ if(isUneditable(request, request.getNewRelationshipEnd())) {
+ return getRefusal();
+ }
+ }
+
+ return super.getBeforeReorientRelationshipCommand(request);
+ }
+
+ @Override
+ protected ICommand getBeforeReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest request) {
+ EObject owner = request.getReferenceOwner();
+
+ // Simple case is when the owner object is read-only
+ if((owner != null) && isUneditable(request, owner)) {
+ return getRefusal();
+ }
+
+ // Assume that changing the target would not affect the target object because it would not have an inverse reference
+ if(request.getDirection() == ReorientRequest.REORIENT_SOURCE) {
+ if(isUneditable(request, request.getOldRelationshipEnd())) {
+ return getRefusal();
+ }
+ if(isUneditable(request, request.getNewRelationshipEnd())) {
+ return getRefusal();
+ }
+ }
+
+ return super.getBeforeReorientReferenceRelationshipCommand(request);
+ }
+
+ @Override
+ protected ICommand getBeforeSetCommand(SetRequest request) {
+ // Simple case of read-only element
+ if(isUneditable(request, request.getElementToEdit())) {
+ return getRefusal();
+ }
+
+ if(request.getFeature() instanceof EReference) {
+ EReference ref = (EReference)request.getFeature();
+ if(ref.getEOpposite() != null) {
+ // Objects on the opposite end must not be read-only
+ Collection<EObject> affectedOpposites = getAffectedOpposites(request.getElementToEdit(), ref, request.getValue());
+ if(!affectedOpposites.isEmpty()) {
+ for(EObject next : affectedOpposites) {
+ if(isUneditable(request, next)) {
+ return getRefusal();
+ }
+ }
+ }
+ } else if(ref.isContainment()) {
+ // Current container of any object must not change if it is read-only (and different from new container)
+ EObject owner = request.getElementToEdit();
+ Object value = request.getValue();
+ if(value instanceof Collection<?>) {
+ for(EObject next : Iterables.filter((Collection<?>)value, EObject.class)) {
+ if((next.eContainer() != owner) && isContainerUneditable(request, next)) {
+ return getRefusal();
+ }
+ }
+ } else if(request.getValue() instanceof EObject) {
+ if(isContainerUneditable(request, (EObject)value)) {
+ return getRefusal();
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Obtains the objects that will be changed by means of the opposite "handshaking" of the given reference of a {@code source} object getting a new
+ * value.
+ */
+ protected Collection<EObject> getAffectedOpposites(EObject source, EReference refWithOpposite, Object newValue) {
+ Collection<EObject> result;
+
+ if(refWithOpposite.isMany()) {
+ if((newValue == null) || ((newValue instanceof Collection<?>) && ((Collection<?>)newValue).isEmpty())) {
+ // Removing all current references (and, hence, their inverses)
+ result = getReferencedObjects(source, refWithOpposite);
+ } else {
+ // The symmetric difference of currently- and to-be-referenced objects will change
+ Set<EObject> current = Sets.newHashSet(getReferencedObjects(source, refWithOpposite));
+ Set<EObject> future = (newValue instanceof Collection<?>) ? ImmutableSet.copyOf(Iterables.filter((Collection<?>)newValue, EObject.class)) : Collections.singleton((EObject)newValue);
+ result = ImmutableList.copyOf(Sets.symmetricDifference(current, future));
+ }
+ } else {
+ Object current = source.eGet(refWithOpposite);
+ if(current != newValue) {
+ // The current value will lose its inverse reference and the new value will gain one
+ if(current == null) {
+ result = Collections.singletonList((EObject)newValue);
+ } else if(newValue == null) {
+ result = Collections.singleton((EObject)current);
+ } else {
+ result = ImmutableList.of((EObject)current, (EObject)newValue);
+ }
+ } else {
+ // No objects will change
+ result = Collections.emptyList();
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Obtains the objects referenced by a {@code source} object via a particular {@code reference}.
+ */
+ private Collection<EObject> getReferencedObjects(EObject source, EReference reference) {
+ Collection<EObject> result;
+
+ Object current = source.eGet(reference);
+ if(current instanceof Collection<?>) {
+ result = ImmutableList.copyOf(Iterables.filter((Collection<?>)current, EObject.class));
+ } else if(current != null) {
+ result = Collections.singletonList((EObject)current);
+ } else {
+ result = Collections.emptyList();
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java
index 6af566f79ad..beb832a0015 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.databinding;
@@ -17,6 +19,7 @@ import java.util.List;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.ObservableList;
import org.eclipse.emf.common.command.Command;
@@ -41,7 +44,7 @@ import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
* @author Camille Letavernier
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
-public class EMFObservableList extends ObservableList implements ICommitListener, IChangeListener {
+public class EMFObservableList extends ObservableList implements ICommitListener, IChangeListener, IObserving {
/**
* The list of commands that haven't been executed yet
@@ -106,6 +109,10 @@ public class EMFObservableList extends ObservableList implements ICommitListener
}
}
+ public Object getObserved() {
+ return source;
+ }
+
@Override
public synchronized void dispose() {
if(concreteList instanceof IObservableList) {
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/NestedEditingDialogContext.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/NestedEditingDialogContext.java
new file mode 100644
index 00000000000..813e5524574
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/NestedEditingDialogContext.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.dialog;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * A tracker of nested editing-dialog context information required by various components that have no direct access to the context.
+ */
+public class NestedEditingDialogContext {
+
+ private static final NestedEditingDialogContext INSTANCE = new NestedEditingDialogContext();
+
+ private final ThreadLocal<Integer> nesting = new ThreadLocal<Integer>();
+
+ private final ThreadLocal<ResourceSet> resourceSet = new ThreadLocal<ResourceSet>();
+
+ public static NestedEditingDialogContext getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Queries whether the current editing dialog is nested in (created by) a higher-level dialog editing some other object.
+ *
+ * @return whether the current thread is presenting a nested editing dialog
+ */
+ public boolean isNested() {
+ Integer depth = nesting.get();
+ return (depth != null) && (depth.intValue() > 0);
+ }
+
+ /**
+ * Signals entry of an editing dialog context (the current thread is now presenting a dialog). Must be matched by a subsequent
+ * call to {@linkplain #exit() exit} the context.
+ *
+ * @see #exit()
+ */
+ public void enter() {
+ Integer depth = nesting.get();
+ if((depth == null) || (depth.intValue() < 1)) {
+ depth = 1;
+ } else {
+ depth = depth.intValue() + 1;
+ }
+ nesting.set(depth);
+ }
+
+ /**
+ * Signals the end of an editing dialog context (the current thread is no longer presenting a dialog). Must match an earlier
+ * call to {@linkplain #enter() enter} the context.
+ *
+ * @see #enter()
+ */
+ public void exit() {
+ Integer depth = nesting.get();
+ if(depth != null) {
+ if(depth.intValue() <= 1) {
+ depth = null;
+ } else {
+ depth = depth.intValue() - 1;
+ }
+ nesting.set(depth);
+ }
+ }
+
+ /**
+ * Obtains the resource set in the editing-dialog context of the current thread.
+ *
+ * @return the current contextual resource set
+ */
+ public ResourceSet getResourceSet() {
+ return resourceSet.get();
+ }
+
+ /**
+ * Determines, if possible, the resource set containing the given {@code context} object being edited and pushes it onto the
+ * current thread's context stack.
+ *
+ * @param context
+ * the object currently being edited in a dialog
+ *
+ * @return the resource set that was previously the context (which may be the same as the new one being pushed). This
+ * must be {@linkplain #pop(ResourceSet) popped} from the context subsequently
+ *
+ * @see #pop(ResourceSet)
+ */
+ public ResourceSet push(Object context) {
+ final ResourceSet previous = resourceSet.get();
+
+ if(context instanceof EObject) {
+ Resource res = ((EObject)context).eResource();
+ if(res != null) {
+ ResourceSet current = res.getResourceSet();
+ if(current != null) {
+ // put it in context
+ resourceSet.set(current);
+ }
+ }
+ }
+
+ return previous;
+ }
+
+ /**
+ * Pops the current resource set from the context, restoring the given resource set that was returned by a previous {@linkplain #push(Object)
+ * push}, even if it was {@code null}.
+ *
+ * @param previous
+ * a resource set returned by an earlier push (may be {@code null})
+ *
+ * @see #push(Object)
+ */
+ public void pop(ResourceSet previous) {
+ if(previous == null) {
+ resourceSet.remove();
+ } else {
+ resourceSet.set(previous);
+ }
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java
index d5a4308186d..6e02b835316 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java
@@ -1,15 +1,18 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
+
+/*************************************************************
+ * Copyright (c) 2012, 2014 CEA 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:
- * Patrick Tessier (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
+ * Vincent Lorenzo (CEA LIST) - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
+ */
+
package org.eclipse.papyrus.infra.emf.messages;
import org.eclipse.osgi.util.NLS;
@@ -18,7 +21,20 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.messages.messages"; //$NON-NLS-1$
+ public static String ResourceFilteredLabelProvider_local;
+
+ public static String ResourceFilteredLabelProvider_localExt;
+
+ public static String ResourceFilteredLabelProvider_system;
+
+ public static String ResourceFilteredLabelProvider_systemExt;
+
+ public static String ResourceFilteredLabelProvider_workspace;
+
+ public static String ResourceFilteredLabelProvider_workspaceExt;
+
public static String UnsetCommand_UnsetCommand;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties
index b5119e19f07..7a50929b818 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties
@@ -1 +1,20 @@
+#
+# Copyright (c) 2012, 2014 CEA 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:
+# Vincent Lorenzo (CEA LIST) - Initial API and implementation
+# Christian W. Damus (CEA) - bug 323802
+#
+
+ResourceFilteredLabelProvider_local=Local model file "{0}"
+ResourceFilteredLabelProvider_localExt=Local model file "{0}" ({1} component)
+ResourceFilteredLabelProvider_system=System resource "{0}"
+ResourceFilteredLabelProvider_systemExt=Resource "{0}"
+ResourceFilteredLabelProvider_workspace=Workspace model file "{0}"
+ResourceFilteredLabelProvider_workspaceExt=Workspace model file "{0}" ({1} component)
UnsetCommand_UnsetCommand=Unset Command
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ResourceFilteredLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ResourceFilteredLabelProvider.java
new file mode 100644
index 00000000000..b776f51de5a
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ResourceFilteredLabelProvider.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.providers;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.ContentHandler;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.resource.LocalResourceManager;
+import org.eclipse.jface.resource.ResourceManager;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.emf.Activator;
+import org.eclipse.papyrus.infra.emf.messages.Messages;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A label provider for EMF {@link Resource}s.
+ */
+public class ResourceFilteredLabelProvider extends EMFLabelProvider implements IFilteredLabelProvider {
+
+ private ResourceManager images;
+
+ public boolean accept(Object element) {
+ return element instanceof Resource;
+ }
+
+ @Override
+ public void dispose() {
+ if(images != null) {
+ images.dispose();
+ images = null;
+ }
+
+ super.dispose();
+ }
+
+ @Override
+ public String getText(Object element) {
+ return (element instanceof Resource) ? getText((Resource)element) : super.getText(element);
+ }
+
+ protected String getText(Resource resource) {
+ String result;
+
+ URI uri = resource.getURI();
+
+ if(uri.isPlatformResource()) {
+ String ext = uri.fileExtension();
+ if(ext == null) {
+ result = NLS.bind(Messages.ResourceFilteredLabelProvider_workspace, uri.toPlatformString(true));
+ } else {
+ result = NLS.bind(Messages.ResourceFilteredLabelProvider_workspaceExt, uri.toPlatformString(true), uri.fileExtension());
+ }
+ } else if(uri.isFile()) {
+ String ext = uri.fileExtension();
+ if(ext == null) {
+ result = NLS.bind(Messages.ResourceFilteredLabelProvider_local, uri.toFileString());
+ } else {
+ result = NLS.bind(Messages.ResourceFilteredLabelProvider_localExt, uri.toFileString(), uri.fileExtension());
+ }
+ } else if(uri.isHierarchical()) {
+ result = NLS.bind(Messages.ResourceFilteredLabelProvider_system, uri.lastSegment());
+ } else {
+ result = NLS.bind(Messages.ResourceFilteredLabelProvider_systemExt, uri.toString());
+ }
+
+ return result;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return (element instanceof Resource) ? getImage((Resource)element) : super.getImage(element);
+ }
+
+ protected Image getImage(Resource resource) {
+ URI uri = resource.getURI();
+ URIConverter converter = (resource.getResourceSet() == null) ? URIConverter.INSTANCE : resource.getResourceSet().getURIConverter();
+
+ IContentType contentType = null;
+ try {
+ Map<String, ?> description = converter.contentDescription(uri, null);
+ contentType = (description.get(ContentHandler.CONTENT_TYPE_PROPERTY) == null) ? null : Platform.getContentTypeManager().getContentType((String)description.get(ContentHandler.CONTENT_TYPE_PROPERTY));
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+
+ IEditorDescriptor[] editors;
+ if(contentType != null) {
+ editors = PlatformUI.getWorkbench().getEditorRegistry().getEditors(uri.lastSegment(), contentType);
+ } else {
+ editors = PlatformUI.getWorkbench().getEditorRegistry().getEditors(uri.lastSegment());
+ }
+
+ ImageDescriptor result = null;
+ for(int i = 0; (result == null) && (i < editors.length); i++) {
+ result = editors[0].getImageDescriptor();
+ }
+
+ return convert(result);
+ }
+
+ protected Image convert(ImageDescriptor descriptor) {
+ Image result = null;
+
+ if(descriptor != null) {
+ if(images == null) {
+ images = new LocalResourceManager(JFaceResources.getResources());
+ }
+
+ result = (Image)images.get(descriptor);
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java
index d187e7bbdc6..20553b3c9bc 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2013 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,6 +10,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - filter out EObjects that are Resources (CDO)
* Christian W. Damus (CEA) - Support read-only state at object level (CDO)
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.utils;
@@ -41,11 +42,13 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.URIConverter;
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.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.emf.facet.custom.ui.CustomizedContentProviderUtils;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.infra.emf.Activator;
@@ -500,6 +503,48 @@ public class EMFHelper {
}
/**
+ * Tests if an object that is read only could possibly be made writable by some means (file system attributes, team provider hook, database
+ * permissions, etc.)
+ *
+ * @param eObject
+ * an object that is assumed to be read-only
+ * @param domain
+ * the editing domain context of the {@link eObject}
+ * @return
+ * whether the {@code eObject} could be made writable
+ */
+ public static boolean canMakeWritable(final EObject eObject, final EditingDomain domain) {
+ if(domain != null) {
+ Object handler = PlatformHelper.getAdapter(domain, IReadOnlyHandler.class);
+ if(handler instanceof IReadOnlyHandler2) {
+ return ((IReadOnlyHandler2)handler).canMakeWritable(eObject).or(false);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Tests if a resource that is read only could possibly be made writable by some means (file system attributes, team provider hook, database
+ * permissions, etc.)
+ *
+ * @param resource
+ * a resource that is assumed to be read-only
+ * @param domain
+ * the editing domain context of the {@link resource}
+ * @return
+ * whether the {@code resource} could be made writable
+ */
+ public static boolean canMakeWritable(final Resource resource, final EditingDomain domain) {
+ if(domain != null) {
+ Object handler = PlatformHelper.getAdapter(domain, IReadOnlyHandler.class);
+ if(handler instanceof IReadOnlyHandler2) {
+ return ((IReadOnlyHandler2)handler).canMakeWritable(new URI[] { resource.getURI() }).or(false);
+ }
+ }
+ return false;
+ }
+
+ /**
* Tests if the given EStructuralFeature is required (ie. should always
* have a value)
*
@@ -741,4 +786,42 @@ public class EMFHelper {
}
return result;
}
+
+ /**
+ * Returns the given element, reloaded into the resource set of the context element,
+ * or the source element itself if not possible.
+ *
+ * Use this method for e.g. loading an element from a shared resource set into another resource set
+ * (Apply a registered profile/library, drop an element from the project explorer, ...)
+ *
+ * @param element
+ * @param contextElement
+ * @return
+ */
+ public static <T extends EObject> T reloadIntoContext(T element, EObject contextElement) {
+ ResourceSet sourceResourceSet = getResourceSet(element);
+ ResourceSet loadingContext = getResourceSet(contextElement);
+
+ if(sourceResourceSet == loadingContext || loadingContext == null) {
+ return element;
+ }
+
+ URI sourceURI = EcoreUtil.getURI(element);
+ EObject result = loadingContext.getEObject(sourceURI, true);
+
+ return (T)result;
+ }
+
+ /**
+ * Returns the resourceSet owning this eObject, or null if it is detached
+ *
+ * @param eObject
+ */
+ public static ResourceSet getResourceSet(EObject eObject) {
+ if(eObject == null || eObject.eResource() == null) {
+ return null;
+ }
+
+ return eObject.eResource().getResourceSet();
+ }
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt
index 208f3a1d236..40dbfbfbce4 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/MultipleStylableElement.xwt
@@ -8,5 +8,5 @@
<Composite.layout>
<GridLayout numColumns="1"></GridLayout>
</Composite.layout>
- <css:ResetStyleWidget input="{Binding}"></css:ResetStyleWidget>
+ <css:ResetStyleWidget input="{Binding}" property="CSS:PapyrusCSSStyle:cssStyle"></css:ResetStyleWidget>
</Composite> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt
index 64704634d72..5d97981f0a2 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleDiagram.xwt
@@ -18,7 +18,7 @@
<Composite.layout>
<GridLayout></GridLayout>
</Composite.layout>
- <css:ResetStyleWidget input="{Binding}"></css:ResetStyleWidget>
+ <css:ResetStyleWidget input="{Binding}" property="CSS:PapyrusCSSStyle:cssStyle"></css:ResetStyleWidget>
</Composite>
<Composite>
<Composite.layout>
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt
index b4b4f789285..827e0614086 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/model/properties/ui/SingleStylableElement.xwt
@@ -11,7 +11,7 @@
<Composite.layout>
<GridLayout></GridLayout>
</Composite.layout>
- <css:ResetStyleWidget input="{Binding}"></css:ResetStyleWidget>
+ <css:ResetStyleWidget input="{Binding}" property="CSS:PapyrusCSSStyle:cssStyle"></css:ResetStyleWidget>
</Composite>
<Composite>
<Composite.layout>
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java
index 470316e7202..f0955ffb7ee 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/widgets/ResetStyleWidget.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.properties.widgets;
@@ -27,6 +29,8 @@ public class ResetStyleWidget implements SelectionListener {
private DataSource input;
+ private String propertyPath;
+
public ResetStyleWidget(Composite parent, int style) {
button = new Button(parent, SWT.PUSH);
button.addSelectionListener(this);
@@ -65,9 +69,28 @@ public class ResetStyleWidget implements SelectionListener {
public void setInput(DataSource input) {
this.input = input;
+ checkInput();
}
public DataSource getInput() {
return input;
}
+
+ public String getProperty() {
+ return propertyPath;
+ }
+
+ public void setProperty(String property) {
+ this.propertyPath = property;
+ checkInput();
+ }
+
+ protected void checkInput() {
+ if((propertyPath != null) && (input != null)) {
+ button.setEnabled(input.isEditable(propertyPath));
+ } else {
+ button.setEnabled(true); // For compatibility with XWT models that don't specify the property
+ }
+ }
+
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css
index 8e651a55605..6ac50b4d5c2 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.theme/theme/papyrus_theme.css
@@ -123,3 +123,6 @@ ParametricDiagram [appliedStereotypes~=ConstraintProperty] {
elementIcon:false;
}
+Label {
+ elementIcon: false;
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java
index c7649f1c542..d2a446bea1c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/DefaultDirectEditorConfiguration.java
@@ -84,7 +84,7 @@ public class DefaultDirectEditorConfiguration implements IDirectEditorConfigurat
* {@inheritDoc}
*/
public String getTextToEdit(Object objectToEdit) {
- return "";
+ return ""; //$NON-NLS-1$
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
index c435b7dc7d2..10ab10ed615 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
@@ -71,10 +71,15 @@ public class DirectEditorExtensionPoint {
// Read configuration elements for the current extension
for(IConfigurationElement configElement : configElements) {
- DirectEditorExtensionPoint proxy = parseDirectEditorConfiguration(configElement);
+ try {
+ DirectEditorExtensionPoint proxy = parseDirectEditorConfiguration(configElement);
- if(proxy != null) {
- directEditorExtensionPoints.add(proxy);
+ if(proxy != null) {
+ directEditorExtensionPoints.add(proxy);
+ }
+ } catch (Throwable ex) {
+ Activator.log.error(ex);
+ continue;
}
} // end of configElements loop
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.properties
index 7b616a5ac05..7324564d6df 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.properties
@@ -1,5 +1,5 @@
#################################################################################
-# Copyright (c) 2011 Atos.
+# Copyright (c) 2011, 2014 Atos, CEA, 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
@@ -7,6 +7,10 @@
#
# Contributors:
# Vincent Hemery - Initial API and implementation
+# Christian W. Damus (CEA) - bug 323802
+#
##################################################################################
pluginName=Papyrus Commands Tools (Incubation)
providerName=Eclipse Modeling Project
+
+historyListeners-extpt=Operation History Listeners
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.xml
index f8f60be4ccb..98f0fc190ef 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/plugin.xml
@@ -2,6 +2,8 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="operationApprover" name="operationApprover" schema="schema/operationApprover.exsd"/>
+ <extension-point id="historyListeners" name="%historyListeners-extpt" schema="schema/historyListeners.exsd"/>
+
<extension
point="org.eclipse.ui.handlers">
<handler
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/schema/historyListeners.exsd b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/schema/historyListeners.exsd
new file mode 100644
index 00000000000..16f042831a6
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/schema/historyListeners.exsd
@@ -0,0 +1,91 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.gmfdiag.commands" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.gmfdiag.commands" id="historyListeners" name="historyListeners"/>
+ </appinfo>
+ <documentation>
+ Registration of history listeners to be attached to the operation history used by the Papyrus GMF diagrams (and transactional editing domains in general).
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="historyListener" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="historyListener">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The Java class implementing of the history listener.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.core.commands.operations.IOperationHistoryListener"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 1.0
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2014 CEA 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
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java
index 5973347c169..179be3fdc44 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/CheckedOperationHistory.java
@@ -9,7 +9,7 @@
*
* Contributors:
* Mathieu Velten (Atos) - Initial API and implementation
- * Christian W. Damus (CEA) - bug 357250
+ * Christian W. Damus (CEA) - bug 357250, bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.commands;
@@ -80,8 +80,8 @@ public class CheckedOperationHistory implements IOperationHistory {
if("operationApprover".equals(elem.getName())) { //$NON-NLS-1$
try {
ApproverPriorityPair approverPriorityPair = new ApproverPriorityPair();
- approverPriorityPair.approver = (IOperationApprover2)elem.createExecutableExtension("class");
- approverPriorityPair.priority = Integer.parseInt(elem.getAttribute("priority"));
+ approverPriorityPair.approver = (IOperationApprover2)elem.createExecutableExtension("class"); //$NON-NLS-1$
+ approverPriorityPair.priority = Integer.parseInt(elem.getAttribute("priority")); //$NON-NLS-1$
approverPriorityPairs.add(approverPriorityPair);
} catch (Exception e) {
@@ -101,6 +101,8 @@ public class CheckedOperationHistory implements IOperationHistory {
private CheckedOperationHistory() {
history = OperationHistoryFactory.getOperationHistory();
+
+ addRegisteredListeners(history);
}
/*
@@ -218,6 +220,21 @@ public class CheckedOperationHistory implements IOperationHistory {
return history.redo(context, monitor, info);
}
+ private static void addRegisteredListeners(IOperationHistory history) {
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.PLUGIN_ID, "historyListeners"); //$NON-NLS-1$
+
+ for(IConfigurationElement elem : configElements) {
+ if("historyListener".equals(elem.getName())) { //$NON-NLS-1$
+ try {
+ IOperationHistoryListener listener = (IOperationHistoryListener)elem.createExecutableExtension("class"); //$NON-NLS-1$
+ history.addOperationHistoryListener(listener);
+ } catch (Exception e) {
+ Activator.log.error("Uncaught exception in instantiation of operation history listener.", e); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
// all the following methods are pure delegation
public IStatus undoOperation(IUndoableOperation operation, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStack.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStack.java
new file mode 100644
index 00000000000..d35ce4035e3
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStack.java
@@ -0,0 +1,231 @@
+/*****************************************************************************
+ * Copyright (c) 2013, 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - adapted for self-nesting behaviour
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.commands;
+
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.RollbackException;
+
+
+public class NestingNotifyingWorkspaceCommandStack extends NotifyingWorkspaceCommandStack {
+
+ private NestingNotifyingWorkspaceCommandStack childCommandStack;
+
+ private final boolean nested;
+
+ private boolean executing;
+
+ protected IUndoContext defaultUndoContext;
+
+ public NestingNotifyingWorkspaceCommandStack(IOperationHistory history) {
+ this(false, history, null);
+ }
+
+ protected NestingNotifyingWorkspaceCommandStack(boolean nested, IOperationHistory history, IUndoContext defaultUndoContext) {
+ super(history);
+ this.nested = nested;
+ this.defaultUndoContext = defaultUndoContext;
+ }
+
+ protected NestingNotifyingWorkspaceCommandStack(boolean nested, IOperationHistory history) {
+ this(nested, history, computeNestedUndoContext());
+ }
+
+ private static IUndoContext computeNestedUndoContext() {
+ return new IUndoContext() {
+
+ public boolean matches(IUndoContext context) {
+ return context == this;
+ }
+
+ public String getLabel() {
+ return "Nested Undo Context";
+ }
+ };
+ }
+
+ @Override
+ public IUndoContext getDefaultUndoContext() {
+ if(defaultUndoContext == null) {
+ return super.getDefaultUndoContext();
+ }
+ return defaultUndoContext;
+ }
+
+ protected NestingNotifyingWorkspaceCommandStack getTopMostCommandStack() {
+ if(childCommandStack == null) {
+ return this;
+ }
+ return childCommandStack.getTopMostCommandStack();
+ }
+
+ protected void startNestedTransaction(Command command) {
+ if(childCommandStack != null) {
+ //Forwards to the current stack
+ childCommandStack.startNestedTransaction(command);
+ } else {
+ //Start a new nested transaction in a new nested Stack
+ childCommandStack = createNestedCommandStack(getOperationHistory());
+ childCommandStack.setEditingDomain(getDomain());
+
+ childCommandStack.execute(command);
+ }
+ }
+
+ protected NestingNotifyingWorkspaceCommandStack createNestedCommandStack(IOperationHistory history) {
+ return new NestingNotifyingWorkspaceCommandStack(true, history);
+ }
+
+ public void commit() {
+ if(childCommandStack != null) {
+ disposeLastCommandStack();
+ }
+ }
+
+ private boolean disposeLastCommandStack() {
+ if(childCommandStack == null) {
+ //I'm the last command stack
+ dispose();
+ return true;
+ }
+
+ //Propagates
+ if(childCommandStack.disposeLastCommandStack()) {
+ childCommandStack = null;
+ }
+
+ return false;
+ }
+
+ public void rollback() {
+ if(childCommandStack != null) {
+ while (canUndo()) {
+ undo();
+ }
+ disposeLastCommandStack();
+ }
+ }
+
+ @Override
+ public void execute(Command command) {
+ if(childCommandStack == null) {
+ if(!executing) {
+ executing = true;
+
+ try {
+ super.execute(command);
+ } finally {
+ executing = false;
+ }
+ } else {
+ // Re-entrant command execution goes on a nested stack
+ try {
+ startNestedTransaction(command);
+ commit();
+ } catch (OperationCanceledException e) {
+ rollback();
+ // Propagate
+ throw e;
+ }
+ }
+ } else {
+ childCommandStack.execute(command);
+ }
+ }
+
+ @Override
+ protected void handleError(Exception exception) {
+ if (nested && (exception instanceof RollbackException)) {
+ //A nested transaction rolled back
+ RollbackException rbe = (RollbackException) exception;
+ if (rbe.getStatus().getSeverity() == IStatus.CANCEL) {
+ // Propagate
+ throw new OperationCanceledException();
+ }
+ }
+
+ if (exception instanceof OperationCanceledException) {
+ rollback();
+ } else {
+ super.handleError(exception);
+ }
+ }
+
+ @Override
+ public Command getMostRecentCommand() {
+ if(childCommandStack == null) {
+ return super.getMostRecentCommand();
+ } else {
+ return childCommandStack.getMostRecentCommand();
+ }
+ }
+
+ @Override
+ public Command getRedoCommand() {
+ if(childCommandStack == null) {
+ return super.getRedoCommand();
+ } else {
+ return childCommandStack.getRedoCommand();
+ }
+ }
+
+ @Override
+ public Command getUndoCommand() {
+ if(childCommandStack == null) {
+ return super.getUndoCommand();
+ } else {
+ return childCommandStack.getUndoCommand();
+ }
+ }
+
+ @Override
+ public void undo() {
+ if(childCommandStack == null) {
+ super.undo();
+ } else {
+ childCommandStack.undo();
+ }
+ }
+
+ @Override
+ public boolean canUndo() {
+ if(childCommandStack == null) {
+ return super.canUndo();
+ } else {
+ return childCommandStack.canUndo();
+ }
+ }
+
+ @Override
+ public boolean canRedo() {
+ if(childCommandStack == null) {
+ return super.canRedo();
+ } else {
+ return childCommandStack.canRedo();
+ }
+ }
+
+ @Override
+ public void redo() {
+ if(childCommandStack == null) {
+ super.redo();
+ } else {
+ childCommandStack.redo();
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java
index 854f1a86d94..da6fbbfae6d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands/src/org/eclipse/papyrus/commands/NotifyingWorkspaceCommandStack.java
@@ -1,7 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2011, 2013 Atos, CEA, and others.
+ * Copyright (c) 2011, 2014 Atos, CEA, 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
@@ -11,6 +10,7 @@
* Mathieu Velten (Atos) - Initial API and implementation
* Arthur Daussy (Atos) - 363826: [Model Explorer] Drag and drop and undo, incorrect behavior
* Christian W. Damus (CEA) - 404220: Add contexts for tracking objects changed by operations (CDO)
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.commands;
@@ -181,7 +181,7 @@ implements IWorkspaceCommandStack {
}
// Documentation copied from the method specification
- public final IUndoContext getDefaultUndoContext() {
+ public IUndoContext getDefaultUndoContext() {
return defaultContext;
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
index 747f030d3d1..2df85a9ff59 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
@@ -52,7 +52,10 @@ Require-Bundle: org.eclipse.emf.edit.ui;bundle-version="2.5.0",
org.eclipse.gmf.tooling.runtime,
com.ibm.icu,
org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0",
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0"
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0",
+ org.eclipse.papyrus.infra.services.decoration;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.services.markerlistener;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.tools
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/shortcut.gif b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/shortcut.gif
new file mode 100644
index 00000000000..c8ebb3156a8
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/icons/shortcut.gif
Binary files differ
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index 7021ed3753b..fff597c93c0 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -1,184 +1,206 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<plugin>
+ <extension-point id="nestedEditor" name="NestedEditor" schema="schema/nestedEditor.exsd"/>
+ <extension-point id="initializeView" name="initializeView" schema="schema/initializeView.exsd"/>
+ <extension-point id="shapeProvider" name="ShapeProvider" schema="schema/shapeProvider.exsd"/>
+ <extension-point id="notationTypesMapping" name="notationTypesMapping" schema="schema/notationTypesMapping.exsd"/>
+ <extension-point id="svgPostProcessors" name="svgPostProcessors" schema="schema/svgPostProcessors.exsd"/>
+ <extension-point id="pasteCommandProvider" name="pasteCommandProvider" schema="schema/pasteCommandProvider.exsd"/>
-<plugin>
- <extension-point id="nestedEditor" name="NestedEditor" schema="schema/nestedEditor.exsd"/>
- <extension-point id="initializeView" name="initializeView" schema="schema/initializeView.exsd"/>
- <extension-point id="shapeProvider" name="ShapeProvider" schema="schema/shapeProvider.exsd"/>
- <extension-point id="notationTypesMapping" name="notationTypesMapping" schema="schema/notationTypesMapping.exsd"/>
- <extension-point id="svgPostProcessors" name="svgPostProcessors" schema="schema/svgPostProcessors.exsd"/>
- <extension-point id="pasteCommandProvider" name="pasteCommandProvider" schema="schema/pasteCommandProvider.exsd"/>
-
-<extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler"
- commandId="org.eclipse.ui.file.refresh">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </activeWhen>
- </handler>
-</extension>
-<extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="toolbar:org.eclipes.papyrus.menu.toolbar">
- <command
- commandId="org.eclipse.ui.file.refresh"
- icon="icons/refresh.gif"
- label="Refresh"
- style="push"
- tooltip="Refresh the current diagram">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
-</extension>
-<extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
- class="org.eclipse.papyrus.infra.gmfdiag.common.preferences.ConnectionToolPreferencePage"
- id="org.eclipse.papyrus.infra.gmfdiag.common.connectionTools"
- name="Connection Tools">
- </page>
-</extension>
-<extension
- point="org.eclipse.core.runtime.preferences">
- <initializer
- class="org.eclipse.papyrus.infra.gmfdiag.common.preferences.ConnectionToolPreferenceInitializer">
- </initializer>
+<extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler"
+ commandId="org.eclipse.ui.file.refresh">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+</extension>
+<extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="toolbar:org.eclipes.papyrus.menu.toolbar">
+ <command
+ commandId="org.eclipse.ui.file.refresh"
+ icon="icons/refresh.gif"
+ label="Refresh"
+ style="push"
+ tooltip="Refresh the current diagram">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+</extension>
+<extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+ class="org.eclipse.papyrus.infra.gmfdiag.common.preferences.ConnectionToolPreferencePage"
+ id="org.eclipse.papyrus.infra.gmfdiag.common.connectionTools"
+ name="Connection Tools">
+ </page>
+</extension>
+<extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.papyrus.infra.gmfdiag.common.preferences.ConnectionToolPreferenceInitializer">
+ </initializer>
+</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.core.model">
+ <model
+ classname="org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel"
+ description="Model for notation">
+ </model>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.emf.ecore.extension_parser">
+ <parser
+ class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory"
+ type="notation">
+ </parser>
+ </extension>
+<extension
+ point="org.eclipse.papyrus.infra.core.service">
+ <serviceFactory
+ classname="org.eclipse.papyrus.infra.gmfdiag.common.undocontext.UndoContextServiceFactory"
+ description="The shared IUndoContext used to tag command in the CommandStack"
+ id="org.eclipse.core.commands.operations.IUndoContext"
+ priority="1"
+ startKind="lazy">
+ <dependsOn
+ serviceKeyRef="org.eclipse.emf.transaction.TransactionalEditingDomain">
+ </dependsOn>
+ </serviceFactory>
+ <service
+ classname="org.eclipse.papyrus.infra.gmfdiag.common.DefaultGraphicalEditorSupport"
+ description="The default diagram editor support implementation."
+ id="org.eclipse.papyrus.infra.gmfdiag.common.IGraphicalEditorSupport"
+ priority="1"
+ startKind="lazy">
+ </service>
+ </extension>
+<extension
+ point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
+ <labelProvider
+ priority="40"
+ provider="org.eclipse.papyrus.infra.gmfdiag.common.providers.NotationFilteredLabelProvider">
+ </labelProvider>
+</extension>
+<extension
+ point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
+ <decoratorProvider
+ class="org.eclipse.papyrus.infra.gmfdiag.common.providers.ShapeDecoratorProvider">
+ <Priority
+ name="Lowest">
+ </Priority>
+ </decoratorProvider>
+</extension>
+<extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.gmf.runtime.notation.Diagram"
+ class="org.eclipse.papyrus.infra.gmfdiag.common.adapter.DiagramAdapterFactory">
+ <adapter
+ type="org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable">
+ </adapter>
+ </factory>
+</extension>
+
+<!-- ElementType bindings for diagram duplication with paste command -->
+ <extension
+ point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
+ <metamodel
+ nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <adviceBinding
+ class="org.eclipse.papyrus.infra.gmfdiag.common.advice.GMFDiagramDuplicateEditHelperAdvice"
+ id="org.eclipse.papyrus.infra.gmfdiag.common.advice.GMFDiagramDuplicateEditHelperAdvice"
+ inheritance="none"
+ typeId="*">
+ </adviceBinding>
+ </metamodel>
+ </extension>
+
+<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
+
+ <!-- Bindings declaration -->
+ <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
+ <advice ref="org.eclipse.papyrus.infra.gmfdiag.common.advice.GMFDiagramDuplicateEditHelperAdvice" />
+ </binding>
+</extension>
+<extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramPropertyTester"
+ id="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester"
+ namespace="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester"
+ properties="isDiagramEditor"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
+ <propertyTester
+ class="org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramPropertyTester"
+ id="org.eclipse.papyrus.infra.gmfdiag.common.diagram.context.tester"
+ namespace="org.eclipse.papyrus.infra.gmfdiag.common.diagram.context.tester"
+ properties="isGmfDiagramContextActive"
+ type="java.util.Collection">
+ </propertyTester>
+</extension>
+<extension
+ point="org.eclipse.papyrus.infra.gmfdiag.common.shapeProvider">
+ <shapeProvider
+ class="org.eclipse.papyrus.infra.gmfdiag.common.providers.StyleBasedShapeProvider"
+ description="Provides shapes based on the applied styles."
+ id="org.eclipse.papyrus.infra.gmfdiag.common.providers.StyleBasedShapeProvider"
+ name="StyleBasedShapeProvider">
+ <Priority
+ name="Low"></Priority>
+ </shapeProvider>
+</extension>
+<extension
+ point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <mapping
+ humanReadableType="symbol"
+ type="compartment_shape_display">
+ </mapping>
</extension>
- <extension
- point="org.eclipse.papyrus.infra.core.model">
- <model
- classname="org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel"
- description="Model for notation">
- </model>
- </extension>
-
-
- <extension
- point="org.eclipse.emf.ecore.extension_parser">
- <parser
- class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory"
- type="notation">
- </parser>
- </extension>
-<extension
- point="org.eclipse.papyrus.infra.core.service">
- <serviceFactory
- classname="org.eclipse.papyrus.infra.gmfdiag.common.undocontext.UndoContextServiceFactory"
- description="The shared IUndoContext used to tag command in the CommandStack"
- id="org.eclipse.core.commands.operations.IUndoContext"
- priority="1"
- startKind="lazy">
- <dependsOn
- serviceKeyRef="org.eclipse.emf.transaction.TransactionalEditingDomain">
- </dependsOn>
- </serviceFactory>
- <service
- classname="org.eclipse.papyrus.infra.gmfdiag.common.DefaultGraphicalEditorSupport"
- description="The default diagram editor support implementation."
- id="org.eclipse.papyrus.infra.gmfdiag.common.IGraphicalEditorSupport"
- priority="1"
- startKind="lazy">
- </service>
- </extension>
<extension
- point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
- <labelProvider
- priority="40"
- provider="org.eclipse.papyrus.infra.gmfdiag.common.providers.NotationFilteredLabelProvider">
- </labelProvider>
+ point="org.eclipse.papyrus.infra.services.decoration.decorationSpecificFunctions">
+ <client
+ class="org.eclipse.papyrus.infra.gmfdiag.common.decoration.ExternalReferenceDecoration"
+ decorationType="org.eclipse.papyrus.infra.gmfdiag.common.externalref">
+ </client>
</extension>
<extension
- point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
- <decoratorProvider
- class="org.eclipse.papyrus.infra.gmfdiag.common.providers.ShapeDecoratorProvider">
+ point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
+ <editpolicyProvider
+ class="org.eclipse.papyrus.infra.gmfdiag.common.providers.ExternalReferenceEditPolicyProvider">
<Priority
name="Lowest">
</Priority>
- </decoratorProvider>
-</extension>
-<extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.gmf.runtime.notation.Diagram"
- class="org.eclipse.papyrus.infra.gmfdiag.common.adapter.DiagramAdapterFactory">
- <adapter
- type="org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IOpenable">
- </adapter>
- </factory>
-</extension>
-
-<!-- ElementType bindings for diagram duplication with paste command -->
- <extension
- point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
- <metamodel
- nsURI="http://www.eclipse.org/emf/2002/Ecore">
- <adviceBinding
- class="org.eclipse.papyrus.infra.gmfdiag.common.advice.GMFDiagramDuplicateEditHelperAdvice"
- id="org.eclipse.papyrus.infra.gmfdiag.common.advice.GMFDiagramDuplicateEditHelperAdvice"
- inheritance="none"
- typeId="*">
- </adviceBinding>
- </metamodel>
- </extension>
-
-<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
-
- <!-- Bindings declaration -->
- <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
- <advice ref="org.eclipse.papyrus.infra.gmfdiag.common.advice.GMFDiagramDuplicateEditHelperAdvice" />
- </binding>
-</extension>
-<extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramPropertyTester"
- id="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester"
- namespace="org.eclipse.papyrus.infra.gmfdiag.common.diagram.tester"
- properties="isDiagramEditor"
- type="org.eclipse.jface.viewers.IStructuredSelection">
- </propertyTester>
- <propertyTester
- class="org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramPropertyTester"
- id="org.eclipse.papyrus.infra.gmfdiag.common.diagram.context.tester"
- namespace="org.eclipse.papyrus.infra.gmfdiag.common.diagram.context.tester"
- properties="isGmfDiagramContextActive"
- type="java.util.Collection">
- </propertyTester>
-</extension>
-<extension
- point="org.eclipse.papyrus.infra.gmfdiag.common.shapeProvider">
- <shapeProvider
- class="org.eclipse.papyrus.infra.gmfdiag.common.providers.StyleBasedShapeProvider"
- description="Provides shapes based on the applied styles."
- id="org.eclipse.papyrus.infra.gmfdiag.common.providers.StyleBasedShapeProvider"
- name="StyleBasedShapeProvider">
- <Priority
- name="Low"></Priority>
- </shapeProvider>
-</extension>
+ </editpolicyProvider>
+</extension>
<extension
- point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
- <mapping
- humanReadableType="symbol"
- type="compartment_shape_display">
- </mapping>
+ point="org.eclipse.papyrus.infra.gmfdiag.commands.historyListeners">
+ <historyListener
+ class="org.eclipse.papyrus.infra.gmfdiag.common.listener.RollbackNotificationHistoryListener">
+ </historyListener>
</extension>
-</plugin>
+</plugin>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/advice/GMFDiagramDuplicateEditHelperAdvice.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/advice/GMFDiagramDuplicateEditHelperAdvice.java
index 202080c4135..7868a3d49df 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/advice/GMFDiagramDuplicateEditHelperAdvice.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/advice/GMFDiagramDuplicateEditHelperAdvice.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 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
@@ -24,7 +24,6 @@ import java.util.Set;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.resource.Resource;
@@ -41,10 +40,9 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.emf.commands.IPapyrusDuplicateCommandConstants;
import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
@@ -70,7 +68,7 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
Set<Object> duplicatedObjects = ((Set<Object>)additional);
EObject object = getDuplicatedEObject(request);
- if(object == null || object.eResource()==null) {
+ if(object == null || object.eResource() == null) {
return super.getBeforeDuplicateCommand(request);
}
@@ -142,7 +140,7 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
/**
* Returns the EObject to be duplicated
- *
+ *
* @return the EObject to be duplicated
*/
protected EObject getDuplicatedEObject(DuplicateElementsRequest request) {
@@ -168,7 +166,7 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
/**
* Constructs a new duplicate EObjects command with the specified label and
* list of EObjects.
- *
+ *
* @param editingDomain
* the editing domain through which model changes are made
* @param label
@@ -184,7 +182,7 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
/**
* Constructs a new duplicate EObjects command with the specified label and
* list of EObjects.
- *
+ *
* @param editingDomain
* the editing domain through which model changes are made
* @param label
@@ -204,7 +202,7 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
* list of EObjects. Also sets the list of affected files to be the files,
* where the targetContainer is stored. Target container specifies the
* eObject into which the duplicated eObjects will be added.
- *
+ *
* @param editingDomain
* the editing domain through which model changes are made
* @param label
@@ -235,15 +233,15 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
EObject duplicateDiagram = copier.get(diagramToDuplicate);
Resource targetResource = getNotationResourceForDiagram(((Diagram)duplicateDiagram).getElement(), getEditingDomain());
Resource diTargetResource = getDiResourceForDiagram(((Diagram)duplicateDiagram).getElement(), getEditingDomain());
-
+
if(targetResource != null) {
targetResource.getContents().add(duplicateDiagram);
-
- if(diTargetResource !=null) {
+
+ if(diTargetResource != null) {
try {
- IPageManager pageManager = ServiceUtilsForResource.getInstance().getIPageManager(diTargetResource);
- pageManager.addPage(duplicateDiagram);
- } catch(ServiceException e) {
+ IPageManager pageManager = ServiceUtilsForResource.getInstance().getIPageManager(diTargetResource);
+ pageManager.addPage(duplicateDiagram);
+ } catch (ServiceException e) {
Activator.log.error(e);
}
} else {
@@ -255,11 +253,11 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
if(targetResource != null) {
Activator.log.error("It was not possible to find the Resource with the source diagram", null);
targetResource.getContents().add(duplicateDiagram);
- if(diTargetResource !=null) {
+ if(diTargetResource != null) {
try {
- IPageManager pageManager = ServiceUtilsForResource.getInstance().getIPageManager(diTargetResource);
- pageManager.addPage(duplicateDiagram);
- } catch(ServiceException e) {
+ IPageManager pageManager = ServiceUtilsForResource.getInstance().getIPageManager(diTargetResource);
+ pageManager.addPage(duplicateDiagram);
+ } catch (ServiceException e) {
Activator.log.error(e);
}
} else {
@@ -279,7 +277,7 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
/**
* Returns the notation resource where to add the new diagram
- *
+ *
* @param eObject
* the semantic object linked to the diagram or the diagram itself.
* @param domain
@@ -295,25 +293,27 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
} else {
semanticObject = (EObject)object;
}
-
+
Resource containerResource = semanticObject.eResource();
- if(containerResource == null) {
+ if(containerResource == null) {
return null;
}
// retrieve the model set from the container resource
ResourceSet resourceSet = containerResource.getResourceSet();
-
+
if(resourceSet instanceof ModelSet) {
ModelSet modelSet = (ModelSet)resourceSet;
Resource destinationResource = modelSet.getAssociatedResource(semanticObject, NotationModel.NOTATION_FILE_EXTENSION, true);
return destinationResource;
- } else throw new RuntimeException("Resource Set is not a ModelSet or is null");
+ } else {
+ throw new RuntimeException("Resource Set is not a ModelSet or is null");
+ }
}
-
+
/**
* Returns the di resource where to add the new diagram
- *
+ *
* @param eObject
* the semantic object linked to the diagram or the diagram itself.
* @param domain
@@ -328,21 +328,23 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
} else {
semanticObject = (EObject)object;
}
-
+
Resource containerResource = semanticObject.eResource();
- if(containerResource == null) {
+ if(containerResource == null) {
return null;
}
// retrieve the model set from the container resource
ResourceSet resourceSet = containerResource.getResourceSet();
-
+
if(resourceSet instanceof ModelSet) {
ModelSet modelSet = (ModelSet)resourceSet;
- Resource destinationResource = modelSet.getAssociatedResource(semanticObject, DiModel.DI_FILE_EXTENSION, true);
+ Resource destinationResource = modelSet.getAssociatedResource(semanticObject, SashModel.MODEL_FILE_EXTENSION, true);
return destinationResource;
- } else throw new RuntimeException("Resource Set is not a ModelSet or is null");
+ } else {
+ throw new RuntimeException("Resource Set is not a ModelSet or is null");
+ }
}
-
+
/**
* Copier for diagrams, where only views and internal references are duplicated, not the semantic elements themselves.
*/
@@ -356,7 +358,7 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
/**
* Creates a new {@link DiagramCopier}
- *
+ *
* @param semanticObjects
* list of semantic objects already copied, to which new views should be related.
*/
@@ -366,7 +368,7 @@ public class GMFDiagramDuplicateEditHelperAdvice extends AbstractEditHelperAdvic
/**
* Overrides the get to look in the map of duplicated semantic objects in case the element was not found in this map
- *
+ *
* {@inheritDoc}
*/
@Override
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleObservableValue.java
index af7a984bf13..406b4a0f6cf 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleObservableValue.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,11 +8,14 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.core.databinding.observable.value.ValueDiff;
import org.eclipse.emf.common.command.Command;
@@ -31,7 +34,7 @@ import org.eclipse.papyrus.uml.tools.databinding.CommandBasedObservableValue;
* @author Camille Letavernier
*
*/
-public abstract class AbstractCustomStyleObservableValue extends AbstractObservableValue implements CommandBasedObservableValue, IChangeListener {
+public abstract class AbstractCustomStyleObservableValue extends AbstractObservableValue implements CommandBasedObservableValue, IChangeListener, IObserving {
protected View source;
@@ -104,6 +107,11 @@ public abstract class AbstractCustomStyleObservableValue extends AbstractObserva
public Command getCommand(Object value) {
return new CustomStyleValueCommand(source, value, styleClass, styleFeature, styleName);
}
+
+ @Override
+ public Object getObserved() {
+ return source;
+ }
@Override
public void dispose() {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/decoration/ExternalReferenceDecoration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/decoration/ExternalReferenceDecoration.java
new file mode 100644
index 00000000000..09e5a6d68af
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/decoration/ExternalReferenceDecoration.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.decoration;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.papyrus.infra.services.decoration.IDecorationSpecificFunctions;
+import org.eclipse.papyrus.infra.services.decoration.util.Decoration.PreferedPosition;
+import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
+import org.eclipse.papyrus.infra.services.markerlistener.IPapyrusMarker;
+
+/**
+ * A Decorator for GMF Shapes, which is displayed when the graphical container is different
+ * from the semantic container (i.e. highlight external references / imported elements)
+ *
+ * It is associated to the {@link ExternalReferenceMarker}
+ *
+ * @author Camille Letavernier
+ */
+public class ExternalReferenceDecoration implements IDecorationSpecificFunctions {
+
+ @Override
+ public MarkChildren supportsMarkerPropagation() {
+ //This marker should not be propagated
+ return null;
+ }
+
+ @Override
+ public IPapyrusDecoration markerPropagation(EList<IPapyrusDecoration> childDecorations) {
+ //This marker should not be propagated
+ return null;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptorForGE(IPapyrusMarker marker) {
+ return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor(Activator.ID, "icons/shortcut.gif"); //$NON-NLS-1$
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptorForME(IPapyrusMarker marker) {
+ //This decorator only applies to GMF elements
+ return null;
+ }
+
+ @Override
+ public PreferedPosition getPreferedPosition(IPapyrusMarker marker) {
+ return PreferedPosition.NORTH_EAST;
+ }
+
+ @Override
+ public String getMessage(IPapyrusMarker marker) {
+ return "This element is imported";
+ }
+
+ @Override
+ public int getPriority(IPapyrusMarker marker) {
+ return 0;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/decoration/ExternalReferenceMarker.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/decoration/ExternalReferenceMarker.java
new file mode 100644
index 00000000000..ee3084b585d
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/decoration/ExternalReferenceMarker.java
@@ -0,0 +1,135 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.decoration;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.infra.services.markerlistener.IPapyrusMarker;
+
+/**
+ * An IPapyrusMarker for GMF Shapes, which is activated when the graphical container is different
+ * from the semantic container (i.e. highlight external references / imported elements)
+ *
+ * This marker is volatile (created/deleted by EditPolicies on EditParts). It cannot be removed directly by the user
+ *
+ * @author Camille Letavernier
+ *
+ * @see {@link org.eclipse.papyrus.infra.gmfdiag.common.decoration.ExternalReferenceDecoration}
+ * @see {@link org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalReferenceEditPolicy}
+ */
+public class ExternalReferenceMarker implements IPapyrusMarker {
+
+ public static final String MARKER_TYPE = "org.eclipse.papyrus.infra.gmfdiag.common.externalref"; //$NON-NLS-1$
+
+ protected View notationElement;
+
+ public ExternalReferenceMarker(View notationElement) {
+ this.notationElement = notationElement;
+ }
+
+ @Override
+ public Resource getResource() {
+ return notationElement.eResource();
+ }
+
+ @Override
+ public EObject getEObject() {
+ return notationElement;
+ }
+
+ @Override
+ public boolean exists() {
+ return NotationHelper.isExternalRef(notationElement);
+ }
+
+ @Override
+ public String getType() throws CoreException {
+ return MARKER_TYPE;
+ }
+
+ @Override
+ public String getTypeLabel() throws CoreException {
+ return "External reference";
+ }
+
+ @Override
+ public void delete() throws CoreException {
+ //Do nothing: the user cannot manually remove the marker
+ }
+
+
+ ///
+ //The marker doesn't have any attribute: default implementation does nothing
+ ///
+
+ @Override
+ public Object getAttribute(String name) throws CoreException {
+ return null;
+ }
+
+ @Override
+ public String getAttribute(String name, String defaultValue) {
+ return defaultValue;
+ }
+
+ @Override
+ public boolean getAttribute(String name, boolean defaultValue) {
+ return defaultValue;
+ }
+
+ @Override
+ public int getAttribute(String name, int defaultValue) {
+ return defaultValue;
+ }
+
+ @Override
+ public Map<String, ?> getAttributes() throws CoreException {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public boolean isSubtypeOf(String type) throws CoreException {
+ return false;
+ }
+
+ @Override
+ public void setAttribute(String name, Object value) throws CoreException {
+ //Nothing
+ }
+
+ @Override
+ public void setAttribute(String name, String value) throws CoreException {
+ //Nothing
+ }
+
+ @Override
+ public void setAttribute(String name, boolean value) throws CoreException {
+ //Nothing
+ }
+
+ @Override
+ public void setAttribute(String name, int value) throws CoreException {
+ //Nothing
+ }
+
+ @Override
+ public void setAttributes(Map<String, ?> attributes) throws CoreException {
+ //Nothing
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java
index 8c916fd9450..4b51871b97b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ConnectionEditPart.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -44,6 +44,16 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
*/
protected static final String LINE_DASH_GAP = "lineDashGap";
+ /**
+ * Minimum length of dashes for dashed connectors
+ */
+ protected static final int LINE_DASH_MIN_LENGTH = 2;
+
+ /**
+ * Minimum length of the gapas between dashes
+ */
+ protected static final int LINE_GAP_MIN_LENGTH = 2;
+
public ConnectionEditPart(View view) {
super(view);
}
@@ -56,14 +66,14 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
super.refresh();
IFigure figure = this.getFigure();
Object model = this.getModel();
- if (figure instanceof PapyrusEdgeFigure && model instanceof Connector) {
- Connector connector = (Connector) model;
- PapyrusEdgeFigure edge = (PapyrusEdgeFigure) figure;
- String lineStyle = extract((StringValueStyle) connector.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), LINE_STYLE));
- int lineDashLength = extract((IntValueStyle) connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), LINE_DASH_LENGTH));
- int lineDashGap = extract((IntValueStyle) connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), LINE_DASH_GAP));
- if (lineStyle != null) {
- setupLineStyle(edge, lineStyle, connector.getLineWidth(), lineDashLength, lineDashGap);
+ if(figure instanceof PapyrusEdgeFigure && model instanceof Connector) {
+ Connector connector = (Connector)model;
+ PapyrusEdgeFigure edge = (PapyrusEdgeFigure)figure;
+ String lineStyle = extract((StringValueStyle)connector.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), LINE_STYLE));
+ int lineDashLength = extract((IntValueStyle)connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), LINE_DASH_LENGTH));
+ int lineDashGap = extract((IntValueStyle)connector.getNamedStyle(NotationPackage.eINSTANCE.getIntValueStyle(), LINE_DASH_GAP));
+ if(lineStyle != null) {
+ setupLineStyle(edge, lineStyle, connector.getLineWidth(), lineDashLength < LINE_DASH_MIN_LENGTH ? LINE_DASH_MIN_LENGTH : lineDashLength, lineDashGap < LINE_GAP_MIN_LENGTH ? LINE_GAP_MIN_LENGTH : lineDashGap);
} else {
edge.resetStyle();
}
@@ -72,13 +82,13 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
/**
* Extracts the primitive value from the given style
- *
+ *
* @param style
- * The style
+ * The style
* @return The primitive value
*/
private String extract(StringValueStyle style) {
- if (style == null || style.getStringValue() == null || style.getStringValue().isEmpty()) {
+ if(style == null || style.getStringValue() == null || style.getStringValue().isEmpty()) {
return null;
}
return style.getStringValue();
@@ -86,13 +96,13 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
/**
* Extracts the primitive value from the given style
- *
+ *
* @param style
- * The style
+ * The style
* @return The primitive value
*/
private int extract(IntValueStyle style) {
- if (style == null) {
+ if(style == null) {
return 0;
}
return style.getIntValue();
@@ -100,37 +110,37 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
/**
* Setups the line style of the edge according to the given CSS style
- *
+ *
* @param edge
- * The shape to setup
+ * The shape to setup
* @param style
- * The CSS style
+ * The CSS style
* @param originalWidth
- * Original width of the connector
+ * Original width of the connector
* @param lineDashLength
- * Length of the dashes
+ * Length of the dashes
* @param lineDashGap
- * Length of the gap between dashes
+ * Length of the gap between dashes
*/
private void setupLineStyle(PapyrusEdgeFigure edge, String style, int originalWidth, int lineDashLength, int lineDashGap) {
- if ("none".equals(style)) {
+ if("none".equals(style)) {
edge.resetStyle();
} else {
- if ("hidden".equals(style)) {
+ if("hidden".equals(style)) {
edge.setLineStyle(Graphics.LINE_SOLID);
edge.setLineWidth(0);
edge.setVisible(false);
- } else if ("dotted".equals(style)) {
+ } else if("dotted".equals(style)) {
edge.setLineStyle(Graphics.LINE_DOT);
edge.setLineWidth(originalWidth);
- } else if ("dashed".equals(style)) {
+ } else if("dashed".equals(style)) {
edge.setLineStyle(Graphics.LINE_CUSTOM);
edge.setLineWidth(originalWidth);
- edge.setLineDash(new int[] { lineDashLength, lineDashGap });
- } else if ("solid".equals(style)) {
+ edge.setLineDash(new int[]{ lineDashLength, lineDashGap });
+ } else if("solid".equals(style)) {
edge.setLineStyle(Graphics.LINE_SOLID);
edge.setLineWidth(originalWidth);
- } else if ("double".equals(style)) {
+ } else if("double".equals(style)) {
edge.setLineWidth(originalWidth * 2);
}
}
@@ -139,9 +149,9 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
/**
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart#createDefaultEditPolicies()
- *
+ *
*/
@Override
protected void createDefaultEditPolicies() {
@@ -149,4 +159,10 @@ public abstract class ConnectionEditPart extends ConnectionNodeEditPart implemen
installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new PapyrusConnectionEndEditPolicy());
}
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLineWidth();
+ installRouter();
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/IControlParserForDirectEdit.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/IControlParserForDirectEdit.java
new file mode 100644
index 00000000000..e4445f56796
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/IControlParserForDirectEdit.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Ansgar Radermacher (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.editpart;
+
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+
+
+/**
+ * Direct editors install their own parser. The objective of this interface is
+ * to reset a parser within an edit part, once a direct editor is stopped.
+ * This will restore the original parser
+ */
+public interface IControlParserForDirectEdit {
+ /**
+ * install a new parser
+ * @param parser
+ */
+ public void setParser(IParser parser);
+}
+
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ExternalReferenceEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ExternalReferenceEditPolicy.java
new file mode 100644
index 00000000000..3e73b38c62b
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ExternalReferenceEditPolicy.java
@@ -0,0 +1,121 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.decoration.ExternalReferenceMarker;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
+import org.eclipse.papyrus.infra.services.decoration.DecorationService;
+import org.eclipse.papyrus.infra.services.markerlistener.IPapyrusMarker;
+
+/**
+ * A generic EditPolicy which applies {@link ExternalReferenceMarker} to EditParts when they have been imported
+ * (According to {@link NotationHelper#isExternalRef(View)}
+ *
+ * @author Camille Letavernier
+ *
+ */
+//Rely on the GraphicalEditPolicyEx, which is less expensive than adding a listener to detect changes in the containment tree
+@SuppressWarnings("restriction")
+public class ExternalReferenceEditPolicy extends GraphicalEditPolicyEx {
+
+ /**
+ * The Edit Policy Role/ID
+ */
+ public static final Object EDIT_POLICY_ROLE = Activator.ID + ".externalReferenceDecorator"; //$NON-NLS-1$
+
+ /**
+ * Last known value for isExternalReference
+ */
+ protected boolean isExternalReference = false;
+
+ protected DecorationService decorationService;
+
+ protected IPapyrusMarker marker;
+
+ protected Adapter listener;
+
+ @Override
+ public void activate() {
+ super.activate();
+
+ try {
+ decorationService = ServiceUtilsForEditPart.getInstance().getService(DecorationService.class, getHost());
+ refresh();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ @Override
+ public void refresh() {
+ if(getView() == null) {
+ return;
+ }
+ if(decorationService == null) {
+ return;
+ }
+
+ //Add or remove the decoration when the current value is different from the last known value
+ if(NotationHelper.isExternalRef(getView()) != isExternalReference) {
+ isExternalReference = !isExternalReference;
+ if(isExternalReference) {
+ decorationService.addDecoration(getMarker(), getView());
+ } else {
+ decorationService.removeDecoration(getMarker().toString());
+ }
+ //We need to call refresh again, so that the decorator gets display.
+ //We shouldn't end up with a StackOverFlow, because we arrive here only when the "isExternalRef" value changes
+ getHost().refresh();
+ }
+ }
+
+ /**
+ * Returns the marker instance. It is never null
+ *
+ * @return
+ */
+ protected IPapyrusMarker getMarker() {
+ if(marker == null) {
+ marker = new ExternalReferenceMarker(getView());
+ }
+ return marker;
+ }
+
+ /**
+ * Return the view associated to this edit policy
+ *
+ * @return
+ */
+ protected View getView() {
+ return (View)getHost().getModel();
+ }
+
+ @Override
+ public void deactivate() {
+ super.deactivate();
+
+ if(marker != null && decorationService != null) {
+ //Remove the marker from the View to avoid duplication
+ decorationService.removeDecoration(getMarker().toString());
+ isExternalReference = false;
+ }
+
+ marker = null;
+ decorationService = null;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/PapyrusResizableShapeEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/PapyrusResizableShapeEditPolicy.java
index f5c83a5c8c4..134a94ffbf3 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/PapyrusResizableShapeEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/PapyrusResizableShapeEditPolicy.java
@@ -13,27 +13,34 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
+import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.tools.ResizeTracker;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.snap.ResizeTrackerWithPreferences;
/**
- *
+ *
* See Bug 424943 ResizableEditPolicy#getResizeCommand duplicates request ignoring some request values
- * TODO : remove this class when the bug will be fixed
+ *
*/
public class PapyrusResizableShapeEditPolicy extends ResizableShapeEditPolicy {
/**
+ * See Bug 424943 ResizableEditPolicy#getResizeCommand duplicates request ignoring some request values
+ * TODO : remove this override when the bug will be fixed
+ *
* Returns the command contribution for the given resize request. By
* default, the request is re-dispatched to the host's parent as a {@link org.eclipse.gef.RequestConstants#REQ_RESIZE_CHILDREN}. The
* parent's edit policies determine how to perform the resize based on the
* layout manager in use.
- *
+ *
* @param request
* the resize request
* @return the command contribution obtained from the parent
*/
+
@Override
protected Command getResizeCommand(ChangeBoundsRequest request) {
ChangeBoundsRequest req = new ChangeBoundsRequest(REQ_RESIZE_CHILDREN);
@@ -56,4 +63,16 @@ public class PapyrusResizableShapeEditPolicy extends ResizableShapeEditPolicy {
return getHost().getParent().getCommand(req);
}
+ /**
+ *
+ * @see org.eclipse.gef.editpolicies.ResizableEditPolicy#getResizeTracker(int)
+ *
+ * @param direction
+ * @return
+ */
+ @Override
+ protected ResizeTracker getResizeTracker(int direction) {
+ return new ResizeTrackerWithPreferences((GraphicalEditPart)getHost(), direction);
+ }
+
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ShapeCompartmentEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ShapeCompartmentEditPolicy.java
index 88fea4dcf86..a1120a7e39a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ShapeCompartmentEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/ShapeCompartmentEditPolicy.java
@@ -1,7 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
- *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,19 +8,14 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
-import java.util.HashMap;
-import java.util.Map;
-
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
@@ -35,6 +29,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.commands.SetNodeVisibilityComman
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IShapeCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.NotificationManager;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ShapeService;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.swt.widgets.Display;
/**
@@ -121,68 +116,15 @@ public class ShapeCompartmentEditPolicy extends GraphicalEditPolicy implements N
*/
protected void executeShapeCompartmentCreation(final IGraphicalEditPart editPart) {
try {
- // getEditingDomain(editPart).runExclusive(new Runnable() {
-
- /**
- * {@inheritDoc}
- */
- // public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- /**
- * {@inheritDoc}
- */
- public void run() {
- //boolean isVisible = hasToDisplayCompartment(editPart.getNotationView());
- CreateShapeCompartmentViewCommand command = new CreateShapeCompartmentViewCommand(getEditingDomain(editPart), "Create Compartment", "Command that creates the compartment displaying shapes", editPart.getNotationView(), /* isVisible */false);
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- //options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- //This should not change the command stack, as this transaction will only manipulate transient views. Create a transaction manually, if needed
- InternalTransactionalEditingDomain editingDomain = (InternalTransactionalEditingDomain)editPart.getEditingDomain();
- InternalTransaction activeTransaction = editingDomain.getActiveTransaction();
- if(activeTransaction != null && activeTransaction.isActive()) {
- if(activeTransaction.isReadOnly()) {
- //We're in a read-only active transaction (e.g. post-commit).
- //Typical case: We create a new gmf::View in a transaction.
- //The transaction has been committed, and the edit part is being created during the post-commit
- //post-commit is read-only. We cannot create a read-write transaction in this state, so we need
- //to deactive the read-only transaction first.
-
- try {
- //Deactivate the read-only transaction
- editingDomain.deactivate(activeTransaction);
-
- //Start a new read-write transaction
- InternalTransaction it = editingDomain.startTransaction(false, options);
- command.execute();
- it.commit();
- } finally {
- //Reactive the read-only transaction
- editingDomain.activate(activeTransaction);
- }
-
- } else {
- //We're already in an active read-write transaction. Simply execute the command
- //Never happens?
- command.execute();
- }
- } else {
- //We're not in a transaction. Start a new read-write transaction
- //Typical case: opening the diagram
- InternalTransaction it = editingDomain.startTransaction(false, options);
- command.execute();
- it.commit();
- }
-
- } catch (Exception e) {
- Activator.log.error(e);
- }
- // editPart.getEditingDomain().getCommandStack().execute(command);
- }
- });
- // }
- // });
+ //boolean isVisible = hasToDisplayCompartment(editPart.getNotationView());
+ TransactionalEditingDomain domain = getEditingDomain(editPart);
+ CreateShapeCompartmentViewCommand command = new CreateShapeCompartmentViewCommand(domain, "Create Compartment", "Command that creates the compartment displaying shapes", editPart.getNotationView(), /* isVisible */false);
+ try {
+ //This should not change the command stack, as this transaction will only manipulate transient views. Create a transaction manually, if needed
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
} catch (Exception e) {
Activator.log.error(e);
}
@@ -261,32 +203,19 @@ public class ShapeCompartmentEditPolicy extends GraphicalEditPolicy implements N
* the stereotype application
*/
protected void setVisibility(final View view, final boolean isVisible) {
- try {
- final GraphicalEditPart editPart = (GraphicalEditPart)getHost();
- editPart.getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- SetNodeVisibilityCommand setCommand = new SetNodeVisibilityCommand(editPart.getEditingDomain(), view, isVisible);
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)editPart.getEditingDomain()).startTransaction(false, options);
- setCommand.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
+ final GraphicalEditPart editPart = (GraphicalEditPart)getHost();
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ public void run() {
+ SetNodeVisibilityCommand setCommand = new SetNodeVisibilityCommand(editPart.getEditingDomain(), view, isVisible);
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(editPart.getEditingDomain(), setCommand);
+ } catch (Exception e) {
+ Activator.log.error(e);
}
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
+ }
+ });
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java
index 87d508506f5..aa77b8fa7f1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java
@@ -86,24 +86,26 @@ public class XYLayoutWithConstrainedResizedEditPolicy extends XYLayoutEditPolicy
double spacing = drep.getGridSpacing();
final double max_value = spacing * 20;
final SnapToHelper helper = (SnapToHelper)getHost().getAdapter(SnapToHelper.class);
- final LayoutHelper layoutHelper = new LayoutHelper();
- while(add < max_value) {//we define a max value to do test
- Rectangle LOCAL_BOUNDS = BOUNDS.getCopy();
- LOCAL_BOUNDS.translate(add, add);
- Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor);
- final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect);
- resultRect.setWidth(-1);
- resultRect.setHeight(-1);
- PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation());
- helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1);
- final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1));
- if(couldBeSnaped) {
- if(pt.equals(resultRect.getLocation())) {
- rect.setLocation(resultRect.getLocation());
- break;
- } else {
- add += spacing;
- continue;
+ if(helper != null) {
+ final LayoutHelper layoutHelper = new LayoutHelper();
+ while(add < max_value) {//we define a max value to do test
+ Rectangle LOCAL_BOUNDS = BOUNDS.getCopy();
+ LOCAL_BOUNDS.translate(add, add);
+ Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor);
+ final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect);
+ resultRect.setWidth(-1);
+ resultRect.setHeight(-1);
+ PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation());
+ helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1);
+ final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1));
+ if(couldBeSnaped) {
+ if(pt.equals(resultRect.getLocation())) {
+ rect.setLocation(resultRect.getLocation());
+ break;
+ } else {
+ add += spacing;
+ continue;
+ }
}
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java
index 57f97aa5bb9..7d783690bec 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/NotationHelper.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -47,4 +47,42 @@ public class NotationHelper {
}
return null;
}
+
+ /**
+ * Tests whether the given View is a reference to an external element.
+ * A view is an external reference if its graphical container is different from its semantic
+ * container (i.e. self.element.eContainer() != self.primaryView.eContainer().element)
+ *
+ * @param diagramElement
+ * @return
+ */
+ public static boolean isExternalRef(View diagramElement) {
+ if(diagramElement == null) {
+ return false;
+ }
+
+ View primaryView = SemanticElementHelper.findTopView(diagramElement);
+ if(primaryView == null) {
+ return false;
+ }
+
+ EObject semanticElement = primaryView.getElement();
+
+ if(semanticElement == null) {
+ return false;
+ }
+
+ EObject parentView = primaryView.eContainer();
+ if(!(parentView instanceof View)) {
+ return false;
+ }
+
+ EObject parentSemanticElement = ((View)parentView).getElement();
+ if(parentSemanticElement == null) {
+ return false;
+ }
+
+ //Relax the constraints for elements displayed on themselves (e.g. Frame in Composite Structure Diagram)
+ return parentSemanticElement != semanticElement.eContainer() && parentSemanticElement != semanticElement;
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/listener/RollbackNotificationHistoryListener.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/listener/RollbackNotificationHistoryListener.java
new file mode 100644
index 00000000000..b14056758e8
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/listener/RollbackNotificationHistoryListener.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.gmfdiag.common.listener;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.commands.operations.IOperationHistoryListener;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.OperationHistoryEvent;
+import org.eclipse.core.commands.operations.TriggeredOperations;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.core.resource.IRollbackStatus;
+import org.eclipse.papyrus.infra.core.resource.RollbackStatus;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
+import org.eclipse.papyrus.infra.gmfdiag.common.messages.Messages;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.ui.statushandlers.IStatusAdapterConstants;
+import org.eclipse.ui.statushandlers.StatusAdapter;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+
+/**
+ * An operation history listener that detects execution failures due to transaction rollback and presents dialogs to explain.
+ */
+public class RollbackNotificationHistoryListener implements IOperationHistoryListener {
+
+ public RollbackNotificationHistoryListener() {
+ super();
+ }
+
+ public void historyNotification(OperationHistoryEvent event) {
+ switch(event.getEventType()) {
+ case OperationHistoryEvent.OPERATION_NOT_OK:
+ final long now = System.currentTimeMillis();
+
+ IRollbackStatus rollback = RollbackStatus.findRollbackStatus(event.getStatus());
+ if(rollback == null) {
+ // Failure of a TriggeredOperations results in an event without a status
+ rollback = findRollbackStatus(event.getOperation());
+ }
+
+ if(rollback != null) {
+ Collection<?> causalObjects = rollback.getCausalObjects();
+ Collection<String> labels = getObjectLabels(causalObjects);
+
+ String message;
+ switch(rollback.getCode()) {
+ case IRollbackStatus.UNCAUGHT_EXCEPTION:
+ message = labels.isEmpty() ? Messages.RollbackNotificationHistoryListener_exception : NLS.bind(Messages.RollbackNotificationHistoryListener_exceptionWithCause, labels);
+ break;
+ case IRollbackStatus.READ_ONLY_OBJECT:
+ message = labels.isEmpty() ? Messages.RollbackNotificationHistoryListener_readOnly : NLS.bind(Messages.RollbackNotificationHistoryListener_readOnlyWithCause, labels);
+ break;
+ default:
+ message = labels.isEmpty() ? Messages.RollbackNotificationHistoryListener_unknown : NLS.bind(Messages.RollbackNotificationHistoryListener_unknownWithCause, labels);
+ break;
+ }
+
+ // Eclipse doesn't seem to use the status adapter explanation property, so we must create a new status with our message
+ StatusAdapter adapter = new StatusAdapter(new Status(rollback.getSeverity(), rollback.getPlugin(), rollback.getCode(), message, rollback.getException()));
+ adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, Messages.RollbackNotificationHistoryListener_title);
+ adapter.setProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY, now);
+
+ StatusManager.getManager().handle(adapter, StatusManager.SHOW);
+ }
+ break;
+ }
+ }
+
+ protected List<String> getObjectLabels(Iterable<?> objects) {
+ List<String> result = new ArrayList<String>();
+ ILabelProvider labels = null;
+
+ try {
+ for(Object next : objects) {
+ if(labels == null) {
+ try {
+ LabelProviderService labelService = null;
+ if(next instanceof EObject) {
+ labelService = ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, (EObject)next);
+ } else if(next instanceof Resource) {
+ labelService = ServiceUtilsForResource.getInstance().getService(LabelProviderService.class, (Resource)next);
+ }
+
+ if(labelService != null) {
+ labels = labelService.getLabelProvider();
+ }
+ } catch (ServiceException e) {
+ // not in an editor context. Fine
+ labels = new EMFLabelProvider();
+ }
+ }
+
+ if(labels != null) {
+ result.add(labels.getText(next));
+ }
+ }
+ } finally {
+ if(labels != null) {
+ labels.dispose();
+ }
+ }
+
+ return result;
+ }
+
+ protected IRollbackStatus findRollbackStatus(IUndoableOperation operation) {
+ IRollbackStatus result = null;
+
+ if(operation instanceof ICommand) {
+ CommandResult commandResult = ((ICommand)operation).getCommandResult();
+ if(commandResult != null) {
+ result = RollbackStatus.findRollbackStatus(commandResult.getStatus());
+ }
+ } else if(operation instanceof TriggeredOperations) {
+ // We can't get the children out of a generic ICompositeOperation, and from this one only the initial triggering operation
+ return findRollbackStatus(((TriggeredOperations)operation).getTriggeringOperation());
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java
index 912f239aac2..f12616652e3 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java
@@ -1,15 +1,16 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
+/****************************************
+ * Copyright (c) 2013, 2014 CEA 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:
- * Patrick Tessier (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
+ * Vincent Lorenzo (CEA LIST) - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
+ */
package org.eclipse.papyrus.infra.gmfdiag.common.messages;
import org.eclipse.osgi.util.NLS;
@@ -18,11 +19,26 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.common.messages.messages"; //$NON-NLS-1$
+ public static String RollbackNotificationHistoryListener_exception;
+
+ public static String RollbackNotificationHistoryListener_exceptionWithCause;
+
+ public static String RollbackNotificationHistoryListener_readOnly;
+
+ public static String RollbackNotificationHistoryListener_readOnlyWithCause;
+
+ public static String RollbackNotificationHistoryListener_title;
+
+ public static String RollbackNotificationHistoryListener_unknown;
+
+ public static String RollbackNotificationHistoryListener_unknownWithCause;
+
public static String UnitsUtils_Centimeters;
public static String UnitsUtils_Inches;
public static String UnitsUtils_Pixels;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties
index 1d8adde52ab..700f3e214d5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties
@@ -1,3 +1,23 @@
+#
+# Copyright (c) 2013, 2014 CEA 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:
+# Vincent Lorenzo (CEA LIST) - Initial API and implementation
+# Christian W. Damus (CEA) - bug 323802
+#
+
+RollbackNotificationHistoryListener_exception=The operation was rolled back due to an uncaught exception.
+RollbackNotificationHistoryListener_exceptionWithCause=The operation was rolled back due to an uncaught exception relating to the following objects: {0}
+RollbackNotificationHistoryListener_readOnly=The operation was rolled back because it modified read-only objects.
+RollbackNotificationHistoryListener_readOnlyWithCause=The operation was rolled back because it modified read-only objects: {0}
+RollbackNotificationHistoryListener_title=Operation Rolled Back
+RollbackNotificationHistoryListener_unknown=The operation was rolled back for an unknown reason.
+RollbackNotificationHistoryListener_unknownWithCause=The operation was rolled back for an unknown reason relating to the following objects: {0}
UnitsUtils_Centimeters=Centimeters
UnitsUtils_Inches=Inches
UnitsUtils_Pixels=Pixels
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
index 1ff44b8c5a6..81b39f9a956 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
@@ -142,6 +142,9 @@ public class PreferencesConstantsHelper {
public final static String DRAW_CONNECTION_POINT_CONSTANT = "drawConnectionPoint"; //$NON-NLS-1$
+ public final static String INVERT_BINDING_FOR_DEFAULT_RESIZE_AND_CONSTRAINED_RESIZE_CONSTANT = "invertBindingForDefaultResizeAndConstrainedResize"; //$NON-NLS-1$
+
+
/**
* A preference of type COLOR FILL
*/
@@ -308,12 +311,21 @@ public class PreferencesConstantsHelper {
* A preference to view the page break on the diagram
*/
public static final int VIEW_PAGE_BREAK = GRID_LINE_STYLE + 1;
-
+
/**
* A preference to draw big point when 2 links have a common part
*/
- public static final int DRAW_CONNECTION_POINT = VIEW_PAGE_BREAK +1;
+ public static final int DRAW_CONNECTION_POINT = VIEW_PAGE_BREAK + 1;
+ /**
+ * A Papyrus preference to define the if the default resize action is constrained or not.
+ * if the preference is <code>false</code>
+ * <ul>
+ * <li>default resize is not constraint</li>
+ * <li>resize + SHIFT is constrained</li>
+ * </ul>
+ */
+ public static final int INVERT_BINDING_FOR_DEFAULT_RESIZE_AND_CONSTRAINED_RESIZE = DRAW_CONNECTION_POINT + 1;
/**
* Get the preference constant used to store the preference of an element.
@@ -428,7 +440,7 @@ public class PreferencesConstantsHelper {
break;
case VIEW_PAGE_BREAK:
sb.append(VIEW_PAGE_BREAK_CONSTANT);
- break;
+ break;
default:
break;
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java
new file mode 100644
index 00000000000..a210921bf6c
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.providers;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalReferenceEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
+
+/**
+ * The EditPolicyProvider for {@link ExternalReferenceEditPolicy} It provides an {@link ExternalReferenceEditPolicy} for Papyrus edit parts, when the
+ * ServicesRegistry is available
+ * This edit policy in only installed on Shapes (Graphical Edges are typically owned by the Diagram, which makes it difficult
+ * to determine whether they are imported or not)
+ *
+ * @author Camille Letavernier
+ */
+public class ExternalReferenceEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
+
+ @Override
+ public boolean provides(IOperation operation) {
+ if(operation instanceof CreateEditPoliciesOperation) {
+ CreateEditPoliciesOperation createOperation = (CreateEditPoliciesOperation)operation;
+ try {
+ if(ServiceUtilsForEditPart.getInstance().getServiceRegistry(createOperation.getEditPart()) != null) {
+ return createOperation.getEditPart().getModel() instanceof Shape;
+ }
+ } catch (ServiceException ex) {
+ //Do nothing: the services registry is not available.
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void createEditPolicies(EditPart editPart) {
+ editPart.installEditPolicy(ExternalReferenceEditPolicy.EDIT_POLICY_ROLE, new ExternalReferenceEditPolicy());
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/BorderNodeSnapHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/BorderNodeSnapHelper.java
new file mode 100644
index 00000000000..503f835fce8
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/BorderNodeSnapHelper.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Vincent Lorenzo - CEA LIST
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.snap;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.SnapToHelper;
+
+/**
+ *
+ * Snap Helper with default behavior for BorderNode (snap only on the center of the figrue
+ * TODO PapyrusDragBorderNodeEditPartTrackerEx should use me
+ */
+public class BorderNodeSnapHelper extends NodeSnapHelper {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param helper
+ * @param figureToSnapBounds
+ */
+ public BorderNodeSnapHelper(SnapToHelper helper, Rectangle figureToSnapBounds) {
+ super(helper, figureToSnapBounds, false, false, true);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/NodeSnapHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/NodeSnapHelper.java
new file mode 100644
index 00000000000..329b6229324
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/NodeSnapHelper.java
@@ -0,0 +1,459 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo - CEA LIST
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.snap;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.gef.SnapToHelper;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.tools.DragEditPartsTracker;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.internal.ruler.SnapToHelperUtil;
+
+/**
+ *
+ * this class allows to determine the best location for a node on the grid
+ *
+ * Adapted code from DragEditPartsTrackerEx
+ * TODO : PapyrusDragEditPartTracker should use me
+ */
+@SuppressWarnings("restriction")
+public class NodeSnapHelper {
+
+ /**
+ * if true, we snap on the four corner of the figures
+ */
+ protected final boolean snapOnCorners;
+
+ /**
+ * if true, we snap on the four middle side of the figures
+ */
+ protected final boolean snapOnMiddles;
+
+ /**
+ * if true, we snap on the center of the figure
+ */
+ protected final boolean snapOnCenter;
+
+ /**
+ * the snap helper to use
+ */
+ private SnapToHelper helper;
+
+ /**
+ * the bounds of the figure to snap
+ */
+ private Rectangle figureToSnapBounds;
+
+ /**
+ * the compoundSourceRectangle, see {@link DragEditPartsTracker} for further informations
+ */
+ private Rectangle compoundSourceRectangle;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param helper
+ * the snap helper
+ * @param figureToSnapBounds
+ * the bounds of the figure to snap
+ *
+ */
+ public NodeSnapHelper(final SnapToHelper helper, final Rectangle figureToSnapBounds) {
+ this(helper, figureToSnapBounds, figureToSnapBounds);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param helper
+ * the snap helper
+ * @param figureToSnapBounds
+ * the bounds of the figure to snap
+ * @param compoundSourceRectangle
+ * see {@link DragEditPartsTracker} for further informations
+ */
+ public NodeSnapHelper(final SnapToHelper helper, final Rectangle figureToSnapBounds, final Rectangle compoundSourceRectangle) {
+ this(helper, figureToSnapBounds, compoundSourceRectangle, true, false, false);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param helper
+ * @param figureToSnapBounds
+ * @param snapOnCorners
+ * @param snapOnMiddles
+ * @param snapOnCenter
+ */
+ public NodeSnapHelper(final SnapToHelper helper, final Rectangle figureToSnapBounds, final boolean snapOnCorners, final boolean snapOnMiddles, final boolean snapOnCenter) {
+ this(helper, figureToSnapBounds, figureToSnapBounds, snapOnCorners, snapOnMiddles, snapOnCenter);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param helper
+ * @param figureToSnapBounds
+ * @param compoundSourceRectangle
+ * @param snapOnCorners
+ * @param snapOnMiddles
+ * @param snapOnCenter
+ */
+ public NodeSnapHelper(final SnapToHelper helper, final Rectangle figureToSnapBounds, final Rectangle compoundSourceRectangle, final boolean snapOnCorners, final boolean snapOnMiddles, final boolean snapOnCenter) {
+ this.helper = helper;
+ this.figureToSnapBounds = figureToSnapBounds;
+ this.compoundSourceRectangle = compoundSourceRectangle;
+ this.snapOnCorners = snapOnCorners;
+ this.snapOnMiddles = snapOnMiddles;
+ this.snapOnCenter = snapOnCenter;
+ }
+
+ /**
+ * This method can be overridden by clients to customize the snapping
+ * behavior.
+ *
+ * @param request
+ * the <code>ChangeBoundsRequest</code> from which the move delta
+ * can be extracted and updated
+ * We use <code>ChangeBoundsRequest</code> to be compatible with snap edit part tracker!
+ */
+ @SuppressWarnings({ "unchecked" })
+ public void snapPoint(ChangeBoundsRequest request) {
+ if(getSnapToHelper() != null && request.isSnapToEnabled()) {
+
+ //test to know if we are moving using keyboard
+ //TODO not useful here
+ // if(!getCurrentInput().isAnyButtonDown()) {
+ // calculateSnapPointFromArrowKey(request);
+ // return;
+ // }
+ int restrictedDirection = 0;
+ restrictedDirection = restrictedDirection | PositionConstants.EAST;
+ restrictedDirection = restrictedDirection | PositionConstants.WEST;
+ restrictedDirection = restrictedDirection | PositionConstants.SOUTH;
+ restrictedDirection = restrictedDirection | PositionConstants.NORTH;
+ request.getExtendedData().put(SnapToHelperUtil.RESTRICTED_DIRECTIONS, restrictedDirection);
+
+ final Map<Double, PrecisionPoint> distVSPoint = new HashMap<Double, PrecisionPoint>();
+ if(this.snapOnCorners) {
+ distVSPoint.putAll(getCornerDistances(request));
+ }
+
+ if(this.snapOnMiddles) {
+ distVSPoint.putAll(getMiddleDistances(request));
+ }
+
+ if(this.snapOnCenter) {
+ distVSPoint.putAll(getCenterDistances(request));
+ }
+
+ final List<Double> distances = new ArrayList<Double>(distVSPoint.keySet());
+ if(distances.size() > 0) {
+ double min = distances.get(0);
+ for(int i = 1; i < distances.size() - 1; i++) {
+ min = Math.min(min, distances.get(i));
+ }
+ request.setMoveDelta(distVSPoint.get(min));
+ }
+ }
+ }
+
+ /**
+ *
+ * @param request
+ * a move request
+ * @return
+ * the restricted direction for the request
+ */
+ protected final int getRestrictedDirection(final ChangeBoundsRequest request) {
+ int restrictedDirection = 0;
+ final Point delta = request.getMoveDelta();
+ if(delta.x > 0) {
+ restrictedDirection = restrictedDirection | PositionConstants.EAST;
+ restrictedDirection = restrictedDirection | PositionConstants.WEST;
+ }
+ if(delta.x < 0) {
+ restrictedDirection = restrictedDirection | PositionConstants.EAST;
+ restrictedDirection = restrictedDirection | PositionConstants.WEST;
+ }
+ if(delta.y > 0) {
+ restrictedDirection = restrictedDirection | PositionConstants.SOUTH;
+ restrictedDirection = restrictedDirection | PositionConstants.NORTH;
+ }
+ if(delta.y < 0) {
+ restrictedDirection = restrictedDirection | PositionConstants.SOUTH;
+ restrictedDirection = restrictedDirection | PositionConstants.NORTH;
+ }
+ return restrictedDirection;
+ }
+
+ /**
+ *
+ * @param request
+ * the move request
+ */
+ @SuppressWarnings("unchecked")
+ protected void calculateSnapPointFromArrowKey(final ChangeBoundsRequest request) {
+ if(request.getEditParts().size() == 0) {
+ return;
+ }
+ final Object ep = request.getEditParts().get(0);
+ if(!(ep instanceof IGraphicalEditPart)) {
+ return;
+ }
+ final RootEditPart root = ((IGraphicalEditPart)ep).getRoot();
+ if(!(root instanceof DiagramRootEditPart)) {
+ return;
+ }
+ final double gridSpacing = ((DiagramRootEditPart)root).getGridSpacing();
+ int max = (int)(1 + gridSpacing);
+ int restrictedDirection = getRestrictedDirection(request);
+ final Point delta = request.getMoveDelta();
+ final Point newDelta = new Point(0, 0);
+ int newMove = 0;
+ while(newMove < max) {
+ newMove++;
+ if(delta.x > 0) {
+ newDelta.x = (int)newMove + delta.x;
+ }
+ if(delta.x < 0) {
+ newDelta.x = (-newMove) + delta.x;
+ }
+ if(delta.y > 0) {
+ newDelta.y = newMove + delta.y;
+ }
+ if(delta.y < 0) {
+ newDelta.y = (-newMove) + delta.y;
+ }
+ request.setMoveDelta(newDelta);
+ request.getExtendedData().put(SnapToHelperUtil.RESTRICTED_DIRECTIONS, restrictedDirection);
+
+ final Map<Double, PrecisionPoint> distVSPoint = new HashMap<Double, PrecisionPoint>();
+ if(this.snapOnCorners) {
+ distVSPoint.putAll(getCornerDistances(request));
+ }
+
+ if(this.snapOnMiddles) {
+ distVSPoint.putAll(getMiddleDistances(request));
+ }
+
+ if(this.snapOnCenter) {
+ distVSPoint.putAll(getCenterDistances(request));
+ }
+
+ final List<Double> distances = new ArrayList<Double>(distVSPoint.keySet());
+ if(distances.size() > 0) {
+ double min = distances.get(0);
+ //We look for the minus distance
+ for(int i = 1; i < distances.size() - 1; i++) {
+ min = Math.min(min, distances.get(i));
+ }
+ final Point minPoint = distVSPoint.get(min);
+ //the distance can't be null
+ if(minPoint.x != 0 || minPoint.y != 0) {
+ //the calculate move must be in the same direction than the keyboard move
+ if(Integer.signum(minPoint.x) == Integer.signum(delta.x) && Integer.signum(minPoint.y) == Integer.signum(delta.y)) {
+ request.setMoveDelta(distVSPoint.get(min));
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param request
+ * @return
+ * a map with the couple distance and delta point to anchor by the corner of the figure
+ */
+ protected Map<Double, PrecisionPoint> getCornerDistances(final ChangeBoundsRequest request) {
+ final Map<Double, PrecisionPoint> distVSPoints = new HashMap<Double, PrecisionPoint>();
+ if(getSnapToHelper() != null && request.isSnapToEnabled()) {
+ final Point moveDelta = request.getMoveDelta();
+ PrecisionRectangle jointRect = getCompoundSourceRectangle();
+ jointRect.translate(moveDelta);
+
+ //calculate the delta to anchor on the top left corner
+ final PrecisionPoint topLeftCornerDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectTopLeft = getSourceRectangle();
+ baseRectTopLeft.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectTopLeft, jointRect }, topLeftCornerDelta);
+
+ //calculate the delta to anchor on the top right corner
+ final PrecisionPoint topRightCornerDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectTopRight = getSourceRectangle();
+ baseRectTopRight.setX(baseRectTopRight.x + baseRectTopRight.width);
+ baseRectTopRight.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectTopRight, jointRect }, topRightCornerDelta);
+
+ //calculate the delta to anchor on the bottom left corner
+ final PrecisionPoint bottomLeftCornerDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectBottomLeft = getSourceRectangle();
+ baseRectBottomLeft.setY(baseRectBottomLeft.y + baseRectBottomLeft.height);
+ baseRectBottomLeft.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectBottomLeft, jointRect }, bottomLeftCornerDelta);
+
+ //calculate the delta to anchor on the bottom right corner
+ final PrecisionPoint bottomRightCornerDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectBottomRight = getSourceRectangle();
+ baseRectBottomRight.setX(baseRectBottomRight.x + baseRectBottomRight.width);
+ baseRectBottomRight.setY(baseRectBottomRight.y + baseRectBottomRight.height);
+ baseRectBottomRight.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectBottomRight, jointRect }, bottomRightCornerDelta);
+
+ final Point ref = baseRectTopLeft.getTopLeft();
+ distVSPoints.put(distance(ref, topLeftCornerDelta), topLeftCornerDelta);
+ distVSPoints.put(distance(ref, topRightCornerDelta), topRightCornerDelta);
+ distVSPoints.put(distance(ref, bottomLeftCornerDelta), bottomLeftCornerDelta);
+ distVSPoints.put(distance(ref, bottomRightCornerDelta), bottomRightCornerDelta);
+ }
+ return distVSPoints;
+ }
+
+ /**
+ *
+ * @param request
+ * @return
+ * a map with the couple distance and delta point to anchor by the middle of each side of the figure
+ */
+ protected Map<Double, PrecisionPoint> getMiddleDistances(final ChangeBoundsRequest request) {
+ final Map<Double, PrecisionPoint> distVSPoints = new HashMap<Double, PrecisionPoint>();
+ if(getSnapToHelper() != null && request.isSnapToEnabled()) {
+ final Point moveDelta = request.getMoveDelta();
+
+ PrecisionRectangle jointRect = getCompoundSourceRectangle();
+ jointRect.translate(moveDelta);
+ //calculate the delta to anchor on the middle top point
+ final PrecisionPoint middleTopDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectMiddleTop = getSourceRectangle();
+ baseRectMiddleTop.setPreciseLocation(baseRectMiddleTop.preciseX() + (baseRectMiddleTop.preciseWidth() / 2), baseRectMiddleTop.preciseY());
+ baseRectMiddleTop.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectMiddleTop, jointRect }, middleTopDelta);
+
+ //calculate the delta to anchor on the middle left point
+ final PrecisionPoint middleLeftDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectMiddleLeft = getSourceRectangle();
+ baseRectMiddleLeft.setPreciseLocation(baseRectMiddleLeft.preciseX(), baseRectMiddleLeft.preciseY() + (baseRectMiddleLeft.preciseWidth() / 2));
+ baseRectMiddleLeft.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectMiddleLeft, jointRect }, middleLeftDelta);
+
+ //calculate the delta to anchor on the middle right point
+ final PrecisionPoint middleRightDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectMiddleRight = getSourceRectangle();
+ baseRectMiddleRight.setPreciseLocation(baseRectMiddleRight.preciseX() + baseRectMiddleRight.preciseWidth(), baseRectMiddleRight.preciseY() + (baseRectMiddleRight.preciseHeight() / 2));
+ baseRectMiddleRight.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectMiddleRight, jointRect }, middleRightDelta);
+
+ //calculate the delta to anchor on the middle bottom
+ final PrecisionPoint middleBottomDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectMiddleBottom = getSourceRectangle();
+ baseRectMiddleBottom.setPreciseLocation(baseRectMiddleBottom.preciseX() + (baseRectMiddleBottom.preciseWidth() / 2), baseRectMiddleBottom.preciseY() + baseRectMiddleBottom.preciseHeight());
+ baseRectMiddleBottom.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectMiddleBottom, jointRect }, middleBottomDelta);
+
+ final Point ref = baseRectMiddleTop.getTopLeft();
+ distVSPoints.put(distance(ref, middleTopDelta), middleTopDelta);
+ distVSPoints.put(distance(ref, middleLeftDelta), middleLeftDelta);
+ distVSPoints.put(distance(ref, middleRightDelta), middleRightDelta);
+ distVSPoints.put(distance(ref, middleBottomDelta), middleBottomDelta);
+ }
+
+ return distVSPoints;
+ }
+
+ /**
+ *
+ * @param request
+ * @return
+ * a map with the couple distance and delta point to anchor by the center of the figure
+ */
+ protected Map<Double, PrecisionPoint> getCenterDistances(final ChangeBoundsRequest request) {
+ final Map<Double, PrecisionPoint> distVSPoints = new HashMap<Double, PrecisionPoint>();
+ if(getSnapToHelper() != null && request.isSnapToEnabled()) {
+ final Point moveDelta = request.getMoveDelta();
+
+ PrecisionRectangle jointRect = getCompoundSourceRectangle();
+ jointRect.translate(moveDelta);
+ //calculate the delta to anchor on the middle top point
+ final PrecisionPoint centerDelta = new PrecisionPoint(moveDelta);
+ final PrecisionRectangle baseRectCenter = getSourceRectangle();
+ baseRectCenter.setPreciseLocation(baseRectCenter.preciseX() + (baseRectCenter.preciseWidth() / 2), baseRectCenter.preciseY() + (baseRectCenter.preciseHeight() / 2));
+ baseRectCenter.translate(moveDelta);
+ getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectCenter, jointRect }, centerDelta);
+
+ final Point ref = baseRectCenter.getTopLeft();
+ distVSPoints.put(distance(ref, centerDelta), centerDelta);
+ }
+
+ return distVSPoints;
+ }
+
+ /**
+ *
+ * @return
+ * the compoundSourceRectangle
+ */
+ private PrecisionRectangle getCompoundSourceRectangle() {
+ return new PrecisionRectangle(this.compoundSourceRectangle);
+ }
+
+ /**
+ *
+ * @return
+ * the source rectangle
+ */
+ private PrecisionRectangle getSourceRectangle() {
+ return new PrecisionRectangle(this.figureToSnapBounds);
+ }
+
+ /**
+ *
+ * @param pt1
+ * a first point
+ * @param pt2
+ * the second point
+ * @return
+ * the distance between the two points
+ */
+ protected final double distance(final Point pt1, final Point pt2) {
+ double deltaX = pt1.preciseX() - pt2.preciseX();
+ double deltaY = pt1.preciseY() - pt2.preciseY();
+ return Math.hypot(deltaX, deltaY);
+ }
+
+ /**
+ *
+ * @return
+ * the snap helper
+ */
+ protected final SnapToHelper getSnapToHelper() {
+ return this.helper;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/PapyrusDragEditPartsTrackerEx.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/PapyrusDragEditPartsTrackerEx.java
index e184e3ee46c..2371b34a767 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/PapyrusDragEditPartsTrackerEx.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/PapyrusDragEditPartsTrackerEx.java
@@ -248,33 +248,35 @@ public class PapyrusDragEditPartsTrackerEx extends DragEditPartsTrackerEx {
baseRectTopLeft.translate(moveDelta);
getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectTopLeft, jointRect }, topLeftCornerDelta);
- //calculate the delta to anchor on the top right corner
- final PrecisionPoint topRightCornerDelta = new PrecisionPoint(moveDelta);
- final PrecisionRectangle baseRectTopRight = getSourceRectangle();
- baseRectTopRight.setX(baseRectTopRight.x + baseRectTopRight.width);
- baseRectTopRight.translate(moveDelta);
- getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectTopRight, jointRect }, topRightCornerDelta);
-
- //calculate the delta to anchor on the bottom left corner
- final PrecisionPoint bottomLeftCornerDelta = new PrecisionPoint(moveDelta);
- final PrecisionRectangle baseRectBottomLeft = getSourceRectangle();
- baseRectBottomLeft.setY(baseRectBottomLeft.y + baseRectBottomLeft.height);
- baseRectBottomLeft.translate(moveDelta);
- getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectBottomLeft, jointRect }, bottomLeftCornerDelta);
-
- //calculate the delta to anchor on the bottom right corner
- final PrecisionPoint bottomRightCornerDelta = new PrecisionPoint(moveDelta);
- final PrecisionRectangle baseRectBottomRight = getSourceRectangle();
- baseRectBottomRight.setX(baseRectBottomRight.x + baseRectBottomRight.width);
- baseRectBottomRight.setY(baseRectBottomRight.y + baseRectBottomRight.height);
- baseRectBottomRight.translate(moveDelta);
- getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectBottomRight, jointRect }, bottomRightCornerDelta);
+ //FIXME : add preferences and re-activate this part of the code
+
+ // //calculate the delta to anchor on the top right corner
+ // final PrecisionPoint topRightCornerDelta = new PrecisionPoint(moveDelta);
+ // final PrecisionRectangle baseRectTopRight = getSourceRectangle();
+ // baseRectTopRight.setX(baseRectTopRight.x + baseRectTopRight.width);
+ // baseRectTopRight.translate(moveDelta);
+ // getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectTopRight, jointRect }, topRightCornerDelta);
+ //
+ // //calculate the delta to anchor on the bottom left corner
+ // final PrecisionPoint bottomLeftCornerDelta = new PrecisionPoint(moveDelta);
+ // final PrecisionRectangle baseRectBottomLeft = getSourceRectangle();
+ // baseRectBottomLeft.setY(baseRectBottomLeft.y + baseRectBottomLeft.height);
+ // baseRectBottomLeft.translate(moveDelta);
+ // getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectBottomLeft, jointRect }, bottomLeftCornerDelta);
+ //
+ // //calculate the delta to anchor on the bottom right corner
+ // final PrecisionPoint bottomRightCornerDelta = new PrecisionPoint(moveDelta);
+ // final PrecisionRectangle baseRectBottomRight = getSourceRectangle();
+ // baseRectBottomRight.setX(baseRectBottomRight.x + baseRectBottomRight.width);
+ // baseRectBottomRight.setY(baseRectBottomRight.y + baseRectBottomRight.height);
+ // baseRectBottomRight.translate(moveDelta);
+ // getSnapToHelper().snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[]{ baseRectBottomRight, jointRect }, bottomRightCornerDelta);
final Point ref = baseRectTopLeft.getTopLeft();
distVSPoints.put(distance(ref, topLeftCornerDelta), topLeftCornerDelta);
- distVSPoints.put(distance(ref, topRightCornerDelta), topRightCornerDelta);
- distVSPoints.put(distance(ref, bottomLeftCornerDelta), bottomLeftCornerDelta);
- distVSPoints.put(distance(ref, bottomRightCornerDelta), bottomRightCornerDelta);
+ // distVSPoints.put(distance(ref, topRightCornerDelta), topRightCornerDelta);
+ // distVSPoints.put(distance(ref, bottomLeftCornerDelta), bottomLeftCornerDelta);
+ // distVSPoints.put(distance(ref, bottomRightCornerDelta), bottomRightCornerDelta);
}
return distVSPoints;
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/ResizeTrackerWithPreferences.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/ResizeTrackerWithPreferences.java
new file mode 100644
index 00000000000..498c0885b38
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/ResizeTrackerWithPreferences.java
@@ -0,0 +1,195 @@
+package org.eclipse.papyrus.infra.gmfdiag.common.snap;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionDimension;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.SnapToHelper;
+import org.eclipse.gef.handles.HandleBounds;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.tools.ResizeTracker;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+
+/**
+ * Adapted code from ResizeTracker
+ * A resize tracker managing a preference for constrained resize
+ *
+ */
+public class ResizeTrackerWithPreferences extends ResizeTracker {
+
+ /**
+ * the snap helper to use
+ */
+ private SnapToHelper localSnapToHelper;
+
+ /**
+ * the source rect bounds
+ */
+ private PrecisionRectangle localSourceRect;
+
+ public ResizeTrackerWithPreferences(GraphicalEditPart owner, int direction) {
+ super(owner, direction);
+ }
+
+ @Override
+ public void activate() {
+ super.activate();
+ if(getOwner() != null) {
+ if(getTargetEditPart() != null)
+ localSnapToHelper = (SnapToHelper)getTargetEditPart().getAdapter(SnapToHelper.class);
+
+ IFigure figure = getOwner().getFigure();
+ if(figure instanceof HandleBounds)
+ localSourceRect = new PrecisionRectangle(((HandleBounds)figure).getHandleBounds());
+ else
+ localSourceRect = new PrecisionRectangle(figure.getBounds());
+ figure.translateToAbsolute(localSourceRect);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.gef.tools.ResizeTracker#updateSourceRequest()
+ *
+ */
+ @Override
+ protected void updateSourceRequest() {
+ ChangeBoundsRequest request = (ChangeBoundsRequest)getSourceRequest();
+ Dimension d = getDragMoveDelta();
+
+ Point location = new Point(getLocation());
+ Point moveDelta = new Point(0, 0);
+ Dimension resizeDelta = new Dimension(0, 0);
+
+ request.setConstrainedResize(isConstrainedResizeAccordingToPreference());
+ request.setCenteredResize(getCurrentInput().isModKeyDown(SnapUtils.MODIFIER_CENTERED_RESIZE));
+ request.setSnapToEnabled(!getCurrentInput().isModKeyDown(SnapUtils.MODIFIER_NO_SNAPPING));
+
+ if(request.isConstrainedResize() && getOwner() != null) {
+ request.setConstrainedResize(true);
+
+ int origHeight = getOwner().getFigure().getBounds().height;
+ int origWidth = getOwner().getFigure().getBounds().width;
+ float ratio = 1;
+
+ if(origWidth != 0 && origHeight != 0)
+ ratio = ((float)origHeight / (float)origWidth);
+
+ if(getResizeDirection() == PositionConstants.SOUTH_EAST) {
+ if(d.height > (d.width * ratio))
+ d.width = (int)(d.height / ratio);
+ else
+ d.height = (int)(d.width * ratio);
+ } else if(getResizeDirection() == PositionConstants.NORTH_WEST) {
+ if(d.height < (d.width * ratio))
+ d.width = (int)(d.height / ratio);
+ else
+ d.height = (int)(d.width * ratio);
+ } else if(getResizeDirection() == PositionConstants.NORTH_EAST) {
+ if(-(d.height) > (d.width * ratio))
+ d.width = -(int)(d.height / ratio);
+ else
+ d.height = -(int)(d.width * ratio);
+ } else if(getResizeDirection() == PositionConstants.SOUTH_WEST) {
+ if(-(d.height) < (d.width * ratio))
+ d.width = -(int)(d.height / ratio);
+ else
+ d.height = -(int)(d.width * ratio);
+ }
+ }
+
+ if((getResizeDirection() & PositionConstants.NORTH) != 0) {
+ if(request.isCenteredResize()) {
+ resizeDelta.height -= d.height;
+ }
+ moveDelta.y += d.height;
+ resizeDelta.height -= d.height;
+ }
+ if((getResizeDirection() & PositionConstants.SOUTH) != 0) {
+ if(request.isCenteredResize()) {
+ moveDelta.y -= d.height;
+ resizeDelta.height += d.height;
+ }
+ resizeDelta.height += d.height;
+ }
+ if((getResizeDirection() & PositionConstants.WEST) != 0) {
+ if(request.isCenteredResize()) {
+ resizeDelta.width -= d.width;
+ }
+ moveDelta.x += d.width;
+ resizeDelta.width -= d.width;
+ }
+ if((getResizeDirection() & PositionConstants.EAST) != 0) {
+ if(request.isCenteredResize()) {
+ moveDelta.x -= d.width;
+ resizeDelta.width += d.width;
+ }
+ resizeDelta.width += d.width;
+ }
+
+ request.setMoveDelta(moveDelta);
+ request.setSizeDelta(resizeDelta);
+ request.setLocation(location);
+ request.setEditParts(getOperationSet());
+ request.getExtendedData().clear();
+ request.setResizeDirection(getResizeDirection());
+
+ if(request.isSnapToEnabled() && localSnapToHelper != null) {
+ PrecisionRectangle rect = localSourceRect.getPreciseCopy();
+ rect.translate(moveDelta);
+ rect.resize(resizeDelta);
+ PrecisionRectangle result = new PrecisionRectangle();
+
+ localSnapToHelper.snapRectangle(request, request.getResizeDirection(), rect, result);
+ if(request.isCenteredResize()) {
+ if(result.preciseX() != 0.0)
+ result.setPreciseWidth(result.preciseWidth() - result.preciseX());
+ else if(result.preciseWidth() != 0.0) {
+ result.setPreciseX(-result.preciseWidth());
+ result.setPreciseWidth(result.preciseWidth() * 2.0);
+ }
+
+ if(result.preciseY() != 0.0)
+ result.setPreciseHeight(result.preciseHeight() - result.preciseY());
+ else if(result.preciseHeight() != 0.0) {
+ result.setPreciseY(-result.preciseHeight());
+ result.setPreciseHeight(result.preciseHeight() * 2.0);
+ }
+ }
+
+ PrecisionPoint preciseMove = new PrecisionPoint(result.preciseX() + moveDelta.x, result.preciseY() + moveDelta.y);
+
+ PrecisionDimension preciseResize = new PrecisionDimension(result.preciseWidth() + resizeDelta.width, result.preciseHeight() + resizeDelta.height);
+
+ request.setMoveDelta(preciseMove);
+ request.setSizeDelta(preciseResize);
+ }
+
+ enforceConstraintsForResize(request);
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> if the current resize must be constrained and <code>false</code> if not
+ */
+ private final boolean isConstrainedResizeAccordingToPreference() {
+ IPreferenceStore store = Activator.getInstance().getPreferenceStore();
+ boolean isInverted = false;
+ if(store.contains(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.INVERT_BINDING_FOR_DEFAULT_RESIZE_AND_CONSTRAINED_RESIZE))) {
+ isInverted = store.getBoolean(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.INVERT_BINDING_FOR_DEFAULT_RESIZE_AND_CONSTRAINED_RESIZE));
+ }
+ //to activate this preference use this code during the preference initialization of Papyrus
+ //org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getPreferenceStore().setValue(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.INVERT_BINDING_FOR_DEFAULT_RESIZE_AND_CONSTRAINED_RESIZE),true);
+ if(isInverted) {
+ return !getCurrentInput().isModKeyDown(SnapUtils.MODIFIER_CONSTRAINED_RESIZE);
+ }
+ return getCurrentInput().isModKeyDown(SnapUtils.MODIFIER_CONSTRAINED_RESIZE);
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/SnapUtils.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/SnapUtils.java
new file mode 100644
index 00000000000..33b4cac3b65
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/snap/SnapUtils.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.snap;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.SWT;
+
+
+public class SnapUtils {
+
+ private SnapUtils() {
+ //to prevent instanciation
+ }
+
+ /**
+ * Key modifier for centered resizing. It's ALT on the Mac and MOD1 on all
+ * other platforms.
+ */
+ public static final int MODIFIER_CENTERED_RESIZE;
+
+ static {
+ if(Platform.OS_MACOSX.equals(Platform.getOS())) {
+ MODIFIER_CENTERED_RESIZE = SWT.ALT;
+ } else {
+ MODIFIER_CENTERED_RESIZE = SWT.MOD1;
+ }
+ }
+
+ /**
+ * Key modifier for constrained resizing. It's SHIFT on all platforms.
+ */
+ public static final int MODIFIER_CONSTRAINED_RESIZE = SWT.SHIFT;
+
+ /**
+ * Key modifier for ignoring snap while dragging. It's CTRL on Mac, and ALT
+ * on all other platforms.
+ */
+ public static final int MODIFIER_NO_SNAPPING;
+
+ static {
+ if (Platform.OS_MACOSX.equals(Platform.getOS())) {
+ MODIFIER_NO_SNAPPING = SWT.CTRL;
+ } else {
+ MODIFIER_NO_SNAPPING = SWT.ALT;
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafe.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafe.java
new file mode 100644
index 00000000000..dd82a003f72
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafe.java
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.gmfdiag.common.utils;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.transaction.RollbackException;
+import org.eclipse.emf.transaction.Transaction;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.commands.Activator;
+
+
+/**
+ * Utilities for operations in the GMF context that we might consider as "unsafe" or exceptional cases.
+ */
+public class GMFUnsafe {
+
+ /**
+ * Not instantiable by clients.
+ */
+ private GMFUnsafe() {
+ super();
+ }
+
+ /**
+ * Performs an unsafe write to the model. The editing domain may or may not already have an active transaction, which may or may not be read-only;
+ * it does not matter. In any case, the changes performed will not be recorded for undo/redo or roll-back. Thus, this is appropriate only for use
+ * cases such as synchronization of canonical views, which are not considered logically as abstract model edits (though they be concrete changes).
+ *
+ * @param domain
+ * an editing domain that may or may not have a transaction in progress
+ * @param writeOperation
+ * an operation that will make unchecked/unsafe changes to the editing {@code domain}
+ *
+ * @throws RollbackException
+ * if the unprotected write transaction fails to commit. Note that this could occlude an uncaught exception thrown by the
+ * {@code writeOperation} runnable
+ * @throws InterruptedException
+ * if the current thread is interrupted while waiting for the unprotected write transaction to start
+ */
+ public static void write(TransactionalEditingDomain domain, Runnable writeOperation) throws InterruptedException, RollbackException {
+ runUnprotected(domain, writeOperation);
+ }
+
+ private static void runUnprotected(TransactionalEditingDomain domain, Runnable writeOperation) throws InterruptedException, RollbackException {
+ InternalTransactionalEditingDomain internalDomain = (InternalTransactionalEditingDomain)domain;
+ Transaction unprotected = internalDomain.startTransaction(false, Collections.singletonMap(Transaction.OPTION_UNPROTECTED, true));
+ try {
+ writeOperation.run();
+ } finally {
+ unprotected.commit();
+ }
+ }
+
+ /**
+ * Executes an unsafe command on the model. The editing domain may or may not already have an active transaction, which may or may not be
+ * read-only; it does not matter. In any case, the changes performed will not be recorded for undo/redo or roll-back. Thus, this is appropriate
+ * only for use cases such as synchronization of canonical views, which are not considered logically as abstract model edits (though they be
+ * concrete changes).
+ *
+ * @param domain
+ * an editing domain that may or may not have a transaction in progress
+ * @param command
+ * a command that will make unchecked/unsafe changes to the editing {@code domain}
+ *
+ * @throws RollbackException
+ * if the unprotected write transaction fails to commit. Note that this could occlude an uncaught exception thrown by the
+ * {@code writeOperation} runnable
+ * @throws InterruptedException
+ * if the current thread is interrupted while waiting for the unprotected write transaction to start
+ *
+ * @see #write(TransactionalEditingDomain, Runnable)
+ */
+ public static void write(TransactionalEditingDomain domain, Command command) throws InterruptedException, RollbackException {
+ write(domain, new CommandRunnable(command));
+ }
+
+ /**
+ * Executes an unsafe command on the model. The editing domain may or may not already have an active transaction, which may or may not be
+ * read-only; it does not matter. In any case, the changes performed will not be recorded for undo/redo or roll-back. Thus, this is appropriate
+ * only for use cases such as synchronization of canonical views, which are not considered logically as abstract model edits (though they be
+ * concrete changes).
+ *
+ * @param domain
+ * an editing domain that may or may not have a transaction in progress
+ * @param command
+ * a command that will make unchecked/unsafe changes to the editing {@code domain}
+ *
+ * @throws RollbackException
+ * if the unprotected write transaction fails to commit. Note that this could occlude an uncaught exception thrown by the
+ * {@code writeOperation} runnable
+ * @throws InterruptedException
+ * if the current thread is interrupted while waiting for the unprotected write transaction to start
+ * @throws ExecutionException
+ * if the {@code command} fails to execute
+ *
+ * @see #write(TransactionalEditingDomain, Runnable)
+ */
+ public static void write(TransactionalEditingDomain domain, ICommand command) throws InterruptedException, RollbackException, ExecutionException {
+ try {
+ write(domain, new GMFCommandRunnable(command));
+ } catch (WrappedException e) {
+ if(e.exception() instanceof ExecutionException) {
+ throw (ExecutionException)e.exception();
+ } else {
+ // It must have been an unchecked RuntimeException of some kind
+ throw (RuntimeException)e.exception();
+ }
+ }
+ }
+
+ /**
+ * Wraps a command for unprotected execution, undo, and redo on the command stack.
+ *
+ * @param domain
+ * a transactional editing domain on which the {@code command} operates
+ * @param command
+ * a command to wrap
+ * @return the wrapped command
+ */
+ public static Command wrap(TransactionalEditingDomain domain, Command command) {
+ return new UnsafeCommandWrapper(domain, command);
+ }
+
+ //
+ // Nested types
+ //
+
+ /**
+ * A useful base class for commands that need to execute, undo, and redo in unprotected mode on the command stack.
+ */
+ public static abstract class UnsafeCommand extends AbstractCommand {
+
+ private final TransactionalEditingDomain domain;
+
+ protected UnsafeCommand(TransactionalEditingDomain domain) {
+ this.domain = domain;
+ }
+
+ protected UnsafeCommand(TransactionalEditingDomain domain, String label, String description) {
+ super(label, description);
+
+ this.domain = domain;
+ }
+
+ protected UnsafeCommand(TransactionalEditingDomain domain, String label) {
+ super(label);
+
+ this.domain = domain;
+ }
+
+ @Override
+ public final void execute() {
+ try {
+ runUnprotected(domain, new Runnable() {
+
+ @Override
+ public void run() {
+ doExecute();
+ }
+ });
+ } catch (Exception e) {
+ handleException(e);
+ }
+ }
+
+ protected abstract void doExecute();
+
+ @Override
+ public final void undo() {
+ try {
+ runUnprotected(domain, new Runnable() {
+
+ @Override
+ public void run() {
+ doUndo();
+ }
+ });
+ } catch (Exception e) {
+ handleException(e);
+ }
+ }
+
+ protected void doUndo() {
+ // Pass. Usually, unprotected changes are not undoable
+ }
+
+ @Override
+ public final void redo() {
+ try {
+ runUnprotected(domain, new Runnable() {
+
+ @Override
+ public void run() {
+ doRedo();
+ }
+ });
+ } catch (Exception e) {
+ handleException(e);
+ }
+ }
+
+ protected void doRedo() {
+ // Pass. Usually, unprotected changes are not undoable
+ }
+
+ void handleException(Exception e) {
+ Activator.log.error(e);
+ }
+ }
+
+ private static class UnsafeCommandWrapper extends UnsafeCommand {
+
+ private final Command command;
+
+ UnsafeCommandWrapper(TransactionalEditingDomain domain, Command command) {
+ super(domain, command.getLabel(), command.getDescription());
+
+ this.command = command;
+ }
+
+ @Override
+ public void dispose() {
+ command.dispose();
+ }
+
+ @Override
+ public boolean canExecute() {
+ return command.canExecute();
+ }
+
+ @Override
+ protected void doExecute() {
+ command.execute();
+ }
+
+ @Override
+ public boolean canUndo() {
+ return command.canUndo();
+ }
+
+ @Override
+ protected void doUndo() {
+ command.undo();
+ }
+
+ @Override
+ protected void doRedo() {
+ command.redo();
+ }
+
+ @Override
+ public Collection<?> getAffectedObjects() {
+ return command.getAffectedObjects();
+ }
+
+ @Override
+ public Collection<?> getResult() {
+ return command.getResult();
+ }
+
+ @Override
+ public String toString() {
+ return String.format("Unsafe(%s)", command.toString()); //$NON-NLS-1$
+ }
+ }
+
+ private static class CommandRunnable implements Runnable {
+
+ private final Command command;
+
+ CommandRunnable(Command command) {
+ this.command = command;
+ }
+
+ @Override
+ public void run() {
+ command.execute();
+ }
+ }
+
+ private static class GMFCommandRunnable implements Runnable {
+
+ private final ICommand command;
+
+ GMFCommandRunnable(ICommand command) {
+ this.command = command;
+ }
+
+ @Override
+ public void run() {
+ try {
+ command.execute(new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ throw new WrappedException(e);
+ }
+ }
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java
index 47caae7f46c..5520af4ff41 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,10 +8,14 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.datatype.GradientData;
/**
@@ -125,4 +129,16 @@ public class ObservableGradientData extends GradientData {
notifySource();
}
+ public EObject getOwner() {
+ EObject result = null;
+
+ if(source instanceof IObserving) {
+ Object owner = ((IObserving)source).getObserved();
+ if(owner instanceof EObject) {
+ result = (EObject)owner;
+ }
+ }
+
+ return result;
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java
index 2956c311344..7afe625c3ff 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
@@ -94,7 +96,7 @@ public class CustomStyleModelElement extends EMFModelElement {
}
@Override
- public boolean isEditable(String propertyPath) {
+ protected boolean isFeatureEditable(String propertyPath) {
return findProperty(propertyPath) != null;
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/DecoratedModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/DecoratedModelElement.java
index 5e3ed3f7cb9..4792204ad56 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/DecoratedModelElement.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/DecoratedModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
*
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
@@ -21,6 +22,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomBooleanStyleObservableValue;
import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomIntStyleObservableValue;
import org.eclipse.papyrus.infra.gmfdiag.common.providers.ShapeDecorator;
@@ -114,12 +116,8 @@ public class DecoratedModelElement extends AbstractModelElement {
*/
@Override
public boolean isEditable(String propertyPath) {
- if(ShapeDecorator.SHAPE_DECORATOR_DIRECTION.equals(propertyPath)) {
- return true;
- }
-
- if(ShapeDecorator.SHAPE_DECORATOR_VISIBILITY.equals(propertyPath)) {
- return true;
+ if(ShapeDecorator.SHAPE_DECORATOR_DIRECTION.equals(propertyPath) || ShapeDecorator.SHAPE_DECORATOR_VISIBILITY.equals(propertyPath)) {
+ return !EMFHelper.isReadOnly(source);
}
return super.isEditable(propertyPath);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GradientDataModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GradientDataModelElement.java
index c68abb5158f..07951aaf382 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GradientDataModelElement.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/GradientDataModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,13 +8,17 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.datatype.GradientData;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.GradientDataObservableValue;
import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.GradientDataObservableValue.GradientProperty;
@@ -31,20 +35,40 @@ import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement;
*/
public class GradientDataModelElement extends AbstractModelElement {
+ private static final String PROPERTY_PATH = "gradientStyle"; //$NON-NLS-1$
+
/**
* The source GradientData
*/
protected GradientData sourceElement;
/**
+ * The notation style element that owns the {@link GradientData}.
+ */
+ protected EObject owner;
+
+ /**
+ * Constructor.
+ *
+ * @param sourceElement
+ * the source GradientData
+ * @param owner
+ * the owner of the gradient data (may be {@code null})
+ */
+ public GradientDataModelElement(GradientData sourceElement, EObject owner) {
+ this.sourceElement = sourceElement;
+ this.owner = owner;
+ }
+
+ /**
*
* Constructor.
*
* @param sourceElement
- * the soruce GradientData
+ * the source GradientData
*/
public GradientDataModelElement(GradientData sourceElement) {
- this.sourceElement = sourceElement;
+ this(sourceElement, null);
}
@Override
@@ -58,8 +82,14 @@ public class GradientDataModelElement extends AbstractModelElement {
}
@Override
+ public boolean isEditable(String propertyPath) {
+ // Let owner be null for compatibility with plain GradientData objects that we don't know their owners
+ return (owner == null) || !EMFHelper.isReadOnly(owner);
+ }
+
+ @Override
public IStaticContentProvider getContentProvider(String propertyPath) {
- if(propertyPath.equals("gradientStyle")) { //$NON-NLS-1$
+ if(propertyPath.equals(PROPERTY_PATH)) {
return new AbstractStaticContentProvider() {
public Object[] getElements() {
@@ -74,7 +104,7 @@ public class GradientDataModelElement extends AbstractModelElement {
@Override
public ILabelProvider getLabelProvider(String propertyPath) {
- if(propertyPath.equals("gradientStyle")) { //$NON-NLS-1$
+ if(propertyPath.equals(PROPERTY_PATH)) {
return new LabelProvider() {
@Override
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java
index 5bcd44621e2..6a0889ccf7d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/NotationModelElementFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
@@ -17,6 +19,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.GradientData;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.ObservableGradientData;
import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
@@ -30,7 +33,10 @@ public class NotationModelElementFactory implements ModelElementFactory {
public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
- if(sourceElement instanceof GradientData) {
+ if (sourceElement instanceof ObservableGradientData) {
+ ObservableGradientData gradientData = (ObservableGradientData)sourceElement;
+ return new GradientDataModelElement(gradientData, gradientData.getOwner());
+ } else if(sourceElement instanceof GradientData) {
return new GradientDataModelElement((GradientData)sourceElement);
}
View view = NotationHelper.findView(sourceElement);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/PopupEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/PopupEditorConfiguration.java
index 6a43b0a2d8b..3cff16ceb76 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/PopupEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/PopupEditorConfiguration.java
@@ -33,7 +33,10 @@ import com.google.inject.Injector;
* This class is provided as a basis for contribution to the extension point directEditors of Papyrus,
* for the case of popup editors.
* Clients must simply override the method createPopupEditorHelper(Object editPart)
+ *
+ * This class is deprecated, use DefaultDirectEditorConfiguration instead
*/
+@Deprecated
public abstract class PopupEditorConfiguration implements IPopupEditorConfiguration {
private String language = "";
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
index 40bf9058df3..65c431481cb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.properties.modelelement;
@@ -418,15 +419,12 @@ public class NatTableModelElement extends EMFModelElement {
}
/**
- *
- * @see org.eclipse.papyrus.views.properties.modelelement.EMFModelElement#isEditable(java.lang.String)
- *
* @param propertyPath
* @return
*/
@Override
- public boolean isEditable(String propertyPath) {
- boolean res = super.isEditable(propertyPath);
+ protected boolean isFeatureEditable(String propertyPath) {
+ boolean res = super.isFeatureEditable(propertyPath);
if(!res) {
//feature column label property
if(Constants.COLUMN_FEATURE_LABEL_CONFIGURATION_DISPLAY_ICON.equals(propertyPath)) {
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TransactionalCommandHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TransactionalCommandHandler.java
new file mode 100644
index 00000000000..539f4eb8662
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TransactionalCommandHandler.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.nebula.widgets.nattable.command.ILayerCommand;
+import org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler;
+import org.eclipse.nebula.widgets.nattable.command.VisualRefreshCommand;
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * A base layer command handler that executes commands on a {@link TransactionalEditingDomain}'s command-stack.
+ * This ensures atomic undo/redo of all model changes performed by the command.
+ */
+public abstract class TransactionalCommandHandler<T extends ILayerCommand> implements ILayerCommandHandler<T> {
+
+ private final TransactionalEditingDomain domain;
+
+ private String label;
+
+ public TransactionalCommandHandler(TransactionalEditingDomain domain) {
+ this.domain = domain;
+ }
+
+ public TransactionalCommandHandler(TransactionalEditingDomain domain, String label) {
+ this.domain = domain;
+
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return (label != null) ? label : "Table Command";
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ @Override
+ public final boolean doCommand(final ILayer targetLayer, final T command) {
+ final boolean[] result = { false };
+
+ if(command.convertToTargetLayer(targetLayer)) {
+ domain.getCommandStack().execute(new RecordingCommand(domain, getLabel()) {
+
+ @Override
+ protected void doExecute() {
+ ExecutionStatusKind status = doCommand(command);
+
+ result[0] = status.isOK();
+
+ if(status.isRollback()) {
+ // Refresh the visual presentation of the layer because stereotype applications
+ // may have updated some cells
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ targetLayer.doCommand(new VisualRefreshCommand());
+ }
+ });
+
+ // Roll back any changes that we made along the way
+ throw new OperationCanceledException();
+ }
+ }
+ });
+ }
+
+ return result[0];
+ }
+
+ protected abstract ExecutionStatusKind doCommand(T command);
+
+ //
+ // Nested types
+ //
+
+ protected enum ExecutionStatusKind {
+ /** Command failed and should be rolled back so that it will not appear on the stack. */
+ FAIL_ROLLBACK(false, true),
+ /** Command succeeded and should appear on the stack. */
+ OK_COMPLETE(true, false),
+ /** Command succeeded but should be rolled back so that it will not appear on the stack. */
+ OK_ROLLBACK(true, true);
+
+ private final boolean ok;
+
+ private final boolean rollback;
+
+ private ExecutionStatusKind(boolean ok, boolean rollback) {
+ this.ok = ok;
+ this.rollback = rollback;
+ }
+
+ public boolean isOK() {
+ return ok;
+ }
+
+ public boolean isRollback() {
+ return rollback;
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TransactionalEditCellCommandHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TransactionalEditCellCommandHandler.java
new file mode 100644
index 00000000000..c32a105d93e
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/TransactionalEditCellCommandHandler.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ * Dirk Fauth <dirk.fauth@gmail.com> - Initial API and implementation of EditController class
+ *
+ */
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.window.Window;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.config.IEditableRule;
+import org.eclipse.nebula.widgets.nattable.edit.ActiveCellEditorRegistry;
+import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.edit.EditTypeEnum;
+import org.eclipse.nebula.widgets.nattable.edit.InlineEditHandler;
+import org.eclipse.nebula.widgets.nattable.edit.command.EditCellCommand;
+import org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.gui.CellEditDialogFactory;
+import org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog;
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * A variant of the {@link EditCellCommand} handler that executes changes on a {@link TransactionalEditingDomain}'s command-stack.
+ */
+public class TransactionalEditCellCommandHandler extends TransactionalCommandHandler<EditCellCommand> {
+
+ public TransactionalEditCellCommandHandler(TransactionalEditingDomain domain) {
+ this(domain, "Edit Table Cell");
+ }
+
+ public TransactionalEditCellCommandHandler(TransactionalEditingDomain domain, String label) {
+ super(domain, label);
+ }
+
+ @Override
+ public Class<EditCellCommand> getCommandClass() {
+ return EditCellCommand.class;
+ }
+
+ protected ExecutionStatusKind doCommand(EditCellCommand command) {
+ ILayerCell cell = command.getCell();
+ Composite parent = command.getParent();
+ IConfigRegistry configRegistry = command.getConfigRegistry();
+
+ IEditableRule rule = (IEditableRule)configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, DisplayMode.EDIT, cell.getConfigLabels().getLabels());
+
+ if(rule.isEditable(cell, configRegistry)) {
+ return editCell(cell, parent, cell.getDataValue(), configRegistry);
+ }
+
+ return ExecutionStatusKind.FAIL_ROLLBACK;
+ }
+
+ // From Nebula EditController (with minor tweaks)
+ protected ExecutionStatusKind editCell(ILayerCell cell, Composite parent, Object initialCanonicalValue, IConfigRegistry configRegistry) {
+ ExecutionStatusKind result = ExecutionStatusKind.FAIL_ROLLBACK;
+
+ try {
+ Rectangle cellBounds = cell.getBounds();
+ ILayer layer = cell.getLayer();
+
+ int columnPosition = cell.getColumnPosition();
+ int rowPosition = cell.getRowPosition();
+
+ List<String> configLabels = cell.getConfigLabels().getLabels();
+
+ ICellEditor cellEditor = (ICellEditor)configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, configLabels);
+
+ // Try to open an in-line editor before falling back to a dialog
+ if(cellEditor.openInline(configRegistry, configLabels)) {
+ MyInlineEditHandler editHandler = new MyInlineEditHandler(layer, columnPosition, rowPosition);
+
+ Rectangle editorBounds = layer.getLayerPainter().adjustCellBounds(columnPosition, rowPosition, new Rectangle(cellBounds.x, cellBounds.y, cellBounds.width, cellBounds.height));
+
+ cellEditor.activateCell(parent, initialCanonicalValue, EditModeEnum.INLINE, editHandler, cell, configRegistry);
+
+ Control editorControl = cellEditor.getEditorControl();
+ if((editorControl != null) && (!(editorControl.isDisposed()))) {
+ editorControl.setBounds(editorBounds);
+
+ cellEditor.addEditorControlListeners();
+ ActiveCellEditorRegistry.registerActiveCellEditor(cellEditor);
+ }
+
+ // Command succeeded but should not appear on the undo stack because we haven't completed an edit (only activated the cell editor),
+ // unless the cell editor is like the CheckBoxCellEditor that commits upon activation
+ result = editHandler.isCommitted() ? ExecutionStatusKind.OK_COMPLETE : ExecutionStatusKind.OK_ROLLBACK;
+ } else {
+ // The dialog case
+ List<ILayerCell> cells = new ArrayList<ILayerCell>(1);
+ cells.add(cell);
+ result = editCells(cells, parent, initialCanonicalValue, configRegistry);
+ }
+ } catch (OperationCanceledException e) {
+ // OK. The user cancelled a dialog or some such
+ result = ExecutionStatusKind.FAIL_ROLLBACK;
+ } catch (Exception e) {
+ Activator.log.error("Uncaught exception in table cell editor activation.", e); //$NON-NLS-1$
+ }
+
+ return result;
+ }
+
+ // From Nebula EditController (with minor tweaks)
+ protected ExecutionStatusKind editCells(List<ILayerCell> cells, Composite parent, Object initialCanonicalValue, IConfigRegistry configRegistry) {
+ if((cells == null) || (cells.isEmpty())) {
+ return ExecutionStatusKind.FAIL_ROLLBACK;
+ }
+
+ ICellEditor cellEditor = (ICellEditor)configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, ((ILayerCell)cells.get(0)).getConfigLabels().getLabels());
+
+ if((cells.size() != 1) && ((cells.size() <= 1) || !(supportMultiEdit(cells, cellEditor, configRegistry)))) {
+ return ExecutionStatusKind.FAIL_ROLLBACK;
+ }
+
+ ExecutionStatusKind result = ExecutionStatusKind.FAIL_ROLLBACK;
+
+ ICellEditDialog dialog = CellEditDialogFactory.createCellEditDialog((parent != null) ? parent.getShell() : null, initialCanonicalValue, (ILayerCell)cells.get(0), cellEditor, configRegistry);
+
+ int returnValue = dialog.open();
+
+ if(returnValue == Window.OK) {
+ // The edit was completed and should appear on the undo stack
+ result = ExecutionStatusKind.OK_COMPLETE;
+
+ for(ILayerCell selectedCell : cells) {
+ Object editorValue = dialog.getCommittedValue();
+ if(dialog.getEditType() != EditTypeEnum.SET) {
+ editorValue = dialog.calculateValue(selectedCell.getDataValue(), editorValue);
+ }
+ ILayer layer = selectedCell.getLayer();
+
+ layer.doCommand(new UpdateDataCommand(layer, selectedCell.getColumnPosition(), selectedCell.getRowPosition(), editorValue));
+ }
+ }
+
+ return result;
+ }
+
+ // From Nebula EditController (with minor tweaks)
+ private static boolean supportMultiEdit(List<ILayerCell> cells, ICellEditor cellEditor, IConfigRegistry configRegistry) {
+ for(ILayerCell cell : cells) {
+ if(!(cellEditor.supportMultiEdit(configRegistry, cell.getConfigLabels().getLabels()))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ //
+ // Nested types
+ //
+
+ private static class MyInlineEditHandler extends InlineEditHandler {
+
+ private boolean committed;
+
+ MyInlineEditHandler(ILayer layer, int columnPosition, int rowPosition) {
+ super(layer, columnPosition, rowPosition);
+ }
+
+ @Override
+ public boolean commit(Object canonicalValue, MoveDirectionEnum direction) {
+ boolean result = super.commit(canonicalValue, direction);
+
+ committed = result || committed;
+
+ return result;
+ }
+
+ boolean isCommitted() {
+ return committed;
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java
index f0dc17d9864..0194de0f87e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusGridLayer.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,13 +9,18 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.layer;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler;
+import org.eclipse.nebula.widgets.nattable.edit.command.EditCellCommand;
import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.papyrus.infra.nattable.configuration.PapyrusGridLayerConfiguration;
+import org.eclipse.papyrus.infra.nattable.handler.TransactionalEditCellCommandHandler;
/**
* This grid layer ovverride the default edition behavior
@@ -25,6 +30,8 @@ import org.eclipse.papyrus.infra.nattable.configuration.PapyrusGridLayerConfigur
*/
public class PapyrusGridLayer extends GridLayer {
+ private final TransactionalEditingDomain domain;
+
/**
*
* Constructor.
@@ -34,8 +41,10 @@ public class PapyrusGridLayer extends GridLayer {
* @param rowHeaderLayer
* @param cornerLayer
*/
- public PapyrusGridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer) {
+ public PapyrusGridLayer(TransactionalEditingDomain domain, ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer) {
super(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
+
+ this.domain = domain;
}
/**
@@ -48,8 +57,10 @@ public class PapyrusGridLayer extends GridLayer {
* @param cornerLayer
* @param useDefaultConfiguration
*/
- public PapyrusGridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer, boolean useDefaultConfiguration) {
+ public PapyrusGridLayer(TransactionalEditingDomain domain, ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer, boolean useDefaultConfiguration) {
super(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer, useDefaultConfiguration);
+
+ this.domain = domain;
}
/**
@@ -58,8 +69,10 @@ public class PapyrusGridLayer extends GridLayer {
*
* @param useDefaultConfiguration
*/
- public PapyrusGridLayer(boolean useDefaultConfiguration) {
+ public PapyrusGridLayer(TransactionalEditingDomain domain, boolean useDefaultConfiguration) {
super(useDefaultConfiguration);
+
+ this.domain = domain;
}
@Override
@@ -71,7 +84,14 @@ public class PapyrusGridLayer extends GridLayer {
}
}
+ @Override
+ public void registerCommandHandler(ILayerCommandHandler<?> commandHandler) {
+ // Override the default edit handler
+ if(commandHandler.getCommandClass() == EditCellCommand.class) {
+ commandHandler = new TransactionalEditCellCommandHandler(domain);
+ }
-
+ super.registerCommandHandler(commandHandler);
+ }
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
index b4bf438bb2b..8cde6c07269 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -17,6 +18,7 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
@@ -182,7 +184,7 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
final IDataProvider cornerDataProvider = new DefaultCornerDataProvider(this.columnHeaderDataProvider, this.rowHeaderDataProvider);
final CornerLayer cornerLayer = new CornerLayer(new DataLayer(cornerDataProvider), this.rowHeaderLayerStack, this.columnHeaderLayerStack);
cornerLayer.addConfiguration(new CornerConfiguration(this));
- this.gridLayer = new PapyrusGridLayer(this.bodyLayerStack, this.columnHeaderLayerStack, this.rowHeaderLayerStack, cornerLayer);
+ this.gridLayer = new PapyrusGridLayer(TransactionUtil.getEditingDomain(tableContext), this.bodyLayerStack, this.columnHeaderLayerStack, this.rowHeaderLayerStack, cornerLayer);
this.gridLayer.addConfiguration(new DefaultPrintBindings());
this.natTable = new NatTable(parent, this.gridLayer, false);
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java
index 449d7ffeb47..e3c566b7d81 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomCheckBoxPainter.java
@@ -30,6 +30,11 @@ import org.eclipse.swt.graphics.Rectangle;
public class CustomCheckBoxPainter extends CheckBoxPainter {
/**
+ * the text painter used to paint N/A
+ */
+ private TextPainter textPainter = new CustomizedCellPainter();
+
+ /**
*
* @see org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter#getCellPainterAt(int, int,
* org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
@@ -48,8 +53,7 @@ public class CustomCheckBoxPainter extends CheckBoxPainter {
try {
isChecked(cell, configRegistry);
} catch (Exception e) {
- TextPainter painter = new CustomizedCellPainter();
- return painter.getCellPainterAt(x, y, cell, gc, bounds, configRegistry);
+ return this;
}
return super.getCellPainterAt(x, y, cell, gc, bounds, configRegistry);
}
@@ -69,8 +73,7 @@ public class CustomCheckBoxPainter extends CheckBoxPainter {
try {
isChecked(cell, configRegistry);
} catch (Exception e) {
- TextPainter painter = new CustomizedCellPainter();
- painter.paintCell(cell, gc, bounds, configRegistry);
+ this.textPainter.paintCell(cell, gc, bounds, configRegistry);
return;
}
super.paintCell(cell, gc, bounds, configRegistry);
@@ -91,8 +94,7 @@ public class CustomCheckBoxPainter extends CheckBoxPainter {
try {
isChecked(cell, configRegistry);
} catch (Exception e) {
- TextPainter painter = new CustomizedCellPainter();
- return painter.getPreferredWidth(cell, gc, configRegistry);
+ return textPainter.getPreferredWidth(cell, gc, configRegistry);
}
return super.getPreferredWidth(cell, gc, configRegistry);
}
@@ -112,8 +114,7 @@ public class CustomCheckBoxPainter extends CheckBoxPainter {
try {
isChecked(cell, configRegistry);
} catch (Exception e) {
- TextPainter painter = new CustomizedCellPainter();
- return painter.getPreferredHeight(cell, gc, configRegistry);
+ return textPainter.getPreferredHeight(cell, gc, configRegistry);
}
return super.getPreferredHeight(cell, gc, configRegistry);
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
index 7ccf3b66884..c9b0c3d4d30 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.decoration/src/org/eclipse/papyrus/infra/services/decoration/util/Decoration.java
@@ -286,7 +286,7 @@ public class Decoration implements IPapyrusDecoration {
}
}
}
- if (message.length() > 0) {
+ if ((message != null) && message.length() > 0) {
return message;
}
else {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/plugin.xml b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/plugin.xml
index 8b67866e84a..3c5b99602e9 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/plugin.xml
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2010, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
@@ -40,7 +53,9 @@
<!-- ElementType that deals with View deletion when their related model element is deleted -->
<elementType ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
<elementType ref="org.eclipse.gmf.runtime.diagram.core.advice.removeBookmarks"/>
-
+
+ <!-- Check for attempts to edit read-only objects that cannot reasonably be made writeable. -->
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice" />
</binding>
</extension>
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/internal/ElementEditServiceProvider.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/internal/ElementEditServiceProvider.java
index c6098144371..be57c143bd2 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/internal/ElementEditServiceProvider.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/internal/ElementEditServiceProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2013 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - support read-only objects (CDO)
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.infra.services.edit.internal;
@@ -21,6 +22,7 @@ import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
@@ -120,7 +122,8 @@ public class ElementEditServiceProvider implements IElementEditServiceProvider {
}
private boolean isReadOnly(EObject object) {
- return EMFHelper.isReadOnly(object);
+ EditingDomain domain = EMFHelper.resolveEditingDomain(object);
+ return EMFHelper.isReadOnly(object, domain) && !EMFHelper.canMakeWritable(object, domain);
}
/**
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/MarkersMonitorService.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/MarkersMonitorService.java
index cfdb91c8c0f..75baa651f37 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/MarkersMonitorService.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/MarkersMonitorService.java
@@ -1,23 +1,24 @@
/*****************************************************************************
* Copyright (c) 2011, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.Elkouhen@cea.fr
+ * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.Elkouhen@cea.fr
* Arnaud Cuccuru (CEA LIST) - arnaud.cuccuru@cea.fr
* Christian W. Damus (CEA) - refactor for non-workspace abstraction of problem markers (CDO)
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.services.markerlistener;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -34,6 +35,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.services.markerlistener.providers.IMarkerMonitor;
+import org.eclipse.papyrus.infra.services.markerlistener.providers.IMarkerProvider;
import org.eclipse.papyrus.infra.services.markerlistener.providers.MarkerMonitorRegistry;
import org.eclipse.papyrus.infra.services.markerlistener.util.MarkerListenerUtils;
@@ -57,7 +59,7 @@ public class MarkersMonitorService implements IService {
/**
* Gets the services registry.
- *
+ *
* @return the services registry
*/
public ServicesRegistry getServicesRegistry() {
@@ -67,7 +69,7 @@ public class MarkersMonitorService implements IService {
/**
* Sets the services registry.
- *
+ *
* @param servicesRegistry
* the new services registry
*/
@@ -84,7 +86,7 @@ public class MarkersMonitorService implements IService {
/**
* @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry)
- *
+ *
* @param servicesRegistry
* @throws ServiceException
*/
@@ -118,7 +120,7 @@ public class MarkersMonitorService implements IService {
/**
* @see org.eclipse.papyrus.infra.core.services.IService#startService()
- *
+ *
* @throws ServiceException
*/
public void startService() throws ServiceException {
@@ -136,7 +138,7 @@ public class MarkersMonitorService implements IService {
/**
* @see org.eclipse.papyrus.infra.core.services.IService#disposeService()
- *
+ *
* @throws ServiceException
*/
public void disposeService() throws ServiceException {
@@ -182,8 +184,11 @@ public class MarkersMonitorService implements IService {
}
public Collection<? extends IPapyrusMarker> getMarkers(Resource resource, String type, boolean includeSubtypes) throws CoreException {
-
- return MarkerListenerUtils.getMarkerProvider(resource).getMarkers(resource, type, includeSubtypes);
+ List<IPapyrusMarker> result = new LinkedList<IPapyrusMarker>();
+ for(IMarkerProvider provider : MarkerListenerUtils.getMarkerProviders(resource)) {
+ result.addAll(provider.getMarkers(resource, type, includeSubtypes));
+ }
+ return result;
}
private IMarkerEventListener createRelayListener() {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/providers/MarkerProviderRegistry.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/providers/MarkerProviderRegistry.java
index e17ed9dcc20..314c1059b9f 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/providers/MarkerProviderRegistry.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/providers/MarkerProviderRegistry.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@ import static org.eclipse.papyrus.infra.services.markerlistener.util.MarkerListe
import java.util.Collection;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
@@ -59,17 +60,16 @@ public class MarkerProviderRegistry {
* delegation.
*/
private void prune() {
- if (needPrune) {
+ if(needPrune) {
needPrune = false;
- for (ListIterator<IMarkerProvider> iter = providers.listIterator(); iter
- .hasNext();) {
+ for(ListIterator<IMarkerProvider> iter = providers.listIterator(); iter.hasNext();) {
IMarkerProvider next = iter.next();
- if (next == IMarkerProvider.NULL) {
+ if(next == IMarkerProvider.NULL) {
iter.remove();
- } else if (next instanceof MyRegistryReader.Descriptor) {
- MyRegistryReader.Descriptor desc = (MyRegistryReader.Descriptor) next;
- if (desc.instance != null) {
+ } else if(next instanceof MyRegistryReader.Descriptor) {
+ MyRegistryReader.Descriptor desc = (MyRegistryReader.Descriptor)next;
+ if(desc.instance != null) {
iter.set(desc.instance);
}
}
@@ -77,14 +77,22 @@ public class MarkerProviderRegistry {
}
}
+ /**
+ * @param resource
+ * @return
+ *
+ * @deprecated
+ * MarkerProviders should not be exclusive. Use #getMarkerProviders(Resource) instead
+ */
+ @Deprecated
public IMarkerProvider getMarkerProvider(Resource resource) {
IMarkerProvider result = IMarkerProvider.NULL;
- synchronized (providers) {
+ synchronized(providers) {
prune();
- for (IMarkerProvider next : providers) {
- if (next.canProvideMarkersFor(resource)) {
+ for(IMarkerProvider next : providers) {
+ if(next.canProvideMarkersFor(resource)) {
result = next;
break;
}
@@ -94,19 +102,34 @@ public class MarkerProviderRegistry {
return result;
}
+ public List<IMarkerProvider> getMarkerProviders(Resource resource) {
+ List<IMarkerProvider> result = new LinkedList<IMarkerProvider>();
+
+ synchronized(providers) {
+ prune();
+
+ for(IMarkerProvider next : providers) {
+ if(next.canProvideMarkersFor(resource)) {
+ result.add(next);
+ }
+ }
+ }
+
+ return result;
+ }
+
private void removeProvider(String className) {
- synchronized (providers) {
- for (Iterator<IMarkerProvider> iter = providers.iterator(); iter
- .hasNext();) {
+ synchronized(providers) {
+ for(Iterator<IMarkerProvider> iter = providers.iterator(); iter.hasNext();) {
IMarkerProvider next = iter.next();
- if (next instanceof MyRegistryReader.Descriptor) {
- MyRegistryReader.Descriptor desc = (MyRegistryReader.Descriptor) next;
- if (className.equals(desc.getClassName())) {
+ if(next instanceof MyRegistryReader.Descriptor) {
+ MyRegistryReader.Descriptor desc = (MyRegistryReader.Descriptor)next;
+ if(className.equals(desc.getClassName())) {
iter.remove();
break;
}
- } else if (className.equals(next.getClass().getName())) {
+ } else if(className.equals(next.getClass().getName())) {
iter.remove();
break;
}
@@ -118,8 +141,7 @@ public class MarkerProviderRegistry {
// Nested types
//
- private class MyRegistryReader
- extends RegistryReader {
+ private class MyRegistryReader extends RegistryReader {
private static final String E_ENABLEMENT = "enablement";
@@ -132,24 +154,21 @@ public class MarkerProviderRegistry {
private boolean inEnablement;
MyRegistryReader() {
- super(Platform.getExtensionRegistry(), Activator.PLUGIN_ID,
- EXT_POINT);
+ super(Platform.getExtensionRegistry(), Activator.PLUGIN_ID, EXT_POINT);
}
@Override
protected boolean readElement(IConfigurationElement element, boolean add) {
- return add
- ? handleAdd(element)
- : handleRemove(element);
+ return add ? handleAdd(element) : handleRemove(element);
}
private boolean handleAdd(IConfigurationElement element) {
boolean result = false;
- if (E_PROVIDER.equals(element.getName())) {
+ if(E_PROVIDER.equals(element.getName())) {
inEnablement = false;
- if (element.getAttribute(A_CLASS) == null) {
+ if(element.getAttribute(A_CLASS) == null) {
logMissingAttribute(element, A_CLASS);
} else {
currentDescriptor = new Descriptor(element, A_CLASS);
@@ -157,13 +176,11 @@ public class MarkerProviderRegistry {
}
result = true;
- } else if (E_ENABLEMENT.equals(element.getName())) {
- if (currentDescriptor != null) {
+ } else if(E_ENABLEMENT.equals(element.getName())) {
+ if(currentDescriptor != null) {
inEnablement = true;
try {
- currentDescriptor
- .setMatchResourceExpression(ExpressionConverter
- .getDefault().perform(element));
+ currentDescriptor.setMatchResourceExpression(ExpressionConverter.getDefault().perform(element));
result = true;
} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
@@ -179,9 +196,9 @@ public class MarkerProviderRegistry {
private boolean handleRemove(IConfigurationElement element) {
boolean result = true;
- if (E_PROVIDER.equals(element.getName())) {
+ if(E_PROVIDER.equals(element.getName())) {
String className = element.getAttribute(A_CLASS);
- if (className == null) {
+ if(className == null) {
logMissingAttribute(element, A_CLASS);
result = false;
} else {
@@ -192,9 +209,7 @@ public class MarkerProviderRegistry {
return result;
}
- private class Descriptor
- extends PluginClassDescriptor
- implements IMarkerProvider {
+ private class Descriptor extends PluginClassDescriptor implements IMarkerProvider {
private Expression matchResource;
@@ -213,13 +228,11 @@ public class MarkerProviderRegistry {
}
IMarkerProvider getInstance() {
- if (instance == null) {
+ if(instance == null) {
try {
- instance = (IMarkerProvider) createInstance();
+ instance = (IMarkerProvider)createInstance();
} catch (Exception e) {
- Activator.log.error(
- "Failed to instantiate marker provider extension.",
- e);
+ Activator.log.error("Failed to instantiate marker provider extension.", e);
instance = IMarkerProvider.NULL;
}
@@ -230,17 +243,14 @@ public class MarkerProviderRegistry {
}
public boolean canProvideMarkersFor(Resource resource) {
- return (instance == null)
- ? evaluateEnablement(resource)
- : instance.canProvideMarkersFor(resource);
+ return (instance == null) ? evaluateEnablement(resource) : instance.canProvideMarkersFor(resource);
}
private boolean evaluateEnablement(Resource resource) {
boolean result;
- if (matchResource != null) {
- IEvaluationContext ctx = new EvaluationContext(null,
- resource);
+ if(matchResource != null) {
+ IEvaluationContext ctx = new EvaluationContext(null, resource);
ctx.addVariable("isFile", getFile(resource) != null);
@@ -259,46 +269,34 @@ public class MarkerProviderRegistry {
return result;
}
- public Collection<? extends IPapyrusMarker> getMarkers(
- Resource resource, String type, boolean includeSubtypes)
- throws CoreException {
+ public Collection<? extends IPapyrusMarker> getMarkers(Resource resource, String type, boolean includeSubtypes) throws CoreException {
- return getInstance()
- .getMarkers(resource, type, includeSubtypes);
+ return getInstance().getMarkers(resource, type, includeSubtypes);
}
- public void createMarkers(Resource resource, Diagnostic diagnostic,
- IProgressMonitor monitor)
- throws CoreException {
+ public void createMarkers(Resource resource, Diagnostic diagnostic, IProgressMonitor monitor) throws CoreException {
getInstance().createMarkers(resource, diagnostic, monitor);
}
@Deprecated
- public void deleteMarkers(EObject object, IProgressMonitor monitor)
- throws CoreException {
+ public void deleteMarkers(EObject object, IProgressMonitor monitor) throws CoreException {
getInstance().deleteMarkers(object, monitor);
}
@Deprecated
- public void deleteMarkers(Resource resource,
- IProgressMonitor monitor)
- throws CoreException {
+ public void deleteMarkers(Resource resource, IProgressMonitor monitor) throws CoreException {
getInstance().deleteMarkers(resource, monitor);
}
- public void deleteMarkers(EObject object, IProgressMonitor monitor,
- String markerType, boolean includeSubtypes)
- throws CoreException {
+ public void deleteMarkers(EObject object, IProgressMonitor monitor, String markerType, boolean includeSubtypes) throws CoreException {
getInstance().deleteMarkers(object, monitor, markerType, includeSubtypes);
-
+
}
- public void deleteMarkers(Resource resource,
- IProgressMonitor monitor, String markerType,
- boolean includeSubtypes) throws CoreException {
+ public void deleteMarkers(Resource resource, IProgressMonitor monitor, String markerType, boolean includeSubtypes) throws CoreException {
getInstance().deleteMarkers(resource, monitor, markerType, includeSubtypes);
}
}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/util/MarkerListenerUtils.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/util/MarkerListenerUtils.java
index 01be0c76b9e..969b173f4d6 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/util/MarkerListenerUtils.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.markerlistener/src/org/eclipse/papyrus/infra/services/markerlistener/util/MarkerListenerUtils.java
@@ -1,22 +1,23 @@
/*****************************************************************************
* Copyright (c) 2011, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.Elkouhen@cea.fr
+ * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.Elkouhen@cea.fr
* Christian W. Damus (CEA) - refactor for non-workspace abstraction of problem markers (CDO)
* Christian W. Damus (CEA) - support marker type hierarchy in CDO problem markers (CDO)
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.services.markerlistener.util;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Set;
@@ -121,10 +122,21 @@ public class MarkerListenerUtils {
return null;
}
+ /**
+ * @param resource
+ * @return
+ * @deprecated
+ * MarkerProviders should not be exclusive. Use #getMarkerProviders(Resource) instead
+ */
+ @Deprecated
public static IMarkerProvider getMarkerProvider(Resource resource) {
return MarkerProviderRegistry.INSTANCE.getMarkerProvider(resource);
}
+ public static List<IMarkerProvider> getMarkerProviders(Resource resource) {
+ return MarkerProviderRegistry.INSTANCE.getMarkerProviders(resource);
+ }
+
public static IFile getFile(Resource resource) {
URI uri = resource.getURI();
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java
index 16ea2cb5d20..c99e64275fc 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/strategies/AskUserStrategy.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 ATOS ORIGIN, 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
@@ -10,7 +10,7 @@
* Tristan Faure (ATOS ORIGIN INTEGRATION) tristan.faure@atosorigin.com - Initial API and implementation
* Christian W. Damus (CEA) - manage models by URI, not IFile (CDO)
* Christian W. Damus (CEA LIST) - support control mode in CDO resources
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.services.resourceloading.strategies;
@@ -26,7 +26,7 @@ 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.util.EcoreUtil;
-import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -53,9 +53,9 @@ import org.eclipse.ui.PlatformUI;
/**
* The strategy which ask user if the resource has to be loaded or not
- *
+ *
* @author tfaure
- *
+ *
*/
public class AskUserStrategy implements ILoadingStrategy {
@@ -97,7 +97,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* @see org.eclipse.papyrus.infra.services.resourceloading.ILoadingStrategy#loadResource(org.eclipse.papyrus.infra.core.resource.ModelSet,
* org.eclipse.emf.common.util.URI)
- *
+ *
* @param modelSet
* @param uri
* @return
@@ -106,7 +106,7 @@ public class AskUserStrategy implements ILoadingStrategy {
// pathmap resource are always loaded
boolean result = !modelSet.isUserModelResource(uri);
URI initialURI = modelSet.getURIWithoutExtension();
- // if no listener is registered, a listener is added on the editor to remove the notifications
+ // if no listener is registered, a listener is added on the editor to remove the notifications
// when the editor is closed the listener removes too the choices made by the user.
addClosingEditorListener(initialURI);
@@ -135,7 +135,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Create the ask notification to the user
- *
+ *
* @param modelSet
* @param initialURI
* @param trimFragment
@@ -153,7 +153,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Add a listener closing the uri parameter
- *
+ *
* @param initialURI
*/
private void addClosingEditorListener(URI initialURI) {
@@ -167,7 +167,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Remember that an uri has already be asked
- *
+ *
* @param initialURI
* , the uri opened by the editor
* @param guessed
@@ -183,7 +183,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Check if the uri is already asked
- *
+ *
* @param initialURI
* , the uri opened by the editor
* @param toLoad
@@ -201,7 +201,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* The extensions are saved to load all the specified resource if the user
* wants to load a set of resources
- *
+ *
* @param uri
* , the file to load
* @param trimFragment
@@ -222,20 +222,20 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Get the current editor
- *
+ *
* @return
*/
- protected CoreMultiDiagramEditor getCurrentEditor() {
+ protected IMultiDiagramEditor getCurrentEditor() {
IEditorPart editor = getEditor();
- if(editor instanceof CoreMultiDiagramEditor) {
- return (CoreMultiDiagramEditor)editor;
+ if(editor instanceof IMultiDiagramEditor) {
+ return (IMultiDiagramEditor)editor;
}
return null;
}
/**
* Create the notification with Yes/No/Yes For All/No For All option
- *
+ *
* @param message
* , the message to display
* @param uri
@@ -256,7 +256,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* NO for all registers the NoForAll URI and do nothing
- *
+ *
* @param uri
* @param modelSet
* @param initialURI
@@ -295,7 +295,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Yes for All registers Yes For All URI and refresh the tabs to take in account the loaded elements
- *
+ *
* @param uri
* @param modelSet
* @param initialURI
@@ -315,7 +315,7 @@ public class AskUserStrategy implements ILoadingStrategy {
return new RefreshRunnable(modelSet, uri, initialURI, true, true) {
@Override
- public void run(CoreMultiDiagramEditor editor) {
+ public void run(IMultiDiagramEditor editor) {
List<INotification> list = notifications.get(getInitialURI());
if(list != null) {
for(INotification n : notifications.get(getInitialURI())) {
@@ -355,7 +355,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* No runnable does not accept the URI asked
- *
+ *
* @param uri
* @param modelSet
* @param initialURI
@@ -379,7 +379,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Yes registers the URI and refresh the tab to take in account the loaded elements
- *
+ *
* @param uri
* @param modelSet
* @param initialURI
@@ -391,7 +391,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Register the notification created to the URI open by the editor
- *
+ *
* @param initialURI
* @param notification
*/
@@ -434,9 +434,9 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* A basic runnable managing the load of a resource and a refresh of the tabs
* If the editor is not opened or activated some listeners will be triggered to launch the refresh
- *
+ *
* @author tfaure
- *
+ *
*/
private class LoadAndRefreshRunnable implements NotificationRunnable {
@@ -516,7 +516,7 @@ public class AskUserStrategy implements ILoadingStrategy {
protected void manageRefresh(IEditorReference ref, IEditorPart part) {
addAuthorized(initialURI, uri);
if(part != null) {
- getRunnable().run((CoreMultiDiagramEditor)part);
+ getRunnable().run((IMultiDiagramEditor)part);
} else {
addPageListener(new EditorActivateListener(ref, modelSet, uri, initialURI, getRunnable()));
}
@@ -535,7 +535,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Add a page listener
- *
+ *
* @param listener
* @return
*/
@@ -550,7 +550,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Register a listener of the perspective to know when the editor is finally closed
- *
+ *
* @param listener
* @return
*/
@@ -564,7 +564,7 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Unregister a perspective listener
- *
+ *
* @param listener
* @return
*/
@@ -592,20 +592,20 @@ public class AskUserStrategy implements ILoadingStrategy {
protected static URI getURI(final IEditorInput input) {
URI result;
-
+
IFile file = (IFile)input.getAdapter(IFile.class);
if((file != null) && (file.getFullPath() != null)) {
result = URI.createPlatformResourceURI(file.getFullPath().removeFileExtension().toString(), true);
} else {
- result = (URI) input.getAdapter(URI.class);
+ result = (URI)input.getAdapter(URI.class);
}
return result;
}
-
+
/**
* Notification containing the {@link URI} loaded
- *
+ *
*/
public class EncapsulatedNotification implements INotification {
@@ -633,9 +633,9 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* An empty {@link IPartListener} implementation
- *
+ *
* @author tfaure
- *
+ *
*/
private class EditorAdapter implements IPartListener {
@@ -658,9 +658,9 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Listener which is notifid when an editor is activated
- *
+ *
* @author tfaure
- *
+ *
*/
private class EditorActivateListener extends EditorAdapter {
@@ -675,8 +675,8 @@ public class AskUserStrategy implements ILoadingStrategy {
@Override
public void partActivated(IWorkbenchPart part) {
- if(reference.getPart(false) == part && part instanceof CoreMultiDiagramEditor) {
- refreshRunnable.run((CoreMultiDiagramEditor)part);
+ if(reference.getPart(false) == part && part instanceof IMultiDiagramEditor) {
+ refreshRunnable.run((IMultiDiagramEditor)part);
removePageListener(this);
}
}
@@ -685,20 +685,20 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* Listener which is notifid when an editor is closed
- *
+ *
* @author tfaure
- *
+ *
*/
private class EditorCloseListener extends EditorAdapter {
@Override
public void partClosed(IWorkbenchPart part) {
super.partClosed(part);
- if(part instanceof CoreMultiDiagramEditor) {
- CoreMultiDiagramEditor editor = (CoreMultiDiagramEditor)part;
-
+ if(part instanceof IMultiDiagramEditor) {
+ IMultiDiagramEditor editor = (IMultiDiagramEditor)part;
+
URI uri = getURI(editor.getEditorInput());
- if (uri != null) {
+ if(uri != null) {
uri = uri.trimFileExtension();
addPerspectiveListener(new EditorClosePerspectiveListener(uri));
removePageListener(this);
@@ -711,9 +711,9 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* A perspective listener which choices of an user
- *
+ *
* @author tfaure
- *
+ *
*/
protected class EditorClosePerspectiveListener implements IPerspectiveListener {
@@ -744,9 +744,9 @@ public class AskUserStrategy implements ILoadingStrategy {
/**
* A runnable refreshing resource and/or pages
- *
+ *
* @author tfaure
- *
+ *
*/
public class RefreshRunnable {
@@ -770,7 +770,7 @@ public class AskUserStrategy implements ILoadingStrategy {
this.refreshTab = refreshTab;
}
- public void run(CoreMultiDiagramEditor editor) {
+ public void run(IMultiDiagramEditor editor) {
final Set<URI> alreadyLoaded = new HashSet<URI>();
try {
pageMngr = editor.getServicesRegistry().getService(IPageManager.class);
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java
index 1a8fb06f784..b72d2528e05 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/util/LoadingUtils.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2011 Atos Origin.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,20 +27,16 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.util.EditPartUtilities;
import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.services.resourceloading.Activator;
@@ -77,8 +73,8 @@ public class LoadingUtils {
IProgressMonitor monitor = dialog.getProgressMonitor();
IEditorPart editor = getEditor();
- if(editor instanceof CoreMultiDiagramEditor) {
- CoreMultiDiagramEditor core = (CoreMultiDiagramEditor)editor;
+ if(editor instanceof IMultiDiagramEditor) {
+ IMultiDiagramEditor core = (IMultiDiagramEditor)editor;
try {
IPageManager pageMngr = core.getServicesRegistry().getService(IPageManager.class);
List<Object> allPages = pageMngr.allPages();
@@ -150,7 +146,7 @@ public class LoadingUtils {
* path of resources to unload without file extension
*/
public static void unloadResourcesFromModelSet(ModelSet modelSet, URI uriWithoutFileExtension) {
- unloadResourcesFromModelSet(modelSet, uriWithoutFileExtension, true);
+ unloadResourcesFromModelSet(modelSet, uriWithoutFileExtension, false);
}
/**
@@ -210,12 +206,23 @@ public class LoadingUtils {
// (registered libraries in the model set have different URIs - e.g. due to a pathmap -
// although they point to the same location).
// TODO: Use a single detection mechanism in ResourceUpdateService and here
- String unloadPlatformString = uriWithoutFileExtension.toPlatformString(true);
- URIConverter uriConverter = modelSet.getURIConverter();
+ String unloadPlatformString;
+ if(uriWithoutFileExtension.isPlatform()) {
+ unloadPlatformString = uriWithoutFileExtension.toPlatformString(true);
+ } else {
+ unloadPlatformString = URI.decode(uriWithoutFileExtension.toString());
+ }
+ //URIConverter uriConverter = modelSet.getURIConverter();
// unload resource
for(Resource res : new ArrayList<Resource>(modelSet.getResources())) {
- URI normalizedURI = uriConverter.normalize(res.getURI());
- String platformString = normalizedURI.trimFileExtension().toPlatformString(true);
+ URI normalizedURI = res.getURI();
+ String platformString;
+ if(normalizedURI.isPlatform()) {
+ platformString = normalizedURI.trimFileExtension().toPlatformString(true);
+ } else {
+ platformString = URI.decode(normalizedURI.trimFileExtension().toString());
+ }
+
if((platformString != null) && platformString.equals(unloadPlatformString)) {
// unload this resource
modelSet.getResources().remove(res);
@@ -248,7 +255,13 @@ public class LoadingUtils {
// refresh page's diagram if needed
Diagram diag = ((Diagram)eobject);
if(pageMngr.isOpen(diag)) {
- Object part = ((IDiagramGraphicalViewer)core.getAdapter(IDiagramGraphicalViewer.class)).getEditPartRegistry().get(diag);
+
+ IDiagramGraphicalViewer graphicalViewer = (IDiagramGraphicalViewer)core.getAdapter(IDiagramGraphicalViewer.class);
+ if(graphicalViewer == null) {
+ continue;
+ }
+
+ Object part = graphicalViewer.getEditPartRegistry().get(diag);
if(part instanceof GraphicalEditPart) {
// refresh nodes
for(Object child : EditPartUtilities.getAllChildren((GraphicalEditPart)part)) {
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
index 8918cea877b..dff5bbd8114 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/commands/AbstractValidateCommand.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.util.BasicDiagnostic;
@@ -64,6 +65,8 @@ abstract public class AbstractValidateCommand extends AbstractTransactionalComma
protected IPapyrusDiagnostician diagnostician;
+ protected boolean showUIfeedback;
+
/**
* Creates a new ValidationCommand
*
@@ -94,9 +97,18 @@ abstract public class AbstractValidateCommand extends AbstractTransactionalComma
this.domain = domain;
this.selectedElement = selectedElement;
this.diagnostician= diagnostician;
+ this.showUIfeedback = true; // default is true;
}
/**
+ * don't use a progress monitor to show validation progress. This is quite useful
+ * for diagnostics that are executed on a (shallow) subtree and do not take much time.
+ */
+ public void disableUIFeedback() {
+ this.showUIfeedback = false;
+ }
+
+ /**
* @return The resource on which markers should be applied.
*/
protected Resource getValidationResource() {
@@ -141,7 +153,12 @@ abstract public class AbstractValidateCommand extends AbstractTransactionalComma
try {
// runs the operation, and shows progress.
diagnostic = null;
- new ProgressMonitorDialog(shell).run(true, true, runValidationWithProgress);
+ if (showUIfeedback) {
+ new ProgressMonitorDialog(shell).run(true, true, runValidationWithProgress);
+ }
+ else {
+ runValidationWithProgress.run(new NullProgressMonitor());
+ }
if(diagnostic != null) {
int markersToCreate = diagnostic.getChildren().size();
if((markersToCreate > 0) && PreferenceUtils.getAutoShowValidation()) {
@@ -154,7 +171,12 @@ abstract public class AbstractValidateCommand extends AbstractTransactionalComma
}
// don't fork this dialog, i.e. run it in the UI thread. This avoids that the diagrams are constantly refreshing *while*
// markers/decorations are changing. This greatly enhances update performance. See also bug 400593
- new ProgressMonitorDialog(shell).run(false, true, createMarkersWithProgress);
+ if (showUIfeedback) {
+ new ProgressMonitorDialog(shell).run(false, true, createMarkersWithProgress);
+ }
+ else {
+ createMarkersWithProgress.run(new NullProgressMonitor());
+ }
}
} catch (Exception exception) {
EMFEditUIPlugin.INSTANCE.log(exception);
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/BooleanEditionFactory.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/BooleanEditionFactory.java
index 8f326b0d196..28e586aa906 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/BooleanEditionFactory.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/BooleanEditionFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.creation;
@@ -71,16 +72,9 @@ public class BooleanEditionFactory extends StringEditionFactory {
super(title, label, new BooleanInputValidator());
}
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.creation.StringEditionFactory#createObject(org.eclipse.swt.widgets.Control)
- *
- * @param widget
- * @return
- */
@Override
- public Object createObject(Control widget) {
- String txt = super.createObject(widget).toString();
+ public Object createObject(Control widget, Object context) {
+ String txt = super.createObject(widget, context).toString();
if(txt != null) {
return Boolean.parseBoolean(txt);
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IAtomicOperationExecutor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IAtomicOperationExecutor.java
new file mode 100644
index 00000000000..dc69d248b2b
--- /dev/null
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IAtomicOperationExecutor.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.widgets.creation;
+
+import java.util.concurrent.Callable;
+
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.papyrus.infra.widgets.Activator;
+
+
+/**
+ * An interface that ensures execution of model changes as an atomic unit that is potentially undoable and redoable, such as on a "command stack"
+ * (whatever form it may take).
+ */
+public interface IAtomicOperationExecutor {
+
+ IAtomicOperationExecutor DEFAULT = new Default();
+
+ /**
+ * Execute a runnable (an operation returning no result).
+ *
+ * @param operation
+ * the operation to execute
+ * @param label
+ * an optional label to associate with the operation for presentation in, for example, the Edit menu's Undo/Redo operations
+ */
+ void execute(Runnable operation, String label);
+
+ /**
+ * Execute a callable (an operation returning a result).
+ *
+ * @param operation
+ * the operation to execute
+ * @param label
+ * an optional label to associate with the operation for presentation in, for example, the Edit menu's Undo/Redo operations
+ * @return the {@code operation}'s result
+ */
+ <V> V execute(Callable<V> operation, String label);
+
+ //
+ // Nested types
+ //
+
+ class Default implements IAtomicOperationExecutor {
+
+ public void execute(final Runnable operation, String label) {
+ try {
+ operation.run();
+ } catch (OperationCanceledException e) {
+ // We cannot really implement cancel because there is not command/transaction to roll back
+ }
+ }
+
+ public <V> V execute(final Callable<V> operation, String label) {
+ class CallableWrapper implements Runnable {
+
+ V result;
+
+ @Override
+ public void run() {
+ try {
+ result = operation.call();
+ } catch (OperationCanceledException e) {
+ // Don't trap this one
+ throw e;
+ } catch (Exception e) {
+ Activator.log.error("Callable operation failed.", e); //$NON-NLS-1$
+ throw new OperationCanceledException(); // roll back
+ }
+ }
+ }
+
+ CallableWrapper wrapper = new CallableWrapper();
+
+ execute(wrapper, label);
+
+ return wrapper.result;
+ }
+
+ }
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IntegerEditionFactory.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IntegerEditionFactory.java
index 3f2c4b05b43..a254d03cda8 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IntegerEditionFactory.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/IntegerEditionFactory.java
@@ -1,7 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
- *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +8,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.creation;
@@ -69,16 +69,9 @@ public class IntegerEditionFactory extends StringEditionFactory {
this(title, label, new IntegerInputValidator());
}
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.creation.StringEditionFactory#createObject(org.eclipse.swt.widgets.Control)
- *
- * @param widget
- * @return
- */
@Override
- public Object createObject(Control widget) {
- String txt = super.createObject(widget).toString();
+ public Object createObject(Control widget, Object context) {
+ String txt = super.createObject(widget, context).toString();
if(txt != null) {
return Integer.parseInt(txt);
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/ReferenceValueFactory.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/ReferenceValueFactory.java
index 25586368f79..f6fac32bac1 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/ReferenceValueFactory.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/ReferenceValueFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.creation;
@@ -50,10 +52,13 @@ public interface ReferenceValueFactory {
* @param widget
* The widget calling this factory. It can be used for example to retrieve
* the Display for opening a Dialog
+ * @param context
+ * The object being edited, in which context the new object is to be created and which will as a result have a reference to the new object.
+ * If there is no context object (creation of a free-floating object) or it cannot be determined, this may be {@code null}
* @return
* The newly created object, or null if no object has been created
*/
- public Object createObject(Control widget);
+ public Object createObject(Control widget, Object context);
/**
* The objects have been validated (For example, the user pressed "Ok")
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java
index 837eaddffe9..cadc95e9bc0 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/StringEditionFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.creation;
@@ -90,7 +92,7 @@ public class StringEditionFactory implements ReferenceValueFactory {
return true;
}
- public Object createObject(Control widget) {
+ public Object createObject(Control widget, Object context) {
InputDialog dialog = new InputDialog(widget.getShell(), title, label, "", validator); //$NON-NLS-1$
if(contentProvider != null) {
dialog.setContentProvider(contentProvider);
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/UnlimitedNaturalEditionFactory.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/UnlimitedNaturalEditionFactory.java
index 1b17b27193f..66e4780188c 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/UnlimitedNaturalEditionFactory.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/creation/UnlimitedNaturalEditionFactory.java
@@ -1,7 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
- *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +8,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.creation;
@@ -73,16 +73,9 @@ public class UnlimitedNaturalEditionFactory extends StringEditionFactory {
super(title, label, validator);
}
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.creation.StringEditionFactory#createObject(org.eclipse.swt.widgets.Control)
- *
- * @param widget
- * @return
- */
@Override
- public Object createObject(Control widget) {
- String txt = super.createObject(widget).toString();
+ public Object createObject(Control widget, Object context) {
+ String txt = super.createObject(widget, context).toString();
if(UnlimitedNaturalValidator.INFINITE_STAR.equals(txt)) {
txt = UnlimitedNaturalValidator.INFINITE_MINUS_ONE;
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractEditor.java
index 4526632711c..28b7d8c9ee8 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractEditor.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.editors;
@@ -17,6 +19,9 @@ import java.util.Set;
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -363,4 +368,34 @@ public abstract class AbstractEditor extends Composite implements DisposeListene
dispose();
}
+ /**
+ * Obtains the most appropriate operation executor for the object being edited.
+ *
+ * @param context the object being edited
+ * @return the executor to use to run operations (never {@code null})
+ */
+ public IAtomicOperationExecutor getOperationExecutor(Object context) {
+ IAtomicOperationExecutor result;
+ if(context instanceof IAdaptable) {
+ result = (IAtomicOperationExecutor)((IAdaptable)context).getAdapter(IAtomicOperationExecutor.class);
+ } else if (context != null) {
+ result = (IAtomicOperationExecutor)Platform.getAdapterManager().getAdapter(context, IAtomicOperationExecutor.class);
+ } else {
+ // We can't adapt null, of course, so we will have to settle for the default executor
+ result = null;
+ }
+
+ if (result == null) {
+ result = IAtomicOperationExecutor.DEFAULT;
+ }
+
+ return result;
+ }
+
+ /**
+ * Queries the model element that I edit.
+ *
+ * @return the contextual model element
+ */
+ protected abstract Object getContextElement();
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java
index f91c35bdb5e..857a0d72062 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractListEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,11 +8,14 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.editors;
import org.eclipse.core.databinding.UpdateListStrategy;
import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.swt.widgets.Composite;
@@ -142,4 +145,10 @@ public abstract class AbstractListEditor extends AbstractEditor {
binding = getBindingContext().bindList(widgetObservable, modelProperty, targetToModelStrategy, modelToTargetStrategy);
}
+
+ protected Object getContextElement() {
+ // Our observables for features of EMF objects are expected to implement IObserving because
+ // the observe the value of the object's feature
+ return (modelProperty instanceof IObserving) ? ((IObserving)modelProperty).getObserved() : null;
+ }
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java
index 503b9a52bf0..150eb611907 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractValueEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.editors;
@@ -15,6 +17,7 @@ import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.conversion.IConverter;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.swt.widgets.Composite;
@@ -172,4 +175,11 @@ public abstract class AbstractValueEditor extends AbstractEditor {
* The current value for this editor
*/
public abstract Object getValue();
+
+ @Override
+ protected Object getContextElement() {
+ // Our observables for features of EMF objects are expected to implement IObserving because
+ // the observe the value of the object's feature
+ return (modelProperty instanceof IObserving) ? ((IObserving)modelProperty).getObserved() : null;
+ }
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/CompactMultipleValueEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/CompactMultipleValueEditor.java
index 44c5728e5cb..97e812c23f2 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/CompactMultipleValueEditor.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/CompactMultipleValueEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.editors;
@@ -229,6 +231,7 @@ public class CompactMultipleValueEditor extends AbstractListEditor implements IC
* {@inheritDoc} Handles the event when the edit button is pressed
*/
public void widgetSelected(SelectionEvent e) {
+ dialog.setContextElement(getContextElement());
dialog.setInitialSelections(modelProperty.toArray());
int returnCode = dialog.open();
if(returnCode == Window.CANCEL) {
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueEditor.java
index 5a5411df9e2..b0694e00bb4 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueEditor.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.editors;
@@ -18,6 +20,7 @@ import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -25,6 +28,7 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.widgets.Activator;
import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.infra.widgets.messages.Messages;
@@ -399,45 +403,67 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
* Handle add Action
*/
protected void addAction() {
+ final Object context = getContextElement();
+
if(directCreation) {
if(referenceFactory != null && referenceFactory.canCreateObject()) {
- Object newElement = referenceFactory.createObject(this);
- if(newElement != null) {
- modelProperty.add(newElement);
- commit();
- }
+ getOperationExecutor(context).execute(new Runnable() {
+
+ @Override
+ public void run() {
+ Object newElement = referenceFactory.createObject(MultipleValueEditor.this, context);
+ if(newElement == null) {
+ // Cancel the operation
+ throw new OperationCanceledException();
+ }
+
+ modelProperty.add(newElement);
+ commit();
+ }
+ }, NLS.bind(Messages.MultipleValueEditor_addOperation, labelText));
}
return;
}
- String dialogLabel = label == null ? null : label.getText();
- MultipleValueSelectorDialog dialog = createMultipleValueSelectorDialog(getParent(), selector, ordered, unique, dialogLabel);
- dialog.setLabelProvider((ILabelProvider)treeViewer.getLabelProvider());
- dialog.setFactory(referenceFactory);
- dialog.setUpperBound(upperBound);
-
- if(modelProperty != null) {
- dialog.setInitialSelections(modelProperty.toArray());
- } else {
- dialog.setInitialSelections(new Object[0]);
- }
+ getOperationExecutor(context).execute(new Runnable() {
+
+ @Override
+ public void run() {
+ String dialogLabel = label == null ? null : label.getText();
+ MultipleValueSelectorDialog dialog = createMultipleValueSelectorDialog(getParent(), selector, ordered, unique, dialogLabel);
+ dialog.setLabelProvider((ILabelProvider)treeViewer.getLabelProvider());
+ dialog.setFactory(referenceFactory);
+ dialog.setUpperBound(upperBound);
+ dialog.setContextElement(context);
+
+ if(modelProperty != null) {
+ dialog.setInitialSelections(modelProperty.toArray());
+ } else {
+ dialog.setInitialSelections(new Object[0]);
+ }
- int returnCode = dialog.open();
- if(returnCode == Window.CANCEL) {
- return;
- }
+ int returnCode = dialog.open();
+ if(returnCode == Window.CANCEL) {
+ // Clear out the element selector in case we open this dialog again
+ selector.clearTemporaryElements();
+
+ // Roll back whatever has been done, so far
+ throw new OperationCanceledException();
+ }
- modelProperty.clear();
+ modelProperty.clear();
- Object[] result = dialog.getResult();
- if(result == null) {
- return;
- }
+ Object[] result = dialog.getResult();
+ if(result == null) {
+ return;
+ }
- modelProperty.addAll(Arrays.asList(result));
+ modelProperty.addAll(Arrays.asList(result));
- commit();
+ commit();
+ }
+ }, NLS.bind(Messages.MultipleValueEditor_addOperation, labelText));
}
@Override
@@ -513,19 +539,26 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
TreeItem selectedItem = treeViewer.getTree().getSelection()[0];
Tree parentTree = selectedItem.getParent();
- int index = parentTree.indexOf(selectedItem);
-
- Object currentValue = selection.getFirstElement();
- Object newValue = referenceFactory.edit(this.edit, selection.getFirstElement());
-
- if(newValue != currentValue && newValue != null) {
- modelProperty.remove(index);
- modelProperty.add(index, newValue);
-
- //commit(); // The commit only occurs in the case where we modify the list (We don't commit direct edition on objects)
- }
+ final int index = parentTree.indexOf(selectedItem);
+ final Object currentValue = selection.getFirstElement();
+
+ getOperationExecutor(currentValue).execute(new Runnable() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+ Object newValue = referenceFactory.edit(MultipleValueEditor.this.edit, currentValue);
+
+ if(newValue != currentValue && newValue != null) {
+ modelProperty.remove(index);
+ modelProperty.add(index, newValue);
+
+ //commit(); // The commit only occurs in the case where we modify the list (We don't commit direct edition on objects)
+ }
- commit();
+ commit();
+ }
+ }, NLS.bind(Messages.MultipleValueEditor_editOperation, labelText));
}
/**
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueSelectorDialog.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueSelectorDialog.java
index dc5eeecdad0..cd2c84d8b5b 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueSelectorDialog.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueSelectorDialog.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.editors;
@@ -19,6 +21,7 @@ import java.util.LinkedList;
import java.util.Set;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -47,10 +50,15 @@ import org.eclipse.ui.dialogs.SelectionDialog;
/**
* Object Chooser. Defines a standard popup for selecting
- * multiple values.
+ * multiple values. If this dialog is used to select or create model
+ * elements to be added to or removed from some element that is being
+ * edited, then it is important to
+ * {@linkplain #setContextElement(Object) set that contextual element}
+ * in this dialog.
*
* @author Camille Letavernier
*
+ * @see #setContextElement(Object)
*/
public class MultipleValueSelectorDialog extends SelectionDialog implements ISelectionChangedListener, IDoubleClickListener, IElementSelectionListener, SelectionListener {
@@ -150,6 +158,11 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements ISel
* The factory for creating new elements
*/
protected ReferenceValueFactory factory;
+
+ /**
+ * The model element being edited (if any), to which elements are to be added or removed.
+ */
+ protected Object contextElement;
/**
* The list of newly created objects
@@ -534,7 +547,15 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements ISel
return;
}
- Object newObject = factory.createObject(this.create);
+ Object newObject;
+
+ try {
+ newObject = factory.createObject(this.create, contextElement);
+ } catch (OperationCanceledException e) {
+ // The user cancelled and we rolled back pending model changes
+ newObject = null;
+ }
+
if(newObject == null) {
return;
}
@@ -703,6 +724,25 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements ISel
this.upperBound = upperBound;
}
+ /**
+ * Sets the optional context of the element that is being edited, in which others will be added and removed.
+ *
+ * @param contextElement
+ * the model element that is being edited
+ */
+ public void setContextElement(Object contextElement) {
+ this.contextElement = contextElement;
+ }
+
+ /**
+ * Queries the optional context of the element that is being edited, in which others will be added and removed.
+ *
+ * @return the model element that is being edited
+ */
+ public Object getContextElement() {
+ return contextElement;
+ }
+
@Override
public boolean close() {
selector.removeElementSelectionListener(this);
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java
index 86a70c761e9..84c2234678b 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.editors;
@@ -16,9 +18,11 @@ import java.util.Collections;
import java.util.List;
import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.widgets.Activator;
import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.infra.widgets.databinding.CLabelObservableValue;
@@ -213,14 +217,22 @@ public class ReferenceDialog extends AbstractValueEditor implements SelectionLis
*/
protected void createAction() {
if(valueFactory != null && valueFactory.canCreateObject()) {
- Object value = valueFactory.createObject(createInstanceButton);
- if(value == null) {
- return;
- }
- Collection<Object> validatedObjects = valueFactory.validateObjects(Collections.singleton(value));
- if(!validatedObjects.isEmpty()) {
- setValue(validatedObjects.iterator().next());
- }
+ final Object context = getContextElement();
+ getOperationExecutor(context).execute(new Runnable() {
+
+ @Override
+ public void run() {
+ Object value = valueFactory.createObject(createInstanceButton, context);
+ if(value == null) {
+ // Cancel the operation
+ throw new OperationCanceledException();
+ }
+ Collection<Object> validatedObjects = valueFactory.validateObjects(Collections.singleton(value));
+ if(!validatedObjects.isEmpty()) {
+ setValue(validatedObjects.iterator().next());
+ }
+ }
+ }, NLS.bind(Messages.ReferenceDialog_setOperation, labelText));
}
}
@@ -229,13 +241,19 @@ public class ReferenceDialog extends AbstractValueEditor implements SelectionLis
* that is currently selected
*/
protected void editAction() {
- Object currentValue = getValue();
+ final Object currentValue = getValue();
if(currentValue != null && valueFactory != null && valueFactory.canEdit()) {
- Object newValue = valueFactory.edit(editInstanceButton, getValue());
- if(newValue != currentValue) {
- setValue(newValue);
- }
- updateLabel();
+ getOperationExecutor(currentValue).execute(new Runnable() {
+
+ @Override
+ public void run() {
+ Object newValue = valueFactory.edit(editInstanceButton, currentValue);
+ if(newValue != currentValue) {
+ setValue(newValue);
+ }
+ updateLabel();
+ }
+ }, NLS.bind(Messages.ReferenceDialog_editOperation, labelText));
}
}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java
index 7944870de3e..82dcdde6ce7 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.messages;
@@ -32,6 +34,10 @@ public class Messages extends NLS {
/** The Multiple value editor_ add elements. */
public static String MultipleValueEditor_AddElements;
+ public static String MultipleValueEditor_addOperation;
+
+ public static String MultipleValueEditor_editOperation;
+
/** The Multiple value editor_ edit selected value */
public static String MultipleValueEditor_EditSelectedValue;
@@ -61,6 +67,8 @@ public class Messages extends NLS {
public static String ReferenceDialog_CreateANewObject;
+ public static String ReferenceDialog_editOperation;
+
public static String ReferenceDialog_EditTheCurrentValue;
/** The Reference dialog_ edit value */
@@ -69,6 +77,8 @@ public class Messages extends NLS {
/** The Reference dialog_ select value */
public static String ReferenceDialog_SelectValue;
+ public static String ReferenceDialog_setOperation;
+
/** The Reference dialog_ unset */
public static String ReferenceDialog_Unset;
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties
index a5cdb982258..a9fbdf92c68 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties
@@ -1,8 +1,24 @@
-BooleanInputValidator_NotABoolean=The actual entry is not an Boolean.
+###############################################################################
+# Copyright (c) 2010, 2014 CEA LIST and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+# Christian W. Damus (CEA) - bug 402525
+#
+###############################################################################
+
+BooleanInputValidator_NotABoolean=The actual entry is not a Boolean.
IntegerInputValidator_NotAnIntegerMessage=The actual entry is not an Integer.
RealInputValidator_NotaRealMessage=The actual entry is not a Real.
UnlimitedNaturalInputValidator_NotAnUnlimitedNaturalMessage=The actual entry is not an UnlimitedNatural. An UnlimitedNatural must be either -1, * or >= 0
MultipleValueEditor_AddElements=Add elements
+MultipleValueEditor_addOperation=Add {0}
+MultipleValueEditor_editOperation=Edit {0}
MultipleValueEditor_EditSelectedValue=Edit the selected value
MultipleValueEditor_MoveSelectedElementsDown=Move selected elements down
MultipleValueEditor_MoveSelectedElementsUp=Move selected elements up
@@ -13,9 +29,11 @@ MultipleValueSelectorDialog_RemoveAllElements=Remove all elements
MultipleValueSelectorDialog_CreateNewElement=Create a new element
MultipleValueSelectorDialog_DeleteNewElement=Deletes a newly created element
ReferenceDialog_CreateANewObject=Create a new object
+ReferenceDialog_editOperation=Edit {0}
ReferenceDialog_EditTheCurrentValue=Edit the current value
ReferenceDialog_EditValue=Edit the reference value
ReferenceDialog_SelectValue=Select the value for this reference
+ReferenceDialog_setOperation=Set {0}
ReferenceDialog_Unset=<Undefined>
ReferenceDialog_UnsetValue=Unset the reference value
ReferenceDialogObservable_Unchanged=<Unchanged>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/ui/CreateUmlElementDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/ui/CreateUmlElementDialog.java
index c48c2086405..0215eb996a8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/ui/CreateUmlElementDialog.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/ui/CreateUmlElementDialog.java
@@ -1,14 +1,14 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2010 CEA LIST.
*
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
- * CEA LIST - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.blockdefinition.ui;
@@ -205,7 +205,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
int max = 0;
do {
- ArrayList<?> allInterface = Util.getInstancesFilteredByType(pack, Interface.class, null);
+ List<Interface> allInterface = Util.getInstancesFilteredByType(pack, Interface.class, null);
for(Object object : allInterface) {
String name = NamedElementUtil.getName((NamedElement)object);
if(name != null && name.startsWith(type)) {
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
index 60f21a35098..9f4e08a5090 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java
@@ -40,8 +40,6 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.XYLayoutWithConstra
*/
public class DefaultXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEditPolicy {
- protected double spacing = 80;
-
/**
* Called in response to a <tt>REQ_CREATE</tt> request. Returns a command
* to set each created element bounds and auto-size properties.
@@ -64,33 +62,35 @@ public class DefaultXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEdi
while(iter.hasNext()) {
CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor)iter.next();
Rectangle rect = getBoundsOffest(req, BOUNDS, viewDescriptor);
-
+
//see bug 427129: Figures newly created via the palette should be snapped to grid if "snap to grid" is activated
if(couldBeSnaped) {
//this code fix the bug in some case...
int add = 0;
DiagramRootEditPart drep = (DiagramRootEditPart)getHost().getRoot();
double spacing = drep.getGridSpacing();
- final double max_value = spacing*20;
+ final double max_value = spacing * 20;
final SnapToHelper helper = (SnapToHelper)getHost().getAdapter(SnapToHelper.class);
- final LayoutHelper layoutHelper = new LayoutHelper();
- while(add < max_value) {//we define a max value to do test
- Rectangle LOCAL_BOUNDS = BOUNDS.getCopy();
- LOCAL_BOUNDS.translate(add, add);
- Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor);
- final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect);
- resultRect.setWidth(-1);
- resultRect.setHeight(-1);
- PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation());
- helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1);
- final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1));
- if(couldBeSnaped) {
- if(pt.equals(resultRect.getLocation())) {
- rect.setLocation(resultRect.getLocation());
- break;
- } else {
- add +=spacing;
- continue;
+ if(helper != null) {
+ final LayoutHelper layoutHelper = new LayoutHelper();
+ while(add < max_value) {//we define a max value to do test
+ Rectangle LOCAL_BOUNDS = BOUNDS.getCopy();
+ LOCAL_BOUNDS.translate(add, add);
+ Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor);
+ final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect);
+ resultRect.setWidth(-1);
+ resultRect.setHeight(-1);
+ PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation());
+ helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1);
+ final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1));
+ if(couldBeSnaped) {
+ if(pt.equals(resultRect.getLocation())) {
+ rect.setLocation(resultRect.getLocation());
+ break;
+ } else {
+ add += spacing;
+ continue;
+ }
}
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
index 79b05853d74..25d93894f72 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
@@ -13,6 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.edit.policy;
+import java.util.Collections;
import java.util.Iterator;
import org.eclipse.draw2d.IFigure;
@@ -22,6 +23,7 @@ import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.SnapToHelper;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gef.requests.ChangeBoundsRequest;
@@ -37,6 +39,7 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescrip
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.snap.NodeSnapHelper;
import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
/**
@@ -121,11 +124,23 @@ public class StructuredClassifierCreationEditPolicy extends CreationEditPolicy {
PortPositionLocator locator = new PortPositionLocator(getHostFigure(), PositionConstants.NONE);
Rectangle proposedBounds = new Rectangle(requestedLocation, new Dimension(20, 20));
Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds);
-
+
+ if(request.isSnapToEnabled()) { //request for snap port at the creation
+ //we find the best location with snap
+ Point wantedPoint = preferredBounds.getLocation();
+ getHostFigure().translateToAbsolute(wantedPoint);
+ Rectangle portBounds = new Rectangle(wantedPoint, new Dimension(20, 20));
+ NodeSnapHelper helper = new NodeSnapHelper((SnapToHelper)getHost().getAdapter(SnapToHelper.class), portBounds, false, false, true);
+ final ChangeBoundsRequest tmpRequest = new ChangeBoundsRequest("move"); //$NON-NLS-1$
+ tmpRequest.setEditParts(Collections.emptyList());
+ tmpRequest.setSnapToEnabled(true);
+ tmpRequest.setLocation(portBounds.getLocation());
+ helper.snapPoint(tmpRequest);
+ preferredBounds.translate(tmpRequest.getMoveDelta());
+ }
// Convert the calculated preferred bounds as relative to parent location
Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated());
setBoundsCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, creationBounds);
-
return setBoundsCommand;
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
index 78884083e9f..90763608a57 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java
@@ -19,10 +19,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
import org.eclipse.papyrus.sysml.blocks.BindingConnector;
-import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
import org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure;
-import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
-import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.Element;
public class ConnectorEditPart extends AbstractElementLinkEditPart {
@@ -85,6 +82,7 @@ public class ConnectorEditPart extends AbstractElementLinkEditPart {
/**
* Creates figure for this edit part.
*/
+ @Override
protected Connection createConnectionFigure() {
return new ConnectorEdgeFigure();
}
@@ -92,17 +90,22 @@ public class ConnectorEditPart extends AbstractElementLinkEditPart {
/**
* Creates primary shape for this edit part.
*/
+ @Override
public ConnectorEdgeFigure getPrimaryShape() {
return (ConnectorEdgeFigure)getFigure();
}
@Override
protected void refreshLineWidth() {
- if (org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication((Element)resolveSemanticElement(), BindingConnector.class) != null) {
- setLineWidth(2);
+ int width = getLineWidth();
+ if(width < 1) {
+ width = 1;
}
- else {
- setLineWidth(1);
+
+ if(org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication((Element)resolveSemanticElement(), BindingConnector.class) != null) {
+ setLineWidth(width * 2);
+ } else {
+ setLineWidth(width);
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
index bdf8a3f464c..93e96ee7244 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
@@ -19,14 +19,9 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForSelection;
-import org.eclipse.papyrus.sysml.SysmlPackage;
-import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
import org.eclipse.papyrus.sysml.diagram.common.Activator;
-import org.eclipse.papyrus.sysml.requirements.RequirementsPackage;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.util.UMLUtil;
/**
* This class is a Property tester used to check is current model (meaning the model currently opened in Papyrus) is a SysML Model.
@@ -75,10 +70,15 @@ public class SysMLSelectionTester extends PropertyTester {
EObject root = getRoot(receiver);
if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(SysmlPackage.eINSTANCE, root);
- if(((Package)root).isProfileApplied(sysml)) {
- isSysMLModel = true;
- }
+
+ return (((Package)root).getAppliedProfile("SysML") != null);
+
+ //FIX: UMLUtil.getProfile() loads the profile into the resource set. This is not desired.
+ //
+ // Profile sysml = UMLUtil.getProfile(SysmlPackage.eINSTANCE, root);
+ // if(((Package)root).isProfileApplied(sysml)) {
+ // isSysMLModel = true;
+ // }
}
return isSysMLModel;
@@ -90,10 +90,13 @@ public class SysMLSelectionTester extends PropertyTester {
EObject root = getRoot(receiver);
if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(RequirementsPackage.eINSTANCE, root);
- if(((Package)root).isProfileApplied(sysml)) {
- isSysMLModel = true;
- }
+ return (((Package)root).getAppliedProfile("SysML::Requirements") != null);
+
+ //FIX: UMLUtil.getProfile() loads the profile into the resource set. This is not desired.
+ // Profile sysml = UMLUtil.getProfile(RequirementsPackage.eINSTANCE, root);
+ // if(((Package)root).isProfileApplied(sysml)) {
+ // isSysMLModel = true;
+ // }
}
return isSysMLModel;
@@ -105,10 +108,12 @@ public class SysMLSelectionTester extends PropertyTester {
EObject root = getRoot(receiver);
if(root instanceof Package) {
- Profile sysml = UMLUtil.getProfile(BlocksPackage.eINSTANCE, root);
- if(((Package)root).isProfileApplied(sysml)) {
- isSysMLModel = true;
- }
+ return (((Package)root).getAppliedProfile("SysML::Blocks") != null);
+ //FIX: UMLUtil.getProfile() loads the profile into the resource set. This is not desired.
+ // Profile sysml = UMLUtil.getProfile(BlocksPackage.eINSTANCE, root);
+ // if(((Package)root).isProfileApplied(sysml)) {
+ // isSysMLModel = true;
+ // }
}
return isSysMLModel;
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/ui/CreateUmlElementDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/ui/CreateUmlElementDialog.java
index 280be778ecf..090a09899a8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/ui/CreateUmlElementDialog.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/ui/CreateUmlElementDialog.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
@@ -28,9 +28,11 @@ import org.eclipse.gef.commands.Command;
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.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -40,7 +42,7 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.sysml.diagram.internalblock.messages.Messages;
-import org.eclipse.papyrus.uml.diagram.common.util.Util;
+import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -90,7 +92,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param parent
* the parent
* @param domain
@@ -126,7 +128,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Sets the forbidden names.
- *
+ *
* @param forbiddenNames
* the new forbidden names
*/
@@ -136,7 +138,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Creates the dialog area.
- *
+ *
* @param parent
* the parent
* @return the control
@@ -161,7 +163,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Creates the name section and put it at the top of the composite.
- *
+ *
* @param parent
* the composite parent
*/
@@ -191,7 +193,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns the default name for the new Element.
- *
+ *
* @return the default name
* the default name for the new Element
*/
@@ -202,7 +204,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
int max = 0;
do {
- ArrayList<?> allInterface = Util.getInstancesFilteredByType(pack, Interface.class, null);
+ List<Interface> allInterface = ElementUtil.getInstancesFilteredByType(pack, Interface.class, null);
for(Object object : allInterface) {
String name = NamedElementUtil.getName((NamedElement)object);
if(name != null && name.startsWith(type)) {
@@ -231,7 +233,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Tests if the proposed name is not forbidden
- *
+ *
* @param name
* a name
* @return
@@ -246,7 +248,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns the command to create the new element which the chosen name.
- *
+ *
* @return the command
* the command to create the new element which the chosen name
*/
@@ -271,7 +273,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Compute result.
- *
+ *
* @see org.eclipse.ui.dialogs.ElementTreeSelectionDialog#computeResult()
*/
@Override
@@ -283,7 +285,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Set the value to {@link #name} and {@link #parentContainer}.
- *
+ *
* @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
*/
@Override
@@ -300,7 +302,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns a command corresponding to this request.
- *
+ *
* @param request
* a request
* @return the command
@@ -329,7 +331,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param domain
* the domain
* @param label
@@ -348,7 +350,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Do execute with result.
- *
+ *
* @param monitor
* the monitor
* @param info
@@ -373,7 +375,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* This command allows to create a new element when its parent is not yet created when the command is build
- *
+ *
* We need a such command, because {@link CreateRelationshipCommand#getCommandResult()} return <code>null</code> when the command has not been
* executed.
*/
@@ -384,7 +386,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param domain
* the domain
* @param label
@@ -401,7 +403,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Do execute with result.
- *
+ *
* @param monitor
* the monitor
* @param info
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java
index 8b6dda12852..d028b869d48 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011-2012 CEA LIST.
+ * Copyright (c) 2011-2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
*
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.service.types.helper.advice;
@@ -49,10 +50,12 @@ import org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils;
import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
import org.eclipse.papyrus.uml.service.types.utils.ElementUtil;
import org.eclipse.papyrus.uml.service.types.utils.NamedElementHelper;
+import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Type;
@@ -195,11 +198,15 @@ public class PropertyEditHelperAdvice extends AbstractEditHelperAdvice {
* @return
*/
private ICommand getDestroyAssociatedNestedConnectorCommand(Property property, ICommand command) {
- List<Connector> instancesFilteredByType = org.eclipse.papyrus.uml.tools.utils.ElementUtil.getInstancesFilteredByType(property.getModel(), Connector.class, null);
- List<Connector> connectorToDestroy = ConnectorUtils.filterConnectorByPropertyInNestedConnectorEnd(instancesFilteredByType, (Property)property);
- for(Connector connector : connectorToDestroy) {
- ICommand destroyConnectorCommand = getDestroyConnectorCommand(connector);
- command = CompositeCommand.compose(command, destroyConnectorCommand);
+ Package rootPackage = PackageUtil.getRootPackage(property);
+ // When creating a property in a new-element dialog, it is not attached to the model, yet. So, there will be no need to worry about connectors
+ if(rootPackage != null) {
+ List<Connector> instancesFilteredByType = org.eclipse.papyrus.uml.tools.utils.ElementUtil.getInstancesFilteredByType(rootPackage, Connector.class, null);
+ List<Connector> connectorToDestroy = ConnectorUtils.filterConnectorByPropertyInNestedConnectorEnd(instancesFilteredByType, (Property)property);
+ for(Connector connector : connectorToDestroy) {
+ ICommand destroyConnectorCommand = getDestroyConnectorCommand(connector);
+ command = CompositeCommand.compose(command, destroyConnectorCommand);
+ }
}
return command;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
index 84eba993fbe..55772f85454 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
@@ -3743,7 +3743,7 @@
<children xsi:type="gmfgen:GenStandardPreferencePage" iD="org.eclipse.uml2.uml.diagram.rulersAndGrid" name="Rulers And Grid" kind="RulersAndGrid"/>
</preferencePages>
</diagram>
- <plugin iD="org.eclipse.papyrus.uml.diagram.activity" name="Papyrus activity editor Plugin" provider="Papyrus" version="0.10.0.qualifier">
+ <plugin iD="org.eclipse.papyrus.uml.diagram.activity" name="Papyrus activity editor Plugin" provider="Papyrus" version="1.0.0.qualifier">
<requiredPlugins>org.eclipse.draw2d</requiredPlugins>
<requiredPlugins>org.eclipse.papyrus.uml.diagram.common</requiredPlugins>
<requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
index 184e676f03f..c27c77e40f6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension point="org.eclipse.ui.contexts" id="ui-context">
@@ -1404,7 +1417,8 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.activity.ExceptionHandler_4005"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.activity.CommentAnnotatedElement_4006"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.activity.ConstraintConstrainedElement_4007"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
<extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomConstraintEditPart.java
new file mode 100644
index 00000000000..b062c1fe0b7
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomConstraintEditPart.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ConstraintEditPart;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("restriction")
+public class CustomConstraintEditPart extends ConstraintEditPart {
+
+ public CustomConstraintEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+ EditPart editPart = this;
+ if (request instanceof DirectEditRequest){
+ Point p = new Point(((DirectEditRequest)request).getLocation());
+ getFigure().translateToRelative(p);
+ IFigure fig = getFigure().findFigureAt(p);
+ editPart =(EditPart) getViewer().getVisualPartMap().get(fig);
+ }
+ if (editPart == this) {
+ try {
+ editPart = (EditPart) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ // edit body, which can be found in 2nd child, instead of default action (first child)
+ setResult(getChildren().get(1));
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ }
+ if (editPart != null){
+ editPart.performRequest(request);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomConstraintEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomConstraintEditPartCN.java
new file mode 100644
index 00000000000..be54ebf4643
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomConstraintEditPartCN.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ConstraintEditPartCN;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("restriction")
+public class CustomConstraintEditPartCN extends ConstraintEditPartCN {
+
+ public CustomConstraintEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+ EditPart editPart = this;
+ if (request instanceof DirectEditRequest){
+ Point p = new Point(((DirectEditRequest)request).getLocation());
+ getFigure().translateToRelative(p);
+ IFigure fig = getFigure().findFigureAt(p);
+ editPart =(EditPart) getViewer().getVisualPartMap().get(fig);
+ }
+ if (editPart == this) {
+ try {
+ editPart = (EditPart) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ // edit body, which can be found in 2nd child, instead of default action (first child)
+ setResult(getChildren().get(1));
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ }
+ if (editPart != null){
+ editPart.performRequest(request);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLeditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLeditPartFactory.java
index 502278e13bf..0d7f69c7ab8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLeditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLeditPartFactory.java
@@ -28,11 +28,15 @@ import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CModelEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CPackageEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CPackageEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CShapeNamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationClassRoleSourceEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationClassRoleTargetEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationNodeEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationSourceNameEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationTargetNameEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ContainmentCircleEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DependencyBranchEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DependencyNodeEditPart;
@@ -80,6 +84,10 @@ public class CustomUMLeditPartFactory extends UMLEditPartFactory {
return new CDependencyBranchEditPart(view);
case ShapeNamedElementEditPart.VISUAL_ID:
return new CShapeNamedElementEditPart(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return new CustomConstraintEditPart(view);
+ case ConstraintEditPartCN.VISUAL_ID:
+ return new CustomConstraintEditPartCN(view);
}
}
return super.createEditPart(context, model);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
index cd19f0fa84b..d73430aeffd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
point="org.eclipse.ui.contexts" id="ui-context">
@@ -1279,6 +1292,7 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.clazz.InformationFlow_4026"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.clazz.ConstraintContext_8500"/>
<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
<extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPart.java
index 4490e4d8e57..0ad0b9bfbbd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPart.java
@@ -59,6 +59,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
@@ -80,7 +81,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -405,7 +406,6 @@ public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implement
Dialog dialog = null;
if(configuration instanceof ICustomDirectEditorConfiguration) {
setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
- setParser(((ICustomDirectEditorConfiguration)configuration).createParser(this.resolveSemanticElement()));
initializeDirectEditManager(theRequest);
return;
} else if(configuration instanceof IPopupEditorConfiguration) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPartCN.java
index 45b10cdd902..6325b0aa446 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/ConstraintBodyEditPartCN.java
@@ -59,6 +59,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
@@ -80,7 +81,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConstraintBodyEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class ConstraintBodyEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -405,7 +406,6 @@ public class ConstraintBodyEditPartCN extends PapyrusCompartmentEditPart impleme
Dialog dialog = null;
if(configuration instanceof ICustomDirectEditorConfiguration) {
setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
- setParser(((ICustomDirectEditorConfiguration)configuration).createParser(this.resolveSemanticElement()));
initializeDirectEditManager(theRequest);
return;
} else if(configuration instanceof IPopupEditorConfiguration) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
index 8a91ff506e4..759817fc0bd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
@@ -249,6 +249,13 @@
properties="isUMLModel, isUMLProfile"
type="org.eclipse.jface.viewers.ISelection">
</propertyTester>
+ <propertyTester
+ class="org.eclipse.papyrus.uml.diagram.common.util.UMLModelTester"
+ id="org.eclipse.papyrus.UMLModelTester"
+ namespace="org.eclipse.papyrus.UMLModelTester"
+ properties="isUMLModel, isUMLProfile"
+ type="org.eclipse.ui.IWorkbenchPart">
+ </propertyTester>
</extension>
<!-- Reusable test definitions verifying:
@@ -259,33 +266,25 @@
point="org.eclipse.core.expressions.definitions">
<definition id="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel">
- <and>
-
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/>
- </with>
-
- <with variable="selection">
- <test property="org.eclipse.papyrus.UMLSelectionTester.isUMLModel" value="true"
- forcePluginActivation="true"/>
- </with>
-
- </and>
+ <with
+ variable="activePart">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.UMLModelTester.isUMLModel"
+ value="true">
+ </test>
+ </with>
</definition>
<definition id="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLProfile">
- <and>
-
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/>
- </with>
-
- <with variable="selection">
- <test property="org.eclipse.papyrus.UMLSelectionTester.isUMLProfile" value="true"
- forcePluginActivation="true"/>
- </with>
-
- </and>
+ <with
+ variable="activePart">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.UMLModelTester.isUMLProfile"
+ value="true">
+ </test>
+ </with>
</definition>
</extension>
@@ -442,22 +441,6 @@
</extension>
<extension
- point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
- <decoratorProvider
- class="org.eclipse.papyrus.uml.diagram.common.service.InheritedDecoratorProvider">
- <Priority
- name="Lowest">
- </Priority>
- <object
- class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
- id="NODE">
- </object>
- <context
- decoratorTargets="NODE">
- </context>
- </decoratorProvider>
-</extension>
-<extension
point="org.eclipse.ui.services">
<sourceProvider
provider="org.eclipse.papyrus.uml.diagram.common.providers.ActionStateSourceProvider">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java
new file mode 100644
index 00000000000..5b57b76195a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java
@@ -0,0 +1,279 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.editparts;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Abstract edit part for all connection nodes that control UML elements
+ * represented by edges. It then defines basic behavior for Stereotype
+ * management. It has facilities to retrieve UML element controlled by this edit
+ * part
+ */
+public class DirectEditNodeEditPart {
+
+ // View view;
+ ConnectionNodeEditPart gep;
+
+ public DirectEditNodeEditPart(ConnectionNodeEditPart gep) {
+ this.gep = gep;
+ }
+
+ /**
+ * Performs a direct edit request (usually by showing some type of editor)
+ *
+ * @param request
+ * the direct edit request
+ */
+ public void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ updateExtendedEditorConfiguration();
+ if(configuration == null || configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(gep.resolveSemanticElement());
+ Dialog dialog = null;
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager((ITextAwareEditPart) gep));
+ setParser(((ICustomDirectEditorConfiguration)configuration).createParser(gep.resolveSemanticElement()));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
+ IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if(configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), gep.resolveSemanticElement(), configuration.getTextToEdit(gep.resolveSemanticElement()));
+ } else if(configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), gep.resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(gep.resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+ if(Window.OK == dialog.open()) {
+ TransactionalEditingDomain domain = gep.getEditingDomain();
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") { //$NON-NLS-1$
+
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(gep.resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * Clients need to override
+ */
+ protected DirectEditManager getManager() {
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /** direct edition mode (default, undefined, registered editor, etc.) */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /** configuration from a registered edit dialog */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * Updates the preference configuration
+ */
+ protected void updateExtendedEditorConfiguration() {
+ String id = gep.resolveSemanticElement().eClass().getInstanceClassName();
+ String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + id);
+ if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ } else if (configuration == null) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, id);
+ } else if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) { //$NON-NLS-1$
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, id);
+ }
+ }
+
+
+ protected void performDirectEdit(Point eventLocation) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ protected void performDirectEdit(char initialCharacter) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+
+ public IParser getParser() {
+ if (gep instanceof ITextAwareEditPart) {
+ return ((ITextAwareEditPart) gep).getParser();
+ }
+ else {
+ return null;
+ }
+ }
+
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ gep.getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(gep.isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public String getEditText() {
+ if(getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ protected EObject getParserElement() {
+ return gep.resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ protected IParser parser;
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ gep.getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(gep.isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = gep.resolveSemanticElement();
+ if(parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ /*
+ if(text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ */
+ return text;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
index 3e3d4bfaa01..deabbfa87c4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
@@ -34,6 +34,15 @@ import org.eclipse.uml2.uml.NamedElement;
*/
public abstract class NamedElementEditPart extends UMLNodeEditPart implements IUMLNamedElementEditPart {
+ /**
+ * CSS boolean property controlling whether stereotypes should be displayed
+ */
+ public static final String DISPLAY_STEREOTYPES = "displayStereotypes";
+
+ /**
+ * CSS boolean property controlling whether tags should be displayed
+ */
+ public static final String DISPLAY_TAGS = "displayTags";
/**
@@ -85,14 +94,24 @@ public abstract class NamedElementEditPart extends UMLNodeEditPart implements IU
protected void refreshLabelDisplay() {
View view = getNotationView();
BooleanValueStyle displayNameStyle = (BooleanValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), NameDisplayEditPolicy.DISPLAY_NAME);
+ BooleanValueStyle displayStereotypes = (BooleanValueStyle) view.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), DISPLAY_STEREOTYPES);
+ BooleanValueStyle displayTags = (BooleanValueStyle) view.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), DISPLAY_TAGS);
if(displayNameStyle != null && !displayNameStyle.isBooleanValue()) {
getNodeNamedElementFigure().removeNameLabel();
getNodeNamedElementFigure().removeStereotypeLabel();
getNodeNamedElementFigure().removeTaggedLabel();
} else {
getNodeNamedElementFigure().restoreNameLabel();
- getNodeNamedElementFigure().restoreStereotypeLabel();
- getNodeNamedElementFigure().restoreTaggedLabel();
+ if (displayStereotypes != null && !displayStereotypes.isBooleanValue()) {
+ getNodeNamedElementFigure().removeStereotypeLabel();
+ } else {
+ getNodeNamedElementFigure().restoreStereotypeLabel();
+ }
+ if (displayTags != null && !displayTags.isBooleanValue()) {
+ getNodeNamedElementFigure().removeTaggedLabel();
+ } else {
+ getNodeNamedElementFigure().restoreTaggedLabel();
+ }
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
index db0db81e772..b85fe5f0f3d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
@@ -309,4 +309,15 @@ public abstract class UMLConnectionNodeEditPart extends ConnectionEditPart imple
return out;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ if(width < 0) {
+ width = 1;
+ }
+ getPrimaryShape().setLineWidth(width);
+ }
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
index 243b254cd64..89e4566efa3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
+ * Copyright (c) 2009, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,16 +9,21 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429275
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.editpolicies;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.swt.graphics.Image;
@@ -55,7 +60,12 @@ public class AppliedStereotypeNodeLabelDisplayEditPolicy extends AppliedStereoty
// if (stereotypesToDisplay != "" || imageToDisplay != null) {
if(figure instanceof IPapyrusNodeUMLElementFigure) {
((IPapyrusNodeUMLElementFigure)figure).setStereotypeDisplay(tag + (stereotypesOnlyToDisplay().equals("") ? stereotypesToDisplay : stereotypesToDisplay), imageToDisplay);
- refreshAppliedStereotypesProperties(((IPapyrusNodeUMLElementFigure)figure));
+
+ if(figure instanceof IPapyrusNodeNamedElementFigure) {
+ refreshAppliedStereotypesProperties((IPapyrusNodeNamedElementFigure)figure);
+ } else {
+ refreshAppliedStereotypesProperties((IPapyrusNodeUMLElementFigure)figure);
+ }
}
// TODO we should manage PapyrusNodeFigure here too (and
// WrappingLabel ?)
@@ -65,6 +75,23 @@ public class AppliedStereotypeNodeLabelDisplayEditPolicy extends AppliedStereoty
/**
* Refreshes the displayed stereotypes properties for this edit part.
*/
+ protected void refreshAppliedStereotypesProperties(IPapyrusNodeNamedElementFigure figure) {
+ final String stereotypesPropertiesToDisplay = AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay((View)getHost().getModel());
+
+ refreshAppliedStereotypesPropertiesInCompartment(stereotypesPropertiesToDisplay, figure);
+ refreshAppliedStereotypesPropertiesInBrace(stereotypesPropertiesToDisplay, figure);
+
+ BooleanValueStyle displayStereotypes = (BooleanValueStyle) getView().getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), NamedElementEditPart.DISPLAY_STEREOTYPES);
+ if (displayStereotypes != null && !displayStereotypes.isBooleanValue()) {
+ figure.removeStereotypeLabel();
+ } else {
+ figure.restoreStereotypeLabel();
+ }
+ }
+
+ /**
+ * Refreshes the displayed stereotypes properties for this edit part.
+ */
protected void refreshAppliedStereotypesProperties(IPapyrusNodeUMLElementFigure figure) {
final String stereotypesPropertiesToDisplay = AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay((View)getHost().getModel());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
index 2374d47501e..efb89b91ae0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,20 +9,16 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.editpolicies;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
@@ -37,8 +33,8 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.notation.EObjectValueStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Element;
@@ -96,36 +92,25 @@ public class CommentShapeForAppliedStereotypeEditPolicy extends GraphicalEditPol
}
- protected void executeAppliedStereotypeCommentDeletion( final TransactionalEditingDomain domain, final View commentNode) {
- try {
- domain.runExclusive(new Runnable() {
+ protected void executeAppliedStereotypeCommentDeletion(final TransactionalEditingDomain domain, final View commentNode) {
+ if(commentNode != null) {
+ Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- //because it is asynchrone the comment node maybe become s null
- if( commentNode!= null&& TransactionUtil.getEditingDomain(commentNode)!=null){
- DeleteCommand command= new DeleteCommand(commentNode);
- Map<String,Boolean> options = new HashMap<String,Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try{
- InternalTransaction it=((InternalTransactionalEditingDomain) TransactionUtil.getEditingDomain(commentNode)).startTransaction(false, options);
- GMFtoEMFCommandWrapper warpperCmd= new GMFtoEMFCommandWrapper (command);
- warpperCmd.execute();
- it.commit();
- }catch(Exception e){
- Activator.log.error(e);
- }
- }
+ //because it is asynchronous the comment node's domain maybe become null
+ if(TransactionUtil.getEditingDomain(commentNode) == domain) {
+ DeleteCommand command = new DeleteCommand(commentNode);
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
}
- });
+ }
}
});
- } catch (Exception e) {
- Activator.log.error(e);
}
}
+
protected int getvisibleAppliedStereotypeCompartment(View view, EObject eobject){
int nbVisibleCompartment=0;
Iterator<View> iteratorView= view.getChildren().iterator();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java
index a69e5fa8710..20c2f3c77cf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java
@@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.draw2d.AbstractLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
@@ -163,13 +164,19 @@ public class AutomaticCompartmentLayoutManager extends AbstractLayout {
protected void layoutOthers(Rectangle container) {
int totalHeight = 0;
for(IFigure child : visibleOthers) {
- totalHeight += child.getPreferredSize().height;
+ totalHeight += child.getPreferredSize(50, -1).height;
}
IFigure previous = null;
for(IFigure child : visibleOthers) {
Rectangle bound = new Rectangle();
- bound.setSize(getPreferedSize(child));
+ if (child instanceof WrappingLabel) {
+ ((WrappingLabel) child).setTextWrap(true);
+ ((WrappingLabel) child).setTextJustification(PositionConstants.CENTER);
+ bound.setSize(child.getPreferredSize(container.width, -1));
+ } else {
+ bound.setSize(getPreferedSize(child));
+ }
if(previous != null) {
bound.y = previous.getBounds().getBottomLeft().y + 1;
bound.x = container.x + 3;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/RenamedElementHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/RenamedElementHandler.java
index f4d962e17a8..0753da97b69 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/RenamedElementHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/RenamedElementHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 350910
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.handlers;
@@ -20,13 +21,15 @@ import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
import org.eclipse.ui.PlatformUI;
/**
@@ -63,8 +66,10 @@ public class RenamedElementHandler extends AbstractHandler {
if(selection.size() == 1) {
IGraphicalEditPart editpart = selection.get(0);
DiagramEditPart diagramEP = DiagramEditPartsUtil.getDiagramEditPart(editpart);
- // we don't rename the diagram
- return editpart != diagramEP;
+ EObject modelElement = EMFHelper.getEObject(editpart);
+
+ // we don't rename the diagram nor read-only objects
+ return (editpart != diagramEP) && ((modelElement == null) || !EMFHelper.isReadOnly(modelElement));
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
index 8aba73da0cc..a12ed42a3c2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2007, 2009 Borland Software Corporation
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@ package org.eclipse.papyrus.uml.diagram.common.providers;
import static org.eclipse.papyrus.uml.diagram.common.Activator.log;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Observable;
@@ -55,26 +56,28 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
/**
* Refined by generated class
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider#createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget)
- *
+ *
* @param decoratorTarget
*/
+ @Override
public abstract void createDecorators(IDecoratorTarget decoratorTarget);
/**
* Refined by generated class
- *
+ *
* @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation)
- *
+ *
* @param operation
* @return
*/
+ @Override
public abstract boolean provides(IOperation operation);
/**
* Refresh the decorators of a specific view
- *
+ *
* @param view
*/
public static void refreshDecorators(View view) {
@@ -91,10 +94,12 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
}
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
try {
domain.runExclusive(new Runnable() {
+ @Override
public void run() {
decorator.refresh();
}
@@ -147,6 +152,7 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
decorationService.addListener(this);
TransactionUtil.getEditingDomain(view).runExclusive(new Runnable() {
+ @Override
public void run() {
StatusDecorator.this.viewId = view != null ? ViewUtil.getIdStr(view) : null;
StatusDecorator.this.editingDomain = TransactionUtil.getEditingDomain(view);
@@ -159,9 +165,10 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
/**
* Completely refresh the decorators of a view
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator#refresh()
*/
+ @Override
public void refresh() {
View view = (View)getDecoratorTarget().getAdapter(View.class);
if(view == null || view.eResource() == null) {
@@ -169,11 +176,14 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
}
if(view.getElement() != null) {
diagramDecorationAdapter.removeDecorations();
- List<IPapyrusDecoration> decorations = decorationService.getDecorations(view.getElement(), false);
+ List<IPapyrusDecoration> semanticDecorations = decorationService.getDecorations(view.getElement(), false);
+ List<IPapyrusDecoration> graphicalDecorations = decorationService.getDecorations(view, false);
+
+ List<IPapyrusDecoration> decorations = new LinkedList<IPapyrusDecoration>(semanticDecorations);
+ decorations.addAll(graphicalDecorations);
if(view instanceof Edge) {
diagramDecorationAdapter.setDecorationsEdge(decorations, 50, true);
- }
- else {
+ } else {
diagramDecorationAdapter.setDecorationsNode(decorations, 0, true);
}
}
@@ -181,15 +191,13 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
/**
* Refresh the decorators of a view when given a DecorationChange information.
- *
+ *
* @param change
* A decoration change, e.g. addition or removal
*/
public void refresh(DecorationChange change) {
- if(change.getChangeKind() == DecorationChangeKind.DecorationRemoved ||
- change.getChangeKind() == DecorationChangeKind.DecorationModified ||
- change.getChangeKind() == DecorationChangeKind.RefreshAll) {
+ if(change.getChangeKind() == DecorationChangeKind.DecorationRemoved || change.getChangeKind() == DecorationChangeKind.DecorationModified || change.getChangeKind() == DecorationChangeKind.RefreshAll) {
// always recreate all decorations, in case of a deletion (would require recalculation of positions) or
// if all decorations should be refreshed
refresh();
@@ -216,6 +224,7 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
* activate the decorators of this view.
* Register a listener for editing domain of the view
*/
+ @Override
public void activate() {
if(viewId == null) {
return;
@@ -252,12 +261,12 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
}
//Refresh when the decoration service adds a decoration
+ @Override
public void update(Observable o, Object arg) {
// check whether update is for this view
if(arg instanceof DecorationChange) {
DecorationChange change = (DecorationChange)arg;
- if((change.getChangeKind() == DecorationChangeKind.RefreshAll) ||
- (change.getDecoration().getElement() == element)) {
+ if((change.getChangeKind() == DecorationChangeKind.RefreshAll) || (change.getDecoration().getElement() == element)) {
refresh(change);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecorator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecorator.java
index abf19823ad5..5867a824ab3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecorator.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecorator.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2009-2010 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
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.diagram.common.service;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.ImageFigure;
import org.eclipse.draw2d.Locator;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
@@ -51,7 +52,7 @@ import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLPackage;
/**
- *
+ *
* The decorator to represent inherited element This decorator adds a small
* image ( the generalization icon) next to the UML Element which are inherited.
* 3 positions are defined for the decoration :
@@ -61,7 +62,10 @@ import org.eclipse.uml2.uml.UMLPackage;
* <li>else if the element is in a compartment list : {@link PositionConstants#EAST} and margin =-1</li>
* <li>else {@link PositionConstants#SOUTH_EAST} and margin = -1</li>
* </ul>
+ *
+ * @deprecated Replaced with the generic {@link org.eclipse.papyrus.infra.gmfdiag.common.decoration.ExternalReferenceMarker}
*/
+@Deprecated
public class InheritedDecorator implements IDecorator {
/** the object to be decorated */
@@ -82,7 +86,7 @@ public class InheritedDecorator implements IDecorator {
/**
* Creates a new <code>AbstractDecorator</code> for the decorator target
* passed in.
- *
+ *
* @param decoratorTarget
* the object to be decorated
*/
@@ -92,7 +96,7 @@ public class InheritedDecorator implements IDecorator {
/**
* Gets the object to be decorated.
- *
+ *
* @return Returns the object to be decorated
*/
protected IDecoratorTarget getDecoratorTarget() {
@@ -128,7 +132,7 @@ public class InheritedDecorator implements IDecorator {
* getDecoratorTargetClassifier Utility method to determine if the
* decoratorTarget is a supported type for this decorator and return the
* associated Classifier element.
- *
+ *
* @param decoratorTarget
* IDecoratorTarget to check and return valid Classifier target.
* @return node Node if IDecoratorTarget can be supported, null otherwise.
@@ -152,6 +156,7 @@ public class InheritedDecorator implements IDecorator {
* satisfied by the view passed in.
*/
+ @Override
public void refresh() {
removeDecoration();
@@ -200,7 +205,7 @@ public class InheritedDecorator implements IDecorator {
/**
* Returns a figure corresponding to this image
- *
+ *
* @param image
* a image
* @return a figure corresponding to this image
@@ -215,7 +220,7 @@ public class InheritedDecorator implements IDecorator {
/**
* Returns the direction to set the decorator for the node
- *
+ *
* @param node
* the node
* @return the direction to set the decorator for the node direction can be
@@ -259,7 +264,7 @@ public class InheritedDecorator implements IDecorator {
/**
* Tests if the compartment is a compartment list
- *
+ *
* @param node
* the node on which we want add an Overlay
* @return <code>true</code> if the compartment is managed by an {@link XYLayoutEditPolicy}
@@ -283,7 +288,7 @@ public class InheritedDecorator implements IDecorator {
/**
* Tests if the node is an inherited element
- *
+ *
* @param node
* a node
* @return <code>true</code> if the node is an inherited element <code>false</code> if not
@@ -320,7 +325,7 @@ public class InheritedDecorator implements IDecorator {
/**
* getDescriptionStyle Accessor to retrieve the description style from a
* Node.
- *
+ *
* @param node
* Node to retrieve the description style from.
* @return DescriptionStyle style object
@@ -335,11 +340,12 @@ public class InheritedDecorator implements IDecorator {
private NotificationListener notificationListener = new NotificationListener() {
/**
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
+ *
* @param notification
*/
+ @Override
public void notifyChanged(Notification notification) {
if(notification.getEventType() == Notification.REMOVE) {
@@ -367,6 +373,7 @@ public class InheritedDecorator implements IDecorator {
* <li>graphical parent, when its a {@link Property} (we add the listener on its Type)</li>
* </ul>
*/
+ @Override
public void activate() {
IGraphicalEditPart gep = (IGraphicalEditPart)getDecoratorTarget().getAdapter(IGraphicalEditPart.class);
@@ -420,7 +427,7 @@ public class InheritedDecorator implements IDecorator {
/**
* Tests if the element can be inherited
- *
+ *
* @param semanticElement
* the element to test
* @return <code>true</code> if the element can be inherited
@@ -443,6 +450,7 @@ public class InheritedDecorator implements IDecorator {
/**
* Removes the listeners and the decorations
*/
+ @Override
public void deactivate() {
removeDecoration();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecoratorProvider.java
index b32623585bb..39f51b7f6d4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecoratorProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/InheritedDecoratorProvider.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2009-2010 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
@@ -22,21 +22,24 @@ import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
import org.eclipse.gmf.runtime.notation.Node;
/**
- *
+ *
* Provide the decorator for the Inheritance
- *
+ *
+ * @deprecated Replaced with the generic {@link org.eclipse.papyrus.infra.gmfdiag.common.decoration.ExternalReferenceMarker}
*/
+@Deprecated
public class InheritedDecoratorProvider extends AbstractProvider implements IDecoratorProvider {
/** The key used for the mood decoration */
public static final String GENERALIZATION = "Generalization"; //$NON-NLS-1$
/**
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider#createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget)
- *
+ *
* @param decoratorTarget
*/
+ @Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
Node node = InheritedDecorator.getDecoratorTargetNode(decoratorTarget);
if(node != null) {
@@ -46,11 +49,12 @@ public class InheritedDecoratorProvider extends AbstractProvider implements IDec
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.gmf.runtime.common.core.internal.service.IProvider#provides
* (org.eclipse.gmf.runtime.common.core.service.IOperation)
*/
+ @Override
public boolean provides(IOperation operation) {
Assert.isNotNull(operation);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java
index c1225d97286..bb38703e727 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/PropertyEditors.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -19,12 +19,11 @@ import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.papyrus.infra.widgets.validator.IntegerInputValidator;
import org.eclipse.papyrus.infra.widgets.validator.RealInputValidator;
import org.eclipse.papyrus.infra.widgets.validator.UnlimitedNaturalInputValidator;
import org.eclipse.papyrus.uml.diagram.common.Messages;
-import org.eclipse.papyrus.uml.diagram.common.util.Util;
+import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.common.util.UML2Util;
import org.eclipse.uml2.uml.Element;
@@ -46,11 +45,11 @@ public class PropertyEditors {
*/
/** IntegerEditor Title */
public static final String IntegerEditor_Title = Messages.PropertyEditors_IntegerTitle;
-
+
/** IntegerEditor Title */
public static final String RealEditor_Title = Messages.PropertyEditors_RealTitle;
-
-
+
+
/** UnlimitedNaturalEditor Title */
public static final String UnlimitedNaturalEditor_Title = Messages.PropertyEditors_UnlimitedNaturalTitle;
@@ -147,7 +146,7 @@ public class PropertyEditors {
}
return value;
}
-
+
/**
*
* @param property
@@ -186,7 +185,7 @@ public class PropertyEditors {
value = dialog.getValue();
}
} else {
- if(value != null) {
+ if(oldValue != null) {
value = oldValue.toString();
}
}
@@ -361,7 +360,7 @@ public class PropertyEditors {
* we research all the elements stereotyped with type!
*/
for(Profile profile : appliedProfiles) {
- stereotypedElement.addAll(Util.getInstancesFilteredByType(profile, null, (Stereotype)type));
+ stereotypedElement.addAll(ElementUtil.getInstancesFilteredByType(profile, null, (Stereotype)type));
}
if(property.getLower() > 0) {
@@ -439,14 +438,14 @@ public class PropertyEditors {
String metaclassName = ((org.eclipse.uml2.uml.Class)type).getName();
// Try to retrieve type of the metaclass
- java.lang.Class metaType = null;
+ java.lang.Class<? extends Element> metaType = null;
try {
- metaType = java.lang.Class.forName("org.eclipse.uml2.uml." + metaclassName); //$NON-NLS-1$
+ metaType = java.lang.Class.forName("org.eclipse.uml2.uml." + metaclassName).asSubclass(Element.class); //$NON-NLS-1$
} catch (Exception e) {
e.printStackTrace();
}
for(Profile profile : appliedProfiles) {
- metaclassElement.addAll(Util.getInstancesFilteredByType(profile, metaType, null));
+ metaclassElement.addAll(ElementUtil.getInstancesFilteredByType(profile, metaType, null));
}
/*
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/Util.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/Util.java
index c1845cea468..6b5f6d20d32 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/Util.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/Util.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,13 +10,12 @@
* Contributors:
* Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Modification
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.util;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -31,11 +30,10 @@ import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ElementImport;
import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.Generalization;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.PackageImport;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Property;
@@ -83,96 +81,9 @@ public class Util {
* may be null, metatype is ignored if not null
* @return an arraylist containing the selected instances
*/
- public static ArrayList getInstancesFilteredByType(Package topPackage, Class metaType, Stereotype appliedStereotype) {
- // List<EObject> elements = ElementUtil.getInstancesFilteredByType(topPackage, metaType, appliedStereotype);
- // return new ArrayList<EObject>(elements);
- // retrieve parent element
- // Package topPackage = Util.topPackage(element);
- // Assert.isNotNull(topPackage,
- // "Top package should not be null for element " + element);
- Iterator iter = topPackage.eAllContents();
- ArrayList filteredElements = new ArrayList();
-
- while(iter.hasNext()) {
- Object currentElt = iter.next();
-
- // If currentElt is an ElementImport, it is replaced by the imported
- // Element.
- if(currentElt instanceof ElementImport) {
- ElementImport elementImport = (ElementImport)currentElt;
- currentElt = elementImport.getImportedElement();
- }
-
- /* package imports treatment */
- else if(currentElt instanceof PackageImport) {
- Iterator piIter = ((PackageImport)currentElt).getImportedPackage().eAllContents();
- while(piIter.hasNext()) {
- Object piCurrentElt = piIter.next();
- if(piCurrentElt instanceof Element) {
- if(appliedStereotype != null) {
-
- Iterator appStIter = ((Element)piCurrentElt).getAppliedStereotypes().iterator();
- while(appStIter.hasNext()) {
- Stereotype currentSt = (Stereotype)appStIter.next();
-
- if(currentSt.conformsTo(appliedStereotype)) {
- filteredElements.add(piCurrentElt);
- }
- }
-
- } else { // if (appliedStereotype == null)
- if(metaType.isInstance(piCurrentElt)) {
- filteredElements.add(piCurrentElt);
- }
-
- /** add imported meta elements */
- else if(piCurrentElt instanceof ElementImport) {
- Iterator eIter = ((ElementImport)piCurrentElt).getImportedElement().eAllContents();
- while(eIter.hasNext()) {
- Object currentEIelt = eIter.next();
- if(metaType.isInstance(currentEIelt))
- filteredElements.add(currentEIelt);
- }
- }
- }
- }
-
- }
- }
-
- // Filtering elements
- if(currentElt instanceof Element) {
-
- if(appliedStereotype != null) {
-
- Iterator appStIter = ((Element)currentElt).getAppliedStereotypes().iterator();
- while(appStIter.hasNext()) {
- Stereotype currentSt = (Stereotype)appStIter.next();
-
- if(currentSt.conformsTo(appliedStereotype)) {
- filteredElements.add(currentElt);
- }
- }
-
- } else { // if (appliedStereotype == null)
- if(metaType.isInstance(currentElt)) {
- filteredElements.add(currentElt);
- }
-
- /** add imported meta elements */
- else if(currentElt instanceof ElementImport) {
- Iterator eIter = ((ElementImport)currentElt).getImportedElement().eAllContents();
- while(eIter.hasNext()) {
- Object currentEIelt = eIter.next();
- if(metaType.isInstance(currentEIelt))
- filteredElements.add(currentEIelt);
- }
- }
- }
- }
- }
-
- return filteredElements;
+ @Deprecated
+ public static <T extends EObject> List<T> getInstancesFilteredByType(Package topPackage, Class<T> metaType, Stereotype appliedStereotype) {
+ return ElementUtil.getInstancesFilteredByType(topPackage, metaType, appliedStereotype);
}
/**
@@ -268,7 +179,7 @@ public class Util {
*
*/
public static Object getValueFromString(Property property, ArrayList<String> stringValues) {
- ArrayList returnedValue = new ArrayList();
+ List<Object> returnedValue = new ArrayList<Object>();
Type type = property.getType();
if(type instanceof PrimitiveType) {
@@ -320,22 +231,22 @@ public class Util {
// the applied profiles
EList<Profile> profiles = ((org.eclipse.uml2.uml.Package)packageContainer).getAllAppliedProfiles();
- ArrayList<Object> returnedValues = new ArrayList<Object>();
- ArrayList<Object> metaclassElement = new ArrayList<Object>();
+ List<Element> returnedValues = new ArrayList<Element>();
+ List<Element> metaclassElement = new ArrayList<Element>();
String metaclassName = ((org.eclipse.uml2.uml.Class)property.getType()).getName();
/*
* we research all the representation of the metaclass in the Profiles
*/
// Try to retrieve type of the metaclass
- java.lang.Class metaType = null;
+ java.lang.Class<? extends Element> metaType = null;
try {
- metaType = java.lang.Class.forName("org.eclipse.uml2.uml." + metaclassName); //$NON-NLS-1$
+ metaType = java.lang.Class.forName("org.eclipse.uml2.uml." + metaclassName).asSubclass(Element.class); //$NON-NLS-1$
} catch (Exception e) {
e.printStackTrace();
}
for(Profile profile : profiles) {
- metaclassElement.addAll(Util.getInstancesFilteredByType(profile, metaType, null));
+ metaclassElement.addAll(ElementUtil.getInstancesFilteredByType(profile, metaType, null));
}
/*
@@ -346,7 +257,7 @@ public class Util {
for(Object metaclassRepresentation : metaclassElement) {
if(metaclassRepresentation instanceof NamedElement) {
if(((NamedElement)metaclassRepresentation).getQualifiedName().equals(valuesQualifiedName)) {
- ((ArrayList)returnedValues).add(metaclassRepresentation);
+ returnedValues.add((NamedElement)metaclassRepresentation);
}
}
}
@@ -380,7 +291,7 @@ public class Util {
* we research all the representation of the stereotype in the Profiles
*/
for(Profile profile : profiles) {
- stereotypedElement.addAll(Util.getInstancesFilteredByType(profile, null, (Stereotype)property.getType()));
+ stereotypedElement.addAll(ElementUtil.getInstancesFilteredByType(profile, null, (Stereotype)property.getType()));
}
/*
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
index 663ec2ad8c6..626e58bc97d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2010, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
@@ -555,7 +568,8 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.communication.ConstraintConstrainedElement_8011"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.communication.DurationObservationEvent_8012"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.communication.TimeObservationEvent_8013"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/ui/CreateUmlElementDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/ui/CreateUmlElementDialog.java
index 06266f5718f..9485cc9857a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/ui/CreateUmlElementDialog.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/ui/CreateUmlElementDialog.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -29,6 +29,7 @@ import org.eclipse.gef.commands.Command;
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.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
@@ -41,8 +42,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.common.util.Util;
import org.eclipse.papyrus.uml.diagram.component.custom.messages.Messages;
+import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -97,7 +98,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param parent
* the parent
* @param domain
@@ -133,7 +134,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Sets the forbidden names.
- *
+ *
* @param forbiddenNames
* the new forbidden names
*/
@@ -143,7 +144,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Creates the dialog area.
- *
+ *
* @param parent
* the parent
* @return the control
@@ -168,7 +169,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Creates the name section and put it at the top of the composite.
- *
+ *
* @param parent
* the composite parent
*/
@@ -198,7 +199,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns the default name for the new Element.
- *
+ *
* @return the default name
* the default name for the new Element
*/
@@ -209,7 +210,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
int max = 0;
do {
- ArrayList<?> allInterface = Util.getInstancesFilteredByType(pack, Interface.class, null);
+ List<Interface> allInterface = ElementUtil.getInstancesFilteredByType(pack, Interface.class, null);
for(Object object : allInterface) {
String name = NamedElementUtil.getName((NamedElement)object);
if(name != null && name.startsWith(type)) {
@@ -238,10 +239,10 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Tests if the proposed name is not forbidden.
- *
- * @param name a name
- * @return true, if is correct name
- * <code>true</code> if the proposed name is not forbidden
+ *
+ * @param name
+ * a name
+ * @return true, if is correct name <code>true</code> if the proposed name is not forbidden
*/
protected boolean isCorrectName(String name) {
if(forbiddenNames == null) {
@@ -252,7 +253,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns the command to create the new element which the chosen name.
- *
+ *
* @return the command
* the command to create the new element which the chosen name
*/
@@ -277,7 +278,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Compute result.
- *
+ *
* @see org.eclipse.ui.dialogs.ElementTreeSelectionDialog#computeResult()
*/
@Override
@@ -289,7 +290,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Set the value to {@link #name} and {@link #parentContainer}.
- *
+ *
* @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
*/
@Override
@@ -306,7 +307,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns a command corresponding to this request.
- *
+ *
* @param request
* a request
* @return the command
@@ -335,7 +336,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param domain
* the domain
* @param label
@@ -354,7 +355,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Do execute with result.
- *
+ *
* @param monitor
* the monitor
* @param info
@@ -379,7 +380,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* This command allows to create a new element when its parent is not yet created when the command is build
- *
+ *
* We need a such command, because {@link CreateRelationshipCommand#getCommandResult()} return <code>null</code> when the command has not been
* executed.
*/
@@ -390,7 +391,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param domain
* the domain
* @param label
@@ -407,7 +408,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Do execute with result.
- *
+ *
* @param monitor
* the monitor
* @param info
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml
index 35b9385e01c..e5554d74cfb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2011, 2014 LIFL, CEA, 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:
+ LIFL - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension
point="org.eclipse.ui.commands">
@@ -776,7 +789,8 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.component.Dependency_4017"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.component.Link_4018"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.component.Connector_4019"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java
index 6ccb7b8c931..03df5d81052 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -304,6 +304,20 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
protected Command getCreateCommand(CreateElementRequest req) {
// no more usage of the extended types here.
+ IElementType requestElementType = req.getElementType();
+ if (requestElementType instanceof IExtendedHintedElementType) {
+ IExtendedHintedElementType extendedElementType = (IExtendedHintedElementType) requestElementType;
+
+ // try to get a semantic create command from the extended type
+ IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(req.getContainer());
+ if (commandProvider != null) {
+ ICommand command = commandProvider.getEditCommand(req);
+ if (command != null && command.canExecute()) {
+ return new ICommandProxy(command);
+ }
+ }
+ }
+
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java
index 2b59263a126..cee084d6808 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java
@@ -231,10 +231,16 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
if(elementType != null) {
if(elementType instanceof IExtendedHintedElementType) {
- IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType);
- if(!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) {
- return false; // foreign element type.
+// if(elementType instanceof IExtendedHintedElementType) {
+ if(domainElement !=null) {
+ if(!UMLVisualIDRegistry.checkNodeVisualID(op.getContainerView(), domainElement, visualID)) {
+ return false;
+ }
}
+// IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType);
+// if(!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) {
+// return false; // foreign element type.
+// }
} else {
if(!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
return false; // foreign element type
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomConstraintEditPart.java
new file mode 100644
index 00000000000..b1d08bf44b6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomConstraintEditPart.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPart;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("restriction")
+public class CustomConstraintEditPart extends ConstraintEditPart {
+
+ public CustomConstraintEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+ EditPart editPart = this;
+ if (request instanceof DirectEditRequest){
+ Point p = new Point(((DirectEditRequest)request).getLocation());
+ getFigure().translateToRelative(p);
+ IFigure fig = getFigure().findFigureAt(p);
+ editPart =(EditPart) getViewer().getVisualPartMap().get(fig);
+ }
+ if (editPart == this) {
+ try {
+ editPart = (EditPart) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ // edit body, which can be found in 2nd child, instead of default action (first child)
+ setResult(getChildren().get(1));
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ }
+ if (editPart != null){
+ editPart.performRequest(request);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomConstraintEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomConstraintEditPartCN.java
new file mode 100644
index 00000000000..a55e77f6a38
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomConstraintEditPartCN.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPartCN;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("restriction")
+public class CustomConstraintEditPartCN extends ConstraintEditPartCN {
+
+ public CustomConstraintEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+ EditPart editPart = this;
+ if (request instanceof DirectEditRequest){
+ Point p = new Point(((DirectEditRequest)request).getLocation());
+ getFigure().translateToRelative(p);
+ IFigure fig = getFigure().findFigureAt(p);
+ editPart =(EditPart) getViewer().getVisualPartMap().get(fig);
+ }
+ if (editPart == this) {
+ try {
+ editPart = (EditPart) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ // edit body, which can be found in 2nd child, instead of default action (first child)
+ setResult(getChildren().get(1));
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ }
+ if (editPart != null){
+ editPart.performRequest(request);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
index c105dd946f1..dc3a9a0ede8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
@@ -15,7 +15,8 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.BehaviorPortEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.UMLEditPartFactory;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
@@ -35,10 +36,12 @@ public class CustomEditPartFactory extends UMLEditPartFactory {
case ConnectorMultiplicitySourceEditPart.VISUAL_ID:
return new ConnectorMultiplicitySourceEditPart(view);
-
case ConnectorMultiplicityTargetEditPart.VISUAL_ID:
return new ConnectorMultiplicityTargetEditPart(view);
-
+ case ConstraintEditPart.VISUAL_ID:
+ return new CustomConstraintEditPart(view);
+ case ConstraintEditPartCN.VISUAL_ID:
+ return new CustomConstraintEditPartCN(view);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
index 061e5619d54..6191de88a05 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
@@ -1,5 +1,5 @@
-/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
+/*****************************************************************************
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -7,24 +7,20 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Contributors:
+ * Patrick Tessier (CEA LIST) - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
@@ -37,14 +33,12 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.command.CreateBehaviorPortCommand;
import org.eclipse.papyrus.uml.diagram.composite.custom.locators.BehaviorPortLocator;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.BehaviorPortLinkEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.UMLPackage;
@@ -86,34 +80,14 @@ public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements Notif
}
protected void executeBehaviorPortDeletion( final TransactionalEditingDomain domain, final View behaviorNode) {
- try {
- domain.runExclusive(new Runnable() {
-
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
- //because it is asynchrone the comment node maybe become s null
- if( behaviorNode!= null&& TransactionUtil.getEditingDomain(behaviorNode)!=null){
- DeleteCommand command= new DeleteCommand(behaviorNode);
- //use to avoid to put it in the command stack
- Map<String,Boolean> options = new HashMap<String,Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try{
- InternalTransaction it=((InternalTransactionalEditingDomain) TransactionUtil.getEditingDomain(behaviorNode)).startTransaction(false, options);
- GMFtoEMFCommandWrapper warpperCmd= new GMFtoEMFCommandWrapper (command);
- warpperCmd.execute();
- it.commit();
- }catch(Exception e){
- Activator.log.error(e);
- }
- }
- }
- });
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
+ if((behaviorNode != null) && (TransactionUtil.getEditingDomain(behaviorNode) == domain)) {
+ DeleteCommand command = new DeleteCommand(behaviorNode);
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
}
}
@@ -154,33 +128,12 @@ public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements Notif
}
protected void executeBehaviorPortCreation(final EditPart editPart, final EditPart port,final TransactionalEditingDomain domain, final Rectangle position){
+ CreateBehaviorPortCommand command = new CreateBehaviorPortCommand(domain, (View)editPart.getModel(), (View)port.getModel(), position);
+ //use to avoid to put it in the command stack
try {
- domain.runExclusive(new Runnable() {
-
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
- CreateBehaviorPortCommand command = new CreateBehaviorPortCommand(domain, (View)editPart.getModel(), (View)port.getModel(), position);
- //use to avoid to put it in the command stack
- Map<String,Boolean> options = new HashMap<String,Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try{
- InternalTransaction it=((InternalTransactionalEditingDomain) domain).startTransaction(false, options);
- command.execute();
- it.commit();
- }catch(Exception e){
- Activator.log.error(e);
- }
- }
- }
- );
- }
- }
- );
- }
- catch(Exception e){
-
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
}
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorSymbolEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorSymbolEditPolicy.java
index f57a023bc96..adce2c33864 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorSymbolEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorSymbolEditPolicy.java
@@ -1,5 +1,5 @@
-/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
+/*****************************************************************************
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -7,21 +7,17 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Contributors:
+ * Patrick Tessier (CEA LIST) - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
@@ -32,12 +28,10 @@ import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.BehaviorPortLinkEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Element;
/**
* This editpolicy listen the notation node of the PortEditpart, when it is removed the notation representation of the symbol is removed.
@@ -154,29 +148,18 @@ public class BehaviorSymbolEditPolicy extends GraphicalEditPolicy implements Not
}
protected void executeBehaviorSymbolDeletion( final TransactionalEditingDomain domain, final View commentNode) {
try {
- if( domain!=null){
+ if(domain != null) {
domain.runExclusive(new Runnable() {
public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
- //because it is asynchrone the comment node maybe become s null
- if( commentNode!= null&& TransactionUtil.getEditingDomain(commentNode)!=null){
- DeleteCommand command= new DeleteCommand(commentNode);
- Map<String,Boolean> options = new HashMap<String,Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try{
- InternalTransaction it=((InternalTransactionalEditingDomain) TransactionUtil.getEditingDomain(commentNode)).startTransaction(false, options);
- GMFtoEMFCommandWrapper warpperCmd= new GMFtoEMFCommandWrapper (command);
- warpperCmd.execute();
- it.commit();
- }catch(Exception e){
- Activator.log.error(e);
- }
- }
+ if((commentNode != null) && (TransactionUtil.getEditingDomain(commentNode) != null)) {
+ DeleteCommand command = new DeleteCommand(commentNode);
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
}
- });
+ }
}
});
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CreateUmlElementDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CreateUmlElementDialog.java
index 4c581458ee5..9def59bb639 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CreateUmlElementDialog.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/CreateUmlElementDialog.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2009-2011 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
@@ -29,9 +29,11 @@ import org.eclipse.gef.commands.Command;
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.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -40,8 +42,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.common.util.Util;
import org.eclipse.papyrus.uml.diagram.composite.custom.messages.Messages;
+import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -95,7 +97,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param parent
* the parent
* @param domain
@@ -131,7 +133,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Sets the forbidden names.
- *
+ *
* @param forbiddenNames
* the new forbidden names
*/
@@ -141,7 +143,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Creates the dialog area.
- *
+ *
* @param parent
* the parent
* @return the control
@@ -166,7 +168,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Creates the name section and put it at the top of the composite.
- *
+ *
* @param parent
* the composite parent
*/
@@ -196,7 +198,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns the default name for the new Element.
- *
+ *
* @return the default name
* the default name for the new Element
*/
@@ -207,7 +209,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
int max = 0;
do {
- ArrayList<?> allInterface = Util.getInstancesFilteredByType(pack, Interface.class, null);
+ List<Interface> allInterface = ElementUtil.getInstancesFilteredByType(pack, Interface.class, null);
for(Object object : allInterface) {
String name = NamedElementUtil.getName((NamedElement)object);
if(name != null && name.startsWith(type)) {
@@ -236,7 +238,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Tests if the proposed name is not forbidden
- *
+ *
* @param name
* a name
* @return
@@ -251,7 +253,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns the command to create the new element which the chosen name.
- *
+ *
* @return the command
* the command to create the new element which the chosen name
*/
@@ -276,7 +278,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Compute result.
- *
+ *
* @see org.eclipse.ui.dialogs.ElementTreeSelectionDialog#computeResult()
*/
@Override
@@ -288,7 +290,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Set the value to {@link #name} and {@link #parentContainer}.
- *
+ *
* @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
*/
@Override
@@ -305,7 +307,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Returns a command corresponding to this request.
- *
+ *
* @param request
* a request
* @return the command
@@ -334,7 +336,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param domain
* the domain
* @param label
@@ -353,7 +355,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Do execute with result.
- *
+ *
* @param monitor
* the monitor
* @param info
@@ -378,7 +380,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* This command allows to create a new element when its parent is not yet created when the command is build
- *
+ *
* We need a such command, because {@link CreateRelationshipCommand#getCommandResult()} return <code>null</code> when the command has not been
* executed.
*/
@@ -389,7 +391,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Constructor.
- *
+ *
* @param domain
* the domain
* @param label
@@ -406,7 +408,7 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog {
/**
* Do execute with result.
- *
+ *
* @param monitor
* the monitor
* @param info
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InterfaceManagerDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InterfaceManagerDialog.java
index 0b7fbcb2ced..a1539ffe449 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InterfaceManagerDialog.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/ui/InterfaceManagerDialog.java
@@ -1,14 +1,14 @@
/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
+ * Copyright (c) 2009-2011 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:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.ui;
@@ -59,6 +59,7 @@ import org.eclipse.papyrus.uml.diagram.composite.custom.messages.Messages;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
+import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.SelectionEvent;
@@ -241,7 +242,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* This method fills the map {@link #requiredInterfacesMappedWithUsage}
*/
protected void buildRequiredInterfaces() {
- List<?> allUsage = Util.getInstancesFilteredByType(this.model, Usage.class, null);
+ List<Usage> allUsage = ElementUtil.getInstancesFilteredByType(this.model, Usage.class, null);
List<Classifier> classifiers = new ArrayList<Classifier>();
classifiers.add((Classifier)this.port.getType());
@@ -274,7 +275,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* This method fills the map {@link #providedInterfacesMappedWithRealization}
*/
protected void buildProvidedInterfaces() {
- List<?> allRealization = Util.getInstancesFilteredByType(this.model, Realization.class, null);
+ List<Realization> allRealization = ElementUtil.getInstancesFilteredByType(this.model, Realization.class, null);
List<Classifier> classifiers = new ArrayList<Classifier>();
classifiers.add((Classifier)this.port.getType());
@@ -318,6 +319,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
*
* @return
*/
+ @Override
public Object[] getElements() {
List<Object> tmp = new ArrayList<Object>();
tmp.addAll(getAllAvailableInterfaces(model));
@@ -340,6 +342,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
*
* @return
*/
+ @Override
public Object[] getElements() {
List<Object> tmp = new ArrayList<Object>();
tmp.addAll(getAllAvailableInterfaces(model));
@@ -587,6 +590,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
*
* @param e
*/
+ @Override
public void widgetSelected(SelectionEvent e) {
CreateUmlElementDialog dialog = new CreateUmlElementDialog(getShell(), domain, newElementLabelProvider, new CustomContentProvider(), model, UMLElementTypes.INTERFACE);
dialog.setTitle(Messages.InterfaceManagerDialog_CreateANewInterface);
@@ -617,6 +621,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
*
* @param e
*/
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
}
@@ -640,6 +645,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* @param selection
* @return
*/
+ @Override
public IStatus validate(Object[] selection) {
IStatus status = new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, Messages.NoSelectionFound);
@@ -734,6 +740,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*
*/
+ @Override
public void dispose() {
}
@@ -745,6 +752,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* @param oldInput
* @param newInput
*/
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@@ -756,6 +764,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* @param inputElement
* @return
*/
+ @Override
public Object[] getElements(Object inputElement) {
if(inputElement instanceof List<?>) {
return ((List<?>)inputElement).toArray();
@@ -770,6 +779,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* @param parentElement
* @return
*/
+ @Override
public Object[] getChildren(Object parentElement) {
List<Object> children = new ArrayList<Object>();
List<?> tmp = null;
@@ -801,6 +811,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* @param element
* @return
*/
+ @Override
public Object getParent(Object element) {
if(element == model) {
return model;
@@ -817,6 +828,7 @@ public class InterfaceManagerDialog extends SelectionDialog {
* @param element
* @return
*/
+ @Override
public boolean hasChildren(Object element) {
return getChildren(element).length != 0;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
index 3297771e67f..4f4f41e5ce9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
@@ -3653,7 +3653,7 @@
<children xsi:type="gmfgen:GenStandardPreferencePage" iD="org.eclipse.uml2.uml.diagram.rulersAndGrid" name="Rulers And Grid" kind="RulersAndGrid"/>
</preferencePages>
</diagram>
- <plugin iD="org.eclipse.papyrus.uml.diagram.composite" name="Papyrus Composite Structure Diagram (Incubation)" provider="Eclipse Modeling Project" version="0.10.0.qualifier">
+ <plugin iD="org.eclipse.papyrus.uml.diagram.composite" name="Papyrus Composite Structure Diagram (Incubation)" provider="Eclipse Modeling Project" version="1.0.0.qualifier">
<requiredPlugins>org.eclipse.draw2d</requiredPlugins>
<requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
index 69b8c144132..22626c268ed 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension point="org.eclipse.ui.contexts" id="ui-context">
@@ -1528,6 +1541,7 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.composite.Representation_4020"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.composite.InformationFlow_4021"/>
<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/CollaborationUseNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/CollaborationUseNameEditPart.java
index 622c73e346a..fe00af508e1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/CollaborationUseNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/CollaborationUseNameEditPart.java
@@ -53,6 +53,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -62,6 +63,7 @@ import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -84,7 +86,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class CollaborationUseNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class CollaborationUseNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -410,7 +412,11 @@ public class CollaborationUseNameEditPart extends PapyrusCompartmentEditPart imp
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -466,6 +472,40 @@ public class CollaborationUseNameEditPart extends PapyrusCompartmentEditPart imp
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
index 7adf20f03c3..ee91df45227 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
@@ -55,6 +55,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -63,6 +64,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
@@ -85,7 +87,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
+public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider, IControlParserForDirectEdit {
/**
* @generated
@@ -439,7 +441,11 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -495,6 +501,40 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PropertyPartNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PropertyPartNameEditPartCN.java
index 45f8b3bd585..16e14f46814 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PropertyPartNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PropertyPartNameEditPartCN.java
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -85,7 +86,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -413,11 +414,9 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
Dialog dialog = null;
if(configuration instanceof ICustomDirectEditorConfiguration) {
setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
- setParser(((ICustomDirectEditorConfiguration)configuration).createParser(this.resolveSemanticElement()));
initializeDirectEditManager(theRequest);
return;
- }
- if(configuration instanceof IPopupEditorConfiguration) {
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -565,6 +564,7 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
e.printStackTrace();
}
}
+
/**
* @generated
*/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/providers/UMLViewProvider.java
index 179b03cc4e9..f1cd92bfe55 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/providers/UMLViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/providers/UMLViewProvider.java
@@ -150,6 +150,11 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
if(elementType != null) {
if(elementType instanceof IExtendedHintedElementType) {
+ if(domainElement !=null) {
+ if(!UMLVisualIDRegistry.checkNodeVisualID(op.getContainerView(), domainElement, visualID)) {
+ return false;
+ }
+ }
// IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType);
// if(!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) {
// return false; // foreign element type.
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
index 8b1bdb752c6..3ccd454eb85 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2011, 2014 LIFL, CEA, 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:
+ LIFL - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension
point="org.eclipse.ui.commands">
@@ -1110,7 +1123,8 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Generalization_4003"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4004"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml
index 5ffcfbc10c8..5a4203eb4bd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2013, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<!-- Diagram declaration -->
@@ -817,6 +830,9 @@
ref="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.advices.CallBehaviorActionAsInteractionUseEditHelperAdvice">
</advice>
</binding>
+ <binding context="org.eclipse.papyrus.uml.diagram.activity.TypeContext">
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
+ </binding>
</extension>
<extension
point="org.eclipse.ui.commands">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/part/CallBehaviorActionAsInteractionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/part/CallBehaviorActionAsInteractionEditPart.java
index a064f57bd17..06253631f8a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/part/CallBehaviorActionAsInteractionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/part/CallBehaviorActionAsInteractionEditPart.java
@@ -1,20 +1,22 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 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
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Shape;
@@ -22,9 +24,6 @@ import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
@@ -51,6 +50,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.activity.edit.parts.AcceptEventActionEditPart;
import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInCallBeActEditPart;
import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInCallOpActAsTargetEditPart;
@@ -952,34 +952,8 @@ public class CallBehaviorActionAsInteractionEditPart extends NamedElementEditPar
final CreateSnapshotForInteractionFromRefreshCommand command = CreateSnapshotForInteractionFromRefreshCommand.create((View)getModel(), (GraphicalEditPart)getParent());
//use to avoid to put it in the command stack
- final Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- final InternalTransactionalEditingDomain editingDomain = (InternalTransactionalEditingDomain)getEditingDomain();
try {
- if(editingDomain.getActiveTransaction() == null) {
- //Should not happen
- final InternalTransaction transaction = editingDomain.startTransaction(false, options);
- command.execute(null, null);
- transaction.commit();
- } else {
- final InternalTransaction activeTransaction = editingDomain.getActiveTransaction();
- if(activeTransaction.isReadOnly()) {
- editingDomain.deactivate(activeTransaction);
- try {
- final InternalTransaction it = editingDomain.startTransaction(false, options);
- command.execute(null, null);
- it.commit();
- } finally {
- editingDomain.activate(activeTransaction);
- }
- } else {
- command.execute(null, null);
- }
- }
-
- final InternalTransaction it = ((InternalTransactionalEditingDomain)getEditingDomain()).startTransaction(false, options);
- command.execute(null, null);
- it.commit();
+ GMFUnsafe.write(getEditingDomain(), command);
} catch (final Exception e) {
Activator.log.error(e);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/plugin.xml
index 05523ce2369..e8885b3065c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/plugin.xml
@@ -21,21 +21,6 @@
rule="org.eclipse.papyrus.uml.diagram.navigation.TransitionRule"></navigationRule>
</extension>
<extension
- point="org.eclipse.papyrus.infra.gmfdiag.navigation.navigationDecoratorRules">
- <decoratedClass
- class="org.eclipse.uml2.uml.BehavioredClassifier">
- </decoratedClass>
- <decoratedClass
- class="org.eclipse.uml2.uml.CallBehaviorAction">
- </decoratedClass>
- <decoratedClass
- class="org.eclipse.uml2.uml.Transition">
- </decoratedClass>
- <decoratedClass
- class="org.eclipse.uml2.uml.State">
- </decoratedClass>
- </extension>
- <extension
point="org.eclipse.papyrus.infra.gmfdiag.navigation.navigationColorProviders">
<navigationColorProvider
provider="org.eclipse.papyrus.uml.diagram.navigation.UMLNavigationColorProvider">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF
index a4b99596499..aa5e48aea01 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF
@@ -1,10 +1,14 @@
Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider
-Require-Bundle: org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.uml.diagram.paletteconfiguration;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.emf.edit;visibility:=reexport,
org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.papyrus.uml.diagram.paletteconfiguration;bundle-version="1.0.0",
+ org.eclipse.emf.edit,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.edit,
org.eclipse.uml2.uml,
org.eclipse.uml2.uml.edit,
org.eclipse.papyrus.emf.facet.efacet.metamodel.edit
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomSemanticCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomSemanticCreateCommand.java
index a317c0e993a..0b7e5758236 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomSemanticCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomSemanticCreateCommand.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,15 +9,13 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.profile.custom.commands;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -34,7 +32,6 @@ import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
@@ -46,7 +43,6 @@ import org.eclipse.papyrus.uml.diagram.profile.custom.messages.Messages;
import org.eclipse.papyrus.uml.diagram.profile.custom.requests.CustomCreateElementRequestAdapter;
import org.eclipse.papyrus.uml.tools.providers.UMLMetaclassContentProvider;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.ElementImport;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.PackageableElement;
@@ -125,6 +121,7 @@ public class CustomSemanticCreateCommand extends AbstractTransactionalCommand {
// }
// }
final MultipleValueSelectorDialog dialog = new MultipleValueSelectorDialog(Display.getDefault().getActiveShell(), selector, Messages.CustomSemanticCreateCommand_SelectMetaclass, true, false, -1);
+ dialog.setContextElement(profile);
dialog.setLabelProvider(labelProvider);
dialog.setInitialElementSelections(alreadyImportedElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/edit/parts/CustomConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/edit/parts/CustomConstraintEditPart.java
new file mode 100644
index 00000000000..fac5ad9a0ba
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/edit/parts/CustomConstraintEditPart.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintEditPart;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("restriction")
+public class CustomConstraintEditPart extends ConstraintEditPart {
+
+ public CustomConstraintEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+ EditPart editPart = this;
+ if (request instanceof DirectEditRequest){
+ Point p = new Point(((DirectEditRequest)request).getLocation());
+ getFigure().translateToRelative(p);
+ IFigure fig = getFigure().findFigureAt(p);
+ editPart =(EditPart) getViewer().getVisualPartMap().get(fig);
+ }
+ if (editPart == this) {
+ try {
+ editPart = (EditPart) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ // edit body, which can be found in 2nd child, instead of default action (first child)
+ setResult(getChildren().get(1));
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ }
+ if (editPart != null){
+ editPart.performRequest(request);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/edit/parts/CustomConstraintEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/edit/parts/CustomConstraintEditPartCN.java
new file mode 100644
index 00000000000..0403c90d9e6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/edit/parts/CustomConstraintEditPartCN.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintEditPartCN;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("restriction")
+public class CustomConstraintEditPartCN extends ConstraintEditPartCN {
+
+ public CustomConstraintEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+ EditPart editPart = this;
+ if (request instanceof DirectEditRequest){
+ Point p = new Point(((DirectEditRequest)request).getLocation());
+ getFigure().translateToRelative(p);
+ IFigure fig = getFigure().findFigureAt(p);
+ editPart =(EditPart) getViewer().getVisualPartMap().get(fig);
+ }
+ if (editPart == this) {
+ try {
+ editPart = (EditPart) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ // edit body, which can be found in 2nd child, instead of default action (first child)
+ setResult(getChildren().get(1));
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ }
+ if (editPart != null){
+ editPart.performRequest(request);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/factory/CustomUMLeditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/factory/CustomUMLeditPartFactory.java
index 975a88c18eb..ab030f00145 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/factory/CustomUMLeditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/factory/CustomUMLeditPartFactory.java
@@ -18,6 +18,8 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.AssociationEndSourceEditPart;
import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.AssociationEndTargetEditPart;
import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.CustomAssociationNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.CustomConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.CustomConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.CustomDependencyBranchEditPart;
import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.CustomDependencyNodeEditPart;
import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.CustomModelEditPart;
@@ -29,6 +31,8 @@ import org.eclipse.papyrus.uml.diagram.profile.custom.edit.parts.CustomProfileEd
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.AssociationNodeEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.AssociationRoleSourceEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.AssociationRoleTargetEditPart;
+import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.DependencyBranchEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.DependencyNodeEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ModelEditPartCN;
@@ -84,6 +88,10 @@ public class CustomUMLeditPartFactory extends UMLEditPartFactory {
return new CustomProfileEditPartTN(view);
case ProfileEditPartCN.VISUAL_ID:
return new CustomProfileEditPartCN(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return new CustomConstraintEditPart(view);
+ case ConstraintEditPartCN.VISUAL_ID:
+ return new CustomConstraintEditPartCN(view);
}
}
return super.createEditPart(context, model);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/messages.properties
index b14ec3bbd19..de542e4bc9f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/messages.properties
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/messages.properties
@@ -108,3 +108,4 @@ NavigatorActionProvider_OpenDiagramActionName=Open Diagram
MessageFormatParser_InvalidInputError=Invalid input at {0}
UMLModelingAssistantProviderTitle=Select domain model element
UMLModelingAssistantProviderMessage=Available domain model elements:
+invalid=Add new EnumerationLiteral
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen
index c5b9d930930..6c1a36c3b01 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen
@@ -351,7 +351,7 @@
<metaFeatures href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
</modelFacet>
</labels>
- <labels visualID="5064" editPartClassName="ConstraintBondyEditPartCN" itemSemanticEditPolicyClassName="ConstraintBodyItemSemanticEditPolicy">
+ <labels visualID="5064" editPartClassName="ConstraintBodyEditPartCN" itemSemanticEditPolicyClassName="ConstraintBodyItemSemanticEditPolicy">
<diagramRunTimeClass href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap xsi:type="gmfgen:ParentAssignedViewmap" getterName="getConstraintFigure" figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
<modelFacet xsi:type="gmfgen:FeatureLabelModelFacet" parser="/0/@labelParsers/@implementations.5">
@@ -1241,7 +1241,7 @@
<children xsi:type="gmfgen:GenStandardPreferencePage" iD="org.eclipse.uml2.uml.diagram.pathmaps" name="Pathmaps" kind="Pathmaps"/>
</preferencePages>
</diagram>
- <plugin iD="org.eclipse.papyrus.uml.diagram.profile" name="PapyrusUMLProfileDiagram" provider="CEA LIST" version="0.10.0.vqualifier">
+ <plugin iD="org.eclipse.papyrus.uml.diagram.profile" name="PapyrusUMLProfileDiagram" provider="CEA LIST" version="1.0.0.vqualifier">
<requiredPlugins>org.eclipse.draw2d</requiredPlugins>
<requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml
index 6c32fc5b2e7..46b07a27e2e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2010, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension point="org.eclipse.ui.contexts" id="ui-context">
@@ -958,7 +971,8 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.profile.CommentAnnotatedElement_1022"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.profile.ConstraintConstrainedElement_4014"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.profile.ConstraintContext_8500"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
<extension point="org.eclipse.ui.commands" id="update-cmd">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBodyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBodyEditPart.java
index d569b786823..6f4a4411ff7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBodyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBodyEditPart.java
@@ -52,6 +52,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -59,6 +60,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -80,7 +82,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -394,7 +396,11 @@ public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implement
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -450,6 +456,39 @@ public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implement
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ /**
+ * @generated
+ */
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBondyEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBodyEditPartCN.java
index d71f1c8d251..1344069840e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBondyEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintBodyEditPartCN.java
@@ -52,6 +52,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -59,6 +60,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -80,7 +82,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConstraintBondyEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class ConstraintBodyEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -124,7 +126,7 @@ public class ConstraintBondyEditPartCN extends PapyrusCompartmentEditPart implem
/**
* @generated
*/
- public ConstraintBondyEditPartCN(View view) {
+ public ConstraintBodyEditPartCN(View view) {
super(view);
}
@@ -326,7 +328,7 @@ public class ConstraintBondyEditPartCN extends PapyrusCompartmentEditPart implem
*/
public IParser getParser() {
if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_1028, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBondyEditPartCN.VISUAL_ID));
+ parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_1028, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBodyEditPartCN.VISUAL_ID));
}
return parser;
}
@@ -394,7 +396,11 @@ public class ConstraintBondyEditPartCN extends PapyrusCompartmentEditPart implem
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -450,6 +456,39 @@ public class ConstraintBondyEditPartCN extends PapyrusCompartmentEditPart implem
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ /**
+ * @generated
+ */
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintEditPartCN.java
index 3042663cbf6..453b25ef915 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintEditPartCN.java
@@ -147,8 +147,8 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart {
((ConstraintNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
- if(childEditPart instanceof ConstraintBondyEditPartCN) {
- ((ConstraintBondyEditPartCN)childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
+ if(childEditPart instanceof ConstraintBodyEditPartCN) {
+ ((ConstraintBodyEditPartCN)childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
return true;
}
return false;
@@ -161,7 +161,7 @@ public class ConstraintEditPartCN extends AbstractConstraintEditPart {
if(childEditPart instanceof ConstraintNameEditPartCN) {
return true;
}
- if(childEditPart instanceof ConstraintBondyEditPartCN) {
+ if(childEditPart instanceof ConstraintBodyEditPartCN) {
return true;
}
return false;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPart.java
index b83049ef635..6b05334bc7c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPart.java
@@ -52,6 +52,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -393,7 +394,12 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ setParser(((ICustomDirectEditorConfiguration)configuration).createParser(this.resolveSemanticElement()));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -449,6 +455,40 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPartCN.java
index 7bb1136d5a3..9d5786b00e7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/ConstraintNameEditPartCN.java
@@ -52,6 +52,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -59,6 +60,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -79,7 +81,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -393,7 +395,11 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -449,6 +455,40 @@ public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart impleme
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/UMLEditPartFactory.java
index fa8df539d3d..bf3555808e9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/UMLEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/parts/UMLEditPartFactory.java
@@ -135,8 +135,8 @@ public class UMLEditPartFactory implements EditPartFactory {
return new ConstraintEditPartCN(view);
case ConstraintNameEditPartCN.VISUAL_ID:
return new ConstraintNameEditPartCN(view);
- case ConstraintBondyEditPartCN.VISUAL_ID:
- return new ConstraintBondyEditPartCN(view);
+ case ConstraintBodyEditPartCN.VISUAL_ID:
+ return new ConstraintBodyEditPartCN(view);
case EnumerationEditPartCN.VISUAL_ID:
return new EnumerationEditPartCN(view);
case EnumerationNameEditPartCN.VISUAL_ID:
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java
index ee6400297a2..ed084c0adea 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java
@@ -39,7 +39,7 @@ import org.eclipse.papyrus.uml.diagram.profile.edit.parts.CommentBodyEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.CommentEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.CommentEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBodyEditPart;
-import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBondyEditPartCN;
+import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBodyEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintNameEditPart;
@@ -686,7 +686,7 @@ public class UMLVisualIDRegistry {
if(ConstraintNameEditPartCN.VISUAL_ID == nodeVisualID) {
return true;
}
- if(ConstraintBondyEditPartCN.VISUAL_ID == nodeVisualID) {
+ if(ConstraintBodyEditPartCN.VISUAL_ID == nodeVisualID) {
return true;
}
break;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLParserProvider.java
index 40c30863982..b0843f6fb52 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLParserProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLParserProvider.java
@@ -43,7 +43,7 @@ import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ClassPropertyEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.CommentBodyEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.CommentBodyEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBodyEditPart;
-import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBondyEditPartCN;
+import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBodyEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintNameEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintNameEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.DataTypeNameEditPart;
@@ -854,7 +854,7 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
return getPackageName_1010Parser();
case ConstraintNameEditPartCN.VISUAL_ID:
return getConstraintName_1059Parser();
- case ConstraintBondyEditPartCN.VISUAL_ID:
+ case ConstraintBodyEditPartCN.VISUAL_ID:
return getConstraintSpecification_5064Parser();
case EnumerationNameEditPartCN.VISUAL_ID:
return getEnumerationName_5055Parser();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLViewProvider.java
index 59048d96b75..1863923d4ee 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/providers/UMLViewProvider.java
@@ -77,7 +77,7 @@ import org.eclipse.papyrus.uml.diagram.profile.edit.parts.CommentBodyEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.CommentEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.CommentEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBodyEditPart;
-import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBondyEditPartCN;
+import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintBodyEditPartCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintConstrainedElementEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.profile.edit.parts.ConstraintEditPartCN;
@@ -950,7 +950,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint");
PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Constraint");
Node label1059 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPartCN.VISUAL_ID));
- Node label5064 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintBondyEditPartCN.VISUAL_ID));
+ Node label5064 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintBodyEditPartCN.VISUAL_ID));
return node;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java
index ea6f52e9308..125e17d5765 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA
+ * Copyright (c) 2013, 2014 Soyatec, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,24 +9,19 @@
*
* Contributors:
* Soyatec - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
-import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart;
@@ -46,6 +41,7 @@ import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.gmf.runtime.notation.TitleStyle;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
@@ -237,59 +233,46 @@ public class AppliedStereotypeCommentCreationEditPolicyEx extends AppliedStereot
}
protected void executeAppliedStereotypeCommentCreation(final EditPart editPart, final TransactionalEditingDomain domain, final EObject semanticElement) {
- try {
- domain.runExclusive(new Runnable() {
+ Display.getCurrent().asyncExec(new Runnable() {
- public void run() {
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- int x = 200;
- int y = 100;
- if(editPart.getModel() instanceof Node) {
- LayoutConstraint constraint = ((Node)editPart.getModel()).getLayoutConstraint();
- if(constraint instanceof Bounds) {
- x = x + ((Bounds)constraint).getX();
- y = ((Bounds)constraint).getY();
- }
-
- }
- if(editPart.getModel() instanceof Edge && ((((Edge)editPart.getModel()).getSource()) instanceof Node)) {
+ public void run() {
+ int x = 200;
+ int y = 100;
+ if(editPart.getModel() instanceof Node) {
+ LayoutConstraint constraint = ((Node)editPart.getModel()).getLayoutConstraint();
+ if(constraint instanceof Bounds) {
+ x = x + ((Bounds)constraint).getX();
+ y = ((Bounds)constraint).getY();
+ }
- LayoutConstraint constraint = ((Node)((Edge)editPart.getModel()).getSource()).getLayoutConstraint();
- if(constraint instanceof Bounds) {
- x = x + ((Bounds)constraint).getX();
- y = ((Bounds)constraint).getY() - 100;
- }
+ }
+ if(editPart.getModel() instanceof Edge && ((((Edge)editPart.getModel()).getSource()) instanceof Node)) {
- }
- boolean isBorderElement = false;
- if(!(editPart instanceof CustomDurationConstraintEditPart)) {
- if(editPart instanceof BorderedBorderItemEditPart) {
- isBorderElement = true;
- }
- }
- if(getAppliedStereotypeCommentNode() == null) {
- CreateAppliedStereotypeCommentViewCommandEx command = new CreateAppliedStereotypeCommentViewCommandEx(domain, (View)editPart.getModel(), x, y, semanticElement, isBorderElement);
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)domain).startTransaction(false, options);
- command.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- }
+ LayoutConstraint constraint = ((Node)((Edge)editPart.getModel()).getSource()).getLayoutConstraint();
+ if(constraint instanceof Bounds) {
+ x = x + ((Bounds)constraint).getX();
+ y = ((Bounds)constraint).getY() - 100;
+ }
- });
}
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
+ boolean isBorderElement = false;
+ if(!(editPart instanceof CustomDurationConstraintEditPart)) {
+ if(editPart instanceof BorderedBorderItemEditPart) {
+ isBorderElement = true;
+ }
+ }
+ if(getAppliedStereotypeCommentNode() == null) {
+ CreateAppliedStereotypeCommentViewCommandEx command = new CreateAppliedStereotypeCommentViewCommandEx(domain, (View)editPart.getModel(), x, y, semanticElement, isBorderElement);
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ });
}
protected Node getAppliedStereotypeCommentNode() {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
index e9525040421..d162c874a7f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart;
@@ -50,7 +51,7 @@ public class InteractionOperandAppliedStereotypeLabelDisplayEditPolicy extends A
// if (stereotypesToDisplay != "" || imageToDisplay != null) {
if(figure instanceof IPapyrusNodeUMLElementFigure) {
((IPapyrusNodeUMLElementFigure)figure).setStereotypeDisplay(tag + (stereotypesOnlyToDisplay().equals("") ? stereotypesToDisplay : stereotypesToDisplay), imageToDisplay);
- refreshAppliedStereotypesProperties(((IPapyrusNodeUMLElementFigure)figure));
+ refreshAppliedStereotypesProperties(((IPapyrusNodeNamedElementFigure) figure));
}
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
index ff9ecb984f7..df94629a8d8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension point="org.eclipse.papyrus.views.properties.context">
<context contextModel="model/prop/seq.ctx">
@@ -618,7 +631,8 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.sequence.ConstraintConstrainedElement_4011"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.sequence.GeneralOrdering_4012"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.sequence.ConstraintContext_8500"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
<extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/EMFCustomTransitionRetargetContainerCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/EMFCustomTransitionRetargetContainerCommand.java
index c66cd019255..d79f3a847a7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/EMFCustomTransitionRetargetContainerCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/EMFCustomTransitionRetargetContainerCommand.java
@@ -1,16 +1,22 @@
+/*****************************************************************************
+ * Copyright (c) 2013, 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 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
+ * Christian W. Damus (CEA) - bug 323802
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.statemachine.custom.commands;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.emf.common.command.AbstractCommand;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.PseudostateKind;
@@ -26,7 +32,7 @@ import org.eclipse.uml2.uml.Vertex;
* @author ansgar
*
*/
-public class EMFCustomTransitionRetargetContainerCommand extends AbstractCommand {
+public class EMFCustomTransitionRetargetContainerCommand extends GMFUnsafe.UnsafeCommand {
protected Transition transition;
@@ -35,6 +41,8 @@ public class EMFCustomTransitionRetargetContainerCommand extends AbstractCommand
protected Region newRegion;
public EMFCustomTransitionRetargetContainerCommand(Transition transition) {
+ super(TransactionUtil.getEditingDomain(transition));
+
this.transition = transition;
}
@@ -267,48 +275,24 @@ public class EMFCustomTransitionRetargetContainerCommand extends AbstractCommand
return null;
}
-
- public void execute() {
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)TransactionUtil.getEditingDomain(transition)).startTransaction(false, options);
- oldRegion = (Region)transition.getOwner();
- changeContainer(transition);
- newRegion = (Region)transition.getOwner();
- it.commit();
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError(e.getMessage());
- }
+ @Override
+ protected void doExecute() {
+ oldRegion = (Region)transition.getOwner();
+ changeContainer(transition);
+ newRegion = (Region)transition.getOwner();
}
@Override
- public void undo() {
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)TransactionUtil.getEditingDomain(transition)).startTransaction(false, options);
- if(oldRegion != transition.getOwner()) {
- oldRegion.getTransitions().add(transition); // will remove transition automatically from original region
- }
- it.commit();
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError(e.getMessage());
+ protected void doUndo() {
+ if(oldRegion != transition.getOwner()) {
+ oldRegion.getTransitions().add(transition); // will remove transition automatically from original region
}
}
-
- public void redo() {
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)TransactionUtil.getEditingDomain(transition)).startTransaction(false, options);
- if(newRegion != transition.getOwner()) {
- newRegion.getTransitions().add(transition); // will remove transition automatically from original region
- }
- it.commit();
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError(e.getMessage());
+ @Override
+ protected void doRedo() {
+ if(newRegion != transition.getOwner()) {
+ newRegion.getTransitions().add(transition); // will remove transition automatically from original region
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomConstraintEditPart.java
new file mode 100644
index 00000000000..ef650562150
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomConstraintEditPart.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConstraintEditPart;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("restriction")
+public class CustomConstraintEditPart extends ConstraintEditPart {
+
+ public CustomConstraintEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+ EditPart editPart = this;
+ if (request instanceof DirectEditRequest){
+ Point p = new Point(((DirectEditRequest)request).getLocation());
+ getFigure().translateToRelative(p);
+ IFigure fig = getFigure().findFigureAt(p);
+ editPart =(EditPart) getViewer().getVisualPartMap().get(fig);
+ }
+ if (editPart == this) {
+ try {
+ editPart = (EditPart) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ // edit body, which can be found in 2nd child, instead of default action (first child)
+ setResult(getChildren().get(1));
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ }
+ if (editPart != null){
+ editPart.performRequest(request);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomTransitionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomTransitionEditPart.java
new file mode 100644
index 00000000000..6179fdbf49b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomTransitionEditPart.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.common.core.util.Log;
+import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionEditPart;
+
+/**
+ * @generated
+ */
+@SuppressWarnings("restriction")
+public class CustomTransitionEditPart extends TransitionEditPart {
+
+ public CustomTransitionEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)
+ */
+ @Override
+ protected void performDirectEditRequest(Request request) {
+ EditPart editPart = this;
+ if (request instanceof DirectEditRequest){
+ Point p = new Point(((DirectEditRequest)request).getLocation());
+ getFigure().translateToRelative(p);
+ IFigure fig = getFigure().findFigureAt(p);
+ editPart =(EditPart) getViewer().getVisualPartMap().get(fig);
+ }
+ if (editPart == this) {
+ try {
+ editPart = (EditPart) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl() {
+
+ public void run() {
+ // edit transition guard, which can be found in 2nd child, instead of default action (first child)
+ setResult(getChildren().get(1));
+ }
+ });
+ } catch (InterruptedException e) {
+ Trace.catching(DiagramUIPlugin.getInstance(),
+ DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ Log.error(DiagramUIPlugin.getInstance(),
+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
+ "performDirectEditRequest", e); //$NON-NLS-1$
+ }
+ if (editPart != null){
+ editPart.performRequest(request);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java
index 341ab7cf819..5c3001c87c4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java
@@ -19,6 +19,7 @@ package org.eclipse.papyrus.uml.diagram.statemachine.custom.factory;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomConnectionPointReferenceNameEditPart;
+import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomFinalStateEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomPackageEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomRegionCompartmentEditPart;
@@ -29,8 +30,10 @@ import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomState
import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomStateMachineEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomStateMachineNameEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomStateNameEditPart;
+import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomTransitionEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomTransitionGuardEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.FinalStateEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
@@ -41,6 +44,7 @@ import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateMachineCompa
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateMachineEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateMachineNameEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateNameEditPart;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionGuardEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.UMLEditPartFactory;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
@@ -76,9 +80,11 @@ public class CustomUMLEditPartFactory extends UMLEditPartFactory {
return new CustomTransitionGuardEditPart(view);
case ConnectionPointReferenceNameEditPart.VISUAL_ID:
return new CustomConnectionPointReferenceNameEditPart(view);
-
+ case ConstraintEditPart.VISUAL_ID:
+ return new CustomConstraintEditPart(view);
+ case TransitionEditPart.VISUAL_ID:
+ return new CustomTransitionEditPart(view);
}
-
}
return super.createEditPart(context, model);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
index 4cc6d94fc91..8a5fc2f5612 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
@@ -2409,7 +2409,7 @@
iD="org.eclipse.papyrus.uml.diagram.statemachine"
name="PapyrusUMLStateMachineDiagram"
provider="Papyrus"
- version="0.10.0.qualifier"/>
+ version="1.0.0.qualifier"/>
<editor
iconPath="icons/UMLDiagramFile.gif"/>
<navigator>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
index 5883f4aa37c..4573b6a3d10 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009, 2014 MOSKitt, CEA 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:
+ MOSKitt - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
@@ -516,7 +529,8 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.statemachine.Generalization_19000"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.statemachine.CommentAnnotatedElement_667"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.statemachine.ConstraintConstrainedElement_670"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
<extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java
index a061d9882e3..4941e5ecee6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java
@@ -42,6 +42,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -49,6 +50,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
@@ -68,7 +70,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConnectionPointReferenceNameEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class ConnectionPointReferenceNameEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -513,7 +515,11 @@ public class ConnectionPointReferenceNameEditPart extends LabelEditPart implemen
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -569,6 +575,40 @@ public class ConnectionPointReferenceNameEditPart extends LabelEditPart implemen
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
public void refreshBounds() {
int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java
index d2a27f21725..e452ad4c7bb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java
@@ -38,6 +38,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -45,6 +46,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -66,7 +68,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -380,7 +382,11 @@ public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implement
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -436,6 +442,40 @@ public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart implement
/**
* @generated
*/
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java
index c67a4f2fecb..cff50689b27 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java
@@ -38,6 +38,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -45,6 +46,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -65,7 +67,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class StateNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart {
+public class StateNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -523,7 +525,11 @@ public class StateNameEditPart extends PapyrusCompartmentEditPart implements ITe
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -590,6 +596,40 @@ public class StateNameEditPart extends PapyrusCompartmentEditPart implements ITe
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
if(maskLabelPolicy == null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java
index cb057b2103f..06d37664c35 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java
@@ -39,6 +39,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
@@ -46,6 +47,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -66,7 +68,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class TransitionGuardEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart {
+public class TransitionGuardEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
/**
* @generated
@@ -508,7 +510,11 @@ public class TransitionGuardEditPart extends PapyrusLabelEditPart implements ITe
} else {
configuration.preEditAction(resolveSemanticElement());
Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
+ if(configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration)configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else if(configuration instanceof IPopupEditorConfiguration) {
IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
@@ -564,6 +570,40 @@ public class TransitionGuardEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((request instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)request;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
protected void refreshFont() {
FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
if(style != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
index ffe7e64d594..2914f240d7b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,23 +9,19 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
@@ -37,7 +33,7 @@ import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.LayoutConstraint;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
@@ -122,31 +118,18 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
cmd.execute();
}
};
- try {
- domain.runExclusive(new Runnable() {
-
- public void run() {
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)domain).startTransaction(false, options);
- cmd.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
+
+ Display.getCurrent().asyncExec(new Runnable() {
+ public void run() {
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(domain, cmd);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+ });
}
}
@@ -186,89 +169,62 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
* the stereotype application
*/
protected void executeAppliedStereotypeCommentCreation(final EditPart editPart, final TransactionalEditingDomain domain, final EObject semanticElement) {
- try {
- domain.runExclusive(new Runnable() {
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ public void run() {
+ int x = 200;
+ int y = 100;
+ if(editPart.getModel() instanceof Node) {
+ LayoutConstraint constraint = ((Node)editPart.getModel()).getLayoutConstraint();
+ if(constraint instanceof Bounds) {
+ x = x + ((Bounds)constraint).getX();
+ y = ((Bounds)constraint).getY();
+ }
- public void run() {
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- int x = 200;
- int y = 100;
- if(editPart.getModel() instanceof Node) {
- LayoutConstraint constraint = ((Node)editPart.getModel()).getLayoutConstraint();
- if(constraint instanceof Bounds) {
- x = x + ((Bounds)constraint).getX();
- y = ((Bounds)constraint).getY();
- }
-
- }
- if(editPart.getModel() instanceof Edge && ((((Edge)editPart.getModel()).getSource()) instanceof Node)) {
-
- LayoutConstraint constraint = ((Node)((Edge)editPart.getModel()).getSource()).getLayoutConstraint();
- if(constraint instanceof Bounds) {
- x = x + ((Bounds)constraint).getX();
- y = ((Bounds)constraint).getY() - 100;
- }
-
- }
- boolean isBorderElement = false;
- if(editPart instanceof BorderedBorderItemEditPart) {
- isBorderElement = true;
- }
- if(getAppliedStereotypeCommentNode() == null) {
- CreateAppliedStereotypeCommentViewCommand command = new CreateAppliedStereotypeCommentViewCommand(domain, (View)editPart.getModel(), x, y, semanticElement, isBorderElement);
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)domain).startTransaction(false, options);
- command.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- }
-
- });
}
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
+ if(editPart.getModel() instanceof Edge && ((((Edge)editPart.getModel()).getSource()) instanceof Node)) {
+
+ LayoutConstraint constraint = ((Node)((Edge)editPart.getModel()).getSource()).getLayoutConstraint();
+ if(constraint instanceof Bounds) {
+ x = x + ((Bounds)constraint).getX();
+ y = ((Bounds)constraint).getY() - 100;
+ }
+
+ }
+ boolean isBorderElement = false;
+ if(editPart instanceof BorderedBorderItemEditPart) {
+ isBorderElement = true;
+ }
+ if(getAppliedStereotypeCommentNode() == null) {
+ CreateAppliedStereotypeCommentViewCommand command = new CreateAppliedStereotypeCommentViewCommand(domain, (View)editPart.getModel(), x, y, semanticElement, isBorderElement);
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ });
}
protected void executeAppliedStereotypeCommentDeletion(final TransactionalEditingDomain domain, final View commentNode) {
- try {
- domain.runExclusive(new Runnable() {
-
- public void run() {
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- //because it is asynchrone the comment node maybe become s null
- if(commentNode != null && TransactionUtil.getEditingDomain(commentNode) != null) {
- DeleteCommand command = new DeleteCommand(commentNode);
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)TransactionUtil.getEditingDomain(commentNode)).startTransaction(false, options);
- GMFtoEMFCommandWrapper warpperCmd = new GMFtoEMFCommandWrapper(command);
- warpperCmd.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- }
- });
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ public void run() {
+ //because it is asynchrone the comment node maybe become s null
+ if(commentNode != null && TransactionUtil.getEditingDomain(commentNode) != null) {
+ DeleteCommand command = new DeleteCommand(commentNode);
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
}
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
+ }
+ });
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
index 8c995486f17..687b056b8a4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,30 +9,26 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Map;
import java.util.StringTokenizer;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.impl.DynamicEObjectImpl;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.gmfdiag.common.commands.SetNodeVisibilityCommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
@@ -131,23 +127,18 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
public void run() {
Display.getCurrent().syncExec(new Runnable() {
-
+
public void run() {
-
- CreateAppliedStereotypeViewCommand command = new CreateAppliedStereotypeViewCommand(editPart.getEditingDomain(), editPart.getNotationView(), appliedstereotype, hasToDisplayCompartment(appliedstereotype));
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)editPart.getEditingDomain()).startTransaction(false, options);
- command.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
-
+ CreateAppliedStereotypeViewCommand command = new CreateAppliedStereotypeViewCommand(editPart.getEditingDomain(), editPart.getNotationView(), appliedstereotype, hasToDisplayCompartment(appliedstereotype));
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(editPart.getEditingDomain(), command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
}
});
+
}
});
} catch (Exception e) {
@@ -229,22 +220,13 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
editPart.getEditingDomain().runExclusive(new Runnable() {
public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
- SetNodeVisibilityCommand setCommand = new SetNodeVisibilityCommand(editPart.getEditingDomain(), view, isVisible);
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)editPart.getEditingDomain()).startTransaction(false, options);
- setCommand.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
+ SetNodeVisibilityCommand setCommand = new SetNodeVisibilityCommand(editPart.getEditingDomain(), view, isVisible);
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(editPart.getEditingDomain(), setCommand);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
}
});
} catch (Exception e) {
@@ -301,23 +283,13 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
editPart.getEditingDomain().runExclusive(new Runnable() {
public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
- DeleteCommand command = new DeleteCommand(currentNode);
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)editPart.getEditingDomain()).startTransaction(false, options);
- GMFtoEMFCommandWrapper warpperCmd = new GMFtoEMFCommandWrapper(command);
- warpperCmd.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
+ DeleteCommand command = new DeleteCommand(currentNode);
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(editPart.getEditingDomain(), command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
}
});
}
@@ -327,25 +299,15 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
editPart.getEditingDomain().runExclusive(new Runnable() {
public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- public void run() {
- if(currentNode != null && editPart.getEditingDomain() != null) {
- DeleteCommand command = new DeleteCommand(editPart.getEditingDomain(), currentNode);
- //use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
- try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)editPart.getEditingDomain()).startTransaction(false, options);
- GMFtoEMFCommandWrapper warpperCmd = new GMFtoEMFCommandWrapper(command);
- warpperCmd.execute();
- it.commit();
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
+ if(currentNode != null && editPart.getEditingDomain() != null) {
+ DeleteCommand command = new DeleteCommand(editPart.getEditingDomain(), currentNode);
+ //use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(editPart.getEditingDomain(), command);
+ } catch (Exception e) {
+ Activator.log.error(e);
}
- });
+ }
}
});
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java
index ba293d51990..2f4a9ee2b7f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypePropertiesEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,26 +9,22 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
-import java.util.HashMap;
-import java.util.Map;
import java.util.StringTokenizer;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.emf.transaction.impl.InternalTransaction;
-import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
@@ -133,12 +129,8 @@ public class AppliedStereotypePropertiesEditPolicy extends AppliedStereotypeNode
if(sterotypePropertyNode == null) {
//use to avoid to put it in the command stack
CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(editPart.getEditingDomain(), editPart.getNotationView(), stereotypeProperty);
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)editPart.getEditingDomain()).startTransaction(false, options);
- command.execute();
- it.commit();
+ GMFUnsafe.write(editPart.getEditingDomain(), command);
} catch (Exception e) {
Activator.log.error(e);
}
@@ -240,13 +232,8 @@ public class AppliedStereotypePropertiesEditPolicy extends AppliedStereotypeNode
public void run() {
DeleteCommand command = new DeleteCommand((View)getHost().getModel());
//use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)editPart.getEditingDomain()).startTransaction(false, options);
- GMFtoEMFCommandWrapper warpperCmd = new GMFtoEMFCommandWrapper(command);
- warpperCmd.execute();
- it.commit();
+ GMFUnsafe.write(editPart.getEditingDomain(), command);
} catch (Exception e) {
System.err.println(e);
}
@@ -298,13 +285,8 @@ public class AppliedStereotypePropertiesEditPolicy extends AppliedStereotypeNode
DeleteCommand command = new DeleteCommand(currentNode);
//use to avoid to put it in the command stack
- Map<String, Boolean> options = new HashMap<String, Boolean>();
- options.put(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
try {
- InternalTransaction it = ((InternalTransactionalEditingDomain)editPart.getEditingDomain()).startTransaction(false, options);
- GMFtoEMFCommandWrapper warpperCmd = new GMFtoEMFCommandWrapper(command);
- warpperCmd.execute();
- it.commit();
+ GMFUnsafe.write(editPart.getEditingDomain(), command);
} catch (Exception e) {
System.err.println(e);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/META-INF/MANIFEST.MF
index c41a93da984..416af96a60a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/META-INF/MANIFEST.MF
@@ -7,7 +7,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.5.0",
- org.eclipse.papyrus.sysml.diagram.common;bundle-version="1.0.0",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml
index 6c683390781..934dc8bf499 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2013, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension point="org.eclipse.ui.contexts" id="ui-context">
@@ -1078,6 +1091,7 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageLost_50"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.timing.MessageFound_53"/>
<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
<extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml
index 2bf6e4a69c8..2a8fb8ff11c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009, 2014 CEA 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 - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+
+-->
<plugin>
<extension point="org.eclipse.ui.contexts" id="ui-context">
@@ -654,7 +667,8 @@
<elementType ref="org.eclipse.papyrus.uml.diagram.usecase.Realization_4017"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.usecase.PackageMerge_4018"/>
<elementType ref="org.eclipse.papyrus.uml.diagram.usecase.PackageImport_4019"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice"/>
</binding>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/PapyrusModelFromExistingDomainModelCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/PapyrusModelFromExistingDomainModelCommand.java
index afe8c8b7feb..fbd517f2aae 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/PapyrusModelFromExistingDomainModelCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/PapyrusModelFromExistingDomainModelCommand.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,6 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.wizards.category;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EObject;
@@ -23,7 +22,7 @@ import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.papyrus.infra.core.resource.IModel;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
@@ -43,10 +42,13 @@ public class PapyrusModelFromExistingDomainModelCommand extends RecordingCommand
/**
* Instantiates a new papyrus model from existing domain model command.
- *
- * @param diResourceSet the di resource set
- * @param newURI the URI of the new model's principal resource
- * @param root the root
+ *
+ * @param diResourceSet
+ * the di resource set
+ * @param newURI
+ * the URI of the new model's principal resource
+ * @param root
+ * the root
*/
public PapyrusModelFromExistingDomainModelCommand(ModelSet modelSet, URI newURI, EObject root) {
super(modelSet.getTransactionalEditingDomain());
@@ -57,16 +59,18 @@ public class PapyrusModelFromExistingDomainModelCommand extends RecordingCommand
myRoot = root;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
*/
@Override
protected void doExecute() {
- IModel model = myDiResourceSet.getModel(DiModel.MODEL_ID);
+ IModel model = myDiResourceSet.getModel(SashModel.MODEL_ID);
model.createModel(myURIWithoutExtension);
model = myDiResourceSet.getModel(NotationModel.MODEL_ID);
model.createModel(myURIWithoutExtension);
- // START OF WORKAROUND for #315083
+ // START OF WORKAROUND for #315083
IModel umlModel = new UmlModel() {
@Override
@@ -76,16 +80,14 @@ public class PapyrusModelFromExistingDomainModelCommand extends RecordingCommand
// as resource already exists, use rs.getResource() not rs.createResource() here
try {
resource = getResourceSet().getResource(resourceURI, true);
- }
- catch (WrappedException e){
- if (ModelUtils.isDegradedModeAllowed(e.getCause())){
+ } catch (WrappedException e) {
+ if(ModelUtils.isDegradedModeAllowed(e.getCause())) {
// in this case Papyrus can work in degraded mode
resource = getResourceSet().getResource(resourceURI, false);
- if (resource == null){
- throw e ;
+ if(resource == null) {
+ throw e;
}
- }
- else {
+ } else {
throw e;
}
}
@@ -95,11 +97,11 @@ public class PapyrusModelFromExistingDomainModelCommand extends RecordingCommand
};
};
myDiResourceSet.getInternal().registerModel(umlModel, true);
- umlModel.createModel((URI) null);
+ umlModel.createModel((URI)null);
// // call snippets to allow them to do their stuff
// snippets.performStart(this);
- // END OF WORKAROUND for #315083
+ // END OF WORKAROUND for #315083
}
-} \ No newline at end of file
+}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
index 17ff8d14efb..335aa070429 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
@@ -1,15 +1,16 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
+/*****************************************************************************
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
- *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Patrick Tessier (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
import org.eclipse.emf.ecore.EClassifier;
@@ -47,7 +48,6 @@ import org.eclipse.papyrus.uml.nattable.editor.MultiReferenceCellEditor;
import org.eclipse.papyrus.uml.nattable.editor.MultiStringCellEditor;
import org.eclipse.papyrus.uml.nattable.editor.MultiUnlimitedNaturalCellEditor;
import org.eclipse.papyrus.uml.nattable.editor.SingleReferenceValueCellEditor;
-import org.eclipse.papyrus.uml.nattable.editor.StereotypeApplierCellEditorWrapper;
import org.eclipse.papyrus.uml.nattable.editor.StereotypeApplierDialogCellEditorWrapper;
import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
import org.eclipse.papyrus.uml.nattable.validator.RealDataValidator;
@@ -180,13 +180,11 @@ public class UMLFeatureCellEditorConfig extends EStructuralFeatureEditorConfig {
editor = super.getICellEditor(table, axisElement, elementProvider);
break;
}
- // to apply required stereotype before edition
+ // to apply required stereotype before editing in a dialog (which we can reasonably encapsulate in a command)
// see bug 426709: [Table 2][Stereotype] Papyrus Table must allows to edit stereotype properties even if the required stereotypes is not yet applied
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=426709
if(editor instanceof AbstractDialogCellEditor) {
editor = new StereotypeApplierDialogCellEditorWrapper((AbstractDialogCellEditor)editor, axisElement, elementProvider);
- } else if(editor instanceof ICellEditor) {
- editor = new StereotypeApplierCellEditorWrapper(editor, axisElement, elementProvider);
}
return editor;
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java
index 93b8eb48afb..68f27d1a11d 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/dataprovider/UMLStereotypeSingleEnumerationComboBoxDataProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.dataprovider;
@@ -18,8 +19,6 @@ import java.util.List;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
@@ -84,12 +83,10 @@ public class UMLStereotypeSingleEnumerationComboBoxDataProvider implements IComb
if(modelElement != null) {
final String id = AxisUtils.getPropertyId(this.axisElement);
final Property property = UMLTableUtils.getRealStereotypeProperty(modelElement, id);
- final List<Stereotype> ste = UMLTableUtils.getAppliedStereotypesWithThisProperty(modelElement, id);
+ final List<Stereotype> ste = UMLTableUtils.getApplicableStereotypesWithThisProperty(modelElement, id);
if(ste.size() == 1) {
final Stereotype current = ste.get(0);
- final EObject steAppl = modelElement.getStereotypeApplication(current);
- final EStructuralFeature feature = steAppl.eClass().getEStructuralFeature(property.getName());
- final EEnum eenum = (EEnum)feature.getEType();
+ final EEnum eenum = (EEnum)current.getProfile().getDefinition(property.getType());
for(final EEnumLiteral instances : eenum.getELiterals()) {
literals.add(instances.getInstance());
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/AbstractUMLMultiValueCellEditor.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/AbstractUMLMultiValueCellEditor.java
index 663d4a014ee..5f85ce1f968 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/AbstractUMLMultiValueCellEditor.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/AbstractUMLMultiValueCellEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.editor;
@@ -167,6 +168,7 @@ public abstract class AbstractUMLMultiValueCellEditor extends AbstractDialogCell
}
};
+ dialog.setContextElement(realEditedObject);
dialog.setLabelProvider(new UMLLabelProvider());
if(value != null && value instanceof Collection) {
Collection<?> coll = (Collection<?>)value;
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java
index c7871b0a79a..92fb2474b5b 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
+ * Copyright (c) 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
*
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.editor;
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java
index df1a74c8e4d..d9ec5e502d9 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +8,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.manager.cell;
@@ -20,11 +20,13 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.osgi.util.NLS;
@@ -41,6 +43,7 @@ import org.eclipse.papyrus.uml.nattable.messages.Messages;
import org.eclipse.papyrus.uml.nattable.paste.StereotypeApplicationStructure;
import org.eclipse.papyrus.uml.nattable.utils.Constants;
import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
+import org.eclipse.papyrus.uml.tools.commands.ApplyStereotypeCommand;
import org.eclipse.papyrus.uml.tools.utils.EnumerationUtil;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Enumeration;
@@ -192,6 +195,27 @@ public class StereotypePropertyCellManager extends UMLFeatureCellManager {
final Property prop = UMLTableUtils.getRealStereotypeProperty(el, id);
final List<Stereotype> stereotypes = UMLTableUtils.getAppliedStereotypesWithThisProperty(el, id);
if(prop != null) {
+ if (stereotypes.isEmpty()) {
+ // Must first apply the stereotype
+ return new RecordingCommand(domain, "Set Value") {
+
+ @Override
+ protected void doExecute() {
+ if (!applyRequiredStereotype(domain, el, id)) {
+ throw new OperationCanceledException();
+ } else {
+ // Now recursively execute the set-string-value command
+ Command command = getSetValueCommand(domain, columnElement, rowElement, newValue, tableManager);
+ if (command == null || !command.canExecute()) {
+ throw new OperationCanceledException();
+ } else {
+ domain.getCommandStack().execute(command);
+ }
+ }
+ }
+ };
+ }
+
if(stereotypes.size() == 1) {
final EObject stereotypeApplication = el.getStereotypeApplication(stereotypes.get(0));
final EStructuralFeature steApFeature = stereotypeApplication.eClass().getEStructuralFeature(prop.getName());
@@ -226,6 +250,27 @@ public class StereotypePropertyCellManager extends UMLFeatureCellManager {
EObject stereotypeApplication = null;
EStructuralFeature steApFeature = null;
if(prop != null) {
+ if (stereotypes.isEmpty()) {
+ // Must first apply the stereotype
+ return new RecordingCommand(domain, "Set Value") {
+
+ @Override
+ protected void doExecute() {
+ if (!applyRequiredStereotype(domain, el, id)) {
+ throw new OperationCanceledException();
+ } else {
+ // Now recursively execute the set-string-value command
+ Command command = getSetStringValueCommand(domain, columnElement, rowElement, newValue, valueSolver, tableManager);
+ if (command == null || !command.canExecute()) {
+ throw new OperationCanceledException();
+ } else {
+ domain.getCommandStack().execute(command);
+ }
+ }
+ }
+ };
+ }
+
if(stereotypes.size() == 1) {
stereotypeApplication = el.getStereotypeApplication(stereotypes.get(0));
switch(UMLTableUtils.getAppliedStereotypesWithThisProperty(el, id).size()) {
@@ -369,4 +414,24 @@ public class StereotypePropertyCellManager extends UMLFeatureCellManager {
createStringResolutionProblem(tableManager, columnElement, rowElement, valueAsString, solvedValue, sharedMap);
}
+
+ /**
+ *
+ * @param el
+ * an element of the model
+ * @param propertyId
+ * the id of the edited property
+ * @return <code>true</code> if a stereotype has been applied
+ */
+ private static boolean applyRequiredStereotype(TransactionalEditingDomain domain, final Element el, final String propertyId) {
+ if(UMLTableUtils.getAppliedStereotypesWithThisProperty(el, propertyId).size() == 0) {
+ final List<Stereotype> stereotypesList = UMLTableUtils.getApplicableStereotypesWithThisProperty(el, propertyId);
+ if(stereotypesList.size() == 1) {
+ final ApplyStereotypeCommand applyCommand = new ApplyStereotypeCommand(el, stereotypesList.get(0), domain);
+ domain.getCommandStack().execute(applyCommand);
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/utils/Util.java b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/utils/Util.java
index c57a3f2ae8a..3ee7dfe0e85 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/utils/Util.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.extensionpoints/src/org/eclipse/papyrus/uml/extensionpoints/utils/Util.java
@@ -16,6 +16,8 @@ import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
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.emf.ecore.xmi.XMLResource;
import org.eclipse.papyrus.uml.extensionpoints.Activator;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Stereotype;
@@ -59,7 +61,9 @@ public class Util {
* the object from which the ResourceSet is retrieved
* @return the ResourceSet in which the eObject is managed, or a new one if no resource is
* associated to the eObject
+ * @deprecated Registered Libraries/Profiles should not be loaded into the current resource set. Use {@link #getSharedResourceSet()} instead
*/
+ @Deprecated
public static ResourceSet getResourceSet(EObject eObject) {
if(eObject != null && eObject.eResource() != null) {
return eObject.eResource().getResourceSet();
@@ -80,4 +84,18 @@ public class Util {
}
}
+ private static ResourceSet sharedResourceSet;
+
+ public static ResourceSet getSharedResourceSet() {
+ if(sharedResourceSet == null) {
+ sharedResourceSet = new ResourceSetImpl();
+
+ sharedResourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, true);
+ sharedResourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true);
+ sharedResourceSet.getLoadOptions().put(XMIResource.OPTION_LAX_FEATURE_PROCESSING, Boolean.TRUE);
+ sharedResourceSet.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
+ }
+ return sharedResourceSet;
+ }
+
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.import/META-INF/MANIFEST.MF
index 88814383466..9f879067817 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/META-INF/MANIFEST.MF
@@ -8,11 +8,13 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
org.eclipse.papyrus.uml.profile;bundle-version="1.0.0",
- org.eclipse.emf.transaction;bundle-version="1.4.0",
org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
org.eclipse.core.databinding;bundle-version="1.4.1",
org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
+ org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.7.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.import/plugin.xml
index 3124266293b..1663f4cbfd3 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/plugin.xml
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/plugin.xml
@@ -31,6 +31,17 @@
id="org.eclipse.papyrus.uml.import.menu"
label="&amp;Import"
tooltip="Papyrus Import Menu">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.infra.emf.readonly.tester.canMakeWritable"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+
<command
commandId="org.eclipse.papyrus.import.registered.profile"
icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Profile.gif"
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/AbstractImportHandler.java b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/AbstractImportHandler.java
index ff05e406820..a7460a7c343 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/AbstractImportHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/AbstractImportHandler.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
+ * Copyright (c) 2012, 2014 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,12 +8,32 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.importt.handlers;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler;
-import org.eclipse.uml2.common.edit.command.ChangeCommand;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PackageImport;
import org.eclipse.uml2.uml.UMLFactory;
@@ -21,10 +41,17 @@ import org.eclipse.uml2.uml.UMLFactory;
public abstract class AbstractImportHandler extends AbstractCommandHandler {
- protected abstract class AbstractImportCommand extends ChangeCommand {
+ protected abstract class AbstractImportCommand extends AbstractTransactionalCommand {
+ private final Runnable runnable;
+
+ private final String description;
+
protected AbstractImportCommand(Runnable runnable, String label, String description) {
- super(AbstractImportHandler.this.getEditingDomain(), runnable, label, description);
+ super(AbstractImportHandler.this.getEditingDomain(), label, computeAffectedFiles(getSelectedElements()));
+
+ this.runnable = runnable;
+ this.description = description;
}
/**
@@ -42,6 +69,54 @@ public abstract class AbstractImportHandler extends AbstractCommandHandler {
return false;
}
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ runnable.run();
+ return CommandResult.newOKCommandResult();
+ }
+
+ String getDescription() {
+ return description;
+ }
+ }
+
+ static List<IFile> computeAffectedFiles(Collection<?> selected) {
+ Set<IFile> unique = new LinkedHashSet<IFile>();
+
+ for (Object next : selected) {
+ EObject object = (next instanceof EObject) ? (EObject)next : null;
+ Resource resource = (object == null) ? null : object.eResource();
+ if (resource != null) {
+ IFile file = WorkspaceSynchronizer.getFile(resource);
+ if (file != null) {
+ unique.add(file);
+ }
+ }
+ }
+
+ return new ArrayList<IFile>(unique);
+ }
+
+ protected Command getCommand() {
+ ICommand command = getGMFCommand();
+ GMFtoEMFCommandWrapper result = new GMFtoEMFCommandWrapper(command);
+
+ if (command instanceof AbstractImportCommand) {
+ result.setDescription(((AbstractImportCommand)command).getDescription());
+ }
+
+ return result;
+ }
+
+ protected abstract ICommand getGMFCommand();
+
+ /**
+ * Loads the Package resource into the current resource set
+ *
+ * @param _package
+ */
+ protected void handleLoadPackage(Package _package) {
+ EMFHelper.reloadIntoContext(_package, getSelectedElement());
}
/**
@@ -52,8 +127,11 @@ public abstract class AbstractImportHandler extends AbstractCommandHandler {
*/
protected void handleImportPackage(Package _package) {
PackageImport ei = UMLFactory.eINSTANCE.createPackageImport();
- ei.setImportedPackage(_package);
+
+ Package importedPackage = EMFHelper.reloadIntoContext(_package, getSelectedElement());
+
((Package)getSelectedElement()).getPackageImports().add(ei);
+ ei.setImportedPackage(importedPackage);
}
/**
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportPackageFromUserModelHandler.java b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportPackageFromUserModelHandler.java
index 548c4240884..79be0d74406 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportPackageFromUserModelHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportPackageFromUserModelHandler.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2011, 2013 CEA LIST.
- *
+ * Copyright (c) 2011, 2014 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,7 +9,8 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
- *
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.importt.handlers;
@@ -17,7 +18,7 @@ import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
-import org.eclipse.emf.common.command.Command;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.uml.importt.ui.PackageImportDialog;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ElementImportTreeSelectionDialog.ImportSpec;
@@ -29,12 +30,8 @@ import org.eclipse.uml2.uml.Package;
public class ImportPackageFromUserModelHandler extends AbstractImportHandler {
- /**
- *
- * {@inheritDoc}
- */
@Override
- protected Command getCommand() {
+ protected ICommand getGMFCommand() {
return new ImportFromFileCommand();
}
@@ -45,7 +42,7 @@ public class ImportPackageFromUserModelHandler extends AbstractImportHandler {
/**
* Creates a new ImportLibraryFromRepositoryCommand
- *
+ *
* @param editingDomain
* editing domain that manages the changed objects
* @param runnable
@@ -86,9 +83,12 @@ public class ImportPackageFromUserModelHandler extends AbstractImportHandler {
case COPY:
handleCopyPackage(selectedPackage);
break;
- default:
+ case IMPORT:
handleImportPackage(selectedPackage);
break;
+ default:
+ handleLoadPackage(selectedPackage);
+ break;
}
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java
index 82684194e42..f672005ea23 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredPackageHandler.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2011, 2013 CEA LIST.
- *
+ * Copyright (c) 2011, 2014 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,7 +9,8 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
- *
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.importt.handlers;
@@ -18,10 +19,10 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.uml.extensionpoints.library.FilteredRegisteredLibrariesSelectionDialog;
@@ -37,12 +38,8 @@ import org.eclipse.uml2.uml.Package;
public class ImportRegisteredPackageHandler extends AbstractImportHandler {
- /**
- *
- * {@inheritDoc}
- */
@Override
- protected Command getCommand() {
+ protected ICommand getGMFCommand() {
return new ImportLibraryFromRepositoryCommand();
}
@@ -54,7 +51,7 @@ public class ImportRegisteredPackageHandler extends AbstractImportHandler {
*/
protected void importLibraries(RegisteredLibrary[] librariesToImport) {
// retrieve the current resource set
- ResourceSet resourceSet = Util.getResourceSet(getSelectedElement());
+ ResourceSet resourceSet = Util.getSharedResourceSet();
for(int i = 0; i < librariesToImport.length; i++) {
RegisteredLibrary currentLibrary = (librariesToImport[i]);
@@ -66,16 +63,18 @@ public class ImportRegisteredPackageHandler extends AbstractImportHandler {
if(dialog.open() == Window.OK) {
Collection<ImportSpec<Package>> result = dialog.getResult();
- for (ImportSpec<Package> resultElement : result) {
- Package selectedPackage = resultElement
- .getElement();
- switch (resultElement.getAction()) {
- case COPY :
- handleCopyPackage(selectedPackage);
- break;
- default :
- handleImportPackage(selectedPackage);
- break;
+ for(ImportSpec<Package> resultElement : result) {
+ Package selectedPackage = resultElement.getElement();
+ switch(resultElement.getAction()) {
+ case COPY:
+ handleCopyPackage(selectedPackage);
+ break;
+ case IMPORT:
+ handleImportPackage(selectedPackage);
+ break;
+ default: //Load
+ handleLoadPackage(selectedPackage);
+ break;
}
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java
index 22de25f417f..640960da3ad 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/handlers/ImportRegisteredProfileHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2013 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.importt.handlers;
@@ -19,10 +20,10 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.uml.extensionpoints.profile.FilteredRegisteredProfilesAsLibrarySelectionDialog;
@@ -33,7 +34,6 @@ import org.eclipse.papyrus.uml.profile.ui.dialogs.ElementImportTreeSelectionDial
import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PackageImport;
import org.eclipse.uml2.uml.Profile;
@@ -43,12 +43,8 @@ import org.eclipse.uml2.uml.UMLFactory;
public class ImportRegisteredProfileHandler extends AbstractImportHandler {
- /**
- *
- * {@inheritDoc}
- */
@Override
- protected Command getCommand() {
+ protected ICommand getGMFCommand() {
return new ImportProfileCommand();
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/ui/PackageImportDialog.java b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/ui/PackageImportDialog.java
index 5fce773acff..4fdd9dd33f9 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/ui/PackageImportDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.import/src/org/eclipse/papyrus/uml/importt/ui/PackageImportDialog.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012, 2013 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.importt.ui;
@@ -28,28 +28,36 @@ import org.eclipse.uml2.uml.Package;
/**
* An import package dialog, with the option to import a copy of the selected
* package
- *
+ *
* @author Camille Letavernier
*/
-public class PackageImportDialog
- extends PackageImportTreeSelectionDialog {
+public class PackageImportDialog extends PackageImportTreeSelectionDialog {
public PackageImportDialog(Shell parent, Package model) {
super(parent, model);
}
- public PackageImportDialog(Shell parent,
- Collection<? extends Package> models) {
+ public PackageImportDialog(Shell parent, Collection<? extends Package> models) {
super(parent, models);
}
@Override
public Composite createDialogArea(Composite parent) {
- Composite result = (Composite) super.createDialogArea(parent);
+ Composite result = (Composite)super.createDialogArea(parent);
Composite buttons = new Composite(result, SWT.NONE);
buttons.setLayout(new RowLayout());
+ Button loadAll = new Button(buttons, SWT.PUSH);
+ loadAll.setText("Load All");
+ loadAll.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ selectAll(ImportAction.LOAD);
+ }
+ });
+
Button importAll = new Button(buttons, SWT.PUSH);
importAll.setText("Import All");
importAll.addSelectionListener(new SelectionAdapter() {
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java
index 53f51726471..c1f6fbb658c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ElementImportTreeSelectionDialog.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -74,61 +74,61 @@ import org.eclipse.uml2.uml.util.UMLSwitch;
public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog {
private final Class<E> elementType;
-
+
protected List<Package> packages;
-
+
protected final EnumSet<ImportAction> allowedActions;
protected boolean subSelection = false;
private Set<E> initialSelections = new java.util.HashSet<E>();
-
+
private Map<E, ImportSpec<E>> importSpecs = new java.util.HashMap<E, ImportSpec<E>>();
-
+
/**
- *
+ *
*/
protected List<ImportSpec<E>> elementsToImport = new ArrayList<ImportSpec<E>>();
/**
- *
+ *
*/
protected CheckboxTreeViewer elementTree;
/**
- *
+ *
*/
protected static final Image IMG_PACKAGE = ImageManager.IMG_PACKAGE;
/**
- *
+ *
*/
protected static final Image IMG_CLASS = ImageManager.IMG_CLASS;
/**
- *
+ *
*/
protected static final Image IMG_DATATYPE = ImageManager.IMG_DATATYPE;
/**
- *
+ *
*/
protected static final Image IMG_ENUM = ImageManager.IMG_ENUMERATION;
/**
- *
+ *
*/
protected static final Image IMG_PRIMITIVE = ImageManager.IMG_PRIMITIVETYPE;
protected static final Image IMG_PROFILE = ImageManager.IMG_PROFILE;
/**
- *
+ *
*/
protected static final Image IMG_ASSOCIATION = ImageManager.IMG_ASSOCIATION;
/**
- *
+ *
*/
protected static final Image IMG_INSTANCESPEC = ImageManager.IMG_INSTANCESPEC;
@@ -179,7 +179,7 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
*/
public ElementImportTreeSelectionDialog(Shell parent, Set<ImportAction> allowedActions, Class<E> elementType, Collection<? extends Package> models) {
super(parent);
-
+
this.allowedActions = EnumSet.copyOf(allowedActions);
this.elementType = elementType;
this.packages = new java.util.ArrayList<Package>(models);
@@ -190,7 +190,7 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
super.configureShell(newShell);
newShell.setText("Select the elements to import");
}
-
+
/**
*
*
@@ -210,40 +210,38 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
tree.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
- if (event.detail == SWT.CHECK) {
+ if(event.detail == SWT.CHECK) {
handleCheckStateChanged(getImportSpec(event.item));
}
}
});
-
+
elementTree = new CheckboxTreeViewer(tree);
-
+
// create tree column for element
TreeViewerColumn col = new TreeViewerColumn(elementTree, SWT.NONE);
col.getColumn().setText("Import");
col.getColumn().setWidth(300);
col.getColumn().setResizable(true);
col.setLabelProvider(new CellLabelProvider() {
-
+
@Override
public void update(ViewerCell cell) {
- ImportSpec<?> importSpec = (ImportSpec<?>) cell
- .getElement();
+ ImportSpec<?> importSpec = (ImportSpec<?>)cell.getElement();
cell.setImage(getElementImage(importSpec.getElement()));
cell.setText(getElementText(importSpec.getElement()));
}
-
+
@Override
public String getToolTipText(Object element) {
- ImportSpec<?> importSpec = (ImportSpec<?>) element;
+ ImportSpec<?> importSpec = (ImportSpec<?>)element;
- return ((EObject) importSpec.getElement()).eResource().getURI()
- .toString();
+ return ((EObject)importSpec.getElement()).eResource().getURI().toString();
}
});
ColumnViewerToolTipSupport.enableFor(elementTree);
-
- if (allowedActions.size() > 1) {
+
+ if(allowedActions.size() > 1) {
tree.setHeaderVisible(true);
col.getColumn().setWidth(220);
@@ -253,68 +251,70 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
col.getColumn().setWidth(80);
col.getColumn().setResizable(true);
col.setLabelProvider(new CellLabelProvider() {
-
+
@Override
public void update(ViewerCell cell) {
- ImportSpec<?> importSpec = (ImportSpec<?>) cell
- .getElement();
+ ImportSpec<?> importSpec = (ImportSpec<?>)cell.getElement();
cell.setText(getDisplayName(importSpec.getAction()));
}
});
col.setEditingSupport(new ImportActionEditingSupport(elementTree));
}
-
+
elementTree.setContentProvider(new ElementTreeContentProvider());
elementTree.setInput(packages);
elementTree.expandAll();
// post a selection of the initially selected elements
tree.getDisplay().asyncExec(new Runnable() {
-
+
public void run() {
- for (E next : initialSelections) {
+ for(E next : initialSelections) {
ImportSpec<E> importSpec = getImportSpec(next);
- if (importSpec != null) {
+ if(importSpec != null) {
elementTree.setChecked(importSpec, true);
handleCheckStateChanged(importSpec);
}
}
}
});
-
+
return comp;
}
-
+
protected void handleCheckStateChanged(ImportSpec<E> importSpec) {
- if (!elementTree.getChecked(importSpec)) {
+ if(!elementTree.getChecked(importSpec)) {
removeResult(importSpec);
} else {
addResult(importSpec);
}
}
-
+
protected void setInitialSelection(E element) {
initialSelections.add(element);
}
-
+
protected String getDisplayName(ImportAction importAction) {
String result;
-
- switch (importAction) {
- case IMPORT:
- result = "Import";
- break;
- case APPLY:
- result = "Apply";
- break;
- case COPY:
- result = "Copy";
- break;
- default:
- result = "<none>";
+
+ switch(importAction) {
+ case IMPORT:
+ result = "Import";
+ break;
+ case APPLY:
+ result = "Apply";
+ break;
+ case COPY:
+ result = "Copy";
+ break;
+ case LOAD:
+ result = "Load";
+ break;
+ default:
+ result = "<none>";
}
-
+
return result;
}
@@ -325,10 +325,10 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
*/
@SuppressWarnings("unchecked")
protected void addChildSelection(ImportSpec<E> item) {
- ITreeContentProvider provider = (ITreeContentProvider) elementTree.getContentProvider();
- for (Object next : provider.getChildren(item)) {
+ ITreeContentProvider provider = (ITreeContentProvider)elementTree.getContentProvider();
+ for(Object next : provider.getChildren(item)) {
elementTree.setChecked(next, true);
- addResult((ImportSpec<E>) next);
+ addResult((ImportSpec<E>)next);
}
}
@@ -339,59 +339,68 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
*/
@SuppressWarnings("unchecked")
protected void remChildSelection(ImportSpec<E> item) {
- ITreeContentProvider provider = (ITreeContentProvider) elementTree.getContentProvider();
- for (Object next : provider.getChildren(item)) {
+ ITreeContentProvider provider = (ITreeContentProvider)elementTree.getContentProvider();
+ for(Object next : provider.getChildren(item)) {
elementTree.setChecked(next, false);
- removeResult((ImportSpec<E>) next);
+ removeResult((ImportSpec<E>)next);
}
}
protected String getElementText(Element element) {
String result = null;
-
- if (element instanceof NamedElement) {
- result = ((NamedElement) element).getName();
+
+ if(element instanceof NamedElement) {
+ result = ((NamedElement)element).getName();
}
-
+
return (result == null) ? "" : result;
}
-
+
protected Image getElementImage(Element element) {
return new UMLSwitch<Image>() {
+
+ @Override
public Image casePackage(Package object) {
return IMG_PACKAGE;
}
-
+
+ @Override
public Image caseProfile(Profile object) {
return IMG_PROFILE;
}
-
+
+ @Override
public Image caseAssociation(Association object) {
return IMG_ASSOCIATION;
}
-
+
+ @Override
public Image caseEnumeration(Enumeration object) {
return IMG_ENUM;
}
-
+
+ @Override
public Image casePrimitiveType(PrimitiveType object) {
return IMG_PRIMITIVE;
}
-
+
+ @Override
public Image caseDataType(DataType object) {
return IMG_DATATYPE;
}
-
+
+ @Override
public Image caseClass(org.eclipse.uml2.uml.Class object) {
return IMG_CLASS;
}
-
+
+ @Override
public Image caseInstanceSpecification(InstanceSpecification object) {
return IMG_INSTANCESPEC;
}
}.doSwitch(element);
}
-
+
/**
* Returns the elements to import.
*
@@ -403,47 +412,47 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
protected Collection<? extends Element> getChildren(Package package_) {
Collection<Element> result = new java.util.ArrayList<Element>();
-
+
Iterator<PackageableElement> elemIter = package_.getPackagedElements().iterator();
- while (elemIter.hasNext()) {
+ while(elemIter.hasNext()) {
Element elem = elemIter.next();
- if (elem instanceof NamedElement) {
+ if(elem instanceof NamedElement) {
result.add(elem);
}
}
-
+
return result;
}
-
+
protected ImportSpec<E> createImportSpec(Element element) {
@SuppressWarnings("unchecked")
- ImportSpec<E> result = new ImportSpec<E>((E) element);
- if (elementType.isInstance(element) && !allowedActions.isEmpty()) {
+ ImportSpec<E> result = new ImportSpec<E>((E)element);
+ if(elementType.isInstance(element) && !allowedActions.isEmpty()) {
result.setAction(allowedActions.iterator().next());
}
return result;
}
-
+
@SuppressWarnings("unchecked")
protected ImportSpec<E> getImportSpec(Element element) {
ImportSpec<E> result = importSpecs.get(element);
- if (result == null) {
+ if(result == null) {
result = createImportSpec(element);
- importSpecs.put((E) element, result);
+ importSpecs.put((E)element, result);
}
return result;
}
-
+
@SuppressWarnings("unchecked")
protected ImportSpec<E> getImportSpec(Widget item) {
- return (ImportSpec<E>) item.getData();
+ return (ImportSpec<E>)item.getData();
}
-
+
protected <T extends E> Iterator<T> getAllElementsOfType(final Class<T> type) {
return filter(EcoreUtil.getAllContents(packages), type);
}
-
+
private <T> Iterator<T> filter(final Iterator<?> iterator, final Class<T> type) {
return new Iterator<T>() {
@@ -452,10 +461,10 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
private T next;
public boolean hasNext() {
- if (next == null) {
- while (delegate.hasNext()) {
+ if(next == null) {
+ while(delegate.hasNext()) {
Object next = delegate.next();
- if (type.isInstance(next)) {
+ if(type.isInstance(next)) {
this.next = type.cast(next);
break;
}
@@ -466,7 +475,7 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
}
public T next() {
- if (!hasNext()) {
+ if(!hasNext()) {
throw new NoSuchElementException();
}
@@ -480,34 +489,34 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
}
};
}
-
+
protected <T extends E> Iterator<T> getRootElementsOfType(final Class<T> type) {
return filter(packages.iterator(), type);
}
protected void selectAll(ImportAction action) {
Iterator<E> iter;
-
+
// if we propagate selections to children, then we need to cover the
// entire tree. Otherwise, we process only the root packages because
// the nested packages are imported/copied recursively
- if ((action == ImportAction.NONE) || subSelection) {
+ if((action == ImportAction.NONE) || subSelection) {
iter = getAllElementsOfType(elementType);
} else {
// first, clear selection of any nested packages
selectAll(ImportAction.NONE);
iter = getRootElementsOfType(elementType);
}
-
- while (iter.hasNext()) {
+
+ while(iter.hasNext()) {
ImportSpec<E> importSpec = getImportSpec(iter.next());
- if (action == ImportAction.NONE) {
- if (elementTree.getChecked(importSpec)) {
+ if(action == ImportAction.NONE) {
+ if(elementTree.getChecked(importSpec)) {
elementTree.setChecked(importSpec, false);
removeResult(importSpec);
}
} else {
- if (!elementTree.getChecked(importSpec)) {
+ if(!elementTree.getChecked(importSpec)) {
elementTree.setChecked(importSpec, true);
addResult(importSpec);
}
@@ -516,50 +525,52 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
elementTree.update(importSpec, null);
}
}
-
+
protected void addResult(ImportSpec<E> importSpec) {
- if (!elementsToImport.contains(importSpec)) {
+ if(!elementsToImport.contains(importSpec)) {
elementsToImport.add(importSpec);
}
- if (subSelection) {
+ if(subSelection) {
addChildSelection(importSpec);
}
}
protected void removeResult(ImportSpec<E> importSpec) {
// bug fix when list is already initialized, it can have several instance of the same element
- while (elementsToImport.contains(importSpec)) {
+ while(elementsToImport.contains(importSpec)) {
elementsToImport.remove(importSpec);
}
- if (subSelection) {
+ if(subSelection) {
remChildSelection(importSpec);
}
}
-
+
//
// Nested types
//
-
+
public static class ImportSpec<E extends Element> {
+
private final E element;
+
private ImportAction action = ImportAction.NONE;
-
+
protected ImportSpec(E element) {
this.element = element;
}
-
+
public E getElement() {
return element;
}
-
+
public ImportAction getAction() {
return action;
}
-
+
public void setAction(ImportAction action) {
this.action = (action == null) ? ImportAction.NONE : action;
}
-
+
@Override
public String toString() {
return String.format("<%s> %s", action, element);
@@ -573,6 +584,8 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
public static enum ImportAction {
/** Do not import the element. */
NONE,
+ /** Loads the resource */
+ LOAD,
/** Import the element or package. */
IMPORT,
/** Apply the profile (only applicable to profiles). */
@@ -580,119 +593,119 @@ public class ElementImportTreeSelectionDialog<E extends Element> extends Dialog
/** Copy the element or package. */
COPY;
}
-
+
private class ElementTreeContentProvider implements ITreeContentProvider {
+
public Object[] getElements(Object inputElement) {
List<ImportSpec<E>> result = new java.util.ArrayList<ImportSpec<E>>(packages.size());
-
- for (Package next : packages) {
+
+ for(Package next : packages) {
result.add(getImportSpec(next));
}
-
+
return result.toArray();
}
-
+
public Object[] getChildren(Object parentElement) {
List<ImportSpec<E>> result = new java.util.ArrayList<ImportSpec<E>>();
-
- Element parent = ((ImportSpec<?>) parentElement).getElement();
- if (parent instanceof Package) {
- for (Element next : ElementImportTreeSelectionDialog.this
- .getChildren((Package) parent)) {
-
+
+ Element parent = ((ImportSpec<?>)parentElement).getElement();
+ if(parent instanceof Package) {
+ for(Element next : ElementImportTreeSelectionDialog.this.getChildren((Package)parent)) {
+
result.add(getImportSpec(next));
}
}
-
+
return result.toArray();
}
-
+
public boolean hasChildren(Object element) {
- Element parent = ((ImportSpec<?>) element).getElement();
+ Element parent = ((ImportSpec<?>)element).getElement();
return parent instanceof Package;
}
-
+
public Object getParent(Object element) {
ImportSpec<?> result = null;
-
- ImportSpec<?> importSpec = (ImportSpec<?>) element;
- Element parent = ((Element) importSpec.getElement()).getOwner();
-
- if ((parent != null) && (importSpecs.containsKey(parent))) {
+
+ ImportSpec<?> importSpec = (ImportSpec<?>)element;
+ Element parent = ((Element)importSpec.getElement()).getOwner();
+
+ if((parent != null) && (importSpecs.containsKey(parent))) {
result = importSpecs.get(parent);
}
-
+
return result;
}
-
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// pass
}
-
+
public void dispose() {
// pass
}
}
-
+
private class ImportActionEditingSupport extends EditingSupport {
+
private ComboBoxViewerCellEditor editor;
-
+
public ImportActionEditingSupport(ColumnViewer viewer) {
super(viewer);
}
@Override
protected CellEditor getCellEditor(Object element) {
- if (editor == null) {
- editor = new ComboBoxViewerCellEditor((Tree) getViewer().getControl());
+ if(editor == null) {
+ editor = new ComboBoxViewerCellEditor((Tree)getViewer().getControl(), SWT.BORDER);
editor.setLabelProvider(new LabelProvider() {
+
@Override
public String getText(Object element) {
- return getDisplayName((ImportAction) element);
+ return getDisplayName((ImportAction)element);
}
});
- editor.setContentProvider(new ArrayContentProvider());
+ editor.setContentProvider(ArrayContentProvider.getInstance());
editor.setInput(allowedActions);
}
-
+
return editor;
}
@Override
protected boolean canEdit(Object element) {
// can't import elements of the wrong type
- ImportSpec<?> spec = (ImportSpec<?>) element;
+ ImportSpec<?> spec = (ImportSpec<?>)element;
return elementType.isInstance(spec.getElement());
}
@Override
protected Object getValue(Object element) {
- ImportSpec<?> spec = (ImportSpec<?>) element;
-
- return elementType.isInstance(spec.getElement())
- ? spec.getAction()
- : ImportAction.NONE;
+ ImportSpec<?> spec = (ImportSpec<?>)element;
+
+ return elementType.isInstance(spec.getElement()) ? spec.getAction() : ImportAction.NONE;
}
@Override
protected void setValue(final Object element, Object value) {
@SuppressWarnings("unchecked")
- ImportSpec<E> importSpec = (ImportSpec<E>) element;
- importSpec.setAction((ImportAction) value);
-
+ ImportSpec<E> importSpec = (ImportSpec<E>)element;
+ importSpec.setAction((ImportAction)value);
+
// if the user is setting the import action, he wants it imported
- if (!elementTree.getChecked(importSpec)) {
+ if(!elementTree.getChecked(importSpec)) {
elementTree.setChecked(importSpec, true);
addResult(importSpec);
}
-
+
editor.getControl().getDisplay().asyncExec(new Runnable() {
-
+
public void run() {
elementTree.update(element, null);
}
});
}
-
+
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/PackageImportTreeSelectionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/PackageImportTreeSelectionDialog.java
index b8e5173d1eb..933c0255f2b 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/PackageImportTreeSelectionDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/PackageImportTreeSelectionDialog.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,37 +25,37 @@ import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PackageableElement;
/**
- *
+ *
*/
public class PackageImportTreeSelectionDialog extends ElementImportTreeSelectionDialog<Package> {
/**
- *
- *
+ *
+ *
* @param model
* @param parent
*/
public PackageImportTreeSelectionDialog(Shell parent, Package model) {
- super(parent, EnumSet.of(ImportAction.IMPORT, ImportAction.COPY), Package.class, model);
+ super(parent, EnumSet.of(ImportAction.IMPORT, ImportAction.COPY, ImportAction.LOAD), Package.class, model);
}
public PackageImportTreeSelectionDialog(Shell parent, Collection<? extends Package> models) {
- super(parent, EnumSet.of(ImportAction.IMPORT, ImportAction.COPY), Package.class, models);
+ super(parent, EnumSet.of(ImportAction.IMPORT, ImportAction.COPY, ImportAction.LOAD), Package.class, models);
}
-
+
@Override
protected Collection<? extends Element> getChildren(Package package_) {
Collection<Package> result = new java.util.ArrayList<Package>();
-
+
Iterator<PackageableElement> elemIter = package_.getPackagedElements().iterator();
while(elemIter.hasNext()) {
Element elem = elemIter.next();
if(elem instanceof Package) {
- result.add((Package) elem);
+ result.add((Package)elem);
}
}
-
+
return result;
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/META-INF/MANIFEST.MF b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/META-INF/MANIFEST.MF
index 0d16b6892c1..9f48270c45c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/META-INF/MANIFEST.MF
@@ -7,10 +7,12 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.105.0",
org.eclipse.gmf.runtime.common.ui.services;bundle-version="1.7.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.7.0",
org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.7.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0",
org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0",
- org.eclipse.xtext;bundle-version="2.4.2"
+ org.eclipse.xtext;bundle-version="2.4.2",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
@@ -19,4 +21,4 @@ Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.uml.properties.xtext;singleto
n:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Bundle-Localization: plugin
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/about.html b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/build.properties b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/build.properties
index 6f20375d6c7..653ec3c3daf 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/build.properties
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/build.properties
@@ -2,4 +2,7 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml
index ed9df447719..6e74c9f1437 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml
@@ -25,4 +25,11 @@
</propertyTab>
</propertyTabs>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.core.modelListener">
+ <listener
+ name="advancedEditing.modelListener"
+ realization="org.eclipse.papyrus.uml.properties.xtext.sheet.ModelListener">
+ </listener>
+ </extension>
</plugin>
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java
index e1bbf4403ad..b3f878687fc 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java
@@ -1,5 +1,21 @@
+/*****************************************************************************
+ * Copyright (c) 2013, 2014 Itemis AG, 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:
+ * Itemis - Initial API and implementation
+ * Ansgar Radermacher - added undo/redo support (inspired by code from Petr Bodnar)
+ * Christian W. Damus (CEA) - bug 323802
+ *
+ *****************************************************************************/
+
package org.eclipse.papyrus.uml.properties.xtext.sheet;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
@@ -13,14 +29,20 @@ import org.eclipse.papyrus.extensionpoints.editors.Activator;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.papyrus.uml.xtext.integration.StyledTextXtextAdapter;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProvider;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProviderWithInit;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ExtendedModifyEvent;
+import org.eclipse.swt.custom.ExtendedModifyListener;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -44,6 +66,19 @@ public class AdvancedEditingPropertySection extends
final private ContextElementAdapter contextElementAdapter = new ContextElementAdapter(
this);
+ UndoRedoStack<ExtendedModifyEvent> undoRedoStack;
+
+ protected boolean isUndo;
+
+ protected boolean isRedo;
+
+ protected EObject currentEObj;
+
+ public AdvancedEditingPropertySection() {
+ undoRedoStack = new UndoRedoStack<ExtendedModifyEvent>();
+ ModelListener.currentEditor = this;
+ }
+
@Override
public void refresh() {
updateXtextAdapters(textControl);
@@ -54,6 +89,9 @@ public class AdvancedEditingPropertySection extends
textControl.setText(printString);
}
+ if (textControl != null) {
+ textControl.setEnabled(!isReadOnly());
+ }
}
@Override
@@ -87,15 +125,21 @@ public class AdvancedEditingPropertySection extends
createTextControl(form.getBody());
}
+
protected void createTextControl(final Composite parent) {
textControl = new StyledText(parent, SWT.MULTI | SWT.BORDER
| SWT.V_SCROLL | SWT.WRAP);
+
textControl.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
IParser parser = getParser();
- if (parser != null) {
+ if (xtextAdapter.getCompletionProposalAdapter().delayedIsPopupOpen()) {
+ // ignore focus lost
+ return;
+ }
+ if ((parser != null) && !parser.getEditString(null, 0).equals(textControl.getText())) {
ICommand command = parser.getParseCommand(
new EObjectAdapter(getEObject()),
textControl.getText(), 0);
@@ -108,52 +152,122 @@ public class AdvancedEditingPropertySection extends
public void focusGained(FocusEvent e) {
}
});
- ((StyledText) textControl).setAlwaysShowScrollBars(false);
+
+ textControl.setAlwaysShowScrollBars(false);
GridDataFactory.fillDefaults().grab(true, true).hint(parent.getSize())
.applyTo(textControl);
+ textControl.addExtendedModifyListener(new ExtendedModifyListener() {
+
+ public void modifyText(ExtendedModifyEvent event) {
+ if (isUndo) {
+ undoRedoStack.pushRedo(event);
+ } else { // is Redo or a normal user action
+ undoRedoStack.pushUndo(event);
+ if (!isRedo) {
+ undoRedoStack.clearRedo();
+ // TODO Switch to treat consecutive characters as one event?
+ }
+ }
+ }
+ });
+
+ textControl.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent e) {
+ boolean isCtrl = (e.stateMask & SWT.CTRL) > 0;
+ boolean isAlt = (e.stateMask & SWT.ALT) > 0;
+ if (isCtrl && !isAlt) {
+ boolean isShift = (e.stateMask & SWT.SHIFT) > 0;
+ if (e.keyCode == 'z') {
+ if (isShift) {
+ redo();
+ }
+ else {
+ undo();
+ }
+ }
+ }
+ }
+ });
+ }
+ protected void undo() {
+ if (undoRedoStack.hasUndo()) {
+ isUndo = true;
+ revertEvent(undoRedoStack.popUndo());
+ isUndo = false;
+ }
}
+ protected void redo() {
+ if (undoRedoStack.hasRedo()) {
+ isRedo = true;
+ revertEvent(undoRedoStack.popRedo());
+ isRedo = false;
+ }
+ }
+
+ /**
+ * Reverts the given modify event, in the way as the Eclipse text editor
+ * does it.
+ *
+ * @param event
+ */
+ private void revertEvent(ExtendedModifyEvent event) {
+ textControl.replaceTextRange(event.start, event.length, event.replacedText);
+ // (causes the modifyText() listener method to be called)
+
+ textControl.setSelectionRange(event.start, event.replacedText.length());
+ }
+
+
protected DefaultXtextDirectEditorConfiguration getConfigurationFromSelection() {
- IGraphicalEditPart part = getEditPartFromSelection();
- if (part != null) {
+ EObject semanticElement = getSemanticObjectFromSelection();
+ if (semanticElement != null) {
IPreferenceStore store = Activator.getDefault()
.getPreferenceStore();
- String semanticClassName = part.resolveSemanticElement().eClass()
+ String semanticClassName = semanticElement.eClass()
.getInstanceClassName();
String key = IDirectEditorsIds.EDITOR_FOR_ELEMENT
+ semanticClassName;
String languagePreferred = store.getString(key);
- if (languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) { //$NON-NLS-1$
IDirectEditorConfiguration configuration = DirectEditorsUtil
.findEditorConfiguration(languagePreferred,
semanticClassName);
if (configuration instanceof DefaultXtextDirectEditorConfiguration) {
- return (DefaultXtextDirectEditorConfiguration) configuration;
+
+ DefaultXtextDirectEditorConfiguration xtextConfiguration = (DefaultXtextDirectEditorConfiguration) configuration;
+ xtextConfiguration.preEditAction(semanticElement);
+ return xtextConfiguration;
}
}
}
return null;
}
- protected IGraphicalEditPart getEditPartFromSelection() {
+ protected EObject getSemanticObjectFromSelection() {
Object selection = getPrimarySelection();
if (selection instanceof IGraphicalEditPart) {
- return (IGraphicalEditPart) selection;
+ return ((IGraphicalEditPart) selection).resolveSemanticElement();
+ }
+ else if (selection instanceof IAdaptable) {
+ return (EObject) ((IAdaptable) selection).getAdapter(EObject.class);
}
return null;
}
protected IParser getParser() {
- final IGraphicalEditPart part = getEditPartFromSelection();
- if (configuration != null && part != null) {
- return configuration.createParser(part.resolveSemanticElement());
+ final EObject semanticElement = getSemanticObjectFromSelection();
+ if (configuration != null && semanticElement != null) {
+ return configuration.createParser(semanticElement);
}
return null;
}
protected void updateXtextAdapters(Control styledText) {
+ final Object oldObjectToEdit = configuration != null ? configuration.getObjectToEdit() : null;
+
final DefaultXtextDirectEditorConfiguration newConfiguration = getConfigurationFromSelection();
// Check if configuration has changed and update adapters
if (newConfiguration != null && newConfiguration != configuration) {
@@ -164,13 +278,40 @@ public class AdvancedEditingPropertySection extends
configuration = newConfiguration;
xtextAdapter = new StyledTextXtextAdapter(
configuration.getInjector());
+
+ EObject semanticElement = getSemanticObjectFromSelection();
+ if (semanticElement != null) {
+ newConfiguration.preEditAction(semanticElement);
+ }
+
xtextAdapter.getFakeResourceContext().getFakeResource().eAdapters()
.add(contextElementAdapter);
xtextAdapter.adapt((StyledText) styledText);
}
+
+ if (configuration.getObjectToEdit() != oldObjectToEdit) {
+ IContextElementProvider provider = configuration.getContextProvider();
+ if (provider instanceof IContextElementProviderWithInit) {
+ // update resource, if required by text editor
+ if (xtextAdapter != null) {
+ ((IContextElementProviderWithInit) provider).initResource(
+ xtextAdapter.getFakeResourceContext().getFakeResource());
+ }
+ }
+ Object semanticObject = configuration.getObjectToEdit();
+ if (semanticObject instanceof EObject) {
+ currentEObj = (EObject) semanticObject;
+ }
+ }
}
public EObject getContextObject() {
return getEObject();
}
+
+ @Override
+ protected boolean isReadOnly() {
+ EObject context = getContextObject();
+ return (context == null) || EMFHelper.isReadOnly(context) || super.isReadOnly();
+ }
} \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java
index 014c4edda46..1e35d5aa728 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java
@@ -1,6 +1,8 @@
package org.eclipse.papyrus.uml.properties.xtext.sheet;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.IFilter;
import org.eclipse.papyrus.extensionpoints.editors.Activator;
@@ -12,20 +14,27 @@ import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
public class AdvancedEditingPropertySectionFilter implements IFilter {
public boolean select(Object toTest) {
- if (toTest instanceof IGraphicalEditPart) {
- IGraphicalEditPart part = (IGraphicalEditPart) toTest;
+ EObject semanticElement = null;
+ if (toTest instanceof IAdaptable) {
+ semanticElement = (EObject) ((IAdaptable) toTest).getAdapter(EObject.class);
+ }
+ else if (toTest instanceof GraphicalEditPart) {
+ GraphicalEditPart part = (GraphicalEditPart) toTest;
+ semanticElement = part.resolveSemanticElement();
+ }
+ if (semanticElement != null) {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
String key = IDirectEditorsIds.EDITOR_FOR_ELEMENT
- + part.resolveSemanticElement().eClass().getInstanceClassName();
+ + semanticElement.eClass().getInstanceClassName();
+
String languagePreferred = store.getString(key);
if (languagePreferred != null && !languagePreferred.equals("")) {
IDirectEditorConfiguration configuration = DirectEditorsUtil.findEditorConfiguration(
- languagePreferred, part.resolveSemanticElement().eClass()
+ languagePreferred, semanticElement.eClass()
.getInstanceClassName());
return configuration instanceof ICustomDirectEditorConfiguration;
}
-
}
return false;
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/ModelListener.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/ModelListener.java
new file mode 100644
index 00000000000..8e07a4391c7
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/ModelListener.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher ansgar.radermacher@cea.fr
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.properties.xtext.sheet;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
+
+/**
+ * Main listener for model changes (registered via plugin.xml). It will delegate
+ * to the sub-listeners for specific sub-elements (type, operation, port, ...) that
+ * can be found in this package
+ *
+ * @author ansgar
+ *
+ */
+public class ModelListener implements IPapyrusListener {
+
+ public void notifyChanged(Notification notification) {
+ Object notifier = notification.getNotifier();
+ if (notifier instanceof EObject && currentEditor != null) {
+ EObject notifierEObj = (EObject) notifier;
+ while (notifierEObj != null) {
+ if (notifierEObj == currentEditor.currentEObj) {
+ currentEditor.refresh();
+ break;
+ }
+ notifierEObj = notifierEObj.eContainer();
+ }
+ }
+ }
+
+ protected static AdvancedEditingPropertySection currentEditor;
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/UndoRedoStack.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/UndoRedoStack.java
new file mode 100644
index 00000000000..f660024c95b
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/UndoRedoStack.java
@@ -0,0 +1,49 @@
+
+package org.eclipse.papyrus.uml.properties.xtext.sheet;
+
+import java.util.Stack;
+
+/**
+ * Encapsulation of the Undo and Redo stack(s)
+ * @author Petr Bodnar
+ */
+public class UndoRedoStack<T> {
+
+ private Stack<T> undo;
+ private Stack<T> redo;
+
+ public UndoRedoStack() {
+ undo = new Stack<T>();
+ redo = new Stack<T>();
+ }
+
+ public void pushUndo(T delta) {
+ undo.add(delta);
+ }
+
+ public void pushRedo(T delta) {
+ redo.add(delta);
+ }
+
+ public T popUndo() {
+ T res = undo.pop();
+ return res;
+ }
+
+ public T popRedo() {
+ T res = redo.pop();
+ return res;
+ }
+
+ public void clearRedo() {
+ redo.clear();
+ }
+
+ public boolean hasUndo() {
+ return !undo.isEmpty();
+ }
+
+ public boolean hasRedo() {
+ return !redo.isEmpty();
+ }
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx
index 9d7f477c15d..cc1223495ba 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx
@@ -1381,6 +1381,12 @@
<sections name="MultiplePackageMerge" sectionFile="ui/MultiplePackageMerge.xwt">
<widget href="ui/MultiplePackageMerge.xwt#/"/>
</sections>
+ <sections name="SingleSignalEvent" sectionFile="ui/SingleSignalEvent.xwt">
+ <widget href="ui/SingleSignalEvent.xwt#/"/>
+ </sections>
+ <sections name="MultipleSignalEvent" sectionFile="ui/SingleSignalEvent.xwt">
+ <widget href="ui/SingleSignalEvent.xwt#/"/>
+ </sections>
</tabs>
<tabs label="Comments" id="comments" category="org.eclipse.papyrus" image="" priority="20">
<sections name="SingleElementAppliedComments" sectionFile="ui/SingleElementAppliedComments.xwt">
@@ -4202,6 +4208,18 @@
</constraints>
</constraints>
</views>
+ <views name="SingleSignalEvent" sections="//@tabs.0/@sections.460">
+ <constraints xsi:type="constraints:SimpleConstraint" name="IsSingleSignalEvent">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="umlClassName" value="SignalEvent"/>
+ </constraints>
+ </views>
+ <views elementMultiplicity="-1" name="MultipleSignalEvent" sections="//@tabs.0/@sections.461">
+ <constraints xsi:type="constraints:SimpleConstraint" name="IsMultipleSignalEvent">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="umlClassName" value="SignalEvent"/>
+ </constraints>
+ </views>
<dataContexts name="UML" label="UML">
<elements name="Comment" supertypes="//@dataContexts.0/@elements.1">
<properties name="body" description="Specifies a string that is the comment."/>
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/ExpressionLanguageFactory.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/ExpressionLanguageFactory.java
index 81733dab260..b26c5153e5a 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/ExpressionLanguageFactory.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/ExpressionLanguageFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.creation;
@@ -85,8 +87,8 @@ public class ExpressionLanguageFactory extends StringEditionFactory {
}
@Override
- public Object createObject(Control widget) {
- String languageName = (String)super.createObject(widget);
+ public Object createObject(Control widget, Object context) {
+ String languageName = (String)super.createObject(widget, context);
if(languageName == null) {
return null;
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/MessageValueSpecificationFactory.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/MessageValueSpecificationFactory.java
index 9dd2731de73..070f4417d43 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/MessageValueSpecificationFactory.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/creation/MessageValueSpecificationFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.creation;
@@ -92,11 +94,8 @@ public class MessageValueSpecificationFactory extends EcorePropertyEditorFactory
return result;
}
- /**
- * {@inheritDoc}
- */
@Override
- public Object createObject(Control widget) {
+ protected Object doCreateObject(Control widget, Object context) {
EClass eClass = chooseEClass(widget);
if(eClass == null) {
return null;
@@ -114,7 +113,7 @@ public class MessageValueSpecificationFactory extends EcorePropertyEditorFactory
}
}
- return super.createObject(widget, instance);
+ return createObject(widget, context, instance);
}
/**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeAppearanceObservableValue.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeAppearanceObservableValue.java
index ce3d31856d4..f70c0403b32 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeAppearanceObservableValue.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeAppearanceObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.databinding;
@@ -22,6 +24,7 @@ import static org.eclipse.papyrus.uml.properties.util.StereotypeAppearanceConsta
import static org.eclipse.papyrus.uml.properties.util.StereotypeAppearanceConstants.VERTICAL;
import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.core.internal.databinding.Util;
import org.eclipse.emf.common.notify.Adapter;
@@ -44,7 +47,7 @@ import org.eclipse.uml2.uml.Stereotype;
*
* @author Camille Letavernier
*/
-public class StereotypeAppearanceObservableValue extends AbstractObservableValue {
+public class StereotypeAppearanceObservableValue extends AbstractObservableValue implements IObserving {
/**
* The name of the property being observed
@@ -270,11 +273,14 @@ public class StereotypeAppearanceObservableValue extends AbstractObservableValue
domain.getCommandStack().execute(command);
}
+ public Object getObserved() {
+ return diagramElement;
+ }
+
/**
* @see org.eclipse.core.databinding.observable.AbstractObservable#dispose()
*
*/
-
@Override
public synchronized void dispose() {
if(diagramElement != null && diagramElementListener != null) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeApplicationObservableList.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeApplicationObservableList.java
index 49e65474e3a..78b252087ad 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeApplicationObservableList.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/StereotypeApplicationObservableList.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.databinding;
@@ -15,6 +17,7 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.list.ListDiff;
import org.eclipse.core.databinding.observable.list.ListDiffEntry;
import org.eclipse.core.databinding.observable.list.WritableList;
@@ -38,7 +41,7 @@ import org.eclipse.uml2.uml.Stereotype;
*
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
-public class StereotypeApplicationObservableList extends WritableList implements ICommitListener {
+public class StereotypeApplicationObservableList extends WritableList implements ICommitListener, IObserving {
private Element umlSource;
@@ -279,6 +282,10 @@ public class StereotypeApplicationObservableList extends WritableList implements
throw new UnsupportedOperationException();
}
+ public Object getObserved() {
+ return umlSource;
+ }
+
@Override
public void dispose() {
super.dispose();
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/expression/ExpressionList.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/expression/ExpressionList.java
index 0ff668e7adf..774df66875e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/expression/ExpressionList.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/expression/ExpressionList.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.expression;
@@ -17,6 +19,7 @@ import java.util.List;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
@@ -36,7 +39,7 @@ import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
*
* @author Camille Letavernier
*/
-public class ExpressionList extends WritableList implements IChangeListener, ICommitListener {
+public class ExpressionList extends WritableList implements IChangeListener, ICommitListener, IObserving {
private List<Expression> expressions;
@@ -165,6 +168,13 @@ public class ExpressionList extends WritableList implements IChangeListener, ICo
languages.add(language);
}
+
+ public Object getObserved() {
+ return //
+ (languages instanceof IObserving) ? ((IObserving)languages).getObserved() : //
+ (bodies instanceof IObserving) ? ((IObserving)bodies).getObserved() : //
+ null;
+ }
/**
* A helper class to aggregate the expression body and language in a single
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java
index c89b79685ab..da818a1a6a6 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Sebastien Poissonnet (CEA LIST) sebastien.poissonnet@cea.fr
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -68,11 +70,11 @@ public class CommentModelElement extends EMFModelElement {
}
@Override
- public boolean isEditable(String propertyPath) {
+ protected boolean isFeatureEditable(String propertyPath) {
if(APPLIED_COMMENTS_PROPERTY.equals(propertyPath)) {
return true;
}
- return super.isEditable(propertyPath);
+ return super.isFeatureEditable(propertyPath);
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java
index 7bd9833d571..326e894de72 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -23,6 +25,7 @@ import java.util.List;
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
import org.eclipse.papyrus.uml.properties.Activator;
@@ -119,9 +122,9 @@ public class MemberEndModelElement extends AbstractModelElement {
return false;
}
}
- return ((Property)source).getAssociation().getMemberEnds().size() <= 2;
+ return (((Property)source).getAssociation().getMemberEnds().size() <= 2) && !EMFHelper.isReadOnly(source);
}
- return true;
+ return !EMFHelper.isReadOnly(source);
}
private boolean isAssociation(Property property) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java
index f3f1ae272b0..d8f5bcda7d5 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/ProfileDefinitionModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -76,4 +78,9 @@ public class ProfileDefinitionModelElement extends AbstractModelElement {
public boolean getDirectCreation(String propertyPath) {
return true; //Cannot browse other definitions
}
+
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return !EMFHelper.isReadOnly(profile);
+ }
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java
index 5da9abffbb4..033b0071f2b 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeAppearanceModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -27,6 +29,7 @@ import static org.eclipse.papyrus.uml.properties.util.StereotypeAppearanceConsta
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
@@ -107,4 +110,8 @@ public class StereotypeAppearanceModelElement extends AbstractModelElement imple
return true;
}
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return !EMFHelper.isReadOnly(diagramElement);
+ }
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
index 8843c04ca19..94f5a7a61cc 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
@@ -65,6 +65,9 @@ public class StereotypeModelElement extends EMFModelElement {
public IObservable doGetObservable(String propertyPath) {
FeaturePath featurePath = getFeaturePath(propertyPath);
EStructuralFeature feature = getFeature(featurePath);
+ if(feature == null) {
+ return super.doGetObservable(propertyPath);
+ }
if(feature.getEType() instanceof EDataType && !(feature.getEType() instanceof EEnum)) {
if(feature.getUpperBound() == 1) {
@@ -89,6 +92,9 @@ public class StereotypeModelElement extends EMFModelElement {
@Override
public ILabelProvider getLabelProvider(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
+ if(feature == null) {
+ return super.getLabelProvider(propertyPath);
+ }
if(feature.getEType() instanceof EEnum) {
return super.getLabelProvider(propertyPath);
}
@@ -102,6 +108,10 @@ public class StereotypeModelElement extends EMFModelElement {
public IStaticContentProvider getContentProvider(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
+ if(feature == null) {
+ return super.getContentProvider(propertyPath);
+ }
+
return new UMLContentProvider(source, feature, stereotype);
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
index 7a4d132cc0a..cef0f90eb28 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -129,7 +131,7 @@ public class UMLModelElement extends EMFModelElement {
}
@Override
- public boolean isEditable(String propertyPath) {
+ protected boolean isFeatureEditable(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
if(feature == UMLPackage.eINSTANCE.getMessage_Signature()) {
return true;
@@ -145,7 +147,7 @@ public class UMLModelElement extends EMFModelElement {
return false;
//return true; //TODO : Unsupported yet
}
- return super.isEditable(propertyPath);
+ return super.isFeatureEditable(propertyPath);
}
@Override
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
index d115969535e..c6c680cd2d8 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
@@ -176,4 +178,8 @@ public class UMLNotationModelElement extends AbstractModelElement {
return super.isMandatory(propertyPath);
}
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return !EMFHelper.isReadOnly(getEModelElement());
+ }
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
index 24fb4ca48ad..62d808c0e0c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
* Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.compositeforview;
@@ -25,6 +26,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.profile.Activator;
@@ -218,6 +220,12 @@ public class AppearanceForAppliedStereotypeComposite extends org.eclipse.papyrus
});
return this;
}
+
+ @Override
+ public boolean isReadOnly() {
+ EModelElement element = getDiagramElement();
+ return (element == null) || EMFHelper.isReadOnly(element);
+ }
/**
* Fixed bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=417372
@@ -228,7 +236,7 @@ public class AppearanceForAppliedStereotypeComposite extends org.eclipse.papyrus
if(tree == null || tree.isDisposed()) {
return;
}
- boolean enabled = getDiagramElement() != null && !treeViewer.getSelection().isEmpty();
+ boolean enabled = (getDiagramElement() != null && !treeViewer.getSelection().isEmpty()) && !isReadOnly();
if(displayButton != null && !displayButton.isDisposed()) {
displayButton.setEnabled(enabled);
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppearanceDecoratedTreeComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppearanceDecoratedTreeComposite.java
index ae973dd0084..ca81c7747e8 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppearanceDecoratedTreeComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppearanceDecoratedTreeComposite.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,12 +10,14 @@
* Contributors:
* Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
* Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementTreeViewer;
import org.eclipse.papyrus.uml.profile.tree.PropertyValueTreeViewer;
import org.eclipse.swt.custom.CLabel;
@@ -133,6 +135,11 @@ public abstract class AppearanceDecoratedTreeComposite extends Composite impleme
public void refresh() {
}
+ public boolean isReadOnly() {
+ Element element = getElement();
+ return (element == null) || EMFHelper.isReadOnly(element);
+ }
+
/**
* Returns the CommmandStack of the current editor.
*
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
index 9dd8446cf9a..ab5020be06e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008, 2013 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST, Atos Origin, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -12,6 +12,7 @@
* Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
* Emilien Perico (Atos Origin) - fix bug on refresh
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
@@ -300,6 +301,8 @@ public class AppliedProfileCompositeOnModel extends Composite {
profiles = createProfilesList();
profiles.setVisible(true);
+
+ updateEnablement();
}
/**
@@ -500,6 +503,23 @@ public class AppliedProfileCompositeOnModel extends Composite {
}
}
}
+
+ updateEnablement();
+ }
+
+ protected boolean isEditable() {
+ Package currentPackage = getSelectedPackage();
+ return (currentPackage != null) && !EMFHelper.isReadOnly(currentPackage);
+ }
+
+ protected void updateEnablement() {
+ boolean isEditable = isEditable();
+
+ if((addButton != null) && !addButton.isDisposed()) {
+ addButton.setEnabled(isEditable);
+ removeButton.setEnabled(isEditable);
+ addRegisteredButton.setEnabled(isEditable);
+ }
}
/**
@@ -524,6 +544,8 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
public void setSelection(ISelection selection) {
this.selectedElement = selection;
+
+ updateEnablement();
}
/**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
index 812b00961d4..b10aed4ac3c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
* Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
@@ -287,6 +288,8 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*/
@Override
public void refresh() {
+ super.refresh();
+
if(treeViewer.getTree() != null && !(treeViewer.getTree().isDisposed())) {
treeViewer.setInput(null);
treeViewer.refresh();
@@ -298,10 +301,12 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
return;
}
+ boolean isEditable = isEditable();
+
// If the property is Multivalued show Up - Down
if((rTO.getChildren() != null) && (rTO.getChildren().length > 1)) {
- upButton.setEnabled(true);
- downButton.setEnabled(true);
+ upButton.setEnabled(isEditable);
+ downButton.setEnabled(isEditable);
} else {
upButton.setEnabled(false);
downButton.setEnabled(false);
@@ -310,7 +315,7 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
if((rTO.getChildren() != null) && (rTO.getChildren().length == 0)) {
removeButton.setEnabled(false);
} else {
- removeButton.setEnabled(true);
+ removeButton.setEnabled(isEditable);
}
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java
index 608c1f9f3fd..ce77785961e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/DecoratedTreeComposite.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,12 +10,14 @@
* Contributors:
* Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
* Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
+ * Christian W. Damus (CEA) - bug 323802
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.profile.ImageManager;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementTreeViewer;
import org.eclipse.papyrus.uml.profile.tree.PropertyValueTreeViewer;
@@ -144,6 +146,8 @@ public abstract class DecoratedTreeComposite extends Composite implements ISecti
*/
public void setElement(Element element) {
this.element = element;
+
+ updateEnablement();
}
/**
@@ -265,18 +269,30 @@ public abstract class DecoratedTreeComposite extends Composite implements ISecti
data.bottom = new FormAttachment(100, -ITabbedPropertyConstants.VSPACE);
tree.setLayoutData(data);
+
+ // initialize enablement of controls
+ updateEnablement();
+
return this;
}
- /*
- * (non-Javadoc)
- *
- * @see com.cea.papyrus.ui.composites.ISectionComposite#refresh()
- */
- /**
- *
- */
public void refresh() {
+ updateEnablement();
+ }
+
+ protected boolean isEditable() {
+ return (element != null) && !EMFHelper.isReadOnly(element);
+ }
+
+ protected void updateEnablement() {
+ boolean isEditable = isEditable();
+
+ if((addButton != null) && !addButton.isDisposed()) {
+ addButton.setEnabled(isEditable);
+ removeButton.setEnabled(isEditable);
+ upButton.setEnabled(isEditable);
+ downButton.setEnabled(isEditable);
+ }
}
// /**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java
index 9021d9f0fd0..8c876cdb4ac 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/dialogs/RegisteredProfileSelectionDialog.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,39 +17,41 @@ package org.eclipse.papyrus.uml.properties.profile.ui.dialogs;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedList;
import java.util.List;
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.dialogs.Dialog;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
import org.eclipse.papyrus.uml.extensionpoints.standard.FilteredRegisteredElementsSelectionDialog;
import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
-import org.eclipse.papyrus.uml.profile.ui.dialogs.ProfileTreeSelectionDialog;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ElementImportTreeSelectionDialog.ImportSpec;
+import org.eclipse.papyrus.uml.profile.ui.dialogs.ProfileTreeSelectionDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Profile;
/**
- *
+ *
*/
public class RegisteredProfileSelectionDialog extends FilteredRegisteredElementsSelectionDialog {
/**
- *
+ *
*/
private RegisteredProfile[] regProfiles;
/**
- *
+ *
*/
private Package currentPackage;
/**
- *
- *
+ *
+ *
* @param umlPackage
* @param parent
*/
@@ -59,8 +61,8 @@ public class RegisteredProfileSelectionDialog extends FilteredRegisteredElements
}
/**
- *
- *
+ *
+ *
* @return
*/
public List<Profile> run() {
@@ -77,21 +79,26 @@ public class RegisteredProfileSelectionDialog extends FilteredRegisteredElements
// 0);
// dialog.open();
this.open();
- return this.treatSelection();
+ List<Profile> profilesToApply = this.treatSelection();
+
+ List<Profile> result = new LinkedList<Profile>();
+ for(Profile profile : profilesToApply) {
+ result.add(EMFHelper.reloadIntoContext(profile, currentPackage));
+ }
+ return result;
}
/**
- *
- *
+ *
+ *
* @return
*/
private List<Profile> treatSelection() {
// User selection
Object[] selection = this.getResult();
- boolean hasChanged = false;
- ResourceSet resourceSet = Util.getResourceSet(currentPackage);
+ ResourceSet resourceSet = Util.getSharedResourceSet();
if(selection == null) { // Cancel was selected
return new ArrayList<Profile>();
@@ -146,7 +153,7 @@ public class RegisteredProfileSelectionDialog extends FilteredRegisteredElements
if(Dialog.OK == returnValue) {
Collection<ImportSpec<Profile>> dlgResult = profileDialog.getResult();
List<Profile> result = new java.util.ArrayList<Profile>(dlgResult.size());
- for (ImportSpec<Profile> next : dlgResult) {
+ for(ImportSpec<Profile> next : dlgResult) {
result.add(next.getElement());
}
return result;
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java
index 0d92fa6ed33..16e03b2e26a 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/EStructuralFeatureEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 Atos.
+ * Copyright (c) 2012, 2014 Atos, CEA, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Mathieu Velten (Atos) mathieu.velten@atos.net - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.widgets;
@@ -212,7 +214,7 @@ public class EStructuralFeatureEditor implements IValueChangeListener, IListChan
protected void setValueEditorProperties(AbstractValueEditor editor, EObject stereotypeApplication, EStructuralFeature feature) {
editor.setLabel(feature.getName());
- if(feature.isDerived() || !feature.isChangeable()) {
+ if(!isEditable(stereotypeApplication, feature)) {
editor.setReadOnly(true);
}
@@ -232,7 +234,7 @@ public class EStructuralFeatureEditor implements IValueChangeListener, IListChan
editor.setDirectCreation(((EReference)feature).isContainment());
}
- if(feature.isDerived() || !feature.isChangeable()) {
+ if(!isEditable(stereotypeApplication, feature)) {
editor.setReadOnly(true);
}
@@ -243,6 +245,10 @@ public class EStructuralFeatureEditor implements IValueChangeListener, IListChan
observable.addListChangeListener(this);
}
+
+ protected boolean isEditable(EObject object, EStructuralFeature feature) {
+ return !feature.isDerived() && feature.isChangeable() && !EMFHelper.isReadOnly(object);
+ }
public void setLayoutData(GridData data) {
pageBook.setLayoutData(data);
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF
index 9adcd72f538..fbc4112ab64 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/META-INF/MANIFEST.MF
@@ -23,11 +23,11 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.collaborationuse.xtext;bundle-v
org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0",
org.eclipse.papyrus.uml.textedit.common.xtext.ui;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.alf.common.ui;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.alf.common.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/plugin.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/plugin.xml
index e0de7a9d13c..d86d634e0e2 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/plugin.xml
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/plugin.xml
@@ -189,7 +189,7 @@
language="Advanced CollaborationUse Editor"
objectToEdit="org.eclipse.uml2.uml.CollaborationUse">
<popupeditor
- editorConfiguration="org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.contributions.CollaborationUsePopupEditor">
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.contributions.CollaborationUseEditor">
</popupeditor>
</DirectEditor>
</extension>
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUsePopupEditor.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUseEditor.java
index f1ca68047cb..034996747ee 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUsePopupEditor.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui/src/org/eclipse/papyrus/uml/textedit/collaborationuse/xtext/ui/contributions/CollaborationUseEditor.java
@@ -16,21 +16,13 @@ package org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.contributions
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.commands.CheckedOperationHistory;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
import org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.ui.internal.UmlCollaborationUseActivator;
-import org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.CollaborationUseRule;
-import org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.TypeRule;
-import org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.validation.SemanticValidator;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.uml2.uml.Collaboration;
import org.eclipse.uml2.uml.CollaborationUse;
import org.eclipse.uml2.uml.UMLPackage;
@@ -42,7 +34,7 @@ import com.google.inject.Injector;
* Editor for the {@link CollaborationUse}
*
*/
-public class CollaborationUsePopupEditor extends org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration {
+public class CollaborationUseEditor extends DefaultXtextDirectEditorConfiguration {
/** the new name for the {@link CollaborationUse} */
private String newName;
@@ -63,7 +55,7 @@ public class CollaborationUsePopupEditor extends org.eclipse.papyrus.infra.gmfdi
* @param editPart
* @return
*/
- @Override
+ /*
public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
// resolves the edit part, and the associated semantic element
@@ -146,7 +138,8 @@ public class CollaborationUsePopupEditor extends org.eclipse.papyrus.infra.gmfdi
};
return super.createPopupEditorHelper(graphicalEditPart, injector, reconciler, textToEdit, fileExtension, new SemanticValidator());
}
-
+ */
+
/**
* Returns the list of requests to update the {@link #collaborationUse}
*
@@ -200,4 +193,20 @@ public class CollaborationUsePopupEditor extends org.eclipse.papyrus.infra.gmfdi
}
return "not a CollaborationUse"; //$NON-NLS-1$
}
-}
+
+ @Override
+ public Injector getInjector() {
+ return UmlCollaborationUseActivator.getInstance().getInjector(UmlCollaborationUseActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_COLLABORATIONUSE_XTEXT_UMLCOLLABORATIONUSE);
+ }
+
+ @Override
+ protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
+ if(!(umlObject instanceof CollaborationUse)) {
+ return null;
+ }
+
+ // Creates and executes the update command
+ IUndoableOperation updateCommand = getUpdateCommand();
+ return (ICommand) updateCommand;
+ }
+} \ No newline at end of file
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
index da78ce6a0f0..e80fb470c9a 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
@@ -8,7 +8,6 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.contentassist.CompletionProposal;
@@ -18,6 +17,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.uml.textedit.common.xtext.ui.internal.UmlCommonActivator;
@@ -93,19 +93,19 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
ISelection mySelection = activePage.getSelection();
if(mySelection instanceof IStructuredSelection) {
- Object first = ((IStructuredSelection)mySelection).getFirstElement();
- if(first != null) {
- if(first instanceof IAdaptable) {
- Element el = (Element)((IAdaptable)first).getAdapter(Element.class);
- this.contextElement = el;
- if(el != null) {
- List<Namespace> namespaces = el.getNearestPackage().allNamespaces();
- if(namespaces.size() == 0) {
- this.model = el.getNearestPackage();
- } else {
- this.model = namespaces.get(namespaces.size() - 1);
- }
+ EObject first = EMFHelper.getEObject(((IStructuredSelection)mySelection).getFirstElement());
+
+ if(first instanceof Element) {
+ Element element = (Element)first;
+ this.contextElement = element;
+ if(element != null) {
+ List<Namespace> namespaces = element.getNearestPackage().allNamespaces();
+ if(namespaces.size() == 0) {
+ this.model = element.getNearestPackage();
+ } else {
+ this.model = namespaces.get(namespaces.size() - 1);
}
+
}
}
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/META-INF/MANIFEST.MF
index f03b142671f..147b8d99f60 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/META-INF/MANIFEST.MF
@@ -27,11 +27,12 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.uml2.uml;bundle-version="3.1.1",
org.eclipse.jface,
org.eclipse.ui.ide,
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.papyrus.uml.alf.common;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.alf.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.xtext.integration.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/src/org/eclipse/papyrus/uml/textedit/common/xtext/scoping/UmlCommonScopeProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/src/org/eclipse/papyrus/uml/textedit/common/xtext/scoping/UmlCommonScopeProvider.java
index 5facfab7571..c4e06832562 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/src/org/eclipse/papyrus/uml/textedit/common/xtext/scoping/UmlCommonScopeProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext/src/org/eclipse/papyrus/uml/textedit/common/xtext/scoping/UmlCommonScopeProvider.java
@@ -1,21 +1,13 @@
-/*
- * generated by Xtext
- */
package org.eclipse.papyrus.uml.textedit.common.xtext.scoping;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.QualifiedName;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementUtil;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.ElementImport;
import org.eclipse.uml2.uml.NamedElement;
@@ -37,48 +29,12 @@ import org.eclipse.xtext.scoping.impl.SimpleScope;
*/
public class UmlCommonScopeProvider extends AbstractDeclarativeScopeProvider {
- /** the edited model */
- private Namespace model = null;
-
- /** the edited element */
- private Element contextElement = null;
-
/**
*
* Constructor.
*
*/
public UmlCommonScopeProvider() {
- initModel();
- }
-
- /**
- *
- * This method initializes the fields {@link #model} {@link #contextElement} thanks to the current selection
- *
- */
- protected void initModel() {
- IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- ISelection mySelection = activePage.getSelection();
- if(mySelection instanceof IStructuredSelection) {
- Object first = ((IStructuredSelection)mySelection).getFirstElement();
- if(first != null) {
- if(first instanceof IAdaptable) {
- Element el = (Element)((IAdaptable)first).getAdapter(Element.class);
- this.contextElement = el;
- if(el != null) {
- List<Namespace> namespaces = el.getNearestPackage().allNamespaces();
- if(namespaces.size() == 0) {
- this.model = el.getNearestPackage();
- } else {
- this.model = namespaces.get(namespaces.size() - 1);
- }
- }
- }
- }
- }
- Assert.isNotNull(contextElement, "I can't find the edited element"); //$NON-NLS-1$
- Assert.isNotNull(this.model, "I can't find the model owning the edited element"); //$NON-NLS-1$
}
/**
@@ -87,21 +43,21 @@ public class UmlCommonScopeProvider extends AbstractDeclarativeScopeProvider {
* @return
* {@link #model}
*/
- protected Namespace getModel() {
- return this.model;
- }
+ protected Namespace getModel(EObject xtextElement) {
+ EObject semanticElement = ContextElementUtil.getContextElement(xtextElement.eResource());
+ if(semanticElement instanceof Element) {
+ Element element = (Element)semanticElement;
+ List<Namespace> namespaces = element.getNearestPackage().allNamespaces();
+ if(namespaces.size() == 0) {
+ return element.getNearestPackage();
+ } else {
+ return namespaces.get(namespaces.size() - 1);
+ }
+ }
- /**
- * Getter for {@link #contextElement}
- *
- * @return
- * {@link #contextElement}
- */
- protected Element getContextElement() {
- return this.contextElement;
+ return null;
}
-
/**
* Rule for computing the scope of PropertyRule
*
@@ -124,7 +80,7 @@ public class UmlCommonScopeProvider extends AbstractDeclarativeScopeProvider {
*/
protected IScope create___TypeRule_type___Scope(org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.TypeRule ctx) {
if(ctx.getPath() == null) {
- Iterator<EObject> i = org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper.context.eResource().getAllContents();
+ Iterator<EObject> i = ContextElementUtil.getContextElement(ctx.eResource()).eResource().getAllContents();
List<EObject> allContent = new ArrayList<EObject>();
while(i.hasNext()) {
EObject object = i.next();
@@ -216,8 +172,9 @@ public class UmlCommonScopeProvider extends AbstractDeclarativeScopeProvider {
namespaces.add(pImport.getImportedPackage());
}
for(ElementImport eImport : visited.getElementImports()) {
- if(eImport.getImportedElement() instanceof Namespace)
+ if(eImport.getImportedElement() instanceof Namespace) {
namespaces.add((Namespace)eImport.getImportedElement());
+ }
}
return namespaces;
@@ -237,8 +194,9 @@ public class UmlCommonScopeProvider extends AbstractDeclarativeScopeProvider {
namespaces.addAll(getImportedNamespaces(visited));
// then retrieves owned namespaces
for(NamedElement n : visited.getOwnedMembers()) {
- if(n instanceof Namespace)
+ if(n instanceof Namespace) {
namespaces.add((Namespace)n);
+ }
}
return namespaces;
}
@@ -254,8 +212,8 @@ public class UmlCommonScopeProvider extends AbstractDeclarativeScopeProvider {
Namespace parentNameSpace = ((QualifiedName)ctx.eContainer()).getPath();
visibleNamespaces.addAll(getOwnedAndImportedNamespaces(parentNameSpace));
} else {
- visibleNamespaces.add(getModel());
- visibleNamespaces.addAll(getImportedNamespaces(getModel()));
+ visibleNamespaces.add(getModel(ctx));
+ visibleNamespaces.addAll(getImportedNamespaces(getModel(ctx)));
}
Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(visibleNamespaces);
return new SimpleScope(iterableIEobjectDescription);
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/META-INF/MANIFEST.MF
index 8d500c582b7..2d3c7afd371 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/META-INF/MANIFEST.MF
@@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext;
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.alf.common.ui;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.alf.common.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/plugin.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/plugin.xml
index 3d17c8a5d78..feaea1f071b 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/plugin.xml
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/plugin.xml
@@ -189,7 +189,7 @@
language="Textual editor for connection point references"
objectToEdit="org.eclipse.uml2.uml.ConnectionPointReference">
<popupeditor
- editorConfiguration="org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui.contributions.ConnectionPointReferencePopupEditorConfiguration">
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui.contributions.ConnectionPointReferenceEditorConfiguration">
</popupeditor>
</DirectEditor>
</extension>
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/src/org/eclipse/papyrus/uml/textedit/connectionpointreference/xtext/ui/contributions/ConnectionPointReferencePopupEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/src/org/eclipse/papyrus/uml/textedit/connectionpointreference/xtext/ui/contributions/ConnectionPointReferenceEditorConfiguration.java
index fa419e221a9..3b83304cc27 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/src/org/eclipse/papyrus/uml/textedit/connectionpointreference/xtext/ui/contributions/ConnectionPointReferencePopupEditorConfiguration.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui/src/org/eclipse/papyrus/uml/textedit/connectionpointreference/xtext/ui/contributions/ConnectionPointReferenceEditorConfiguration.java
@@ -9,24 +9,18 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.DefaultXtextSemanticValidator;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
-import org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.uMLConnectionPointReference.ConnectionPointReferenceRule;
import org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.ui.internal.UMLConnectionPointReferenceActivator;
-import org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext.validation.UMLConnectionPointReferenceJavaValidator;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.uml2.uml.ConnectionPointReference;
import org.eclipse.uml2.uml.Pseudostate;
import com.google.inject.Injector;
-public class ConnectionPointReferencePopupEditorConfiguration extends PopupEditorConfiguration {
+public class ConnectionPointReferenceEditorConfiguration extends DefaultXtextDirectEditorConfiguration {
private ConnectionPointReference connectionPoint;
@@ -34,7 +28,7 @@ public class ConnectionPointReferencePopupEditorConfiguration extends PopupEdito
private List<Pseudostate> newExits = new ArrayList<Pseudostate>();
- public ConnectionPointReferencePopupEditorConfiguration() {
+ public ConnectionPointReferenceEditorConfiguration() {
super();
}
@@ -71,6 +65,7 @@ public class ConnectionPointReferencePopupEditorConfiguration extends PopupEdito
return "not a ConnectionPointReference";
}
+ /*
@Override
public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
// resolves the edit part, and the associated semantic element
@@ -123,7 +118,8 @@ public class ConnectionPointReferencePopupEditorConfiguration extends PopupEdito
};
return super.createPopupEditorHelper(graphicalEditPart, injector, reconciler, textToEdit, fileExtension, new DefaultXtextSemanticValidator());
}
-
+ */
+
/**
* @author CEA LIST
*
@@ -153,7 +149,7 @@ public class ConnectionPointReferencePopupEditorConfiguration extends PopupEdito
}
public UpdateConnectionPointReferenceCommand(ConnectionPointReference connectionPointReference) {
- super(ConnectionPointReferencePopupEditorConfiguration.getEditingDomain(connectionPointReference), "ConnectionPointReference Update", getWorkspaceFiles(connectionPointReference));
+ super(ConnectionPointReferenceEditorConfiguration.getEditingDomain(connectionPointReference), "ConnectionPointReference Update", getWorkspaceFiles(connectionPointReference));
this.connectionPointReference = connectionPointReference;
}
@@ -167,4 +163,14 @@ public class ConnectionPointReferencePopupEditorConfiguration extends PopupEdito
}
return null;
}
+
+ @Override
+ public Injector getInjector() {
+ return UMLConnectionPointReferenceActivator.getInstance().getInjector(UMLConnectionPointReferenceActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_CONNECTIONPOINTREFERENCE_XTEXT_UMLCONNECTIONPOINTREFERENCE);
+ }
+
+ @Override
+ protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
+ return new UpdateConnectionPointReferenceCommand((ConnectionPointReference) umlObject);
+ }
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/META-INF/MANIFEST.MF
index e3a1b40cc41..f1550ef8799 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.connectionpointreference.xtext/META-INF/MANIFEST.MF
@@ -25,7 +25,6 @@ Require-Bundle: org.eclipse.xtext,
org.antlr.runtime,
org.eclipse.uml2.uml;bundle-version="3.1.0",
org.eclipse.uml2.codegen.ecore;bundle-version="1.6.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.uml.alf.common;bundle-version="1.0.0"
Bundle-Vendor: %providerName
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
index c42c8ff73bb..2a80241edd6 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
@@ -10,15 +10,17 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.7.0"
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.7.0",
+ org.apache.log4j;bundle-version="1.2.15",
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.services.validation;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.textedit.constraintwithessen
- tialocl.xtext.EssentialOCLPopupPlugin
+Bundle-Activator: org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext.UMLConstraintEditorActivator
Bundle-SymbolicName: org.eclipse.papyrus.uml.textedit.constraintwithes
sentialocl.xtext;singleton:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/plugin.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/plugin.xml
index 4d18f622e78..778d157689d 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/plugin.xml
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/plugin.xml
@@ -9,7 +9,7 @@
language="Essential OCL constraint editor"
objectToEdit="org.eclipse.uml2.uml.Constraint">
<popupeditor
- editorConfiguration="org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext.EssentialOCLPopupEditorConfiguration">
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext.EssentialOCLEditorConfiguration">
</popupeditor>
</DirectEditor>
</extension>s
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java
new file mode 100644
index 00000000000..b82cc201fd6
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java
@@ -0,0 +1,217 @@
+/*****************************************************************************
+ * Copyright (c) 2011,2012 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:
+ * E.D.Willink - Initial API and implementation
+ * CEA LIST - Architecture refactoring
+ * E.D.Willink - Bug 388529
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+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.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.ocl.examples.pivot.ParserException;
+import org.eclipse.ocl.examples.pivot.utilities.BaseResource;
+import org.eclipse.ocl.examples.pivot.utilities.PivotUtil;
+import org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCLRuntimeModule;
+import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
+import org.eclipse.papyrus.infra.services.validation.commands.ValidateSubtreeCommand;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProvider;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProviderWithInit;
+import org.eclipse.swt.SWT;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.xtext.resource.XtextResource;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+
+/**
+ * this plugin is the configuration of the essential editor
+ *
+ */
+public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorConfiguration {
+ // org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration {
+
+ private static final String OCL = "OCL"; //$NON-NLS-1$
+
+ @Inject
+ protected XtextResource fakeResource;
+
+ /**
+ * Clients may override to change style to {@link SWT}.MULTI
+ */
+ @Override
+ public int getStyle() {
+ return SWT.MULTI | SWT.WRAP;
+ }
+
+ /**
+ * the command to save the content of the OCL constraint into the body of the UML constraint element
+ *
+ */
+ protected class UpdateConstraintCommand extends AbstractTransactionalCommand {
+
+ protected final org.eclipse.uml2.uml.Constraint constraint;
+
+ protected final String newTextualRepresentation;
+
+ public UpdateConstraintCommand(TransactionalEditingDomain editingDomain, org.eclipse.uml2.uml.Constraint constraint, String newTextualRepresentation) {
+ super(editingDomain, "Constraint Update", getWorkspaceFiles(constraint)); //$NON-NLS-1$
+ this.constraint = constraint;
+ this.newTextualRepresentation = newTextualRepresentation;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
+ org.eclipse.uml2.uml.OpaqueExpression opaqueExpression = null;
+ int indexOfOCLBody = -1;
+ if(constraint.getSpecification() == null || !(constraint.getSpecification() instanceof org.eclipse.uml2.uml.OpaqueExpression)) {
+ opaqueExpression = UMLFactory.eINSTANCE.createOpaqueExpression();
+ } else {
+ opaqueExpression = (org.eclipse.uml2.uml.OpaqueExpression)constraint.getSpecification();
+ for(int i = 0; i < opaqueExpression.getLanguages().size() && indexOfOCLBody == -1; i++) {
+ if(opaqueExpression.getLanguages().get(i).equals(OCL)) {
+ indexOfOCLBody = i;
+ }
+ }
+ }
+ if(indexOfOCLBody == -1) {
+ opaqueExpression.getLanguages().add(OCL);
+ opaqueExpression.getBodies().add(newTextualRepresentation);
+ } else {
+ opaqueExpression.getBodies().remove(indexOfOCLBody);
+ opaqueExpression.getBodies().add(indexOfOCLBody, newTextualRepresentation);
+ }
+ constraint.setSpecification(opaqueExpression);
+
+ return CommandResult.newOKCommandResult(constraint);
+ }
+ }
+
+ @Override
+ public String getTextToEdit(Object editedObject) {
+ Constraint umlConstraint = (Constraint)objectToEdit;
+ String value = ""; //$NON-NLS-1$
+ if(umlConstraint.getSpecification() != null) {
+ if(umlConstraint.getSpecification() instanceof LiteralString) {
+ if(((LiteralString)umlConstraint.getSpecification()).getValue() != null) {
+ value += ((LiteralString)umlConstraint.getSpecification()).getValue();
+ }
+ } else if(umlConstraint.getSpecification() instanceof org.eclipse.uml2.uml.OpaqueExpression) {
+ int indexOfOCLBody = -1;
+ org.eclipse.uml2.uml.OpaqueExpression opaqueExpression = (org.eclipse.uml2.uml.OpaqueExpression)umlConstraint.getSpecification();
+ for(int i = 0; i < opaqueExpression.getLanguages().size() && indexOfOCLBody == -1; i++) {
+ if(opaqueExpression.getLanguages().get(i).equals(OCL)) {
+ value += opaqueExpression.getBodies().get(i);
+ indexOfOCLBody = i;
+ }
+ }
+ }
+ }
+ return value;
+ }
+
+ @Override
+ public IContextElementProvider getContextProvider() {
+ return new IContextElementProviderWithInit() {
+
+ public EObject getContextObject() {
+ if(objectToEdit instanceof Constraint) {
+ return ((Constraint)objectToEdit).getContext();
+ }
+ return null;
+ }
+
+ public void initResource(XtextResource resource) {
+ try {
+ if (resource instanceof BaseResource) {
+ PivotUtil.setParserContext((BaseResource) resource, getContextObject());
+ }
+ }
+ catch (ParserException e) {
+ }
+ }
+ };
+ }
+
+ @Override
+ public Injector getInjector() {
+ return UMLConstraintEditorActivator.getInstance().getInjector(EssentialOCLRuntimeModule.LANGUAGE_ID);
+ }
+
+ @Override
+ public IParser createParser(final EObject semanticObject) {
+ if (objectToEdit == null) {
+ objectToEdit = semanticObject;
+ }
+ final IParser defaultParser = super.createParser(semanticObject);
+ return new IParser() {
+
+ public String getEditString(IAdaptable element, int flags) {
+ return defaultParser.getEditString(element, flags);
+ }
+
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+ // the superclass creates a comment, if validation fails. This is not useful in case of OCL,
+ // since the OCL expression is already stored in opaque form within the constraint.
+ CompositeCommand result = new CompositeCommand("validation"); //$NON-NLS-1$
+ TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(semanticObject);
+ if (semanticObject instanceof Constraint) {
+ result.add(new UpdateConstraintCommand(editingDomain, (Constraint) semanticObject, newString));
+ ValidateSubtreeCommand validationCommand = new ValidateSubtreeCommand(semanticObject, new EcoreDiagnostician());
+ validationCommand.disableUIFeedback();
+ result.add(validationCommand);
+ }
+ return result;
+ }
+
+ public String getPrintString(IAdaptable element, int flags) {
+ return defaultParser.getPrintString(element, flags);
+ }
+
+ public boolean isAffectingEvent(Object event, int flags) {
+ return false;
+ }
+
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ // Not used
+ return null;
+ }
+
+ public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
+ // Not used
+ return null;
+ }
+ };
+ }
+
+ @Override
+ protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
+ // this operation is never called, since the parser above will not call it.
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPartialModelEditor.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPartialModelEditor.java
deleted file mode 100644
index 836d1c44eee..00000000000
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPartialModelEditor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011,2012 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:
- * E.D.Willink - Initial API and implementation
- * CEA LIST - Architecture refactoring
- * E.D.Willink - Bug 388529
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext;
-
-import java.util.Collections;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.partialEditing.ISyntheticResourceProvider;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.partialEditing.PartialModelEditor;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.util.StringInputStream;
-
-/**
- * This partial editor is used to launch an OCL expression Xtext editor
- */
-public class EssentialOCLPartialModelEditor extends PartialModelEditor {
-
- /**
- *
- * Constructor.
- *
- * @param viewer
- * @param resourceProvider
- * @param insertLineBreaks
- * @param semanticElement
- * @param modelReconciler
- */
- public EssentialOCLPartialModelEditor(SourceViewer viewer,
- ISyntheticResourceProvider resourceProvider,
- boolean insertLineBreaks,
- EObject semanticElement,
- IXtextEMFReconciler modelReconciler) {
-
- super(viewer, resourceProvider, insertLineBreaks, semanticElement, modelReconciler);
- }
-
- @Override
- public XtextResource createResource(String content) {
- XtextResource result = resourceProvider.createResource();
-
- if (modelReconciler instanceof IXtextEMFReconcilerWithContext) {
- ((IXtextEMFReconcilerWithContext)modelReconciler).configureResource(result, semanticElement);
- }
- try {
- result.load(new StringInputStream(content, result.getEncoding()), Collections.emptyMap());
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return result;
- }
-
-}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupEditorConfiguration.java
deleted file mode 100644
index e4a5ca236a8..00000000000
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupEditorConfiguration.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011,2012 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:
- * E.D.Willink - Initial API and implementation
- * CEA LIST - Architecture refactoring
- * E.D.Willink - Bug 388529
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.ocl.examples.pivot.ParserException;
-import org.eclipse.ocl.examples.pivot.utilities.BaseResource;
-import org.eclipse.ocl.examples.pivot.utilities.PivotUtil;
-import org.eclipse.ocl.examples.xtext.essentialocl.utilities.EssentialOCLPlugin;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.core.Activator;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.DefaultXtextSemanticValidator;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXTextSemanticValidator;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.partialEditing.SourceViewerHandle;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.xtext.resource.XtextResource;
-
-import com.google.inject.Injector;
-
-
-/**
- * this plugin is the configuration of the essential editor
- *
- */
-public class EssentialOCLPopupEditorConfiguration extends org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration {
-
- /**
- * this is a specific reconcilers to manipulate OCL constraint
- *
- */
- public class Reconciler implements IXtextEMFReconcilerWithContext {
-
- public void configureResource(XtextResource resource, EObject umlObject) {
-
- //to launch the editor, it is important to set the context. if not there is no completion and the constraint can not be validated
- //thanks to E.D.Willink
- if(resource instanceof BaseResource) {
- if(umlObject instanceof Constraint) {
- Constraint constraint = (Constraint)umlObject;
- if(constraint.getContext() == null) {
- return;
- }
- try {
- if(!PivotUtil.setParserContext((BaseResource)resource, umlObject)) {
- Activator.log.error("Unknown context type", new ExecutionException("Unknown context type for " + umlObject));
- }
- } catch (ParserException e) {
- Activator.log.error("Failed to create context", new ExecutionException("Failed to create context for " + umlObject, e));
- }
- }
- }
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler#reconcile(org.eclipse.emf.ecore.EObject,
- * org.eclipse.emf.ecore.EObject)
- *
- * @param modelObject
- * the uml element to modify
- * @param xtextObject
- * the xtext structure
- */
- public void reconcile(EObject modelObject, EObject xtextObject) {
- if(!(modelObject instanceof org.eclipse.uml2.uml.Constraint)) {
- return;
- }
- String newTextualRepresentation = editorHelper.getSourceViewerHandle().getDocument().get();
- //
- // Creates and executes the update command
- //
- TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(modelObject);
-
- UpdateConstraintCommand updateCommand = new UpdateConstraintCommand(editingDomain, (org.eclipse.uml2.uml.Constraint)modelObject, newTextualRepresentation);
- editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(updateCommand));
-
- }
- }
-
-
- /**
- * the command to save the content of the OCL constraint into the body of the UML constraint element
- *
- */
- protected class UpdateConstraintCommand extends AbstractTransactionalCommand {
-
- protected final org.eclipse.uml2.uml.Constraint constraint;
-
- protected final String newTextualRepresentation;
-
- public UpdateConstraintCommand(TransactionalEditingDomain editingDomain, org.eclipse.uml2.uml.Constraint constraint, String newTextualRepresentation) {
- super(editingDomain, "Constraint Update", getWorkspaceFiles(constraint));
- this.constraint = constraint;
- this.newTextualRepresentation = newTextualRepresentation;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
- org.eclipse.uml2.uml.OpaqueExpression opaqueExpression = null;
- int indexOfOCLBody = -1;
- if(constraint.getSpecification() == null || !(constraint.getSpecification() instanceof org.eclipse.uml2.uml.OpaqueExpression)) {
- opaqueExpression = UMLFactory.eINSTANCE.createOpaqueExpression();
- } else {
- opaqueExpression = (org.eclipse.uml2.uml.OpaqueExpression)constraint.getSpecification();
- for(int i = 0; i < opaqueExpression.getLanguages().size() && indexOfOCLBody == -1; i++) {
- if(opaqueExpression.getLanguages().get(i).equals("OCL")) {
- indexOfOCLBody = i;
- }
- }
- }
- if(indexOfOCLBody == -1) {
- opaqueExpression.getLanguages().add("OCL");
- opaqueExpression.getBodies().add(newTextualRepresentation);
- } else {
- opaqueExpression.getBodies().remove(indexOfOCLBody);
- opaqueExpression.getBodies().add(indexOfOCLBody, newTextualRepresentation);
- }
- constraint.setSpecification(opaqueExpression);
- return CommandResult.newOKCommandResult(constraint);
- }
- }
-
- protected PopupXtextEditorHelper editorHelper = null;
-
- /**
- *
- * Constructor.
- *
- */
- public EssentialOCLPopupEditorConfiguration() {
-
- }
-
- @Override
- public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
- editorHelper = null;
-
- if(!(editPart instanceof IGraphicalEditPart)) {
- return null;
- }
-
-
- IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart)editPart;
-
- EObject element = EMFHelper.getEObject(graphicalEditPart);
-
- if(!(element instanceof org.eclipse.uml2.uml.Constraint)) {
- return null;
- }
-
- Injector xtextInjector = EssentialOCLPopupPlugin.getInstance().getInjector(EssentialOCLPlugin.LANGUAGE_ID);
- IXtextEMFReconciler modelReconciler = new Reconciler();
- String textToEdit = getTextToEdit(element);
- String fileExtension = "essentialocl";
- IXTextSemanticValidator semanticValidator = new DefaultXtextSemanticValidator();
- SourceViewerHandle.bindPartialModelEditorClass(EssentialOCLPartialModelEditor.class);
- editorHelper = (PopupXtextEditorHelper)super.createPopupEditorHelper(graphicalEditPart, xtextInjector, modelReconciler, textToEdit, fileExtension, semanticValidator);
- return editorHelper;
- }
-
- @Override
- public String getTextToEdit(Object editedObject) {
- Constraint umlConstraint = (Constraint)editedObject;
- String value = "";
- if(umlConstraint.getSpecification() != null) {
- if(umlConstraint.getSpecification() instanceof LiteralString) {
- if(((LiteralString)umlConstraint.getSpecification()).getValue() != null) {
- value += ((LiteralString)umlConstraint.getSpecification()).getValue();
- }
- } else if(umlConstraint.getSpecification() instanceof org.eclipse.uml2.uml.OpaqueExpression) {
- int indexOfOCLBody = -1;
- org.eclipse.uml2.uml.OpaqueExpression opaqueExpression = (org.eclipse.uml2.uml.OpaqueExpression)umlConstraint.getSpecification();
- for(int i = 0; i < opaqueExpression.getLanguages().size() && indexOfOCLBody == -1; i++) {
- if(opaqueExpression.getLanguages().get(i).equals("OCL")) {
- value += opaqueExpression.getBodies().get(i);
- indexOfOCLBody = i;
- }
- }
- }
- }
- return value;
- }
-}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupPlugin.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupPlugin.java
deleted file mode 100644
index b60d8fe21f7..00000000000
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupPlugin.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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:
- * E.D.Willink - Initial API and implementation
- * CEA LIST - Architecture refactoring
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext;
-
-import org.eclipse.ocl.examples.xtext.essentialocl.ui.internal.EssentialOCLActivator;
-import org.eclipse.ocl.examples.xtext.essentialocl.utilities.EssentialOCLPlugin;
-
-import com.google.inject.Module;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class EssentialOCLPopupPlugin extends EssentialOCLActivator
-{
- // The shared instance.
- private static EssentialOCLPopupPlugin plugin;
-
- /**
- * Returns the shared instance.
- */
- public static EssentialOCLPopupPlugin getInstance() {
- return plugin;
- }
-
- /**
- * Obtains my plug-in ID.
- *
- * @return my plug-in ID
- */
- public static String getPluginId() {
- return getInstance().getBundle().getSymbolicName();
- }
-
- /**
- * The constructor.
- */
- public EssentialOCLPopupPlugin() {
- super();
- plugin = this;
- }
-
-
- protected Module getRuntimeModule(String grammar) {
- if (EssentialOCLPlugin.LANGUAGE_ID.equals(grammar)) {
- return new EssentialOCLPopupRuntimeModule();
- }
-
- throw new IllegalArgumentException(grammar);
- }
-
- protected Module getUiModule(String grammar) {
- if (EssentialOCLPlugin.LANGUAGE_ID.equals(grammar)) {
- return new EssentialOCLPopupUiModule(this);
- }
-
- throw new IllegalArgumentException(grammar);
- }
-}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupRuntimeModule.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupRuntimeModule.java
deleted file mode 100644
index 87865694c3f..00000000000
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupRuntimeModule.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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:
- * E.D.Willink - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext;
-
-import org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCLRuntimeModule;
-
-/**
- * Use this class to register components to be used within the IDE.
- */
-public class EssentialOCLPopupRuntimeModule extends EssentialOCLRuntimeModule
-{
-
-}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupUiModule.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupUiModule.java
deleted file mode 100644
index a182a9dfae9..00000000000
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLPopupUiModule.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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:
- * E.D.Willink - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext;
-
-import org.eclipse.ocl.examples.xtext.essentialocl.ui.EssentialOCLUiModule;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Use this class to register components to be used within the IDE.
- */
-public class EssentialOCLPopupUiModule extends EssentialOCLUiModule
-{
- /**
- *
- * Constructor.
- *
- * @param plugin
- */
- public EssentialOCLPopupUiModule(AbstractUIPlugin plugin) {
- super(plugin);
- }
-
-}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/IXtextEMFReconcilerWithContext.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/IXtextEMFReconcilerWithContext.java
deleted file mode 100644
index 2fcea89b60d..00000000000
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/IXtextEMFReconcilerWithContext.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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:
- * E.D.Willink - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
-import org.eclipse.xtext.resource.XtextResource;
-
-/**
- * this reconciler has a context in the case of OCL in order to validate its written
- *
- */
-public interface IXtextEMFReconcilerWithContext extends IXtextEMFReconciler
-{
- /**
- *
- * @param result the resource that represent the constraint under a from of xtext
- * @param semanticElement the semantic object that is the context of the constraint
- */
- void configureResource(XtextResource result, EObject semanticElement);
-}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java
new file mode 100644
index 00000000000..3628d6b457b
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java
@@ -0,0 +1,95 @@
+/*
+ * generated by Xtext
+ */
+package org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCLRuntimeModule;
+import org.eclipse.ocl.examples.xtext.essentialocl.ui.EssentialOCLUiModule;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.xtext.ui.shared.SharedStateModule;
+import org.eclipse.xtext.util.Modules2;
+import org.osgi.framework.BundleContext;
+
+import com.google.common.collect.Maps;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+/**
+ * This class was generated. Customizations should only happen in a newly
+ * introduced subclass.
+ */
+public class UMLConstraintEditorActivator extends AbstractUIPlugin {
+
+ private static final Logger logger = Logger.getLogger(UMLConstraintEditorActivator.class);
+
+ private static UMLConstraintEditorActivator INSTANCE;
+
+ private Map<String, Injector> injectors = Collections.synchronizedMap(Maps.<String, Injector> newHashMapWithExpectedSize(1));
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ INSTANCE = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ injectors.clear();
+ INSTANCE = null;
+ super.stop(context);
+ }
+
+ public static UMLConstraintEditorActivator getInstance() {
+ return INSTANCE;
+ }
+
+ public Injector getInjector(String language) {
+ synchronized (injectors) {
+ Injector injector = injectors.get(language);
+ if (injector == null) {
+ injectors.put(language, injector = createInjector(language));
+ }
+ return injector;
+ }
+ }
+
+ protected Injector createInjector(String language) {
+ try {
+ Module runtimeModule = getRuntimeModule(language);
+ Module sharedStateModule = getSharedStateModule();
+ Module uiModule = getUiModule(language);
+ Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
+ return Guice.createInjector(mergedModule);
+ } catch (Exception e) {
+ logger.error("Failed to create injector for " + language);
+ logger.error(e.getMessage(), e);
+ throw new RuntimeException("Failed to create injector for " + language, e);
+ }
+ }
+
+ protected Module getRuntimeModule(String grammar) {
+ if (EssentialOCLRuntimeModule.LANGUAGE_ID.equals(grammar)) {
+ return new EssentialOCLRuntimeModule();
+ }
+
+ throw new IllegalArgumentException(grammar);
+ }
+
+ protected Module getUiModule(String grammar) {
+ if (EssentialOCLRuntimeModule.LANGUAGE_ID.equals(grammar)) {
+ return new EssentialOCLUiModule(this);
+ }
+
+ throw new IllegalArgumentException(grammar);
+ }
+
+ protected Module getSharedStateModule() {
+ return new SharedStateModule();
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF
index db6f4aee371..70685d8c25f 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/META-INF/MANIFEST.MF
@@ -20,7 +20,6 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.message.xtext;bundle-version="1
org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
org.eclipse.core.expressions;bundle-version="3.4.200",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java
index c3afc4f6721..62126e501a0 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.message.xtext.ui/src/org/eclipse/papyrus/uml/textedit/message/xtext/ui/contributions/MessagePopupEditor.java
@@ -33,27 +33,22 @@ import com.google.inject.Injector;
public class MessagePopupEditor extends DefaultXtextDirectEditorConfiguration {
- public void init(EObject semanticObject) {
-
- }
-
@Override
public Injector getInjector() {
- return UmlMessageActivator.getInstance().getInjector(
- UmlMessageActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_MESSAGE_XTEXT_UMLMESSAGE);
+ return UmlMessageActivator.getInstance().getInjector(UmlMessageActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_MESSAGE_XTEXT_UMLMESSAGE);
}
@Override
protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
- Message message = (Message) umlObject;
+ Message message = (Message)umlObject;
EObject modifiedObject = xtextObject;
- while (xtextObject != null && !(xtextObject instanceof MessageRule)) {
+ while(xtextObject != null && !(xtextObject instanceof MessageRule)) {
modifiedObject = modifiedObject.eContainer();
}
- if (modifiedObject == null) {
+ if(modifiedObject == null) {
return UnexecutableCommand.INSTANCE;
}
- MessageRule messageRuleObject = (MessageRule) xtextObject;
+ MessageRule messageRuleObject = (MessageRule)xtextObject;
// Retrieves the information to be populated in modelObject
String newName = "" + messageRuleObject.getName();
@@ -65,15 +60,15 @@ public class MessagePopupEditor extends DefaultXtextDirectEditorConfiguration {
String newSequenceTermList = "";
int i = 0;
String recurrence;
- for (i = 0; i < messageRuleObject.getSequenceTerm().size(); i++) {
- if (messageRuleObject.getSequenceTerm().get(i).getSequenceName() != null) {
+ for(i = 0; i < messageRuleObject.getSequenceTerm().size(); i++) {
+ if(messageRuleObject.getSequenceTerm().get(i).getSequenceName() != null) {
ocname = messageRuleObject.getSequenceTerm().get(i).getSequenceName().toString();
}
ocnumber = messageRuleObject.getSequenceTerm().get(i).getSequencialOrder();
- if (messageRuleObject.getSequenceTerm().get(i).getRecurrence() != null) {
+ if(messageRuleObject.getSequenceTerm().get(i).getRecurrence() != null) {
recurrence = messageRuleObject.getSequenceTerm().get(i).getRecurrence().trim();
}
- if ((i == 0)) {
+ if((i == 0)) {
newSequenceTermList = newSequenceTermList + ocnumber + ocname;
} else {
newSequenceTermList = newSequenceTermList + '.' + ocnumber + ocname;
@@ -94,17 +89,17 @@ public class MessagePopupEditor extends DefaultXtextDirectEditorConfiguration {
@Override
public String getTextToEdit(Object editedObject) {
- if (editedObject instanceof Message) {
- String texttoedit = ((Message) editedObject).getName().trim();
+ if(editedObject instanceof Message) {
+ String texttoedit = ((Message)editedObject).getName().trim();
- Interaction interaction = ((Message) editedObject).getInteraction();
+ Interaction interaction = ((Message)editedObject).getInteraction();
int sequencenumber = 0;
- for (Iterator it = interaction.getMessages().iterator(); it.hasNext();) {
+ for(Iterator it = interaction.getMessages().iterator(); it.hasNext();) {
sequencenumber++;
- Message childElement = (Message) it.next();
- if (childElement.equals(editedObject)) {
- if ((texttoedit.charAt(0) >= 48) && (texttoedit.charAt(0) <= 57)) {
+ Message childElement = (Message)it.next();
+ if(childElement.equals(editedObject)) {
+ if((texttoedit.charAt(0) >= 48) && (texttoedit.charAt(0) <= 57)) {
return texttoedit;
} else {
return texttoedit = sequencenumber + ":" + texttoedit;
@@ -119,11 +114,12 @@ public class MessagePopupEditor extends DefaultXtextDirectEditorConfiguration {
/**
* The Class UpdateUMLMessageCommand.
*/
- protected static class UpdateUMLMessageCommand extends
- org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
+ protected static class UpdateUMLMessageCommand extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
private Message message;
+
private String newName;
+
private String newSequenceTermList;
@Override
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/.classpath b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/.classpath
index e5fbd3dd27a..5353f0e9459 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/.classpath
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
+ <classpathentry excluding="org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterPopupEditor.java" kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF
index 7cfa139c4e6..ce485629d9e 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.parameter.xtext;bundle-version=
org.eclipse.xtext.builder,
org.antlr.runtime,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
org.eclipse.papyrus.uml.textedit.common.xtext;bundle-version="1.0.0",
@@ -25,7 +24,8 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.parameter.xtext;bundle-version=
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.uml2.uml,
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
- org.eclipse.papyrus.uml.alf.common.ui;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.alf.common.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/plugin.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/plugin.xml
index 596a515b413..f3793923f6a 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/plugin.xml
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/plugin.xml
@@ -233,7 +233,7 @@
language="Advanced Parameter Editor"
objectToEdit="org.eclipse.uml2.uml.Parameter">
<popupeditor
- editorConfiguration="org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.contributions.ParameterPopupEditor">
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.contributions.ParameterXtextDirectEditorConfiguration">
</popupeditor>
</DirectEditor>
</extension>
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterPopupEditor.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterPopupEditor.java
index 2af0db64a34..67760f9a2f4 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterPopupEditor.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterPopupEditor.java
@@ -26,7 +26,8 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.TypeRule;
import org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.internal.UmlParameterActivator;
import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.ParameterRule;
@@ -41,7 +42,7 @@ import com.google.inject.Injector;
-public class ParameterPopupEditor extends org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration {
+public class ParameterPopupEditor extends PopupEditorConfiguration {
/** the new name for the {@link Parameter} */
private String newName;
@@ -293,7 +294,7 @@ public class ParameterPopupEditor extends org.eclipse.papyrus.infra.gmfdiag.xtex
*/
protected IUndoableOperation getUpdateCommand() {
CompositeCommand cc = new CompositeCommand("Set values for Parameter"); //$NON-NLS-1$
- org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(parameter);
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(parameter);
if(provider != null) {
ICommand editCommand = null;
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterXtextDirectEditorConfiguration.java
new file mode 100644
index 00000000000..73433d7cd9c
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext.ui/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/ui/contributions/ParameterXtextDirectEditorConfiguration.java
@@ -0,0 +1,238 @@
+package org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.contributions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+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.SetRequest;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.TypeRule;
+import org.eclipse.papyrus.uml.textedit.parameter.xtext.ui.internal.UmlParameterActivator;
+import org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.ParameterRule;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+import org.eclipse.uml2.uml.ParameterEffectKind;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+
+import com.google.inject.Injector;
+
+
+public class ParameterXtextDirectEditorConfiguration extends DefaultXtextDirectEditorConfiguration {
+
+ @Override
+ public Injector getInjector() {
+ return UmlParameterActivator.getInstance().getInjector(UmlParameterActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_PARAMETER_XTEXT_UMLPARAMETER);
+ }
+
+ @Override
+ protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
+ CompositeCommand cc = new CompositeCommand("Set values for Parameter"); //$NON-NLS-1$
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(umlObject);
+ if(provider != null) {
+
+ ICommand editCommand = null;
+ for(SetRequest current : getRequests(umlObject, xtextObject)) {
+ editCommand = provider.getEditCommand(current);
+
+ if(editCommand != null && editCommand.canExecute()) {
+ cc.add(editCommand);
+ }
+ }
+ }
+ return cc;
+ }
+
+ /**
+ * Returns the list of requests to update the {@link #parameter}
+ *
+ * @return
+ * the list of requests to update the {@link #parameter}
+ */
+ protected List<SetRequest> getRequests(EObject modelObject, EObject xtextObject) {
+ List<SetRequest> requests = new ArrayList<SetRequest>();
+
+
+ // first: retrieves / determines if the xtextObject is a CollaborationUseRule object
+ EObject modifiedObject = xtextObject;
+ if(!(modelObject instanceof Parameter)) {
+ return requests;
+ }
+ while(xtextObject != null && !(xtextObject instanceof ParameterRule)) {
+ modifiedObject = modifiedObject.eContainer();
+ }
+ if(modifiedObject == null) {
+ return requests;
+ }
+ ParameterRule parameterRuleObject = (ParameterRule)xtextObject;
+
+ /** the new name for the {@link Parameter} */
+ String newName;
+
+ /** the new type for the {@link Parameter} */
+ Type newType;
+
+ /** the new visibility for the {@link Parameter} */
+ org.eclipse.uml2.uml.VisibilityKind newVisibility;
+
+ /** the new value for isException */
+ boolean newIsException = false;
+
+ /** the new value for isStream */
+ boolean newIsStream = false;
+
+ /** the new value for isOrdered */
+ boolean newIsOrdered = false;
+
+ /** the new value for isUnique */
+ boolean newIsUnique = false;
+
+ /** the new lowerBound */
+ int newLowerBound = 1;
+
+ /** the new upperBound */
+ int newUpperBound = 1;
+
+ /** the new effect for the parameter */
+ ParameterEffectKind newEffect = ParameterEffectKind.CREATE_LITERAL;
+
+ /** the new direction of the parameter */
+ ParameterDirectionKind newDirection = ParameterDirectionKind.IN_LITERAL;
+
+ // Retrieves the information to be populated in modelObject
+ if(parameterRuleObject.getModifiers() != null) {
+ for(org.eclipse.papyrus.uml.textedit.parameter.xtext.umlParameter.ModifierSpecification modifier : parameterRuleObject.getModifiers().getValues()) {
+ switch(modifier.getValue()) {
+ case ORDERED:
+ newIsOrdered = true;
+ break;
+ case UNIQUE:
+ newIsUnique = true;
+ break;
+ case EXCEPTION:
+ newIsException = true;
+ break;
+ case STREAM:
+ newIsStream = true;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if(parameterRuleObject.getMultiplicity() != null) {
+ if(parameterRuleObject.getMultiplicity().getBounds().size() == 1) {
+ String tempBound = parameterRuleObject.getMultiplicity().getBounds().get(0).getValue();
+ if(tempBound.equals("*")) { //$NON-NLS-1$
+ newLowerBound = 0;
+ newUpperBound = -1;
+ } else {
+ newLowerBound = new Integer(tempBound).intValue();
+ newUpperBound = new Integer(tempBound).intValue();
+ }
+ } else { //size == 2
+ String tempBound = parameterRuleObject.getMultiplicity().getBounds().get(0).getValue();
+ newLowerBound = new Integer(tempBound).intValue();
+ tempBound = parameterRuleObject.getMultiplicity().getBounds().get(1).getValue();
+ if(tempBound.equals("*")) { //$NON-NLS-1$
+ newUpperBound = -1;
+ } else {
+ newUpperBound = new Integer(tempBound).intValue();
+ }
+ }
+ } else {//reset to the default value :
+ newLowerBound = 1;
+ newUpperBound = 1;
+ }
+
+ newName = "" + parameterRuleObject.getName(); //$NON-NLS-1$
+
+ TypeRule typeRule = parameterRuleObject.getType();
+ if(typeRule == null) {
+ newType = null;
+ } else {
+ newType = typeRule.getType();
+ }
+
+ newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL;
+
+ switch(parameterRuleObject.getVisibility()) {
+ case PUBLIC:
+ newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL;
+ break;
+ case PACKAGE:
+ newVisibility = org.eclipse.uml2.uml.VisibilityKind.PACKAGE_LITERAL;
+ break;
+ case PRIVATE:
+ newVisibility = org.eclipse.uml2.uml.VisibilityKind.PRIVATE_LITERAL;
+ break;
+ case PROTECTED:
+ newVisibility = org.eclipse.uml2.uml.VisibilityKind.PROTECTED_LITERAL;
+ break;
+ default:
+ break;
+ }
+
+ switch(parameterRuleObject.getDirection()) {
+ case IN:
+ newDirection = ParameterDirectionKind.IN_LITERAL;
+ break;
+ case OUT:
+ newDirection = ParameterDirectionKind.OUT_LITERAL;
+ break;
+ case INOUT:
+ newDirection = ParameterDirectionKind.INOUT_LITERAL;
+ break;
+ case RETURN:
+ newDirection = ParameterDirectionKind.RETURN_LITERAL;
+ break;
+ }
+
+ switch(parameterRuleObject.getEffect().getEffectKind()) {
+ case CREATE:
+ newEffect = ParameterEffectKind.CREATE_LITERAL;
+ break;
+ case DELETE:
+ newEffect = ParameterEffectKind.DELETE_LITERAL;
+ break;
+ case READ:
+ newEffect = ParameterEffectKind.READ_LITERAL;
+ break;
+ case UPDATE:
+ newEffect = ParameterEffectKind.UPDATE_LITERAL;
+ break;
+ }
+
+ Parameter parameter = (Parameter)modelObject;
+
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getNamedElement_Name(), newName));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getNamedElement_Visibility(), newVisibility));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getTypedElement_Type(), newType));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_IsException(), newIsException));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_IsStream(), newIsStream));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered(), newIsOrdered));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique(), newIsUnique));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_Direction(), newDirection));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_Lower(), newLowerBound));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getMultiplicityElement_Upper(), newUpperBound));
+ requests.add(new SetRequest(parameter, UMLPackage.eINSTANCE.getParameter_Effect(), newEffect));
+ return requests;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getTextToEdit(Object editedObject) {
+ if(editedObject instanceof Parameter) {
+ return UMLParameterEditorUtil.getLabel((Parameter)editedObject).trim();
+ }
+ return "not a Parameter"; //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/META-INF/MANIFEST.MF
index 739e0e20547..2db6dad9aa9 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/META-INF/MANIFEST.MF
@@ -14,7 +14,6 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.emf.common,
org.antlr.runtime,
org.eclipse.papyrus.uml.textedit.common.xtext;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.uml.alf.common;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.uml.textedit.parameter.xtext,
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/validation/SemanticValidator.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/validation/SemanticValidator.java
deleted file mode 100644
index 6f9c9ac7a46..00000000000
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.parameter.xtext/src/org/eclipse/papyrus/uml/textedit/parameter/xtext/validation/SemanticValidator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.textedit.parameter.xtext.validation;
-
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXTextSemanticValidator;
-
-/**
- * Custom implementation for IXtextSemanticValidator in the context of the textual editor for {@link Parameter}
- *
- * @author CEA LIST
- *
- */
-public class SemanticValidator implements IXTextSemanticValidator {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXTextSemanticValidator#validate()
- *
- * @return
- */
- public boolean validate() {
- UmlParameterJavaValidator validator = new UmlParameterJavaValidator();
- return validator.validate();
- }
-
-}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src-gen/org/eclipse/papyrus/uml/textedit/port/xtext/ui/internal/UmlPortActivator.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src-gen/org/eclipse/papyrus/uml/textedit/port/xtext/ui/internal/UmlPortActivator.java
index e77861a009c..79bd5bdc96e 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src-gen/org/eclipse/papyrus/uml/textedit/port/xtext/ui/internal/UmlPortActivator.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src-gen/org/eclipse/papyrus/uml/textedit/port/xtext/ui/internal/UmlPortActivator.java
@@ -23,7 +23,7 @@ import com.google.inject.Module;
*/
public class UmlPortActivator extends AbstractUIPlugin {
- public static final String ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_PORT_XTEXT_UMLPORT = "org.eclipse.papyrus.uml.textedit.port.xtext.UmlPort";
+ public static final String ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_PORT_XTEXT_UMLPORT = "org.eclipse.papyrus.uml.textedit.port.xtext.UmlPort"; //$NON-NLS-1$
private static final Logger logger = Logger.getLogger(UmlPortActivator.class);
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contentassist/UmlPortProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contentassist/UmlPortProposalProvider.java
index 80fea0c0d73..873f1ef37f0 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contentassist/UmlPortProposalProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contentassist/UmlPortProposalProvider.java
@@ -19,8 +19,6 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CompletionProposalUtils;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CustomCompletionProposal;
import org.eclipse.papyrus.uml.textedit.port.xtext.scoping.UmlPortScopeProvider;
import org.eclipse.papyrus.uml.textedit.port.xtext.ui.contribution.UMLPortEditorPropertyUtil;
import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.ModifierSpecification;
@@ -29,6 +27,8 @@ import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.MultiplicityRule;
import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.PortRule;
import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.QualifiedName;
import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.TypeRule;
+import org.eclipse.papyrus.uml.xtext.integration.CompletionProposalUtils;
+import org.eclipse.papyrus.uml.xtext.integration.CustomCompletionProposal;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementUtil;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Element;
@@ -59,8 +59,7 @@ public class UmlPortProposalProvider extends org.eclipse.papyrus.uml.textedit.po
@Override
public void completePortRule_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
List<Classifier> allClassifiers = new ArrayList<Classifier>();
- Namespace namespace = (Namespace) EcoreUtil.getRootContainer(ContextElementUtil.getContextElement(model
- .eResource()));
+ Namespace namespace = (Namespace)EcoreUtil.getRootContainer(ContextElementUtil.getContextElement(model.eResource()));
allClassifiers.addAll(getRecursivelyOwnedClassifiers(namespace));
allClassifiers.addAll(getRecursivelyImportedClassifiers(namespace));
for(Classifier c : allClassifiers) {
@@ -82,8 +81,7 @@ public class UmlPortProposalProvider extends org.eclipse.papyrus.uml.textedit.po
*/
@Override
public void completeTypeRule_Path(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- Namespace root = (Namespace) EcoreUtil
- .getRootContainer(ContextElementUtil.getContextElement(model.eResource()));
+ Namespace root = (Namespace)EcoreUtil.getRootContainer(ContextElementUtil.getContextElement(model.eResource()));
if(root == null) {
return;
@@ -120,7 +118,7 @@ public class UmlPortProposalProvider extends org.eclipse.papyrus.uml.textedit.po
@Override
public void completeTypeRule_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- Namespace namespace = ((Property) ContextElementUtil.getContextElement(model.eResource())).getNamespace();
+ Namespace namespace = ((Property)ContextElementUtil.getContextElement(model.eResource())).getNamespace();
if(model instanceof TypeRule) {
TypeRule typeRule = (TypeRule)model;
QualifiedName path = typeRule.getPath();
@@ -190,7 +188,7 @@ public class UmlPortProposalProvider extends org.eclipse.papyrus.uml.textedit.po
@Override
public void completeRedefinesRule_Port(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- for(Property inherited : UmlPortScopeProvider.retrieveInheritedProperties()) {
+ for(Property inherited : UmlPortScopeProvider.retrieveInheritedProperties(model)) {
if(inherited.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String completionString = inherited.getName();
String displayString = UMLPortEditorPropertyUtil.getLabel(inherited);
@@ -202,7 +200,7 @@ public class UmlPortProposalProvider extends org.eclipse.papyrus.uml.textedit.po
@Override
public void completeSubsetsRule_Port(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- for(Property inherited : UmlPortScopeProvider.retrieveInheritedProperties()) {
+ for(Property inherited : UmlPortScopeProvider.retrieveInheritedProperties(model)) {
if(inherited.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String completionString = inherited.getName();
String displayString = UMLPortEditorPropertyUtil.getLabel(inherited);
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java
index c7b58da2677..294a6b3d287 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/PortXtextDirectEditorConfiguration.java
@@ -44,6 +44,8 @@ import com.google.inject.Injector;
*/
public class PortXtextDirectEditorConfiguration extends DefaultXtextDirectEditorConfiguration {
+ private static final String PORT_UPDATE = "port update"; //$NON-NLS-1$
+
private Port port;
private boolean newIsDerived;
@@ -102,8 +104,8 @@ public class PortXtextDirectEditorConfiguration extends DefaultXtextDirectEditor
PortRule portRuleObject = (PortRule) xtextObject;
// Retrieves the information to be populated in modelObject
- newIsDerived = portRuleObject.getIsDerived() != null && portRuleObject.getIsDerived().equals("/");
- isConjugated = portRuleObject.getIsConjugated() != null && portRuleObject.getIsConjugated().equals("~");
+ newIsDerived = portRuleObject.getIsDerived() != null && portRuleObject.getIsDerived().equals("/"); //$NON-NLS-1$
+ isConjugated = portRuleObject.getIsConjugated() != null && portRuleObject.getIsConjugated().equals("~"); //$NON-NLS-1$
newIsReadOnly = false;
newIsUnique = false;
newIsUnion = false;
@@ -144,7 +146,7 @@ public class PortXtextDirectEditorConfiguration extends DefaultXtextDirectEditor
if (portRuleObject.getMultiplicity() != null) {
if (portRuleObject.getMultiplicity().getBounds().size() == 1) {
String tempBound = portRuleObject.getMultiplicity().getBounds().get(0).getValue();
- if (tempBound.equals("*")) {
+ if (tempBound.equals("*")) { //$NON-NLS-1$
newLowerBound = 0;
newUpperBound = -1;
} else {
@@ -155,7 +157,7 @@ public class PortXtextDirectEditorConfiguration extends DefaultXtextDirectEditor
String tempBound = portRuleObject.getMultiplicity().getBounds().get(0).getValue();
newLowerBound = new Integer(tempBound).intValue();
tempBound = portRuleObject.getMultiplicity().getBounds().get(1).getValue();
- if (tempBound.equals("*")) {
+ if (tempBound.equals("*")) { //$NON-NLS-1$
newUpperBound = -1;
} else {
newUpperBound = new Integer(tempBound).intValue();
@@ -169,7 +171,7 @@ public class PortXtextDirectEditorConfiguration extends DefaultXtextDirectEditor
newDefault = null;
}
- newName = "" + ALFIDConverter.IDtoName(portRuleObject.getName());
+ newName = "" + ALFIDConverter.IDtoName(portRuleObject.getName()); //$NON-NLS-1$
TypeRule typeRule = portRuleObject.getType();
if (typeRule == null) {
@@ -200,7 +202,7 @@ public class PortXtextDirectEditorConfiguration extends DefaultXtextDirectEditor
}
private CompositeCommand getUpdateCommand(EObject editedObject) {
- org.eclipse.gmf.runtime.common.core.command.CompositeCommand updateCommand = new CompositeCommand("port update");
+ org.eclipse.gmf.runtime.common.core.command.CompositeCommand updateCommand = new CompositeCommand(PORT_UPDATE);
SetRequest setIsDerivedRequest = new SetRequest(editedObject, UMLPackage.eINSTANCE.getProperty_IsDerived(),
newIsDerived);
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/UMLPortEditorPropertyUtil.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/UMLPortEditorPropertyUtil.java
index 74e24135c52..a01a3652eaf 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/UMLPortEditorPropertyUtil.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext.ui/src/org/eclipse/papyrus/uml/textedit/port/xtext/ui/contribution/UMLPortEditorPropertyUtil.java
@@ -13,13 +13,13 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.textedit.port.xtext.ui.contribution;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CompletionProposalUtils;
import org.eclipse.papyrus.uml.alf.naming.ALFIDConverter;
import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil;
import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
import org.eclipse.papyrus.uml.tools.utils.PortUtil;
import org.eclipse.papyrus.uml.tools.utils.PropertyUtil;
import org.eclipse.papyrus.uml.tools.utils.TypeUtil;
+import org.eclipse.papyrus.uml.xtext.integration.CompletionProposalUtils;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/META-INF/MANIFEST.MF
index 193b1ecc81c..0ad5b565292 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/META-INF/MANIFEST.MF
@@ -12,7 +12,6 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.emf.ecore,
org.eclipse.emf.common,
org.antlr.runtime,
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.uml.alf.common;bundle-version="1.0.0",
org.eclipse.papyrus.uml.xtext.integration.core;bundle-version="1.0.0"
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/src/org/eclipse/papyrus/uml/textedit/port/xtext/scoping/UmlPortScopeProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/src/org/eclipse/papyrus/uml/textedit/port/xtext/scoping/UmlPortScopeProvider.java
index 640d97a8890..57f9d92e54b 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/src/org/eclipse/papyrus/uml/textedit/port/xtext/scoping/UmlPortScopeProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.port.xtext/src/org/eclipse/papyrus/uml/textedit/port/xtext/scoping/UmlPortScopeProvider.java
@@ -20,7 +20,6 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper;
import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.QualifiedName;
import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.RedefinesRule;
import org.eclipse.papyrus.uml.textedit.port.xtext.umlPort.SubsetsRule;
@@ -59,14 +58,14 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
}
private IScope create___TypeRule_type___Scope(TypeRule ctx) {
- if (ctx.getPath() == null) {
- EObject contextElement = ContextElementUtil.getContextElement(ctx.eResource());
- Namespace root = (Namespace) EcoreUtil.getRootContainer(contextElement);
+ if(ctx.getPath() == null) {
+ EObject contextElement = ContextElementUtil.getContextElement(ctx.eResource());
+ Namespace root = (Namespace)EcoreUtil.getRootContainer(contextElement);
Iterator<EObject> i = root.eResource().getAllContents();
List<EObject> allContent = new ArrayList<EObject>();
- while (i.hasNext()) {
+ while(i.hasNext()) {
EObject object = i.next();
- if (object instanceof Classifier) {
+ if(object instanceof Classifier) {
allContent.add(object);
}
}
@@ -77,17 +76,16 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
// specified,
// retrieves visible elements from this name space
List<Element> tmpVisibleElementsFromPath = new ArrayList<Element>();
- if (ctx.getPath() != null) {
+ if(ctx.getPath() != null) {
QualifiedName qualifiedName = ctx.getPath();
- while (qualifiedName.getRemaining() != null) {
+ while(qualifiedName.getRemaining() != null) {
qualifiedName = qualifiedName.getRemaining();
}
Namespace nearestNamespace = qualifiedName.getPath();
- if (nearestNamespace != null) {
+ if(nearestNamespace != null) {
List<Element> tmpVisiblePropertiesFromPath = new ArrayList<Element>();
- tmpVisiblePropertiesFromPath.addAll(new Visitor_GetOwnedAndImportedClassifiers()
- .visit(nearestNamespace));
- for (Element e : tmpVisiblePropertiesFromPath) {
+ tmpVisiblePropertiesFromPath.addAll(new Visitor_GetOwnedAndImportedClassifiers().visit(nearestNamespace));
+ for(Element e : tmpVisiblePropertiesFromPath) {
tmpVisibleElementsFromPath.add(e);
}
}
@@ -97,14 +95,12 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
SimpleScope resultScope = null;
Iterable<IEObjectDescription> iterableIEobjectDescriptions;
- if (!tmpVisibleElementsFromPath.isEmpty()) {
+ if(!tmpVisibleElementsFromPath.isEmpty()) {
iterableIEobjectDescriptions = Scopes.scopedElementsFor(tmpVisibleElementsFromPath);
- resultScope = resultScope != null ? new SimpleScope(resultScope, iterableIEobjectDescriptions)
- : new SimpleScope(iterableIEobjectDescriptions);
+ resultScope = resultScope != null ? new SimpleScope(resultScope, iterableIEobjectDescriptions) : new SimpleScope(iterableIEobjectDescriptions);
}
- return resultScope != null ? resultScope : new SimpleScope(
- Scopes.scopedElementsFor(new ArrayList<Element>()));
+ return resultScope != null ? resultScope : new SimpleScope(Scopes.scopedElementsFor(new ArrayList<Element>()));
}
}
@@ -115,12 +111,12 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
*/
public IScope scope_QualifiedName_path(QualifiedName ctx, EReference ref) {
List<Namespace> visibleNamespaces = new ArrayList<Namespace>();
- if (ctx != null && ctx.eContainer() != null && ctx.eContainer() instanceof QualifiedName) {
- Namespace parentNameSpace = ((QualifiedName) ctx.eContainer()).getPath();
+ if(ctx != null && ctx.eContainer() != null && ctx.eContainer() instanceof QualifiedName) {
+ Namespace parentNameSpace = ((QualifiedName)ctx.eContainer()).getPath();
visibleNamespaces.addAll(new Visitor_GetOwnedNamespacesAndImportedNamespaces().visit(parentNameSpace));
} else {
EObject contextElement = ContextElementUtil.getContextElement(ctx.eResource());
- Namespace root = (Namespace) EcoreUtil.getRootContainer(contextElement);
+ Namespace root = (Namespace)EcoreUtil.getRootContainer(contextElement);
visibleNamespaces.add(root);
visibleNamespaces.addAll(new Visitor_GetOwnedNamespacesAndImportedNamespaces().visit(root));
}
@@ -134,12 +130,12 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
List<Namespace> namespaces = new ArrayList<Namespace>();
// retrieves imported namespaces
- for (PackageImport pImport : visited.getPackageImports()) {
+ for(PackageImport pImport : visited.getPackageImports()) {
namespaces.add(pImport.getImportedPackage());
}
- for (ElementImport eImport : visited.getElementImports()) {
- if (eImport.getImportedElement() instanceof Namespace) {
- namespaces.add((Namespace) eImport.getImportedElement());
+ for(ElementImport eImport : visited.getElementImports()) {
+ if(eImport.getImportedElement() instanceof Namespace) {
+ namespaces.add((Namespace)eImport.getImportedElement());
}
}
@@ -155,9 +151,9 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
// first retrieves imported namespaces
namespaces.addAll(super.visit(visited));
// then retrieves owned namespaces
- for (NamedElement n : visited.getOwnedMembers()) {
- if (n instanceof Namespace) {
- namespaces.add((Namespace) n);
+ for(NamedElement n : visited.getOwnedMembers()) {
+ if(n instanceof Namespace) {
+ namespaces.add((Namespace)n);
}
}
return namespaces;
@@ -169,14 +165,14 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
public List<Element> visit(Namespace visited) {
List<Element> visibleElements = new ArrayList<Element>();
// first retrieves imported properties
- for (ElementImport eImport : visited.getElementImports()) {
- if (eImport.getImportedElement() instanceof Classifier) {
+ for(ElementImport eImport : visited.getElementImports()) {
+ if(eImport.getImportedElement() instanceof Classifier) {
visibleElements.add(eImport.getImportedElement());
}
}
// then retrieves owned properties
- for (NamedElement n : visited.getOwnedMembers()) {
- if (n instanceof Classifier) {
+ for(NamedElement n : visited.getOwnedMembers()) {
+ if(n instanceof Classifier) {
visibleElements.add(n);
}
}
@@ -194,8 +190,7 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
* @return
*/
public IScope scope_RedefinesRule_property(RedefinesRule ctx, EReference ref) {
- Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes
- .scopedElementsFor(retrieveInheritedProperties());
+ Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(retrieveInheritedProperties(ctx));
return new SimpleScope(iterableIEobjectDescription);
}
@@ -207,21 +202,20 @@ public class UmlPortScopeProvider extends org.eclipse.xtext.scoping.impl.Abstrac
* @return
*/
public IScope scope_SubsetsRule_property(SubsetsRule ctx, EReference ref) {
- Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes
- .scopedElementsFor(retrieveInheritedProperties());
+ Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(retrieveInheritedProperties(ctx));
return new SimpleScope(iterableIEobjectDescription);
}
- //TODO
- public static List<Property> retrieveInheritedProperties() {
- Property editedProperty = (Property)PopupXtextEditorHelper.context;
- if (editedProperty == null) {
+
+ public static List<Property> retrieveInheritedProperties(EObject modelRule) {
+ Property editedProperty = (Property)ContextElementUtil.getContextElement(modelRule.eResource());
+ if(editedProperty == null) {
return null;
}
- Classifier owner = (Classifier) editedProperty.getNamespace();
+ Classifier owner = (Classifier)editedProperty.getNamespace();
List<Property> inheritedProperties = new ArrayList<Property>();
- for (Classifier parent : owner.getGenerals()) {
- for (Property p : parent.getAllAttributes()) {
- if (!inheritedProperties.contains(p)) {
+ for(Classifier parent : owner.getGenerals()) {
+ for(Property p : parent.getAllAttributes()) {
+ if(!inheritedProperties.contains(p)) {
;
}
inheritedProperties.add(p);
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF
index 68cf1ca3286..e8bcab7fc67 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/META-INF/MANIFEST.MF
@@ -35,7 +35,6 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.property.xtext;bundle-version="
org.antlr.runtime,
org.eclipse.xtext.builder,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.4.0",
org.eclipse.uml2.uml;bundle-version="3.1.0",
org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contentassist/UmlPropertyProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contentassist/UmlPropertyProposalProvider.java
index 08d354267bb..a8b0fc909e8 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contentassist/UmlPropertyProposalProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contentassist/UmlPropertyProposalProvider.java
@@ -20,8 +20,6 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CompletionProposalUtils;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CustomCompletionProposal;
import org.eclipse.papyrus.uml.textedit.property.xtext.scoping.UmlPropertyScopeProvider;
import org.eclipse.papyrus.uml.textedit.property.xtext.ui.contributions.UMLPropertyEditorPropertyUtil;
import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.ModifierSpecification;
@@ -30,6 +28,8 @@ import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.MultiplicityR
import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.PropertyRule;
import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.QualifiedName;
import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.TypeRule;
+import org.eclipse.papyrus.uml.xtext.integration.CompletionProposalUtils;
+import org.eclipse.papyrus.uml.xtext.integration.CustomCompletionProposal;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementUtil;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Element;
@@ -57,25 +57,20 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
* Provides custom completion for the specifying the type of a property
*
* @see org.eclipse.papyrus.uml.textedit.property.xtext.ui.contentassist.AbstractUmlPropertyProposalProvider#completePropertyRule_Type(org.eclipse.emf.ecore.EObject,
- * org.eclipse.xtext.Assignment,
- * org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
+ * org.eclipse.xtext.Assignment, org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
* org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor)
*/
@Override
- public void completePropertyRule_Type(EObject model, Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completePropertyRule_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
List<Classifier> allClassifiers = new ArrayList<Classifier>();
- Namespace namespace = (Namespace) EcoreUtil.getRootContainer(ContextElementUtil.getContextElement(model
- .eResource()));
+ Namespace namespace = (Namespace)EcoreUtil.getRootContainer(ContextElementUtil.getContextElement(model.eResource()));
allClassifiers.addAll(getRecursivelyOwnedClassifiers(namespace));
allClassifiers.addAll(getRecursivelyImportedClassifiers(namespace));
- for (Classifier c : allClassifiers) {
- if (c.getQualifiedName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ for(Classifier c : allClassifiers) {
+ if(c.getQualifiedName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String displayString = c.getQualifiedName();
- String completionString = CompletionProposalUtils
- .getQualifiedNameLabelWithSufficientDepth(c, namespace);
- ICompletionProposal completionProposal = CompletionProposalUtils
- .createCompletionProposalWithReplacementOfPrefix(c, completionString, displayString, context);
+ String completionString = CompletionProposalUtils.getQualifiedNameLabelWithSufficientDepth(c, namespace);
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(c, completionString, displayString, context);
acceptor.accept(completionProposal);
}
}
@@ -85,35 +80,30 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
* Provides custom completion for the root element in a qualified name
*
* @see org.eclipse.papyrus.uml.textedit.property.xtext.ui.contentassist.AbstractUmlPropertyProposalProvider#completeTypeRule_Path(org.eclipse.emf.ecore.EObject,
- * org.eclipse.xtext.Assignment,
- * org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
+ * org.eclipse.xtext.Assignment, org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
* org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor)
*/
@Override
- public void completeTypeRule_Path(EObject model, Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- Namespace root = (Namespace) EcoreUtil
- .getRootContainer(ContextElementUtil.getContextElement(model.eResource()));
- if (root == null) {
+ public void completeTypeRule_Path(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ Namespace root = (Namespace)EcoreUtil.getRootContainer(ContextElementUtil.getContextElement(model.eResource()));
+ if(root == null) {
return;
}
// first accept the root Model
String completionString = root.getName() + "::";
String displayString = root.getName() + "::";
// String displayString = c.getName() ;
- CustomCompletionProposal completionProposal = CompletionProposalUtils
- .createCompletionProposalWithReplacementOfPrefix(root, completionString, displayString, context);
+ CustomCompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(root, completionString, displayString, context);
acceptor.accept(completionProposal);
// then accepts all packages imported by Model
List<Package> importedPackages = root.getImportedPackages();
- for (Package p : importedPackages) {
- if (p.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ for(Package p : importedPackages) {
+ if(p.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
completionString = p.getName() + "::";
displayString = p.getName() + "::";
// String displayString = c.getName() ;
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(root,
- completionString, displayString, context);
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(root, completionString, displayString, context);
acceptor.accept(completionProposal);
}
}
@@ -125,32 +115,28 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
* into account the path if the name is qualified
*
* @see org.eclipse.papyrus.uml.textedit.property.xtext.ui.contentassist.AbstractUmlPropertyProposalProvider#completeTypeRule_Type(org.eclipse.emf.ecore.EObject,
- * org.eclipse.xtext.Assignment,
- * org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
+ * org.eclipse.xtext.Assignment, org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
* org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor)
*/
@Override
- public void completeTypeRule_Type(EObject model, Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- Namespace namespace = ((Property) ContextElementUtil.getContextElement(model.eResource())).getNamespace();
- if (model instanceof TypeRule) {
- TypeRule typeRule = (TypeRule) model;
+ public void completeTypeRule_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ Namespace namespace = ((Property)ContextElementUtil.getContextElement(model.eResource())).getNamespace();
+ if(model instanceof TypeRule) {
+ TypeRule typeRule = (TypeRule)model;
QualifiedName path = typeRule.getPath();
- while (path.getRemaining() != null) {
+ while(path.getRemaining() != null) {
path = path.getRemaining();
}
namespace = path.getPath();
- } else if (!(model instanceof PropertyRule)) {
+ } else if(!(model instanceof PropertyRule)) {
return;
}
- for (NamedElement n : namespace.getOwnedMembers()) {
- if (n instanceof Classifier) {
- if (n.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ for(NamedElement n : namespace.getOwnedMembers()) {
+ if(n instanceof Classifier) {
+ if(n.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String completionString = n.getName();
String displayString = n.getName();
- CustomCompletionProposal completionProposal = CompletionProposalUtils
- .createCompletionProposalWithReplacementOfPrefix(n, completionString, displayString,
- context);
+ CustomCompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(n, completionString, displayString, context);
acceptor.accept(completionProposal);
}
}
@@ -162,13 +148,11 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
* Provides custom completion for a path in a qualified name
*
* @see org.eclipse.papyrus.uml.textedit.property.xtext.ui.contentassist.AbstractUmlPropertyProposalProvider#completeQualifiedName_Path(org.eclipse.emf.ecore.EObject,
- * org.eclipse.xtext.Assignment,
- * org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
+ * org.eclipse.xtext.Assignment, org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
* org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor)
*/
@Override
- public void completeQualifiedName_Path(EObject model, Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeQualifiedName_Path(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// The customization consists in proposing nothing. Proposals are
// already handled by other methods
}
@@ -178,62 +162,51 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
* has already been specified
*
* @see org.eclipse.papyrus.uml.textedit.property.xtext.ui.contentassist.AbstractUmlPropertyProposalProvider#completeQualifiedName_Remaining(org.eclipse.emf.ecore.EObject,
- * org.eclipse.xtext.Assignment,
- * org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
+ * org.eclipse.xtext.Assignment, org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
* org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor)
*/
@Override
- public void completeQualifiedName_Remaining(EObject model, Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- QualifiedName path = (QualifiedName) model;
- for (NamedElement n : path.getPath().getOwnedMembers()) {
- if (n instanceof Package) {
- if (n.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ public void completeQualifiedName_Remaining(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ QualifiedName path = (QualifiedName)model;
+ for(NamedElement n : path.getPath().getOwnedMembers()) {
+ if(n instanceof Package) {
+ if(n.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String completionString = n.getName() + "::";
String displayString = n.getName() + "::";
- CustomCompletionProposal completionProposal = CompletionProposalUtils
- .createCompletionProposalWithReplacementOfPrefix(n, completionString, displayString,
- context);
+ CustomCompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(n, completionString, displayString, context);
acceptor.accept(completionProposal);
}
}
}
- for (Package p : path.getPath().getImportedPackages()) {
- if (p.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ for(Package p : path.getPath().getImportedPackages()) {
+ if(p.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String completionString = p.getName() + "::";
String displayString = p.getName() + "::";
- CustomCompletionProposal completionProposal = CompletionProposalUtils
- .createCompletionProposalWithReplacementOfPrefix(p, completionString, displayString, context);
+ CustomCompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(p, completionString, displayString, context);
acceptor.accept(completionProposal);
}
}
}
@Override
- public void completeRedefinesRule_Property(EObject model, Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- for (Property inherited : UmlPropertyScopeProvider.retrieveInheritedProperties()) {
- if (inherited.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ public void completeRedefinesRule_Property(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ for(Property inherited : UmlPropertyScopeProvider.retrieveInheritedProperties(model)) {
+ if(inherited.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String completionString = inherited.getName();
String displayString = UMLPropertyEditorPropertyUtil.getLabel(inherited);
- CustomCompletionProposal completionProposal = CompletionProposalUtils
- .createCompletionProposalWithReplacementOfPrefix(inherited, completionString, displayString,
- context);
+ CustomCompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(inherited, completionString, displayString, context);
acceptor.accept(completionProposal);
}
}
}
@Override
- public void completeSubsetsRule_Property(EObject model, Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- for (Property inherited : UmlPropertyScopeProvider.retrieveInheritedProperties()) {
- if (inherited.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ public void completeSubsetsRule_Property(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ for(Property inherited : UmlPropertyScopeProvider.retrieveInheritedProperties(model)) {
+ if(inherited.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String completionString = inherited.getName();
String displayString = UMLPropertyEditorPropertyUtil.getLabel(inherited);
- CustomCompletionProposal completionProposal = CompletionProposalUtils
- .createCompletionProposalWithReplacementOfPrefix(inherited, completionString, displayString,
- context);
+ CustomCompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(inherited, completionString, displayString, context);
acceptor.accept(completionProposal);
}
}
@@ -244,25 +217,23 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
* specification
*
* @see org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider#completeKeyword(org.eclipse.xtext.Keyword,
- * org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext,
- * org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor)
+ * org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext, org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor)
*/
@Override
- public void completeKeyword(Keyword keyword, ContentAssistContext contentAssistContext,
- ICompletionProposalAcceptor acceptor) {
+ public void completeKeyword(Keyword keyword, ContentAssistContext contentAssistContext, ICompletionProposalAcceptor acceptor) {
EObject model = contentAssistContext.getCurrentModel();
- if (!(model instanceof ModifiersRule)) {
+ if(!(model instanceof ModifiersRule)) {
super.completeKeyword(keyword, contentAssistContext, acceptor);
return;
}
- ModifiersRule modifiersRule = (ModifiersRule) model;
+ ModifiersRule modifiersRule = (ModifiersRule)model;
boolean isOrdered = false;
boolean isReadOnly = true;
boolean isUnion = false;
boolean isUnique = false;
- for (ModifierSpecification spec : modifiersRule.getValues()) {
- if (spec.getValue() != null) {
- switch (spec.getValue()) {
+ for(ModifierSpecification spec : modifiersRule.getValues()) {
+ if(spec.getValue() != null) {
+ switch(spec.getValue()) {
case ORDERED:
isOrdered = true;
break;
@@ -281,20 +252,20 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
}
}
String value = keyword.getValue();
- if (value.equals("ordered")) {
- if (!isOrdered) {
+ if(value.equals("ordered")) {
+ if(!isOrdered) {
super.completeKeyword(keyword, contentAssistContext, acceptor);
}
- } else if (value.equals("readOnly")) {
- if (!isReadOnly) {
+ } else if(value.equals("readOnly")) {
+ if(!isReadOnly) {
super.completeKeyword(keyword, contentAssistContext, acceptor);
}
- } else if (value.equals("unique")) {
- if (!isUnique) {
+ } else if(value.equals("unique")) {
+ if(!isUnique) {
super.completeKeyword(keyword, contentAssistContext, acceptor);
}
- } else if (value.equals("union")) {
- if (!isUnion) {
+ } else if(value.equals("union")) {
+ if(!isUnion) {
super.completeKeyword(keyword, contentAssistContext, acceptor);
}
} else {
@@ -303,8 +274,7 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
}
@Override
- public void complete_MultiplicityRule(EObject model, RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_MultiplicityRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
String zero_one = "[0..1]";
String one = "[1]";
String one_star = "[1..*]";
@@ -336,26 +306,23 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
}
@Override
- public void completeMultiplicityRule_Bounds(EObject model, Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeMultiplicityRule_Bounds(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- if (!(model instanceof MultiplicityRule)) {
+ if(!(model instanceof MultiplicityRule)) {
return;
}
- MultiplicityRule multiplicityRule = (MultiplicityRule) model;
+ MultiplicityRule multiplicityRule = (MultiplicityRule)model;
- if (multiplicityRule.getBounds().size() == 2) {
+ if(multiplicityRule.getBounds().size() == 2) {
String value = multiplicityRule.getBounds().get(1).getValue();
try {
Integer.valueOf(value);
} catch (Exception e) {
- if (!multiplicityRule.getBounds().get(0).getValue().equals("*")
- && !multiplicityRule.getBounds().get(1).getValue().equals("*")) {
+ if(!multiplicityRule.getBounds().get(0).getValue().equals("*") && !multiplicityRule.getBounds().get(1).getValue().equals("*")) {
String completionString = "*";
String displayString = "*";
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposal(
- completionString, displayString, context);
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
acceptor.accept(completionProposal);
}
}
@@ -373,7 +340,7 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
* indirectly owned by a context namespace
*
* @param context
- * The context namespace
+ * The context namespace
* @return the list of classifiers that are directly or indirectly owned by
* the context namespace
*/
@@ -381,12 +348,12 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
List<Classifier> recursivelyOwnedClassifiers = new ArrayList<Classifier>();
List<Element> allOwnedElements = context.getOwnedElements();
- for (Element e : allOwnedElements) {
- if (e instanceof Classifier) {
- recursivelyOwnedClassifiers.add((Classifier) e);
+ for(Element e : allOwnedElements) {
+ if(e instanceof Classifier) {
+ recursivelyOwnedClassifiers.add((Classifier)e);
}
- if (e instanceof Namespace) {
- recursivelyOwnedClassifiers.addAll(getRecursivelyOwnedClassifiers((Namespace) e));
+ if(e instanceof Namespace) {
+ recursivelyOwnedClassifiers.addAll(getRecursivelyOwnedClassifiers((Namespace)e));
}
}
@@ -398,7 +365,7 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
* or indirectly owned by the namespaces imported by a context namespace
*
* @param context
- * The context namespace
+ * The context namespace
* @return the list of classifiers that are directly or indirectly owned by
* the namespaces imported by the context namespace
*/
@@ -406,7 +373,7 @@ public class UmlPropertyProposalProvider extends AbstractUmlPropertyProposalProv
List<Classifier> recursivelyImportedClassifiers = new ArrayList<Classifier>();
List<Package> importedPackages = context.getImportedPackages();
- for (Package p : importedPackages) {
+ for(Package p : importedPackages) {
recursivelyImportedClassifiers.addAll(getRecursivelyOwnedClassifiers(p));
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java
index acab337eebf..98860acb908 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/PropertyXtextDirectEditorConfiguration.java
@@ -45,34 +45,32 @@ import com.google.inject.Injector;
* editor, for properties of UML classifiers.
*
*/
-public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEditorConfiguration implements
- ICustomDirectEditorConfiguration {
+public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
@Override
public Injector getInjector() {
- return UmlPropertyActivator.getInstance().getInjector(
- UmlPropertyActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_PROPERTY_XTEXT_UMLPROPERTY);
+ return UmlPropertyActivator.getInstance().getInjector(UmlPropertyActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_PROPERTY_XTEXT_UMLPROPERTY);
}
+ @Override
public ICommand getParseCommand(EObject modelObject, EObject xtextObject) {
- Property property = (Property) modelObject;
+ Property property = (Property)modelObject;
xtextObject = EcoreUtil2.getContainerOfType(xtextObject, PropertyRule.class);
- PropertyRule propertyRuleObject = (PropertyRule) xtextObject;
+ PropertyRule propertyRuleObject = (PropertyRule)xtextObject;
// Retrieves the information to be populated in modelObject
- boolean newIsDerived = propertyRuleObject.getIsDerived() != null
- && propertyRuleObject.getIsDerived().equals("/");
+ boolean newIsDerived = propertyRuleObject.getIsDerived() != null && propertyRuleObject.getIsDerived().equals("/");
boolean newIsReadOnly = false;
boolean newIsUnique = false;
boolean newIsUnion = false;
boolean newIsOrdered = false;
List<Property> newRedefines = new ArrayList<Property>();
List<Property> newSubsets = new ArrayList<Property>();
- if (propertyRuleObject.getModifiers() != null) {
- for (ModifierSpecification modifier : propertyRuleObject.getModifiers().getValues()) {
- if (modifier.getRedefines() == null && modifier.getSubsets() == null) {
- switch (modifier.getValue()) {
+ if(propertyRuleObject.getModifiers() != null) {
+ for(ModifierSpecification modifier : propertyRuleObject.getModifiers().getValues()) {
+ if(modifier.getRedefines() == null && modifier.getSubsets() == null) {
+ switch(modifier.getValue()) {
case ORDERED:
newIsOrdered = true;
break;
@@ -90,20 +88,20 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd
}
}
}
- for (ModifierSpecification modifier : propertyRuleObject.getModifiers().getValues()) {
- if (modifier.getRedefines() != null) {
+ for(ModifierSpecification modifier : propertyRuleObject.getModifiers().getValues()) {
+ if(modifier.getRedefines() != null) {
newRedefines.add(modifier.getRedefines().getProperty());
- } else if (modifier.getSubsets() != null) {
+ } else if(modifier.getSubsets() != null) {
newSubsets.add(modifier.getSubsets().getProperty());
}
}
}
int newLowerBound = 1;
int newUpperBound = 1;
- if (propertyRuleObject.getMultiplicity() != null) {
- if (propertyRuleObject.getMultiplicity().getBounds().size() == 1) {
+ if(propertyRuleObject.getMultiplicity() != null) {
+ if(propertyRuleObject.getMultiplicity().getBounds().size() == 1) {
String tempBound = propertyRuleObject.getMultiplicity().getBounds().get(0).getValue();
- if (tempBound.equals("*")) {
+ if(tempBound.equals("*")) {
newLowerBound = 0;
newUpperBound = -1;
} else {
@@ -114,7 +112,7 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd
String tempBound = propertyRuleObject.getMultiplicity().getBounds().get(0).getValue();
newLowerBound = new Integer(tempBound).intValue();
tempBound = propertyRuleObject.getMultiplicity().getBounds().get(1).getValue();
- if (tempBound.equals("*")) {
+ if(tempBound.equals("*")) {
newUpperBound = -1;
} else {
newUpperBound = new Integer(tempBound).intValue();
@@ -123,7 +121,7 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd
}
String newDefault;
- if (propertyRuleObject.getDefault() != null) {
+ if(propertyRuleObject.getDefault() != null) {
newDefault = propertyRuleObject.getDefault().getDefault();
} else {
newDefault = null;
@@ -131,7 +129,7 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd
String newName = ALFIDConverter.IDtoName(propertyRuleObject.getName());
Classifier newType;
TypeRule typeRule = propertyRuleObject.getType();
- if (typeRule == null) {
+ if(typeRule == null) {
newType = null;
} else {
newType = typeRule.getType();
@@ -139,7 +137,7 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd
org.eclipse.uml2.uml.VisibilityKind newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL;
- switch (propertyRuleObject.getVisibility()) {
+ switch(propertyRuleObject.getVisibility()) {
case PUBLIC:
newVisibility = org.eclipse.uml2.uml.VisibilityKind.PUBLIC_LITERAL;
break;
@@ -156,42 +154,34 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd
break;
}
- org.eclipse.gmf.runtime.common.core.command.CompositeCommand updateCommand = new CompositeCommand(
- "Property update");
+ org.eclipse.gmf.runtime.common.core.command.CompositeCommand updateCommand = new CompositeCommand("Property update");
IElementEditService provider = ElementEditServiceUtils.getCommandProvider(property);
- SetRequest setIsDerivedRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_IsDerived(),
- newIsDerived);
+ SetRequest setIsDerivedRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_IsDerived(), newIsDerived);
ICommand setIsDerivedCommand = provider.getEditCommand(setIsDerivedRequest);
updateCommand.add(setIsDerivedCommand);
- SetRequest setIsReadOnlyRequest = new SetRequest(property,
- UMLPackage.eINSTANCE.getStructuralFeature_IsReadOnly(), newIsReadOnly);
+ SetRequest setIsReadOnlyRequest = new SetRequest(property, UMLPackage.eINSTANCE.getStructuralFeature_IsReadOnly(), newIsReadOnly);
ICommand setIsReadOnlyCommand = provider.getEditCommand(setIsReadOnlyRequest);
updateCommand.add(setIsReadOnlyCommand);
- SetRequest setIsUniqueRequest = new SetRequest(property,
- UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique(), newIsUnique);
+ SetRequest setIsUniqueRequest = new SetRequest(property, UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique(), newIsUnique);
ICommand setIsUniqueCommand = provider.getEditCommand(setIsUniqueRequest);
updateCommand.add(setIsUniqueCommand);
- SetRequest setIsDerivedUnionRequest = new SetRequest(property,
- UMLPackage.eINSTANCE.getProperty_IsDerivedUnion(), newIsUnion);
+ SetRequest setIsDerivedUnionRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_IsDerivedUnion(), newIsUnion);
ICommand setIsDerivedUnionCommand = provider.getEditCommand(setIsDerivedUnionRequest);
updateCommand.add(setIsDerivedUnionCommand);
- SetRequest setIsOrderedRequest = new SetRequest(property,
- UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered(), newIsOrdered);
+ SetRequest setIsOrderedRequest = new SetRequest(property, UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered(), newIsOrdered);
ICommand setIsOrderedCommand = provider.getEditCommand(setIsOrderedRequest);
updateCommand.add(setIsOrderedCommand);
- SetRequest setLowerRequest = new SetRequest(property, UMLPackage.eINSTANCE.getMultiplicityElement_Lower(),
- newLowerBound);
+ SetRequest setLowerRequest = new SetRequest(property, UMLPackage.eINSTANCE.getMultiplicityElement_Lower(), newLowerBound);
ICommand setLowerCommand = provider.getEditCommand(setLowerRequest);
updateCommand.add(setLowerCommand);
- SetRequest setUpperRequest = new SetRequest(property, UMLPackage.eINSTANCE.getMultiplicityElement_Upper(),
- newUpperBound);
+ SetRequest setUpperRequest = new SetRequest(property, UMLPackage.eINSTANCE.getMultiplicityElement_Upper(), newUpperBound);
ICommand setUpperCommand = provider.getEditCommand(setUpperRequest);
updateCommand.add(setUpperCommand);
@@ -203,29 +193,25 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd
ICommand setTypeCommand = provider.getEditCommand(setTypeRequest);
updateCommand.add(setTypeCommand);
- SetRequest setVisibilityRequest = new SetRequest(property, UMLPackage.eINSTANCE.getNamedElement_Visibility(),
- newVisibility);
+ SetRequest setVisibilityRequest = new SetRequest(property, UMLPackage.eINSTANCE.getNamedElement_Visibility(), newVisibility);
ICommand setVisibilityCommand = provider.getEditCommand(setVisibilityRequest);
updateCommand.add(setVisibilityCommand);
-
- if (newDefault == null && property.getDefaultValue() != null) {
- DestroyElementRequest destroyDefaultValueRequest = new DestroyElementRequest(property.getDefaultValue(), false) ;
- ICommand destroyDefaultValueCommand = provider.getEditCommand(destroyDefaultValueRequest) ;
+
+ if(newDefault == null && property.getDefaultValue() != null) {
+ DestroyElementRequest destroyDefaultValueRequest = new DestroyElementRequest(property.getDefaultValue(), false);
+ ICommand destroyDefaultValueCommand = provider.getEditCommand(destroyDefaultValueRequest);
updateCommand.add(destroyDefaultValueCommand);
- }
- else {
+ } else {
SetRequest setDefaultValueRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_Default(), newDefault);
ICommand setDefaultValueCommand = provider.getEditCommand(setDefaultValueRequest);
updateCommand.add(setDefaultValueCommand);
}
- SetRequest setRedefinedPropertiesRequest = new SetRequest(property,
- UMLPackage.eINSTANCE.getProperty_RedefinedProperty(), newRedefines);
+ SetRequest setRedefinedPropertiesRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_RedefinedProperty(), newRedefines);
ICommand setRedefinedPropertiesCommand = provider.getEditCommand(setRedefinedPropertiesRequest);
updateCommand.add(setRedefinedPropertiesCommand);
- SetRequest setSubsettedPropertiesRequest = new SetRequest(property,
- UMLPackage.eINSTANCE.getProperty_SubsettedProperty(), newSubsets);
+ SetRequest setSubsettedPropertiesRequest = new SetRequest(property, UMLPackage.eINSTANCE.getProperty_SubsettedProperty(), newSubsets);
ICommand setSubsettedPropertiesCommand = provider.getEditCommand(setSubsettedPropertiesRequest);
updateCommand.add(setSubsettedPropertiesCommand);
return updateCommand;
@@ -241,8 +227,8 @@ public class PropertyXtextDirectEditorConfiguration extends DefaultXtextDirectEd
*/
@Override
public String getTextToEdit(Object editedObject) {
- if (editedObject instanceof Property) {
- return UMLPropertyEditorPropertyUtil.getLabel((Property) editedObject).trim();
+ if(editedObject instanceof Property) {
+ return UMLPropertyEditorPropertyUtil.getLabel((Property)editedObject).trim();
// TODO: default values not supported by the grammar
// TODO: either complete the grammar, or use another label provider
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/UMLPropertyEditorPropertyUtil.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/UMLPropertyEditorPropertyUtil.java
index 7f699c567dc..4db9abc488e 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/UMLPropertyEditorPropertyUtil.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext.ui/src/org/eclipse/papyrus/uml/textedit/property/xtext/ui/contributions/UMLPropertyEditorPropertyUtil.java
@@ -13,12 +13,12 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.textedit.property.xtext.ui.contributions;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CompletionProposalUtils;
import org.eclipse.papyrus.uml.alf.naming.ALFIDConverter;
import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil;
import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
import org.eclipse.papyrus.uml.tools.utils.PropertyUtil;
import org.eclipse.papyrus.uml.tools.utils.TypeUtil;
+import org.eclipse.papyrus.uml.xtext.integration.CompletionProposalUtils;
import org.eclipse.uml2.uml.Property;
public class UMLPropertyEditorPropertyUtil extends PropertyUtil {
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/META-INF/MANIFEST.MF
index cd6fdd92493..5ee10ddbae6 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/META-INF/MANIFEST.MF
@@ -18,7 +18,6 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.emf.mwe.utils;resolution:=optional,
org.eclipse.emf.mwe2.launch;resolution:=optional,
com.ibm.icu;resolution:=optional,
- org.eclipse.xtext.xtend;resolution:=optional,
org.eclipse.xtext.util,
org.eclipse.emf.ecore,
org.eclipse.emf.common,
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/src/org/eclipse/papyrus/uml/textedit/property/xtext/scoping/UmlPropertyScopeProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/src/org/eclipse/papyrus/uml/textedit/property/xtext/scoping/UmlPropertyScopeProvider.java
index 17bc0195cc7..e210aaef8ab 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/src/org/eclipse/papyrus/uml/textedit/property/xtext/scoping/UmlPropertyScopeProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.xtext/src/org/eclipse/papyrus/uml/textedit/property/xtext/scoping/UmlPropertyScopeProvider.java
@@ -14,13 +14,13 @@
package org.eclipse.papyrus.uml.textedit.property.xtext.scoping;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper;
import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.QualifiedName;
import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.RedefinesRule;
import org.eclipse.papyrus.uml.textedit.property.xtext.umlProperty.SubsetsRule;
@@ -60,15 +60,16 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
}
private IScope create___TypeRule_type___Scope(TypeRule ctx) {
- if (ctx.getPath() == null) {
+ if(ctx.getPath() == null) {
EObject contextElement = ContextElementUtil.getContextElement(ctx.eResource());
- Namespace root = (Namespace) EcoreUtil.getRootContainer(contextElement);
+ Namespace root = (Namespace)EcoreUtil.getRootContainer(contextElement);
Iterator<EObject> i = root.eResource().getAllContents();
List<EObject> allContent = new ArrayList<EObject>();
- while (i.hasNext()) {
+ while(i.hasNext()) {
EObject object = i.next();
- if (object instanceof Classifier)
+ if(object instanceof Classifier) {
allContent.add(object);
+ }
}
Iterable<IEObjectDescription> visibleClassifiers = Scopes.scopedElementsFor(allContent);
return new SimpleScope(visibleClassifiers);
@@ -77,17 +78,16 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
// specified,
// retrieves visible elements from this name space
List<Element> tmpVisibleElementsFromPath = new ArrayList<Element>();
- if (ctx.getPath() != null) {
+ if(ctx.getPath() != null) {
QualifiedName qualifiedName = ctx.getPath();
- while (qualifiedName.getRemaining() != null) {
+ while(qualifiedName.getRemaining() != null) {
qualifiedName = qualifiedName.getRemaining();
}
Namespace nearestNamespace = qualifiedName.getPath();
- if (nearestNamespace != null) {
+ if(nearestNamespace != null) {
List<Element> tmpVisiblePropertiesFromPath = new ArrayList<Element>();
- tmpVisiblePropertiesFromPath.addAll(new Visitor_GetOwnedAndImportedClassifiers()
- .visit(nearestNamespace));
- for (Element e : tmpVisiblePropertiesFromPath) {
+ tmpVisiblePropertiesFromPath.addAll(new Visitor_GetOwnedAndImportedClassifiers().visit(nearestNamespace));
+ for(Element e : tmpVisiblePropertiesFromPath) {
tmpVisibleElementsFromPath.add(e);
}
}
@@ -97,14 +97,12 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
SimpleScope resultScope = null;
Iterable<IEObjectDescription> iterableIEobjectDescriptions;
- if (!tmpVisibleElementsFromPath.isEmpty()) {
+ if(!tmpVisibleElementsFromPath.isEmpty()) {
iterableIEobjectDescriptions = Scopes.scopedElementsFor(tmpVisibleElementsFromPath);
- resultScope = resultScope != null ? new SimpleScope(resultScope, iterableIEobjectDescriptions)
- : new SimpleScope(iterableIEobjectDescriptions);
+ resultScope = resultScope != null ? new SimpleScope(resultScope, iterableIEobjectDescriptions) : new SimpleScope(iterableIEobjectDescriptions);
}
- return resultScope != null ? resultScope : new SimpleScope(
- Scopes.scopedElementsFor(new ArrayList<Element>()));
+ return resultScope != null ? resultScope : new SimpleScope(Scopes.scopedElementsFor(new ArrayList<Element>()));
}
}
@@ -115,12 +113,12 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
*/
public IScope scope_QualifiedName_path(QualifiedName ctx, EReference ref) {
List<Namespace> visibleNamespaces = new ArrayList<Namespace>();
- if (ctx != null && ctx.eContainer() != null && ctx.eContainer() instanceof QualifiedName) {
- Namespace parentNameSpace = ((QualifiedName) ctx.eContainer()).getPath();
+ if(ctx != null && ctx.eContainer() != null && ctx.eContainer() instanceof QualifiedName) {
+ Namespace parentNameSpace = ((QualifiedName)ctx.eContainer()).getPath();
visibleNamespaces.addAll(new Visitor_GetOwnedNamespacesAndImportedNamespaces().visit(parentNameSpace));
} else {
EObject contextElement = ContextElementUtil.getContextElement(ctx.eResource());
- Namespace root = (Namespace) EcoreUtil.getRootContainer(contextElement);
+ Namespace root = (Namespace)EcoreUtil.getRootContainer(contextElement);
visibleNamespaces.add(root);
visibleNamespaces.addAll(new Visitor_GetOwnedNamespacesAndImportedNamespaces().visit(root));
}
@@ -129,16 +127,18 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
}
private class Visitor_GetImportedNamespaces {
+
public List<Namespace> visit(Namespace visited) {
List<Namespace> namespaces = new ArrayList<Namespace>();
// retrieves imported namespaces
- for (PackageImport pImport : visited.getPackageImports()) {
+ for(PackageImport pImport : visited.getPackageImports()) {
namespaces.add(pImport.getImportedPackage());
}
- for (ElementImport eImport : visited.getElementImports()) {
- if (eImport.getImportedElement() instanceof Namespace)
- namespaces.add((Namespace) eImport.getImportedElement());
+ for(ElementImport eImport : visited.getElementImports()) {
+ if(eImport.getImportedElement() instanceof Namespace) {
+ namespaces.add((Namespace)eImport.getImportedElement());
+ }
}
return namespaces;
@@ -146,15 +146,17 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
}
private class Visitor_GetOwnedNamespacesAndImportedNamespaces extends Visitor_GetImportedNamespaces {
+
@Override
public List<Namespace> visit(Namespace visited) {
List<Namespace> namespaces = new ArrayList<Namespace>();
// first retrieves imported namespaces
namespaces.addAll(super.visit(visited));
// then retrieves owned namespaces
- for (NamedElement n : visited.getOwnedMembers()) {
- if (n instanceof Namespace)
- namespaces.add((Namespace) n);
+ for(NamedElement n : visited.getOwnedMembers()) {
+ if(n instanceof Namespace) {
+ namespaces.add((Namespace)n);
+ }
}
return namespaces;
}
@@ -165,14 +167,16 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
public List<Element> visit(Namespace visited) {
List<Element> visibleElements = new ArrayList<Element>();
// first retrieves imported properties
- for (ElementImport eImport : visited.getElementImports()) {
- if (eImport.getImportedElement() instanceof Classifier)
+ for(ElementImport eImport : visited.getElementImports()) {
+ if(eImport.getImportedElement() instanceof Classifier) {
visibleElements.add(eImport.getImportedElement());
+ }
}
// then retrieves owned properties
- for (NamedElement n : visited.getOwnedMembers()) {
- if (n instanceof Classifier)
+ for(NamedElement n : visited.getOwnedMembers()) {
+ if(n instanceof Classifier) {
visibleElements.add(n);
+ }
}
return visibleElements;
@@ -188,8 +192,7 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
* @return
*/
public IScope scope_RedefinesRule_property(RedefinesRule ctx, EReference ref) {
- Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes
- .scopedElementsFor(retrieveInheritedProperties());
+ Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(retrieveInheritedProperties(ctx));
return new SimpleScope(iterableIEobjectDescription);
}
@@ -201,21 +204,29 @@ public class UmlPropertyScopeProvider extends AbstractDeclarativeScopeProvider {
* @return
*/
public IScope scope_SubsetsRule_property(SubsetsRule ctx, EReference ref) {
- Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes
- .scopedElementsFor(retrieveInheritedProperties());
+ Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(retrieveInheritedProperties(ctx));
return new SimpleScope(iterableIEobjectDescription);
}
- //TODO
- public static List<Property> retrieveInheritedProperties() {
- Property editedProperty = (Property) PopupXtextEditorHelper.context;
- if (editedProperty == null)
- return null;
- Classifier owner = (Classifier) editedProperty.getNamespace();
+
+ public static List<Property> retrieveInheritedProperties(EObject model) {
+ if(model == null) {
+ return Collections.emptyList();
+ }
+
+ EObject editionContext = ContextElementUtil.getContextElement(model.eResource());
+ if(!(editionContext instanceof Property)) {
+ return Collections.emptyList();
+ }
+
+ Property editedProperty = (Property)editionContext;
+
+ Classifier owner = (Classifier)editedProperty.getNamespace();
List<Property> inheritedProperties = new ArrayList<Property>();
- for (Classifier parent : owner.getGenerals()) {
- for (Property p : parent.getAllAttributes()) {
- if (!inheritedProperties.contains(p))
+ for(Classifier parent : owner.getGenerals()) {
+ for(Property p : parent.getAllAttributes()) {
+ if(!inheritedProperties.contains(p)) {
;
+ }
inheritedProperties.add(p);
}
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF
index 8f87ecb3643..1657c21b647 100755
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext.ui/META-INF/MANIFEST.MF
@@ -19,7 +19,6 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.state.xtext;bundle-version="1.0
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.4.0",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF
index 792676642b1..c12c6eb5d68 100755
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/META-INF/MANIFEST.MF
@@ -25,7 +25,6 @@ Require-Bundle: org.eclipse.xtext,
org.antlr.runtime,
org.eclipse.uml2.uml;bundle-version="3.1.0",
org.eclipse.uml2.codegen.ecore;bundle-version="1.6.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.uml.alf.common;bundle-version="1.0.0",
org.eclipse.papyrus.uml.xtext.integration.core;bundle-version="1.0.0"
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java
index bddf7eac0f9..b27e862d4f7 100755
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/validation/UmlStateJavaValidator.java
@@ -17,7 +17,6 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper;
import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.BehaviorKind;
import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.DoRule;
import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.EntryRule;
@@ -32,253 +31,203 @@ import org.eclipse.uml2.uml.OpaqueBehavior;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.Vertex;
import org.eclipse.xtext.validation.Check;
-
+
public class UmlStateJavaValidator extends AbstractUmlStateJavaValidator {
/**
* First checks if the new name being attributed to the edited state is already used by another state in the region.
- * Then, notifies (via warning) any of the potential Behavior deletion implied by the textual specification
+ * Then, notifies (via warning) any of the potential Behavior deletion implied by the textual specification
* (either DoActivity, Enty, or Exit behaviors)
*
* @param stateRule
*/
@Check
- public void checkStateName (StateRule stateRule) {
- if (PopupXtextEditorHelper.context == null)
- return ;
-
- if (stateRule.getName() == null || stateRule.getName().equals(""))
- return ;
-
+ public void checkStateName(StateRule stateRule) {
+ if(stateRule.getName() == null || stateRule.getName().equals("")) {
+ return;
+ }
+
//
// first, checks if the new name of the State is already used by another state in the region
//
- org.eclipse.uml2.uml.State editedState = (org.eclipse.uml2.uml.State) PopupXtextEditorHelper.context ;
- List<String> alreadyUsedNames = new ArrayList<String>() ;
-
- for (Vertex v : editedState.getContainer().getSubvertices()) {
- if (v instanceof org.eclipse.uml2.uml.State) {
- org.eclipse.uml2.uml.State s = (org.eclipse.uml2.uml.State) v ;
- if (s != editedState) {
- alreadyUsedNames.add("" + s.getName()) ;
+ org.eclipse.uml2.uml.State editedState = (org.eclipse.uml2.uml.State)ContextElementUtil.getContextElement(stateRule.eResource());
+ List<String> alreadyUsedNames = new ArrayList<String>();
+
+ for(Vertex v : editedState.getContainer().getSubvertices()) {
+ if(v instanceof org.eclipse.uml2.uml.State) {
+ org.eclipse.uml2.uml.State s = (org.eclipse.uml2.uml.State)v;
+ if(s != editedState) {
+ alreadyUsedNames.add("" + s.getName());
}
}
}
-
- String newName = "" + stateRule.getName() ;
-
- if (alreadyUsedNames.contains("" + newName))
- warning("Name " + newName + " is already used by another State in this Region", UmlStatePackage.eINSTANCE.getStateRule_Name()) ;
-
-
+
+ String newName = "" + stateRule.getName();
+
+ if(alreadyUsedNames.contains("" + newName)) {
+ warning("Name " + newName + " is already used by another State in this Region", UmlStatePackage.eINSTANCE.getStateRule_Name());
+ }
+
+
// Check if ConnectionPointReference exist when one delete the submachine reference: not allowed!
- if((stateRule.getSubmachine() == null) && !editedState.getConnections().isEmpty()){
- error(getErrorMessageForSubmachineState(), UmlStatePackage.eINSTANCE.getStateRule_Submachine()) ;
+ if((stateRule.getSubmachine() == null) && !editedState.getConnections().isEmpty()) {
+ error(getErrorMessageForSubmachineState(), UmlStatePackage.eINSTANCE.getStateRule_Submachine());
}
//
// Then, checks if the textual specification implies deletion of the DoActivity, Entry or Exit behavior
// and raises warnings accordingly
//
-
- boolean deletionOfDoActivity = editedState.getDoActivity()!=null && stateRule.getDo()==null ;
- boolean deletionOfExit = editedState.getExit()!=null && stateRule.getExit()==null ;
- boolean deletionOfEntry = editedState.getEntry()!=null && stateRule.getEntry()==null;
-
- if (deletionOfDoActivity) {
- warning(getBehaviorKindAsString(
- getBehaviorKind(editedState.getDoActivity())
- )
- + " "
- + editedState.getDoActivity().getName()
- + " will be deleted", UmlStatePackage.eINSTANCE.getStateRule_Name()) ;
+
+ boolean deletionOfDoActivity = editedState.getDoActivity() != null && stateRule.getDo() == null;
+ boolean deletionOfExit = editedState.getExit() != null && stateRule.getExit() == null;
+ boolean deletionOfEntry = editedState.getEntry() != null && stateRule.getEntry() == null;
+
+ if(deletionOfDoActivity) {
+ warning(getBehaviorKindAsString(getBehaviorKind(editedState.getDoActivity())) + " " + editedState.getDoActivity().getName() + " will be deleted", UmlStatePackage.eINSTANCE.getStateRule_Name());
}
-
- if (deletionOfExit) {
- warning(getBehaviorKindAsString(
- getBehaviorKind(editedState.getExit())
- )
- + " "
- + editedState.getExit().getName()
- + " will be deleted", UmlStatePackage.eINSTANCE.getStateRule_Name()) ;
+
+ if(deletionOfExit) {
+ warning(getBehaviorKindAsString(getBehaviorKind(editedState.getExit())) + " " + editedState.getExit().getName() + " will be deleted", UmlStatePackage.eINSTANCE.getStateRule_Name());
}
-
- if (deletionOfEntry) {
- warning(getBehaviorKindAsString(
- getBehaviorKind(editedState.getEntry())
- )
- + " "
- + editedState.getEntry().getName()
- + " will be deleted", UmlStatePackage.eINSTANCE.getStateRule_Name()) ;
+
+ if(deletionOfEntry) {
+ warning(getBehaviorKindAsString(getBehaviorKind(editedState.getEntry())) + " " + editedState.getEntry().getName() + " will be deleted", UmlStatePackage.eINSTANCE.getStateRule_Name());
}
}
-
+
/**
- * Notifies (via a Warning) the potential impact of changing the kind (i.e., Activity, StateMachine or OpaqueBehavior)
+ * Notifies (via a Warning) the potential impact of changing the kind (i.e., Activity, StateMachine or OpaqueBehavior)
* of the DoActivity behavior.
*
* @param doRule
*/
@Check
- public void checkDoRule (DoRule doRule) {
- if (PopupXtextEditorHelper.context == null)
- return ;
- if (doRule.getKind() == null)
- return ;
- if (doRule.getBehaviorName() == null || doRule.getBehaviorName().equals(""))
- return ;
-
- org.eclipse.uml2.uml.State editedState = (org.eclipse.uml2.uml.State) PopupXtextEditorHelper.context ;
- BehaviorKind oldDoKind = getBehaviorKind(editedState.getDoActivity()) ;
- BehaviorKind newDoKind = doRule.getKind() ;
- if (oldDoKind != null) {
- if (oldDoKind != newDoKind) {
- warning("Changing the kind of "
- + doRule.getBehaviorName()
- + " from <<"
- + getBehaviorKindAsString(oldDoKind)
- + ">> to <<"
- + getBehaviorKindAsString(newDoKind)
- + ">> will cause the deletion of "
- + getBehaviorKindAsString(oldDoKind)
- + " "
- + doRule.getBehaviorName()
- + ". Any changes made to "
- + getBehaviorKindAsString(oldDoKind)
- + " "
- + doRule.getBehaviorName()
- + " will be lost", UmlStatePackage.eINSTANCE.getDoRule_Kind()) ;
+ public void checkDoRule(DoRule doRule) {
+ if(doRule.getKind() == null) {
+ return;
+ }
+ if(doRule.getBehaviorName() == null || doRule.getBehaviorName().equals("")) {
+ return;
+ }
+
+ org.eclipse.uml2.uml.State editedState = (org.eclipse.uml2.uml.State)ContextElementUtil.getContextElement(doRule.eResource());
+ BehaviorKind oldDoKind = getBehaviorKind(editedState.getDoActivity());
+ BehaviorKind newDoKind = doRule.getKind();
+ if(oldDoKind != null) {
+ if(oldDoKind != newDoKind) {
+ warning("Changing the kind of " + doRule.getBehaviorName() + " from <<" + getBehaviorKindAsString(oldDoKind) + ">> to <<" + getBehaviorKindAsString(newDoKind) + ">> will cause the deletion of " + getBehaviorKindAsString(oldDoKind) + " " + doRule.getBehaviorName() + ". Any changes made to " + getBehaviorKindAsString(oldDoKind) + " " + doRule.getBehaviorName() + " will be lost", UmlStatePackage.eINSTANCE.getDoRule_Kind());
}
}
}
-
+
/**
- * Notifies (via a Warning) the potential impact of changing the kind (i.e., Activity, StateMachine or OpaqueBehavior)
+ * Notifies (via a Warning) the potential impact of changing the kind (i.e., Activity, StateMachine or OpaqueBehavior)
* of the Entry behavior.
*
* @param entryRule
*/
@Check
- public void checkEntryRule (EntryRule entryRule) {
- if (PopupXtextEditorHelper.context == null)
- return ;
- if (entryRule.getKind() == null)
- return ;
- if (entryRule.getBehaviorName() == null || entryRule.getBehaviorName().equals(""))
- return ;
-
- org.eclipse.uml2.uml.State editedState = (org.eclipse.uml2.uml.State) PopupXtextEditorHelper.context ;
- BehaviorKind oldDoKind = getBehaviorKind(editedState.getEntry()) ;
- BehaviorKind newDoKind = entryRule.getKind() ;
- if (oldDoKind != null) {
- if (oldDoKind != newDoKind) {
- warning("Changing the kind of "
- + entryRule.getBehaviorName()
- + " from <<"
- + getBehaviorKindAsString(oldDoKind)
- + ">> to <<"
- + getBehaviorKindAsString(newDoKind)
- + ">> will cause the deletion of "
- + getBehaviorKindAsString(oldDoKind)
- + " "
- + entryRule.getBehaviorName()
- + ". Any changes made to "
- + getBehaviorKindAsString(oldDoKind)
- + " "
- + entryRule.getBehaviorName()
- + " will be lost", UmlStatePackage.eINSTANCE.getEntryRule_Kind()) ;
+ public void checkEntryRule(EntryRule entryRule) {
+ if(entryRule.getKind() == null) {
+ return;
+ }
+ if(entryRule.getBehaviorName() == null || entryRule.getBehaviorName().equals("")) {
+ return;
+ }
+
+ org.eclipse.uml2.uml.State editedState = (org.eclipse.uml2.uml.State)ContextElementUtil.getContextElement(entryRule.eResource());
+ BehaviorKind oldDoKind = getBehaviorKind(editedState.getEntry());
+ BehaviorKind newDoKind = entryRule.getKind();
+ if(oldDoKind != null) {
+ if(oldDoKind != newDoKind) {
+ warning("Changing the kind of " + entryRule.getBehaviorName() + " from <<" + getBehaviorKindAsString(oldDoKind) + ">> to <<" + getBehaviorKindAsString(newDoKind) + ">> will cause the deletion of " + getBehaviorKindAsString(oldDoKind) + " " + entryRule.getBehaviorName() + ". Any changes made to " + getBehaviorKindAsString(oldDoKind) + " " + entryRule.getBehaviorName() + " will be lost", UmlStatePackage.eINSTANCE.getEntryRule_Kind());
}
}
}
-
+
/**
- * Notifies (via a Warning) the potential impact of changing the kind (i.e., Activity, StateMachine or OpaqueBehavior)
+ * Notifies (via a Warning) the potential impact of changing the kind (i.e., Activity, StateMachine or OpaqueBehavior)
* of the Entry behavior.
*
* @param exitRule
*/
@Check
- public void checkExitRule (ExitRule exitRule) {
- if (PopupXtextEditorHelper.context == null)
- return ;
- if (exitRule.getKind() == null)
- return ;
- if (exitRule.getBehaviorName() == null || exitRule.getBehaviorName().equals(""))
- return ;
-
- org.eclipse.uml2.uml.State editedState = (org.eclipse.uml2.uml.State) PopupXtextEditorHelper.context ;
- BehaviorKind oldDoKind = getBehaviorKind(editedState.getExit()) ;
- BehaviorKind newDoKind = exitRule.getKind() ;
- if (oldDoKind != null) {
- if (oldDoKind != newDoKind) {
- warning("Changing the kind of "
- + exitRule.getBehaviorName()
- + " from <<"
- + getBehaviorKindAsString(oldDoKind)
- + ">> to <<"
- + getBehaviorKindAsString(newDoKind)
- + ">> will cause the deletion of "
- + getBehaviorKindAsString(oldDoKind)
- + " "
- + exitRule.getBehaviorName()
- + ". Any changes made to "
- + getBehaviorKindAsString(oldDoKind)
- + " "
- + exitRule.getBehaviorName()
- + " will be lost", UmlStatePackage.eINSTANCE.getExitRule_Kind()) ;
+ public void checkExitRule(ExitRule exitRule) {
+ if(exitRule.getKind() == null) {
+ return;
+ }
+ if(exitRule.getBehaviorName() == null || exitRule.getBehaviorName().equals("")) {
+ return;
+ }
+
+ org.eclipse.uml2.uml.State editedState = (org.eclipse.uml2.uml.State)ContextElementUtil.getContextElement(exitRule.eResource());
+ BehaviorKind oldDoKind = getBehaviorKind(editedState.getExit());
+ BehaviorKind newDoKind = exitRule.getKind();
+ if(oldDoKind != null) {
+ if(oldDoKind != newDoKind) {
+ warning("Changing the kind of " + exitRule.getBehaviorName() + " from <<" + getBehaviorKindAsString(oldDoKind) + ">> to <<" + getBehaviorKindAsString(newDoKind) + ">> will cause the deletion of " + getBehaviorKindAsString(oldDoKind) + " " + exitRule.getBehaviorName() + ". Any changes made to " + getBehaviorKindAsString(oldDoKind) + " " + exitRule.getBehaviorName() + " will be lost", UmlStatePackage.eINSTANCE.getExitRule_Kind());
}
}
}
-
+
@Check
public void checkSubmachineRule(SubmachineRule rule) {
EObject contextElement = ContextElementUtil.getContextElement(rule.eResource());
- if (contextElement == null || ! (contextElement instanceof org.eclipse.uml2.uml.State))
- return ;
- org.eclipse.uml2.uml.State contextState = (org.eclipse.uml2.uml.State)contextElement ;
- if (contextState.isOrthogonal()) {
- error(getErrorMessageForOrthogonalState(), UmlStatePackage.eINSTANCE.getSubmachineRule_Submachine()) ;
+ if(contextElement == null || !(contextElement instanceof org.eclipse.uml2.uml.State)) {
+ return;
+ }
+ org.eclipse.uml2.uml.State contextState = (org.eclipse.uml2.uml.State)contextElement;
+ if(contextState.isOrthogonal()) {
+ error(getErrorMessageForOrthogonalState(), UmlStatePackage.eINSTANCE.getSubmachineRule_Submachine());
}
- if (contextState.isComposite()) {
- error(getErrorMessageForCompositeState(), UmlStatePackage.eINSTANCE.getSubmachineRule_Submachine()) ;
+ if(contextState.isComposite()) {
+ error(getErrorMessageForCompositeState(), UmlStatePackage.eINSTANCE.getSubmachineRule_Submachine());
}
}
-
+
//*****************//
// Utility methods //
//*****************//
-
+
private String getErrorMessageForOrthogonalState() {
- return "An orthogonal state cannot reference a submachine." ;
+ return "An orthogonal state cannot reference a submachine.";
}
-
+
private String getErrorMessageForCompositeState() {
- return "A composite state cannot reference a submachine." ;
+ return "A composite state cannot reference a submachine.";
}
private String getErrorMessageForSubmachineState() {
- return "A simple state cannot have ConnectionPointReferences. You should delete them before removing the reference to the submachine." ;
+ return "A simple state cannot have ConnectionPointReferences. You should delete them before removing the reference to the submachine.";
}
private static BehaviorKind getBehaviorKind(Behavior behavior) {
- if (behavior == null)
- return null ;
- if (behavior instanceof Activity)
- return BehaviorKind.ACTIVITY ;
- if (behavior instanceof OpaqueBehavior)
- return BehaviorKind.OPAQUE_BEHAVIOR ;
- if (behavior instanceof StateMachine)
- return BehaviorKind.STATE_MACHINE ;
- return null ;
+ if(behavior == null) {
+ return null;
+ }
+ if(behavior instanceof Activity) {
+ return BehaviorKind.ACTIVITY;
+ }
+ if(behavior instanceof OpaqueBehavior) {
+ return BehaviorKind.OPAQUE_BEHAVIOR;
+ }
+ if(behavior instanceof StateMachine) {
+ return BehaviorKind.STATE_MACHINE;
+ }
+ return null;
}
-
+
private static String getBehaviorKindAsString(BehaviorKind behaviorKind) {
- if (behaviorKind == BehaviorKind.ACTIVITY)
- return "Activity" ;
- if (behaviorKind == BehaviorKind.OPAQUE_BEHAVIOR)
- return "OpaqueBehavior" ;
- if (behaviorKind == BehaviorKind.STATE_MACHINE)
- return "StateMachine" ;
- return "" ;
+ if(behaviorKind == BehaviorKind.ACTIVITY) {
+ return "Activity";
+ }
+ if(behaviorKind == BehaviorKind.OPAQUE_BEHAVIOR) {
+ return "OpaqueBehavior";
+ }
+ if(behaviorKind == BehaviorKind.STATE_MACHINE) {
+ return "StateMachine";
+ }
+ return "";
}
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/plugin.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/plugin.xml
index 240966dccd7..59ddce5aa71 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/plugin.xml
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/plugin.xml
@@ -234,7 +234,7 @@
language="Advanced Property Textual Editor"
objectToEdit="org.eclipse.papyrus.uml.profile.structure.AppliedStereotypeProperty">
<popupeditor
- editorConfiguration="org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui.contributions.StereotypePropertyPopupEditorConfigurationContribution">
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui.contributions.StereotypePropertyEditorConfigurationContribution">
</popupeditor>
</DirectEditor>
</extension>
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/StringConstants.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/StringConstants.java
new file mode 100644
index 00000000000..3354903f0fd
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/StringConstants.java
@@ -0,0 +1,20 @@
+package org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui;
+
+public class StringConstants {
+
+ public static final String BOOLEAN = "Boolean"; //$NON-NLS-1$
+ public static final String DATA_TYPE = "DataType"; //$NON-NLS-1$
+ public static final String INTEGER = "Integer"; //$NON-NLS-1$
+ public static final String PRIMITIVE_TYPE = "PrimitiveType"; //$NON-NLS-1$
+ public static final String STEREOTYPE = "Stereotype"; //$NON-NLS-1$
+ public static final String STRING = "String"; //$NON-NLS-1$
+ public static final String COMMA = ","; //$NON-NLS-1$
+ public static final String CURLY_CLOSE = "}"; //$NON-NLS-1$
+ public static final String CURLY_OPEN = "{"; //$NON-NLS-1$
+ public static final String EMPTY = ""; //$NON-NLS-1$
+ public static final String EQUALS = "="; //$NON-NLS-1$
+ public static final String NULL = "null"; //$NON-NLS-1$
+ public static final String FALSE = "false";
+ public static final String TRUE = "true";
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contentassist/AppliedStereotypePropertyProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contentassist/AppliedStereotypePropertyProposalProvider.java
index f4f370a5dd9..eafdd53098c 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contentassist/AppliedStereotypePropertyProposalProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contentassist/AppliedStereotypePropertyProposalProvider.java
@@ -23,13 +23,13 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gef.EditPart;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CompletionProposalUtils;
import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper;
import org.eclipse.papyrus.infra.widgets.providers.HierarchicToFlatContentProvider;
import org.eclipse.papyrus.uml.profile.structure.AppliedStereotypeProperty;
import org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.appliedStereotypeProperty.ExpressionValueRule;
+import org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui.StringConstants;
import org.eclipse.papyrus.uml.tools.providers.UMLContentProvider;
-import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
+import org.eclipse.papyrus.uml.xtext.integration.CompletionProposalUtils;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.util.UMLUtil;
import org.eclipse.xtext.Assignment;
@@ -69,7 +69,7 @@ public class AppliedStereotypePropertyProposalProvider extends AbstractAppliedSt
UMLContentProvider umlContentProvider = new UMLContentProvider(appliedStereotypeProperty.getStereotypeApplication(), foundStructuralFeature, appliedStereotypeProperty.getStereotype());
HierarchicToFlatContentProvider treeToFlatContentProvider = new HierarchicToFlatContentProvider(umlContentProvider);
Object[] result = treeToFlatContentProvider.getElements();
- UMLLabelProvider umlLabelProvider = new UMLLabelProvider();
+ // UMLLabelProvider umlLabelProvider = new UMLLabelProvider();
for(int i = 0; i < result.length; i++) {
if(result[i] instanceof EObject && UMLUtil.getBaseElement((EObject)result[i]) != null) {
acceptor.accept(CompletionProposalUtils.createCompletionProposal(((NamedElement)UMLUtil.getBaseElement((EObject)result[i])), ((NamedElement)UMLUtil.getBaseElement((EObject)result[i])).getQualifiedName(), ((NamedElement)UMLUtil.getBaseElement((EObject)result[i])).getQualifiedName(), context));
@@ -100,15 +100,11 @@ public class AppliedStereotypePropertyProposalProvider extends AbstractAppliedSt
public void completeBooleanKeyWord(Keyword keyword, ContentAssistContext contentAssistContext, ICompletionProposalAcceptor acceptor, AppliedStereotypeProperty appliedStereotypeProperty) {
- if(appliedStereotypeProperty.getStereotypeProperty().getType().getName().equals("Boolean")) {
- String TRUE = "true";
- String FALSE = "false";
- if(keyword.getValue().startsWith(TRUE) || (keyword.getValue().startsWith(FALSE))) {
+ if(appliedStereotypeProperty.getStereotypeProperty().getType().getName().equals(StringConstants.BOOLEAN)) {
+ if(keyword.getValue().startsWith(StringConstants.TRUE) || (keyword.getValue().startsWith(StringConstants.FALSE))) {
addKeyWord(keyword, contentAssistContext, acceptor);
}
}
-
-
}
@@ -123,7 +119,7 @@ public class AppliedStereotypePropertyProposalProvider extends AbstractAppliedSt
@Override
public void completeKeyword(Keyword keyword, ContentAssistContext contentAssistContext, ICompletionProposalAcceptor acceptor) {
- if(!contentAssistContext.getPrefix().equals("") && !contentAssistContext.getPrefix().equals("=")) {
+ if(!contentAssistContext.getPrefix().equals(StringConstants.EMPTY) && !contentAssistContext.getPrefix().equals(StringConstants.EQUALS)) {
if(keyword.getValue().startsWith(contentAssistContext.getPrefix()))
super.completeKeyword(keyword, contentAssistContext, acceptor);
} else {
@@ -134,18 +130,18 @@ public class AppliedStereotypePropertyProposalProvider extends AbstractAppliedSt
completeBooleanKeyWord(keyword, contentAssistContext, acceptor, appliedStereotypeProperty);
//collection
if(appliedStereotypeProperty.getStereotypeProperty().getUpper() == -1 || appliedStereotypeProperty.getStereotypeProperty().getUpper() > 1) {
- if(keyword.getValue().startsWith("}") || keyword.getValue().startsWith("{") || keyword.getValue().startsWith(",") || keyword.getValue().startsWith("null") || keyword.getValue().startsWith(",")) {
+ if(keyword.getValue().startsWith(StringConstants.CURLY_CLOSE) || keyword.getValue().startsWith(StringConstants.CURLY_OPEN) || keyword.getValue().startsWith(StringConstants.COMMA) || keyword.getValue().startsWith(StringConstants.NULL) || keyword.getValue().startsWith(StringConstants.COMMA)) {
addKeyWord(keyword, contentAssistContext, acceptor);
}
}
if(appliedStereotypeProperty.getStereotypeProperty().getUpper() == 1) {
- if(keyword.getValue().startsWith("null")) {
+ if(keyword.getValue().startsWith(StringConstants.NULL)) {
addKeyWord(keyword, contentAssistContext, acceptor);
}
}
- if(appliedStereotypeProperty.getStereotypeProperty().getType().eClass().getName().equals("PrimitiveType")) {
- if(keyword.getValue().startsWith("\"")) {
+ if(appliedStereotypeProperty.getStereotypeProperty().getType().eClass().getName().equals(StringConstants.PRIMITIVE_TYPE)) {
+ if(keyword.getValue().startsWith("\"")) { //$NON-NLS-1$
addKeyWord(keyword, contentAssistContext, acceptor);
}
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contributions/StereotypePropertyPopupEditorConfigurationContribution.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contributions/StereotypePropertyEditorConfigurationContribution.java
index a5cbe83f876..a165cf88912 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contributions/StereotypePropertyPopupEditorConfigurationContribution.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui/src/org/eclipse/papyrus/uml/textedit/stereotypeproperty/xtext/ui/contributions/StereotypePropertyEditorConfigurationContribution.java
@@ -35,6 +35,7 @@ import org.eclipse.papyrus.uml.alf.alf.NameExpression;
import org.eclipse.papyrus.uml.alf.alf.STRING_LITERAL;
import org.eclipse.papyrus.uml.profile.structure.AppliedStereotypeProperty;
import org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.AppliedStereotypePropertyEditorUtil;
+import org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui.StringConstants;
import org.eclipse.papyrus.uml.textedit.stereotypeproperty.xtext.ui.internal.AppliedStereotypePropertyActivator;
import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.uml2.uml.Element;
@@ -42,7 +43,7 @@ import org.eclipse.uml2.uml.Enumeration;
import com.google.inject.Injector;
-public class StereotypePropertyPopupEditorConfigurationContribution extends DefaultXtextDirectEditorConfiguration {
+public class StereotypePropertyEditorConfigurationContribution extends DefaultXtextDirectEditorConfiguration {
@Override
public Injector getInjector() {
@@ -54,32 +55,32 @@ public class StereotypePropertyPopupEditorConfigurationContribution extends Defa
@Override
protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
- CompositeCommand command = new CompositeCommand("");
+ CompositeCommand command = new CompositeCommand(""); //$NON-NLS-1$
final AppliedStereotypeProperty appliedStereotypeProperty = (AppliedStereotypeProperty) umlObject;
Object[] result = AppliedStereotypePropertyEditorUtil.getPossibleElements(appliedStereotypeProperty);
// ref element stereotype application
- if (appliedStereotypeProperty.getStereotypeProperty().getType().eClass().getName().equals("Stereotype")) {
+ if (appliedStereotypeProperty.getStereotypeProperty().getType().eClass().getName().equals(StringConstants.STEREOTYPE)) {
command.add(reconcileRefToStereotypeApp(appliedStereotypeProperty, xtextObject, result));
}
// int
- if (appliedStereotypeProperty.getStereotypeProperty().getType().getName().equals("Integer")) {
+ if (appliedStereotypeProperty.getStereotypeProperty().getType().getName().equals(StringConstants.INTEGER)) {
command.add(reconcileInteger(appliedStereotypeProperty, xtextObject));
}
// boolean
- if (appliedStereotypeProperty.getStereotypeProperty().getType().getName().equals("Boolean")) {
+ if (appliedStereotypeProperty.getStereotypeProperty().getType().getName().equals(StringConstants.BOOLEAN)) {
command.add(reconcileBoolean(appliedStereotypeProperty, xtextObject));
}
// string
- if (appliedStereotypeProperty.getStereotypeProperty().getType().getName().equals("String")) {
+ if (appliedStereotypeProperty.getStereotypeProperty().getType().getName().equals(StringConstants.STRING)) {
command.add(reconcileString(appliedStereotypeProperty, xtextObject));
}
// dataType
- if (appliedStereotypeProperty.getStereotypeProperty().getType().eClass().getName().equals("DataType")) {
+ if (appliedStereotypeProperty.getStereotypeProperty().getType().eClass().getName().equals(StringConstants.DATA_TYPE)) {
command.add(reconcileString(appliedStereotypeProperty, xtextObject));
}
// primitiveType
- if (appliedStereotypeProperty.getStereotypeProperty().getType().eClass().getName().equals("PrimitiveType")) {
+ if (appliedStereotypeProperty.getStereotypeProperty().getType().eClass().getName().equals(StringConstants.PRIMITIVE_TYPE)) {
command.add(reconcileString(appliedStereotypeProperty, xtextObject));
}
if (appliedStereotypeProperty.getStereotypeProperty().getType() instanceof Enumeration) {
@@ -137,7 +138,7 @@ public class StereotypePropertyPopupEditorConfigurationContribution extends Defa
// cardinality *
else {
if (eObjects.size() == 0) {
- return createUpdateCommand(appliedStereotypeProperty, new ArrayList());
+ return createUpdateCommand(appliedStereotypeProperty, new ArrayList<Object>());
} else {
// iterate on NameExpression
ArrayList<Object> stereotypeApplicationList = new ArrayList<Object>();
@@ -389,7 +390,7 @@ public class StereotypePropertyPopupEditorConfigurationContribution extends Defa
protected ICommand createUpdateCommand(final AppliedStereotypeProperty appliedStereotypeProperty, final Object value) {
AbstractTransactionalCommand setValueCommand = new AbstractTransactionalCommand(
- TransactionUtil.getEditingDomain(appliedStereotypeProperty), "", Collections.EMPTY_LIST) {
+ TransactionUtil.getEditingDomain(appliedStereotypeProperty), "", Collections.EMPTY_LIST) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
@@ -430,7 +431,7 @@ public class StereotypePropertyPopupEditorConfigurationContribution extends Defa
// TODO: default values not supported by the grammar
// TODO: either complete the grammar, or use another label provider
}
- return "<UNDEFINED>";
+ return "<UNDEFINED>"; //$NON-NLS-1$
}
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/META-INF/MANIFEST.MF
index 14a80d36460..8d453b83e50 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/META-INF/MANIFEST.MF
@@ -25,11 +25,12 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.transition.xtext;bundle-version
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.4.0",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
org.eclipse.core.expressions;bundle-version="3.4.200",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
org.eclipse.papyrus.uml.alf.common.ui;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
@@ -37,5 +38,4 @@ Bundle-Activator: org.eclipse.papyrus.uml.textedit.transition.xtext.ui
.internal.UmlTransitionActivator
Bundle-SymbolicName: org.eclipse.papyrus.uml.textedit.transition.xtext
.ui;singleton:=true
-Import-Package: org.apache.log4j
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/plugin.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/plugin.xml
index e1d27832ee2..7c211d86c08 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/plugin.xml
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/plugin.xml
@@ -201,7 +201,7 @@
language="Advanced transition textual editor"
objectToEdit="org.eclipse.uml2.uml.Transition">
<popupeditor
- editorConfiguration="org.eclipse.papyrus.uml.textedit.transition.xtext.ui.contributions.TransitionPopupEditorConfigurationContribution">
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.transition.xtext.ui.contributions.TransitionEditorConfigurationContribution">
</popupeditor>
</DirectEditor>
</extension>
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contentassist/UmlTransitionProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contentassist/UmlTransitionProposalProvider.java
index 2bb74e4be83..c1d7137c58d 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contentassist/UmlTransitionProposalProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contentassist/UmlTransitionProposalProvider.java
@@ -1,6 +1,6 @@
/*
-* generated by Xtext
-*/
+ * generated by Xtext
+ */
package org.eclipse.papyrus.uml.textedit.transition.xtext.ui.contentassist;
import java.util.ArrayList;
@@ -9,59 +9,59 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper;
import org.eclipse.papyrus.uml.textedit.transition.xtext.scoping.UmlTransitionScopeProvider;
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.CallOrSignalEventRule;
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.EventRule;
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.TransitionRule;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementUtil;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
+
/**
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
*/
public class UmlTransitionProposalProvider extends AbstractUmlTransitionProposalProvider {
@Override
- public void complete_CallOrSignalEventRule(EObject model,
- RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_CallOrSignalEventRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
- TransitionRule rule = (TransitionRule) model ;
- List<EObject> operationAndSignals = UmlTransitionScopeProvider.getVisibleOperationAndSignals(PopupXtextEditorHelper.context) ;
+ TransitionRule rule = (TransitionRule)model;
+ List<EObject> operationAndSignals = UmlTransitionScopeProvider.getVisibleOperationAndSignals(ContextElementUtil.getContextElement(model.eResource()));
List<EObject> alreadyUsedOperationAndSignals = new ArrayList<EObject>();
- if (rule != null && rule.getTriggers() != null && ! rule.getTriggers().isEmpty()) {
- List<EventRule> eventRules = rule.getTriggers() ;
- for (EventRule eventRule : eventRules) {
- if (eventRule instanceof CallOrSignalEventRule) {
- CallOrSignalEventRule callOrSignalEventRule = (CallOrSignalEventRule) eventRule ;
- if (callOrSignalEventRule.getOperationOrSignal() != null)
- alreadyUsedOperationAndSignals.add(callOrSignalEventRule.getOperationOrSignal()) ;
+ if(rule != null && rule.getTriggers() != null && !rule.getTriggers().isEmpty()) {
+ List<EventRule> eventRules = rule.getTriggers();
+ for(EventRule eventRule : eventRules) {
+ if(eventRule instanceof CallOrSignalEventRule) {
+ CallOrSignalEventRule callOrSignalEventRule = (CallOrSignalEventRule)eventRule;
+ if(callOrSignalEventRule.getOperationOrSignal() != null) {
+ alreadyUsedOperationAndSignals.add(callOrSignalEventRule.getOperationOrSignal());
+ }
}
}
}
- operationAndSignals.removeAll(alreadyUsedOperationAndSignals) ;
- for (EObject o : operationAndSignals) {
- NamedElement opOrSignal = (NamedElement) o ;
- if (opOrSignal.getName().startsWith(context.getPrefix())) {
- String completionString = opOrSignal.getName().substring(context.getPrefix().length()) ;
- ICompletionProposal completionProposal = new CompletionProposal(completionString, // String to be inserted
- context.getOffset(), // Offset
- context.getSelectedText().length(), // Replacement length
- completionString.length(), // cursorPosition
- null , // image
- opOrSignal.getName() + " - " + (opOrSignal instanceof Operation ? "Operation" : "Signal"), // displayString
- null , // contextInformation
- (opOrSignal instanceof Operation ? "Operation associated with the CallEvent of this trigger" : "Signal associated with the SignalEvent of this trigger") // additionalProposalInfo
- );
- //acceptor.accept(new CompletionProposal(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo))
- acceptor.accept(completionProposal) ;
+ operationAndSignals.removeAll(alreadyUsedOperationAndSignals);
+ for(EObject o : operationAndSignals) {
+ NamedElement opOrSignal = (NamedElement)o;
+ if(opOrSignal.getName().startsWith(context.getPrefix())) {
+ String completionString = opOrSignal.getName().substring(context.getPrefix().length());
+ ICompletionProposal completionProposal = new CompletionProposal(completionString, // String to be inserted
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ null, // image
+ opOrSignal.getName() + " - " + (opOrSignal instanceof Operation ? "Operation" : "Signal"), // displayString
+ null, // contextInformation
+ (opOrSignal instanceof Operation ? "Operation associated with the CallEvent of this trigger" : "Signal associated with the SignalEvent of this trigger") // additionalProposalInfo
+ );
+ //acceptor.accept(new CompletionProposal(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo))
+ acceptor.accept(completionProposal);
}
}
}
-
-
+
+
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contributions/TransitionPopupEditorConfigurationContribution.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contributions/TransitionEditorConfigurationContribution.java
index 59c8c17834b..9c5d08258fa 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contributions/TransitionPopupEditorConfigurationContribution.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext.ui/src/org/eclipse/papyrus/uml/textedit/transition/xtext/ui/contributions/TransitionEditorConfigurationContribution.java
@@ -23,13 +23,12 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.DefaultXtextSemanticValidator;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.Activator;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.textedit.transition.xtext.ui.internal.UmlTransitionActivator;
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.BehaviorKind;
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.CallOrSignalEventRule;
@@ -38,6 +37,8 @@ import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.EventRule
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.RelativeTimeEventRule;
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.TimeEventRule;
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.TransitionRule;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
+import org.eclipse.swt.SWT;
import org.eclipse.uml2.common.util.UML2Util;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Behavior;
@@ -70,75 +71,18 @@ import com.google.inject.Injector;
* of an xtext generated editor, for Transitions of UML StateMachines.
*
*/
-public class TransitionPopupEditorConfigurationContribution extends PopupEditorConfiguration {
+@SuppressWarnings("nls")
+public class TransitionEditorConfigurationContribution extends DefaultXtextDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
- private Transition transition = null;
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private final static String EVENTS = "events"; //$NON-NLS-1$
- private final static String EVENTS = "events";
-
- private TransitionRule transitionRuleObject = null;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#createPopupEditorHelper(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)
+ /**
+ * Override to change style to {@link SWT}.MULTI
*/
@Override
- public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
-
- // resolves the edit part, and the associated semantic element
- if(!(editPart instanceof IGraphicalEditPart)) {
- return null;
- }
- final IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart)editPart;
-
- if(!(graphicalEditPart.resolveSemanticElement() instanceof Transition)) {
- return null;
- }
- transition = (Transition)graphicalEditPart.resolveSemanticElement();
-
- // retrieves the XText injector
- Injector injector = UmlTransitionActivator.getInstance().getInjector("org.eclipse.papyrus.uml.textedit.transition.xtext.UmlTransition");
-
- // builds the text content and extension for a temporary file, to be edited by the xtext editor
- String textToEdit = "" + this.getTextToEdit(graphicalEditPart.resolveSemanticElement());
- String fileExtension = "" + ".umltransition";
-
- // builds a new IXtextEMFReconciler.
- // Its purpose is to extract any relevant information from the textual specification,
- // and then merge it in the context UML model if necessary
- IXtextEMFReconciler reconciler = new IXtextEMFReconciler() {
-
- /**
- * {@inheritDoc}
- */
- public void reconcile(EObject modelObject, EObject xtextObject) {
- // first: retrieves / determines if the xtextObject is a TransitionRule object
- EObject modifiedObject = xtextObject;
- if(!(modelObject instanceof Transition)) {
- return;
- }
- while(xtextObject != null && !(xtextObject instanceof TransitionRule)) {
- modifiedObject = modifiedObject.eContainer();
- }
- if(modifiedObject == null) {
- return;
- }
- transitionRuleObject = (TransitionRule)xtextObject;
-
- // Creates and executes the update command
- TransactionalEditingDomain dom = graphicalEditPart.getEditingDomain();
- UpdateUMLTransitionCommand updateCommand = new UpdateUMLTransitionCommand(dom,transition);
- dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(updateCommand));
- }
- };
- return super.createPopupEditorHelper(graphicalEditPart,
- injector,
- reconciler,
- textToEdit,
- fileExtension,
- new DefaultXtextSemanticValidator());
+ public int getStyle() {
+ return SWT.MULTI;
}
/*
@@ -146,11 +90,12 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
*
* @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#getTextToEdit(java.lang.Object)
*/
+ @SuppressWarnings("nls")
@Override
public String getTextToEdit(Object editedObject) {
if(editedObject instanceof Transition) {
Transition transition = (Transition)editedObject;
- String textToEdit = "";
+ String textToEdit = EMPTY;
// Triggers
if(!transition.getTriggers().isEmpty()) {
@@ -168,9 +113,9 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
textToEdit = textToEdit + ((SignalEvent)e).getSignal().getName();
} else if(e instanceof ChangeEvent) {
- textToEdit = textToEdit + "when " + "\"" + retrieveBody((OpaqueExpression)((ChangeEvent)e).getChangeExpression(), "Natural language") + "\"";
+ textToEdit = textToEdit + "when \"" + retrieveBody((OpaqueExpression)((ChangeEvent)e).getChangeExpression(), "Natural language") + "\"";
} else if(e instanceof TimeEvent) {
- String absRelPrefix = "" + (((TimeEvent)e).isRelative() ? "after " : "at ");
+ String absRelPrefix = EMPTY + (((TimeEvent)e).isRelative() ? "after " : "at ");
textToEdit = textToEdit + absRelPrefix + "\"" + retrieveBody((OpaqueExpression)((TimeEvent)e).getWhen().getExpr(), "Natural language") + "\"";
} else { // any receive event
textToEdit = textToEdit + "all";
@@ -184,11 +129,11 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
}
if(transition.getEffect() != null) {
- textToEdit = textToEdit + " / ";
- String behaviorKind = "";
- behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof Activity)) ? "Activity " : "");
- behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof StateMachine)) ? "StateMachine " : "");
- behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof OpaqueBehavior)) ? "OpaqueBehavior " : "");
+ textToEdit = textToEdit + " /\n";
+ String behaviorKind = EMPTY;
+ behaviorKind = behaviorKind + ((behaviorKind.equals(EMPTY) && (transition.getEffect() instanceof Activity)) ? "Activity " : EMPTY);
+ behaviorKind = behaviorKind + ((behaviorKind.equals(EMPTY) && (transition.getEffect() instanceof StateMachine)) ? "StateMachine " : EMPTY);
+ behaviorKind = behaviorKind + ((behaviorKind.equals(EMPTY) && (transition.getEffect() instanceof OpaqueBehavior)) ? "OpaqueBehavior " : EMPTY);
textToEdit = textToEdit + behaviorKind + " " + transition.getEffect().getName();
}
@@ -199,7 +144,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
}
private String retrieveBody(OpaqueExpression exp, String languageName) {
- String body = "";
+ String body = EMPTY;
if(exp == null) {
return body;
}
@@ -209,7 +154,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
if(index < exp.getBodies().size()) {
return exp.getBodies().get(index);
} else {
- return "";
+ return EMPTY;
}
}
index++;
@@ -224,9 +169,13 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
*/
protected class UpdateUMLTransitionCommand extends AbstractTransactionalCommand {
- private Transition transition;
+ private static final String ANY = "any"; //$NON-NLS-1$
+
+ private static final String NATURAL_LANGUAGE = "Natural language"; //$NON-NLS-1$
- private String newName = "";
+ private final Transition transition;
+
+ private final TransitionRule transitionRuleObject;
private List<Trigger> newTriggers = new ArrayList<Trigger>();
@@ -242,8 +191,6 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
-
-
// - Events associated with triggers of this transition
for(Trigger t : transition.getTriggers()) {
Event e = t.getEvent();
@@ -277,38 +224,37 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
}
// Create the new constraint
if(transitionRuleObject.getGuard() != null && transitionRuleObject.getGuard().getConstraint() != null) {
- this.newConstraint = transition.createGuard("");
+ this.newConstraint = transition.createGuard(EMPTY);
OpaqueExpression guardSpecification = UMLFactory.eINSTANCE.createOpaqueExpression();
- guardSpecification.getLanguages().add("Natural language");
- guardSpecification.getBodies().add("" + transitionRuleObject.getGuard().getConstraint());
+ guardSpecification.getLanguages().add(NATURAL_LANGUAGE);
+ guardSpecification.getBodies().add(EMPTY + transitionRuleObject.getGuard().getConstraint());
this.newConstraint.setSpecification(guardSpecification);
}
-
+
boolean hasEffect = transitionRuleObject.getEffect() != null && transitionRuleObject.getEffect().getKind() != null && transitionRuleObject.getEffect().getBehaviorName() != null;
BehaviorKind oldKind = getBehaviorKind(transition.getEffect());
-
- if ((!hasEffect) || (transitionRuleObject.getEffect().getKind() != oldKind)) {
+
+ if((!hasEffect) || (transitionRuleObject.getEffect().getKind() != oldKind)) {
// delete owned effect behavior
Behavior effect = transition.getEffect();
transition.setEffect(null);
if(effect != null) {
effect.destroy();
- }
+ }
}
-
+
// Create the new behavior
if(hasEffect) {
String behaviorName = transitionRuleObject.getEffect().getBehaviorName();
- if (transition.getEffect() == null) {
+ if(transition.getEffect() == null) {
// behavior does exist yet => create
Behavior newEffectBehavior = createUMLBehavior(transitionRuleObject.getEffect().getKind(), behaviorName);
transition.setEffect(newEffectBehavior);
- }
- else {
+ } else {
transition.getEffect().setName(behaviorName);
}
}
-
+
return CommandResult.newOKCommandResult(transition);
}
@@ -327,8 +273,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
PackageableElement ep = np.getPackagedElement(name);
if(ep instanceof Package) {
return (Package)ep;
- }
- else if(ep == null) {
+ } else if(ep == null) {
// does not exist, create
return np.createNestedPackage(name);
}
@@ -343,7 +288,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
* @return
*/
private CallEvent getOrCreateCallEvent(Operation operation) {
- String name = "CE - " + operation.getClass_().getName() + " - " + operation.getName();
+ String name = "CE - " + operation.getClass_().getName() + " - " + operation.getName(); //$NON-NLS-1$ //$NON-NLS-2$
Package eventPkg = getEventPackage();
for(PackageableElement existingPE : eventPkg.getPackagedElements()) {
if(existingPE instanceof CallEvent) {
@@ -369,7 +314,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
*/
private SignalEvent getOrCreateSignalEvent(Signal signal) {
Package eventPkg = getEventPackage();
- String name = "SE - " + signal.getName();
+ String name = "SE - " + signal.getName(); //$NON-NLS-1$
for(PackageableElement existingPE : eventPkg.getPackagedElements()) {
if(existingPE instanceof SignalEvent) {
// Call event with this operation exists already
@@ -394,7 +339,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
*/
private ChangeEvent getOrCreateChangeEvent(String opaqueChangeExpr) {
Package eventPkg = getEventPackage();
- String name = "CE - " + opaqueChangeExpr;
+ String name = "CE - " + opaqueChangeExpr; //$NON-NLS-1$
for(PackageableElement existingPE : eventPkg.getPackagedElements()) {
if(existingPE instanceof ChangeEvent) {
// Call event with this operation exists already
@@ -410,7 +355,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
}
ChangeEvent ce = UMLFactory.eINSTANCE.createChangeEvent();
OpaqueExpression changeExpression = UMLFactory.eINSTANCE.createOpaqueExpression();
- changeExpression.getLanguages().add("Natural language");
+ changeExpression.getLanguages().add(NATURAL_LANGUAGE);
changeExpression.getBodies().add(opaqueChangeExpr);
ce.setChangeExpression(changeExpression);
ce.setName(name);
@@ -426,7 +371,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
*/
private TimeEvent getOrCreateTimeEvent(String opaqueWhen, boolean isRelative) {
Package eventPkg = getEventPackage();
- String name = "TE - " + opaqueWhen;
+ String name = "TE - " + opaqueWhen; //$NON-NLS-1$
for(PackageableElement existingPE : eventPkg.getPackagedElements()) {
if(existingPE instanceof TimeEvent) {
// Call event with this operation exists already
@@ -442,7 +387,7 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
}
TimeEvent te = UMLFactory.eINSTANCE.createTimeEvent();
OpaqueExpression timeExpressionExp = UMLFactory.eINSTANCE.createOpaqueExpression();
- timeExpressionExp.getLanguages().add("Natural language");
+ timeExpressionExp.getLanguages().add(NATURAL_LANGUAGE);
timeExpressionExp.getBodies().add(opaqueWhen);
TimeExpression timeExpression = UMLFactory.eINSTANCE.createTimeExpression();
timeExpression.setExpr(timeExpressionExp);
@@ -475,41 +420,42 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
} else if(eventRule instanceof TimeEventRule) {
TimeEventRule timeEventRule = (TimeEventRule)eventRule;
if(timeEventRule.getExpr() != null) {
- e = getOrCreateTimeEvent(timeEventRule.getExpr(),
- timeEventRule instanceof RelativeTimeEventRule);
+ e = getOrCreateTimeEvent(timeEventRule.getExpr(), timeEventRule instanceof RelativeTimeEventRule);
}
} else { // AnyReceiveEventRule
e = UMLFactory.eINSTANCE.createAnyReceiveEvent();
getEventPackage().getPackagedElements().add(e);
- e.setName("any");
+ e.setName(ANY);
}
return e;
}
/**
* Return the behaviorKind for a given behavior
- * @param behavior the behavior
+ *
+ * @param behavior
+ * the behavior
* @return
*/
protected BehaviorKind getBehaviorKind(Behavior behavior) {
- if (behavior instanceof OpaqueBehavior) {
+ if(behavior instanceof OpaqueBehavior) {
return BehaviorKind.OPAQUE_BEHAVIOR;
- }
- else if (behavior instanceof Activity) {
+ } else if(behavior instanceof Activity) {
return BehaviorKind.ACTIVITY;
- }
- else if (behavior instanceof StateMachine) {
+ } else if(behavior instanceof StateMachine) {
return BehaviorKind.STATE_MACHINE;
- }
- else {
+ } else {
return null;
}
}
/**
* Create a new UML behavior of a given kind
- * @param kind the behavior kind
- * @param name the name of the behavior
+ *
+ * @param kind
+ * the behavior kind
+ * @param name
+ * the name of the behavior
* @return the created behavior
*/
protected Behavior createUMLBehavior(BehaviorKind kind, String name) {
@@ -541,9 +487,45 @@ public class TransitionPopupEditorConfigurationContribution extends PopupEditorC
return behavior;
}
- public UpdateUMLTransitionCommand(TransactionalEditingDomain domain, Transition transition) {
- super(domain, "Transition Update", getWorkspaceFiles(transition));
+ public UpdateUMLTransitionCommand(TransactionalEditingDomain domain, Transition transition, TransitionRule transitionRule) {
+ super(domain, "Transition Update", getWorkspaceFiles(transition)); //$NON-NLS-1$
this.transition = transition;
+ this.transitionRuleObject = transitionRule;
+ }
+ }
+
+ @Override
+ public Injector getInjector() {
+ return UmlTransitionActivator.getInstance().getInjector(UmlTransitionActivator.ORG_ECLIPSE_PAPYRUS_UML_TEXTEDIT_TRANSITION_XTEXT_UMLTRANSITION);
+ }
+
+ @Override
+ protected ICommand getParseCommand(EObject modelObject, EObject xtextObject) {
+ // first: retrieves / determines if the xtextObject is a TransitionRule object
+ EObject modifiedObject = xtextObject;
+
+ if(!(modelObject instanceof Transition)) {
+ return null;
+ }
+
+ Transition transition = (Transition)modelObject;
+
+ while(xtextObject != null && !(xtextObject instanceof TransitionRule)) {
+ modifiedObject = modifiedObject.eContainer();
+ }
+ if(modifiedObject == null) {
+ return null;
+ }
+ TransitionRule transitionRuleObject = (TransitionRule)xtextObject;
+
+ // Creates and executes the update command
+ try {
+ TransactionalEditingDomain dom = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(transition);
+ UpdateUMLTransitionCommand updateCommand = new UpdateUMLTransitionCommand(dom, transition, transitionRuleObject);
+ return updateCommand;
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
}
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/META-INF/MANIFEST.MF
index d7c80d318be..0b5ca5e9d65 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/META-INF/MANIFEST.MF
@@ -24,9 +24,9 @@ Require-Bundle: org.eclipse.xtext,
org.antlr.runtime,
org.eclipse.uml2.uml;bundle-version="3.1.0",
org.eclipse.uml2.codegen.ecore;bundle-version="1.6.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.2.15",
- org.eclipse.papyrus.uml.alf.common;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.alf.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.xtext.integration.core;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/src/org/eclipse/papyrus/uml/textedit/transition/xtext/scoping/UmlTransitionScopeProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/src/org/eclipse/papyrus/uml/textedit/transition/xtext/scoping/UmlTransitionScopeProvider.java
index 44786d25ed5..b41fd7a5142 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/src/org/eclipse/papyrus/uml/textedit/transition/xtext/scoping/UmlTransitionScopeProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.transition.xtext/src/org/eclipse/papyrus/uml/textedit/transition/xtext/scoping/UmlTransitionScopeProvider.java
@@ -8,8 +8,8 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper;
import org.eclipse.papyrus.uml.textedit.transition.xtext.umlTransition.CallOrSignalEventRule;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementUtil;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Reception;
@@ -24,53 +24,53 @@ import org.eclipse.xtext.scoping.impl.SimpleScope;
* This class contains custom scoping description.
*
* see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping
- * on how and when to use it
- *
+ * on how and when to use it
+ *
*/
public class UmlTransitionScopeProvider extends AbstractDeclarativeScopeProvider {
-
+
/**
* Rule for computing the scope of TriggerRule
+ *
* @param ctx
* @param ref
* @return
*/
public IScope scope_CallOrSignalEventRule_operationOrSignal(CallOrSignalEventRule ctx, EReference ref) {
- return create___CallOrSignalEventRule_operationOrSignal___Scope(ctx) ;
+ return create___CallOrSignalEventRule_operationOrSignal___Scope(ctx);
}
-
+
private IScope create___CallOrSignalEventRule_operationOrSignal___Scope(CallOrSignalEventRule ctx) {
-
- List<EObject> allOperationsAndSignals = getVisibleOperationAndSignals(PopupXtextEditorHelper.context) ;
- Iterable<IEObjectDescription> visibleOperationsAndSignals = Scopes.scopedElementsFor(allOperationsAndSignals) ;
- return new SimpleScope(visibleOperationsAndSignals) ;
+
+ List<EObject> allOperationsAndSignals = getVisibleOperationAndSignals(ContextElementUtil.getContextElement(ctx.eResource()));
+ Iterable<IEObjectDescription> visibleOperationsAndSignals = Scopes.scopedElementsFor(allOperationsAndSignals);
+ return new SimpleScope(visibleOperationsAndSignals);
}
-
+
public static List<EObject> getVisibleOperationAndSignals(EObject context) {
- List<EObject> allOperationsAndSignals = new ArrayList<EObject>() ;
-
- Element tmpContext = (Element) context ;
-
- while (tmpContext != null &&
- !(tmpContext instanceof Classifier && !(tmpContext instanceof StateMachine))) {
- tmpContext = tmpContext.getOwner() ;
+ List<EObject> allOperationsAndSignals = new ArrayList<EObject>();
+
+ Element tmpContext = (Element)context;
+
+ while(tmpContext != null && !(tmpContext instanceof Classifier && !(tmpContext instanceof StateMachine))) {
+ tmpContext = tmpContext.getOwner();
}
-
- if (tmpContext != null) {
- Classifier behavioredClassifier = (Classifier) tmpContext ;
- allOperationsAndSignals.addAll(behavioredClassifier.getAllOperations()) ;
- if (behavioredClassifier instanceof org.eclipse.uml2.uml.Class) {
- org.eclipse.uml2.uml.Class behavioredClass = (org.eclipse.uml2.uml.Class) behavioredClassifier ;
- for (Reception r : behavioredClass.getOwnedReceptions()) {
- if (r.getSignal() != null) {
- if (!(allOperationsAndSignals.contains(r.getSignal()))) {
- allOperationsAndSignals.add(r.getSignal()) ;
+
+ if(tmpContext != null) {
+ Classifier behavioredClassifier = (Classifier)tmpContext;
+ allOperationsAndSignals.addAll(behavioredClassifier.getAllOperations());
+ if(behavioredClassifier instanceof org.eclipse.uml2.uml.Class) {
+ org.eclipse.uml2.uml.Class behavioredClass = (org.eclipse.uml2.uml.Class)behavioredClassifier;
+ for(Reception r : behavioredClass.getOwnedReceptions()) {
+ if(r.getSignal() != null) {
+ if(!(allOperationsAndSignals.contains(r.getSignal()))) {
+ allOperationsAndSignals.add(r.getSignal());
}
}
}
}
}
-
- return allOperationsAndSignals ;
+
+ return allOperationsAndSignals;
}
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ElementUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ElementUtil.java
index f2d17196218..459bd03eb69 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ElementUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ElementUtil.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2009 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
@@ -9,7 +9,7 @@
*
* Contributors:
* Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
@@ -338,38 +338,45 @@ public class ElementUtil {
/* package imports treatment */
else if(currentElt instanceof PackageImport) {
- Iterator<EObject> piIter = ((PackageImport)currentElt).getImportedPackage().eAllContents();
- while(piIter.hasNext()) {
- EObject piCurrentElt = piIter.next();
- if(piCurrentElt instanceof Element) {
- if(appliedStereotype != null) {
-
- Iterator<Stereotype> appStIter = ((Element)piCurrentElt).getAppliedStereotypes().iterator();
- while(appStIter.hasNext()) {
- Stereotype currentSt = (Stereotype)appStIter.next();
+ Package importedPackage = ((PackageImport)currentElt).getImportedPackage();
+ if(importedPackage != null) {
+ Iterator<EObject> piIter = importedPackage.eAllContents();
+ while(piIter.hasNext()) {
+ EObject piCurrentElt = piIter.next();
+ if(piCurrentElt instanceof Element) {
+ if(appliedStereotype != null) {
+
+ Iterator<Stereotype> appStIter = ((Element)piCurrentElt).getAppliedStereotypes().iterator();
+ while(appStIter.hasNext()) {
+ Stereotype currentSt = appStIter.next();
+
+ if(currentSt.conformsTo(appliedStereotype)) {
+ filteredElements.add((T)piCurrentElt);
+ }
+ }
- if(currentSt.conformsTo(appliedStereotype)) {
+ } else { // if (appliedStereotype == null)
+ if(metaType.isInstance(piCurrentElt)) {
filteredElements.add((T)piCurrentElt);
}
- }
- } else { // if (appliedStereotype == null)
- if(metaType.isInstance(piCurrentElt)) {
- filteredElements.add((T)piCurrentElt);
- }
-
- /** add imported meta elements */
- else if(piCurrentElt instanceof ElementImport) {
- Iterator<EObject> eIter = ((ElementImport)piCurrentElt).getImportedElement().eAllContents();
- while(eIter.hasNext()) {
- EObject currentEIelt = eIter.next();
- if(metaType.isInstance(currentEIelt))
- filteredElements.add((T)currentEIelt);
+ /** add imported meta elements */
+ else if(piCurrentElt instanceof ElementImport) {
+ Element importedElement = ((ElementImport)piCurrentElt).getImportedElement();
+ if(importedElement != null) {
+ Iterator<EObject> eIter = importedElement.eAllContents();
+ while(eIter.hasNext()) {
+ EObject currentEIelt = eIter.next();
+ if(metaType.isInstance(currentEIelt)) {
+ filteredElements.add((T)currentEIelt);
+ }
+ }
+ }
}
}
}
- }
+ }
}
}
@@ -380,7 +387,7 @@ public class ElementUtil {
Iterator<Stereotype> appStIter = ((Element)currentElt).getAppliedStereotypes().iterator();
while(appStIter.hasNext()) {
- Stereotype currentSt = (Stereotype)appStIter.next();
+ Stereotype currentSt = appStIter.next();
if(currentSt.conformsTo(appliedStereotype)) {
filteredElements.add((T)currentElt);
@@ -397,8 +404,9 @@ public class ElementUtil {
Iterator<EObject> eIter = ((ElementImport)currentElt).getImportedElement().eAllContents();
while(eIter.hasNext()) {
EObject currentEIelt = eIter.next();
- if(metaType.isInstance(currentEIelt))
+ if(metaType.isInstance(currentEIelt)) {
filteredElements.add((T)currentEIelt);
+ }
}
}
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java
index 81ce8faf333..f8f000c683d 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PackageUtil.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008, 2009 CEA LIST.
+ * Copyright (c) 2008, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Remi SCHNEKENBURGER (CEA LIST) Remi.schnekenburger@cea.fr - Initial API and implementation
* Yann TANGUY (CEA LIST) yann.tanguy@cea.fr
+ * Christian W. Damus (CEA) - bug 402525
*
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
@@ -138,7 +139,8 @@ public class PackageUtil {
* @return the top {@link Package} for the specified element
*/
public static Package getRootPackage(Element element) {
- return getRootPackage(element.getNearestPackage());
+ Package nearest = element.getNearestPackage();
+ return (nearest == null) ? null : getRootPackage(nearest);
}
/**
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
index 7b0fa0804fa..0561cb11d12 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
@@ -21,7 +21,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.expressions;bundle-version="3.4.0",
org.eclipse.uml2.uml,
org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0",
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0"
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0",
+ org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.0.0",
+ org.eclipse.uml2.uml.validation;bundle-version="5.0.0"
Export-Package: org.eclipse.papyrus.uml.tools,
org.eclipse.papyrus.uml.tools.adapters,
org.eclipse.papyrus.uml.tools.commands,
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtensionRequiredObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtensionRequiredObservableValue.java
index cfab0f2c6aa..01385fa79f0 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtensionRequiredObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtensionRequiredObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,12 +9,14 @@
*
* Contributors:
* Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
*
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.core.databinding.observable.value.ValueDiff;
import org.eclipse.emf.edit.domain.EditingDomain;
@@ -29,7 +31,7 @@ import org.eclipse.uml2.uml.Extension;
* @author Camille Letavernier
*
*/
-public class ExtensionRequiredObservableValue extends AbstractObservableValue implements IChangeListener {
+public class ExtensionRequiredObservableValue extends AbstractObservableValue implements IChangeListener, IObserving {
private Extension extension;
@@ -70,6 +72,10 @@ public class ExtensionRequiredObservableValue extends AbstractObservableValue im
observable.setValue(required ? MultiplicityParser.ONE : MultiplicityParser.OPTIONAL);
currentValue = required;
}
+
+ public Object getObserved() {
+ return extension;
+ }
@Override
public void dispose() {
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageExpressionObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageExpressionObservableValue.java
index ddba5d70bd4..6f7fff680d0 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageExpressionObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageExpressionObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,9 +8,12 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.edit.domain.EditingDomain;
@@ -23,7 +26,7 @@ import org.eclipse.uml2.uml.Image;
*
* @author Camille Letavernier
*/
-public class ImageExpressionObservableValue extends AbstractObservableValue {
+public class ImageExpressionObservableValue extends AbstractObservableValue implements IObserving {
private Image image;
@@ -70,4 +73,7 @@ public class ImageExpressionObservableValue extends AbstractObservableValue {
}
}
+ public Object getObserved() {
+ return image;
+ }
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageKindObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageKindObservableValue.java
index 45db2817a2c..6957029ef32 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageKindObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageKindObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,9 +8,12 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.edit.domain.EditingDomain;
@@ -25,7 +28,7 @@ import org.eclipse.uml2.uml.Image;
* @author Camille Letavernier
*
*/
-public class ImageKindObservableValue extends AbstractObservableValue {
+public class ImageKindObservableValue extends AbstractObservableValue implements IObserving {
/**
* The kind of image display
@@ -95,4 +98,7 @@ public class ImageKindObservableValue extends AbstractObservableValue {
}
}
+ public Object getObserved() {
+ return image;
+ }
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageNameObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageNameObservableValue.java
index 2b355c02960..7af527ad018 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageNameObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ImageNameObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,9 +8,12 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.edit.domain.EditingDomain;
@@ -23,7 +26,7 @@ import org.eclipse.uml2.uml.Image;
*
* @author Camille Letavernier
*/
-public class ImageNameObservableValue extends AbstractObservableValue {
+public class ImageNameObservableValue extends AbstractObservableValue implements IObserving {
private Image image;
@@ -70,4 +73,7 @@ public class ImageNameObservableValue extends AbstractObservableValue {
}
}
+ public Object getObserved() {
+ return image;
+ }
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
index 9303602b5ce..e62380f34b5 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,12 +8,15 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.ValueDiff;
@@ -40,7 +43,7 @@ import org.eclipse.uml2.uml.UMLPackage;
*
* @author Camille Letavernier
*/
-public class MultiplicityObservableValue extends AbstractObservableValue implements IChangeListener, CommandBasedObservableValue, AggregatedObservable {
+public class MultiplicityObservableValue extends AbstractObservableValue implements IChangeListener, CommandBasedObservableValue, AggregatedObservable, IObserving {
private IObservableValue lowerBound, upperBound, lowerValue, upperValue, lowerValueSpecification, upperValueSpecification;
@@ -135,6 +138,10 @@ public class MultiplicityObservableValue extends AbstractObservableValue impleme
}
}
+ public Object getObserved() {
+ return eObject;
+ }
+
@Override
public synchronized void dispose() {
lowerValue.removeChangeListener(this);
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/NavigationObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/NavigationObservableValue.java
index d2fff73971a..f2308f0b186 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/NavigationObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/NavigationObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
@@ -19,6 +21,7 @@ import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.Diffs;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.emf.common.command.Command;
@@ -45,7 +48,7 @@ import org.eclipse.uml2.uml.UMLPackage;
*
* @author Camille Letavernier
*/
-public class NavigationObservableValue extends AbstractObservableValue implements IChangeListener, CommandBasedObservableValue, AggregatedObservable {
+public class NavigationObservableValue extends AbstractObservableValue implements IChangeListener, CommandBasedObservableValue, AggregatedObservable, IObserving {
private Property memberEnd;
@@ -89,6 +92,10 @@ public class NavigationObservableValue extends AbstractObservableValue implement
Command command = getCommand(value);
domain.getCommandStack().execute(command);
}
+
+ public Object getObserved() {
+ return memberEnd;
+ }
@Override
public synchronized void dispose() {
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/OwnerObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/OwnerObservableValue.java
index 7c8dea6a61b..1fab72a0498 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/OwnerObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/OwnerObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
@@ -18,6 +20,7 @@ import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.Diffs;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.emf.common.command.Command;
@@ -57,7 +60,7 @@ import org.eclipse.uml2.uml.UMLPackage;
*
* @author Camille Letavernier
*/
-public class OwnerObservableValue extends AbstractObservableValue implements IChangeListener, AggregatedObservable, CommandBasedObservableValue {
+public class OwnerObservableValue extends AbstractObservableValue implements IChangeListener, AggregatedObservable, CommandBasedObservableValue, IObserving {
private Property memberEnd;
@@ -111,6 +114,10 @@ public class OwnerObservableValue extends AbstractObservableValue implements ICh
domain.getCommandStack().execute(command);
}
+ public Object getObserved() {
+ return memberEnd;
+ }
+
@Override
public synchronized void dispose() {
super.dispose();
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
index 6f24f4c45bf..56b221f3d5e 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.databinding;
@@ -15,6 +17,7 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.list.ListDiff;
import org.eclipse.core.databinding.observable.list.ListDiffEntry;
import org.eclipse.core.databinding.observable.list.WritableList;
@@ -37,7 +40,7 @@ import org.eclipse.uml2.uml.Profile;
* @author Camille Letavernier
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
-public class ProfileApplicationObservableList extends WritableList implements ICommitListener {
+public class ProfileApplicationObservableList extends WritableList implements ICommitListener, IObserving {
private Package umlSource;
@@ -124,6 +127,10 @@ public class ProfileApplicationObservableList extends WritableList implements IC
};
}
+ public Object getObserved() {
+ return umlSource;
+ }
+
@Override
public synchronized void dispose() {
super.dispose();
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/importsources/PackageImportSourceDialog.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/importsources/PackageImportSourceDialog.java
index f13a92c2d74..fcf3bf2430d 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/importsources/PackageImportSourceDialog.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/importsources/PackageImportSourceDialog.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,14 +16,12 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectorDialog;
import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
+import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
@@ -46,7 +44,7 @@ public class PackageImportSourceDialog extends MultipleValueSelectorDialog {
/**
* Initializes me.
- *
+ *
* @param parentShell
* the shell to use as parent of the dialog
* @param title
@@ -61,7 +59,7 @@ public class PackageImportSourceDialog extends MultipleValueSelectorDialog {
/**
* Opens a new {@code PackageImportSourceDialog} and returns the selected
* models, if any.
- *
+ *
* @return the selected models from which to import, or {@code null} if the
* user cancelled
*/
@@ -73,7 +71,7 @@ public class PackageImportSourceDialog extends MultipleValueSelectorDialog {
/**
* Opens a new {@code PackageImportSourceDialog} and returns the selected
* models, if any.
- *
+ *
* @return the selected models from which to import, or {@code null} if the
* user cancelled
*/
@@ -84,7 +82,7 @@ public class PackageImportSourceDialog extends MultipleValueSelectorDialog {
/**
* Opens a new {@code PackageImportSourceDialog} and returns the selected
* models, if any.
- *
+ *
* @return the selected models from which to import, or {@code null} if the
* user cancelled
*/
@@ -117,31 +115,12 @@ public class PackageImportSourceDialog extends MultipleValueSelectorDialog {
setLabelProvider(labelProvider);
- resourceSet = getResourceSet(selection);
- }
-
- private static ResourceSet getResourceSet(Collection<?> selection) {
- ResourceSet result = null;
-
- for(Object next : selection) {
- EObject context = EMFHelper.getEObject(next);
- if(context != null) {
- Resource res = context.eResource();
- if(res != null) {
- result = res.getResourceSet();
- if(result != null) {
- break;
- }
- }
- }
- }
-
- return result;
+ resourceSet = Util.getSharedResourceSet();
}
/**
* Queries the packages selected by the user, if not cancelled.
- *
+ *
* @return the selected packages, or {@code null} if the user cancelled
*/
public Collection<Package> getSelectedPackages() {
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
index 1fc89c22d81..271b767b28b 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -14,6 +14,8 @@ package org.eclipse.papyrus.uml.tools.providers;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
@@ -25,12 +27,15 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.emf.adapters.ResourceSetRootsAdapter;
import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.widgets.Activator;
-import org.eclipse.papyrus.uml.tools.model.UmlUtils;
+import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.resource.UMLResource;
/**
* A semantic Hierarchic Content Provider for UML
@@ -62,6 +67,7 @@ public class SemanticUMLContentProvider extends SemanticEMFContentProvider {
public SemanticUMLContentProvider(EObject editedEObject, EStructuralFeature feature, ResourceSet root) {
this(editedEObject, feature, getRoots(root));
+ this.root = root;
}
protected static EObject[] findRoots(EObject source) {
@@ -74,39 +80,79 @@ public class SemanticUMLContentProvider extends SemanticEMFContentProvider {
}
protected static EObject[] getRoots(ResourceSet root) {
+ EObject rootElement = null;
+
if(root instanceof ModelSet) {
ModelSet modelSet = (ModelSet)root;
- //TODO : Find all semantic roots, including Models and Libraries
- //This is related to the ModelSet evolution
- try {
- EObject rootElement = UmlUtils.getUmlModel(modelSet).lookupRoot();
- if(rootElement == null) {
- return new EObject[0];
- }
-
- Resource rootResource = rootElement.eResource();
- if(rootResource == null) {
- return new EObject[]{ rootElement };
+ UmlModel umlModel = (UmlModel)modelSet.getModel(UmlModel.MODEL_ID);
+ if(umlModel != null) {
+ try {
+ rootElement = umlModel.lookupRoot();
+ } catch (NotFoundException ex) {
+ //Ignore and treat the ModelSet as a standard resource set
}
+ }
+ }
- List<EObject> rootObjects = new LinkedList<EObject>();
- for(EObject rootObject : rootResource.getContents()) {
- if(rootObject instanceof Element) {
- rootObjects.add(rootObject);
+ List<EObject> rootElements = new LinkedList<EObject>();
+ for(Resource resource : root.getResources()) {
+ if(isUMLModel(resource, rootElement)) {
+ for(EObject rootEObject : resource.getContents()) {
+ if(rootEObject instanceof Element) {
+ rootElements.add(rootEObject);
}
}
+ }
+ }
+ return rootElements.toArray(new EObject[0]);
+ }
- if(rootObjects.isEmpty()) {
- return new EObject[]{ rootElement };
- }
+ // protected static URI[] excludedModels = new URI[0];
- return rootObjects.toArray(new EObject[0]);
- } catch (NotFoundException ex) {
- Activator.log.error(ex);
+ //TODO: Currently, some resources are explicitly excluded.
+ //We need more use cases and user feedback to determine how we should filter them
+ protected static URI[] excludedModels = new URI[]{
+ // URI.createURI(UMLResource.STANDARD_L2_PROFILE_URI),
+ // URI.createURI(UMLResource.STANDARD_L3_PROFILE_URI),
+ URI.createURI(UMLResource.UML_METAMODEL_URI), URI.createURI(UMLResource.ECORE_METAMODEL_URI)
+ // URI.createURI(UMLResource.ECORE_PRIMITIVE_TYPES_LIBRARY_URI)
+ };
+
+ protected static boolean isUMLModel(Resource resource, EObject rootElement) {
+ if(!isUMLResource(resource)) {
+ return false;
+ }
+
+ for(URI uri : excludedModels) {
+ if(uri.equals(resource.getURI())) {
+ return false;
}
}
- return SemanticEMFContentProvider.getRoots(root);
+ for(EObject rootObject : resource.getContents()) {
+ if(rootObject.eIsProxy()) {
+ continue;
+ }
+
+ if(rootObject.eContainer() != null) { //Controlled element
+ return false;
+ }
+
+ if(rootObject instanceof Profile && !(rootElement instanceof Profile)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ protected static boolean isUMLResource(Resource resource) {
+ if(resource instanceof UMLResource) {
+ return true;
+ }
+
+ URI uri = resource.getURI();
+ return (uri != null && UMLResource.FILE_EXTENSION.equals(uri.fileExtension()));
}
@Override
@@ -133,7 +179,7 @@ public class SemanticUMLContentProvider extends SemanticEMFContentProvider {
return res;
}
- //TODO : We should use super.isCompatibleMetaclass(), but the super-implementation
+ //TODO : We should use super.isCompatibleMetaclass(), but the super-implementation
//may not be compatible with our implementation of getAdaptedValue()
if(metaclass instanceof EClassifier) {
return ((EClassifier)metaclass).isInstance(semanticElement);
@@ -188,22 +234,85 @@ public class SemanticUMLContentProvider extends SemanticEMFContentProvider {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- ResourceSet root = null;
+ ResourceSet resourceSet = root;
if(newInput instanceof ResourceSet) {
- root = (ResourceSet)newInput;
+ resourceSet = (ResourceSet)newInput;
} else if(newInput instanceof ServicesRegistry) {
try {
- root = ServiceUtils.getInstance().getModelSet((ServicesRegistry)newInput);
+ resourceSet = ServiceUtils.getInstance().getModelSet((ServicesRegistry)newInput);
} catch (Exception ex) {
Activator.log.error(ex);
}
}
- if(root != null) {
- this.roots = getRoots(root);
+ if(newInput == null) {
+ resourceSetListener.unsetTarget(root);
+ } else {
+ listenOnResourceSet(resourceSet);
}
+ this.viewer = viewer;
+
super.inputChanged(viewer, oldInput, newInput);
}
+
+ protected void listenOnResourceSet(ResourceSet resourceSet) {
+ resourceSetListener.unsetTarget(root);
+ resourceSetListener.setTarget(resourceSet);
+ if(resourceSet != null) {
+ this.root = resourceSet;
+ this.roots = getRoots(root);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ resourceSetListener.unsetTarget(root);
+ super.dispose();
+ }
+
+ private ResourceSet root;
+
+ private Viewer viewer;
+
+ private ResourceSetRootsAdapter resourceSetListener = new ResourceSetRootsAdapter() {
+
+ private boolean needsRefresh = false;
+
+ @Override
+ protected void doNotify(Notification msg) {
+ if(root == null || msg.isTouch()) {
+ return;
+ }
+
+ switch(msg.getEventType()) {
+ case Notification.ADD:
+ case Notification.ADD_MANY:
+ case Notification.REMOVE:
+ case Notification.REMOVE_MANY:
+ triggerRefresh();
+ }
+ }
+
+ private synchronized void triggerRefresh() {
+ roots = getRoots(root);
+ //During display, a resource has been loaded (e.g. by a Label provider).
+ //Schedule an update (in the future, to avoid conflicts with a potential current update)
+ if(viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
+ needsRefresh = true;
+ viewer.getControl().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ if(!needsRefresh || viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) {
+ return;
+ }
+ needsRefresh = false;
+ viewer.refresh();
+ };
+ });
+ }
+ }
+ };
+
}
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.core/src/org/eclipse/papyrus/uml/xtext/integration/core/ContextElementAdapter.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.core/src/org/eclipse/papyrus/uml/xtext/integration/core/ContextElementAdapter.java
index 20c25b9b74a..2d5ef6bc50c 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.core/src/org/eclipse/papyrus/uml/xtext/integration/core/ContextElementAdapter.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.core/src/org/eclipse/papyrus/uml/xtext/integration/core/ContextElementAdapter.java
@@ -13,6 +13,7 @@ package org.eclipse.papyrus.uml.xtext.integration.core;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.resource.XtextResource;
/**
* The {@link ContextElementAdapter} is added to the FakeResource to get access
@@ -27,6 +28,19 @@ public class ContextElementAdapter extends AdapterImpl {
public interface IContextElementProvider {
public EObject getContextObject();
}
+
+ /**
+ * Some editors, might require a resource initialization with the context object, for instance the
+ * OCL editor. These editors should implement the interface. IContextElementProviderWithResourceUpdate
+ */
+ public interface IContextElementProviderWithInit extends IContextElementProvider {
+ /**
+ * Initialize the resource according to the context object. This function needs to be
+ * called after resource creation and addition to the resource set
+ * @param resource the xtext resource for the editor.
+ */
+ public void initResource(XtextResource resource);
+ }
private final IContextElementProvider provider;
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
index a8a33bd9e3e..4cb1b462ab4 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
@@ -10,7 +10,10 @@ Require-Bundle: org.eclipse.gef;bundle-version="3.9.0",
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.uml2.uml;bundle-version="4.1.0",
org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.uml.xtext.integration
Bundle-Vendor: Eclipse Modeling Project
Bundle-Version: 1.0.0.qualifier
@@ -25,4 +28,3 @@ Import-Package: org.eclipse.papyrus.infra.services.validation,
org.eclipse.papyrus.uml.extensionpoints.profile,
org.eclipse.papyrus.uml.extensionpoints.standard
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalAdapter.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalAdapter.java
index cb4c9125f39..2c7ded5372b 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalAdapter.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalAdapter.java
@@ -14,6 +14,7 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
@@ -24,11 +25,15 @@ import org.eclipse.swt.widgets.Listener;
*
* @author patrick.koenemann@itemis.de
*
+ * ansgar.radermacher@cea.fr: added delayedIsPopupOpen()
+ *
*/
public class CompletionProposalAdapter implements ICompletionListener {
private final IContentAssistant contentAssistant;
+ protected boolean delayedIsOpen;
+
/**
* <p>
* This adapter installs listener on the given control and delegates the
@@ -57,6 +62,21 @@ public class CompletionProposalAdapter implements ICompletionListener {
this.contentAssistant = contentAssistant;
addControlListener(control);
+ addContentProposalListener(new ICompletionProposalListener() {
+
+ public void proposalPopupOpened(CompletionProposalAdapter adapter) {
+ }
+
+ public void proposalPopupClosed(CompletionProposalAdapter adapter) {
+ // reset open status asynchronously.
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ delayedIsOpen = false;
+ }
+ });
+ }
+ });
}
/**
@@ -436,6 +456,7 @@ public class CompletionProposalAdapter implements ICompletionListener {
private void openProposalPopup(boolean autoActivated) {
if (isValid() && isEnabled()) {
+ delayedIsOpen = true;
// XXX here we delegate the request!
contentAssistant.showPossibleCompletions();
@@ -546,6 +567,16 @@ public class CompletionProposalAdapter implements ICompletionListener {
}
/**
+ * @return true, if popup is open. Flag whether is reset asynchronously.
+ * This means that it still returns true, when isProposalPopupOpen() already
+ * returns false. This is useful to filter for instance the escape key
+ * once the popup is open.
+ */
+ public boolean delayedIsPopupOpen() {
+ return delayedIsOpen;
+ }
+
+ /**
* @return <code>true</code> if the content assistant has the completion
* proposal popup open; <code>false</code> otherwise.
*/
@@ -556,7 +587,7 @@ public class CompletionProposalAdapter implements ICompletionListener {
*/
try {
final Method m = ContentAssistant.class
- .getDeclaredMethod("isProposalPopupActive");
+ .getDeclaredMethod("isProposalPopupActive"); //$NON-NLS-1$
m.setAccessible(true);
try {
final Object result = m.invoke(contentAssistant);
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalUtils.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalUtils.java
new file mode 100644
index 00000000000..a701f5c3e31
--- /dev/null
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CompletionProposalUtils.java
@@ -0,0 +1,152 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.xtext.integration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.core.utils.DisplayUtils;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
+
+/**
+ * @author CEA LIST - Initial contribution and API
+ */
+public class CompletionProposalUtils {
+
+ protected final static ILabelProvider labelProvider = DisplayUtils.getLabelProvider() ;
+
+ /**
+ * Public Utility method for creating a completion proposal
+ *
+ * @param namedElement The named element for which completion proposal must be created
+ * @param completionString The actual completion string
+ * @param displayString The way the completion is displayed in the completion list
+ * @param context Some information related to the context of the completion
+ * @return completion proposal
+ */
+ public static CustomCompletionProposal createCompletionProposal(NamedElement namedElement,
+ String completionString,
+ String displayString,
+ ContentAssistContext context) {
+ String additionalProposalInfo = "" + namedElement.getQualifiedName() + "\n" + '(' + namedElement.eClass().getName() + ')' ;
+
+ CustomCompletionProposal completionProposal = new CustomCompletionProposal(completionString, // String to be inserted
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ labelProvider.getImage(namedElement) , // image
+ " " + displayString, // displayString
+ null , // contextInformation
+ additionalProposalInfo, // additionalProposalInfo
+ context);
+ return completionProposal ;
+ }
+
+ /**
+ * Public Utility method for creating a completion proposal with replacement of prefix
+ *
+ * @param namedElement The named element for which completion proposal must be created
+ * @param completionString The actual completion string
+ * @param displayString The way the completion is displayed in the completion list
+ * @param context Some information related to the context of the completion
+ * @return completion proposal
+ */
+ public static CustomCompletionProposal createCompletionProposalWithReplacementOfPrefix(NamedElement namedElement,
+ String completionString,
+ String displayString,
+ ContentAssistContext context) {
+ String additionalProposalInfo = "" + namedElement.getQualifiedName() + "\n" + '(' + namedElement.eClass().getName() + ')' ;
+
+ CustomCompletionProposal completionProposal = new CustomCompletionProposal(completionString, // String to be inserted
+ context.getOffset() - context.getPrefix().length(), // Offset
+ context.getPrefix().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ labelProvider.getImage(namedElement) , // image
+ " " + displayString, // displayString
+ null , // contextInformation
+ additionalProposalInfo, // additionalProposalInfo
+ context);
+ return completionProposal ;
+ }
+
+ /**
+ * Public Utility method for creating a completion proposal
+ *
+ * @param completionString The actual completion string
+ * @param displayString The way the completion is displayed in the completion list
+ * @param context Some information related to the context of the completion
+ * @return completion proposal
+ */
+ public static CustomCompletionProposal createCompletionProposal(String completionString,
+ String displayString,
+ ContentAssistContext context) {
+
+ CustomCompletionProposal completionProposal = new CustomCompletionProposal(completionString, // String to be inserted
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ null , // image
+ " " + displayString, // displayString
+ null , // contextInformation
+ null, // additionalProposalInfo
+ context);
+ return completionProposal ;
+ }
+
+ /**
+ * Public utility method that computes a qualified name, taking into account packages imported by the namespace model
+ *
+ * @param namedElement
+ * @param model
+ * @return the qualified name label
+ */
+ public static String getQualifiedNameLabelWithSufficientDepth(NamedElement namedElement, Namespace model) {
+ String label = "" ;
+
+ List<Package> importedPackages = new ArrayList<Package>(model.getImportedPackages()) ;
+
+ List<Namespace> visitedNamespaces = new ArrayList<Namespace>() ;
+ Namespace currentNamespace = namedElement.getNamespace() ;
+
+ boolean rootFound = false ;
+ boolean modelIsTheRoot = false ;
+
+ while (currentNamespace != null && !rootFound) {
+ visitedNamespaces.add(currentNamespace) ;
+ if (importedPackages.contains(currentNamespace) || currentNamespace == model) {
+ rootFound = true ;
+ if (currentNamespace == model)
+ modelIsTheRoot = true ;
+ }
+ Element owner = currentNamespace.getOwner() ;
+ while (owner != null && !(owner instanceof Namespace))
+ owner = owner.getOwner() ;
+
+ currentNamespace = owner != null ? (Namespace)owner : null ;
+ }
+
+ for (int i = visitedNamespaces.size() - 1 - (modelIsTheRoot ? 1 : 0) ; i >= 0 ; i--) {
+ label += visitedNamespaces.get(i).getName() + "::" ;
+ }
+
+ return label + namedElement.getName() ;
+ }
+
+}
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CustomCompletionProposal.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CustomCompletionProposal.java
new file mode 100644
index 00000000000..6279f776e12
--- /dev/null
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/CustomCompletionProposal.java
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.xtext.integration;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
+
+/**
+ * @author CEA LIST - Initial contribution and API
+ */
+public class CustomCompletionProposal implements ICompletionProposal, ICompletionProposalExtension {
+
+ private CompletionProposal completionProposal ;
+ private int fReplacementOffset ;
+ private ContentAssistContext fContentAssistContext ;
+ private String fReplacementString ;
+
+ /**
+ * @param replacementString
+ * @param replacementOffset
+ * @param replacementLength
+ * @param cursorPosition
+ * @param image
+ * @param displayString
+ * @param contextInformation
+ * @param additionalProposalInfo
+ * @param contentAssistContext
+ *
+ */
+ public CustomCompletionProposal (String replacementString,
+ int replacementOffset,
+ int replacementLength,
+ int cursorPosition,
+ Image image,
+ String displayString,
+ IContextInformation contextInformation,
+ String additionalProposalInfo,
+ ContentAssistContext contentAssistContext) {
+ completionProposal = new CompletionProposal(replacementString,
+ replacementOffset,
+ replacementLength,
+ cursorPosition,
+ image,
+ displayString,
+ contextInformation,
+ additionalProposalInfo) ;
+ fReplacementOffset = replacementOffset ;
+ fReplacementString = replacementString ;
+ fContentAssistContext = contentAssistContext ;
+ }
+
+ public void apply(IDocument document, char trigger, int offset) {
+ try {
+ int length = 0 ;
+ if (offset != fReplacementOffset)
+ length = offset - fReplacementOffset ;
+ else
+ length = fContentAssistContext.getSelectedText().length() ;
+ document.replace(fReplacementOffset ,
+ length,
+ fReplacementString) ;
+ }
+ catch (BadLocationException e) {
+ // ignore
+ }
+ }
+
+ public boolean isValidFor(IDocument document, int offset) {
+ try {
+ int length = offset - fReplacementOffset ;
+ return completionProposal.getDisplayString().toLowerCase().contains(document.get(fReplacementOffset, length).toLowerCase()) ;
+ }
+ catch (BadLocationException e) {
+ // ignore
+ }
+ return false;
+ }
+
+ public char[] getTriggerCharacters() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getContextInformationPosition() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public void apply(IDocument document) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Point getSelection(IDocument document) {
+ return completionProposal.getSelection(document);
+ }
+
+ public String getAdditionalProposalInfo() {
+ return completionProposal.getAdditionalProposalInfo();
+ }
+
+ public String getDisplayString() {
+ return completionProposal.getDisplayString();
+ }
+
+ public Image getImage() {
+ return completionProposal.getImage();
+ }
+
+ public IContextInformation getContextInformation() {
+ return completionProposal.getContextInformation();
+ }
+
+}
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java
index 706d3acdc92..fd4850eecc2 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DefaultXtextDirectEditorConfiguration.java
@@ -40,6 +40,7 @@ import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.papyrus.infra.services.validation.commands.ValidateSubtreeCommand;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProvider;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProviderWithInit;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Composite;
@@ -61,12 +62,10 @@ import com.google.inject.name.Names;
* abstract base implementation of {@link ICustomDirectEditorConfiguration}
*
* @author andreas muelder - Initial contribution and API
- *
+ * Ansgar Radermacher - Added possibility to configure context provider
*
*/
-public abstract class DefaultXtextDirectEditorConfiguration extends
- DefaultDirectEditorConfiguration implements
- ICustomDirectEditorConfiguration {
+public abstract class DefaultXtextDirectEditorConfiguration extends DefaultDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
public static final String ANNOTATION_SOURCE = "expression_source";
@@ -85,8 +84,7 @@ public abstract class DefaultXtextDirectEditorConfiguration extends
* @param xtextObject
* @return
*/
- protected abstract ICommand getParseCommand(EObject umlObject,
- EObject xtextObject);
+ protected abstract ICommand getParseCommand(EObject umlObject, EObject xtextObject);
/**
* Clients may override to change style to {@link SWT}.MULTI
@@ -96,84 +94,95 @@ public abstract class DefaultXtextDirectEditorConfiguration extends
return SWT.SINGLE;
}
- public DirectEditManager createDirectEditManager(
- final ITextAwareEditPart host) {
- IContextElementProvider provider = new IContextElementProvider() {
+ /**
+ * Clients may override, if the objectToEdit is not equal to the context element
+ * @return the context provider
+ */
+ public IContextElementProvider getContextProvider() {
+ return new IContextElementProvider() {
public EObject getContextObject() {
- if (host instanceof IGraphicalEditPart)
- return ((IGraphicalEditPart) host).resolveSemanticElement();
+ if (objectToEdit instanceof EObject) {
+ return (EObject) objectToEdit;
+ }
return null;
}
};
- return new XtextDirectEditManager(host, getInjector(), getStyle(),
- provider);
+ }
+
+ public DirectEditManager createDirectEditManager(final ITextAwareEditPart host) {
+ IContextElementProvider provider;
+ if (objectToEdit != null) {
+ provider = getContextProvider();
+ }
+ else {
+ provider = new IContextElementProvider() {
+
+ public EObject getContextObject() {
+ if(host instanceof IGraphicalEditPart) {
+ return ((IGraphicalEditPart)host).resolveSemanticElement();
+ }
+ return null;
+ }
+ };
+ }
+ return new XtextDirectEditManager(host, getInjector(), getStyle(), this);
}
/**
- * Adapts {@link IDirectEditorConfiguration} to gmfs {@link IParser}
- * interface for reuse in GMF direct editing infrastructure.
+ * Adapts {@link IDirectEditorConfiguration} to gmfs {@link IParser} interface for reuse in GMF direct editing infrastructure.
*/
public IParser createParser(final EObject semanticObject) {
+ if (objectToEdit == null) {
+ objectToEdit = semanticObject;
+ }
return new IParser() {
public String getEditString(IAdaptable element, int flags) {
- return DefaultXtextDirectEditorConfiguration.this
- .getTextToEditInternal(semanticObject);
+ return DefaultXtextDirectEditorConfiguration.this.getTextToEditInternal(semanticObject);
}
- public ICommand getParseCommand(IAdaptable element,
- String newString, int flags) {
- CompositeCommand result = new CompositeCommand("validation");
- IContextElementProvider provider = new IContextElementProvider() {
- public EObject getContextObject() {
- return semanticObject;
- }
- };
- XtextFakeResourceContext context = new XtextFakeResourceContext(
- getInjector());
- context.getFakeResource().eAdapters()
- .add(new ContextElementAdapter(provider));
+ public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+ CompositeCommand result = new CompositeCommand("validation"); //$NON-NLS-1$
+ IContextElementProvider provider = getContextProvider();
+
+ XtextFakeResourceContext context = new XtextFakeResourceContext(getInjector());
+ context.getFakeResource().eAdapters().add(new ContextElementAdapter(provider));
try {
- context.getFakeResource().load(
- new StringInputStream(newString),
- Collections.EMPTY_MAP);
+ context.getFakeResource().load(new StringInputStream(newString), Collections.EMPTY_MAP);
} catch (IOException e) {
e.printStackTrace();
}
- EcoreUtil2.resolveLazyCrossReferences(
- context.getFakeResource(), CancelIndicator.NullImpl);
- if (!context.getFakeResource().getParseResult()
- .hasSyntaxErrors()
- && context.getFakeResource().getErrors().size() == 0) {
- EObject xtextObject = context.getFakeResource()
- .getParseResult().getRootASTElement();
- result.add( DefaultXtextDirectEditorConfiguration.this
- .getParseCommand(semanticObject, xtextObject));
+ if (provider instanceof IContextElementProviderWithInit) {
+ ((IContextElementProviderWithInit) provider).initResource(context.getFakeResource());
+ }
+ EcoreUtil2.resolveLazyCrossReferences(context.getFakeResource(), CancelIndicator.NullImpl);
+ if(!context.getFakeResource().getParseResult().hasSyntaxErrors() && context.getFakeResource().getErrors().size() == 0) {
+ EObject xtextObject = context.getFakeResource().getParseResult().getRootASTElement();
+ result.add(DefaultXtextDirectEditorConfiguration.this.getParseCommand(semanticObject, xtextObject));
} else {
result.add(createInvalidStringCommand(newString, semanticObject));
}
- result.add(new ValidateSubtreeCommand(semanticObject, new EcoreDiagnostician()));
+ ValidateSubtreeCommand validationCommand = new ValidateSubtreeCommand(semanticObject, new EcoreDiagnostician());
+ validationCommand.disableUIFeedback();
+ result.add(validationCommand);
return result;
}
public String getPrintString(IAdaptable element, int flags) {
- return DefaultXtextDirectEditorConfiguration.this
- .getTextToEdit(semanticObject);
+ return DefaultXtextDirectEditorConfiguration.this.getTextToEdit(semanticObject);
}
public boolean isAffectingEvent(Object event, int flags) {
return false;
}
- public IContentAssistProcessor getCompletionProcessor(
- IAdaptable element) {
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
// Not used
return null;
}
- public IParserEditStatus isValidEditString(IAdaptable element,
- String editString) {
+ public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
// Not used
return null;
}
@@ -181,34 +190,27 @@ public abstract class DefaultXtextDirectEditorConfiguration extends
}
protected String getTextToEditInternal(EObject semanticObject) {
- if (semanticObject instanceof Element) {
- String textualRepresentation = InvalidStringUtil
- .getTextualRepresentation((Element) semanticObject);
- if (textualRepresentation != null)
+ if(semanticObject instanceof Element) {
+ String textualRepresentation = InvalidStringUtil.getTextualRepresentation((Element)semanticObject);
+ if(textualRepresentation != null) {
return textualRepresentation;
+ }
}
return getTextToEdit(semanticObject);
}
- protected ICommand createInvalidStringCommand(final String newString,
- EObject semanticElement) {
- if (semanticElement instanceof Element) {
+ protected ICommand createInvalidStringCommand(final String newString, EObject semanticElement) {
+ if(semanticElement instanceof Element) {
registerInvalidStringAdapter(semanticElement);
- final Element element = (Element) semanticElement;
- return new AbstractTransactionalCommand(
- TransactionUtil.getEditingDomain(semanticElement), "",
- Collections.emptyList()) {
+ final Element element = (Element)semanticElement;
+ return new AbstractTransactionalCommand(TransactionUtil.getEditingDomain(semanticElement), "", Collections.emptyList()) {
@Override
- protected CommandResult doExecuteWithResult(
- IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
String languageName = getInjector().getInstance(Key.get(String.class, Names.named(Constants.LANGUAGE_NAME)));
- Comment comment = InvalidStringUtil
- .getTextualRepresentationComment(element);
- if (comment == null) {
- comment = InvalidStringUtil
- .createTextualRepresentationComment(element,languageName);
+ Comment comment = InvalidStringUtil.getTextualRepresentationComment(element);
+ if(comment == null) {
+ comment = InvalidStringUtil.createTextualRepresentationComment(element, languageName);
}
comment.setBody(newString);
return CommandResult.newOKCommandResult();
@@ -218,24 +220,17 @@ public abstract class DefaultXtextDirectEditorConfiguration extends
}
return UnexecutableCommand.INSTANCE;
}
-
+
protected void registerInvalidStringAdapter(EObject semanticElement) {
- Adapter existingAdapter = EcoreUtil.getExistingAdapter(semanticElement,
- InvalidSyntaxAdapter.class);
- if (existingAdapter == null) {
+ Adapter existingAdapter = EcoreUtil.getExistingAdapter(semanticElement, InvalidSyntaxAdapter.class);
+ if(existingAdapter == null) {
semanticElement.eAdapters().add(new InvalidSyntaxAdapter());
}
}
- public CellEditor createCellEditor(Composite parent,
- final EObject semanticObject) {
- IContextElementProvider provider = new IContextElementProvider() {
- public EObject getContextObject() {
- return semanticObject;
- }
- };
- XtextStyledTextCellEditorEx cellEditor = new XtextStyledTextCellEditorEx(
- SWT.MULTI | SWT.BORDER, getInjector(), provider) {
+ public CellEditor createCellEditor(Composite parent, final EObject semanticObject) {
+ IContextElementProvider provider = getContextProvider();
+ XtextStyledTextCellEditorEx cellEditor = new XtextStyledTextCellEditorEx(SWT.MULTI | SWT.BORDER, getInjector(), provider) {
// This is a workaround for bug
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=412732
@@ -248,9 +243,7 @@ public abstract class DefaultXtextDirectEditorConfiguration extends
text.addListener(3005, new Listener() {
public void handleEvent(Event event) {
- if (event.character == SWT.CR
- && !completionProposalAdapter
- .isProposalPopupOpen()) {
+ if(event.character == SWT.CR && !completionProposalAdapter.isProposalPopupOpen()) {
focusLost();
}
}
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DirectEditManagerEx.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DirectEditManagerEx.java
index 20a1065a8fc..38937f310e2 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DirectEditManagerEx.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/DirectEditManagerEx.java
@@ -37,8 +37,9 @@ import org.eclipse.swt.widgets.Display;
* getCellEditorFrame to protected
*
* TODO: Delete me when https://bugs.eclipse.org/bugs/show_bug.cgi?id=388697 is fixed
+ * CAVEAT: this variant also cleans the parser in bringDown()
*/
-@SuppressWarnings("all")
+@SuppressWarnings("rawtypes")
public abstract class DirectEditManagerEx extends DirectEditManager {
private static final Color BLUE = ColorConstants.menuBackgroundSelected;
@@ -59,6 +60,8 @@ public abstract class DirectEditManagerEx extends DirectEditManager {
private boolean committing = false;
private Object feature;
+
+
/**
* Constructs a new DirectEditManager for the given source edit part. The
* cell editor will be created by instantiating the type <i>editorType</i>.
@@ -101,6 +104,10 @@ public abstract class DirectEditManagerEx extends DirectEditManager {
this.feature = feature;
}
+ public boolean isActive() {
+ return getCellEditor() != null;
+ }
+
/**
* Cleanup is done here. Any feedback is erased and listeners unhooked. If
* the cell editor is not <code>null</code>, it will be
@@ -144,7 +151,7 @@ public abstract class DirectEditManagerEx extends DirectEditManager {
/**
* Creates the cell editor on the given composite. The cell editor is
* created by instantiating the cell editor type passed into this
- * DirectEditManager's constuctor.
+ * DirectEditManager's constructor.
*
* @param composite
* the composite to create the cell editor on
@@ -152,6 +159,7 @@ public abstract class DirectEditManagerEx extends DirectEditManager {
*/
protected CellEditor createCellEditorOn(Composite composite) {
try {
+ @SuppressWarnings("unchecked")
Constructor constructor = editorType
.getConstructor(new Class[] { Composite.class });
return (CellEditor) constructor
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java
index 9ddf38e7d5a..ffa78d906c1 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/InvalidStringUtil.java
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Stereotype;
@@ -108,7 +108,8 @@ public class InvalidStringUtil {
RegisteredProfile registeredActionLanguageProfile = RegisteredProfile
.getRegisteredProfile(ACTION_LANGUAGE_PROFILE_NAME);
URI modelUri = registeredActionLanguageProfile.uri;
- Model root = element.getModel();
+ Package root = PackageUtil.getRootPackage(element);
+
Resource modelResource = root.eResource().getResourceSet()
.getResource(modelUri, true);
if (modelResource.getContents().get(0) instanceof Profile) {
@@ -116,7 +117,7 @@ public class InvalidStringUtil {
.get(0);
}
}
- List<Profile> appliedProfiles = element.getModel().getAppliedProfiles();
+ List<Profile> appliedProfiles = PackageUtil.getRootPackage(element).getAppliedProfiles();
return appliedProfiles.contains(actionLanguageProfile);
}
@@ -128,7 +129,7 @@ public class InvalidStringUtil {
Comment textualRepresentationComment = element.createOwnedComment();
if (!isActionLanguageProfileApplied(element)) {
PackageUtil.applyProfile(
- (org.eclipse.uml2.uml.Package) element.getModel(),
+ PackageUtil.getRootPackage(element),
actionLanguageProfile, true);
}
clean();
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextXtextAdapter.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextXtextAdapter.java
index 5343d01a206..ba3994802da 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextXtextAdapter.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextXtextAdapter.java
@@ -86,10 +86,12 @@ public class StyledTextXtextAdapter {
private XtextFakeResourceContext fakeResourceContext;
private final IXtextFakeContextResourcesProvider contextFakeResourceProvider;
- private StyledText styledText;
+ protected StyledText styledText;
- private ControlDecoration decoration;
+ protected ControlDecoration decoration;
+ protected CompletionProposalAdapter completionProposalAdapter;
+
public StyledTextXtextAdapter(Injector injector, IXtextFakeContextResourcesProvider contextFakeResourceProvider) {
this.contextFakeResourceProvider = contextFakeResourceProvider;
injector.injectMembers(this);
@@ -128,7 +130,7 @@ public class StyledTextXtextAdapter {
styledText.setData(StyledTextXtextAdapter.class.getCanonicalName(), this);
final IContentAssistant contentAssistant = sourceviewer.getContentAssistant();
- final CompletionProposalAdapter completionProposalAdapter = new CompletionProposalAdapter(styledText,
+ completionProposalAdapter = new CompletionProposalAdapter(styledText,
contentAssistant, KeyStroke.getInstance(SWT.CTRL, SWT.SPACE), null);
if ((styledText.getStyle() & SWT.SINGLE) != 0) {
@@ -158,6 +160,13 @@ public class StyledTextXtextAdapter {
createContentAssistDecoration(styledText);
}
+ /**
+ * @return completion proposal adapter that has been created by @see adapt
+ */
+ public CompletionProposalAdapter getCompletionProposalAdapter() {
+ return completionProposalAdapter;
+ }
+
private void createContentAssistDecoration(StyledText styledText) {
decoration = new ControlDecoration(styledText, SWT.TOP | SWT.LEFT);
decoration.setShowHover(true);
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextDirectEditManager.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextDirectEditManager.java
index 25ab91ef6ce..7c0d5f5bbba 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextDirectEditManager.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextDirectEditManager.java
@@ -31,6 +31,8 @@ import org.eclipse.gef.editparts.ZoomManager;
import org.eclipse.gef.tools.CellEditorLocator;
import org.eclipse.gmf.runtime.common.core.util.Log;
import org.eclipse.gmf.runtime.common.core.util.Trace;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions;
import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
@@ -47,8 +49,9 @@ import org.eclipse.jface.resource.FontDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.papyrus.uml.xtext.integration.core.IXtextFakeContextResourcesProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProvider;
+import org.eclipse.papyrus.uml.xtext.integration.core.IXtextFakeContextResourcesProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
@@ -111,6 +114,11 @@ public class XtextDirectEditManager extends DirectEditManagerEx {
private Font zoomLevelFont = null;
/**
+ * store used parser to enable activation, if required
+ * */
+ protected IParser parser;
+
+ /**
* The superclass only relocates the cell editor when the location of the
* editpart's figure moves, but we need to also relocate the cell editor
* when the text figure's location changes.
@@ -151,11 +159,19 @@ public class XtextDirectEditManager extends DirectEditManagerEx {
}
public XtextDirectEditManager(ITextAwareEditPart source, Injector injector,
+ int style, DefaultXtextDirectEditorConfiguration configuration) {
+ this(source, null, getTextCellEditorLocator(source), injector, style);
+ this.contextProvider = configuration.getContextProvider();
+ this.parser = configuration.createParser(((IGraphicalEditPart) source).resolveSemanticElement());
+ installCustomParser();
+ }
+
+ public XtextDirectEditManager(ITextAwareEditPart source, Injector injector,
int style, IContextElementProvider provider) {
this(source, null, getTextCellEditorLocator(source), injector, style);
this.contextProvider = provider;
}
-
+
/**
* @param source
* @param editorType
@@ -288,6 +304,8 @@ public class XtextDirectEditManager extends DirectEditManagerEx {
*/
protected CellEditor createCellEditorOn(Composite composite) {
+ // ((ICleanupAfterDirectEdit) getEditPart()).setParser(parser);
+
Composite parent = new Composite(composite, SWT.None);
FillLayout fillLayout = new FillLayout();
fillLayout.marginWidth = 10;
@@ -356,7 +374,6 @@ public class XtextDirectEditManager extends DirectEditManagerEx {
committed = false;
// Get the Text Compartments Edit Part
-
setEditText(getEditPart().getEditText());
IFigure label = getEditPart().getFigure();
@@ -375,6 +392,7 @@ public class XtextDirectEditManager extends DirectEditManagerEx {
actionHandler = new CellEditorActionHandler(actionBars);
actionHandler.addCellEditor(getCellEditor());
actionBars.updateActionBars();
+ resetDefaultParser();
}
/**
@@ -404,10 +422,36 @@ public class XtextDirectEditManager extends DirectEditManagerEx {
return;
}
committed = true;
+ // installCustomParser();
+ // already call eraseFeedback here, to assure that a refresh is done with the default parser
+ eraseFeedback();
+ // now install the custom parser before committing
+ installCustomParser();
super.commit();
+ resetDefaultParser();
+ getEditPart().refresh();
+
}
/**
+ * install the custom parser for the editor
+ */
+ protected void installCustomParser() {
+ if ((parser != null) && getEditPart() instanceof IControlParserForDirectEdit) {
+ ((IControlParserForDirectEdit) getEditPart()).setParser(parser);
+ }
+ }
+
+ /**
+ * reset to default parser
+ */
+ protected void resetDefaultParser() {
+ if (getEditPart() instanceof IControlParserForDirectEdit) {
+ ((IControlParserForDirectEdit) getEditPart()).setParser(null);
+ }
+ }
+
+ /**
* @see org.eclipse.gef.tools.DirectEditManager#bringDown()
*/
protected void bringDown() {
@@ -428,7 +472,7 @@ public class XtextDirectEditManager extends DirectEditManagerEx {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- // Content Assist hack - allow proper cleanup on childen
+ // Content Assist hack - allow proper cleanup on children
// controls
XtextDirectEditManager.super.bringDown();
}
@@ -497,11 +541,15 @@ public class XtextDirectEditManager extends DirectEditManagerEx {
*/
public void show(char initialChar) {
initialString = initialString.append(initialChar);
+
+ ((IControlParserForDirectEdit) getEditPart()).setParser(parser);
show();
if (SWT.getPlatform() != "carbon") { //$NON-NLS-1$
// Set the cell editor text to the initial character
setEditText(initialString.toString());
}
+ ((IControlParserForDirectEdit) getEditPart()).setParser(null);
+
}
/**
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextFakeResourceContext.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextFakeResourceContext.java
index b72daaf822d..608aa52351f 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextFakeResourceContext.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextFakeResourceContext.java
@@ -33,6 +33,7 @@ public class XtextFakeResourceContext {
@Inject
private @Named(Constants.FILE_EXTENSIONS)
String fakeResourceFileExtension;
+
public XtextFakeResourceContext(Injector injector) {
injector.injectMembers(this);
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextStyledTextCellEditor.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextStyledTextCellEditor.java
index aa7795f4812..83b8ea788ab 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextStyledTextCellEditor.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/XtextStyledTextCellEditor.java
@@ -11,25 +11,24 @@
*/
package org.eclipse.papyrus.uml.xtext.integration;
-import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter;
-import org.eclipse.papyrus.uml.xtext.integration.core.IXtextFakeContextResourcesProvider;
import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProvider;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementAdapter.IContextElementProviderWithInit;
+import org.eclipse.papyrus.uml.xtext.integration.core.IXtextFakeContextResourcesProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.xtext.ui.editor.XtextEditor;
import com.google.inject.Injector;
@@ -50,11 +49,16 @@ import com.google.inject.Injector;
*/
public class XtextStyledTextCellEditor extends StyledTextCellEditor {
- private Injector injector;
- private StyledTextXtextAdapter xtextAdapter;
- private IXtextFakeContextResourcesProvider contextFakeResourceProvider;
- private IContextElementProvider provider;
-
+ public static final String GTK = "gtk"; //$NON-NLS-1$
+
+ protected Injector injector;
+ protected StyledTextXtextAdapter xtextAdapter;
+ protected StyledText styledText;
+
+ protected IXtextFakeContextResourcesProvider contextFakeResourceProvider;
+ protected IContextElementProvider provider;
+ protected Shell startingShell;
+
public XtextStyledTextCellEditor(int style, Injector injector,
IXtextFakeContextResourcesProvider contextFakeResourceProvider) {
this(style, injector);
@@ -79,29 +83,29 @@ public class XtextStyledTextCellEditor extends StyledTextCellEditor {
*/
@Override
protected Control createControl(Composite parent) {
- StyledText styledText = (StyledText) super.createControl(parent);
- styledText.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- XtextStyledTextCellEditor.this.focusLost();
- }
- });
+ styledText = (StyledText) super.createControl(parent);
+ // a focus lost listener is already registered by the super-class, so no need to do this
+
+ startingShell = styledText.getDisplay().getActiveShell();
// adapt to xtext
xtextAdapter = new StyledTextXtextAdapter(injector,
contextFakeResourceProvider == null ? IXtextFakeContextResourcesProvider.NULL_CONTEXT_PROVIDER
: contextFakeResourceProvider);
xtextAdapter.adapt(styledText);
+ // adapt has created a completion proposal adapter. Retrieve this instead of creating a new one.
+ completionProposalAdapter = xtextAdapter.getCompletionProposalAdapter();
+
if (provider != null) {
xtextAdapter.getFakeResourceContext().getFakeResource().eAdapters()
.add(new ContextElementAdapter(provider));
+ if (provider instanceof IContextElementProviderWithInit) {
+ // update resource, if required by text editor
+ ((IContextElementProviderWithInit) provider).initResource(
+ xtextAdapter.getFakeResourceContext().getFakeResource());
+ }
}
-
- // configure content assist
- final IContentAssistant contentAssistant = xtextAdapter.getContentAssistant();
-
- completionProposalAdapter = new CompletionProposalAdapter(styledText, contentAssistant, KeyStroke.getInstance(
- SWT.CTRL, SWT.SPACE), null);
-
+
// This listener notifies the modification, when text is selected via
// proposal. A ModifyEvent is not thrown by the StyledText in this case.
xtextAdapter.getXtextSourceviewer().addTextListener(new ITextListener() {
@@ -123,14 +127,16 @@ public class XtextStyledTextCellEditor extends StyledTextCellEditor {
}
});
}
- styledText.addListener(3005, new Listener() {
+ final Listener cancelListener = new Listener() {
public void handleEvent(Event event) {
if (event.character == '\u001b' // ESC
- && !completionProposalAdapter.isProposalPopupOpen()) {
+ && !completionProposalAdapter.delayedIsPopupOpen()) {
XtextStyledTextCellEditor.this.fireCancelEditor();
}
}
- });
+ };
+
+ styledText.addListener(3005, cancelListener);
return styledText;
}
@@ -145,7 +151,7 @@ public class XtextStyledTextCellEditor extends StyledTextCellEditor {
@Override
protected void doSetValue(Object value) {
super.doSetValue(value);
- // Reset the undo manager to prevend deletion of complete text if the
+ // Reset the undo manager to prevent deletion of complete text if the
// user hits ctrl+z after cell editor opens
xtextAdapter.sourceviewer.getUndoManager().reset();
}
@@ -177,7 +183,8 @@ public class XtextStyledTextCellEditor extends StyledTextCellEditor {
// in gtk, we need this flag to let one focus lost event pass. See
// focusLost() for details.
- private boolean ignoreNextFocusLost = false;
+ boolean ignoreNextFocusLost = false;
+
protected CompletionProposalAdapter completionProposalAdapter;
/*
@@ -186,9 +193,21 @@ public class XtextStyledTextCellEditor extends StyledTextCellEditor {
*/
@Override
protected void focusLost() {
- if (SWT.getPlatform().equals("gtk")) {
+ if (completionProposalAdapter == null) {
+ super.focusLost();
+ return;
+ }
+ if (SWT.getPlatform().equals(GTK)) {
if (ignoreNextFocusLost) {
ignoreNextFocusLost = false;
+ // styledText has lost focus, set it again.
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ styledText.setFocus();
+ }
+ });
+
return;
}
@@ -198,8 +217,9 @@ public class XtextStyledTextCellEditor extends StyledTextCellEditor {
}
}
- if (!completionProposalAdapter.isProposalPopupOpen())
+ if (!completionProposalAdapter.isProposalPopupOpen()) {
super.focusLost();
+ }
}
@Override
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/src/org/eclipse/papyrus/uml/xtext/integration/validation/ExistsAnnotationConstraint.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/src/org/eclipse/papyrus/uml/xtext/integration/validation/ExistsAnnotationConstraint.java
index 008439089cb..091aa7bbf2e 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/src/org/eclipse/papyrus/uml/xtext/integration/validation/ExistsAnnotationConstraint.java
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.validation/src/org/eclipse/papyrus/uml/xtext/integration/validation/ExistsAnnotationConstraint.java
@@ -13,7 +13,7 @@ import org.eclipse.uml2.uml.Element;
* the xtext string couldn't be parsed and is out of sync with the UML model.
*
*
- * @author Markus Mühlbrandt
+ * @author Markus M�hlbrandt
*
*/
public class ExistsAnnotationConstraint extends AbstractModelConstraint {
@@ -30,7 +30,7 @@ public class ExistsAnnotationConstraint extends AbstractModelConstraint {
text = InvalidStringUtil.getTextualRepresentation(element);
}
- if (text != null && !"".equals(text)) {
+ if (text != null && !"".equals(text)) { //$NON-NLS-1$
return ctx.createFailureStatus(eObj.eClass().getName());
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java
index a4841993af4..61581ca5d52 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java
@@ -47,6 +47,7 @@ public class DirectEditorEditingSupport extends EditingSupport {
ICustomDirectEditorConfiguration configuration = getConfigurationAE(element);
EObject semanticObject = EMFHelper.getEObject(element);
Composite parent = (Composite) getViewer().getControl();
+ configuration.preEditAction(semanticObject);
return configuration.createCellEditor(parent, semanticObject);
}
@@ -112,4 +113,4 @@ public class DirectEditorEditingSupport extends EditingSupport {
}
return null;
}
-} \ No newline at end of file
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
index 13201dff933..dfe453e837b 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
@@ -927,10 +927,17 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
}
if(r != null) {
- ResourceSet rs = r.getResourceSet();
+ final ResourceSet rs = r.getResourceSet();
+ final Resource resource = r;
if(rs instanceof ModelSet && AdditionalResourcesModel.isAdditionalResource((ModelSet)rs, r.getURI())) {
- commonViewer.expandToLevel(new ReferencableMatchingItem(rs), 1);
- commonViewer.expandToLevel(new ReferencableMatchingItem(r), 1);
+ commonViewer.getControl().getDisplay().syncExec(new Runnable() {
+
+ public void run() {
+ commonViewer.expandToLevel(new ReferencableMatchingItem(rs), 1);
+ commonViewer.expandToLevel(new ReferencableMatchingItem(resource), 1);
+ }
+ });
+
}
}
@@ -1003,12 +1010,17 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
* @param viewer
* The ComonViewer to select it in
*/
- public static void reveal(ISelection selection, CommonViewer viewer) {
+ public static void reveal(final ISelection selection, final CommonViewer viewer) {
if(selection instanceof IStructuredSelection) {
IStructuredSelection structured = (IStructuredSelection)selection;
reveal(Lists.newArrayList(structured.iterator()), viewer);
} else {
- viewer.setSelection(selection);
+ viewer.getControl().getDisplay().syncExec(new Runnable() {
+
+ public void run() {
+ viewer.setSelection(selection);
+ }
+ });
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java
index 8348119ae07..a28069085ec 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java
@@ -1,18 +1,18 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
* Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
* Christian W. Damus (CEA) - Refactoring package/profile import/apply UI for CDO
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.handler;
@@ -37,27 +37,27 @@ import org.eclipse.ui.handlers.HandlerUtil;
/**
* <pre>
- *
+ *
* This abstract command handler manages:
* - current selection in order to build a list of the selected {@link EObject}
* - execute the command (returned by children) in Papyrus {@link TransactionalEditingDomain}
* - calculate the command enablement and visibility regarding the command executability
* (the command is now shown in menu if not executable).
- *
+ *
* </pre>
*/
public abstract class AbstractCommandHandler extends AbstractModelExplorerHandler {
private List<?> selection = Collections.EMPTY_LIST;
-
+
/**
* <pre>
- *
+ *
* Returns the command to execute (to be implemented
* in children implementing this class)
- *
+ *
* @return the command to execute
- *
+ *
* </pre>
*/
protected abstract Command getCommand();
@@ -65,15 +65,15 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle
protected List<?> getSelection() {
return selection;
}
-
+
/**
* <pre>
* Get the selected element, the first selected element if several are selected or null
* if no selection or the selection is not an {@link EObject}.
- *
+ *
* @return selected {@link EObject} or null
* </pre>
- *
+ *
*/
protected EObject getSelectedElement() {
EObject eObject = null;
@@ -82,11 +82,10 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle
List<?> selection = getSelection();
// Treat non-null selected object (try to adapt and return EObject)
- if (!selection.isEmpty()) {
+ if(!selection.isEmpty()) {
// Get first element if the selection is an IStructuredSelection
- Object first = selection.get(0);
-
+ Object first = selection.get(0);
EObject businessObject = EMFHelper.getEObject(first);
if(businessObject != null) {
@@ -101,13 +100,13 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle
* <pre>
* Parse current selection and extract the list of {@link EObject} from
* this selection.
- *
+ *
* This also tries to adapt selected element into {@link EObject}
* (for example to get the {@link EObject} from a selection in the ModelExplorer).
- *
+ *
* @return a list of currently selected {@link EObject}
* </pre>
- *
+ *
*/
protected List<EObject> getSelectedElements() {
@@ -117,13 +116,13 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle
Collection<?> selection = getSelection();
// Treat non-null selected object (try to adapt and return EObject)
- if (!selection.isEmpty()) {
+ if(!selection.isEmpty()) {
// Parse current selection
- for (Object current : selection) {
+ for(Object current : selection) {
// Adapt current selection to EObject
EObject selectedEObject = EMFHelper.getEObject(current);
- if (selectedEObject != null) {
+ if(selectedEObject != null) {
//we avoid to add null element in the list!
selectedEObjects.add(selectedEObject);
}
@@ -134,9 +133,9 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle
}
/**
- *
+ *
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
+ *
* @param event
* @return null
* @throws ExecutionException
@@ -144,13 +143,9 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
ISelection selection = HandlerUtil.getCurrentSelection(event);
- this.selection = (selection instanceof IStructuredSelection)
- ? ((IStructuredSelection) selection).toList()
- : Collections.EMPTY_LIST;
-
- ServiceUtilsForHandlers.getInstance()
- .getTransactionalEditingDomain(event).getCommandStack()
- .execute(getCommand());
+ this.selection = (selection instanceof IStructuredSelection) ? ((IStructuredSelection)selection).toList() : Collections.EMPTY_LIST;
+
+ ServiceUtilsForHandlers.getInstance().getTransactionalEditingDomain(event).getCommandStack().execute(getCommand());
} catch (ServiceException e) {
Activator.log.error("Unexpected error while executing command.", e); //$NON-NLS-1$
} finally {
@@ -163,24 +158,22 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle
protected boolean computeEnabled() {
boolean result = false;
-
+
Command command = getCommand();
- if (command != null) {
+ if(command != null) {
result = getCommand().canExecute();
command.dispose();
}
-
+
return result;
}
@Override
public void setEnabled(Object evaluationContext) {
- if (evaluationContext instanceof IEvaluationContext) {
- Object selection = ((IEvaluationContext) evaluationContext).getDefaultVariable();
- if (selection instanceof Collection<?>) {
- this.selection = (selection instanceof List<?>)
- ? (List<?>) selection
- : new java.util.ArrayList<Object>((Collection<?>) selection);
+ if(evaluationContext instanceof IEvaluationContext) {
+ Object selection = ((IEvaluationContext)evaluationContext).getDefaultVariable();
+ if(selection instanceof Collection<?>) {
+ this.selection = (selection instanceof List<?>) ? (List<?>)selection : new java.util.ArrayList<Object>((Collection<?>)selection);
setBaseEnabled(computeEnabled());
this.selection = Collections.EMPTY_LIST;
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/EcorePropertyEditorFactory.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/EcorePropertyEditorFactory.java
index f9da5ab4928..e17e7831e6b 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/EcorePropertyEditorFactory.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/EcorePropertyEditorFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.views.properties.creation;
@@ -16,17 +18,23 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.emf.dialog.NestedEditingDialogContext;
import org.eclipse.papyrus.infra.emf.utils.EClassNameComparator;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.views.properties.Activator;
+import org.eclipse.papyrus.views.properties.contexts.View;
import org.eclipse.papyrus.views.properties.messages.Messages;
import org.eclipse.papyrus.views.properties.providers.CreateInFeatureContentProvider;
import org.eclipse.swt.SWT;
@@ -185,17 +193,67 @@ public class EcorePropertyEditorFactory extends PropertyEditorFactory {
* {@inheritDoc}
*/
@Override
- public Object createObject(Control widget) {
+ public final Object createObject(Control widget, Object context) {
+ Object result;
+
+ final ResourceSet previous = NestedEditingDialogContext.getInstance().push(context);
+
+ try {
+ result = doCreateObject(widget, context);
+ } finally {
+ NestedEditingDialogContext.getInstance().pop(previous);
+ }
+
+ return result;
+ }
+
+ protected Object doCreateObject(Control widget, Object context) {
Object instance;
+
if(referenceIn.isContainment()) {
instance = simpleCreateObject(widget);
} else {
instance = createObjectInDifferentContainer(widget);
}
- return super.createObject(widget, instance);
+ return createObject(widget, context, instance);
}
+ @Override
+ protected Object doEdit(final Control widget, final Object source, final Set<View> views, final String dialogTitle) {
+ Object result;
+
+ try {
+ NestedEditingDialogContext.getInstance().enter();
+ try {
+ result = getOperationExecutor(source).execute(new Callable<Object>() {
+ public Object call() throws Exception {
+ return basicDoEdit(widget, source, views, dialogTitle);
+ }
+ }, dialogTitle);
+ } finally {
+ NestedEditingDialogContext.getInstance().exit();
+ }
+ } catch (OperationCanceledException e) {
+ if(!NestedEditingDialogContext.getInstance().isNested()) {
+ // Propagate to the caller if not in a nested edit dialog
+ throw e;
+ }
+ result = null;
+ }
+
+ return result;
+ }
+
+ protected final Object basicDoEdit(Control widget, Object source, Set<View> views, String dialogTitle) {
+ return super.doEdit(widget, source, views, dialogTitle);
+ }
+
+ @Override
+ protected void handleEditCancelled(Control widget, Object source) {
+ throw new OperationCanceledException();
+ }
+
protected EObject simpleCreateObject(Control widget) {
EClass eClass = chooseEClass(widget);
if(eClass == null) {
@@ -212,7 +270,14 @@ public class EcorePropertyEditorFactory extends PropertyEditorFactory {
return null;
}
- containerContentProvider.inputChanged(null, null, instance);
+ // Try to get the current resource set for a wide scope of places to put a new element
+ Object containerInput = NestedEditingDialogContext.getInstance().getResourceSet();
+ if (containerInput == null) {
+ // Only have the object that we've created for context
+ containerInput = instance;
+ }
+
+ containerContentProvider.inputChanged(null, null, containerInput);
referenceContentProvider.setType(instance.eClass());
CreateInDialog dialog = new CreateInDialog(widget.getShell(), instance);
dialog.setProviders(containerContentProvider, referenceContentProvider, containerLabelProvider, referenceLabelProvider);
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/PropertyEditorFactory.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/PropertyEditorFactory.java
index 4e86109ca2b..93eb38b7ef1 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/PropertyEditorFactory.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/creation/PropertyEditorFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,15 +8,20 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
*****************************************************************************/
package org.eclipse.papyrus.views.properties.creation;
import java.util.Collection;
import java.util.Set;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor;
import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.views.properties.contexts.View;
import org.eclipse.papyrus.views.properties.messages.Messages;
@@ -51,15 +56,18 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
* Return a null value. Implementors should override when object creation
* needs to be supported. Implementors may rely on {@link #createObject(Control, Object)}
*
- * @see org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory#createObject(org.eclipse.swt.widgets.Control)
- * @see #createObject(org.eclipse.swt.widgets.Control, Object)
- *
* @param widget
* The widget from which this method is called. May be used to retrieve the current shell
+ * @param context
+ * The object being edited, in which context the new object is to be created and which will as a result have a reference to the new object.
+ * If there is no context object (creation of a free-floating object) or it cannot be determined, this may be {@code null}
* @return
* The newly created object
+ *
+ * @see ReferenceValueFactory#createObject(Control, Object)
+ * @see #createObject(Control, Object, Object)
*/
- public Object createObject(Control widget) {
+ public Object createObject(Control widget, Object context) {
return null;
}
@@ -72,12 +80,15 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
*
* @param widget
* The widget used to open the dialog
+ * @param context
+ * The object being edited, in which context the new object is to be created and which will as a result have a reference to the new object.
+ * If there is no context object (creation of a free-floating object) or it cannot be determined, this may be {@code null}
* @param source
* The created EObject. If null, nothing will happen
* @return
* The source EObject, which potential in-place modifications
*/
- protected Object createObject(Control widget, Object source) {
+ protected Object createObject(Control widget, Object context, Object source) {
if(source == null) {
return null;
}
@@ -87,15 +98,7 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
ViewConstraintEngine constraintEngine = ConfigurationManager.getInstance().getConstraintEngine();
Set<View> views = constraintEngine.getViews(selection);
if(!views.isEmpty()) {
- EditionDialog dialog = new EditionDialog(widget.getShell(), true);
- dialog.setViews(views);
- dialog.setInput(source);
- dialog.setTitle(getCreationDialogTitle());
-
- int result = dialog.open();
- if(result != Window.OK) {
- return null;
- }
+ return doEdit(widget, source, views, getCreationDialogTitle());
}
return source;
@@ -134,17 +137,30 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
Set<View> views = constraintEngine.getViews(selection);
if(!views.isEmpty()) {
- EditionDialog dialog = new EditionDialog(widget.getShell());
- dialog.setTitle(getEditionDialogTitle(source));
- dialog.setViews(views);
- dialog.setInput(source);
-
- dialog.open();
+ return doEdit(widget, source, views, getEditionDialogTitle(source));
}
return source;
}
+ protected Object doEdit(Control widget, Object source, Set<View> views, String dialogTitle) {
+ EditionDialog dialog = new EditionDialog(widget.getShell(), true);
+ dialog.setTitle(dialogTitle);
+ dialog.setViews(views);
+ dialog.setInput(source);
+
+ if (dialog.open() != Window.OK) {
+ handleEditCancelled(widget, source);
+ return null;
+ }
+
+ return source;
+ }
+
+ protected void handleEditCancelled(Control widget, Object source) {
+ // Pass
+ }
+
/**
* The standard Property Editor Factory cannot instantiate new objects.
* However, subclasses may override this method to return true if they
@@ -173,4 +189,25 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
public String getEditionDialogTitle(Object objectToEdit) {
return "Edit an element";
}
+
+ /**
+ * Obtains the most appropriate operation executor for the object being edited.
+ *
+ * @param context the object being edited
+ * @return the executor to use to run operations (never {@code null})
+ */
+ public IAtomicOperationExecutor getOperationExecutor(Object context) {
+ IAtomicOperationExecutor result;
+ if(context instanceof IAdaptable) {
+ result = (IAtomicOperationExecutor)((IAdaptable)context).getAdapter(IAtomicOperationExecutor.class);
+ } else {
+ result = (IAtomicOperationExecutor)Platform.getAdapterManager().getAdapter(context, IAtomicOperationExecutor.class);
+ }
+
+ if (result == null) {
+ result = IAtomicOperationExecutor.DEFAULT;
+ }
+
+ return result;
+ }
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java
index 9aa30330743..beca09c8205 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AnnotationModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.views.properties.modelelement;
@@ -15,6 +17,7 @@ import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.emf.databinding.AnnotationObservableValue;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
/**
* A ModelElement for handling EAnnotations
@@ -63,4 +66,8 @@ public class AnnotationModelElement extends AbstractModelElement {
return new AnnotationObservableValue(source, domain, annotationName, propertyPath);
}
+ @Override
+ public boolean isEditable(String propertyPath) {
+ return !EMFHelper.isReadOnly(source);
+ }
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
index cf40594c4ef..bbe0b763493 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,9 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ * Christian W. Damus (CEA) - bug 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.views.properties.modelelement;
@@ -27,10 +30,12 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.databinding.EMFObservableList;
import org.eclipse.papyrus.infra.emf.databinding.EMFObservableValue;
+import org.eclipse.papyrus.infra.emf.dialog.NestedEditingDialogContext;
import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
@@ -199,7 +204,10 @@ public class EMFModelElement extends AbstractModelElement {
@Override
public ILabelProvider getLabelProvider(String propertyPath) {
try {
- return ServiceUtilsForEObject.getInstance().getServiceRegistry(source).getService(LabelProviderService.class).getLabelProvider();
+ LabelProviderService lpSvc = (source.eResource() != null) //
+ ? ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, source) //
+ : ServiceUtilsForResourceSet.getInstance().getService(LabelProviderService.class, NestedEditingDialogContext.getInstance().getResourceSet());
+ return lpSvc.getLabelProvider();
} catch (ServiceException ex) {
Activator.log.error(ex);
return new EMFLabelProvider();
@@ -235,14 +243,22 @@ public class EMFModelElement extends AbstractModelElement {
}
@Override
- public boolean isEditable(String propertyPath) {
+ public final boolean isEditable(String propertyPath) {
+ return isFeatureEditable(propertyPath) && isElementEditable();
+ }
+
+ protected boolean isFeatureEditable(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
if(feature == null) {
return false;
}
- return feature.isChangeable() && !EMFHelper.isReadOnly(source);
+ return feature.isChangeable();
}
-
+
+ protected boolean isElementEditable() {
+ return !EMFHelper.isReadOnly(source);
+ }
+
@Override
public boolean forceRefresh(String propertyPath) {
EStructuralFeature feature = getFeature(propertyPath);
diff --git a/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly-tests/build.rmap b/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly-tests/build.rmap
index 7b0e28165a2..b4a4b4b03fa 100644
--- a/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly-tests/build.rmap
+++ b/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly-tests/build.rmap
@@ -174,7 +174,7 @@
<!-- M2T Acceleo -->
<rm:provider componentTypes="eclipse.feature,osgi.bundle" mutable="false" readerType="p2" source="false">
<!-- updateFrom("M2T ACCELEO",0) -->
- <rm:uri format="{0}/modeling/m2t/acceleo/updates/milestones/3.5/S201401281458">
+ <rm:uri format="{0}/acceleo/updates/milestones/3.5/S201401281458">
<bc:propertyRef key="eclipse.downloads"/>
</rm:uri>
</rm:provider>
diff --git a/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly/build.rmap b/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly/build.rmap
index db3c69dd59a..83fe59474d2 100644
--- a/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly/build.rmap
+++ b/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-extra-nightly/build.rmap
@@ -295,7 +295,7 @@
<!-- M2T Acceleo -->
<rm:provider componentTypes="eclipse.feature,osgi.bundle" mutable="false" readerType="p2" source="false">
<!-- updateFrom("M2T ACCELEO",0) -->
- <rm:uri format="{0}/modeling/m2t/acceleo/updates/milestones/3.5/S201401281458">
+ <rm:uri format="{0}/acceleo/updates/milestones/3.5/S201401281458">
<bc:propertyRef key="eclipse.downloads"/>
</rm:uri>
</rm:provider>
diff --git a/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly-tests/build.rmap b/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly-tests/build.rmap
index a18e8e3c18a..5fab719dcbb 100644
--- a/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly-tests/build.rmap
+++ b/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly-tests/build.rmap
@@ -148,6 +148,13 @@
</rm:provider>
<rm:provider componentTypes="osgi.bundle" readerType="local">
+ <rm:uri format="{0}/tests/junit/plugins/infra/emf/{1}">
+ <bc:propertyRef key="local.repository"/>
+ <bc:propertyRef key="buckminster.component"/>
+ </rm:uri>
+ </rm:provider>
+
+ <rm:provider componentTypes="osgi.bundle" readerType="local">
<rm:uri format="{0}/tests/junit/plugins/junit/{1}">
<bc:propertyRef key="local.repository"/>
<bc:propertyRef key="buckminster.component"/>
@@ -239,7 +246,7 @@
<!-- M2T Acceleo -->
<rm:provider componentTypes="eclipse.feature,osgi.bundle" mutable="false" readerType="p2" source="false">
<!-- updateFrom("M2T ACCELEO",0) -->
- <rm:uri format="{0}/modeling/m2t/acceleo/updates/milestones/3.5/S201401281458">
+ <rm:uri format="{0}/acceleo/updates/milestones/3.5/S201401281458">
<bc:propertyRef key="eclipse.downloads"/>
</rm:uri>
</rm:provider>
diff --git a/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly/build.rmap b/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly/build.rmap
index ea0c23d7706..6ddb76d8d30 100644
--- a/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly/build.rmap
+++ b/releng/org.eclipse.mdt.papyrus.releng.buckminster/papyrus-trunk-nightly/build.rmap
@@ -436,7 +436,7 @@
<!-- M2T Acceleo -->
<rm:provider componentTypes="eclipse.feature,osgi.bundle" mutable="false" readerType="p2" source="false">
<!-- updateFrom("M2T ACCELEO",0) -->
- <rm:uri format="{0}/modeling/m2t/acceleo/updates/milestones/3.5/S201401281458">
+ <rm:uri format="{0}/acceleo/updates/milestones/3.5/S201401281458">
<bc:propertyRef key="eclipse.downloads"/>
</rm:uri>
</rm:provider>
diff --git a/releng/rcp/org.eclipse.papyrus.rcp/splash.bmp b/releng/rcp/org.eclipse.papyrus.rcp/splash.bmp
index 3a333acce30..21d73ab3223 100644
--- a/releng/rcp/org.eclipse.papyrus.rcp/splash.bmp
+++ b/releng/rcp/org.eclipse.papyrus.rcp/splash.bmp
Binary files differ
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependencies.zip b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependencies.zip
index e73b4a8ec53..fab7fb4077c 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependencies.zip
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependencies.zip
Binary files differ
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependents.zip b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependents.zip
index 616ca0c1597..38a31400c1b 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependents.zip
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/has_dependents.zip
Binary files differ
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/isolated.zip b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/isolated.zip
index f8cca1b5c21..d7988d396f1 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/isolated.zip
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.core.tests/resources/projects/isolated.zip
Binary files differ
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.di b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.di
index 7035d603909..2ea7222c067 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.di
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.di
@@ -1,211 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:org.eclipse.papyrus.infra.table.instance.papyrustableinstance="http://www.eclipse.org/Papyrus/Table/0.8.0/papyrustableinstance" xmlns:tableinstance="http://www.eclipse.org/EMF_Facet/ModelCellEditor/0.1.0/tableinstance" xmlns:tableinstance2="http://www.eclipse.org/EMF_Facet/Table/0.1.0/tableinstance2">
- <di:SashWindowsMngr>
- <pageList>
- <availablePage>
- <emfPageIdentifier href="model.notation#_PIsWgHFlEeK8x7zQKtpUFg"/>
- </availablePage>
- <availablePage emfPageIdentifier="/1"/>
- <availablePage>
- <emfPageIdentifier href="model.notation#_PIuywHFlEeK8x7zQKtpUFg"/>
- </availablePage>
- <availablePage>
- <emfPageIdentifier href="model.notation#_PIxPAHFlEeK8x7zQKtpUFg"/>
- </availablePage>
- <availablePage>
- <emfPageIdentifier href="model.notation#_PIzrQHFlEeK8x7zQKtpUFg"/>
- </availablePage>
- </pageList>
- <sashModel currentSelection="/0/@sashModel/@windows.0/@children.0">
- <windows>
- <children xsi:type="di:TabFolder">
- <children>
- <emfPageIdentifier href="model.notation#_PIsWgHFlEeK8x7zQKtpUFg"/>
- </children>
- <children emfPageIdentifier="/1"/>
- <children>
- <emfPageIdentifier href="model.notation#_PIuywHFlEeK8x7zQKtpUFg"/>
- </children>
- <children>
- <emfPageIdentifier href="model.notation#_PIxPAHFlEeK8x7zQKtpUFg"/>
- </children>
- <children>
- <emfPageIdentifier href="model.notation#_PIzrQHFlEeK8x7zQKtpUFg"/>
- </children>
- </children>
- </windows>
- </sashModel>
- </di:SashWindowsMngr>
- <org.eclipse.papyrus.infra.table.instance.papyrustableinstance:PapyrusTableInstance name="DefaultTable" table="/2"/>
- <tableinstance2:TableInstance2 description="Table Description">
- <tableConfiguration href="platform:/plugin/org.eclipse.papyrus.uml.table.default/resources/default.tableconfiguration2#/"/>
- <customizations href="emffacet:/customization/UMLPapyrusDefaultBrowserCustomization#/"/>
- <customizations href="#/2/@localCustomizations.1"/>
- <customizations href="#/2/@localCustomizations.0"/>
- <context href="model.uml#_PI4jwHFlEeK8x7zQKtpUFg"/>
- <columns xsi:type="tableinstance:DefaultLabelColumn"/>
- <columns xsi:type="tableinstance:MetaClassColumn"/>
- <columns xsi:type="tableinstance:EContainerColumn"/>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/emf/2002/Ecore#//EModelElement/eAnnotations"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Element/ownedComment"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Element/ownedElement"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Element/owner"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/clientDependency"/>
- </columns>
- <columns xsi:type="tableinstance:AttributeColumn">
- <attribute href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/name"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/nameExpression"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/namespace"/>
- </columns>
- <columns xsi:type="tableinstance:AttributeColumn">
- <attribute href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/qualifiedName"/>
- </columns>
- <columns xsi:type="tableinstance:AttributeColumn">
- <attribute href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement/visibility"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Namespace/elementImport"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Namespace/packageImport"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Namespace/ownedRule"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Namespace/ownedMember"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Namespace/importedMember"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Namespace/member"/>
- </columns>
- <columns xsi:type="tableinstance:AttributeColumn">
- <attribute href="http://www.eclipse.org/uml2/4.0.0/UML#//RedefinableElement/isLeaf"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//RedefinableElement/redefinedElement"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//RedefinableElement/redefinitionContext"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//ParameterableElement/owningTemplateParameter"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//ParameterableElement/templateParameter"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Type/package"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//TemplateableElement/ownedTemplateSignature"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//TemplateableElement/templateBinding"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/feature"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/attribute"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/collaborationUse"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/general"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/generalization"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/powertypeExtent"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/inheritedMember"/>
- </columns>
- <columns xsi:type="tableinstance:AttributeColumn">
- <attribute href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/isAbstract"/>
- </columns>
- <columns xsi:type="tableinstance:AttributeColumn">
- <attribute href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/isFinalSpecialization"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/ownedUseCase"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/useCase"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/redefinedClassifier"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/representation"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier/substitution"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedConnector"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/part"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/role"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//EncapsulatedClassifier/ownedPort"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//BehavioredClassifier/classifierBehavior"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//BehavioredClassifier/interfaceRealization"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//BehavioredClassifier/ownedBehavior"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/ownedOperation"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/extension"/>
- </columns>
- <columns xsi:type="tableinstance:AttributeColumn">
- <attribute href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/isActive"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/nestedClassifier"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/ownedReception"/>
- </columns>
- <columns xsi:type="tableinstance:ReferenceColumn">
- <reference href="http://www.eclipse.org/uml2/4.0.0/UML#//Class/superClass"/>
- </columns>
- <rows>
- <element href="model.uml#_PI4jwnFlEeK8x7zQKtpUFg"/>
- </rows>
- <localCustomizations metamodelURI="http://www.eclipse.org/emf/2002/Ecore"/>
- <localCustomizations metamodelURI="http://www.eclipse.org/uml2/4.0.0/UML"/>
- </tableinstance2:TableInstance2>
-</xmi:XMI>
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <di:SashWindowsMngr>
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="model.notation#_PIsWgHFlEeK8x7zQKtpUFg"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="model.notation#_PIuywHFlEeK8x7zQKtpUFg"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="model.notation#_PIxPAHFlEeK8x7zQKtpUFg"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="model.notation#_PIzrQHFlEeK8x7zQKtpUFg"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="model.notation#_0TYNgJoYEeOBraiw2Bz-fA"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="/0/@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="model.notation#_PIsWgHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children>
+ <emfPageIdentifier href="model.notation#_PIuywHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children>
+ <emfPageIdentifier href="model.notation#_PIxPAHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children>
+ <emfPageIdentifier href="model.notation#_PIzrQHFlEeK8x7zQKtpUFg"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+ </di:SashWindowsMngr>
+</xmi:XMI>
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.notation b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.notation
index 9abe6da081d..2bc92d2869e 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.notation
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.notation
@@ -1,854 +1,865 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML">
- <notation:Diagram xmi:id="_PIsWgHFlEeK8x7zQKtpUFg" type="PapyrusUMLClassDiagram" name="classes" measurementUnit="Pixel">
- <children xmi:type="notation:Shape" xmi:id="_PIsWgXFlEeK8x7zQKtpUFg" type="2008">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIsWgnFlEeK8x7zQKtpUFg" type="5029"/>
- <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWg3FlEeK8x7zQKtpUFg" type="7017">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWhHFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWhXFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
- </eAnnotations>
- <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWhnFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWh3FlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWiHFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWiXFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWinFlEeK8x7zQKtpUFg" type="7018">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWi3FlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWjHFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
- </eAnnotations>
- <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWjXFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWjnFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWj3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWkHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWkXFlEeK8x7zQKtpUFg" type="7019">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWknFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWk3FlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
- </eAnnotations>
- <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWlHFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWlXFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWlnFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWl3FlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:Class" href="model.uml#_PI4jwnFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWmHFlEeK8x7zQKtpUFg" x="63" y="18"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIsWmXFlEeK8x7zQKtpUFg" type="2008">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIsWmnFlEeK8x7zQKtpUFg" type="5029"/>
- <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWm3FlEeK8x7zQKtpUFg" type="7017">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWnHFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWnXFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
- </eAnnotations>
- <children xmi:type="notation:Shape" xmi:id="_PIsWnnFlEeK8x7zQKtpUFg" type="3012">
- <element xmi:type="uml:Property" href="model.uml#_PI4kH3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWn3FlEeK8x7zQKtpUFg"/>
- </children>
- <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWoHFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWoXFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWonFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWo3FlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWpHFlEeK8x7zQKtpUFg" type="7018">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWpXFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWpnFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
- </eAnnotations>
- <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWp3FlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWqHFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWqXFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWqnFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWq3FlEeK8x7zQKtpUFg" type="7019">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWrHFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWrXFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
- </eAnnotations>
- <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWrnFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWr3FlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWsHFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWsXFlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:Class" href="model.uml#_PI4kHnFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWsnFlEeK8x7zQKtpUFg" x="270" y="18"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_SFbYAIQqEeKq_f8GS5X7FQ" type="2009">
- <children xmi:type="notation:DecorationNode" xmi:id="_SFcmIIQqEeKq_f8GS5X7FQ" type="5032"/>
- <element xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SFbYAYQqEeKq_f8GS5X7FQ" x="171" y="198"/>
- </children>
- <styles xmi:type="notation:DiagramStyle" xmi:id="_PIsWs3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Model" href="model.uml#_PI4jwHFlEeK8x7zQKtpUFg"/>
- <edges xmi:type="notation:Connector" xmi:id="_PIsWtHFlEeK8x7zQKtpUFg" type="4001" source="_PIsWgXFlEeK8x7zQKtpUFg" target="_PIsWmXFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIsWtXFlEeK8x7zQKtpUFg" type="6001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWtnFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIsWt3FlEeK8x7zQKtpUFg" visible="false" type="6002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWuHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIsWuXFlEeK8x7zQKtpUFg" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWunFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIsWu3FlEeK8x7zQKtpUFg" type="6005">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWvHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIsWvXFlEeK8x7zQKtpUFg" type="6033">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWvnFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIsWv3FlEeK8x7zQKtpUFg" type="6034">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWwHFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIsWwXFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Association" href="model.uml#_PI4kIHFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIsWwnFlEeK8x7zQKtpUFg" points="[21, -6, -217, -15]$[204, -41, -34, -50]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIsWw3FlEeK8x7zQKtpUFg" id="(0.79,0.39)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_VftGgIQqEeKq_f8GS5X7FQ" type="4002" source="_PIsWmXFlEeK8x7zQKtpUFg" target="_SFbYAIQqEeKq_f8GS5X7FQ">
- <children xmi:type="notation:DecorationNode" xmi:id="_VftGg4QqEeKq_f8GS5X7FQ" type="6007">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_VftGhIQqEeKq_f8GS5X7FQ" y="40"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_VftGgYQqEeKq_f8GS5X7FQ"/>
- <element xmi:type="uml:Generalization" href="model.uml#_VZyEsIQqEeKq_f8GS5X7FQ"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VftGgoQqEeKq_f8GS5X7FQ" points="[-16, 22, 60, -89]$[-70, 102, 6, -9]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VgM1wIQqEeKq_f8GS5X7FQ" id="(0.3482142857142857,0.78)"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VgM1wYQqEeKq_f8GS5X7FQ" id="(0.62,0.18)"/>
- </edges>
- </notation:Diagram>
- <notation:Diagram xmi:id="_PIuywHFlEeK8x7zQKtpUFg" type="PapyrusUMLActivityDiagram" name="lifecycle" measurementUnit="Pixel">
- <children xmi:type="notation:Shape" xmi:id="_PIuywXFlEeK8x7zQKtpUFg" type="2001" fontName="Lucida Grande" fontHeight="11" lineColor="0">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIuywnFlEeK8x7zQKtpUFg" source="ShadowFigure">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIuyw3FlEeK8x7zQKtpUFg" key="ShadowFigure_Value" value="false"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIuyxHFlEeK8x7zQKtpUFg" source="displayNameLabelIcon">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIuyxXFlEeK8x7zQKtpUFg" key="displayNameLabelIcon_value" value="false"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIuyxnFlEeK8x7zQKtpUFg" source="QualifiedName">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIuyx3FlEeK8x7zQKtpUFg" key="QualifiedNameDepth" value="1000"/>
- </eAnnotations>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuyyHFlEeK8x7zQKtpUFg" type="5001"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuyyXFlEeK8x7zQKtpUFg" type="7001">
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIuyynFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIuyy3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuyzHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuyzXFlEeK8x7zQKtpUFg" type="7002">
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIuyznFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIuyz3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy0HFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy0XFlEeK8x7zQKtpUFg" type="7003">
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIuy0nFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIuy03FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy1HFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy1XFlEeK8x7zQKtpUFg" type="7004">
- <children xmi:type="notation:Shape" xmi:id="_PIuy1nFlEeK8x7zQKtpUFg" type="3004">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy13FlEeK8x7zQKtpUFg" type="5080">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuy2HFlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy2XFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:InitialNode" href="model.uml#_PI4j5HFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy2nFlEeK8x7zQKtpUFg" x="89" y="122"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIuy23FlEeK8x7zQKtpUFg" type="3005">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy3HFlEeK8x7zQKtpUFg" type="5081">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuy3XFlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy3nFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ActivityFinalNode" href="model.uml#_PI4j5XFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy33FlEeK8x7zQKtpUFg" x="787" y="186"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIuy4HFlEeK8x7zQKtpUFg" type="3065">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy4XFlEeK8x7zQKtpUFg" type="5117"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy4nFlEeK8x7zQKtpUFg" type="7005">
- <children xmi:type="notation:Shape" xmi:id="_PIuy43FlEeK8x7zQKtpUFg" type="3007">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy5HFlEeK8x7zQKtpUFg" type="5003"/>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy5XFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4jyHFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy5nFlEeK8x7zQKtpUFg" x="30" y="66"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIuy53FlEeK8x7zQKtpUFg" type="3007">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy6HFlEeK8x7zQKtpUFg" type="5003"/>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy6XFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4jyXFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy6nFlEeK8x7zQKtpUFg" x="138" y="66"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIuy63FlEeK8x7zQKtpUFg" type="3038">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy7HFlEeK8x7zQKtpUFg" type="5043">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuy7XFlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy7nFlEeK8x7zQKtpUFg" type="5098">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuy73FlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy8HFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:DecisionNode" href="model.uml#_PI4jynFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy8XFlEeK8x7zQKtpUFg" x="246" y="66"/>
- </children>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy8nFlEeK8x7zQKtpUFg"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy83FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:StructuredActivityNode" href="model.uml#_PI4jx3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy9HFlEeK8x7zQKtpUFg" x="76" y="192" width="280" height="154"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIuy9XFlEeK8x7zQKtpUFg" type="3067">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy9nFlEeK8x7zQKtpUFg" type="5118"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy93FlEeK8x7zQKtpUFg" type="7006">
- <children xmi:type="notation:Shape" xmi:id="_PIuy-HFlEeK8x7zQKtpUFg" type="3007">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuy-XFlEeK8x7zQKtpUFg" type="5003"/>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy-nFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4j5nFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy-3FlEeK8x7zQKtpUFg" x="85" y="52"/>
- </children>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy_HFlEeK8x7zQKtpUFg"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy_XFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ActivityPartition" href="model.uml#_PI4jy3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy_nFlEeK8x7zQKtpUFg" x="391" y="30" width="239" height="148"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIuy_3FlEeK8x7zQKtpUFg" type="3007">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzAHFlEeK8x7zQKtpUFg" type="5003"/>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuzAXFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4j53FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuzAnFlEeK8x7zQKtpUFg" x="497" y="288"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIuzA3FlEeK8x7zQKtpUFg" type="3039">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzBHFlEeK8x7zQKtpUFg" type="5099">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzBXFlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuzBnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:MergeNode" href="model.uml#_PI4j6HFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuzB3FlEeK8x7zQKtpUFg" x="715" y="183"/>
- </children>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuzCHFlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:Activity" href="model.uml#_PI4jxnFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuzCXFlEeK8x7zQKtpUFg"/>
- </children>
- <styles xmi:type="notation:DiagramStyle" xmi:id="_PIuzCnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Activity" href="model.uml#_PI4jxnFlEeK8x7zQKtpUFg"/>
- <edges xmi:type="notation:Connector" xmi:id="_PIuzC3FlEeK8x7zQKtpUFg" type="4004" source="_PIuy1nFlEeK8x7zQKtpUFg" target="_PIuy43FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzDHFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzDXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzDnFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzD3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzEHFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzEXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzEnFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzE3FlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIuzFHFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4jzHFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzFXFlEeK8x7zQKtpUFg" points="[1, 3, -39, -143]$[39, 126, -1, -20]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIuzFnFlEeK8x7zQKtpUFg" id="(0.45,0.8)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIuzF3FlEeK8x7zQKtpUFg" type="4004" source="_PIuy43FlEeK8x7zQKtpUFg" target="_PIuy53FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzGHFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzGXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzGnFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzG3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzHHFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzHXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzHnFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzH3FlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIuzIHFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4jz3FlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzIXFlEeK8x7zQKtpUFg" points="[11, 2, -73, -1]$[88, -17, 4, -20]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIuzInFlEeK8x7zQKtpUFg" id="(0.8428571428571429,0.425)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIuzI3FlEeK8x7zQKtpUFg" type="4004" source="_PIuy53FlEeK8x7zQKtpUFg" target="_PIuy63FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzJHFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzJXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzJnFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzJ3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzKHFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzKXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzKnFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzK3FlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIuzLHFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j0nFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzLXFlEeK8x7zQKtpUFg" points="[35, -4, -48, 1]$[82, 8, -1, 13]"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIuzLnFlEeK8x7zQKtpUFg" type="4004" source="_PIuy63FlEeK8x7zQKtpUFg" target="_PIuy-HFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzL3FlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzMHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzMXFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzMnFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzM3FlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzNHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzNXFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzNnFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIuzN3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j1XFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzOHFlEeK8x7zQKtpUFg" points="[6, -6, -181, 151]$[189, -137, 2, 20]"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIuzOXFlEeK8x7zQKtpUFg" type="4004" source="_PIuy63FlEeK8x7zQKtpUFg" target="_PIuy_3FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzOnFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzO3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzPHFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzPXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzPnFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzP3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzQHFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzQXFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIuzQnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j2HFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzQ3FlEeK8x7zQKtpUFg" points="[13, 2, -195, -27]$[243, 37, 35, 8]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIuzRHFlEeK8x7zQKtpUFg" id="(0.25,0.5)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIuzRXFlEeK8x7zQKtpUFg" type="4004" source="_PIuy_3FlEeK8x7zQKtpUFg" target="_PIuzA3FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzRnFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzR3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzSHFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzSXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzSnFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzS3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzTHFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzTXFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIuzTnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j23FlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzT3FlEeK8x7zQKtpUFg" points="[16, -11, -158, 103]$[174, -114, 0, 0]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIuzUHFlEeK8x7zQKtpUFg" id="(0.7714285714285715,0.6)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIuzUXFlEeK8x7zQKtpUFg" type="4004" source="_PIuy-HFlEeK8x7zQKtpUFg" target="_PIuzA3FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzUnFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzU3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzVHFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzVXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzVnFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzV3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIuzWHFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzWXFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIuzWnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j3nFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzW3FlEeK8x7zQKtpUFg" points="[35, 12, -174, -64]$[208, 62, -1, -14]"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIvZ0HFlEeK8x7zQKtpUFg" type="4004" source="_PIuzA3FlEeK8x7zQKtpUFg" target="_PIuy23FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIvZ0XFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIvZ0nFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIvZ03FlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIvZ1HFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIvZ1XFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIvZ1nFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIvZ13FlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIvZ2HFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIvZ2XFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j4XFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIvZ2nFlEeK8x7zQKtpUFg" points="[7, -4, -65, -2]$[71, -12, -1, -10]"/>
- </edges>
- </notation:Diagram>
- <notation:Diagram xmi:id="_PIxPAHFlEeK8x7zQKtpUFg" type="PapyrusUMLStateMachineDiagram" name="fsm" measurementUnit="Pixel">
- <children xmi:type="notation:Shape" xmi:id="_PIxPAXFlEeK8x7zQKtpUFg" type="2000" fontName="Lucida Grande" fontHeight="11" lineColor="0">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPAnFlEeK8x7zQKtpUFg" source="ShadowFigure">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPA3FlEeK8x7zQKtpUFg" key="ShadowFigure_Value" value="false"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPBHFlEeK8x7zQKtpUFg" source="displayNameLabelIcon">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPBXFlEeK8x7zQKtpUFg" key="displayNameLabelIcon_value" value="false"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPBnFlEeK8x7zQKtpUFg" source="QualifiedName">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPB3FlEeK8x7zQKtpUFg" key="QualifiedNameDepth" value="1000"/>
- </eAnnotations>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPCHFlEeK8x7zQKtpUFg" type="2001">
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPCXFlEeK8x7zQKtpUFg" width="700" height="13"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPCnFlEeK8x7zQKtpUFg" type="2002">
- <children xmi:type="notation:Shape" xmi:id="_PIxPC3FlEeK8x7zQKtpUFg" type="3000" fontName="Lucida Grande" fontHeight="11" lineColor="0">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPDHFlEeK8x7zQKtpUFg" source="ShadowFigure">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPDXFlEeK8x7zQKtpUFg" key="ShadowFigure_Value" value="false"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPDnFlEeK8x7zQKtpUFg" source="displayNameLabelIcon">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPD3FlEeK8x7zQKtpUFg" key="displayNameLabelIcon_value" value="false"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPEHFlEeK8x7zQKtpUFg" source="QualifiedName">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPEXFlEeK8x7zQKtpUFg" key="QualifiedNameDepth" value="1000"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPEnFlEeK8x7zQKtpUFg" source="RegionAnnotationKey">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPE3FlEeK8x7zQKtpUFg" key="RegionZoneKey" value="L"/>
- </eAnnotations>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPFHFlEeK8x7zQKtpUFg" type="3002">
- <children xmi:type="notation:Shape" xmi:id="_PIxPFXFlEeK8x7zQKtpUFg" type="8000">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPFnFlEeK8x7zQKtpUFg" type="8001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPF3FlEeK8x7zQKtpUFg" x="25" y="3"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPGHFlEeK8x7zQKtpUFg" type="8002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPGXFlEeK8x7zQKtpUFg" x="25" y="-10"/>
- </children>
- <element xmi:type="uml:Pseudostate" href="model.uml#_PI4j7nFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPGnFlEeK8x7zQKtpUFg" x="51" y="53"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIxPG3FlEeK8x7zQKtpUFg" type="6000">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPHHFlEeK8x7zQKtpUFg" type="6001"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPHXFlEeK8x7zQKtpUFg" type="6002">
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPHnFlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:State" href="model.uml#_PI4j73FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPH3FlEeK8x7zQKtpUFg" x="96" y="164"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIxPIHFlEeK8x7zQKtpUFg" type="6000">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPIXFlEeK8x7zQKtpUFg" type="6001"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPInFlEeK8x7zQKtpUFg" type="6002">
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPI3FlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:State" href="model.uml#_PI4j8HFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPJHFlEeK8x7zQKtpUFg" x="240" y="164"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIxPJXFlEeK8x7zQKtpUFg" type="5000">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPJnFlEeK8x7zQKtpUFg" type="5001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPJ3FlEeK8x7zQKtpUFg" x="25" y="3"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPKHFlEeK8x7zQKtpUFg" type="5002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPKXFlEeK8x7zQKtpUFg" x="25" y="-10"/>
- </children>
- <element xmi:type="uml:FinalState" href="model.uml#_PI4j8XFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPKnFlEeK8x7zQKtpUFg" x="195" y="30"/>
- </children>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPK3FlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:Region" href="model.uml#_PI4j6nFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPLHFlEeK8x7zQKtpUFg" width="350" height="287"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIxPLXFlEeK8x7zQKtpUFg" type="3000">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPLnFlEeK8x7zQKtpUFg" source="RegionAnnotationKey">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPL3FlEeK8x7zQKtpUFg" key="RegionZoneKey" value="R"/>
- </eAnnotations>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPMHFlEeK8x7zQKtpUFg" type="3002">
- <children xmi:type="notation:Shape" xmi:id="_PIxPMXFlEeK8x7zQKtpUFg" type="6000">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPMnFlEeK8x7zQKtpUFg" type="6001"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPM3FlEeK8x7zQKtpUFg" type="6002">
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPNHFlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:State" href="model.uml#_PI4j-HFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPNXFlEeK8x7zQKtpUFg" x="79" y="110"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIxPNnFlEeK8x7zQKtpUFg" type="6000">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPN3FlEeK8x7zQKtpUFg" type="6001"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPOHFlEeK8x7zQKtpUFg" type="6002">
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPOXFlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:State" href="model.uml#_PI4j-XFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPOnFlEeK8x7zQKtpUFg" x="205" y="119"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIxPO3FlEeK8x7zQKtpUFg" type="9000">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPPHFlEeK8x7zQKtpUFg" type="9001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPPXFlEeK8x7zQKtpUFg" x="25" y="3"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPPnFlEeK8x7zQKtpUFg" type="9002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPP3FlEeK8x7zQKtpUFg" x="25" y="-10"/>
- </children>
- <element xmi:type="uml:Pseudostate" href="model.uml#_PI4j-nFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPQHFlEeK8x7zQKtpUFg" x="168" y="49"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIxPQXFlEeK8x7zQKtpUFg" type="10000">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPQnFlEeK8x7zQKtpUFg" type="10001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPQ3FlEeK8x7zQKtpUFg" x="25" y="3"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPRHFlEeK8x7zQKtpUFg" type="10002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPRXFlEeK8x7zQKtpUFg" x="25" y="-10"/>
- </children>
- <element xmi:type="uml:Pseudostate" href="model.uml#_PI4j-3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPRnFlEeK8x7zQKtpUFg" x="173" y="202"/>
- </children>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPR3FlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:Region" href="model.uml#_PI4j8nFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPSHFlEeK8x7zQKtpUFg" x="350" width="350" height="287"/>
- </children>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPSXFlEeK8x7zQKtpUFg" y="13" width="700" height="287"/>
- </children>
- <element xmi:type="uml:StateMachine" href="model.uml#_PI4j6XFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPSnFlEeK8x7zQKtpUFg" x="30" y="30" width="700" height="300"/>
- </children>
- <styles xmi:type="notation:DiagramStyle" xmi:id="_PIxPS3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:StateMachine" href="model.uml#_PI4j6XFlEeK8x7zQKtpUFg"/>
- <edges xmi:type="notation:Connector" xmi:id="_PIxPTHFlEeK8x7zQKtpUFg" type="7000" source="_PIxPFXFlEeK8x7zQKtpUFg" target="_PIxPG3FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPTXFlEeK8x7zQKtpUFg" type="7001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPTnFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPT3FlEeK8x7zQKtpUFg" type="7002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPUHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPUXFlEeK8x7zQKtpUFg" type="7003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPUnFlEeK8x7zQKtpUFg" y="60"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIxPU3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Transition" href="model.uml#_PI4j63FlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIxPVHFlEeK8x7zQKtpUFg" points="[4, 10, -51, -111]$[52, 101, -3, -20]"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIxPVXFlEeK8x7zQKtpUFg" type="7000" source="_PIxPG3FlEeK8x7zQKtpUFg" target="_PIxPIHFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPVnFlEeK8x7zQKtpUFg" type="7001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPV3FlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPWHFlEeK8x7zQKtpUFg" type="7002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPWXFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIxPWnFlEeK8x7zQKtpUFg" type="7003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2EHFlEeK8x7zQKtpUFg" y="60"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIx2EXFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Transition" href="model.uml#_PI4j7HFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2EnFlEeK8x7zQKtpUFg" points="[20, 7, -105, 6]$[128, 21, 3, 20]"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIx2E3FlEeK8x7zQKtpUFg" type="7000" source="_PIxPIHFlEeK8x7zQKtpUFg" target="_PIxPQXFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2FHFlEeK8x7zQKtpUFg" type="7001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2FXFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2FnFlEeK8x7zQKtpUFg" type="7002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2F3FlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2GHFlEeK8x7zQKtpUFg" type="7003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2GXFlEeK8x7zQKtpUFg" y="60"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIx2GnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Transition" href="model.uml#_PI4j7XFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2G3FlEeK8x7zQKtpUFg" points="[20, 1, -267, -21]$[287, 17, 0, -5]"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIx2HHFlEeK8x7zQKtpUFg" type="7000" source="_PIxPQXFlEeK8x7zQKtpUFg" target="_PIxPMXFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2HXFlEeK8x7zQKtpUFg" type="7001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2HnFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2H3FlEeK8x7zQKtpUFg" type="7002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2IHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2IXFlEeK8x7zQKtpUFg" type="7003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2InFlEeK8x7zQKtpUFg" y="60"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIx2I3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Transition" href="model.uml#_PI4j83FlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2JHFlEeK8x7zQKtpUFg" points="[-2, -2, 77, 72]$[-74, -94, 5, -20]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIx2JXFlEeK8x7zQKtpUFg" id="(0.5,0.2)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIx2JnFlEeK8x7zQKtpUFg" type="7000" source="_PIxPQXFlEeK8x7zQKtpUFg" target="_PIxPNnFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2J3FlEeK8x7zQKtpUFg" type="7001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2KHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2KXFlEeK8x7zQKtpUFg" type="7002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2KnFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2K3FlEeK8x7zQKtpUFg" type="7003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2LHFlEeK8x7zQKtpUFg" y="60"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIx2LXFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Transition" href="model.uml#_PI4j9HFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2LnFlEeK8x7zQKtpUFg" points="[5, -6, -49, 50]$[58, -48, 4, 8]"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIx2L3FlEeK8x7zQKtpUFg" id="(0.675,0.8)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIx2MHFlEeK8x7zQKtpUFg" type="7000" source="_PIxPMXFlEeK8x7zQKtpUFg" target="_PIxPO3FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2MXFlEeK8x7zQKtpUFg" type="7001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2MnFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2M3FlEeK8x7zQKtpUFg" type="7002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2NHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2NXFlEeK8x7zQKtpUFg" type="7003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2NnFlEeK8x7zQKtpUFg" y="60"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIx2N3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Transition" href="model.uml#_PI4j9XFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2OHFlEeK8x7zQKtpUFg" points="[6, -5, -72, 54]$[76, -58, -2, 1]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIx2OXFlEeK8x7zQKtpUFg" id="(0.325,0.125)"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIx2OnFlEeK8x7zQKtpUFg" id="(0.2,0.7)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIx2O3FlEeK8x7zQKtpUFg" type="7000" source="_PIxPNnFlEeK8x7zQKtpUFg" target="_PIxPO3FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2PHFlEeK8x7zQKtpUFg" type="7001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2PXFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2PnFlEeK8x7zQKtpUFg" type="7002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2P3FlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2QHFlEeK8x7zQKtpUFg" type="7003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2QXFlEeK8x7zQKtpUFg" y="60"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIx2QnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Transition" href="model.uml#_PI4j9nFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2Q3FlEeK8x7zQKtpUFg" points="[-13, -20, 39, 65]$[-52, -80, 0, 5]"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIx2RHFlEeK8x7zQKtpUFg" type="7000" source="_PIxPO3FlEeK8x7zQKtpUFg" target="_PIxPJXFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2RXFlEeK8x7zQKtpUFg" type="7001">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2RnFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2R3FlEeK8x7zQKtpUFg" type="7002">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2SHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIx2SXFlEeK8x7zQKtpUFg" type="7003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2SnFlEeK8x7zQKtpUFg" y="60"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIx2S3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Transition" href="model.uml#_PI4j93FlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2THFlEeK8x7zQKtpUFg" points="[-5, -1, 313, 13]$[-315, -4, 3, 10]"/>
- </edges>
- </notation:Diagram>
- <notation:Diagram xmi:id="_PIzrQHFlEeK8x7zQKtpUFg" type="PapyrusUMLActivityDiagram" name="activity2" measurementUnit="Pixel">
- <children xmi:type="notation:Shape" xmi:id="_PIzrQXFlEeK8x7zQKtpUFg" type="2001" fontName="Lucida Grande" fontHeight="11" lineColor="0">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIzrQnFlEeK8x7zQKtpUFg" source="ShadowFigure">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIzrQ3FlEeK8x7zQKtpUFg" key="ShadowFigure_Value" value="false"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIzrRHFlEeK8x7zQKtpUFg" source="displayNameLabelIcon">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIzrRXFlEeK8x7zQKtpUFg" key="displayNameLabelIcon_value" value="false"/>
- </eAnnotations>
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIzrRnFlEeK8x7zQKtpUFg" source="QualifiedName">
- <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIzrR3FlEeK8x7zQKtpUFg" key="QualifiedNameDepth" value="1000"/>
- </eAnnotations>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrSHFlEeK8x7zQKtpUFg" type="5001"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrSXFlEeK8x7zQKtpUFg" type="7001">
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIzrSnFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIzrS3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrTHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrTXFlEeK8x7zQKtpUFg" type="7002">
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIzrTnFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIzrT3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrUHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrUXFlEeK8x7zQKtpUFg" type="7003">
- <styles xmi:type="notation:SortingStyle" xmi:id="_PIzrUnFlEeK8x7zQKtpUFg"/>
- <styles xmi:type="notation:FilteringStyle" xmi:id="_PIzrU3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrVHFlEeK8x7zQKtpUFg"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrVXFlEeK8x7zQKtpUFg" type="7004">
- <children xmi:type="notation:Shape" xmi:id="_PIzrVnFlEeK8x7zQKtpUFg" type="3004">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrV3FlEeK8x7zQKtpUFg" type="5080">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrWHFlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrWXFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:InitialNode" href="model.uml#_PI4kFnFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrWnFlEeK8x7zQKtpUFg" x="45" y="84"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIzrW3FlEeK8x7zQKtpUFg" type="3067">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrXHFlEeK8x7zQKtpUFg" type="5118"/>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrXXFlEeK8x7zQKtpUFg" type="7006">
- <children xmi:type="notation:Shape" xmi:id="_PIzrXnFlEeK8x7zQKtpUFg" type="3007">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrX3FlEeK8x7zQKtpUFg" type="5003"/>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrYHFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4kGHFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrYXFlEeK8x7zQKtpUFg" x="85" y="100"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIzrYnFlEeK8x7zQKtpUFg" type="3007">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrY3FlEeK8x7zQKtpUFg" type="5003"/>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrZHFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4kGXFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrZXFlEeK8x7zQKtpUFg" x="85" y="268"/>
- </children>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrZnFlEeK8x7zQKtpUFg"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrZ3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ActivityPartition" href="model.uml#_PI4j_XFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzraHFlEeK8x7zQKtpUFg" x="283" y="-6" width="244" height="397"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIzraXFlEeK8x7zQKtpUFg" type="3007">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzranFlEeK8x7zQKtpUFg" type="5003"/>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzra3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4kF3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrbHFlEeK8x7zQKtpUFg" x="106" y="210"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIzrbXFlEeK8x7zQKtpUFg" type="3007">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrbnFlEeK8x7zQKtpUFg" type="5003"/>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrb3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4kGnFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrcHFlEeK8x7zQKtpUFg" x="670" y="210"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIzrcXFlEeK8x7zQKtpUFg" type="3005">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrcnFlEeK8x7zQKtpUFg" type="5081">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrc3FlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrdHFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ActivityFinalNode" href="model.uml#_PI4kG3FlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrdXFlEeK8x7zQKtpUFg" x="742" y="84"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIzrdnFlEeK8x7zQKtpUFg" type="3040">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrd3FlEeK8x7zQKtpUFg" type="5100">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzreHFlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzreXFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ForkNode" href="model.uml#_PI4kHHFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrenFlEeK8x7zQKtpUFg" x="229" y="210"/>
- </children>
- <children xmi:type="notation:Shape" xmi:id="_PIzre3FlEeK8x7zQKtpUFg" type="3041">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrfHFlEeK8x7zQKtpUFg" type="5042">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrfXFlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrfnFlEeK8x7zQKtpUFg" type="5101">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrf3FlEeK8x7zQKtpUFg" y="5"/>
- </children>
- <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrgHFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:JoinNode" href="model.uml#_PI4kHXFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrgXFlEeK8x7zQKtpUFg" x="598" y="210"/>
- </children>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrgnFlEeK8x7zQKtpUFg"/>
- </children>
- <element xmi:type="uml:Activity" href="model.uml#_PI4j_HFlEeK8x7zQKtpUFg"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrg3FlEeK8x7zQKtpUFg"/>
- </children>
- <styles xmi:type="notation:DiagramStyle" xmi:id="_PIzrhHFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:Activity" href="model.uml#_PI4j_HFlEeK8x7zQKtpUFg"/>
- <edges xmi:type="notation:Connector" xmi:id="_PIzrhXFlEeK8x7zQKtpUFg" type="4004" source="_PIzrVnFlEeK8x7zQKtpUFg" target="_PIzraXFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrhnFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrh3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzriHFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzriXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrinFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzri3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrjHFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrjXFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIzrjnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j_nFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIzrj3FlEeK8x7zQKtpUFg" points="[4, 8, -63, -118]$[51, 117, -16, -9]"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIzrkHFlEeK8x7zQKtpUFg" id="(0.22857142857142856,0.25)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIzrkXFlEeK8x7zQKtpUFg" type="4004" source="_PIzraXFlEeK8x7zQKtpUFg" target="_PIzrdnFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrknFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrk3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrlHFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrlXFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrlnFlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrl3FlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrmHFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrmXFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PIzrmnFlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kAXFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIzrm3FlEeK8x7zQKtpUFg" points="[35, 0, -58, 0]$[88, 0, -5, 0]"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PIzrnHFlEeK8x7zQKtpUFg" type="4004" source="_PIzrdnFlEeK8x7zQKtpUFg" target="_PIzrXnFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PIzrnXFlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SUHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SUXFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SUnFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SU3FlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SVHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SVXFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SVnFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PI0SV3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kBHFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SWHFlEeK8x7zQKtpUFg" points="[4, -2, -169, 83]$[138, -80, -35, 5]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SWXFlEeK8x7zQKtpUFg" id="(0.6,0.15)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PI0SWnFlEeK8x7zQKtpUFg" type="4004" source="_PIzrdnFlEeK8x7zQKtpUFg" target="_PIzrYnFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SW3FlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SXHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SXXFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SXnFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SX3FlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SYHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SYXFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SYnFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PI0SY3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kB3FlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SZHFlEeK8x7zQKtpUFg" points="[5, 2, -150, -71]$[139, 73, -16, 0]"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SZXFlEeK8x7zQKtpUFg" id="(0.22857142857142856,0.525)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PI0SZnFlEeK8x7zQKtpUFg" type="4004" source="_PIzrXnFlEeK8x7zQKtpUFg" target="_PIzre3FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SZ3FlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SaHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SaXFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SanFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sa3FlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SbHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SbXFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SbnFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PI0Sb3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kCnFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0ScHFlEeK8x7zQKtpUFg" points="[16, 8, -160, -85]$[176, 73, 0, -20]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0ScXFlEeK8x7zQKtpUFg" id="(0.7714285714285715,0.65)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PI0ScnFlEeK8x7zQKtpUFg" type="4004" source="_PIzrYnFlEeK8x7zQKtpUFg" target="_PIzre3FlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sc3FlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SdHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SdXFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SdnFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sd3FlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SeHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SeXFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SenFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PI0Se3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kDXFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SfHFlEeK8x7zQKtpUFg" points="[17, -7, -160, 65]$[175, -52, -2, 20]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SfXFlEeK8x7zQKtpUFg" id="(0.7571428571428571,0.5)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PI0SfnFlEeK8x7zQKtpUFg" type="4004" source="_PIzre3FlEeK8x7zQKtpUFg" target="_PIzrbXFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sf3FlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SgHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SgXFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SgnFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sg3FlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0ShHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0ShXFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0ShnFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PI0Sh3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kEHFlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SiHFlEeK8x7zQKtpUFg" points="[5, -1, -97, 0]$[85, -3, -17, -2]"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SiXFlEeK8x7zQKtpUFg" id="(0.24285714285714285,0.45)"/>
- </edges>
- <edges xmi:type="notation:Connector" xmi:id="_PI0SinFlEeK8x7zQKtpUFg" type="4004" source="_PIzrbXFlEeK8x7zQKtpUFg" target="_PIzrcXFlEeK8x7zQKtpUFg">
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0Si3FlEeK8x7zQKtpUFg" visible="false" type="6003">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SjHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SjXFlEeK8x7zQKtpUFg" visible="false" type="6004">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SjnFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sj3FlEeK8x7zQKtpUFg" type="6009">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SkHFlEeK8x7zQKtpUFg" y="20"/>
- </children>
- <children xmi:type="notation:DecorationNode" xmi:id="_PI0SkXFlEeK8x7zQKtpUFg" type="6011">
- <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SknFlEeK8x7zQKtpUFg" y="-20"/>
- </children>
- <styles xmi:type="notation:FontStyle" xmi:id="_PI0Sk3FlEeK8x7zQKtpUFg"/>
- <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kE3FlEeK8x7zQKtpUFg"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SlHFlEeK8x7zQKtpUFg" points="[-2, -9, 12, 115]$[-14, -114, 0, 10]"/>
- <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SlXFlEeK8x7zQKtpUFg" id="(0.4,0.225)"/>
- </edges>
- </notation:Diagram>
-</xmi:XMI>
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattable="http://www.eclipse.org/papyrus/nattable/model" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis http://www.eclipse.org/papyrus/nattable/model#//nattableaxis http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration http://www.eclipse.org/papyrus/nattable/model#//nattableaxisconfiguration http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider http://www.eclipse.org/papyrus/nattable/model#//nattableaxisprovider http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration http://www.eclipse.org/papyrus/nattable/model#//nattableconfiguration">
+ <notation:Diagram xmi:id="_PIsWgHFlEeK8x7zQKtpUFg" type="PapyrusUMLClassDiagram" name="classes" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_PIsWgXFlEeK8x7zQKtpUFg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIsWgnFlEeK8x7zQKtpUFg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWg3FlEeK8x7zQKtpUFg" type="7017">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWhHFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWhXFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWhnFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWh3FlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWiHFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWiXFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWinFlEeK8x7zQKtpUFg" type="7018">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWi3FlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWjHFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWjXFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWjnFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWj3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWkHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWkXFlEeK8x7zQKtpUFg" type="7019">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWknFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWk3FlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWlHFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWlXFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWlnFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWl3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_PI4jwnFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWmHFlEeK8x7zQKtpUFg" x="63" y="18"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIsWmXFlEeK8x7zQKtpUFg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIsWmnFlEeK8x7zQKtpUFg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWm3FlEeK8x7zQKtpUFg" type="7017">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWnHFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWnXFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <children xmi:type="notation:Shape" xmi:id="_PIsWnnFlEeK8x7zQKtpUFg" type="3012">
+ <element xmi:type="uml:Property" href="model.uml#_PI4kH3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWn3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWoHFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWoXFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWonFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWo3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWpHFlEeK8x7zQKtpUFg" type="7018">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWpXFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWpnFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWp3FlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWqHFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWqXFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWqnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PIsWq3FlEeK8x7zQKtpUFg" type="7019">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIsWrHFlEeK8x7zQKtpUFg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIsWrXFlEeK8x7zQKtpUFg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PIsWrnFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIsWr3FlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIsWsHFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWsXFlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_PI4kHnFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIsWsnFlEeK8x7zQKtpUFg" x="270" y="18"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_SFbYAIQqEeKq_f8GS5X7FQ" type="2009">
+ <children xmi:type="notation:DecorationNode" xmi:id="_SFcmIIQqEeKq_f8GS5X7FQ" type="5032"/>
+ <element xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SFbYAYQqEeKq_f8GS5X7FQ" x="171" y="198"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_PIsWs3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Model" href="model.uml#_PI4jwHFlEeK8x7zQKtpUFg"/>
+ <edges xmi:type="notation:Connector" xmi:id="_PIsWtHFlEeK8x7zQKtpUFg" type="4001" source="_PIsWgXFlEeK8x7zQKtpUFg" target="_PIsWmXFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIsWtXFlEeK8x7zQKtpUFg" type="6001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWtnFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIsWt3FlEeK8x7zQKtpUFg" visible="false" type="6002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWuHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIsWuXFlEeK8x7zQKtpUFg" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWunFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIsWu3FlEeK8x7zQKtpUFg" type="6005">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWvHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIsWvXFlEeK8x7zQKtpUFg" type="6033">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWvnFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIsWv3FlEeK8x7zQKtpUFg" type="6034">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIsWwHFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIsWwXFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Association" href="model.uml#_PI4kIHFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIsWwnFlEeK8x7zQKtpUFg" points="[21, -6, -217, -15]$[204, -41, -34, -50]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIsWw3FlEeK8x7zQKtpUFg" id="(0.79,0.39)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_VftGgIQqEeKq_f8GS5X7FQ" type="4002" source="_PIsWmXFlEeK8x7zQKtpUFg" target="_SFbYAIQqEeKq_f8GS5X7FQ">
+ <children xmi:type="notation:DecorationNode" xmi:id="_VftGg4QqEeKq_f8GS5X7FQ" type="6007">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_VftGhIQqEeKq_f8GS5X7FQ" y="40"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_VftGgYQqEeKq_f8GS5X7FQ"/>
+ <element xmi:type="uml:Generalization" href="model.uml#_VZyEsIQqEeKq_f8GS5X7FQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VftGgoQqEeKq_f8GS5X7FQ" points="[-16, 22, 60, -89]$[-70, 102, 6, -9]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VgM1wIQqEeKq_f8GS5X7FQ" id="(0.3482142857142857,0.78)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VgM1wYQqEeKq_f8GS5X7FQ" id="(0.62,0.18)"/>
+ </edges>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_PIuywHFlEeK8x7zQKtpUFg" type="PapyrusUMLActivityDiagram" name="lifecycle" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_PIuywXFlEeK8x7zQKtpUFg" type="2001" fontName="Lucida Grande" fontHeight="11" lineColor="0">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIuywnFlEeK8x7zQKtpUFg" source="ShadowFigure">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIuyw3FlEeK8x7zQKtpUFg" key="ShadowFigure_Value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIuyxHFlEeK8x7zQKtpUFg" source="displayNameLabelIcon">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIuyxXFlEeK8x7zQKtpUFg" key="displayNameLabelIcon_value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIuyxnFlEeK8x7zQKtpUFg" source="QualifiedName">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIuyx3FlEeK8x7zQKtpUFg" key="QualifiedNameDepth" value="1000"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuyyHFlEeK8x7zQKtpUFg" type="5001"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuyyXFlEeK8x7zQKtpUFg" type="7001">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIuyynFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIuyy3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuyzHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuyzXFlEeK8x7zQKtpUFg" type="7002">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIuyznFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIuyz3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy0HFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy0XFlEeK8x7zQKtpUFg" type="7003">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIuy0nFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIuy03FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy1HFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy1XFlEeK8x7zQKtpUFg" type="7004">
+ <children xmi:type="notation:Shape" xmi:id="_PIuy1nFlEeK8x7zQKtpUFg" type="3004">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy13FlEeK8x7zQKtpUFg" type="5080">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuy2HFlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy2XFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:InitialNode" href="model.uml#_PI4j5HFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy2nFlEeK8x7zQKtpUFg" x="89" y="122"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIuy23FlEeK8x7zQKtpUFg" type="3005">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy3HFlEeK8x7zQKtpUFg" type="5081">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuy3XFlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy3nFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ActivityFinalNode" href="model.uml#_PI4j5XFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy33FlEeK8x7zQKtpUFg" x="787" y="186"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIuy4HFlEeK8x7zQKtpUFg" type="3065">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy4XFlEeK8x7zQKtpUFg" type="5117"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy4nFlEeK8x7zQKtpUFg" type="7005">
+ <children xmi:type="notation:Shape" xmi:id="_PIuy43FlEeK8x7zQKtpUFg" type="3007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy5HFlEeK8x7zQKtpUFg" type="5003"/>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy5XFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4jyHFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy5nFlEeK8x7zQKtpUFg" x="30" y="66"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIuy53FlEeK8x7zQKtpUFg" type="3007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy6HFlEeK8x7zQKtpUFg" type="5003"/>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy6XFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4jyXFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy6nFlEeK8x7zQKtpUFg" x="138" y="66"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIuy63FlEeK8x7zQKtpUFg" type="3038">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy7HFlEeK8x7zQKtpUFg" type="5043">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuy7XFlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy7nFlEeK8x7zQKtpUFg" type="5098">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuy73FlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy8HFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:DecisionNode" href="model.uml#_PI4jynFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy8XFlEeK8x7zQKtpUFg" x="246" y="66"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy8nFlEeK8x7zQKtpUFg"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy83FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:StructuredActivityNode" href="model.uml#_PI4jx3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy9HFlEeK8x7zQKtpUFg" x="76" y="192" width="280" height="154"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIuy9XFlEeK8x7zQKtpUFg" type="3067">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy9nFlEeK8x7zQKtpUFg" type="5118"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy93FlEeK8x7zQKtpUFg" type="7006">
+ <children xmi:type="notation:Shape" xmi:id="_PIuy-HFlEeK8x7zQKtpUFg" type="3007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuy-XFlEeK8x7zQKtpUFg" type="5003"/>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy-nFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4j5nFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy-3FlEeK8x7zQKtpUFg" x="85" y="52"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy_HFlEeK8x7zQKtpUFg"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuy_XFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ActivityPartition" href="model.uml#_PI4jy3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuy_nFlEeK8x7zQKtpUFg" x="391" y="30" width="239" height="148"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIuy_3FlEeK8x7zQKtpUFg" type="3007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzAHFlEeK8x7zQKtpUFg" type="5003"/>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuzAXFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4j53FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuzAnFlEeK8x7zQKtpUFg" x="497" y="288"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIuzA3FlEeK8x7zQKtpUFg" type="3039">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzBHFlEeK8x7zQKtpUFg" type="5099">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzBXFlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIuzBnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:MergeNode" href="model.uml#_PI4j6HFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuzB3FlEeK8x7zQKtpUFg" x="715" y="183"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuzCHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:Activity" href="model.uml#_PI4jxnFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIuzCXFlEeK8x7zQKtpUFg"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_PIuzCnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Activity" href="model.uml#_PI4jxnFlEeK8x7zQKtpUFg"/>
+ <edges xmi:type="notation:Connector" xmi:id="_PIuzC3FlEeK8x7zQKtpUFg" type="4004" source="_PIuy1nFlEeK8x7zQKtpUFg" target="_PIuy43FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzDHFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzDXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzDnFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzD3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzEHFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzEXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzEnFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzE3FlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIuzFHFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4jzHFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzFXFlEeK8x7zQKtpUFg" points="[1, 3, -39, -143]$[39, 126, -1, -20]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIuzFnFlEeK8x7zQKtpUFg" id="(0.45,0.8)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIuzF3FlEeK8x7zQKtpUFg" type="4004" source="_PIuy43FlEeK8x7zQKtpUFg" target="_PIuy53FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzGHFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzGXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzGnFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzG3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzHHFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzHXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzHnFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzH3FlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIuzIHFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4jz3FlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzIXFlEeK8x7zQKtpUFg" points="[11, 2, -73, -1]$[88, -17, 4, -20]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIuzInFlEeK8x7zQKtpUFg" id="(0.8428571428571429,0.425)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIuzI3FlEeK8x7zQKtpUFg" type="4004" source="_PIuy53FlEeK8x7zQKtpUFg" target="_PIuy63FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzJHFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzJXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzJnFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzJ3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzKHFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzKXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzKnFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzK3FlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIuzLHFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j0nFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzLXFlEeK8x7zQKtpUFg" points="[35, -4, -48, 1]$[82, 8, -1, 13]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIuzLnFlEeK8x7zQKtpUFg" type="4004" source="_PIuy63FlEeK8x7zQKtpUFg" target="_PIuy-HFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzL3FlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzMHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzMXFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzMnFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzM3FlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzNHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzNXFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzNnFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIuzN3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j1XFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzOHFlEeK8x7zQKtpUFg" points="[6, -6, -181, 151]$[189, -137, 2, 20]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIuzOXFlEeK8x7zQKtpUFg" type="4004" source="_PIuy63FlEeK8x7zQKtpUFg" target="_PIuy_3FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzOnFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzO3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzPHFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzPXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzPnFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzP3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzQHFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzQXFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIuzQnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j2HFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzQ3FlEeK8x7zQKtpUFg" points="[13, 2, -195, -27]$[243, 37, 35, 8]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIuzRHFlEeK8x7zQKtpUFg" id="(0.25,0.5)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIuzRXFlEeK8x7zQKtpUFg" type="4004" source="_PIuy_3FlEeK8x7zQKtpUFg" target="_PIuzA3FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzRnFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzR3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzSHFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzSXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzSnFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzS3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzTHFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzTXFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIuzTnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j23FlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzT3FlEeK8x7zQKtpUFg" points="[16, -11, -158, 103]$[174, -114, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIuzUHFlEeK8x7zQKtpUFg" id="(0.7714285714285715,0.6)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIuzUXFlEeK8x7zQKtpUFg" type="4004" source="_PIuy-HFlEeK8x7zQKtpUFg" target="_PIuzA3FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzUnFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzU3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzVHFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzVXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzVnFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzV3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIuzWHFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIuzWXFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIuzWnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j3nFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIuzW3FlEeK8x7zQKtpUFg" points="[35, 12, -174, -64]$[208, 62, -1, -14]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIvZ0HFlEeK8x7zQKtpUFg" type="4004" source="_PIuzA3FlEeK8x7zQKtpUFg" target="_PIuy23FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIvZ0XFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIvZ0nFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIvZ03FlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIvZ1HFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIvZ1XFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIvZ1nFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIvZ13FlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIvZ2HFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIvZ2XFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j4XFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIvZ2nFlEeK8x7zQKtpUFg" points="[7, -4, -65, -2]$[71, -12, -1, -10]"/>
+ </edges>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_PIxPAHFlEeK8x7zQKtpUFg" type="PapyrusUMLStateMachineDiagram" name="fsm" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_PIxPAXFlEeK8x7zQKtpUFg" type="2000" fontName="Lucida Grande" fontHeight="11" lineColor="0">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPAnFlEeK8x7zQKtpUFg" source="ShadowFigure">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPA3FlEeK8x7zQKtpUFg" key="ShadowFigure_Value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPBHFlEeK8x7zQKtpUFg" source="displayNameLabelIcon">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPBXFlEeK8x7zQKtpUFg" key="displayNameLabelIcon_value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPBnFlEeK8x7zQKtpUFg" source="QualifiedName">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPB3FlEeK8x7zQKtpUFg" key="QualifiedNameDepth" value="1000"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPCHFlEeK8x7zQKtpUFg" type="2001">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPCXFlEeK8x7zQKtpUFg" width="700" height="13"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPCnFlEeK8x7zQKtpUFg" type="2002">
+ <children xmi:type="notation:Shape" xmi:id="_PIxPC3FlEeK8x7zQKtpUFg" type="3000" fontName="Lucida Grande" fontHeight="11" lineColor="0">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPDHFlEeK8x7zQKtpUFg" source="ShadowFigure">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPDXFlEeK8x7zQKtpUFg" key="ShadowFigure_Value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPDnFlEeK8x7zQKtpUFg" source="displayNameLabelIcon">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPD3FlEeK8x7zQKtpUFg" key="displayNameLabelIcon_value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPEHFlEeK8x7zQKtpUFg" source="QualifiedName">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPEXFlEeK8x7zQKtpUFg" key="QualifiedNameDepth" value="1000"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPEnFlEeK8x7zQKtpUFg" source="RegionAnnotationKey">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPE3FlEeK8x7zQKtpUFg" key="RegionZoneKey" value="L"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPFHFlEeK8x7zQKtpUFg" type="3002">
+ <children xmi:type="notation:Shape" xmi:id="_PIxPFXFlEeK8x7zQKtpUFg" type="8000">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPFnFlEeK8x7zQKtpUFg" type="8001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPF3FlEeK8x7zQKtpUFg" x="25" y="3"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPGHFlEeK8x7zQKtpUFg" type="8002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPGXFlEeK8x7zQKtpUFg" x="25" y="-10"/>
+ </children>
+ <element xmi:type="uml:Pseudostate" href="model.uml#_PI4j7nFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPGnFlEeK8x7zQKtpUFg" x="51" y="53"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIxPG3FlEeK8x7zQKtpUFg" type="6000">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPHHFlEeK8x7zQKtpUFg" type="6001"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPHXFlEeK8x7zQKtpUFg" type="6002">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPHnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:State" href="model.uml#_PI4j73FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPH3FlEeK8x7zQKtpUFg" x="96" y="164"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIxPIHFlEeK8x7zQKtpUFg" type="6000">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPIXFlEeK8x7zQKtpUFg" type="6001"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPInFlEeK8x7zQKtpUFg" type="6002">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPI3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:State" href="model.uml#_PI4j8HFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPJHFlEeK8x7zQKtpUFg" x="240" y="164"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIxPJXFlEeK8x7zQKtpUFg" type="5000">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPJnFlEeK8x7zQKtpUFg" type="5001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPJ3FlEeK8x7zQKtpUFg" x="25" y="3"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPKHFlEeK8x7zQKtpUFg" type="5002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPKXFlEeK8x7zQKtpUFg" x="25" y="-10"/>
+ </children>
+ <element xmi:type="uml:FinalState" href="model.uml#_PI4j8XFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPKnFlEeK8x7zQKtpUFg" x="195" y="30"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPK3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:Region" href="model.uml#_PI4j6nFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPLHFlEeK8x7zQKtpUFg" width="350" height="287"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIxPLXFlEeK8x7zQKtpUFg" type="3000">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIxPLnFlEeK8x7zQKtpUFg" source="RegionAnnotationKey">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIxPL3FlEeK8x7zQKtpUFg" key="RegionZoneKey" value="R"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPMHFlEeK8x7zQKtpUFg" type="3002">
+ <children xmi:type="notation:Shape" xmi:id="_PIxPMXFlEeK8x7zQKtpUFg" type="6000">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPMnFlEeK8x7zQKtpUFg" type="6001"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPM3FlEeK8x7zQKtpUFg" type="6002">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPNHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:State" href="model.uml#_PI4j-HFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPNXFlEeK8x7zQKtpUFg" x="79" y="110"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIxPNnFlEeK8x7zQKtpUFg" type="6000">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPN3FlEeK8x7zQKtpUFg" type="6001"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPOHFlEeK8x7zQKtpUFg" type="6002">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPOXFlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:State" href="model.uml#_PI4j-XFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPOnFlEeK8x7zQKtpUFg" x="205" y="119"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIxPO3FlEeK8x7zQKtpUFg" type="9000">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPPHFlEeK8x7zQKtpUFg" type="9001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPPXFlEeK8x7zQKtpUFg" x="25" y="3"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPPnFlEeK8x7zQKtpUFg" type="9002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPP3FlEeK8x7zQKtpUFg" x="25" y="-10"/>
+ </children>
+ <element xmi:type="uml:Pseudostate" href="model.uml#_PI4j-nFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPQHFlEeK8x7zQKtpUFg" x="168" y="49"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIxPQXFlEeK8x7zQKtpUFg" type="10000">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPQnFlEeK8x7zQKtpUFg" type="10001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPQ3FlEeK8x7zQKtpUFg" x="25" y="3"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPRHFlEeK8x7zQKtpUFg" type="10002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPRXFlEeK8x7zQKtpUFg" x="25" y="-10"/>
+ </children>
+ <element xmi:type="uml:Pseudostate" href="model.uml#_PI4j-3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPRnFlEeK8x7zQKtpUFg" x="173" y="202"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPR3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:Region" href="model.uml#_PI4j8nFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPSHFlEeK8x7zQKtpUFg" x="350" width="350" height="287"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPSXFlEeK8x7zQKtpUFg" y="13" width="700" height="287"/>
+ </children>
+ <element xmi:type="uml:StateMachine" href="model.uml#_PI4j6XFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIxPSnFlEeK8x7zQKtpUFg" x="30" y="30" width="700" height="300"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_PIxPS3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:StateMachine" href="model.uml#_PI4j6XFlEeK8x7zQKtpUFg"/>
+ <edges xmi:type="notation:Connector" xmi:id="_PIxPTHFlEeK8x7zQKtpUFg" type="7000" source="_PIxPFXFlEeK8x7zQKtpUFg" target="_PIxPG3FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPTXFlEeK8x7zQKtpUFg" type="7001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPTnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPT3FlEeK8x7zQKtpUFg" type="7002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPUHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPUXFlEeK8x7zQKtpUFg" type="7003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPUnFlEeK8x7zQKtpUFg" y="60"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIxPU3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Transition" href="model.uml#_PI4j63FlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIxPVHFlEeK8x7zQKtpUFg" points="[4, 10, -51, -111]$[52, 101, -3, -20]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIxPVXFlEeK8x7zQKtpUFg" type="7000" source="_PIxPG3FlEeK8x7zQKtpUFg" target="_PIxPIHFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPVnFlEeK8x7zQKtpUFg" type="7001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPV3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPWHFlEeK8x7zQKtpUFg" type="7002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIxPWXFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIxPWnFlEeK8x7zQKtpUFg" type="7003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2EHFlEeK8x7zQKtpUFg" y="60"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIx2EXFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Transition" href="model.uml#_PI4j7HFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2EnFlEeK8x7zQKtpUFg" points="[20, 7, -105, 6]$[128, 21, 3, 20]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIx2E3FlEeK8x7zQKtpUFg" type="7000" source="_PIxPIHFlEeK8x7zQKtpUFg" target="_PIxPQXFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2FHFlEeK8x7zQKtpUFg" type="7001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2FXFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2FnFlEeK8x7zQKtpUFg" type="7002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2F3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2GHFlEeK8x7zQKtpUFg" type="7003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2GXFlEeK8x7zQKtpUFg" y="60"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIx2GnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Transition" href="model.uml#_PI4j7XFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2G3FlEeK8x7zQKtpUFg" points="[20, 1, -267, -21]$[287, 17, 0, -5]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIx2HHFlEeK8x7zQKtpUFg" type="7000" source="_PIxPQXFlEeK8x7zQKtpUFg" target="_PIxPMXFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2HXFlEeK8x7zQKtpUFg" type="7001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2HnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2H3FlEeK8x7zQKtpUFg" type="7002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2IHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2IXFlEeK8x7zQKtpUFg" type="7003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2InFlEeK8x7zQKtpUFg" y="60"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIx2I3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Transition" href="model.uml#_PI4j83FlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2JHFlEeK8x7zQKtpUFg" points="[-2, -2, 77, 72]$[-74, -94, 5, -20]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIx2JXFlEeK8x7zQKtpUFg" id="(0.5,0.2)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIx2JnFlEeK8x7zQKtpUFg" type="7000" source="_PIxPQXFlEeK8x7zQKtpUFg" target="_PIxPNnFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2J3FlEeK8x7zQKtpUFg" type="7001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2KHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2KXFlEeK8x7zQKtpUFg" type="7002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2KnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2K3FlEeK8x7zQKtpUFg" type="7003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2LHFlEeK8x7zQKtpUFg" y="60"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIx2LXFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Transition" href="model.uml#_PI4j9HFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2LnFlEeK8x7zQKtpUFg" points="[5, -6, -49, 50]$[58, -48, 4, 8]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIx2L3FlEeK8x7zQKtpUFg" id="(0.675,0.8)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIx2MHFlEeK8x7zQKtpUFg" type="7000" source="_PIxPMXFlEeK8x7zQKtpUFg" target="_PIxPO3FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2MXFlEeK8x7zQKtpUFg" type="7001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2MnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2M3FlEeK8x7zQKtpUFg" type="7002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2NHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2NXFlEeK8x7zQKtpUFg" type="7003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2NnFlEeK8x7zQKtpUFg" y="60"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIx2N3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Transition" href="model.uml#_PI4j9XFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2OHFlEeK8x7zQKtpUFg" points="[6, -5, -72, 54]$[76, -58, -2, 1]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIx2OXFlEeK8x7zQKtpUFg" id="(0.325,0.125)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIx2OnFlEeK8x7zQKtpUFg" id="(0.2,0.7)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIx2O3FlEeK8x7zQKtpUFg" type="7000" source="_PIxPNnFlEeK8x7zQKtpUFg" target="_PIxPO3FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2PHFlEeK8x7zQKtpUFg" type="7001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2PXFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2PnFlEeK8x7zQKtpUFg" type="7002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2P3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2QHFlEeK8x7zQKtpUFg" type="7003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2QXFlEeK8x7zQKtpUFg" y="60"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIx2QnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Transition" href="model.uml#_PI4j9nFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2Q3FlEeK8x7zQKtpUFg" points="[-13, -20, 39, 65]$[-52, -80, 0, 5]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIx2RHFlEeK8x7zQKtpUFg" type="7000" source="_PIxPO3FlEeK8x7zQKtpUFg" target="_PIxPJXFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2RXFlEeK8x7zQKtpUFg" type="7001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2RnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2R3FlEeK8x7zQKtpUFg" type="7002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2SHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIx2SXFlEeK8x7zQKtpUFg" type="7003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIx2SnFlEeK8x7zQKtpUFg" y="60"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIx2S3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Transition" href="model.uml#_PI4j93FlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIx2THFlEeK8x7zQKtpUFg" points="[-5, -1, 313, 13]$[-315, -4, 3, 10]"/>
+ </edges>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_PIzrQHFlEeK8x7zQKtpUFg" type="PapyrusUMLActivityDiagram" name="activity2" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_PIzrQXFlEeK8x7zQKtpUFg" type="2001" fontName="Lucida Grande" fontHeight="11" lineColor="0">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIzrQnFlEeK8x7zQKtpUFg" source="ShadowFigure">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIzrQ3FlEeK8x7zQKtpUFg" key="ShadowFigure_Value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIzrRHFlEeK8x7zQKtpUFg" source="displayNameLabelIcon">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIzrRXFlEeK8x7zQKtpUFg" key="displayNameLabelIcon_value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_PIzrRnFlEeK8x7zQKtpUFg" source="QualifiedName">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_PIzrR3FlEeK8x7zQKtpUFg" key="QualifiedNameDepth" value="1000"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrSHFlEeK8x7zQKtpUFg" type="5001"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrSXFlEeK8x7zQKtpUFg" type="7001">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIzrSnFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIzrS3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrTHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrTXFlEeK8x7zQKtpUFg" type="7002">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIzrTnFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIzrT3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrUHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrUXFlEeK8x7zQKtpUFg" type="7003">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PIzrUnFlEeK8x7zQKtpUFg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PIzrU3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrVHFlEeK8x7zQKtpUFg"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrVXFlEeK8x7zQKtpUFg" type="7004">
+ <children xmi:type="notation:Shape" xmi:id="_PIzrVnFlEeK8x7zQKtpUFg" type="3004">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrV3FlEeK8x7zQKtpUFg" type="5080">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrWHFlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrWXFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:InitialNode" href="model.uml#_PI4kFnFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrWnFlEeK8x7zQKtpUFg" x="45" y="84"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIzrW3FlEeK8x7zQKtpUFg" type="3067">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrXHFlEeK8x7zQKtpUFg" type="5118"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrXXFlEeK8x7zQKtpUFg" type="7006">
+ <children xmi:type="notation:Shape" xmi:id="_PIzrXnFlEeK8x7zQKtpUFg" type="3007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrX3FlEeK8x7zQKtpUFg" type="5003"/>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrYHFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4kGHFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrYXFlEeK8x7zQKtpUFg" x="85" y="100"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIzrYnFlEeK8x7zQKtpUFg" type="3007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrY3FlEeK8x7zQKtpUFg" type="5003"/>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrZHFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4kGXFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrZXFlEeK8x7zQKtpUFg" x="85" y="268"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrZnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrZ3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ActivityPartition" href="model.uml#_PI4j_XFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzraHFlEeK8x7zQKtpUFg" x="283" y="-6" width="244" height="397"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIzraXFlEeK8x7zQKtpUFg" type="3007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzranFlEeK8x7zQKtpUFg" type="5003"/>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzra3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4kF3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrbHFlEeK8x7zQKtpUFg" x="106" y="210"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIzrbXFlEeK8x7zQKtpUFg" type="3007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrbnFlEeK8x7zQKtpUFg" type="5003"/>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrb3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:OpaqueAction" href="model.uml#_PI4kGnFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrcHFlEeK8x7zQKtpUFg" x="670" y="210"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIzrcXFlEeK8x7zQKtpUFg" type="3005">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrcnFlEeK8x7zQKtpUFg" type="5081">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrc3FlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrdHFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ActivityFinalNode" href="model.uml#_PI4kG3FlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrdXFlEeK8x7zQKtpUFg" x="742" y="84"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIzrdnFlEeK8x7zQKtpUFg" type="3040">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrd3FlEeK8x7zQKtpUFg" type="5100">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzreHFlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzreXFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ForkNode" href="model.uml#_PI4kHHFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrenFlEeK8x7zQKtpUFg" x="229" y="210"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PIzre3FlEeK8x7zQKtpUFg" type="3041">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrfHFlEeK8x7zQKtpUFg" type="5042">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrfXFlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrfnFlEeK8x7zQKtpUFg" type="5101">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrf3FlEeK8x7zQKtpUFg" y="5"/>
+ </children>
+ <styles xmi:type="notation:HintedDiagramLinkStyle" xmi:id="_PIzrgHFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:JoinNode" href="model.uml#_PI4kHXFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrgXFlEeK8x7zQKtpUFg" x="598" y="210"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrgnFlEeK8x7zQKtpUFg"/>
+ </children>
+ <element xmi:type="uml:Activity" href="model.uml#_PI4j_HFlEeK8x7zQKtpUFg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PIzrg3FlEeK8x7zQKtpUFg"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_PIzrhHFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:Activity" href="model.uml#_PI4j_HFlEeK8x7zQKtpUFg"/>
+ <edges xmi:type="notation:Connector" xmi:id="_PIzrhXFlEeK8x7zQKtpUFg" type="4004" source="_PIzrVnFlEeK8x7zQKtpUFg" target="_PIzraXFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrhnFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrh3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzriHFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzriXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrinFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzri3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrjHFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrjXFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIzrjnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4j_nFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIzrj3FlEeK8x7zQKtpUFg" points="[4, 8, -63, -118]$[51, 117, -16, -9]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PIzrkHFlEeK8x7zQKtpUFg" id="(0.22857142857142856,0.25)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIzrkXFlEeK8x7zQKtpUFg" type="4004" source="_PIzraXFlEeK8x7zQKtpUFg" target="_PIzrdnFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrknFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrk3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrlHFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrlXFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrlnFlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrl3FlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrmHFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PIzrmXFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PIzrmnFlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kAXFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PIzrm3FlEeK8x7zQKtpUFg" points="[35, 0, -58, 0]$[88, 0, -5, 0]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PIzrnHFlEeK8x7zQKtpUFg" type="4004" source="_PIzrdnFlEeK8x7zQKtpUFg" target="_PIzrXnFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PIzrnXFlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SUHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SUXFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SUnFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SU3FlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SVHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SVXFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SVnFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PI0SV3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kBHFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SWHFlEeK8x7zQKtpUFg" points="[4, -2, -169, 83]$[138, -80, -35, 5]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SWXFlEeK8x7zQKtpUFg" id="(0.6,0.15)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PI0SWnFlEeK8x7zQKtpUFg" type="4004" source="_PIzrdnFlEeK8x7zQKtpUFg" target="_PIzrYnFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SW3FlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SXHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SXXFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SXnFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SX3FlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SYHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SYXFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SYnFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PI0SY3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kB3FlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SZHFlEeK8x7zQKtpUFg" points="[5, 2, -150, -71]$[139, 73, -16, 0]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SZXFlEeK8x7zQKtpUFg" id="(0.22857142857142856,0.525)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PI0SZnFlEeK8x7zQKtpUFg" type="4004" source="_PIzrXnFlEeK8x7zQKtpUFg" target="_PIzre3FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SZ3FlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SaHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SaXFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SanFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sa3FlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SbHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SbXFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SbnFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PI0Sb3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kCnFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0ScHFlEeK8x7zQKtpUFg" points="[16, 8, -160, -85]$[176, 73, 0, -20]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0ScXFlEeK8x7zQKtpUFg" id="(0.7714285714285715,0.65)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PI0ScnFlEeK8x7zQKtpUFg" type="4004" source="_PIzrYnFlEeK8x7zQKtpUFg" target="_PIzre3FlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sc3FlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SdHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SdXFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SdnFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sd3FlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SeHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SeXFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SenFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PI0Se3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kDXFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SfHFlEeK8x7zQKtpUFg" points="[17, -7, -160, 65]$[175, -52, -2, 20]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SfXFlEeK8x7zQKtpUFg" id="(0.7571428571428571,0.5)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PI0SfnFlEeK8x7zQKtpUFg" type="4004" source="_PIzre3FlEeK8x7zQKtpUFg" target="_PIzrbXFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sf3FlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SgHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SgXFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SgnFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sg3FlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0ShHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0ShXFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0ShnFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PI0Sh3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kEHFlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SiHFlEeK8x7zQKtpUFg" points="[5, -1, -97, 0]$[85, -3, -17, -2]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SiXFlEeK8x7zQKtpUFg" id="(0.24285714285714285,0.45)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_PI0SinFlEeK8x7zQKtpUFg" type="4004" source="_PIzrbXFlEeK8x7zQKtpUFg" target="_PIzrcXFlEeK8x7zQKtpUFg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0Si3FlEeK8x7zQKtpUFg" visible="false" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SjHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SjXFlEeK8x7zQKtpUFg" visible="false" type="6004">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SjnFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0Sj3FlEeK8x7zQKtpUFg" type="6009">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SkHFlEeK8x7zQKtpUFg" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_PI0SkXFlEeK8x7zQKtpUFg" type="6011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_PI0SknFlEeK8x7zQKtpUFg" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_PI0Sk3FlEeK8x7zQKtpUFg"/>
+ <element xmi:type="uml:ControlFlow" href="model.uml#_PI4kE3FlEeK8x7zQKtpUFg"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_PI0SlHFlEeK8x7zQKtpUFg" points="[-2, -9, 12, 115]$[-14, -114, 0, 10]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PI0SlXFlEeK8x7zQKtpUFg" id="(0.4,0.225)"/>
+ </edges>
+ </notation:Diagram>
+ <nattable:Table xmi:id="_0TYNgJoYEeOBraiw2Bz-fA" description="Table Description" name="DefaultTable(Converted)" currentRowAxisProvider="_0TYNgpoYEeOBraiw2Bz-fA" currentColumnAxisProvider="_0TYNgZoYEeOBraiw2Bz-fA">
+ <context xmi:type="uml:Model" href="model.uml#_PI4jwHFlEeK8x7zQKtpUFg"/>
+ <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#/"/>
+ <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_0TYNgZoYEeOBraiw2Bz-fA" description="This axis provider provides available columns according to the rows of the table (features of the object displayed on the other axis)" name="UML Feature axis provider"/>
+ <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_0TYNgpoYEeOBraiw2Bz-fA" description="This axis provider contains the object dropped by the user into the table" name="DroppedElementAxisProvider">
+ <axis xmi:type="nattableaxis:EObjectAxis" xmi:id="_0TYNg5oYEeOBraiw2Bz-fA">
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/configs/generic.nattableconfiguration#//@rowHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="uml:Class" href="model.uml#_PI4jwnFlEeK8x7zQKtpUFg"/>
+ </axis>
+ </rowAxisProvidersHistory>
+ </nattable:Table>
+</xmi:XMI>
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.uml b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.uml
index c601b47a595..de40bec32c5 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.uml
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/resources/model.uml
@@ -1,136 +1,136 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_PI4jwHFlEeK8x7zQKtpUFg" name="model">
- <packageImport xmi:type="uml:PackageImport" xmi:id="_PI4jwXFlEeK8x7zQKtpUFg">
- <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
- </packageImport>
- <packagedElement xmi:type="uml:Class" xmi:id="_PI4jwnFlEeK8x7zQKtpUFg" name="Foo" classifierBehavior="_PI4j_HFlEeK8x7zQKtpUFg">
- <ownedAttribute xmi:type="uml:Property" xmi:id="_PI4jw3FlEeK8x7zQKtpUFg" name="bar" type="_PI4kHnFlEeK8x7zQKtpUFg" association="_PI4kIHFlEeK8x7zQKtpUFg">
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PI4jxHFlEeK8x7zQKtpUFg" value="1"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PI4jxXFlEeK8x7zQKtpUFg" value="1"/>
- </ownedAttribute>
- <ownedBehavior xmi:type="uml:Activity" xmi:id="_PI4jxnFlEeK8x7zQKtpUFg" name="Activity1" group="_PI4jx3FlEeK8x7zQKtpUFg _PI4jy3FlEeK8x7zQKtpUFg" node="_PI4j5HFlEeK8x7zQKtpUFg _PI4j5XFlEeK8x7zQKtpUFg _PI4j5nFlEeK8x7zQKtpUFg _PI4j53FlEeK8x7zQKtpUFg _PI4j6HFlEeK8x7zQKtpUFg">
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4jzHFlEeK8x7zQKtpUFg" name="ControlFlow1" source="_PI4j5HFlEeK8x7zQKtpUFg" target="_PI4jyHFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4jzXFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4jznFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4jz3FlEeK8x7zQKtpUFg" name="ControlFlow2" source="_PI4jyHFlEeK8x7zQKtpUFg" target="_PI4jyXFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j0HFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j0XFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j0nFlEeK8x7zQKtpUFg" name="ControlFlow3" source="_PI4jyXFlEeK8x7zQKtpUFg" target="_PI4jynFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j03FlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j1HFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j1XFlEeK8x7zQKtpUFg" name="ControlFlow4" source="_PI4jynFlEeK8x7zQKtpUFg" target="_PI4j5nFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j1nFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j13FlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j2HFlEeK8x7zQKtpUFg" name="ControlFlow5" source="_PI4jynFlEeK8x7zQKtpUFg" target="_PI4j53FlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j2XFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j2nFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j23FlEeK8x7zQKtpUFg" name="ControlFlow6" source="_PI4j53FlEeK8x7zQKtpUFg" target="_PI4j6HFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j3HFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j3XFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j3nFlEeK8x7zQKtpUFg" name="ControlFlow7" source="_PI4j5nFlEeK8x7zQKtpUFg" target="_PI4j6HFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j33FlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j4HFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j4XFlEeK8x7zQKtpUFg" name="ControlFlow8" source="_PI4j6HFlEeK8x7zQKtpUFg" target="_PI4j5XFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j4nFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j43FlEeK8x7zQKtpUFg"/>
- </edge>
- <group xmi:type="uml:StructuredActivityNode" xmi:id="_PI4jx3FlEeK8x7zQKtpUFg" name="StructuredActivityNode1">
- <node xmi:type="uml:OpaqueAction" xmi:id="_PI4jyHFlEeK8x7zQKtpUFg" name="OpaqueAction1" outgoing="_PI4jz3FlEeK8x7zQKtpUFg" incoming="_PI4jzHFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:OpaqueAction" xmi:id="_PI4jyXFlEeK8x7zQKtpUFg" name="OpaqueAction2" outgoing="_PI4j0nFlEeK8x7zQKtpUFg" incoming="_PI4jz3FlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:DecisionNode" xmi:id="_PI4jynFlEeK8x7zQKtpUFg" name="DecisionNode1" outgoing="_PI4j1XFlEeK8x7zQKtpUFg _PI4j2HFlEeK8x7zQKtpUFg" incoming="_PI4j0nFlEeK8x7zQKtpUFg"/>
- </group>
- <group xmi:type="uml:ActivityPartition" xmi:id="_PI4jy3FlEeK8x7zQKtpUFg" name="ActivityPartition1" node="_PI4j5nFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:InitialNode" xmi:id="_PI4j5HFlEeK8x7zQKtpUFg" name="InitialNode1" outgoing="_PI4jzHFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:ActivityFinalNode" xmi:id="_PI4j5XFlEeK8x7zQKtpUFg" name="ActivityFinalNode1" incoming="_PI4j4XFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:OpaqueAction" xmi:id="_PI4j5nFlEeK8x7zQKtpUFg" name="OpaqueAction1" inPartition="_PI4jy3FlEeK8x7zQKtpUFg" outgoing="_PI4j3nFlEeK8x7zQKtpUFg" incoming="_PI4j1XFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:OpaqueAction" xmi:id="_PI4j53FlEeK8x7zQKtpUFg" name="OpaqueAction2" outgoing="_PI4j23FlEeK8x7zQKtpUFg" incoming="_PI4j2HFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:MergeNode" xmi:id="_PI4j6HFlEeK8x7zQKtpUFg" name="MergeNode1" outgoing="_PI4j4XFlEeK8x7zQKtpUFg" incoming="_PI4j23FlEeK8x7zQKtpUFg _PI4j3nFlEeK8x7zQKtpUFg"/>
- </ownedBehavior>
- <ownedBehavior xmi:type="uml:StateMachine" xmi:id="_PI4j6XFlEeK8x7zQKtpUFg" name="StateMachine1">
- <region xmi:type="uml:Region" xmi:id="_PI4j6nFlEeK8x7zQKtpUFg" name="Region1">
- <transition xmi:type="uml:Transition" xmi:id="_PI4j63FlEeK8x7zQKtpUFg" name="Transition0" source="_PI4j7nFlEeK8x7zQKtpUFg" target="_PI4j73FlEeK8x7zQKtpUFg"/>
- <transition xmi:type="uml:Transition" xmi:id="_PI4j7HFlEeK8x7zQKtpUFg" name="Transition1" source="_PI4j73FlEeK8x7zQKtpUFg" target="_PI4j8HFlEeK8x7zQKtpUFg"/>
- <transition xmi:type="uml:Transition" xmi:id="_PI4j7XFlEeK8x7zQKtpUFg" name="Transition2" source="_PI4j8HFlEeK8x7zQKtpUFg" target="_PI4j-3FlEeK8x7zQKtpUFg"/>
- <subvertex xmi:type="uml:Pseudostate" xmi:id="_PI4j7nFlEeK8x7zQKtpUFg" name="Initial0"/>
- <subvertex xmi:type="uml:State" xmi:id="_PI4j73FlEeK8x7zQKtpUFg" name="State0"/>
- <subvertex xmi:type="uml:State" xmi:id="_PI4j8HFlEeK8x7zQKtpUFg" name="State1"/>
- <subvertex xmi:type="uml:FinalState" xmi:id="_PI4j8XFlEeK8x7zQKtpUFg" name="FinalState0"/>
- </region>
- <region xmi:type="uml:Region" xmi:id="_PI4j8nFlEeK8x7zQKtpUFg" name="Region0">
- <transition xmi:type="uml:Transition" xmi:id="_PI4j83FlEeK8x7zQKtpUFg" name="Transition0" source="_PI4j-3FlEeK8x7zQKtpUFg" target="_PI4j-HFlEeK8x7zQKtpUFg"/>
- <transition xmi:type="uml:Transition" xmi:id="_PI4j9HFlEeK8x7zQKtpUFg" name="Transition1" source="_PI4j-3FlEeK8x7zQKtpUFg" target="_PI4j-XFlEeK8x7zQKtpUFg"/>
- <transition xmi:type="uml:Transition" xmi:id="_PI4j9XFlEeK8x7zQKtpUFg" name="Transition2" source="_PI4j-HFlEeK8x7zQKtpUFg" target="_PI4j-nFlEeK8x7zQKtpUFg"/>
- <transition xmi:type="uml:Transition" xmi:id="_PI4j9nFlEeK8x7zQKtpUFg" name="Transition3" source="_PI4j-XFlEeK8x7zQKtpUFg" target="_PI4j-nFlEeK8x7zQKtpUFg"/>
- <transition xmi:type="uml:Transition" xmi:id="_PI4j93FlEeK8x7zQKtpUFg" name="Transition4" source="_PI4j-nFlEeK8x7zQKtpUFg" target="_PI4j8XFlEeK8x7zQKtpUFg"/>
- <subvertex xmi:type="uml:State" xmi:id="_PI4j-HFlEeK8x7zQKtpUFg" name="State0"/>
- <subvertex xmi:type="uml:State" xmi:id="_PI4j-XFlEeK8x7zQKtpUFg" name="State1"/>
- <subvertex xmi:type="uml:Pseudostate" xmi:id="_PI4j-nFlEeK8x7zQKtpUFg" name="Join0" kind="join"/>
- <subvertex xmi:type="uml:Pseudostate" xmi:id="_PI4j-3FlEeK8x7zQKtpUFg" name="Fork0" kind="fork"/>
- </region>
- </ownedBehavior>
- <ownedBehavior xmi:type="uml:Activity" xmi:id="_PI4j_HFlEeK8x7zQKtpUFg" name="Activity2" group="_PI4j_XFlEeK8x7zQKtpUFg" node="_PI4kFnFlEeK8x7zQKtpUFg _PI4kF3FlEeK8x7zQKtpUFg _PI4kGHFlEeK8x7zQKtpUFg _PI4kGXFlEeK8x7zQKtpUFg _PI4kGnFlEeK8x7zQKtpUFg _PI4kG3FlEeK8x7zQKtpUFg _PI4kHHFlEeK8x7zQKtpUFg _PI4kHXFlEeK8x7zQKtpUFg">
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j_nFlEeK8x7zQKtpUFg" name="ControlFlow1" source="_PI4kFnFlEeK8x7zQKtpUFg" target="_PI4kF3FlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j_3FlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kAHFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kAXFlEeK8x7zQKtpUFg" name="ControlFlow2" source="_PI4kF3FlEeK8x7zQKtpUFg" target="_PI4kHHFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kAnFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kA3FlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kBHFlEeK8x7zQKtpUFg" name="ControlFlow3" source="_PI4kHHFlEeK8x7zQKtpUFg" target="_PI4kGHFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kBXFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kBnFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kB3FlEeK8x7zQKtpUFg" name="ControlFlow4" source="_PI4kHHFlEeK8x7zQKtpUFg" target="_PI4kGXFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kCHFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kCXFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kCnFlEeK8x7zQKtpUFg" name="ControlFlow5" source="_PI4kGHFlEeK8x7zQKtpUFg" target="_PI4kHXFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kC3FlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kDHFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kDXFlEeK8x7zQKtpUFg" name="ControlFlow6" source="_PI4kGXFlEeK8x7zQKtpUFg" target="_PI4kHXFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kDnFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kD3FlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kEHFlEeK8x7zQKtpUFg" name="ControlFlow7" source="_PI4kHXFlEeK8x7zQKtpUFg" target="_PI4kGnFlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kEXFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kEnFlEeK8x7zQKtpUFg"/>
- </edge>
- <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kE3FlEeK8x7zQKtpUFg" name="ControlFlow8" source="_PI4kGnFlEeK8x7zQKtpUFg" target="_PI4kG3FlEeK8x7zQKtpUFg">
- <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kFHFlEeK8x7zQKtpUFg" value="true"/>
- <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kFXFlEeK8x7zQKtpUFg"/>
- </edge>
- <group xmi:type="uml:ActivityPartition" xmi:id="_PI4j_XFlEeK8x7zQKtpUFg" name="ActivityPartition1" node="_PI4kGHFlEeK8x7zQKtpUFg _PI4kGXFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:InitialNode" xmi:id="_PI4kFnFlEeK8x7zQKtpUFg" name="InitialNode1" outgoing="_PI4j_nFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:OpaqueAction" xmi:id="_PI4kF3FlEeK8x7zQKtpUFg" name="OpaqueAction1" outgoing="_PI4kAXFlEeK8x7zQKtpUFg" incoming="_PI4j_nFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:OpaqueAction" xmi:id="_PI4kGHFlEeK8x7zQKtpUFg" name="OpaqueAction2" inPartition="_PI4j_XFlEeK8x7zQKtpUFg" outgoing="_PI4kCnFlEeK8x7zQKtpUFg" incoming="_PI4kBHFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:OpaqueAction" xmi:id="_PI4kGXFlEeK8x7zQKtpUFg" name="OpaqueAction3" inPartition="_PI4j_XFlEeK8x7zQKtpUFg" outgoing="_PI4kDXFlEeK8x7zQKtpUFg" incoming="_PI4kB3FlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:OpaqueAction" xmi:id="_PI4kGnFlEeK8x7zQKtpUFg" name="OpaqueAction4" outgoing="_PI4kE3FlEeK8x7zQKtpUFg" incoming="_PI4kEHFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:ActivityFinalNode" xmi:id="_PI4kG3FlEeK8x7zQKtpUFg" name="ActivityFinalNode1" incoming="_PI4kE3FlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:ForkNode" xmi:id="_PI4kHHFlEeK8x7zQKtpUFg" name="ForkNode1" outgoing="_PI4kBHFlEeK8x7zQKtpUFg _PI4kB3FlEeK8x7zQKtpUFg" incoming="_PI4kAXFlEeK8x7zQKtpUFg"/>
- <node xmi:type="uml:JoinNode" xmi:id="_PI4kHXFlEeK8x7zQKtpUFg" name="JoinNode1" outgoing="_PI4kEHFlEeK8x7zQKtpUFg" incoming="_PI4kCnFlEeK8x7zQKtpUFg _PI4kDXFlEeK8x7zQKtpUFg"/>
- </ownedBehavior>
- </packagedElement>
- <packagedElement xmi:type="uml:Class" xmi:id="_PI4kHnFlEeK8x7zQKtpUFg" name="Bar">
- <generalization xmi:type="uml:Generalization" xmi:id="_VZyEsIQqEeKq_f8GS5X7FQ">
- <general xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- </generalization>
- <ownedAttribute xmi:type="uml:Property" xmi:id="_PI4kH3FlEeK8x7zQKtpUFg" name="name">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- </ownedAttribute>
- </packagedElement>
- <packagedElement xmi:type="uml:Association" xmi:id="_PI4kIHFlEeK8x7zQKtpUFg" name="foo_bar" memberEnd="_PI4kIXFlEeK8x7zQKtpUFg _PI4jw3FlEeK8x7zQKtpUFg">
- <ownedEnd xmi:type="uml:Property" xmi:id="_PI4kIXFlEeK8x7zQKtpUFg" name="foo" type="_PI4jwnFlEeK8x7zQKtpUFg" association="_PI4kIHFlEeK8x7zQKtpUFg">
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PI4kInFlEeK8x7zQKtpUFg" value="1"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PI4kI3FlEeK8x7zQKtpUFg" value="1"/>
- </ownedEnd>
- </packagedElement>
-</uml:Model>
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_PI4jwHFlEeK8x7zQKtpUFg" name="model">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_PI4jwXFlEeK8x7zQKtpUFg">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_PI4jwnFlEeK8x7zQKtpUFg" name="Foo" classifierBehavior="_PI4j_HFlEeK8x7zQKtpUFg">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_PI4jw3FlEeK8x7zQKtpUFg" name="bar" type="_PI4kHnFlEeK8x7zQKtpUFg" association="_PI4kIHFlEeK8x7zQKtpUFg">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PI4jxHFlEeK8x7zQKtpUFg" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PI4jxXFlEeK8x7zQKtpUFg" value="1"/>
+ </ownedAttribute>
+ <ownedBehavior xmi:type="uml:Activity" xmi:id="_PI4jxnFlEeK8x7zQKtpUFg" name="Activity1" group="_PI4jx3FlEeK8x7zQKtpUFg _PI4jy3FlEeK8x7zQKtpUFg" node="_PI4j5HFlEeK8x7zQKtpUFg _PI4j5XFlEeK8x7zQKtpUFg _PI4j5nFlEeK8x7zQKtpUFg _PI4j53FlEeK8x7zQKtpUFg _PI4j6HFlEeK8x7zQKtpUFg">
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4jzHFlEeK8x7zQKtpUFg" name="ControlFlow1" source="_PI4j5HFlEeK8x7zQKtpUFg" target="_PI4jyHFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4jzXFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4jznFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4jz3FlEeK8x7zQKtpUFg" name="ControlFlow2" source="_PI4jyHFlEeK8x7zQKtpUFg" target="_PI4jyXFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j0HFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j0XFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j0nFlEeK8x7zQKtpUFg" name="ControlFlow3" source="_PI4jyXFlEeK8x7zQKtpUFg" target="_PI4jynFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j03FlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j1HFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j1XFlEeK8x7zQKtpUFg" name="ControlFlow4" source="_PI4jynFlEeK8x7zQKtpUFg" target="_PI4j5nFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j1nFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j13FlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j2HFlEeK8x7zQKtpUFg" name="ControlFlow5" source="_PI4jynFlEeK8x7zQKtpUFg" target="_PI4j53FlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j2XFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j2nFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j23FlEeK8x7zQKtpUFg" name="ControlFlow6" source="_PI4j53FlEeK8x7zQKtpUFg" target="_PI4j6HFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j3HFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j3XFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j3nFlEeK8x7zQKtpUFg" name="ControlFlow7" source="_PI4j5nFlEeK8x7zQKtpUFg" target="_PI4j6HFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j33FlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j4HFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j4XFlEeK8x7zQKtpUFg" name="ControlFlow8" source="_PI4j6HFlEeK8x7zQKtpUFg" target="_PI4j5XFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j4nFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4j43FlEeK8x7zQKtpUFg"/>
+ </edge>
+ <group xmi:type="uml:StructuredActivityNode" xmi:id="_PI4jx3FlEeK8x7zQKtpUFg" name="StructuredActivityNode1">
+ <node xmi:type="uml:OpaqueAction" xmi:id="_PI4jyHFlEeK8x7zQKtpUFg" name="OpaqueAction1" outgoing="_PI4jz3FlEeK8x7zQKtpUFg" incoming="_PI4jzHFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:OpaqueAction" xmi:id="_PI4jyXFlEeK8x7zQKtpUFg" name="OpaqueAction2" outgoing="_PI4j0nFlEeK8x7zQKtpUFg" incoming="_PI4jz3FlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:DecisionNode" xmi:id="_PI4jynFlEeK8x7zQKtpUFg" name="DecisionNode1" outgoing="_PI4j1XFlEeK8x7zQKtpUFg _PI4j2HFlEeK8x7zQKtpUFg" incoming="_PI4j0nFlEeK8x7zQKtpUFg"/>
+ </group>
+ <group xmi:type="uml:ActivityPartition" xmi:id="_PI4jy3FlEeK8x7zQKtpUFg" name="ActivityPartition1" node="_PI4j5nFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:InitialNode" xmi:id="_PI4j5HFlEeK8x7zQKtpUFg" name="InitialNode1" outgoing="_PI4jzHFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:ActivityFinalNode" xmi:id="_PI4j5XFlEeK8x7zQKtpUFg" name="ActivityFinalNode1" incoming="_PI4j4XFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:OpaqueAction" xmi:id="_PI4j5nFlEeK8x7zQKtpUFg" name="OpaqueAction1" inPartition="_PI4jy3FlEeK8x7zQKtpUFg" outgoing="_PI4j3nFlEeK8x7zQKtpUFg" incoming="_PI4j1XFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:OpaqueAction" xmi:id="_PI4j53FlEeK8x7zQKtpUFg" name="OpaqueAction2" outgoing="_PI4j23FlEeK8x7zQKtpUFg" incoming="_PI4j2HFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:MergeNode" xmi:id="_PI4j6HFlEeK8x7zQKtpUFg" name="MergeNode1" outgoing="_PI4j4XFlEeK8x7zQKtpUFg" incoming="_PI4j23FlEeK8x7zQKtpUFg _PI4j3nFlEeK8x7zQKtpUFg"/>
+ </ownedBehavior>
+ <ownedBehavior xmi:type="uml:StateMachine" xmi:id="_PI4j6XFlEeK8x7zQKtpUFg" name="StateMachine1">
+ <region xmi:type="uml:Region" xmi:id="_PI4j6nFlEeK8x7zQKtpUFg" name="Region1">
+ <transition xmi:type="uml:Transition" xmi:id="_PI4j63FlEeK8x7zQKtpUFg" name="Transition0" source="_PI4j7nFlEeK8x7zQKtpUFg" target="_PI4j73FlEeK8x7zQKtpUFg"/>
+ <transition xmi:type="uml:Transition" xmi:id="_PI4j7HFlEeK8x7zQKtpUFg" name="Transition1" source="_PI4j73FlEeK8x7zQKtpUFg" target="_PI4j8HFlEeK8x7zQKtpUFg"/>
+ <transition xmi:type="uml:Transition" xmi:id="_PI4j7XFlEeK8x7zQKtpUFg" name="Transition2" source="_PI4j8HFlEeK8x7zQKtpUFg" target="_PI4j-3FlEeK8x7zQKtpUFg"/>
+ <subvertex xmi:type="uml:Pseudostate" xmi:id="_PI4j7nFlEeK8x7zQKtpUFg" name="Initial0"/>
+ <subvertex xmi:type="uml:State" xmi:id="_PI4j73FlEeK8x7zQKtpUFg" name="State0"/>
+ <subvertex xmi:type="uml:State" xmi:id="_PI4j8HFlEeK8x7zQKtpUFg" name="State1"/>
+ <subvertex xmi:type="uml:FinalState" xmi:id="_PI4j8XFlEeK8x7zQKtpUFg" name="FinalState0"/>
+ </region>
+ <region xmi:type="uml:Region" xmi:id="_PI4j8nFlEeK8x7zQKtpUFg" name="Region0">
+ <transition xmi:type="uml:Transition" xmi:id="_PI4j83FlEeK8x7zQKtpUFg" name="Transition0" source="_PI4j-3FlEeK8x7zQKtpUFg" target="_PI4j-HFlEeK8x7zQKtpUFg"/>
+ <transition xmi:type="uml:Transition" xmi:id="_PI4j9HFlEeK8x7zQKtpUFg" name="Transition1" source="_PI4j-3FlEeK8x7zQKtpUFg" target="_PI4j-XFlEeK8x7zQKtpUFg"/>
+ <transition xmi:type="uml:Transition" xmi:id="_PI4j9XFlEeK8x7zQKtpUFg" name="Transition2" source="_PI4j-HFlEeK8x7zQKtpUFg" target="_PI4j-nFlEeK8x7zQKtpUFg"/>
+ <transition xmi:type="uml:Transition" xmi:id="_PI4j9nFlEeK8x7zQKtpUFg" name="Transition3" source="_PI4j-XFlEeK8x7zQKtpUFg" target="_PI4j-nFlEeK8x7zQKtpUFg"/>
+ <transition xmi:type="uml:Transition" xmi:id="_PI4j93FlEeK8x7zQKtpUFg" name="Transition4" source="_PI4j-nFlEeK8x7zQKtpUFg" target="_PI4j8XFlEeK8x7zQKtpUFg"/>
+ <subvertex xmi:type="uml:State" xmi:id="_PI4j-HFlEeK8x7zQKtpUFg" name="State0"/>
+ <subvertex xmi:type="uml:State" xmi:id="_PI4j-XFlEeK8x7zQKtpUFg" name="State1"/>
+ <subvertex xmi:type="uml:Pseudostate" xmi:id="_PI4j-nFlEeK8x7zQKtpUFg" name="Join0" kind="join"/>
+ <subvertex xmi:type="uml:Pseudostate" xmi:id="_PI4j-3FlEeK8x7zQKtpUFg" name="Fork0" kind="fork"/>
+ </region>
+ </ownedBehavior>
+ <ownedBehavior xmi:type="uml:Activity" xmi:id="_PI4j_HFlEeK8x7zQKtpUFg" name="Activity2" group="_PI4j_XFlEeK8x7zQKtpUFg" node="_PI4kFnFlEeK8x7zQKtpUFg _PI4kF3FlEeK8x7zQKtpUFg _PI4kGHFlEeK8x7zQKtpUFg _PI4kGXFlEeK8x7zQKtpUFg _PI4kGnFlEeK8x7zQKtpUFg _PI4kG3FlEeK8x7zQKtpUFg _PI4kHHFlEeK8x7zQKtpUFg _PI4kHXFlEeK8x7zQKtpUFg">
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4j_nFlEeK8x7zQKtpUFg" name="ControlFlow1" source="_PI4kFnFlEeK8x7zQKtpUFg" target="_PI4kF3FlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4j_3FlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kAHFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kAXFlEeK8x7zQKtpUFg" name="ControlFlow2" source="_PI4kF3FlEeK8x7zQKtpUFg" target="_PI4kHHFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kAnFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kA3FlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kBHFlEeK8x7zQKtpUFg" name="ControlFlow3" source="_PI4kHHFlEeK8x7zQKtpUFg" target="_PI4kGHFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kBXFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kBnFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kB3FlEeK8x7zQKtpUFg" name="ControlFlow4" source="_PI4kHHFlEeK8x7zQKtpUFg" target="_PI4kGXFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kCHFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kCXFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kCnFlEeK8x7zQKtpUFg" name="ControlFlow5" source="_PI4kGHFlEeK8x7zQKtpUFg" target="_PI4kHXFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kC3FlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kDHFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kDXFlEeK8x7zQKtpUFg" name="ControlFlow6" source="_PI4kGXFlEeK8x7zQKtpUFg" target="_PI4kHXFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kDnFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kD3FlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kEHFlEeK8x7zQKtpUFg" name="ControlFlow7" source="_PI4kHXFlEeK8x7zQKtpUFg" target="_PI4kGnFlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kEXFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kEnFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <edge xmi:type="uml:ControlFlow" xmi:id="_PI4kE3FlEeK8x7zQKtpUFg" name="ControlFlow8" source="_PI4kGnFlEeK8x7zQKtpUFg" target="_PI4kG3FlEeK8x7zQKtpUFg">
+ <guard xmi:type="uml:LiteralBoolean" xmi:id="_PI4kFHFlEeK8x7zQKtpUFg" value="true"/>
+ <weight xmi:type="uml:LiteralInteger" xmi:id="_PI4kFXFlEeK8x7zQKtpUFg"/>
+ </edge>
+ <group xmi:type="uml:ActivityPartition" xmi:id="_PI4j_XFlEeK8x7zQKtpUFg" name="ActivityPartition1" node="_PI4kGHFlEeK8x7zQKtpUFg _PI4kGXFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:InitialNode" xmi:id="_PI4kFnFlEeK8x7zQKtpUFg" name="InitialNode1" outgoing="_PI4j_nFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:OpaqueAction" xmi:id="_PI4kF3FlEeK8x7zQKtpUFg" name="OpaqueAction1" outgoing="_PI4kAXFlEeK8x7zQKtpUFg" incoming="_PI4j_nFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:OpaqueAction" xmi:id="_PI4kGHFlEeK8x7zQKtpUFg" name="OpaqueAction2" inPartition="_PI4j_XFlEeK8x7zQKtpUFg" outgoing="_PI4kCnFlEeK8x7zQKtpUFg" incoming="_PI4kBHFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:OpaqueAction" xmi:id="_PI4kGXFlEeK8x7zQKtpUFg" name="OpaqueAction3" inPartition="_PI4j_XFlEeK8x7zQKtpUFg" outgoing="_PI4kDXFlEeK8x7zQKtpUFg" incoming="_PI4kB3FlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:OpaqueAction" xmi:id="_PI4kGnFlEeK8x7zQKtpUFg" name="OpaqueAction4" outgoing="_PI4kE3FlEeK8x7zQKtpUFg" incoming="_PI4kEHFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:ActivityFinalNode" xmi:id="_PI4kG3FlEeK8x7zQKtpUFg" name="ActivityFinalNode1" incoming="_PI4kE3FlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:ForkNode" xmi:id="_PI4kHHFlEeK8x7zQKtpUFg" name="ForkNode1" outgoing="_PI4kBHFlEeK8x7zQKtpUFg _PI4kB3FlEeK8x7zQKtpUFg" incoming="_PI4kAXFlEeK8x7zQKtpUFg"/>
+ <node xmi:type="uml:JoinNode" xmi:id="_PI4kHXFlEeK8x7zQKtpUFg" name="JoinNode1" outgoing="_PI4kEHFlEeK8x7zQKtpUFg" incoming="_PI4kCnFlEeK8x7zQKtpUFg _PI4kDXFlEeK8x7zQKtpUFg"/>
+ </ownedBehavior>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_PI4kHnFlEeK8x7zQKtpUFg" name="Bar">
+ <generalization xmi:type="uml:Generalization" xmi:id="_VZyEsIQqEeKq_f8GS5X7FQ">
+ <general xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </generalization>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_PI4kH3FlEeK8x7zQKtpUFg" name="name">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Association" xmi:id="_PI4kIHFlEeK8x7zQKtpUFg" name="foo_bar" memberEnd="_PI4kIXFlEeK8x7zQKtpUFg _PI4jw3FlEeK8x7zQKtpUFg">
+ <ownedEnd xmi:type="uml:Property" xmi:id="_PI4kIXFlEeK8x7zQKtpUFg" name="foo" type="_PI4jwnFlEeK8x7zQKtpUFg" association="_PI4kIHFlEeK8x7zQKtpUFg">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PI4kInFlEeK8x7zQKtpUFg" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PI4kI3FlEeK8x7zQKtpUFg" value="1"/>
+ </ownedEnd>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/Bug402525.ecore b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/Bug402525.ecore
new file mode 100644
index 00000000000..8dea18de3e8
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/Bug402525.ecore
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bug402525" nsURI="http://www.eclipse.org/schema/Papyrus/tests/bug402525"
+ nsPrefix="bug">
+ <eClassifiers xsi:type="ecore:EClass" name="Foo"/>
+</ecore:EPackage>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/NestingTransactionalCommandStackTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/NestingTransactionalCommandStackTest.java
new file mode 100644
index 00000000000..2d6ce7c92e1
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/NestingTransactionalCommandStackTest.java
@@ -0,0 +1,513 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.core.resource;
+
+import static org.hamcrest.CoreMatchers.both;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.sameInstance;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.net.URL;
+import java.util.concurrent.Callable;
+
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+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.provider.ComposedAdapterFactory;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalCommandStack;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.base.Objects;
+
+
+/**
+ * Test suite for the {@link NestingTransactionalCommandStack} class.
+ */
+public class NestingTransactionalCommandStackTest {
+
+ // No API signatures but the most basic are required for nesting
+ private CommandStack fixture;
+
+ private TransactionalEditingDomain domain;
+
+ private ResourceSet rset;
+
+ private EPackage testPackage;
+
+ private EClass foo;
+
+ public NestingTransactionalCommandStackTest() {
+ super();
+ }
+
+ //
+ // Test cases
+ //
+
+ @Test
+ public void testCompleteUnnestedCommand() {
+ Callable<EAttribute> createAttribute = createAttribute();
+
+ int oldFeatureCount = foo.getEStructuralFeatures().size();
+
+ // Create two attributes
+ EAttribute attr1 = execute(createAttribute);
+ EAttribute attr2 = execute(createAttribute);
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 2));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr2));
+
+ // Undo only undoes one of them
+ Command undone = undo();
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeatures(), not(hasItem(attr2)));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 2));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr2));
+ }
+
+ @Test
+ public void testCancelUnnestedCommand() {
+ Callable<EAttribute> createAttribute = createAttribute(2);
+
+ int oldFeatureCount = foo.getEStructuralFeatures().size();
+
+ // Try to create two attributes (second one cancels)
+ EAttribute attr1 = execute(createAttribute);
+ EAttribute attr2 = execute(createAttribute);
+ assertThat(attr2, nullValue());
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeature("attribute2"), nullValue()); //$NON-NLS-1$
+
+ // Undo is sane
+ Command undone = undo();
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount));
+ assertThat(foo.getEStructuralFeatures(), not(hasItem(attr1)));
+ assertThat(foo.getEStructuralFeature("attribute2"), nullValue()); //$NON-NLS-1$
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeature("attribute2"), nullValue()); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testCompleteNestedCommand() {
+ final int FEATURES = 2;
+ Callable<EClass> createClass = createClass(FEATURES);
+
+ int oldClassifierCount = testPackage.getEClassifiers().size();
+
+ EClass clas = execute(createClass);
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount + 1));
+ assertThat(testPackage.getEClassifiers(), hasItem(clas));
+ assertThat(clas.getEStructuralFeatures().size(), is(FEATURES));
+ assertThat(clas.getEStructuralFeature("attribute1"), notNullValue()); //$NON-NLS-1$
+ assertThat(clas.getEStructuralFeature("attribute2"), notNullValue()); //$NON-NLS-1$
+
+ // Undo is sane and there is only one command to undo
+ Command undone = undo();
+ assertThat(fixture.canUndo(), is(false));
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount));
+ assertThat(testPackage.getEClassifiers(), not(hasItem(clas)));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount + 1));
+ assertThat(testPackage.getEClassifiers(), hasItem(clas));
+ assertThat(clas.getEStructuralFeatures().size(), is(FEATURES));
+ assertThat(clas.getEStructuralFeature("attribute1"), notNullValue()); //$NON-NLS-1$
+ assertThat(clas.getEStructuralFeature("attribute2"), notNullValue()); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testCancelNestedCommand() {
+ final int FEATURES = 2;
+ Callable<EClass> createClass = createClass(FEATURES, 2, FEATURES);
+
+ int oldClassifierCount = testPackage.getEClassifiers().size();
+
+ // Try to create two classes (second one cancels)
+ EClass class1 = execute(createClass);
+ EClass class2 = execute(createClass);
+ assertThat(class2, nullValue());
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount + 1));
+ assertThat(testPackage.getEClassifiers(), hasItem(class1));
+ assertThat(class1.getEStructuralFeatures().size(), is(FEATURES));
+ assertThat(class1.getEStructuralFeature("attribute1"), notNullValue()); //$NON-NLS-1$
+ assertThat(class1.getEStructuralFeature("attribute2"), notNullValue()); //$NON-NLS-1$
+
+ // Undo is sane and there is only one command to undo
+ Command undone = undo();
+ assertThat(fixture.canUndo(), is(false));
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount));
+ assertThat(testPackage.getEClassifiers(), not(hasItem(class1)));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount + 1));
+ assertThat(testPackage.getEClassifiers(), hasItem(class1));
+ assertThat(class1.getEStructuralFeatures().size(), is(FEATURES));
+ assertThat(class1.getEStructuralFeature("attribute1"), notNullValue()); //$NON-NLS-1$
+ assertThat(class1.getEStructuralFeature("attribute2"), notNullValue()); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testCompleteTripleNestedCommand() {
+ final int CLASSES = 2;
+ final int FEATURES = 2;
+
+ Callable<EPackage> createPackage = createPackage(CLASSES, FEATURES);
+
+ int oldPackageCount = testPackage.getESubpackages().size();
+
+ EPackage pkg = execute(createPackage);
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount + 1));
+ assertThat(testPackage.getESubpackages(), hasItem(pkg));
+ assertThat(pkg.getEClassifiers().size(), is(CLASSES));
+ assertThat(pkg.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class1")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertThat(pkg.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class2")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ // Undo is sane and there is only one command to undo
+ Command undone = undo();
+ assertThat(fixture.canUndo(), is(false));
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount));
+ assertThat(testPackage.getESubpackages(), not(hasItem(pkg)));
+ assertThat(pkg.getName(), nullValue());
+ assertThat(pkg.getEClassifiers().size(), is(0));
+ assertThat(pkg.getEClassifiers().size(), is(0));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(fixture.canRedo(), is(false));
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount + 1));
+ assertThat(testPackage.getESubpackages(), hasItem(pkg));
+ assertThat(pkg, named("package1")); //$NON-NLS-1$
+ assertThat(pkg.getEClassifiers().size(), is(CLASSES));
+ assertThat(pkg.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class1")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertThat(pkg.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class2")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ @Test
+ public void testCancelTripleNestedCommand() {
+ final int CLASSES = 2;
+ final int FEATURES = 2;
+
+ Callable<EPackage> createPackage = createPackage(CLASSES, FEATURES, 2, CLASSES, FEATURES);
+
+ int oldPackageCount = testPackage.getESubpackages().size();
+
+ // Try to create two packages (second one cancels)
+ EPackage pkg1 = execute(createPackage);
+ EPackage pkg2 = execute(createPackage);
+
+ // the first package is complete
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount + 1));
+ assertThat(testPackage.getESubpackages(), hasItem(pkg1));
+ assertThat(pkg1, named("package1")); //$NON-NLS-1$
+ assertThat(pkg1.getEClassifiers().size(), is(CLASSES));
+ assertThat(pkg1.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class1")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertThat(pkg1.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class2")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ // there is no second package
+ assertThat(pkg2, nullValue());
+
+ // Undo is sane and there is only one command to undo
+ Command undone = undo();
+ assertThat(fixture.canUndo(), is(false));
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount));
+ assertThat(testPackage.getESubpackages(), not(hasItem(pkg1)));
+ assertThat(pkg1.getName(), nullValue());
+ assertThat(pkg1.getEClassifiers().size(), is(0));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(fixture.canRedo(), is(false));
+ assertThat(redone, sameInstance(undone));
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount + 1));
+ assertThat(testPackage.getESubpackages(), hasItem(pkg1));
+ assertThat(pkg1, named("package1")); //$NON-NLS-1$
+ assertThat(pkg1.getEClassifiers().size(), is(CLASSES));
+ assertThat(pkg1.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class1")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertThat(pkg1.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class2")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void createFixture() {
+ rset = new ResourceSetImpl();
+ fixture = new NestingTransactionalCommandStack();
+ AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ domain = new TransactionalEditingDomainImpl(adapterFactory, (TransactionalCommandStack)fixture, rset);
+
+ URL testModelURL = getClass().getResource("Bug402525.ecore"); //$NON-NLS-1$
+ Resource testModel = rset.getResource(URI.createURI(testModelURL.toExternalForm(), true), true);
+ testPackage = (EPackage)testModel.getContents().get(0);
+ foo = (EClass)testPackage.getEClassifier("Foo"); //$NON-NLS-1$
+ }
+
+ @After
+ public void destroyFixture() {
+ // This disposes the command stack for us
+ domain.dispose();
+ domain = null;
+ fixture = null;
+
+ dispose(rset);
+ rset = null;
+ }
+
+ void dispose(ResourceSet rset) {
+ for(Resource next : rset.getResources()) {
+ next.unload();
+ next.eAdapters().clear();
+ }
+
+ rset.getResources().clear();
+ rset.eAdapters().clear();
+ }
+
+ <V> V execute(final Callable<V> operation) {
+ class TestCommand extends RecordingCommand {
+
+ V result;
+
+ TestCommand() {
+ super(domain);
+ }
+
+ @Override
+ protected void doExecute() {
+ try {
+ result = operation.call();
+ } catch (OperationCanceledException e) {
+ // Pass it on
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Uncaught exception in operation: " + e.getLocalizedMessage()); //$NON-NLS-1$
+ }
+ }
+ }
+
+ TestCommand command = new TestCommand();
+ fixture.execute(command);
+ return command.result;
+ }
+
+ Command undo() {
+ assertThat("Cannot undo", fixture.canUndo()); //$NON-NLS-1$
+ Command result = fixture.getUndoCommand();
+ fixture.undo();
+ return result;
+ }
+
+ Command redo() {
+ assertThat("Cannot redo", fixture.canRedo()); //$NON-NLS-1$
+ Command result = fixture.getRedoCommand();
+ fixture.redo();
+ return result;
+ }
+
+ Callable<EAttribute> createAttribute() {
+ return createAttribute(0);
+ }
+
+ Callable<EAttribute> createAttribute(int cancelOn) {
+ return createAttribute(foo, cancelOn);
+ }
+
+ Callable<EAttribute> createAttribute(final EClass owner, final int cancelOn) {
+ return new Callable<EAttribute>() {
+
+ int i = 0;
+
+ public EAttribute call() throws Exception {
+ String name = nextName();
+
+ EAttribute attr = EcoreFactory.eINSTANCE.createEAttribute();
+ owner.getEStructuralFeatures().add(attr);
+ attr.setName(name);
+ attr.setEType(EcorePackage.Literals.ESTRING);
+
+ checkCancel();
+
+ return attr;
+ }
+
+ private String nextName() {
+ i = i + 1;
+ return "attribute" + i; //$NON-NLS-1$
+ }
+
+ private void checkCancel() {
+ if(i == cancelOn) {
+ throw new OperationCanceledException();
+ }
+ }
+ };
+ }
+
+ Callable<EClass> createClass(int attributes) {
+ return createClass(attributes, 0, 0);
+ }
+
+ Callable<EClass> createClass(int attributes, int cancelOn, int cancelAttributesOn) {
+ return createClass(testPackage, attributes, cancelOn, cancelAttributesOn);
+ }
+
+ Callable<EClass> createClass(final EPackage owner, final int attributes, final int cancelOn, final int cancelAttributesOn) {
+ return new Callable<EClass>() {
+
+ int i = 0;
+
+ public EClass call() throws Exception {
+ String name = nextName();
+
+ EClass clas = EcoreFactory.eINSTANCE.createEClass();
+ owner.getEClassifiers().add(clas);
+ clas.setName(name);
+
+ Callable<?> createAttribute = createAttribute(clas, checkCancelAttributes());
+ for(int i = 0; i < attributes; i++) {
+ // Nested command
+ execute(createAttribute);
+ }
+
+ return clas;
+ }
+
+ private String nextName() {
+ i = i + 1;
+ return "Class" + i; //$NON-NLS-1$
+ }
+
+ private int checkCancelAttributes() {
+ return (i == cancelOn) ? cancelAttributesOn : 0;
+ }
+ };
+ }
+
+ Callable<EPackage> createPackage(int classes, int attributes) {
+ return createPackage(classes, attributes, 0, 0, 0);
+ }
+
+ Callable<EPackage> createPackage(final int classes, final int attributes, final int cancelOn, final int cancelClassesOn, final int cancelAttributesOn) {
+ return new Callable<EPackage>() {
+
+ int i = 0;
+
+ public EPackage call() throws Exception {
+ String name = nextName();
+
+ EPackage pkg = EcoreFactory.eINSTANCE.createEPackage();
+ testPackage.getESubpackages().add(pkg);
+ pkg.setName(name);
+
+ Callable<?> createClass = createClass(pkg, attributes, checkCancelClasses(), cancelAttributesOn);
+ for(int i = 0; i < classes; i++) {
+ // Nested command
+ execute(createClass);
+ }
+
+ return pkg;
+ }
+
+ private String nextName() {
+ i = i + 1;
+ return "package" + i; //$NON-NLS-1$
+ }
+
+ private int checkCancelClasses() {
+ return (i == cancelOn) ? cancelClassesOn : 0;
+ }
+ };
+ }
+
+ Matcher<ENamedElement> named(final String name) {
+ return new BaseMatcher<ENamedElement>() {
+
+ public void describeTo(Description desc) {
+ desc.appendText("is named \"").appendValue(name).appendText("\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public boolean matches(Object o) {
+ return (o instanceof ENamedElement) && Objects.equal(((ENamedElement)o).getName(), name);
+ }
+ };
+ }
+
+ Matcher<EClass> featureCount(final int count) {
+ return new BaseMatcher<EClass>() {
+
+ public void describeTo(Description desc) {
+ desc.appendText("has ").appendValue(count).appendText(" features"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public boolean matches(Object o) {
+ return (o instanceof EClass) && (((EClass)o).getEStructuralFeatures().size() == count);
+ }
+ };
+ }
+
+ Matcher<EClass> hasFeature(final String name) {
+ return new BaseMatcher<EClass>() {
+
+ public void describeTo(Description desc) {
+ desc.appendText("has a \"").appendValue(name).appendText("\" feature"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public boolean matches(Object o) {
+ return (o instanceof EClass) && (((EClass)o).getEStructuralFeature(name) != null);
+ }
+ };
+ }
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java
index 9670eb13bbc..1d389ba9ad7 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2013 CEA LIST and others.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
* Christian W. Damus (CEA LIST) - add test for AdapterUtils
+ * Christian W. Damus (CEA) - bug 402525
*****************************************************************************/
package org.eclipse.papyrus.infra.core.tests;
@@ -16,6 +17,7 @@ import org.eclipse.papyrus.infra.core.contentoutline.NestedEditorDelegatedOutlin
import org.eclipse.papyrus.infra.core.lifecycleevents.LifeCycleEventsProviderTest;
import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResourceTest;
import org.eclipse.papyrus.infra.core.resource.ModelSetTest;
+import org.eclipse.papyrus.infra.core.resource.NestingTransactionalCommandStackTest;
import org.eclipse.papyrus.infra.core.services.ComposedServiceTest;
import org.eclipse.papyrus.infra.core.services.ServicesRegistryTest;
import org.eclipse.papyrus.infra.core.utils.AdapterUtilsTest;
@@ -28,7 +30,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
// {oep.resource}
-ModelSetTest.class, AbstractModelWithSharedResourceTest.class,
+ModelSetTest.class, AbstractModelWithSharedResourceTest.class, NestingTransactionalCommandStackTest.class,
// {oep}.core.services
ComposedServiceTest.class, ServicesRegistryTest.class,
// {oep}.core.lifecycleevents
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF
index e56fafcb15a..e20872ef1db 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF
@@ -16,7 +16,7 @@ Export-Package: org.eclipse.papyrus.infra.extendedtypes.tests
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
-Bundle-Name: %pluginName
+Bundle-Name: %fragmentName
Bundle-Localization: plugin
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.infra.extendedtypes.tests.Activa
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
index 6aeaa83921f..4700fff2cda 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
@@ -44,7 +44,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.uml.diagram.interactionoverview.tests;bundle-version="1.0.0",
org.eclipse.papyrus.uml.diagram.composite.tests;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.css.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.extendedtypes.tests;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.extendedtypes.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
index 510de5a6616..b6405aa10d4 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bugs 402525, 323802
+ *
*****************************************************************************/
package org.eclipse.papyrus.tests;
@@ -47,9 +49,12 @@ public class AllTests {
/* infra */
suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.services.edit.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.services.edit.tests.suites.AllTests"));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.labelprovider.tests.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceTest"));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.tests.AllTests"));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.extendedtypes.tests.AllTests.class));
// suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.openelement.tests.AllTests.class));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.commands.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.gmfdiag.commands.tests.AllTests"));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.common.Activator.ID, "org.eclipse.papyrus.infra.gmfdiag.common.tests.AllTests"));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.readonly.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.readonly.tests.AllTests"));
/* views */
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.views.modelexplorer.tests.AllTests.class));
@@ -106,7 +111,7 @@ public class AllTests {
/**
* Constructor.
- *
+ *
* @param clazz
* the suite class � AllTests2
* @throws InitializationError
@@ -120,7 +125,7 @@ public class AllTests {
/**
* Returns the list of test classes
- *
+ *
* @return the list of test classes
*/
private static Class<?>[] getSuites() {
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/05/05c7b36fbab4ca0d1ab135dea6de98a858e98957.svn-base b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.classpath
index c83506765b4..64c5e31b7a2 100644
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/05/05c7b36fbab4ca0d1ab135dea6de98a858e98957.svn-base
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.classpath
@@ -2,5 +2,6 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.project b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.project
new file mode 100644
index 00000000000..fdbdaeef2f6
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.emf.readonly.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8d/8d296e7c27efbc530279b585ece27327bfd35b37.svn-base b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.settings/org.eclipse.jdt.core.prefs
index d1c0bf949da..af0f20f97a5 100644
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/8d/8d296e7c27efbc530279b585ece27327bfd35b37.svn-base
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,5 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..fd89e78f654
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.readonly.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: %providerName
+Bundle-Localization: fragment
+Fragment-Host: org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.uml2.uml;bundle-version="5.0.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.services.controlmode;bundle-version="1.0.0",
+ org.eclipse.gmf.runtime.notation;bundle-version="1.7.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.0.0"
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/21/213758e5da3272ec26a8760b23415abcebba4ed3.svn-base b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/about.html
index 23506a4bae1..d35d5aed64c 100644
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/21/213758e5da3272ec26a8760b23415abcebba4ed3.svn-base
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/about.html
@@ -1,26 +1,28 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"><head>
-
-
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
-</head><body lang="EN-US">
+</head>
+<body lang="EN-US">
<h2>About This Content</h2>
-<p>June 5, 2006</p>
+<p>June 5, 2007</p>
<h3>License</h3>
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). 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
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-</body></html> \ No newline at end of file
+</body>
+</html>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties
new file mode 100644
index 00000000000..412030aeabe
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties
@@ -0,0 +1,20 @@
+# Copyright (c) 2014 CEA 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:
+# Christian W. Damus (CEA) - Initial API and implementation
+#
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ fragment.properties,\
+ about.html,\
+ resources/
+src.includes = about.html,\
+ org.eclipse.papyrus.infra.emf.readonly.tests.launch
diff --git a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/7b/7b03b446fd8d23e4e34d8e0597bfd2021129c1f8.svn-base b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/fragment.properties
index 21c153b3b8f..836d5c8643e 100644
--- a/plugins/developer/org.eclipse.papyrus.def/.svn/pristine/7b/7b03b446fd8d23e4e34d8e0597bfd2021129c1f8.svn-base
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/fragment.properties
@@ -1,12 +1,13 @@
#################################################################################
-# Copyright (c) 2008 CEA LIST.
+# Copyright (c) 2014 CEA 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:
-# Patrick Tessier patrick.tessier@cea.fr - Initial API and implementation
+# Christian W. Damus (CEA) - Initial API and implementation
+#
##################################################################################
-pluginName=Papyrus Templates Extension for GMF tooling (Incubation)
+pluginName=Papyrus EMF Read-only Suport Test (Incubation)
providerName=Eclipse Modeling Project
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/org.eclipse.papyrus.infra.emf.readonly.tests.launch b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/org.eclipse.papyrus.infra.emf.readonly.tests.launch
new file mode 100644
index 00000000000..f88fd3877e9
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/org.eclipse.papyrus.infra.emf.readonly.tests.launch
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/tests/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JAVA_COMMAND" value="java"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.infra.emf.readonly.tests.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.infra.emf.readonly.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms768m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.di b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.di
new file mode 100644
index 00000000000..c225e67b58e
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.di
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="referenced.notation#_Cbxz8J7tEeOJ2JaKXBO95w"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="referenced.notation#_Cbxz8J7tEeOJ2JaKXBO95w"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.notation b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.notation
new file mode 100644
index 00000000000..128575d9a2b
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.notation
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_Cbxz8J7tEeOJ2JaKXBO95w" type="PapyrusUMLClassDiagram" name="classes" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_H1H3MJ7tEeOJ2JaKXBO95w" type="2009">
+ <children xmi:type="notation:DecorationNode" xmi:id="_H1H3Mp7tEeOJ2JaKXBO95w" type="5032"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_H1H3M57tEeOJ2JaKXBO95w" type="7039">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_H1H3NJ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_H1H3NZ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_H1H3Np7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_H1H3N57tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_H1IeQJ7tEeOJ2JaKXBO95w" type="7040">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_H1IeQZ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_H1IeQp7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_H1IeQ57tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_H1IeRJ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <element xmi:type="uml:PrimitiveType" href="referenced.uml#_H1GCAJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_H1H3MZ7tEeOJ2JaKXBO95w" x="177" y="145"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_J874QJ7tEeOJ2JaKXBO95w" type="2009">
+ <children xmi:type="notation:DecorationNode" xmi:id="_J874Qp7tEeOJ2JaKXBO95w" type="5032"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_J874Q57tEeOJ2JaKXBO95w" type="7039">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_J874RJ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_J874RZ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_J874Rp7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_J874R57tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_J874SJ7tEeOJ2JaKXBO95w" type="7040">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_J874SZ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_J874Sp7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_J874S57tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_J874TJ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <element xmi:type="uml:PrimitiveType" href="referenced.uml#_J86qIJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_J874QZ7tEeOJ2JaKXBO95w" x="408" y="145"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_Cbxz8Z7tEeOJ2JaKXBO95w"/>
+ <element xmi:type="uml:Model" href="referenced.uml#_CbjKcJ7tEeOJ2JaKXBO95w"/>
+</notation:Diagram>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.uml b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.uml
new file mode 100644
index 00000000000..8cde5f2052d
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referenced.uml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_CbjKcJ7tEeOJ2JaKXBO95w" name="referenced">
+ <packagedElement xmi:type="uml:PrimitiveType" xmi:id="_H1GCAJ7tEeOJ2JaKXBO95w" name="SocialSecurityNumber"/>
+ <packagedElement xmi:type="uml:PrimitiveType" xmi:id="_J86qIJ7tEeOJ2JaKXBO95w" name="Timestamp"/>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.di b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.di
new file mode 100644
index 00000000000..1615b760e8e
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.di
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="referencing.notation#_T_1gkJ7tEeOJ2JaKXBO95w"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="referencing.notation#_T_1gkJ7tEeOJ2JaKXBO95w"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.notation b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.notation
new file mode 100644
index 00000000000..767464d829f
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.notation
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_T_1gkJ7tEeOJ2JaKXBO95w" type="PapyrusUMLClassDiagram" name="core classes" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_VTikIJ7tEeOJ2JaKXBO95w" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_VTikIp7tEeOJ2JaKXBO95w" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_VTikI57tEeOJ2JaKXBO95w" type="7017">
+ <children xmi:type="notation:Shape" xmi:id="_YcB_EJ7tEeOJ2JaKXBO95w" type="3012">
+ <element xmi:type="uml:Property" href="referencing.uml#_YbzVkJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_YcB_EZ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_drUHYJ7tEeOJ2JaKXBO95w" type="3012">
+ <element xmi:type="uml:Property" href="referencing.uml#_drSSMJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_drUHYZ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_fnOacJ7tEeOJ2JaKXBO95w" type="3012">
+ <element xmi:type="uml:Property" href="referencing.uml#_fnNMUJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_fnOacZ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_0LCcwJ7tEeOJ2JaKXBO95w" type="3012">
+ <element xmi:type="uml:Property" href="referencing.uml#_0LAnkJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_0LCcwZ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_VTikJJ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_VTikJZ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_VTikJp7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTikJ57tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_VTikKJ7tEeOJ2JaKXBO95w" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_VTjLMJ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_VTjLMZ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_VTjLMp7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTjLM57tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_VTjLNJ7tEeOJ2JaKXBO95w" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_VTjLNZ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_VTjLNp7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_VTjLN57tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTjLOJ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <element xmi:type="uml:Class" href="referencing.uml#_VTe5wJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTikIZ7tEeOJ2JaKXBO95w" x="130" y="135"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_6Avr4J7tEeOJ2JaKXBO95w" type="2009">
+ <children xmi:type="notation:DecorationNode" xmi:id="_6Avr4p7tEeOJ2JaKXBO95w" type="5032"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_6AwS8J7tEeOJ2JaKXBO95w" type="7039">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_6AwS8Z7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_6AwS8p7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_6AwS857tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6AwS9J7tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_6AwS9Z7tEeOJ2JaKXBO95w" type="7040">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_6AwS9p7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_6AwS957tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_6AwS-J7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6AwS-Z7tEeOJ2JaKXBO95w"/>
+ </children>
+ <element xmi:type="uml:PrimitiveType" href="referenced.uml#_H1GCAJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6Avr4Z7tEeOJ2JaKXBO95w" x="447" y="212"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_6WYksJ7tEeOJ2JaKXBO95w" type="2009">
+ <children xmi:type="notation:DecorationNode" xmi:id="_6WZLwJ7tEeOJ2JaKXBO95w" type="5032"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_6WZLwZ7tEeOJ2JaKXBO95w" type="7039">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_6WZLwp7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_6WZLw57tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_6WZLxJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6WZLxZ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_6WZLxp7tEeOJ2JaKXBO95w" type="7040">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_6WZLx57tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_6WZLyJ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_6WZLyZ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6WZLyp7tEeOJ2JaKXBO95w"/>
+ </children>
+ <element xmi:type="uml:PrimitiveType" href="referenced.uml#_J86qIJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6WYksZ7tEeOJ2JaKXBO95w" x="447" y="308"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_7YrvMJ7tEeOJ2JaKXBO95w" type="2009">
+ <children xmi:type="notation:DecorationNode" xmi:id="_7YrvMp7tEeOJ2JaKXBO95w" type="5032"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_7YsWQJ7tEeOJ2JaKXBO95w" type="7039">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_7YsWQZ7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_7YsWQp7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_7YsWQ57tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7YsWRJ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_7YsWRZ7tEeOJ2JaKXBO95w" type="7040">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_7YsWRp7tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_7YsWR57tEeOJ2JaKXBO95w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_7YsWSJ7tEeOJ2JaKXBO95w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7YsWSZ7tEeOJ2JaKXBO95w"/>
+ </children>
+ <element xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7YrvMZ7tEeOJ2JaKXBO95w" x="449" y="113"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_T_1gkZ7tEeOJ2JaKXBO95w"/>
+ <element xmi:type="uml:Package" href="referencing.uml#_fmHKsJ7uEeODBa-4Ow1JoA"/>
+</notation:Diagram>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.uml b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.uml
new file mode 100644
index 00000000000..2e3b45f8cc7
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/resources/referencing.uml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_T_05gJ7tEeOJ2JaKXBO95w" name="referencing">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_T_05gZ7tEeOJ2JaKXBO95w">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Package" xmi:id="_fmHKsJ7uEeODBa-4Ow1JoA" name="core">
+ <packagedElement xmi:type="uml:Class" xmi:id="_VTe5wJ7tEeOJ2JaKXBO95w" name="Person">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_YbzVkJ7tEeOJ2JaKXBO95w" name="lastName">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_drSSMJ7tEeOJ2JaKXBO95w" name="firstName">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_fnNMUJ7tEeOJ2JaKXBO95w" name="ssn">
+ <type xmi:type="uml:PrimitiveType" href="referenced.uml#_H1GCAJ7tEeOJ2JaKXBO95w"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_0LAnkJ7tEeOJ2JaKXBO95w" name="registered">
+ <type xmi:type="uml:PrimitiveType" href="referenced.uml#_J86qIJ7tEeOJ2JaKXBO95w"/>
+ </ownedAttribute>
+ </packagedElement>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/Bug323802.uml b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/Bug323802.uml
new file mode 100644
index 00000000000..61aca0ef7fc
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/Bug323802.uml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_-3u4cJW3EeOfoK3RwHm3pQ" name="bug323802">
+ <packagedElement xmi:type="uml:Class" xmi:id="_C3c2UJW4EeOfoK3RwHm3pQ" clientDependency="_f_HJAJW4EeOfoK3RwHm3pQ" name="A"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_ExBnEJW4EeOfoK3RwHm3pQ" name="B"/>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_f_HJAJW4EeOfoK3RwHm3pQ" name="A-->B" client="_C3c2UJW4EeOfoK3RwHm3pQ" supplier="_ExBnEJW4EeOfoK3RwHm3pQ"/>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainTest.java b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainTest.java
new file mode 100644
index 00000000000..54d5d6b1dee
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainTest.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.readonly;
+
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IOperationHistoryListener;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.commands.operations.OperationHistoryEvent;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+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.transaction.RecordingCommand;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.emf.workspace.IWorkspaceCommandStack;
+import org.eclipse.papyrus.infra.core.resource.IRollbackStatus;
+import org.eclipse.papyrus.infra.core.resource.RollbackStatus;
+import org.eclipse.uml2.common.util.UML2Util;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.resource.UMLResource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.Iterables;
+
+
+/**
+ * Test suite for the {@link PapyrusROTransactionalEditingDomain} class.
+ */
+public class PapyrusROTransactionalEditingDomainTest {
+
+ private PapyrusROTransactionalEditingDomain fixture;
+
+ private Model model;
+
+ public PapyrusROTransactionalEditingDomainTest() {
+ super();
+ }
+
+ /**
+ * Test that attempting to establish a reference (in a writable object) to a read-only object will be rolled back if that reference has an
+ * opposite, which implies modification of the read-only object.
+ */
+ @Test
+ public void testReferenceToReadOnlyObjectWithOppositeRolledBackCommand() {
+ RecordingCommand cmd = new RecordingCommand(fixture) {
+
+ @Override
+ protected void doExecute() {
+ Dependency ab = (Dependency)model.getPackagedElement("A-->B");
+ assertThat(ab, notNullValue());
+
+ // can load a read-only resource just fine
+ Model primTypes = UML2Util.load(fixture.getResourceSet(), URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI), UMLPackage.Literals.MODEL);
+ Type string = primTypes.getOwnedType("String");
+ assertThat(string, notNullValue());
+ ab.getClients().add(string);
+ }
+ };
+
+ fixture.getCommandStack().execute(cmd);
+
+ // The command was rolled back, so it wasn't stacked
+ assertThat(fixture.getCommandStack().canUndo(), is(false));
+
+ // The change was rolled back
+ Dependency ab = (Dependency)model.getPackagedElement("A-->B");
+ assertThat(ab.getClients().size(), is(1));
+ assertThat(ab.getClients().get(0), instanceOf(org.eclipse.uml2.uml.Class.class));
+ }
+
+ /**
+ * Test that attempting to establish a reference (in a writable object) to a read-only object will be rolled back if that reference has an
+ * opposite, which implies modification of the read-only object.
+ */
+ @Test
+ public void testReferenceToReadOnlyObjectWithOppositeRolledBackOperation() {
+ final Type string[] = { null };
+
+ AbstractEMFOperation op = new AbstractEMFOperation(fixture, "Test") {
+
+ @Override
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Dependency ab = (Dependency)model.getPackagedElement("A-->B");
+ assertThat(ab, notNullValue());
+
+ // can load a read-only resource just fine
+ Model primTypes = UML2Util.load(fixture.getResourceSet(), URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI), UMLPackage.Literals.MODEL);
+ string[0] = primTypes.getOwnedType("String");
+ assertThat(string, notNullValue());
+ ab.getClients().add(string[0]);
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ IOperationHistory history = ((IWorkspaceCommandStack)fixture.getCommandStack()).getOperationHistory();
+ IUndoContext ctx = ((IWorkspaceCommandStack)fixture.getCommandStack()).getDefaultUndoContext();
+
+ final IRollbackStatus[] status = { null };
+
+ IOperationHistoryListener l = new IOperationHistoryListener() {
+
+ public void historyNotification(OperationHistoryEvent event) {
+ if(event.getEventType() == OperationHistoryEvent.OPERATION_NOT_OK) {
+ status[0] = RollbackStatus.findRollbackStatus(event.getStatus());
+ }
+ }
+ };
+
+ try {
+ history.addOperationHistoryListener(l);
+ history.execute(op, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ fail("Should not have thown ExecutionException because roll-back is normal.");
+ } finally {
+ history.removeOperationHistoryListener(l);
+ }
+
+ // The operation was rolled back, so it wasn't stacked
+ assertThat(history.canUndo(ctx), is(false));
+
+ // The change was rolled back
+ Dependency ab = (Dependency)model.getPackagedElement("A-->B");
+ assertThat(ab.getClients().size(), is(1));
+ assertThat(ab.getClients().get(0), instanceOf(org.eclipse.uml2.uml.Class.class));
+
+ assertThat(status[0], notNullValue());
+ assertThat(status[0].getCode(), is(IRollbackStatus.READ_ONLY_OBJECT));
+ assertThat(status[0].getCausalObjects().isEmpty(), is(false));
+ assertThat(string[0], notNullValue());
+ assertThat(Iterables.filter(status[0].getCausalObjects(), Type.class), hasItem(string[0]));
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void createFixture() throws Exception {
+ fixture = (PapyrusROTransactionalEditingDomain)new PapyrusROTransactionalEditingDomainProvider().createTransactionalEditingDomain(new ResourceSetImpl());
+
+ Resource res = fixture.getResourceSet().createResource(URI.createURI("platform:/resource/bogus/model.uml"));
+ InputStream input = PapyrusROTransactionalEditingDomainTest.class.getResourceAsStream("Bug323802.uml");
+ try {
+ res.load(input, null);
+ } finally {
+ input.close();
+ }
+ model = (Model)res.getContents().get(0);
+ }
+
+ @After
+ public void destroyFixture() {
+ ResourceSet rset = fixture.getResourceSet();
+
+ model = null;
+
+ fixture.dispose();
+ fixture = null;
+
+ for(Resource next : rset.getResources()) {
+ next.unload();
+ next.eAdapters().clear();
+ }
+
+ rset.getResources().clear();
+ rset.eAdapters().clear();
+ }
+}
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManagerTest.java b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManagerTest.java
new file mode 100644
index 00000000000..585d7e5309f
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManagerTest.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.readonly;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourceAttributes;
+import org.eclipse.core.runtime.CoreException;
+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.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.junit.utils.rules.ProjectFixture;
+import org.eclipse.uml2.uml.Model;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+
+/**
+ * Test suite for the {@link ReadOnlyManager} class.
+ */
+public class ReadOnlyManagerTest {
+
+ @Rule
+ public final ProjectFixture project = new ProjectFixture();
+
+ private ReadOnlyManager fixture;
+
+ private TransactionalEditingDomain domain;
+
+ private Model model;
+
+ public ReadOnlyManagerTest() {
+ super();
+ }
+
+ @Test
+ public void testIsReadOnlyEObject() {
+ setReadOnly(project.getFile(model.eResource().getURI()));
+ assertThat(fixture.isReadOnly(model).or(false), is(true));
+ }
+
+ @Test
+ public void testCanMakeWritableEObject() {
+ setReadOnly(project.getFile(model.eResource().getURI()));
+ assertThat(fixture.canMakeWritable(model).or(false), is(true));
+ }
+
+ @Test
+ public void testAnyReadOnlyURIs() {
+ URI uri = model.eResource().getURI();
+ setReadOnly(project.getFile(uri));
+ assertThat(fixture.anyReadOnly(new URI[]{ uri }).or(false), is(true));
+ }
+
+ @Test
+ public void testCanMakeWritableURIs() {
+ URI uri = model.eResource().getURI();
+ setReadOnly(project.getFile(uri));
+ assertThat(fixture.canMakeWritable(new URI[]{ uri }).or(false), is(true));
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void createFixture() throws Exception {
+ domain = (PapyrusROTransactionalEditingDomain)new PapyrusROTransactionalEditingDomainProvider().createTransactionalEditingDomain(new ResourceSetImpl());
+ fixture = new ReadOnlyManager(domain);
+
+ Resource res = domain.getResourceSet().createResource(project.getURI("model.uml"));
+ InputStream input = ReadOnlyManagerTest.class.getResourceAsStream("Bug323802.uml");
+ try {
+ res.load(input, null);
+ } finally {
+ input.close();
+ }
+ res.save(null); // Make sure it exists
+ model = (Model)res.getContents().get(0);
+ }
+
+ @After
+ public void destroyFixture() {
+ ResourceSet rset = domain.getResourceSet();
+
+ model = null;
+
+ domain.dispose();
+ domain = null;
+ fixture = null;
+
+ for(Resource next : rset.getResources()) {
+ next.unload();
+ next.eAdapters().clear();
+ }
+
+ rset.getResources().clear();
+ rset.eAdapters().clear();
+ }
+
+ void setReadOnly(IFile file) {
+ ResourceAttributes attr = file.getResourceAttributes();
+ attr.setReadOnly(true);
+
+ try {
+ file.setResourceAttributes(attr);
+ } catch (CoreException e) {
+ e.getLocalizedMessage();
+ fail("Failed to make workspace file read-only: " + e.getLocalizedMessage());
+ }
+ }
+}
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandlerTest.java b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandlerTest.java
new file mode 100644
index 00000000000..6f638990388
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandlerTest.java
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.readonly;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeThat;
+
+import java.util.Collections;
+
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.IWorkspaceCommandStack;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.papyrus.infra.core.resource.EditingDomainServiceFactory;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.ModelsReader;
+import org.eclipse.papyrus.infra.core.services.ServiceDescriptor;
+import org.eclipse.papyrus.infra.core.services.ServiceDescriptor.ServiceTypeKind;
+import org.eclipse.papyrus.infra.core.services.ServiceStartKind;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceInitializerService;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeManager;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.uml2.common.util.CacheAdapter;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+
+
+/**
+ * Test suite for the {@link ReferencedModelReadOnlyHandler} class.
+ */
+public class ReferencedModelReadOnlyHandlerTest {
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ private ServicesRegistry services;
+
+ private TransactionalEditingDomain domain;
+
+ private ReferencedModelReadOnlyHandler fixture;
+
+ private IProject project;
+
+ private Model model;
+
+ private Package core;
+
+ private Class person;
+
+ public ReferencedModelReadOnlyHandlerTest() {
+ super();
+ }
+
+ /**
+ * Test that cross-referenced workspace model resources are read-only by default.
+ */
+ @Test
+ public void testCrossReferencedWorkspaceModelElementsAreReadOnly() {
+ Property ssn = person.getAttribute("ssn", null);
+ assertReadOnly(ssn.getType());
+ }
+
+ /**
+ * Test that cross-referenced plug-in model resources are not handled by this read-only handler.
+ */
+ @Test
+ public void testCrossReferencedPluginModelElementsAreUnhandled() {
+ Property lastName = person.getAttribute("lastName", null);
+ assertNotReadOnly(lastName.getType());
+ }
+
+ /**
+ * Test that the main model resources are not considered as read-only by this read-only handler.
+ */
+ @Test
+ public void testMainModelElementsAreUnhandled() {
+ Property ssn = person.getAttribute("ssn", null);
+ assertNotReadOnly(ssn);
+ assertLocalViewsNotReadOnly(ssn.getType());
+ }
+
+ /**
+ * Test that we can make cross-referenced workspace model resources writable.
+ */
+ @Test
+ public void testCrossReferencedWorkspaceModelElementsMadeWritable() {
+ Property ssn = person.getAttribute("ssn", null);
+ assumeReadOnly(ssn.getType());
+ assertThat(fixture.canMakeWritable(ssn.getType()).or(false), is(true));
+ assertThat(fixture.makeWritable(ssn.getType()).or(false), is(true));
+ assertNotReadOnly(ssn.getType());
+ assertNotReadOnly(person.getAttribute("registered", null).getType());
+ }
+
+ /**
+ * Test that the sub-model units of the main model resources are not considered as read-only by this read-only handler.
+ */
+ @Test
+ public void testSubModelElementsAreUnhandled() {
+ control(core);
+
+ Property ssn = person.getAttribute("ssn", null);
+ assertNotReadOnly(ssn);
+ assertLocalViewsNotReadOnly(ssn.getType());
+ }
+
+ /**
+ * Test that a referenced resource is not considered read-only if it does not exist, because in that case it couldn't
+ * possibly be subject to conflicting edits in some other editor.
+ */
+ @Test
+ public void testNonExistentResourceIsUnhandled() {
+ Property ssn = person.getAttribute("ssn", null);
+
+ Resource referenced = ssn.getType().eResource();
+
+ // Don't use the URIConverter delete API for this
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(referenced.getURI().toPlatformString(true)));
+ assertThat(file.exists(), is(true));
+ try {
+ file.delete(true, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ fail("Failed to delete referenced resource's underlying file: " + e.getLocalizedMessage());
+ }
+
+ assertNotReadOnly(ssn.getType());
+ }
+
+ /**
+ * Test that we do not get confused by clients that pass object URIs (including fragments) into the read-only handler API,
+ * resulting in thinking that an object in a writable resource is read-only because its file-extension-trimmed URI doesn't
+ * match the resource's.
+ */
+ @Test
+ public void testObjectURIsWithFragment() {
+ Property ssn = person.getAttribute("ssn", null);
+ URI uri = EcoreUtil.getURI(ssn);
+ assertThat(fixture.anyReadOnly(new URI[]{ uri }).or(false), is(false));
+ assertThat(fixture.canMakeWritable(new URI[]{ uri }).or(true), is(false));
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void createFixture() throws Exception {
+ createProject();
+ createServiceRegistry();
+
+ domain = services.getService(TransactionalEditingDomain.class);
+ fixture = new ReferencedModelReadOnlyHandler(domain);
+ fixture.setInteractive(false);
+
+ Resource res = importModel();
+ saveModels();
+
+ model = (Model)res.getContents().get(0);
+ core = model.getNestedPackage("core");
+ person = (Class)core.getOwnedType("Person");
+ }
+
+ protected void createProject() throws Exception {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName.getMethodName());
+ if(!project.exists()) {
+ project.create(null);
+ }
+ if(!project.isOpen()) {
+ project.open(null);
+ }
+ }
+
+ protected void createServiceRegistry() throws Exception {
+ services = new ServicesRegistry();
+ services.add(ModelSet.class, 10, new ModelSet());
+ services.add(ServiceUtilsForResourceInitializerService.class, 10, new ServiceUtilsForResourceInitializerService());
+
+ ServiceDescriptor desc = new ServiceDescriptor(TransactionalEditingDomain.class, EditingDomainServiceFactory.class.getName(), ServiceStartKind.STARTUP, 10, Collections.singletonList(ModelSet.class.getName()));
+ desc.setServiceTypeKind(ServiceTypeKind.serviceFactory);
+ desc.setClassBundleID(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
+ services.add(desc);
+
+ services.startRegistry();
+ }
+
+ @After
+ public void destroyFixture() throws Exception {
+ try {
+ project.delete(true, true, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ ResourceSet rset = domain.getResourceSet();
+
+ model = null;
+ core = null;
+ person = null;
+
+ domain.dispose();
+ domain = null;
+ fixture = null;
+
+ for(Resource next : rset.getResources()) {
+ next.unload();
+ next.eAdapters().clear();
+ }
+
+ rset.getResources().clear();
+ rset.eAdapters().clear();
+
+ services.disposeRegistry();
+ }
+
+ Resource importModel() throws Exception {
+ ModelSet rset = services.getService(ModelSet.class);
+
+ importModel(rset, "referencing");
+ importModel(rset, "referenced");
+
+ // Set the ModelSet's main URI and initialize it
+ URI mainURI = URI.createPlatformResourceURI(String.format("%s/%s", project.getName(), "referencing"), true);
+ new ModelsReader().readModel(rset);
+ rset.loadModels(mainURI);
+
+ return rset.getResource(mainURI.appendFileExtension("uml"), false);
+ }
+
+ void importModel(ModelSet rset, String name) throws Exception {
+ URI source = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.emf.readonly.tests/resources/" + name, true);
+ URI destination = URI.createPlatformResourceURI(project.getName(), true);
+
+ for(String component : ImmutableList.of("uml", "notation", "di")) {
+ Resource res = rset.getResource(source.appendFileExtension(component), true);
+ EcoreUtil.resolveAll(res);
+ res.setURI(destination.appendSegment(res.getURI().lastSegment()));
+ }
+ }
+
+ void saveModels() throws Exception {
+ for(Resource next : services.getService(ModelSet.class).getResources()) {
+ if(next.getURI().isPlatformResource()) {
+ next.save(null);
+ }
+ }
+ }
+
+ void control(NamedElement element) {
+ URI unit = element.eResource().getURI().trimSegments(1).appendSegment("units").appendSegment(URI.encodeSegment(element.getName() + ".uml", true));
+ execute(ControlModeManager.getInstance().getControlCommand(new ControlModeRequest(domain, element, unit)));
+
+ assertThat("Controlling the unit failed", ((InternalEObject)element).eDirectResource(), notNullValue());
+
+ try {
+ saveModels();
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failed to save sub-model units: " + e.getLocalizedMessage());
+ }
+ }
+
+ void execute(ICommand command) {
+ IOperationHistory history = ((IWorkspaceCommandStack)domain.getCommandStack()).getOperationHistory();
+
+ try {
+ history.execute(command, null, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failed to execute command: " + e.getLocalizedMessage());
+ }
+ }
+
+ void assertReadOnly(EObject object) {
+ Optional<Boolean> status = fixture.isReadOnly(object);
+ assertThat("Not read-only", status.or(false), is(true));
+ }
+
+ void assertNotReadOnly(EObject object) {
+ Optional<Boolean> status = fixture.isReadOnly(object);
+ assertThat("Should not be either read-only or definitely writable", status.isPresent(), is(false));
+ }
+
+ void assumeReadOnly(EObject object) {
+ Optional<Boolean> status = fixture.isReadOnly(object);
+ assumeThat("Not read-only", status.or(false), is(true));
+ }
+
+ void assertLocalViewsNotReadOnly(EObject object) {
+ boolean foundSomeLocalViews = false;
+
+ for(EStructuralFeature.Setting setting : CacheAdapter.getCacheAdapter(object).getNonNavigableInverseReferences(object)) {
+ if(setting.getEStructuralFeature() == NotationPackage.Literals.VIEW__ELEMENT) {
+ EObject view = setting.getEObject();
+ URI uri = ControlledResourceTracker.getInstance(domain).getRootResourceURI(view.eResource().getURI());
+ if(uri.trimFileExtension().lastSegment().equals("referencing")) {
+ foundSomeLocalViews = true;
+ assertNotReadOnly(view);
+ }
+ }
+ }
+
+ assertThat("No local views of the object found", foundSomeLocalViews, is(true));
+ }
+}
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/tests/AllTests.java b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/tests/AllTests.java
new file mode 100644
index 00000000000..b7d564ad280
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/tests/AllTests.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.readonly.tests;
+
+import org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomainTest;
+import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManagerTest;
+import org.eclipse.papyrus.infra.emf.readonly.ReferencedModelReadOnlyHandlerTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+
+/**
+ * Master test suite.
+ */
+@RunWith(Suite.class)
+@SuiteClasses({
+PapyrusROTransactionalEditingDomainTest.class, ReferencedModelReadOnlyHandlerTest.class, ReadOnlyManagerTest.class
+})
+public class AllTests {
+
+}
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..416f4fb6960
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF
index cbdd1c73ba8..7f8d708dc08 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF
@@ -1,7 +1,11 @@
Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.infra.emf.utils
+Export-Package: org.eclipse.papyrus.infra.emf.advice,
+ org.eclipse.papyrus.infra.emf.tests,
+ org.eclipse.papyrus.infra.emf.utils
Require-Bundle: org.eclipse.emf.ecore.xmi;bundle-version="2.8.0",
- org.junit;bundle-version="4.10.0"
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.uml2.uml;bundle-version="5.0.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Bundle-Version: 1.0.0.qualifier
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/build.properties b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/build.properties
index 5e0cadfabf6..d1acf12332b 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/build.properties
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/build.properties
@@ -3,5 +3,7 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
about.html,\
- plugin.properties
-src.includes = about.html
+ plugin.properties,\
+ resources/
+src.includes = about.html,\
+ org.eclipse.papyrus.infra.emf.tests.launch
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/org.eclipse.papyrus.infra.emf.tests.launch b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/org.eclipse.papyrus.infra.emf.tests.launch
new file mode 100644
index 00000000000..318189c4f3b
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/org.eclipse.papyrus.infra.emf.tests.launch
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/tests/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JAVA_COMMAND" value="java"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.infra.emf.tests.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.infra.emf.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms768m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/resources/readonly.uml b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/resources/readonly.uml
new file mode 100644
index 00000000000..bf38c81c044
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/resources/readonly.uml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_h2dxAJo-EeOW4qDSrI_zog" name="readonly">
+ <packagedElement xmi:type="uml:Class" xmi:id="_lqVrQJo-EeOW4qDSrI_zog" name="B"/>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/resources/writable.uml b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/resources/writable.uml
new file mode 100644
index 00000000000..e7f94ac844b
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/resources/writable.uml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_h2dxAJo-EeOW4qDSrI_zog" name="writable">
+ <packagedElement xmi:type="uml:Class" xmi:id="_lqVrQJo-EeOW4qDSrI_zog" clientDependency="_KFjrIJo_EeOW4qDSrI_zog" name="A"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_IX7rsJo_EeOW4qDSrI_zog" name="D"/>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_KFjrIJo_EeOW4qDSrI_zog" name="A-->D" client="_lqVrQJo-EeOW4qDSrI_zog" supplier="_IX7rsJo_EeOW4qDSrI_zog"/>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/advice/ReadOnlyObjectEditAdviceTest.java b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/advice/ReadOnlyObjectEditAdviceTest.java
new file mode 100644
index 00000000000..f5e1a0e25aa
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/advice/ReadOnlyObjectEditAdviceTest.java
@@ -0,0 +1,631 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.advice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.UniqueEList;
+import org.eclipse.emf.ecore.EClass;
+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.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RollbackException;
+import org.eclipse.emf.transaction.Transaction;
+import org.eclipse.emf.transaction.TransactionalCommandStack;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.ClientContextManager;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelper;
+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.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.infra.core.resource.TransactionalEditingDomainManager;
+import org.eclipse.papyrus.junit.utils.rules.Condition;
+import org.eclipse.papyrus.junit.utils.rules.ConditionRule;
+import org.eclipse.papyrus.junit.utils.rules.Conditional;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.Usage;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
+
+/**
+ * Test suite for the {@link ReadOnlyObjectEditAdvice} class.
+ */
+@RunWith(Parameterized.class)
+public class ReadOnlyObjectEditAdviceTest {
+
+ private static final String TEST_BUNDLE = "org.eclipse.papyrus.infra.emf.tests"; //$NON-NLS-1$
+
+ private static final IClientContext PAPYRUS_CONTEXT = ClientContextManager.getInstance().getClientContext("org.eclipse.papyrus.infra.services.edit.TypeContext"); //$NON-NLS-1$
+
+ @Parameter
+ public ResourceMode resourceMode;
+
+ @Rule
+ public final ConditionRule condition = new ConditionRule();
+
+ @Rule
+ public final TemporaryFolder tmp = new TemporaryFolder();
+
+ private IProject project;
+
+ private IFile workspaceFile;
+
+ private TransactionalEditingDomain domain;
+
+ private Package writablePackage;
+
+ private Package readOnlyPackage;
+
+ private Class classA;
+
+ private Class classB;
+
+ public ReadOnlyObjectEditAdviceTest() {
+ super();
+ }
+
+ /**
+ * Test that setting an attribute of a read-only object is not permitted.
+ */
+ @Test
+ public void testSetCommand_attribute() {
+ ICommand command = getEditCommand(classB, new SetRequest(classB, UMLPackage.Literals.NAMED_ELEMENT__NAME, "BB")); //$NON-NLS-1$
+ assertExecutability(command);
+ }
+
+ /**
+ * Test that adding a read-only object to a multi-valued reference that has an opposite is not permitted.
+ */
+ @Test
+ public void testSetCommand_referenceOppositeAdd() {
+ Dependency dep = classA.getClientDependency("A-->D"); //$NON-NLS-1$
+ ICommand command = getEditCommand(dep, new SetRequest(dep, UMLPackage.Literals.DEPENDENCY__CLIENT, classB)); //$NON-NLS-1$
+ assertExecutability(command);
+ }
+
+ /**
+ * Test that removing a read-only object from a multi-valued reference that has an opposite is not permitted.
+ */
+ @Test
+ public void testSetCommand_referenceOppositeRemove() {
+ final Dependency dep = classA.getClientDependency("A-->D"); //$NON-NLS-1$
+
+ // By-pass edit-helpers to set up the dependency
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ dep.getClients().clear();
+ dep.getClients().add(classB); // the read-only object
+ }
+ });
+
+ Type classD = writablePackage.getOwnedType("D"); //$NON-NLS-1$
+ ICommand command = getEditCommand(dep, new SetRequest(dep, UMLPackage.Literals.DEPENDENCY__CLIENT, ImmutableList.of(classD))); //$NON-NLS-1$
+ assertExecutability(command);
+ }
+
+ /**
+ * Test that adding a read-only object to a new container by means of setting a containment reference is forbidden (as the side-effect is to
+ * remove it from the originating read-only containment context).
+ */
+ @Test
+ public void testSetCommand_containmentOldContainerReadonly() {
+ ICommand command = getEditCommand(writablePackage, new SetRequest(writablePackage, UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, classB));
+ assertExecutability(command);
+ }
+
+ /**
+ * Test that adding a read-only object to a new container by means of setting a containment reference to a new list is forbidden (as the
+ * side-effect is to remove it from the originating read-only containment context).
+ */
+ @Test
+ public void testSetCommand_containmentOldContainerReadonlyMany() {
+ List<EObject> newList = new UniqueEList<EObject>(writablePackage.getPackagedElements());
+ newList.add(classB);
+ ICommand command = getEditCommand(writablePackage, new SetRequest(writablePackage, UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, newList));
+ assertExecutability(command);
+ }
+
+ @Test
+ public void testCreateCommand() {
+ IElementType propertyType = getElementType(UMLPackage.Literals.PROPERTY);
+ ICommand command = getEditCommand(classB, new CreateElementRequest(classB, propertyType, UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE));
+ assertExecutability(command);
+ }
+
+ @Test
+ public void testCreateRelationshipCommand() {
+ IElementType usageType = getElementType(UMLPackage.Literals.USAGE);
+ // Create the Usage in the writable package to remove that concern
+ ICommand command = getEditCommand(writablePackage, new CreateRelationshipRequest(writablePackage, classB, classA, usageType));
+ assertExecutability(command);
+ }
+
+ @Test
+ public void testDestroyElementCommand() {
+ ICommand command = getEditCommand(readOnlyPackage, new DestroyElementRequest(classB, false));
+ assertExecutability(command);
+ }
+
+ @Test
+ public void testDestroyReferenceCommand_owner() {
+ final Usage[] usage = { null };
+ final Type classD = writablePackage.getOwnedType("D"); //$NON-NLS-1$
+
+ // By-pass edit-helpers to set up the relationship
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ usage[0] = (Usage)writablePackage.createPackagedElement("B-->D", UMLPackage.Literals.USAGE); //$NON-NLS-1$
+ usage[0].getClients().add(classB);
+ usage[0].getSuppliers().add(classD);
+ }
+ });
+
+ ICommand command = getEditCommand(writablePackage, new DestroyReferenceRequest(classB, UMLPackage.Literals.NAMED_ELEMENT__CLIENT_DEPENDENCY, usage[0], false)); //$NON-NLS-1$
+ assertExecutability(command);
+ }
+
+ @Test
+ public void testDestroyReferenceCommand_referencedOpposite() {
+ final Dependency dep = classA.getClientDependency("A-->D"); //$NON-NLS-1$
+
+ // By-pass edit-helpers to set up the relationship
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ dep.getClients().add(classB);
+ }
+ });
+
+ ICommand command = getEditCommand(writablePackage, new DestroyReferenceRequest(dep, UMLPackage.Literals.DEPENDENCY__CLIENT, classB, false)); //$NON-NLS-1$
+ assertExecutability(command);
+ }
+
+ @Test
+ @Conditional(key = "adviceEnabled")
+ public void testDuplicateCommand() {
+ // We don't have any edit helpers suitable for this use case
+ assertAdvice(new DuplicateElementsRequest(Collections.singletonList(classB)));
+ }
+
+ @Test
+ public void testMoveCommand_fromReadOnly() {
+ ICommand command = getEditCommand(readOnlyPackage, new MoveRequest(writablePackage, UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, classB));
+ assertExecutability(command);
+ }
+
+ /**
+ * Test the special case of a root element of a read-only resource being moved to a writable resource. Roots do not have containers (read-only
+ * or otherwise) so we need to check the originating containing resource for read-only state.
+ */
+ @Test
+ public void testMoveCommand_rootFromReadOnly() {
+ ICommand command = getEditCommand(readOnlyPackage, new MoveRequest(writablePackage, UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, readOnlyPackage));
+ assertExecutability(command);
+ }
+
+ @Test
+ public void testMoveCommand_toReadOnly() {
+ final Type classD = writablePackage.getOwnedType("D"); //$NON-NLS-1$
+ ICommand command = getEditCommand(writablePackage, new MoveRequest(readOnlyPackage, UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, classD));
+ assertExecutability(command);
+ }
+
+ @Test
+ public void testReorientRelationshipCommand_targetOldReadonly() {
+ final Dependency dep = classA.getClientDependency("A-->D"); //$NON-NLS-1$
+ final NamedElement classD = dep.getSupplier("D"); //$NON-NLS-1$
+ assertThat("Wrong initial supplier in test model dependency", classD, notNullValue()); //$NON-NLS-1$
+
+ // By-pass edit-helpers to set up the relationship
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ dep.getSuppliers().clear();
+ dep.getSuppliers().add(classB);
+ }
+ });
+
+ ICommand command = getEditCommand(dep, new ReorientRelationshipRequest(dep, classD, classB, ReorientRequest.REORIENT_TARGET));
+ // Reorienting the target is always permitted because there is no inverse reference
+ assertThat("Command should be executable", command.canExecute(), is(true)); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testReorientRelationshipCommand_targetNewReadOnly() {
+ final Dependency dep = classA.getClientDependency("A-->D"); //$NON-NLS-1$
+ final NamedElement classD = dep.getSupplier("D"); //$NON-NLS-1$
+ assertThat("Wrong supplier in test model dependency", classD, notNullValue()); //$NON-NLS-1$
+
+ ICommand command = getEditCommand(dep, new ReorientRelationshipRequest(dep, classB, classD, ReorientRequest.REORIENT_TARGET));
+ // Reorienting the target is always permitted because there is no inverse reference
+ assertThat("Command should be executable", command.canExecute(), is(true)); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testReorientRelationshipCommand_sourceNewReadOnly() {
+ final Dependency dep = classA.getClientDependency("A-->D"); //$NON-NLS-1$
+
+ ICommand command = getEditCommand(dep, new ReorientRelationshipRequest(dep, classB, classA, ReorientRequest.REORIENT_SOURCE));
+ assertExecutability(command);
+ }
+
+ @Test
+ public void testReorientRelationshipCommand_sourceOldReadOnly() {
+ final Dependency dep = classA.getClientDependency("A-->D"); //$NON-NLS-1$
+
+ // By-pass edit-helpers to set up the relationship
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ dep.getClients().clear();
+ dep.getClients().add(classB);
+ }
+ });
+
+ ICommand command = getEditCommand(dep, new ReorientRelationshipRequest(dep, classA, classB, ReorientRequest.REORIENT_SOURCE));
+ assertExecutability(command);
+ }
+
+ @Test
+ @Conditional(key = "adviceEnabled")
+ public void testReorientReferenceCommand_targetOldReadonly() {
+ final Comment[] comment = { null };
+
+ // By-pass edit-helpers to set up the reference
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ comment[0] = writablePackage.createOwnedComment();
+ comment[0].getAnnotatedElements().add(classB);
+ }
+ });
+
+ // We don't have any edit helpers suitable for this use case.
+ // Reorienting the target is always permitted because there is no inverse reference
+ assertThat(new ReadOnlyObjectEditAdvice().getBeforeEditCommand(new ReorientReferenceRelationshipRequest(comment[0], classA, classB, ReorientRequest.REORIENT_TARGET)), nullValue());
+ }
+
+ @Test
+ @Conditional(key = "adviceEnabled")
+ public void testReorientReferenceCommand_targetNewReadonly() {
+ final Comment[] comment = { null };
+
+ // By-pass edit-helpers to set up the reference
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ comment[0] = writablePackage.createOwnedComment();
+ comment[0].getAnnotatedElements().add(classA);
+ }
+ });
+
+ // We don't have any edit helpers suitable for this use case.
+ // Reorienting the target is always permitted because there is no inverse reference
+ assertThat(new ReadOnlyObjectEditAdvice().getBeforeEditCommand(new ReorientReferenceRelationshipRequest(comment[0], classB, classA, ReorientRequest.REORIENT_TARGET)), nullValue());
+ }
+
+ @Test
+ @Conditional(key = "adviceEnabled")
+ public void testReorientReferenceCommand_sourceOldReadOnly() {
+ final Comment[] comment = { null, null };
+
+ // By-pass edit-helpers to set up the reference
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ comment[0] = readOnlyPackage.createOwnedComment();
+ comment[1] = writablePackage.createOwnedComment();
+ comment[0].getAnnotatedElements().add(classA);
+ }
+ });
+
+ // We don't have any edit helpers suitable for this use case
+ assertAdvice(new ReorientReferenceRelationshipRequest(comment[0], comment[1], comment[0], ReorientRequest.REORIENT_SOURCE));
+ }
+
+ @Test
+ @Conditional(key = "adviceEnabled")
+ public void testReorientReferenceCommand_sourceNewReadonly() {
+ final Comment[] comment = { null, null };
+
+ // By-pass edit-helpers to set up the reference
+ executeUnprotected(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ comment[0] = writablePackage.createOwnedComment();
+ comment[1] = readOnlyPackage.createOwnedComment();
+ comment[0].getAnnotatedElements().add(classA);
+ }
+ });
+
+ // We don't have any edit helpers suitable for this use case
+ assertAdvice(new ReorientReferenceRelationshipRequest(comment[0], comment[1], comment[0], ReorientRequest.REORIENT_SOURCE));
+ }
+
+ //
+ // Test framework
+ //
+
+ @Parameters(name = "model is {0}")
+ public static Collection<Object[]> parameters() {
+ return ImmutableList.copyOf(Iterables.transform(Arrays.asList(ResourceMode.values()), new Function<Object, Object[]>() {
+
+ public Object[] apply(Object input) {
+ return new Object[]{ input };
+ }
+ }));
+ }
+
+ @Condition
+ public boolean adviceEnabled() {
+ return resourceMode.isAdviceEnabled();
+ }
+
+ @Before
+ public void createFixture() throws Exception {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(String.format("%s_%d", getClass().getSimpleName(), resourceMode.ordinal())); //$NON-NLS-1$
+ project.create(null);
+ project.open(null);
+
+ IFile writableFile = project.getFile("writable.uml"); //$NON-NLS-1$
+ writablePackage = loadPackage(URI.createPlatformResourceURI(writableFile.getFullPath().toString(), true));
+
+ URI readOnlyURI;
+
+ switch(resourceMode) {
+ case WORKSPACE_WRITEABLE:
+ case WORKSPACE_READONLY:
+ workspaceFile = project.getFile("readonly.uml"); //$NON-NLS-1$
+ readOnlyURI = URI.createPlatformResourceURI(workspaceFile.getFullPath().toString(), true);
+ break;
+ default: // plug-in resource
+ readOnlyURI = URI.createPlatformPluginURI(String.format("%s/resources/readonly.uml", TEST_BUNDLE), true); //$NON-NLS-1$
+ break;
+ }
+
+ readOnlyPackage = loadPackage(readOnlyURI);
+
+ switch(resourceMode) {
+ case WORKSPACE_WRITEABLE:
+ // File needs to exist to determine that it is writable
+ readOnlyPackage.eResource().save(null);
+ break;
+ case WORKSPACE_READONLY:
+ // Must first create the file, then make it read-only
+ readOnlyPackage.eResource().save(null);
+ break;
+ default:
+ // Nothing to do
+ break;
+ }
+
+ // Refresh to pick up and read-only/persisted state changes in test resources
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+
+ // Pick out some model elements
+ classA = (Class)writablePackage.getOwnedType("A"); //$NON-NLS-1$
+ classB = (Class)readOnlyPackage.getOwnedType("B"); //$NON-NLS-1$
+ }
+
+ private Package loadPackage(URI uri) throws IOException {
+ Package result = null;
+
+ if(domain == null) {
+ domain = TransactionalEditingDomainManager.createTransactionalEditingDomain(new ResourceSetImpl());
+ }
+
+ Resource res = domain.getResourceSet().createResource(uri);
+ URL url = Platform.getBundle(TEST_BUNDLE).getEntry(String.format("resources/%s", uri.lastSegment())); //$NON-NLS-1$
+
+ InputStream input = null;
+ try {
+ input = url.openStream();
+ res.load(input, null);
+ result = (Package)EcoreUtil.getObjectByType(res.getContents(), UMLPackage.Literals.PACKAGE);
+ } finally {
+ if(input != null) {
+ try {
+ input.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @After
+ public void destroyFixture() {
+ ResourceSet rset = domain.getResourceSet();
+ domain.dispose();
+ domain = null;
+
+ for(Resource next : rset.getResources()) {
+ next.unload();
+ next.eAdapters().clear();
+ }
+
+ rset.getResources().clear();
+ rset.eAdapters().clear();
+ writablePackage = null;
+ readOnlyPackage = null;
+
+ try {
+ project.delete(true, true, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ IClientContext getClientContext() {
+ switch(resourceMode) {
+ case PLUGIN_NOADVICE:
+ return ClientContextManager.getDefaultClientContext();
+ default:
+ return PAPYRUS_CONTEXT;
+ }
+ }
+
+ IEditHelper getEditHelper(EObject object) {
+ // Use the Papyrus context to get an UML-aware edit helper
+ return ElementTypeRegistry.getInstance().getElementType(object, PAPYRUS_CONTEXT).getEditHelper();
+ }
+
+ <R extends IEditCommandRequest> R prepareRequest(R request) {
+ request.setClientContext(getClientContext());
+ return request;
+ }
+
+ ICommand getEditCommand(EObject subject, IEditCommandRequest request) {
+ return getEditHelper(subject).getEditCommand(prepareRequest(request));
+ }
+
+ IElementType getElementType(EClass eclass) {
+ // Use the Papyrus context to get an UML-aware edit helper
+ return getElementType(eclass, PAPYRUS_CONTEXT);
+ }
+
+ IElementType getElementType(EClass eclass, IClientContext context) {
+ return ElementTypeRegistry.getInstance().getElementType(eclass, context);
+ }
+
+ void assertExecutability(ICommand command) {
+ switch(resourceMode) {
+ case WORKSPACE_WRITEABLE:
+ case WORKSPACE_READONLY:
+ case PLUGIN_NOADVICE:
+ // The edit-helper can return null if there is no executable command to be provided
+ assertThat("Command should be executable", (command != null) && command.canExecute(), is(true)); //$NON-NLS-1$
+ break;
+ default:
+ // The edit-helper can return null if there is no executable command to be provided
+ assertThat("Command should not be executable", (command != null) && command.canExecute(), is(false)); //$NON-NLS-1$
+ break;
+ }
+ }
+
+ void assertAdvice(IEditCommandRequest request) {
+ ICommand command = new ReadOnlyObjectEditAdvice().getBeforeEditCommand(request);
+
+ switch(resourceMode) {
+ case WORKSPACE_WRITEABLE:
+ case WORKSPACE_READONLY:
+ case PLUGIN_NOADVICE:
+ // The advice can return null if there is no need to decorate the operation
+ assertThat("Advice should be executable", (command == null) || command.canExecute(), is(true)); //$NON-NLS-1$
+ break;
+ default:
+ // The advice can return null if there is no need to decorate the operation
+ assertThat("Advice should not be executable", (command == null) || command.canExecute(), is(false)); //$NON-NLS-1$
+ break;
+ }
+ }
+
+ void executeUnprotected(Command command) {
+ try {
+ ((TransactionalCommandStack)domain.getCommandStack()).execute(command, Collections.singletonMap(Transaction.OPTION_UNPROTECTED, true));
+ } catch (InterruptedException e) {
+ fail("Unprotected command execution interrupted.");
+ } catch (RollbackException e) {
+ e.printStackTrace();
+ fail("Unprotected command execution rolled back: " + e.getLocalizedMessage());
+ }
+ }
+
+ enum ResourceMode {
+ WORKSPACE_WRITEABLE("writable in workspace"), //$NON-NLS-1$
+ WORKSPACE_READONLY("read-only in workspace"), //$NON-NLS-1$
+ PLUGIN_NOADVICE("deployed in plug-in, advice disabled"), //$NON-NLS-1$
+ PLUGIN("deployed in plug-in"); //$NON-NLS-1$
+
+ private final String displayName;
+
+ ResourceMode(String displayName) {
+ this.displayName = displayName;
+ }
+
+ boolean isAdviceEnabled() {
+ return this != PLUGIN_NOADVICE;
+ }
+
+ @Override
+ public String toString() {
+ return displayName;
+ }
+ }
+}
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/tests/AllTests.java b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/tests/AllTests.java
new file mode 100644
index 00000000000..29d5a3ca529
--- /dev/null
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/tests/org/eclipse/papyrus/infra/emf/tests/AllTests.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.emf.tests;
+
+import org.eclipse.papyrus.infra.emf.advice.ReadOnlyObjectEditAdviceTest;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+
+/**
+ * The test suite for the {@code org.eclipse.papyrus.infra.emf} plug-in.
+ */
+@RunWith(Suite.class)
+@SuiteClasses({
+// oep.infra.emf.advice
+ReadOnlyObjectEditAdviceTest.class,
+// oep.infra.emf.utils
+ServiceUtilsForResourceTest.class })
+public class AllTests {
+
+ public AllTests() {
+ super();
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.classpath b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.classpath
new file mode 100644
index 00000000000..64c5e31b7a2
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.project b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.project
new file mode 100644
index 00000000000..a7434ea3fe4
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.gmfdiag.commands.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..3eff40b8b33
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Nov 08 19:25:55 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..0afee83d834
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.commands.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: fragment
+Fragment-Host: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0"
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.commands.tests
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/about.html b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/about.html
new file mode 100644
index 00000000000..d35d5aed64c
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties
new file mode 100644
index 00000000000..6f802cf9614
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ fragment.properties,\
+ org.eclipse.papyrus.infra.gmfdiag.commands.tests.launch,\
+ about.html
+src.includes = about.html
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/fragment.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/fragment.properties
new file mode 100644
index 00000000000..6242c967488
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/fragment.properties
@@ -0,0 +1,14 @@
+#################################################################################
+# Copyright (c) 2014 CEA 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:
+#
+# Christian W. Damus (CEA) - initial API and Implementation.
+#
+##################################################################################
+pluginName=Papyrus GMF Diagram Commands Infrastructure Tests (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/org.eclipse.papyrus.infra.gmfdiag.commands.tests.launch b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/org.eclipse.papyrus.infra.gmfdiag.commands.tests.launch
new file mode 100644
index 00000000000..5afacf2f348
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/org.eclipse.papyrus.infra.gmfdiag.commands.tests.launch
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/infra/gmfdiag/commands/tests/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.infra.gmfdiag.commands.tests.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.infra.gmfdiag.commands.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/Bug402525.ecore b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/Bug402525.ecore
new file mode 100644
index 00000000000..8dea18de3e8
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/Bug402525.ecore
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bug402525" nsURI="http://www.eclipse.org/schema/Papyrus/tests/bug402525"
+ nsPrefix="bug">
+ <eClassifiers xsi:type="ecore:EClass" name="Foo"/>
+</ecore:EPackage>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStackTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStackTest.java
new file mode 100644
index 00000000000..737326cac56
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/NestingNotifyingWorkspaceCommandStackTest.java
@@ -0,0 +1,522 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ *
+ */
+package org.eclipse.papyrus.commands;
+
+import static org.hamcrest.CoreMatchers.both;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.sameInstance;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.net.URL;
+import java.util.concurrent.Callable;
+
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+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.provider.ComposedAdapterFactory;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalCommandStack;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+import com.google.common.base.Objects;
+
+
+/**
+ * Test suite for the {@link NestingNotifyingWorkspaceCommandStack} class.
+ */
+public class NestingNotifyingWorkspaceCommandStackTest {
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ // No API signatures but the most basic are required for nesting
+ private CommandStack fixture;
+
+ private TransactionalEditingDomain domain;
+
+ private ResourceSet rset;
+
+ private EPackage testPackage;
+
+ private EClass foo;
+
+ public NestingNotifyingWorkspaceCommandStackTest() {
+ super();
+ }
+
+ //
+ // Test cases
+ //
+
+ @Test
+ public void testCompleteUnnestedCommand() {
+ Callable<EAttribute> createAttribute = createAttribute();
+
+ int oldFeatureCount = foo.getEStructuralFeatures().size();
+
+ // Create two attributes
+ EAttribute attr1 = execute(createAttribute);
+ EAttribute attr2 = execute(createAttribute);
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 2));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr2));
+
+ // Undo only undoes one of them
+ Command undone = undo();
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeatures(), not(hasItem(attr2)));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 2));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr2));
+ }
+
+ @Test
+ public void testCancelUnnestedCommand() {
+ Callable<EAttribute> createAttribute = createAttribute(2);
+
+ int oldFeatureCount = foo.getEStructuralFeatures().size();
+
+ // Try to create two attributes (second one cancels)
+ EAttribute attr1 = execute(createAttribute);
+ EAttribute attr2 = execute(createAttribute);
+ assertThat(attr2, nullValue());
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeature("attribute2"), nullValue()); //$NON-NLS-1$
+
+ // Undo is sane
+ Command undone = undo();
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount));
+ assertThat(foo.getEStructuralFeatures(), not(hasItem(attr1)));
+ assertThat(foo.getEStructuralFeature("attribute2"), nullValue()); //$NON-NLS-1$
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(foo.getEStructuralFeatures().size(), is(oldFeatureCount + 1));
+ assertThat(foo.getEStructuralFeatures(), hasItem(attr1));
+ assertThat(foo.getEStructuralFeature("attribute2"), nullValue()); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testCompleteNestedCommand() {
+ final int FEATURES = 2;
+ Callable<EClass> createClass = createClass(FEATURES);
+
+ int oldClassifierCount = testPackage.getEClassifiers().size();
+
+ EClass clas = execute(createClass);
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount + 1));
+ assertThat(testPackage.getEClassifiers(), hasItem(clas));
+ assertThat(clas.getEStructuralFeatures().size(), is(FEATURES));
+ assertThat(clas.getEStructuralFeature("attribute1"), notNullValue()); //$NON-NLS-1$
+ assertThat(clas.getEStructuralFeature("attribute2"), notNullValue()); //$NON-NLS-1$
+
+ // Undo is sane and there is only one command to undo
+ Command undone = undo();
+ assertThat(fixture.canUndo(), is(false));
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount));
+ assertThat(testPackage.getEClassifiers(), not(hasItem(clas)));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount + 1));
+ assertThat(testPackage.getEClassifiers(), hasItem(clas));
+ assertThat(clas.getEStructuralFeatures().size(), is(FEATURES));
+ assertThat(clas.getEStructuralFeature("attribute1"), notNullValue()); //$NON-NLS-1$
+ assertThat(clas.getEStructuralFeature("attribute2"), notNullValue()); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testCancelNestedCommand() {
+ final int FEATURES = 2;
+ Callable<EClass> createClass = createClass(FEATURES, 2, FEATURES);
+
+ int oldClassifierCount = testPackage.getEClassifiers().size();
+
+ // Try to create two classes (second one cancels)
+ EClass class1 = execute(createClass);
+ EClass class2 = execute(createClass);
+ assertThat(class2, nullValue());
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount + 1));
+ assertThat(testPackage.getEClassifiers(), hasItem(class1));
+ assertThat(class1.getEStructuralFeatures().size(), is(FEATURES));
+ assertThat(class1.getEStructuralFeature("attribute1"), notNullValue()); //$NON-NLS-1$
+ assertThat(class1.getEStructuralFeature("attribute2"), notNullValue()); //$NON-NLS-1$
+
+ // Undo is sane and there is only one command to undo
+ Command undone = undo();
+ assertThat(fixture.canUndo(), is(false));
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount));
+ assertThat(testPackage.getEClassifiers(), not(hasItem(class1)));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(testPackage.getEClassifiers().size(), is(oldClassifierCount + 1));
+ assertThat(testPackage.getEClassifiers(), hasItem(class1));
+ assertThat(class1.getEStructuralFeatures().size(), is(FEATURES));
+ assertThat(class1.getEStructuralFeature("attribute1"), notNullValue()); //$NON-NLS-1$
+ assertThat(class1.getEStructuralFeature("attribute2"), notNullValue()); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testCompleteTripleNestedCommand() {
+ final int CLASSES = 2;
+ final int FEATURES = 2;
+
+ Callable<EPackage> createPackage = createPackage(CLASSES, FEATURES);
+
+ int oldPackageCount = testPackage.getESubpackages().size();
+
+ EPackage pkg = execute(createPackage);
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount + 1));
+ assertThat(testPackage.getESubpackages(), hasItem(pkg));
+ assertThat(pkg.getEClassifiers().size(), is(CLASSES));
+ assertThat(pkg.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class1")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertThat(pkg.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class2")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ // Undo is sane and there is only one command to undo
+ Command undone = undo();
+ assertThat(fixture.canUndo(), is(false));
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount));
+ assertThat(testPackage.getESubpackages(), not(hasItem(pkg)));
+ assertThat(pkg.getName(), nullValue());
+ assertThat(pkg.getEClassifiers().size(), is(0));
+ assertThat(pkg.getEClassifiers().size(), is(0));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(redone, sameInstance(undone));
+ assertThat(fixture.canRedo(), is(false));
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount + 1));
+ assertThat(testPackage.getESubpackages(), hasItem(pkg));
+ assertThat(pkg, named("package1")); //$NON-NLS-1$
+ assertThat(pkg.getEClassifiers().size(), is(CLASSES));
+ assertThat(pkg.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class1")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertThat(pkg.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class2")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ @Test
+ public void testCancelTripleNestedCommand() {
+ final int CLASSES = 2;
+ final int FEATURES = 2;
+
+ Callable<EPackage> createPackage = createPackage(CLASSES, FEATURES, 2, CLASSES, FEATURES);
+
+ int oldPackageCount = testPackage.getESubpackages().size();
+
+ // Try to create two packages (second one cancels)
+ EPackage pkg1 = execute(createPackage);
+ EPackage pkg2 = execute(createPackage);
+
+ // the first package is complete
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount + 1));
+ assertThat(testPackage.getESubpackages(), hasItem(pkg1));
+ assertThat(pkg1, named("package1")); //$NON-NLS-1$
+ assertThat(pkg1.getEClassifiers().size(), is(CLASSES));
+ assertThat(pkg1.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class1")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertThat(pkg1.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class2")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ // there is no second package
+ assertThat(pkg2, nullValue());
+
+ // Undo is sane and there is only one command to undo
+ Command undone = undo();
+ assertThat(fixture.canUndo(), is(false));
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount));
+ assertThat(testPackage.getESubpackages(), not(hasItem(pkg1)));
+ assertThat(pkg1.getName(), nullValue());
+ assertThat(pkg1.getEClassifiers().size(), is(0));
+
+ // Redo is sane
+ Command redone = redo();
+ assertThat(fixture.canRedo(), is(false));
+ assertThat(redone, sameInstance(undone));
+ assertThat(testPackage.getESubpackages().size(), is(oldPackageCount + 1));
+ assertThat(testPackage.getESubpackages(), hasItem(pkg1));
+ assertThat(pkg1, named("package1")); //$NON-NLS-1$
+ assertThat(pkg1.getEClassifiers().size(), is(CLASSES));
+ assertThat(pkg1.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class1")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertThat(pkg1.getEClassifiers(), hasItem(both(featureCount(FEATURES)).and(named("Class2")).and(hasFeature("attribute1")).and(hasFeature("attribute2")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void createFixture() {
+ rset = new ResourceSetImpl();
+ fixture = new NestingNotifyingWorkspaceCommandStack(CheckedOperationHistory.getInstance());
+ AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ domain = new PapyrusROTransactionalEditingDomain(adapterFactory, (TransactionalCommandStack)fixture, rset);
+
+ URL testModelURL = getClass().getResource("Bug402525.ecore"); //$NON-NLS-1$
+ Resource testModel = rset.getResource(URI.createURI(testModelURL.toExternalForm(), true), true);
+ testPackage = (EPackage)testModel.getContents().get(0);
+ foo = (EClass)testPackage.getEClassifier("Foo"); //$NON-NLS-1$
+
+ // tweak the URI so that we don't think this is a plug-in deployed resource that is unmodifiable (which triggers transaction rollback)
+ testModel.setURI(URI.createPlatformResourceURI(String.format("%s/%s", testName.getMethodName(), testModel.getURI().lastSegment()), true));
+ }
+
+ @After
+ public void destroyFixture() {
+ // This disposes the command stack for us
+ domain.dispose();
+ domain = null;
+ fixture = null;
+
+ dispose(rset);
+ rset = null;
+ }
+
+ void dispose(ResourceSet rset) {
+ for(Resource next : rset.getResources()) {
+ next.unload();
+ next.eAdapters().clear();
+ }
+
+ rset.getResources().clear();
+ rset.eAdapters().clear();
+ }
+
+ <V> V execute(final Callable<V> operation) {
+ class TestCommand extends RecordingCommand {
+
+ V result;
+
+ TestCommand() {
+ super(domain);
+ }
+
+ @Override
+ protected void doExecute() {
+ try {
+ result = operation.call();
+ } catch (OperationCanceledException e) {
+ // Pass it on
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Uncaught exception in operation: " + e.getLocalizedMessage()); //$NON-NLS-1$
+ }
+ }
+ }
+
+ TestCommand command = new TestCommand();
+ fixture.execute(command);
+ return command.result;
+ }
+
+ Command undo() {
+ assertThat("Cannot undo", fixture.canUndo()); //$NON-NLS-1$
+ Command result = fixture.getUndoCommand();
+ fixture.undo();
+ return result;
+ }
+
+ Command redo() {
+ assertThat("Cannot redo", fixture.canRedo()); //$NON-NLS-1$
+ Command result = fixture.getRedoCommand();
+ fixture.redo();
+ return result;
+ }
+
+ Callable<EAttribute> createAttribute() {
+ return createAttribute(0);
+ }
+
+ Callable<EAttribute> createAttribute(int cancelOn) {
+ return createAttribute(foo, cancelOn);
+ }
+
+ Callable<EAttribute> createAttribute(final EClass owner, final int cancelOn) {
+ return new Callable<EAttribute>() {
+
+ int i = 0;
+
+ public EAttribute call() throws Exception {
+ String name = nextName();
+
+ EAttribute attr = EcoreFactory.eINSTANCE.createEAttribute();
+ owner.getEStructuralFeatures().add(attr);
+ attr.setName(name);
+ attr.setEType(EcorePackage.Literals.ESTRING);
+
+ checkCancel();
+
+ return attr;
+ }
+
+ private String nextName() {
+ i = i + 1;
+ return "attribute" + i; //$NON-NLS-1$
+ }
+
+ private void checkCancel() {
+ if(i == cancelOn) {
+ throw new OperationCanceledException();
+ }
+ }
+ };
+ }
+
+ Callable<EClass> createClass(int attributes) {
+ return createClass(attributes, 0, 0);
+ }
+
+ Callable<EClass> createClass(int attributes, int cancelOn, int cancelAttributesOn) {
+ return createClass(testPackage, attributes, cancelOn, cancelAttributesOn);
+ }
+
+ Callable<EClass> createClass(final EPackage owner, final int attributes, final int cancelOn, final int cancelAttributesOn) {
+ return new Callable<EClass>() {
+
+ int i = 0;
+
+ public EClass call() throws Exception {
+ String name = nextName();
+
+ EClass clas = EcoreFactory.eINSTANCE.createEClass();
+ owner.getEClassifiers().add(clas);
+ clas.setName(name);
+
+ Callable<?> createAttribute = createAttribute(clas, checkCancelAttributes());
+ for(int i = 0; i < attributes; i++) {
+ // Nested command
+ execute(createAttribute);
+ }
+
+ return clas;
+ }
+
+ private String nextName() {
+ i = i + 1;
+ return "Class" + i; //$NON-NLS-1$
+ }
+
+ private int checkCancelAttributes() {
+ return (i == cancelOn) ? cancelAttributesOn : 0;
+ }
+ };
+ }
+
+ Callable<EPackage> createPackage(int classes, int attributes) {
+ return createPackage(classes, attributes, 0, 0, 0);
+ }
+
+ Callable<EPackage> createPackage(final int classes, final int attributes, final int cancelOn, final int cancelClassesOn, final int cancelAttributesOn) {
+ return new Callable<EPackage>() {
+
+ int i = 0;
+
+ public EPackage call() throws Exception {
+ String name = nextName();
+
+ EPackage pkg = EcoreFactory.eINSTANCE.createEPackage();
+ testPackage.getESubpackages().add(pkg);
+ pkg.setName(name);
+
+ Callable<?> createClass = createClass(pkg, attributes, checkCancelClasses(), cancelAttributesOn);
+ for(int i = 0; i < classes; i++) {
+ // Nested command
+ execute(createClass);
+ }
+
+ return pkg;
+ }
+
+ private String nextName() {
+ i = i + 1;
+ return "package" + i; //$NON-NLS-1$
+ }
+
+ private int checkCancelClasses() {
+ return (i == cancelOn) ? cancelClassesOn : 0;
+ }
+ };
+ }
+
+ Matcher<ENamedElement> named(final String name) {
+ return new BaseMatcher<ENamedElement>() {
+
+ public void describeTo(Description desc) {
+ desc.appendText("is named \"").appendValue(name).appendText("\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public boolean matches(Object o) {
+ return (o instanceof ENamedElement) && Objects.equal(((ENamedElement)o).getName(), name);
+ }
+ };
+ }
+
+ Matcher<EClass> featureCount(final int count) {
+ return new BaseMatcher<EClass>() {
+
+ public void describeTo(Description desc) {
+ desc.appendText("has ").appendValue(count).appendText(" features"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public boolean matches(Object o) {
+ return (o instanceof EClass) && (((EClass)o).getEStructuralFeatures().size() == count);
+ }
+ };
+ }
+
+ Matcher<EClass> hasFeature(final String name) {
+ return new BaseMatcher<EClass>() {
+
+ public void describeTo(Description desc) {
+ desc.appendText("has a \"").appendValue(name).appendText("\" feature"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public boolean matches(Object o) {
+ return (o instanceof EClass) && (((EClass)o).getEStructuralFeature(name) != null);
+ }
+ };
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/infra/gmfdiag/commands/tests/AllTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/infra/gmfdiag/commands/tests/AllTests.java
new file mode 100644
index 00000000000..ecce7998eb4
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/infra/gmfdiag/commands/tests/AllTests.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus (CEA) - initial API and implementation
+ */
+package org.eclipse.papyrus.infra.gmfdiag.commands.tests;
+
+import org.eclipse.papyrus.commands.NestingNotifyingWorkspaceCommandStackTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+
+/**
+ * Master test suite for this test fragment.
+ */
+@RunWith(Suite.class)
+@SuiteClasses({
+// {oep.commands}
+NestingNotifyingWorkspaceCommandStackTest.class })
+public class AllTests {
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.classpath b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.classpath
new file mode 100644
index 00000000000..64c5e31b7a2
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.project b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.project
new file mode 100644
index 00000000000..4686f1fb47f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.gmfdiag.common.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..af0f20f97a5
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.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.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..afea0d03906
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.common.tests
+Bundle-Version: 1.0.0.qualifier
+Fragment-Host: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Localization: fragment
+Require-Bundle: org.junit;bundle-version="4.10.0"
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/about.html b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/about.html
new file mode 100644
index 00000000000..d35d5aed64c
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties
new file mode 100644
index 00000000000..0d608a77b5e
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ fragment.properties
+src.includes = about.html,\
+ org.eclipse.papyrus.infra.gmfdiag.common.tests.launch
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.properties
new file mode 100644
index 00000000000..5b90ec40388
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.properties
@@ -0,0 +1,14 @@
+#################################################################################
+# Copyright (c) 2014 CEA 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:
+#
+# Christian W. Damus (CEA) - initial API and Implementation.
+#
+##################################################################################
+pluginName=Papyrus GMF Diagram Common Infrastructure Tests (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/org.eclipse.papyrus.infra.gmfdiag.common.tests.launch b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/org.eclipse.papyrus.infra.gmfdiag.common.tests.launch
new file mode 100644
index 00000000000..7ebd1529b1c
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/org.eclipse.papyrus.infra.gmfdiag.common.tests.launch
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.infra.gmfdiag.common.tests"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.infra.gmfdiag.common.tests.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.infra.gmfdiag.common.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AllTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AllTests.java
new file mode 100644
index 00000000000..c0928f48ead
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AllTests.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus (CEA) - initial API and implementation
+ */
+package org.eclipse.papyrus.infra.gmfdiag.common.tests;
+
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafeTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+
+/**
+ * Master test suite for this test fragment.
+ */
+@RunWith(Suite.class)
+@SuiteClasses({
+// {oep.commands}
+GMFUnsafeTest.class })
+public class AllTests {
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafeTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafeTest.java
new file mode 100644
index 00000000000..5065aa67edf
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/GMFUnsafeTest.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.gmfdiag.common.utils;
+
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collections;
+
+import junit.framework.AssertionFailedError;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.AbstractCommand;
+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.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.infra.core.resource.TransactionalEditingDomainManager;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Property;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+
+/**
+ * Test suite for the {@link GMFUnsafe} class.
+ */
+public class GMFUnsafeTest {
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ private TransactionalEditingDomain domain;
+
+ private Model model;
+
+ private Class classA;
+
+ private boolean doIt;
+
+ @Test
+ public void testWrite_runnable() throws Exception {
+ if(doIt()) {
+ GMFUnsafe.write(domain, new Runnable() {
+
+ public void run() {
+ createAttribute();
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testWrite_command() throws Exception {
+ if(doIt()) {
+ GMFUnsafe.write(domain, new AbstractCommand() {
+
+ public void redo() {
+ createAttribute();
+ }
+
+ public void execute() {
+ createAttribute();
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testWrite_gmfCommand() throws Exception {
+ if(doIt()) {
+ GMFUnsafe.write(domain, new AbstractTransactionalCommand(domain, "Test", Collections.emptyList()) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ createAttribute();
+ return CommandResult.newOKCommandResult();
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testWrap() throws Exception {
+ if(doIt()) {
+ GMFUnsafe.wrap(domain, new AbstractCommand() {
+
+ public void redo() {
+ createAttribute();
+ }
+
+ public void execute() {
+ createAttribute();
+ }
+ }).execute();
+ }
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void createFixture() throws Exception {
+ ResourceSet rset = new ResourceSetImpl();
+ domain = TransactionalEditingDomainManager.createTransactionalEditingDomain(rset);
+
+ // This will be treated by the editing domain as a read-only resource (except that we run unprotected transactions)
+ Resource res = rset.createResource(URI.createURI("bogus://test/model.uml"));
+
+ InputStream input = getClass().getResourceAsStream("model.uml");
+ try {
+ res.load(input, null);
+ } finally {
+ input.close();
+ }
+
+ model = (Model)res.getContents().get(0);
+ classA = (Class)model.getOwnedType("A");
+ }
+
+ @After
+ public void destroyFixture() {
+ ResourceSet rset = domain.getResourceSet();
+
+ for(Resource next : rset.getResources()) {
+ next.unload();
+ next.eAdapters().clear();
+ }
+ rset.getResources().clear();
+ rset.eAdapters().clear();
+
+ domain.dispose();
+
+ model = null;
+ classA = null;
+ }
+
+ Property createAttribute() {
+ return classA.createOwnedAttribute("related", classA);
+ }
+
+ void assertProperty() {
+ Property related = classA.getOwnedAttribute("related", classA);
+ assertThat(related, notNullValue());
+ }
+
+ boolean doIt() {
+ if(!doIt) {
+ try {
+ domain.runExclusive(new Runnable() {
+
+ public void run() {
+ try {
+ GMFUnsafe.write(domain, new Runnable() {
+
+ public void run() {
+ doIt = true;
+
+ try {
+ // Reflectively re-invoke the test method. This will result in it execution of its body because
+ // the re-entrant call to doIt() will return true this time
+ try {
+ Object test = GMFUnsafeTest.this;
+ Method method = test.getClass().getDeclaredMethod(testName.getMethodName());
+ method.invoke(test);
+ } catch (Exception e) {
+ if((e instanceof InvocationTargetException) && (((InvocationTargetException)e).getTargetException() instanceof AssertionFailedError)) {
+ throw (AssertionFailedError)((InvocationTargetException)e).getTargetException();
+ }
+ e.printStackTrace();
+ fail("Reflective invocation of test failed: " + e.getLocalizedMessage());
+ }
+ } finally {
+ doIt = false;
+ }
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Unsafe write failed: " + e.getLocalizedMessage());
+ }
+
+ assertProperty();
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Read transaction failed: " + e.getLocalizedMessage());
+ }
+ }
+
+ return doIt;
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/model.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/model.uml
new file mode 100644
index 00000000000..8baf6eb40f8
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/model.uml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_ri8egJ_-EeOesJ0LKEiU6A" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_yBzYUJ_-EeOesJ0LKEiU6A" name="A"/>
+</uml:Model>
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
index e185144d600..51d7e76ea04 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.ui,
org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.junit.utils,
+ org.eclipse.papyrus.junit.utils.rules,
org.eclipse.papyrus.junit.utils.tests
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/Condition.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/Condition.java
new file mode 100644
index 00000000000..08f56f0d533
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/Condition.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.junit.utils.rules;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * An annotation on a boolean-valued field or method that implements a condition to test for {@linkplain Conditional conditional execution} of test
+ * cases. The {@link #key() key} is optional; the implicit key is the field or method name.
+ *
+ * @see Conditional
+ * @see ConditionRule
+ */
+@Target({ ElementType.METHOD, ElementType.FIELD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Condition {
+
+ String key() default "";
+}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ConditionRule.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ConditionRule.java
new file mode 100644
index 00000000000..961d38552ce
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ConditionRule.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.junit.utils.rules;
+
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.junit.Assume;
+import org.junit.Rule;
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+
+/**
+ * A JUnit {@linkplain Rule rule} that skips tests annotated as {@linkplain Conditional @Conditional} when their {@linkplain Condition conditions} are
+ * not satisfied. This model is compatible with the JUnit execution and reporting in the Papyrus Hudson build, which does not understand
+ * {@linkplain Assume#assumeThat(Object, org.hamcrest.Matcher) assumption failures} and reports them as test failures.
+ *
+ * @see Conditional
+ * @see Condition
+ * @see Rule
+ */
+public class ConditionRule implements MethodRule {
+
+ public ConditionRule() {
+ super();
+ }
+
+ public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
+ return new Statement() {
+
+ @Override
+ public void evaluate() throws Throwable {
+ if(testCondition(method.getMethod().getDeclaringClass(), method.getAnnotation(Conditional.class), target)) {
+ base.evaluate();
+ }
+ }
+ };
+ }
+
+ protected boolean testCondition(Class<?> testClass, Conditional conditional, Object test) {
+ boolean result = true;
+
+ if(conditional != null) {
+ Method conditionMethod = findConditionMethod(testClass, conditional);
+ if(conditionMethod != null) {
+ result = evaluateCondition(conditionMethod, test);
+ } else {
+ Field conditionField = findConditionField(testClass, conditional);
+ if(conditionField != null) {
+ result = evaluateCondition(conditionField, test);
+ } else {
+ fail("Condition not found: " + conditional.key());
+ }
+ }
+ }
+
+ return result;
+ }
+
+ protected Method findConditionMethod(Class<?> testClass, Conditional conditional) {
+ Method result = null;
+
+ for(Method next : testClass.getDeclaredMethods()) {
+ Condition condition = next.getAnnotation(Condition.class);
+ if((condition != null) && match(conditional.key(), condition, next)) {
+ result = next;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ protected Field findConditionField(Class<?> testClass, Conditional conditional) {
+ Field result = null;
+
+ for(Field next : testClass.getDeclaredFields()) {
+ Condition condition = next.getAnnotation(Condition.class);
+ if((condition != null) && match(conditional.key(), condition, next)) {
+ result = next;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ protected boolean evaluateCondition(Method conditionMethod, Object test) {
+ boolean result = true;
+
+ try {
+ result = (Boolean)conditionMethod.invoke(test);
+ } catch (InvocationTargetException e) {
+ e.getTargetException().printStackTrace();
+ fail("Condition method evaluation failed: " + e.getTargetException().getLocalizedMessage());
+ } catch (Exception e) {
+ fail(String.format("Condition method must be public, accept no arguments, and return a boolean result: %s::%s()", conditionMethod.getDeclaringClass().getSimpleName(), conditionMethod.getName()));
+ }
+
+ return result;
+ }
+
+ protected boolean evaluateCondition(Field conditionField, Object test) {
+ boolean result = true;
+
+ try {
+ result = (Boolean)conditionField.get(test);
+ } catch (Exception e) {
+ fail(String.format("Condition field must be public and boolean-valued: %s::%s", conditionField.getDeclaringClass().getSimpleName(), conditionField.getName()));
+ }
+
+ return result;
+ }
+
+ static boolean match(String conditionKey, Condition condition, Member conditionMember) {
+ String match = condition.key();
+ if((match == null) || match.equals("")) {
+ match = conditionMember.getName();
+ }
+
+ return match.equals(conditionKey);
+ }
+}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/Conditional.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/Conditional.java
new file mode 100644
index 00000000000..1c1726bb726
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/Conditional.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.junit.utils.rules;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.junit.Test;
+
+
+/**
+ * An annotation for {@linkplain Test test methods} that are to be executed conditionally. The {@link #key() key} indicates a field or method
+ * annotated with {@link Condition @Condition}. If the condition evaluates {@code false}, the test case is skipped.
+ *
+ * @see Condition
+ * @see ConditionRule
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Conditional {
+
+ /**
+ * Identifies a condition field or method annotated with {@link Condition @Condition}, which either specifies an explicit
+ * {@linkplain Condition#key() key} or implicit by field/method name.
+ *
+ * @return the key of the condition to evaluate
+ */
+ String key();
+}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ProjectFixture.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ProjectFixture.java
new file mode 100644
index 00000000000..f808abda246
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ProjectFixture.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2014 CEA 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:
+ * Christian W. Damus (CEA) - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.junit.utils.rules;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.ResourceAttributes;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+
+/**
+ * A self-creating and self-destroying workspace project named according to the current test case.
+ */
+public class ProjectFixture implements TestRule {
+
+ private IProject project;
+
+ public ProjectFixture() {
+ super();
+ }
+
+ public final IProject getProject() {
+ return project;
+ }
+
+ public URI getURI(IPath path) {
+ return URI.createPlatformResourceURI(project.getFile(path).getFullPath().toString(), true);
+ }
+
+ public URI getURI(String path) {
+ return URI.createPlatformResourceURI(project.getFile(new Path(path)).getFullPath().toString(), true);
+ }
+
+ public IFile getFile(URI uri) {
+ return !uri.isPlatformResource() ? null : project.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
+ }
+
+ public Statement apply(final Statement base, final Description description) {
+ return new Statement() {
+
+ @Override
+ public void evaluate() throws Throwable {
+ createProject(description.getMethodName());
+
+ try {
+ base.evaluate();
+ } finally {
+ deleteProject();
+ }
+ }
+ };
+ }
+
+ protected void createProject(String name) throws CoreException {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+
+ if(project.exists()) {
+ // Start clean, if we can
+ deleteProject();
+ }
+
+ if(!project.exists()) {
+ project.create(null);
+ }
+
+ if(!project.isOpen()) {
+ project.open(null);
+ }
+
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+
+ protected void deleteProject() {
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+
+ // Make sure that we can delete everything
+ project.accept(new IResourceVisitor() {
+
+ public boolean visit(IResource resource) throws CoreException {
+ switch(resource.getType()) {
+ case IResource.FILE:
+ case IResource.FOLDER:
+ ensureWritable(resource);
+ break;
+ }
+
+ return true;
+ }
+ });
+
+ project.delete(true, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ // leave the project. We may end up re-using it, who knows?
+ }
+ }
+
+ protected void ensureWritable(IResource resource) throws CoreException {
+ ResourceAttributes attr = resource.getResourceAttributes();
+ if(attr.isReadOnly()) {
+ attr.setReadOnly(false);
+ resource.setResourceAttributes(attr);
+ }
+ }
+}
diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF
index ebdb0908e87..22572a26754 100644
--- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/META-INF/MANIFEST.MF
@@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.ide;bundle-version="3.8.0",
org.eclipse.papyrus.views.modelexplorer;bundle-version="1.0.0",
org.eclipse.emf.transaction;bundle-version="1.4.0",
- org.junit;bundle-version="4.10.0"
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.uml.modelexplorer.tests
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/Activator.java b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/Activator.java
index b75f0c94267..274bbf42413 100644
--- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/Activator.java
+++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/Activator.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -13,6 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.modelexplorer.tests;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -26,7 +27,9 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
-
+
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -35,16 +38,19 @@ public class Activator extends AbstractUIPlugin {
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(final 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
diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/ModelExplorerViewTests.java b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/ModelExplorerViewTests.java
index fdc3d8e32ba..60e5533aa5d 100644
--- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/ModelExplorerViewTests.java
+++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/ModelExplorerViewTests.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -156,6 +156,9 @@ public class ModelExplorerViewTests extends AbstractHandlerTest {
final int size = importedPackage.size();
Assert.assertTrue(size != 0);//to be sure that the tested model is correct
for(NamedElement current : importedPackage) {
+
+ waitForPendingMessages();
+
selectedElement.clear();
selectedElement.add(current);
getModelExplorerView().revealSemanticElement(selectedElement);
@@ -180,6 +183,21 @@ public class ModelExplorerViewTests extends AbstractHandlerTest {
}
}
+ private void waitForPendingMessages() {
+ //Run all pending tasks to refresh the ModelExplorer
+ if(Display.getCurrent() != null) {
+ while(true) {
+ try {
+ if(!Display.getCurrent().readAndDispatch()) {
+ break;
+ }
+ } catch (Throwable t) {
+ Activator.log.error(t);
+ }
+ }
+ }
+ }
+
@Test
public void revealSemanticElement_selectImportedPackageList() {
final List<EObject> selectedElement = new ArrayList<EObject>();
@@ -187,6 +205,10 @@ public class ModelExplorerViewTests extends AbstractHandlerTest {
final EList<Package> importedPackage = pack.getImportedPackages();
final int size = importedPackage.size();
Assert.assertNotSame(0, size);//to be sure that the tested model is correct
+
+ //Run all pending tasks to refresh the ModelExplorer
+ waitForPendingMessages();
+
selectedElement.addAll(importedPackage);
getModelExplorerView().revealSemanticElement(selectedElement);
RunnableWithResult<IWorkbenchPart> activePartRunnable;

Back to the top