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 /plugins/uml
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
Diffstat (limited to 'plugins/uml')
-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
203 files changed, 5036 insertions, 2661 deletions
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;
+ }
+
//
// fir