Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Allogo2021-07-19 09:37:03 +0000
committerVincent Lorenzo2021-10-19 16:13:44 +0000
commitfbaf7ef983af6bd5066df99ac1b709065e1558fb (patch)
tree16fc78d9721220f03c3d67f629480a7eb56226da /plugins/uml/diagram
parent74b2fbe704601da79892b73778831ae2a82f06d0 (diff)
downloadorg.eclipse.papyrus-fbaf7ef983af6bd5066df99ac1b709065e1558fb.tar.gz
org.eclipse.papyrus-fbaf7ef983af6bd5066df99ac1b709065e1558fb.tar.xz
org.eclipse.papyrus-fbaf7ef983af6bd5066df99ac1b709065e1558fb.zip
Bug 569174: [Toolsmiths] Papyrus integration of GMF Tooling - Statemachine diagram code regeneration
Statemachine diagram code regeneration after genextension migration + Fix cleanup Change-Id: I23d243b8e66ba05f95e299e0629ec306dfd7fadd Signed-off-by: Etienne Allogo <etienne.allogo@artal.fr> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/uml/diagram')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/.classpath2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/messages.properties42
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen649
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLAbstractExpression.java15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLOCLFactory.java6
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java20
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentAnnotatedElementEditPart.java23
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentBodyEditPart.java815
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentEditPart.java29
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java34
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java815
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintConstrainedElementEditPart.java23
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintEditPart.java30
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintNameLabelEditPart.java814
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkAppliedStereotypeEditPart.java738
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkEditPart.java26
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DeferrableTriggerEditPart.java810
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DoActivityStateBehaviorStateEditPart.java807
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/EntryStateBehaviorEditPart.java807
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ExitStateBehaviorEditPart.java807
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationEditPart.java26
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java739
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/InternalTransitionEditPart.java781
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java23
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java34
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java34
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java775
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java23
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionEditPart.java31
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPart.java23
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPartTN.java23
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPart.java50
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPartTN.java41
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateFloatingLabelEditPart.java782
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java23
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineEditPart.java41
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineNameEditPart.java815
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java815
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPartTN.java815
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionEditPart.java26
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java755
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionNameEditPart.java755
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java739
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/UMLEditPartFactory.java102
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/OpenDiagramEditPolicy.java196
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java340
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/AbstractParser.java1
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java35
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/DiagramEditorContextMenuProvider.java19
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/LoadResourceAction.java29
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/Messages.java321
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ModelElementSelectionPage.java21
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizard.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizardPage.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java46
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorPlugin.java22
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorUtil.java52
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramUpdater.java25
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDocumentProvider.java51
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLInitDiagramFileAction.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLLinkDescriptor.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNewDiagramFileWizard.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNodeDescriptor.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java45
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ValidateAction.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/preferences/DiagramPreferenceInitializer.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/ElementInitializers.java110
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLEditPartProvider.java4
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLElementTypes.java75
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLMarkerNavigationProvider.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLParserProvider.java23
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLViewProvider.java328
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLVisualTypeProvider.java24
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLPropertySection.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLSheetLabelProvider.java3
110 files changed, 1611 insertions, 34160 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/.classpath b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/.classpath
index 1ee876a6b66..ca630b31841 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/.classpath
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src-gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="custom-src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
index 805546c7da5..34e9e190f6f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
@@ -32,14 +32,20 @@ Bundle-Name: %pluginName
Bundle-Localization: plugin
Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: org.eclipse.emf.databinding;bundle-version="[1.5.0,2.0.0)",
+Require-Bundle: com.google.guava;bundle-version="[30.1.0,31.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.emf.databinding;bundle-version="[1.5.0,2.0.0)",
org.eclipse.emf.validation.ocl;bundle-version="[1.4.0,2.0.0)",
org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="[1.8.0,2.0.0)",
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)",
org.eclipse.m2m.qvt.oml;bundle-version="[3.10.0,4.0.0)",
+ org.eclipse.ocl.ecore;bundle-version="[3.16.0,4.0.0)",
+ org.eclipse.papyrus.infra.architecture;bundle-version="[3.1.0,4.0.0)",
org.eclipse.papyrus.infra.core;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.infra.core.architecture;bundle-version="[3.1.0,4.0.0)",
org.eclipse.papyrus.infra.core.log;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.emf;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.infra.emf.appearance;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.emf.gmf;bundle-version="[2.0.0,3.0.0)",
@@ -47,6 +53,7 @@ Require-Bundle: org.eclipse.emf.databinding;bundle-version="[1.5.0,2.0.0)",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.infra.hyperlink;bundle-version="[4.0.0,5.0.0)",
@@ -58,10 +65,13 @@ Require-Bundle: org.eclipse.emf.databinding;bundle-version="[1.5.0,2.0.0)",
org.eclipse.papyrus.infra.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.infra.widgets;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.uml.appearance;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.uml.diagram.common;bundle-version="[4.0.0,5.0.0)",
org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.uml.service.types;bundle-version="[5.0.0,6.0.0)",
org.eclipse.papyrus.uml.tools.utils;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.ui.navigator;bundle-version="[3.10.0,4.0.0)",
+ org.eclipse.ui.navigator.resources;bundle-version="[3.8.0,4.0.0)",
org.eclipse.uml2.uml.editor;bundle-version="[5.5.0,6.0.0)"
Bundle-Vendor: %providerName
Ant-Version: Apache Ant 1.7.0
@@ -70,6 +80,4 @@ Bundle-Version: 4.1.0.qualifier
Bundle-Activator: org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.statemachine; singleton:=true
-Import-Package: com.google.common.base;version="[30.1.0, 31.0.0)",
- com.google.common.collect;version="[30.1.0, 31.0.0)"
Automatic-Module-Name: org.eclipse.papyrus.uml.diagram.statemachine
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/messages.properties
index b1a06a6c41d..0af9e8e84e6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/messages.properties
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/messages.properties
@@ -44,51 +44,11 @@ UMLDiagramEditor_SaveErrorMessage=Could not save file.
UMLElementChooserDialog_SelectModelElementTitle=Select model element
ModelElementSelectionPageMessage=Select model element:
ValidateActionMessage=Validate
-NodesGroup_title=Nodes
-EdgesGroup_title=Edges
-RegionCreationTool_title=Region
-RegionCreationTool_desc=Region
-StateCreationTool_title=State
-StateCreationTool_desc=State
-InitialCreationTool_title=Initial
-InitialCreationTool_desc=Initial
-FinalStateCreationTool_title=FinalState
-FinalStateCreationTool_desc=FinalState
-ShallowHistoryCreationTool_title=ShallowHistory
-ShallowHistoryCreationTool_desc=ShallowHistory
-DeepHistoryCreationTool_title=DeepHistory
-DeepHistoryCreationTool_desc=DeepHistory
-ForkCreationTool_title=Fork
-ForkCreationTool_desc=Fork
-JoinCreationTool_title=Join
-JoinCreationTool_desc=Join
-ChoiceCreationTool_title=Choice
-ChoiceCreationTool_desc=Choice
-JunctionCreationTool_title=Junction
-JunctionCreationTool_desc=Junction
-EntryPointCreationTool_title=EntryPoint
-EntryPointCreationTool_desc=EntryPoint
-ExitPointCreationTool_title=ExitPoint
-ExitPointCreationTool_desc=ExitPoint
-TerminateCreationTool_title=Terminate
-TerminateCreationTool_desc=Terminate
-ConnectionPointReferenceCreationTool_title=ConnectionPointReference
-ConnectionPointReferenceCreationTool_desc=ConnectionPointReference
-StateMachineCommentCreationTool_title=Comment
-StateMachineCommentCreationTool_desc=Comment
-ConstraintCreationTool_title=Constraint
-ConstraintCreationTool_desc=Create Constraint
-TransitionCreationTool_title=Transition
-TransitionCreationTool_desc=Transition
-CommentlinkCreationTool_title=Link
-CommentlinkCreationTool_desc=Creation of a link for comment, constraint
RegionCompartmentEditPart_title=RegionCompartment
StateMachineCompartmentEditPart_title=StateMachineCompartment
StateCompartmentEditPart_title=StateCompartment
+StateCompartmentEditPartTN_title=StateCompartment
CommandName_OpenDiagram=Open Diagram
MessageFormatParser_InvalidInputError=Invalid input at {0}
UMLModelingAssistantProviderTitle=Select domain model element
UMLModelingAssistantProviderMessage=Available domain model elements:
-ContextLink3CreationTool_title=ContextLink
-ContextLink3CreationTool_desc=Creation of a context link for a Constraint
-StateCompartmentEditPartTN_title=StateCompartment
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 a90547012a4..98a0aa202ad 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
@@ -3,14 +3,14 @@
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmfgen="http://www.eclipse.org/papyrus/gmf/2020/GenModel"
- xmlns:papyrusgmfgenextension="http://www.eclipse.org/papyrus/gmf/2020/GenExtension">
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:gmfgen="http://www.eclipse.org/papyrus/gmf/2020/GenModel">
<gmfgen:GenEditorGenerator
packageNamePrefix="org.eclipse.papyrus.uml.diagram.statemachine"
modelID="PapyrusUMLStateMachineDiagram"
diagramFileExtension="PapyrusUMLStateMachine_diagram"
domainFileExtension="PapyrusUMLStateMachine"
- copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;http://www.eclipse.org/legal/epl-2.0&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
+ copyrightText="Copyright (c) 2014 CEA LIST.&#xA;&#xA;All rights reserved. This program and the accompanying materials&#xA;are made available under the terms of the Eclipse Public License 2.0&#xA;which accompanies this distribution, and is available at&#xA;https://www.eclipse.org/legal/epl-2.0/&#xA;&#xA;SPDX-License-Identifier: EPL-2.0&#xA;&#xA;Contributors:&#xA; CEA LIST - Initial API and implementation"
pluginDirectory="/org.eclipse.papyrus.uml.diagram.statemachine/src-gen">
<audits>
<categories
@@ -41,6 +41,7 @@
visualID="1000"
editPartClassName="PackageEditPart"
itemSemanticEditPolicyClassName="PackageItemSemanticEditPolicy"
+ visualIDOverride="Package_StateMachineDiagram"
canonicalEditPolicyClassName="PackageCanonicalEditPolicy"
iconProviderPriority="Low"
creationWizardIconPath="icons/UMLDiagramFile.gif"
@@ -81,10 +82,13 @@
visualID="3000"
editPartClassName="RegionEditPart"
itemSemanticEditPolicyClassName="RegionItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart"
+ visualIDOverride="Region_Shape"
canonicalEditPolicyClassName="RegionCanonicalEditPolicy"
compartments="/0/@diagram/@compartments.0"
graphicalNodeEditPolicyClassName="RegionGraphicalNodeEditPolicy"
createCommandClassName="RegionCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.2 /0/@diagram/@childNodes.2 /0/@diagram/@compartments.3">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -126,9 +130,12 @@
visualID="5000"
editPartClassName="FinalStateEditPart"
itemSemanticEditPolicyClassName="FinalStateItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="FinalState_Shape"
canonicalEditPolicyClassName="FinalStateCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="FinalStateGraphicalNodeEditPolicy"
createCommandClassName="FinalStateCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -173,7 +180,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="5001"
editPartClassName="FinalStateFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="FinalStateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="FinalStateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="FinalState_FloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -198,7 +209,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="5002"
editPartClassName="FinalStateStereotypeEditPart"
- itemSemanticEditPolicyClassName="FinalStateStereotypeItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="FinalStateStereotypeItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="FinalState_StereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -228,11 +243,14 @@
visualID="6000"
editPartClassName="StateEditPart"
itemSemanticEditPolicyClassName="StateItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="State_Shape"
canonicalEditPolicyClassName="StateCanonicalEditPolicy"
childNodes="/0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.0 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13"
compartments="/0/@diagram/@compartments.2"
graphicalNodeEditPolicyClassName="StateGraphicalNodeEditPolicy"
createCommandClassName="StateCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -295,7 +313,8 @@
<labels
visualID="6001"
editPartClassName="StateNameEditPart"
- itemSemanticEditPolicyClassName="StateNameItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="StateNameItemSemanticEditPolicy"
+ visualIDOverride="State_NameLabel">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -313,7 +332,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="19003"
editPartClassName="StateFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="StateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="StateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="State_FloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -338,9 +361,12 @@
visualID="8000"
editPartClassName="PseudostateInitialEditPart"
itemSemanticEditPolicyClassName="PseudostateInitialItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="Pseudostate_InitialShape"
canonicalEditPolicyClassName="PseudostateInitialCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateInitialNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateInitialCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -396,7 +422,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="8001"
editPartClassName="PseudostateInitialFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_InitialFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -421,7 +451,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="8002"
editPartClassName="PseudostateInitialStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateInitialStereotypeltemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateInitialStereotypeltemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_InitialStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -450,9 +484,12 @@
visualID="9000"
editPartClassName="PseudostateJoinEditPart"
itemSemanticEditPolicyClassName="PseudostateJoinItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="Pseudostate_JoinShape"
canonicalEditPolicyClassName="PseudostateJoinCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateJoinNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateJoinCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -512,7 +549,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="9001"
editPartClassName="PseudostateJoinFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_JoinFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -537,7 +578,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="9002"
editPartClassName="PseudostateJoinStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateJoinStereotypeItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateJoinStereotypeItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_JoinStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -566,9 +611,12 @@
visualID="10000"
editPartClassName="PseudostateForkEditPart"
itemSemanticEditPolicyClassName="PseudostateForkItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="Pseudostate_ForkShape"
canonicalEditPolicyClassName="PseudostateForkCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateForkNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateForkCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -628,7 +676,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="10001"
editPartClassName="PseudostateForkNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateForkNameItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateForkNameItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_ForkFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -650,7 +702,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="10002"
editPartClassName="PseudostateForkStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateForkStereotypeltemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateForkStereotypeltemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_ForkStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -679,9 +735,12 @@
visualID="11000"
editPartClassName="PseudostateChoiceEditPart"
itemSemanticEditPolicyClassName="PseudostateChoiceItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="Pseudostate_ChoiceShape"
canonicalEditPolicyClassName="PseudostateChoiceCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateChoiceNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateChoiceCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -737,7 +796,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="11001"
editPartClassName="PseudostateChoiceFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_ChoiceFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -762,7 +825,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="11002"
editPartClassName="PseudostateChoiceStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateChoiceStereotypeItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateChoiceStereotypeItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_ChoiceStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -791,9 +858,12 @@
visualID="12000"
editPartClassName="PseudostateJunctionEditPart"
itemSemanticEditPolicyClassName="PseudostateJunctionItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="Pseudostate_JunctionShape"
canonicalEditPolicyClassName="PseudostateJunctionCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateJunctionNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateJunctionCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -849,7 +919,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="12001"
editPartClassName="PseudostateJunctionFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_JunctionFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -874,7 +948,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="12002"
editPartClassName="PseudostateJunctionStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateJunctionStereotypeItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateJunctionStereotypeItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_JunctionStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -903,9 +981,12 @@
visualID="13000"
editPartClassName="PseudostateShallowHistoryEditPart"
itemSemanticEditPolicyClassName="PseudostateShallowHistoryItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="Pseudostate_ShallowHistoryShape"
canonicalEditPolicyClassName="PseudostateShallowHistoryCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateShallowHistoryNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateShallowHistoryCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -961,7 +1042,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="13001"
editPartClassName="PseudostateShallowHistoryFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_ShallowHistoryFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -986,7 +1071,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="13002"
editPartClassName="PseudostateShallowHistoryStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateShallowHistoryStereotypeItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateShallowHistoryStereotypeItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_ShallowHistoryStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1015,9 +1104,12 @@
visualID="14000"
editPartClassName="PseudostateDeepHistoryEditPart"
itemSemanticEditPolicyClassName="PseudostateDeepHistoryItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="Pseudostate_DeepHistoryShape"
canonicalEditPolicyClassName="PseudostateDeepHistoryCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateDeepHistoryNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateDeepHistoryCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -1073,7 +1165,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="14001"
editPartClassName="PseudostateDeepHistoryFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_DeepHistoryFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1098,7 +1194,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="14002"
editPartClassName="PseudostateDeepHistoryStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateDeepHistoryStereotypeItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateDeepHistoryStereotypeItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_DeepHistoryStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1127,9 +1227,12 @@
visualID="15000"
editPartClassName="PseudostateTerminateEditPart"
itemSemanticEditPolicyClassName="PseudostateTerminateItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="Pseudostate_TerminateShape"
canonicalEditPolicyClassName="PseudostateTerminateCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateTerminateNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateTerminateCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -1185,7 +1288,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="15001"
editPartClassName="PseudostateTerminateFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_TerminateFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1210,7 +1317,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="15002"
editPartClassName="PseudostateTerminateStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateTerminateStereotypeItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateTerminateStereotypeItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_TerminateStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1240,10 +1351,14 @@
visualID="16000"
editPartClassName="PseudostateEntryPointEditPart"
itemSemanticEditPolicyClassName="PseudostateEntryPointItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedBorderNamedElementEditPart"
+ visualIDOverride="Pseudostate_EntryPointShape"
canonicalEditPolicyClassName="PseudostateEntryPointCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateEntryPointNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateEntryPointCreateCommand"
- containers="/0/@diagram/@topLevelNodes.0 /0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@childNodes.2 /0/@diagram/@topLevelNodes.1 /0/@diagram/@compartments.3">
+ specificNotificationEvent="true"
+ containers="/0/@diagram/@topLevelNodes.0 /0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@childNodes.2 /0/@diagram/@topLevelNodes.1 /0/@diagram/@compartments.3"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<elementType
@@ -1300,7 +1415,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="16001"
editPartClassName="PseudostateEntryPointFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_EntryPointFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1325,7 +1444,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="16002"
editPartClassName="PseudostateEntryPointStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateEntryPointStereotypeltemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateEntryPointStereotypeltemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_EntryPointStereotypeLabel"
+ name="StereotypeLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1348,6 +1471,9 @@
<metaFeatures
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
</modelFacet>
+ <labelVisibilityPreference
+ role="Stereotype"
+ iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif"/>
</labels>
</childNodes>
<childNodes
@@ -1355,10 +1481,14 @@
visualID="17000"
editPartClassName="PseudostateExitPointEditPart"
itemSemanticEditPolicyClassName="PseudostateExitPointItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedBorderNamedElementEditPart"
+ visualIDOverride="Pseudostate_ExitPointShape"
canonicalEditPolicyClassName="PseudostateExitPointCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="PseudostateExitPointNodeGraphicalNodeEditPolicy"
createCommandClassName="PseudostateExitPointCreateCommand"
- containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.2 /0/@diagram/@topLevelNodes.1 /0/@diagram/@compartments.3">
+ specificNotificationEvent="true"
+ containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.2 /0/@diagram/@topLevelNodes.1 /0/@diagram/@compartments.3"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<elementType
@@ -1415,7 +1545,11 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="17001"
editPartClassName="PseudostateExitPointFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateFloatingLabelItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart"
+ visualIDOverride="Pseudostate_ExitPointFloatingNameLabel"
+ name="FloatingLabelEditPart"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1440,7 +1574,10 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="17002"
editPartClassName="PseudostateExitPointStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateExitPointStereotypeItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="PseudostateExitPointStereotypeItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="Pseudostate_ExitPointStereotypeLabel"
+ name="StereotypeLabel">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1463,6 +1600,9 @@
<metaFeatures
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
</modelFacet>
+ <labelVisibilityPreference
+ role="Stereotype"
+ iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif"/>
</labels>
</childNodes>
<childNodes
@@ -1470,10 +1610,14 @@
visualID="18000"
editPartClassName="ConnectionPointReferenceEditPart"
itemSemanticEditPolicyClassName="ConnectionPointReferenceItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractBorderEditPart"
+ visualIDOverride="ConnectionPointReference_Shape"
canonicalEditPolicyClassName="ConnectionPointReferenceCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="ConnectionPointReferenceNodeGraphicalNodeEditPolicy"
createCommandClassName="ConnectionPointReferenceCreateCommand"
- containers="/0/@diagram/@childNodes.2 /0/@diagram/@compartments.2">
+ specificNotificationEvent="true"
+ containers="/0/@diagram/@childNodes.2 /0/@diagram/@compartments.2"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<elementType
@@ -1519,7 +1663,9 @@
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="18001"
editPartClassName="ConnectionPointReferenceNameEditPart"
- itemSemanticEditPolicyClassName="ConnectionPointReferenceNameItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="ConnectionPointReferenceNameItemSemanticEditPolicy"
+ visualIDOverride="ConnectionPointReference_NameLabel"
+ locatorClassName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1537,12 +1683,18 @@
<metaFeatures
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
</modelFacet>
+ <labelVisibilityPreference
+ role="Name"
+ iconPathRole="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/name.png"/>
</labels>
<labels
xsi:type="gmfgen:GenExternalNodeLabel"
visualID="18002"
editPartClassName="ConnectionPointReferenceStereotypeEditPart"
- itemSemanticEditPolicyClassName="ConnectionPointReferenceItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="ConnectionPointReferenceItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart"
+ visualIDOverride="ConnectionPointReference_StereotypeLabel"
+ name="StereotypeLabel">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1565,12 +1717,16 @@
<metaFeatures
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
</modelFacet>
+ <labelVisibilityPreference
+ role="Stereotype"
+ iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif"/>
</labels>
</childNodes>
<childNodes
visualID="666"
editPartClassName="CommentEditPart"
itemSemanticEditPolicyClassName="CommentItemSemanticEditPolicy"
+ visualIDOverride="Comment_Shape"
canonicalEditPolicyClassName="CommentCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="CommentGraphicalNodeEditPolicy"
createCommandClassName="CommentCreateCommand"
@@ -1612,7 +1768,8 @@
</modelElementInitializer>
</modelFacet>
<labels
- visualID="6666">
+ visualID="6666"
+ visualIDOverride="Comment_BodyLabel">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1633,9 +1790,12 @@
visualID="668"
editPartClassName="ConstraintEditPart"
itemSemanticEditPolicyClassName="ConstraintItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart"
+ visualIDOverride="Constraint_Shape"
canonicalEditPolicyClassName="ConstraintCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="ConstraintGraphicalNodeEditPolicy"
createCommandClassName="ConstraintCreateCommand"
+ specificNotificationEvent="true"
containers="/0/@diagram/@compartments.0">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -1679,6 +1839,7 @@
visualID="6668"
editPartClassName="ConstraintNameLabelEditPart"
itemSemanticEditPolicyClassName="ConstraintNameLabelItemSemanticEditPolicy"
+ visualIDOverride="Constraint_NameLabel"
elementIcon="true">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -1696,7 +1857,8 @@
<labels
visualID="6669"
editPartClassName="ConstraintBodyEditPart"
- itemSemanticEditPolicyClassName="ConstraintBodyItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="ConstraintBodyItemSemanticEditPolicy"
+ visualIDOverride="Constraint_BodyLabel">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -1717,6 +1879,7 @@
visualID="680"
editPartClassName="InternalTransitionEditPart"
itemSemanticEditPolicyClassName="InternalTransitionItemSemanticEditPolicy"
+ visualIDOverride="Transition_InternalTransitionLabel"
canonicalEditPolicyClassName="InternalTransitionCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="InternalTransitionGraphicalNodeEditPolicy"
createCommandClassName="InternalTransitionCreateCommand"
@@ -1766,6 +1929,7 @@
visualID="690"
editPartClassName="EntryStateBehaviorEditPart"
itemSemanticEditPolicyClassName="EntryStateBehaviorItemSemanticEditPolicy"
+ visualIDOverride="Behavior_EntryBehaviorLabel"
canonicalEditPolicyClassName="EntryStateBehaviorCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="EntryStateBehaviorGraphicalNodeEditPolicy"
createCommandClassName="EntryStateBehaviorCreateCommand"
@@ -1806,6 +1970,7 @@
visualID="691"
editPartClassName="DoActivityStateBehaviorStateEditPart"
itemSemanticEditPolicyClassName="DoActivityStateBehaviorStateItemSemanticEditPolicy"
+ visualIDOverride="Behavior_DoActivityBehaviorLabel"
canonicalEditPolicyClassName="DoActivityStateBehaviorCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="DoActivityStateBehaviorStateGraphicalNodeEditPolicy"
createCommandClassName="DoActivityStateBehaviorStateCreateCommand"
@@ -1846,6 +2011,7 @@
visualID="692"
editPartClassName="ExitStateBehaviorEditPart"
itemSemanticEditPolicyClassName="ExitStateBehaviorItemSemanticEditPolicy"
+ visualIDOverride="Behavior_ExitBehaviorLabel"
canonicalEditPolicyClassName="ExitStateBehaviorCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="ExitStateBehaviorGraphicalNodeEditPolicy"
createCommandClassName="ExitStateBehaviorCreateCommand"
@@ -1886,6 +2052,7 @@
visualID="693"
editPartClassName="DeferrableTriggerEditPart"
itemSemanticEditPolicyClassName="DeferrableTriggerItemSemanticEditPolicy"
+ visualIDOverride="Trigger_DeferrableTriggerLabel"
canonicalEditPolicyClassName="DeferrableTriggerCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="DeferrableTriggerGraphicalNodeEditPolicy"
createCommandClassName="DeferrableTriggerCreateCommand"
@@ -1924,11 +2091,14 @@
visualID="2000"
editPartClassName="StateMachineEditPart"
itemSemanticEditPolicyClassName="StateMachineItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="StateMachine_Shape"
canonicalEditPolicyClassName="StateMachineCanonicalEditPolicy"
childNodes="/0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
compartments="/0/@diagram/@compartments.1"
graphicalNodeEditPolicyClassName="StateMachineGraphicalNodeEditPolicy"
- createCommandClassName="StateMachineCreateCommand">
+ createCommandClassName="StateMachineCreateCommand"
+ specificNotificationEvent="true">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<elementType
@@ -2005,7 +2175,8 @@
<labels
visualID="2001"
editPartClassName="StateMachineNameEditPart"
- itemSemanticEditPolicyClassName="StateMachineNameItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="StateMachineNameItemSemanticEditPolicy"
+ visualIDOverride="StateMachine_NameLabel">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -2024,11 +2195,14 @@
visualID="2010"
editPartClassName="StateEditPartTN"
itemSemanticEditPolicyClassName="StateItemSemanticEditPolicyTN"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"
+ visualIDOverride="State_Shape_TN"
canonicalEditPolicyClassName="StateCanonicalEditPolicyTN"
childNodes="/0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
compartments="/0/@diagram/@compartments.3"
graphicalNodeEditPolicyClassName="StateGraphicalNodeEditPolicyTN"
- createCommandClassName="StateCreateCommandTN">
+ createCommandClassName="StateCreateCommandTN"
+ specificNotificationEvent="true">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<elementType
@@ -2093,7 +2267,8 @@
<labels
visualID="2011"
editPartClassName="StateNameEditPartTN"
- itemSemanticEditPolicyClassName="StateNameItemSemanticEditPolicyTN">
+ itemSemanticEditPolicyClassName="StateNameItemSemanticEditPolicyTN"
+ visualIDOverride="State_NameLabel_TN">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -2112,6 +2287,8 @@
visualID="7000"
editPartClassName="TransitionEditPart"
itemSemanticEditPolicyClassName="TransitionItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"
+ visualIDOverride="Transition_Edge"
createCommandClassName="TransitionCreateCommand"
reorientCommandClassName="TransitionReorientCommand">
<diagramRunTimeClass
@@ -2131,7 +2308,7 @@
editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
<behaviour
xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
<modelFacet
xsi:type="gmfgen:TypeLinkModelFacet">
@@ -2156,7 +2333,8 @@
<labels
visualID="7001"
editPartClassName="TransitionNameEditPart"
- itemSemanticEditPolicyClassName="TransitionNameItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="TransitionNameItemSemanticEditPolicy"
+ visualIDOverride="Transition_NameLabel">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -2172,11 +2350,15 @@
<metaFeatures
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
</modelFacet>
+ <labelVisibilityPreference
+ role="Name"
+ iconPathRole="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/name.png"/>
</labels>
<labels
visualID="7002"
editPartClassName="TransitionGuardEditPart"
- itemSemanticEditPolicyClassName="TransitionGuardItemSemanticEditPolicy">
+ itemSemanticEditPolicyClassName="TransitionGuardItemSemanticEditPolicy"
+ visualIDOverride="Transition_GuardLabel">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
<viewmap
@@ -2192,11 +2374,15 @@
<metaFeatures
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Transition/guard"/>
</modelFacet>
+ <labelVisibilityPreference
+ role="Guard"
+ iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"/>
</labels>
<labels
visualID="7003"
editPartClassName="TransitionStereotypeEditPart"
itemSemanticEditPolicyClassName="TransitionStereotypeItemSemanticEditPolicy"
+ visualIDOverride="Transition_StereotypeLabel"
readOnly="true">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -2217,12 +2403,17 @@
<metaFeatures
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
</modelFacet>
+ <labelVisibilityPreference
+ role="Stereotype"
+ iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif"/>
</labels>
</links>
<links
visualID="19000"
editPartClassName="GeneralizationEditPart"
itemSemanticEditPolicyClassName="GeneralizationItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"
+ visualIDOverride="Generalization_Edge"
incomingCreationAllowed="true"
createCommandClassName="GeneralizationCreateCommand"
reorientCommandClassName="GeneralizationReorientCommand">
@@ -2239,7 +2430,7 @@
figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.GeneralizationFigure"/>
<behaviour
xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
<modelFacet
xsi:type="gmfgen:TypeLinkModelFacet">
@@ -2256,6 +2447,7 @@
visualID="19002"
editPartClassName="GeneralizationStereotypeEditPart"
itemSemanticEditPolicyClassName="GeneralizationStereotypeItemSemanticEditPolicy"
+ visualIDOverride="Generalization_StereotypeLabel"
readOnly="true">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -2276,12 +2468,17 @@
<metaFeatures
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Generalization/isSubstitutable"/>
</modelFacet>
+ <labelVisibilityPreference
+ role="Stereotype"
+ iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif"/>
</labels>
</links>
<links
visualID="667"
editPartClassName="CommentAnnotatedElementEditPart"
itemSemanticEditPolicyClassName="CommentAnnotatedElementItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"
+ visualIDOverride="Comment_AnnotatedElementEdge"
createCommandClassName="CommentAnnotatedElementCreateCommand"
reorientCommandClassName="CommentAnnotatedElementReorientCommand">
<diagramRunTimeClass
@@ -2303,6 +2500,8 @@
visualID="670"
editPartClassName="ConstraintConstrainedElementEditPart"
itemSemanticEditPolicyClassName="ConstraintConstrainedElementItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"
+ visualIDOverride="Constraint_ConstrainedElementEdge"
createCommandClassName="ConstraintConstrainedElementCreateCommand"
reorientCommandClassName="ConstraintConstrainedElementReorientCommand">
<diagramRunTimeClass
@@ -2324,6 +2523,8 @@
visualID="8500"
editPartClassName="ContextLinkEditPart"
itemSemanticEditPolicyClassName="ContextLinkItemSemanticEditPolicy"
+ superEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"
+ visualIDOverride="Constraint_ContextEdge"
createCommandClassName="ContextLinkCreateCommand"
reorientCommandClassName="ContextLinkReorientCommand">
<diagramRunTimeClass
@@ -2337,7 +2538,7 @@
figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomContextLinkFigure"/>
<behaviour
xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomAppliedStereotypeContextLinkLabelDisplayEditPolicy"/>
<modelFacet
xsi:type="gmfgen:FeatureLinkModelFacet">
@@ -2348,6 +2549,7 @@
visualID="8501"
editPartClassName="ContextLinkAppliedStereotypeEditPart"
itemSemanticEditPolicyClassName="ContextLinkAppliedStereotypeItemSemanticEditPolicy"
+ visualIDOverride="Constraint_KeywordLabel"
readOnly="true">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -2361,13 +2563,18 @@
editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.NoSemanticParserEditPolicy"/>
<modelFacet
parser="/0/@labelParsers/@implementations.0"/>
+ <labelVisibilityPreference
+ role="Stereotype"
+ iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif"/>
</labels>
</links>
<compartments
visualID="3002"
editPartClassName="RegionCompartmentEditPart"
itemSemanticEditPolicyClassName="RegionCompartmentItemSemanticEditPolicy"
+ visualIDOverride="Region_SubvertexCompartment"
canonicalEditPolicyClassName="RegionCompartmentCanonicalEditPolicy"
+ specificDiagramUpdaterClassName="org.eclipse.papyrus.uml.diagram.statemachine.custom.parts.RegionCompartmentDiagramUpdater"
childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15"
title="RegionCompartment"
canCollapse="false"
@@ -2398,6 +2605,7 @@
visualID="2002"
editPartClassName="StateMachineCompartmentEditPart"
itemSemanticEditPolicyClassName="StateMachineCompartmentItemSemanticEditPolicy"
+ visualIDOverride="StateMachine_RegionCompartment"
canonicalEditPolicyClassName="StateMachineCompartmentCanonicalEditPolicy"
childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
title="StateMachineCompartment"
@@ -2429,6 +2637,7 @@
visualID="6002"
editPartClassName="StateCompartmentEditPart"
itemSemanticEditPolicyClassName="StateCompartmentItemSemanticEditPolicy"
+ visualIDOverride="State_RegionCompartment"
canonicalEditPolicyClassName="StateCompartmentCanonicalEditPolicy"
childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.13"
title="StateCompartment"
@@ -2464,6 +2673,7 @@
visualID="6010"
editPartClassName="StateCompartmentEditPartTN"
itemSemanticEditPolicyClassName="StateCompartmentItemSemanticEditPolicyTN"
+ visualIDOverride="State_RegionCompartment_TN"
canonicalEditPolicyClassName="StateCompartmentCanonicalEditPolicyTN"
childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
title="StateCompartment"
@@ -2525,7 +2735,7 @@
iD="org.eclipse.papyrus.uml.diagram.statemachine"
name="PapyrusUMLStateMachineDiagram"
provider="Eclipse Modeling Project"
- version="3.2.100.qualifier"/>
+ version="4.1.0.qualifier"/>
<editor
iconPath="icons/UMLDiagramFile.gif"/>
<diagramUpdater/>
@@ -2600,34 +2810,34 @@
body="return org.eclipse.uml2.uml.PseudostateKind.TERMINATE_LITERAL;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is an initial&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.INITIAL_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is an initial&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.INITIAL_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a deepHistory&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.DEEP_HISTORY_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is a deepHistory&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.DEEP_HISTORY_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a shallowHistory&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.SHALLOW_HISTORY_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is a shallowHistory&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.SHALLOW_HISTORY_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a join&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.JOIN_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is a join&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.JOIN_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a fork&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.FORK_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is a fork&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.FORK_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a junction&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.JUNCTION_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is a junction&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.JUNCTION_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a choice&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.CHOICE_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is a choice&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.CHOICE_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is an entryPoint&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.ENTRY_POINT_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is an entryPoint&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.ENTRY_POINT_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is an exitPoint&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.EXIT_POINT_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is an exitPoint&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.EXIT_POINT_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a terminate&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.TERMINATE_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
+ body="// Test if the pseudostate is a terminate&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = domainElement.getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.TERMINATE_LITERAL)) {&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
<expressions
body="return org.eclipse.papyrus.uml.tools.utils.NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());"/>
<expressions
@@ -2713,333 +2923,6 @@
oclExpression="self.diagram"/>
</extensions>
</gmfgen:GenEditorGenerator>
- <papyrusgmfgenextension:PapyrusExtensionRootNode
- comment="Papyrus specific extension for GMFGen">
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Add super class to a selected set of generated EditParts"
- genView="/0/@diagram/@childNodes.0"
- name="NamedElementEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Label in charge to display applied stereotypes on links"
- genView="/0/@diagram/@links.0 /0/@diagram/@links.1 /0/@diagram/@links.2 /0/@diagram/@links.4 /0/@diagram/@links.3"
- name="UMLConnectionNodeEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel"
- comment="ExternalLabel locator"
- classpath="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator"
- genExternalNodeLabel="/0/@diagram/@childNodes.1/@labels.1 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.6/@labels.1 /0/@diagram/@childNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.13/@labels.0"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Manages stereotype shown with External Label"
- genView="/0/@diagram/@childNodes.1/@labels.1 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.6/@labels.1 /0/@diagram/@childNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.12/@labels.1 /0/@diagram/@childNodes.13/@labels.1"
- name="StereotypeLabel"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificLocator"
- comment="Affixed EntryExitPoints ConnectionPointReferences Locator"
- classpath="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"
- genChildSideAffixedNode="/0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
- comment="Region compartment custom DiagramUpdater"
- classpath="org.eclipse.papyrus.uml.diagram.statemachine.custom.parts.RegionCompartmentDiagramUpdater"
- genNode="/0/@diagram/@compartments.0"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Manage named element figure relying on Affixed Node"
- genView="/0/@diagram/@childNodes.13"
- name="AffixedNode"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractBorderEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Constraint EditPart"
- genView="/0/@diagram/@childNodes.15"
- name="ConstraintEditPart extension"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="add superclass for floating Label"
- genView="/0/@diagram/@childNodes.2/@labels.1 /0/@diagram/@childNodes.1/@labels.0 /0/@diagram/@childNodes.3/@labels.0 /0/@diagram/@childNodes.4/@labels.0 /0/@diagram/@childNodes.6/@labels.0 /0/@diagram/@childNodes.7/@labels.0 /0/@diagram/@childNodes.8/@labels.0 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0 /0/@diagram/@childNodes.5/@labels.0 /0/@diagram/@childNodes.11/@labels.0 /0/@diagram/@childNodes.12/@labels.0"
- name="FloatingLabelEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Rounded Compartment EditPart"
- genView="/0/@diagram/@childNodes.2 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.4 /0/@diagram/@topLevelNodes.1"
- name="RoundedCompartmentEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel"
- comment="Locator for external Floating label of RoundedCompartment EP"
- classpath="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator"
- genExternalNodeLabel="/0/@diagram/@childNodes.2/@labels.1 /0/@diagram/@childNodes.1/@labels.0 /0/@diagram/@childNodes.3/@labels.0 /0/@diagram/@childNodes.4/@labels.0 /0/@diagram/@childNodes.6/@labels.0 /0/@diagram/@childNodes.7/@labels.0 /0/@diagram/@childNodes.8/@labels.0 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0 /0/@diagram/@childNodes.5/@labels.0 /0/@diagram/@childNodes.11/@labels.0 /0/@diagram/@childNodes.12/@labels.0"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="extend view for affixed node"
- genView="/0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
- name="RoundedBorderNamedElementEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedBorderNamedElementEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
- comment="Stereotype"
- role="Stereotype"
- iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif"
- linkLabels="/0/@diagram/@links.0/@labels.2 /0/@diagram/@links.1/@labels.0 /0/@diagram/@links.4/@labels.0"
- externalNodeLabels="/0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.12/@labels.1 /0/@diagram/@childNodes.13/@labels.1"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
- comment="Name"
- role="Name"
- iconPathRole="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/name.png"
- linkLabels="/0/@diagram/@links.0/@labels.0"
- externalNodeLabels="/0/@diagram/@childNodes.13/@labels.0"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
- comment="Guard"
- role="Guard"
- iconPathRole="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
- linkLabels="/0/@diagram/@links.0/@labels.1"/>
- </papyrusgmfgenextension:PapyrusExtensionRootNode>
- <papyrusgmfgenextension:VisualIDOverride
- genView="/0/@diagram"
- visualID="Package_StateMachineDiagram">
- <child
- genView="/0/@diagram/@childNodes.16"
- visualID="Transition_InternalTransitionLabel"/>
- <child
- genView="/0/@diagram/@childNodes.17"
- visualID="Behavior_EntryBehaviorLabel"/>
- <child
- genView="/0/@diagram/@childNodes.18"
- visualID="Behavior_DoActivityBehaviorLabel"/>
- <child
- genView="/0/@diagram/@childNodes.19"
- visualID="Behavior_ExitBehaviorLabel"/>
- <child
- genView="/0/@diagram/@childNodes.20"
- visualID="Trigger_DeferrableTriggerLabel"/>
- <child
- genView="/0/@diagram/@childNodes.11"
- visualID="Pseudostate_EntryPointShape">
- <child
- genView="/0/@diagram/@childNodes.11/@labels.0"
- visualID="Pseudostate_EntryPointFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.11/@labels.1"
- visualID="Pseudostate_EntryPointStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.12"
- visualID="Pseudostate_ExitPointShape">
- <child
- genView="/0/@diagram/@childNodes.12/@labels.0"
- visualID="Pseudostate_ExitPointFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.12/@labels.1"
- visualID="Pseudostate_ExitPointStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.13"
- visualID="ConnectionPointReference_Shape">
- <child
- genView="/0/@diagram/@childNodes.13/@labels.0"
- visualID="ConnectionPointReference_NameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.13/@labels.1"
- visualID="ConnectionPointReference_StereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.0"
- visualID="Region_Shape"/>
- <child
- genView="/0/@diagram/@childNodes.1"
- visualID="FinalState_Shape">
- <child
- genView="/0/@diagram/@childNodes.1/@labels.0"
- visualID="FinalState_FloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.1/@labels.1"
- visualID="FinalState_StereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.2"
- visualID="State_Shape">
- <child
- genView="/0/@diagram/@childNodes.2/@labels.0"
- visualID="State_NameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.2/@labels.1"
- visualID="State_FloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.2"
- visualID="State_Shape">
- <child
- genView="/0/@diagram/@childNodes.2/@labels.0"
- visualID="State_NameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.2/@labels.1"
- visualID="State_FloatingNameLabel"/>
- </child>
- </child>
- <child
- genView="/0/@diagram/@childNodes.3"
- visualID="Pseudostate_InitialShape">
- <child
- genView="/0/@diagram/@childNodes.3/@labels.0"
- visualID="Pseudostate_InitialFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.3/@labels.1"
- visualID="Pseudostate_InitialStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.4"
- visualID="Pseudostate_JoinShape">
- <child
- genView="/0/@diagram/@childNodes.4/@labels.0"
- visualID="Pseudostate_JoinFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.4/@labels.1"
- visualID="Pseudostate_JoinStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.5"
- visualID="Pseudostate_ForkShape">
- <child
- genView="/0/@diagram/@childNodes.5/@labels.0"
- visualID="Pseudostate_ForkFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.5/@labels.1"
- visualID="Pseudostate_ForkStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.6"
- visualID="Pseudostate_ChoiceShape">
- <child
- genView="/0/@diagram/@childNodes.6/@labels.0"
- visualID="Pseudostate_ChoiceFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.6/@labels.1"
- visualID="Pseudostate_ChoiceStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.7"
- visualID="Pseudostate_JunctionShape">
- <child
- genView="/0/@diagram/@childNodes.7/@labels.0"
- visualID="Pseudostate_JunctionFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.7/@labels.1"
- visualID="Pseudostate_JunctionStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.8"
- visualID="Pseudostate_ShallowHistoryShape">
- <child
- genView="/0/@diagram/@childNodes.8/@labels.0"
- visualID="Pseudostate_ShallowHistoryFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.8/@labels.1"
- visualID="Pseudostate_ShallowHistoryStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.9"
- visualID="Pseudostate_DeepHistoryShape">
- <child
- genView="/0/@diagram/@childNodes.9/@labels.0"
- visualID="Pseudostate_DeepHistoryFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.9/@labels.1"
- visualID="Pseudostate_DeepHistoryStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.10"
- visualID="Pseudostate_TerminateShape">
- <child
- genView="/0/@diagram/@childNodes.10/@labels.0"
- visualID="Pseudostate_TerminateFloatingNameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.10/@labels.1"
- visualID="Pseudostate_TerminateStereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.14"
- visualID="Comment_Shape">
- <child
- genView="/0/@diagram/@childNodes.14/@labels.0"
- visualID="Comment_BodyLabel"/>
- </child>
- <child
- genView="/0/@diagram/@childNodes.15"
- visualID="Constraint_Shape">
- <child
- genView="/0/@diagram/@childNodes.15/@labels.0"
- visualID="Constraint_NameLabel"/>
- <child
- genView="/0/@diagram/@childNodes.15/@labels.1"
- visualID="Constraint_BodyLabel"/>
- </child>
- <child
- genView="/0/@diagram/@compartments.0"
- visualID="Region_SubvertexCompartment"/>
- <child
- genView="/0/@diagram/@compartments.1"
- visualID="StateMachine_RegionCompartment"/>
- <child
- genView="/0/@diagram/@compartments.2"
- visualID="State_RegionCompartment"/>
- <child
- genView="/0/@diagram/@compartments.3"
- visualID="State_RegionCompartment_TN"/>
- <child
- genView="/0/@diagram/@topLevelNodes.0"
- visualID="StateMachine_Shape">
- <child
- genView="/0/@diagram/@topLevelNodes.0/@labels.0"
- visualID="StateMachine_NameLabel"/>
- </child>
- <child
- genView="/0/@diagram/@links.0"
- visualID="Transition_Edge">
- <child
- genView="/0/@diagram/@links.0/@labels.0"
- visualID="Transition_NameLabel"/>
- <child
- genView="/0/@diagram/@links.0/@labels.1"
- visualID="Transition_GuardLabel"/>
- <child
- genView="/0/@diagram/@links.0/@labels.2"
- visualID="Transition_StereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@links.1"
- visualID="Generalization_Edge">
- <child
- genView="/0/@diagram/@links.1/@labels.0"
- visualID="Generalization_StereotypeLabel"/>
- </child>
- <child
- genView="/0/@diagram/@links.2"
- visualID="Comment_AnnotatedElementEdge"/>
- <child
- genView="/0/@diagram/@links.3"
- visualID="Constraint_ConstrainedElementEdge"/>
- <child
- genView="/0/@diagram/@links.4"
- visualID="Constraint_ContextEdge">
- <child
- genView="/0/@diagram/@links.4/@labels.0"
- visualID="Constraint_KeywordLabel"/>
- </child>
- <child
- genView="/0/@diagram/@topLevelNodes.1"
- visualID="State_Shape_TN">
- <child
- genView="/0/@diagram/@topLevelNodes.1/@labels.0"
- visualID="State_NameLabel_TN"/>
- </child>
- </papyrusgmfgenextension:VisualIDOverride>
+ <ecore:EAnnotation
+ source="genextension_migration"/>
</xmi:XMI>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLAbstractExpression.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLAbstractExpression.java
index e1caf6c06c4..b949ec4c405 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLAbstractExpression.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLAbstractExpression.java
@@ -116,8 +116,7 @@ public abstract class UMLAbstractExpression {
}
/**
- * Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral
- * meta-object when literal instance is expected
+ * Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected
*
* @generated
*/
@@ -143,25 +142,25 @@ public abstract class UMLAbstractExpression {
}
if (Number.class.isAssignableFrom(targetWrapperClass)) {
if (targetWrapperClass.equals(Byte.class)) {
- return new Byte(num.byteValue());
+ return Byte.valueOf(num.byteValue());
}
if (targetWrapperClass.equals(Integer.class)) {
- return new Integer(num.intValue());
+ return Integer.valueOf(num.intValue());
}
if (targetWrapperClass.equals(Short.class)) {
- return new Short(num.shortValue());
+ return Short.valueOf(num.shortValue());
}
if (targetWrapperClass.equals(Long.class)) {
- return new Long(num.longValue());
+ return Long.valueOf(num.longValue());
}
if (targetWrapperClass.equals(BigInteger.class)) {
return BigInteger.valueOf(num.longValue());
}
if (targetWrapperClass.equals(Float.class)) {
- return new Float(num.floatValue());
+ return Float.valueOf(num.floatValue());
}
if (targetWrapperClass.equals(Double.class)) {
- return new Double(num.doubleValue());
+ return Double.valueOf(num.doubleValue());
}
if (targetWrapperClass.equals(BigDecimal.class)) {
return new BigDecimal(num.doubleValue());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLOCLFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLOCLFactory.java
index c73b4ec6a48..e4b680a2c41 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLOCLFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/custom/expressions/UMLOCLFactory.java
@@ -79,8 +79,7 @@ public class UMLOCLFactory {
/**
* @generated
*/
- public static UMLAbstractExpression getExpression(int index, EClassifier context,
- Map<String, EClassifier> environment) {
+ public static UMLAbstractExpression getExpression(int index, EClassifier context, Map<String, EClassifier> environment) {
UMLOCLFactory cached = getInstance();
if (index < 0 || index >= cached.expressions.length) {
throw new IllegalArgumentException();
@@ -96,8 +95,7 @@ public class UMLOCLFactory {
*
* @generated
*/
- public static UMLAbstractExpression getExpression(String body, EClassifier context,
- Map<String, EClassifier> environment) {
+ public static UMLAbstractExpression getExpression(String body, EClassifier context, Map<String, EClassifier> environment) {
return new Expression(body, context, environment);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java
index 6fa621c3147..a0d31ea8389 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.helpers;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentAnnotatedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentAnnotatedElementEditPart.java
index d55055d5d18..7c283930b05 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentAnnotatedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentAnnotatedElementEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -29,7 +29,7 @@ public class CommentAnnotatedElementEditPart extends UMLConnectionNodeEditPart i
/**
* @generated
*/
- public static final String VISUAL_ID = "Comment_AnnotatedElementEdge";
+ public static final String VISUAL_ID = "Comment_AnnotatedElementEdge"; //$NON-NLS-1$
/**
* @generated
@@ -67,5 +67,4 @@ public class CommentAnnotatedElementEditPart extends UMLConnectionNodeEditPart i
public SimpleDashedEdgeFigure getPrimaryShape() {
return (SimpleDashedEdgeFigure) getFigure();
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentBodyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentBodyEditPart.java
index b8eb840392e..da8f83b45ba 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentBodyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentBodyEditPart.java
@@ -1,127 +1,38 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractNodeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class CommentBodyEditPart extends PapyrusCompartmentEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Comment_BodyLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class CommentBodyEditPart extends AbstractNodeLabelEditPart {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Comment_BodyLabel"; //$NON-NLS-1$
/**
* @generated
@@ -144,212 +55,15 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
@Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), CommentBodyEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -357,505 +71,4 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart
}
return parser;
}
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentEditPart.java
index 591757e84a4..0056c8c3d77 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/CommentEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -47,7 +47,7 @@ public class CommentEditPart extends NodeEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Comment_Shape";
+ public static final String VISUAL_ID = "Comment_Shape"; //$NON-NLS-1$
/**
* @generated
@@ -73,9 +73,7 @@ public class CommentEditPart extends NodeEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusReflowableShapeEditPolicy());
@@ -137,8 +135,6 @@ public class CommentEditPart extends NodeEditPart {
((CommentBodyEditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure());
return true;
}
-
-
return false;
}
@@ -185,6 +181,7 @@ public class CommentEditPart extends NodeEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
@@ -211,6 +208,7 @@ public class CommentEditPart extends NodeEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -269,5 +267,4 @@ public class CommentEditPart extends NodeEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java
index eb59a572dbf..edb7472fbde 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -61,7 +61,7 @@ public class ConnectionPointReferenceEditPart extends AbstractBorderEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "ConnectionPointReference_Shape";
+ public static final String VISUAL_ID = "ConnectionPointReference_Shape"; //$NON-NLS-1$
/**
* @generated
@@ -88,9 +88,7 @@ public class ConnectionPointReferenceEditPart extends AbstractBorderEditPart {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -157,20 +155,19 @@ public class ConnectionPointReferenceEditPart extends AbstractBorderEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
* @generated
*/
+ @Override
protected IFigure createNodeShape() {
return primaryShape = new ConnectionPointReferenceFigure();
}
@@ -205,6 +202,8 @@ public class ConnectionPointReferenceEditPart extends AbstractBorderEditPart {
/**
* @generated
*/
+
+ @Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(4, 4);
return result;
@@ -235,8 +234,10 @@ public class ConnectionPointReferenceEditPart extends AbstractBorderEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
+ @Override
protected IFigure setupContentPane(IFigure nodeShape) {
return nodeShape; // use nodeShape itself as contentPane
}
@@ -287,5 +288,4 @@ public class ConnectionPointReferenceEditPart extends AbstractBorderEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConnectionPointReferenceNameEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java
index 65afc596d41..3cabdd294ef 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java
@@ -1,132 +1,41 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractExternalLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConnectionPointReferenceNameEditPart extends PapyrusLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "ConnectionPointReference_NameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class ConnectionPointReferenceNameEditPart extends AbstractExternalLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "ConnectionPointReference_NameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -142,250 +51,19 @@ public class ConnectionPointReferenceNameEditPart extends PapyrusLabelEditPart
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), ConnectionPointReferenceNameEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -397,438 +75,6 @@ public class ConnectionPointReferenceNameEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java
index e8662d4da55..88ebcd51cec 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java
@@ -1,134 +1,43 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConnectionPointReferenceStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "ConnectionPointReference_StereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class ConnectionPointReferenceStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "ConnectionPointReference_StereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -150,245 +59,21 @@ public class ConnectionPointReferenceStereotypeEditPart extends AbstractLabelEdi
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), ConnectionPointReferenceStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -400,438 +85,6 @@ public class ConnectionPointReferenceStereotypeEditPart extends AbstractLabelEdi
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java
index 3f5b2a2fde8..33fc85ca391 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintBodyEditPart.java
@@ -1,127 +1,38 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractNodeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Constraint_BodyLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class ConstraintBodyEditPart extends AbstractNodeLabelEditPart {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Constraint_BodyLabel"; //$NON-NLS-1$
/**
* @generated
@@ -144,212 +55,15 @@ public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
@Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), ConstraintBodyEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -357,505 +71,4 @@ public class ConstraintBodyEditPart extends PapyrusCompartmentEditPart
}
return parser;
}
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintConstrainedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintConstrainedElementEditPart.java
index 4fadc2b97cf..e8219f438e4 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintConstrainedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintConstrainedElementEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -29,7 +29,7 @@ public class ConstraintConstrainedElementEditPart extends UMLConnectionNodeEditP
/**
* @generated
*/
- public static final String VISUAL_ID = "Constraint_ConstrainedElementEdge";
+ public static final String VISUAL_ID = "Constraint_ConstrainedElementEdge"; //$NON-NLS-1$
/**
* @generated
@@ -67,5 +67,4 @@ public class ConstraintConstrainedElementEditPart extends UMLConnectionNodeEditP
public SimpleDashedEdgeFigure getPrimaryShape() {
return (SimpleDashedEdgeFigure) getFigure();
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintEditPart.java
index d383660fcf0..5add7b8a943 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -47,7 +47,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Constraint_Shape";
+ public static final String VISUAL_ID = "Constraint_Shape"; //$NON-NLS-1$
/**
* @generated
@@ -73,9 +73,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
@@ -118,7 +116,6 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
-
}
/**
@@ -151,8 +148,6 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
((ConstraintBodyEditPart) childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
return true;
}
-
-
return false;
}
@@ -202,6 +197,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
@@ -228,6 +224,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -286,5 +283,4 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConstraintNameLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintNameLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintNameLabelEditPart.java
index b174766775e..a7ef7427b0f 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintNameLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ConstraintNameLabelEditPart.java
@@ -1,129 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
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.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractNodeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConstraintNameLabelEditPart extends PapyrusCompartmentEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Constraint_NameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class ConstraintNameLabelEditPart extends AbstractNodeLabelEditPart {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Constraint_NameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -146,212 +57,6 @@ public class ConstraintNameLabelEditPart extends PapyrusCompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.getIcon(getParserElement(), getViewer());
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), ConstraintNameLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -363,504 +68,11 @@ public class ConstraintNameLabelEditPart extends PapyrusCompartmentEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
@Override
protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
refreshLabel();
}
super.handleNotificationEvent(event);
}
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkAppliedStereotypeEditPart.java
index 6a03e79bc49..585f6c92f73 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkAppliedStereotypeEditPart.java
@@ -1,131 +1,44 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.NoSemanticParserEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLinkLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ContextLinkAppliedStereotypeEditPart extends PapyrusLabelEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Constraint_KeywordLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class ContextLinkAppliedStereotypeEditPart extends AbstractLinkLabelEditPart implements ILabelRoleProvider {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Constraint_KeywordLabel"; //$NON-NLS-1$
/**
* @generated
@@ -157,160 +70,15 @@ public class ContextLinkAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
@Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
@Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
protected boolean isEditable() {
return false;
}
@@ -319,58 +87,6 @@ public class ContextLinkAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
@Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), ContextLinkAppliedStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
public IParser getParser() {
if (parser == null) {
parser = ParserUtil.getParser(UMLElementTypes.Constraint_ContextEdge, getParserElement(), this, VISUAL_ID);
@@ -381,438 +97,13 @@ public class ContextLinkAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
@Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
public int getDirectEditionType() {
// The label is read-only (defined in GMFGen model)
return IDirectEdition.NO_DIRECT_EDITION;
}
/**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
* @generated
*/
@Override
@@ -827,5 +118,4 @@ public class ContextLinkAppliedStereotypeEditPart extends PapyrusLabelEditPart
public String getIconPathRole() {
return "platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif";//$NON-NLS-1$
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkEditPart.java
index e2e08f59cf6..5600fafd6be 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ContextLinkEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -32,7 +32,7 @@ public class ContextLinkEditPart extends UMLConnectionNodeEditPart implements IT
/**
* @generated
*/
- public static final String VISUAL_ID = "Constraint_ContextEdge";
+ public static final String VISUAL_ID = "Constraint_ContextEdge"; //$NON-NLS-1$
/**
* @generated
@@ -56,8 +56,7 @@ public class ContextLinkEditPart extends UMLConnectionNodeEditPart implements IT
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof ContextLinkAppliedStereotypeEditPart) {
- ((ContextLinkAppliedStereotypeEditPart) childEditPart).setLabel(
- getPrimaryShape().getAppliedStereotypeLabel());
+ ((ContextLinkAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
@@ -114,5 +113,4 @@ public class ContextLinkEditPart extends UMLConnectionNodeEditPart implements IT
public CustomContextLinkFigure getPrimaryShape() {
return (CustomContextLinkFigure) getFigure();
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DeferrableTriggerEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DeferrableTriggerEditPart.java
index d5622137359..3effb215435 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DeferrableTriggerEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DeferrableTriggerEditPart.java
@@ -1,138 +1,44 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.DragTracker;
import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.SelectionRequest;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextNonResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.CenteredWrappedLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
*/
-public class DeferrableTriggerEditPart extends CompartmentEditPart
- implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Trigger_DeferrableTriggerLabel";
-
+public class DeferrableTriggerEditPart extends AbstractCompartmentEditPart implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
/**
* @generated
*/
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
+ public static final String VISUAL_ID = "Trigger_DeferrableTriggerLabel"; //$NON-NLS-1$
/**
* @generated
@@ -145,17 +51,6 @@ public class DeferrableTriggerEditPart extends CompartmentEditPart
* @generated
*/
@Override
- public DragTracker getDragTracker(Request request) {
- if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
- return null;
- }
- return new DragEditPartsTrackerEx(this);
- }
-
- /**
- * @generated
- */
- @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
@@ -165,213 +60,6 @@ public class DeferrableTriggerEditPart extends CompartmentEditPart
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
}
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), DeferrableTriggerEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
/**
* @generated
*/
@@ -386,480 +74,8 @@ public class DeferrableTriggerEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
@Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- if (UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) {
- refreshUnderline();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
protected IFigure createFigurePrim() {
return new CenteredWrappedLabel();
}
-
- /**
- * @generated
- */
- @Override
- public boolean isSelectable() {
- return getFigure().isShowing();
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DoActivityStateBehaviorStateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DoActivityStateBehaviorStateEditPart.java
index 461d5094797..3b5c59806c5 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DoActivityStateBehaviorStateEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/DoActivityStateBehaviorStateEditPart.java
@@ -1,137 +1,44 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.DragTracker;
import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.SelectionRequest;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextNonResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.CenteredWrappedLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
*/
-public class DoActivityStateBehaviorStateEditPart extends CompartmentEditPart
- implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Behavior_DoActivityBehaviorLabel";
-
+public class DoActivityStateBehaviorStateEditPart extends AbstractCompartmentEditPart implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
/**
* @generated
*/
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Behavior_DoActivityBehaviorLabel"; //$NON-NLS-1$
/**
* @generated
@@ -144,17 +51,6 @@ public class DoActivityStateBehaviorStateEditPart extends CompartmentEditPart
* @generated
*/
@Override
- public DragTracker getDragTracker(Request request) {
- if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
- return null;
- }
- return new DragEditPartsTrackerEx(this);
- }
-
- /**
- * @generated
- */
- @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
@@ -167,212 +63,6 @@ public class DoActivityStateBehaviorStateEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), DoActivityStateBehaviorStateEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -384,479 +74,8 @@ public class DoActivityStateBehaviorStateEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
@Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- if (UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) {
- refreshUnderline();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
protected IFigure createFigurePrim() {
return new CenteredWrappedLabel();
}
-
- /**
- * @generated
- */
- @Override
- public boolean isSelectable() {
- return getFigure().isShowing();
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/EntryStateBehaviorEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/EntryStateBehaviorEditPart.java
index 282b4aa19c2..10cf09912ad 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/EntryStateBehaviorEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/EntryStateBehaviorEditPart.java
@@ -1,137 +1,44 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.DragTracker;
import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.SelectionRequest;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextNonResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.CenteredWrappedLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
*/
-public class EntryStateBehaviorEditPart extends CompartmentEditPart
- implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Behavior_EntryBehaviorLabel";
-
+public class EntryStateBehaviorEditPart extends AbstractCompartmentEditPart implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
/**
* @generated
*/
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Behavior_EntryBehaviorLabel"; //$NON-NLS-1$
/**
* @generated
@@ -144,17 +51,6 @@ public class EntryStateBehaviorEditPart extends CompartmentEditPart
* @generated
*/
@Override
- public DragTracker getDragTracker(Request request) {
- if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
- return null;
- }
- return new DragEditPartsTrackerEx(this);
- }
-
- /**
- * @generated
- */
- @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
@@ -167,212 +63,6 @@ public class EntryStateBehaviorEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), EntryStateBehaviorEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -384,479 +74,8 @@ public class EntryStateBehaviorEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
@Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- if (UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) {
- refreshUnderline();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
protected IFigure createFigurePrim() {
return new CenteredWrappedLabel();
}
-
- /**
- * @generated
- */
- @Override
- public boolean isSelectable() {
- return getFigure().isShowing();
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ExitStateBehaviorEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ExitStateBehaviorEditPart.java
index dd890846bf9..a2e68a2d83a 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ExitStateBehaviorEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/ExitStateBehaviorEditPart.java
@@ -1,137 +1,44 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.DragTracker;
import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.SelectionRequest;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextNonResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.CenteredWrappedLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
*/
-public class ExitStateBehaviorEditPart extends CompartmentEditPart
- implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Behavior_ExitBehaviorLabel";
-
+public class ExitStateBehaviorEditPart extends AbstractCompartmentEditPart implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
/**
* @generated
*/
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Behavior_ExitBehaviorLabel"; //$NON-NLS-1$
/**
* @generated
@@ -144,17 +51,6 @@ public class ExitStateBehaviorEditPart extends CompartmentEditPart
* @generated
*/
@Override
- public DragTracker getDragTracker(Request request) {
- if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
- return null;
- }
- return new DragEditPartsTrackerEx(this);
- }
-
- /**
- * @generated
- */
- @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
@@ -167,212 +63,6 @@ public class ExitStateBehaviorEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), ExitStateBehaviorEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -384,479 +74,8 @@ public class ExitStateBehaviorEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
@Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- if (UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) {
- refreshUnderline();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
protected IFigure createFigurePrim() {
return new CenteredWrappedLabel();
}
-
- /**
- * @generated
- */
- @Override
- public boolean isSelectable() {
- return getFigure().isShowing();
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateEditPart.java
index e8a21b51d38..52e403b10c7 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -58,7 +58,7 @@ public class FinalStateEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "FinalState_Shape";
+ public static final String VISUAL_ID = "FinalState_Shape"; //$NON-NLS-1$
/**
* @generated
@@ -84,9 +84,7 @@ public class FinalStateEditPart extends RoundedCompartmentEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy());
@@ -153,15 +151,13 @@ public class FinalStateEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -201,6 +197,7 @@ public class FinalStateEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(20, 20);
@@ -227,6 +224,7 @@ public class FinalStateEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -280,5 +278,4 @@ public class FinalStateEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(FinalStateFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateFloatingLabelEditPart.java
index 7bc7b2f2f89..ee136390450 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class FinalStateFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "FinalState_FloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class FinalStateFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "FinalState_FloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class FinalStateFloatingLabelEditPart extends FloatingLabelEditPart
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), FinalStateFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class FinalStateFloatingLabelEditPart extends FloatingLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java
index 87f3a1a5b41..391f12c64a6 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class FinalStateStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "FinalState_StereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class FinalStateStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "FinalState_StereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class FinalStateStereotypeEditPart extends AbstractLabelEditPart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), FinalStateStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class FinalStateStereotypeEditPart extends AbstractLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationEditPart.java
index e3b333c127d..0988ac215b2 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -32,7 +32,7 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements
/**
* @generated
*/
- public static final String VISUAL_ID = "Generalization_Edge";
+ public static final String VISUAL_ID = "Generalization_Edge"; //$NON-NLS-1$
/**
* @generated
@@ -56,8 +56,7 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof GeneralizationStereotypeEditPart) {
- ((GeneralizationStereotypeEditPart) childEditPart).setLabel(
- getPrimaryShape().getAppliedStereotypeLabel());
+ ((GeneralizationStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
@@ -114,5 +113,4 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements
public GeneralizationFigure getPrimaryShape() {
return (GeneralizationFigure) getFigure();
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java
index f62b8da0ab5..c17bee5850b 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java
@@ -1,130 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLinkLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class GeneralizationStereotypeEditPart extends PapyrusLabelEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Generalization_StereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class GeneralizationStereotypeEditPart extends AbstractLinkLabelEditPart implements ILabelRoleProvider {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Generalization_StereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -155,160 +67,15 @@ public class GeneralizationStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
@Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
@Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
protected boolean isEditable() {
return false;
}
@@ -317,58 +84,6 @@ public class GeneralizationStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
@Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), GeneralizationStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
public IParser getParser() {
if (parser == null) {
parser = ParserUtil.getParser(UMLElementTypes.Generalization_Edge, getParserElement(), this, VISUAL_ID);
@@ -379,438 +94,13 @@ public class GeneralizationStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
@Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
public int getDirectEditionType() {
// The label is read-only (defined in GMFGen model)
return IDirectEdition.NO_DIRECT_EDITION;
}
/**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
* @generated
*/
@Override
@@ -825,5 +115,4 @@ public class GeneralizationStereotypeEditPart extends PapyrusLabelEditPart
public String getIconPathRole() {
return "platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif";//$NON-NLS-1$
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/InternalTransitionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/InternalTransitionEditPart.java
index 11cc2bf887d..bf70686c76b 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/InternalTransitionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/InternalTransitionEditPart.java
@@ -1,137 +1,45 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.DragTracker;
import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.SelectionRequest;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextNonResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.CenteredWrappedLabel;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
*/
-public class InternalTransitionEditPart extends CompartmentEditPart
- implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Transition_InternalTransitionLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
+public class InternalTransitionEditPart extends AbstractCompartmentEditPart implements ITextAwareEditPart, IPrimaryEditPart, IControlParserForDirectEdit {
/**
* @generated
*/
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Transition_InternalTransitionLabel"; //$NON-NLS-1$
/**
* @generated
@@ -144,17 +52,6 @@ public class InternalTransitionEditPart extends CompartmentEditPart
* @generated
*/
@Override
- public DragTracker getDragTracker(Request request) {
- if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
- return null;
- }
- return new DragEditPartsTrackerEx(this);
- }
-
- /**
- * @generated
- */
- @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
@@ -167,153 +64,7 @@ public class InternalTransitionEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
@Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
protected boolean isEditable() {
return false;
}
@@ -322,58 +73,6 @@ public class InternalTransitionEditPart extends CompartmentEditPart
* @generated
*/
@Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), InternalTransitionEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
public IParser getParser() {
if (parser == null) {
parser = ParserUtil.getParser(UMLElementTypes.Transition_InternalTransitionLabel, getParserElement(), this, VISUAL_ID);
@@ -384,471 +83,17 @@ public class InternalTransitionEditPart extends CompartmentEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
@Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
public int getDirectEditionType() {
// The label is read-only (defined in GMFGen model)
return IDirectEdition.NO_DIRECT_EDITION;
}
/**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- if (UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) {
- refreshUnderline();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
* @generated
*/
@Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
protected IFigure createFigurePrim() {
return new CenteredWrappedLabel();
}
-
- /**
- * @generated
- */
- @Override
- public boolean isSelectable() {
- return getFigure().isShowing();
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java
index 5971db49134..cf104d785d6 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -39,7 +39,7 @@ public class PackageEditPart extends PapyrusDiagramEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Package_StateMachineDiagram";
+ public static final String VISUAL_ID = "Package_StateMachineDiagram"; //$NON-NLS-1$
/**
* @generated
@@ -61,7 +61,6 @@ public class PackageEditPart extends PapyrusDiagramEditPart {
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.PackageCanonicalEditPolicy());
-
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomPackageCreationEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomPackageXYLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java
index f310ddb04b6..290170b2076 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class PseudostateChoiceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_ChoiceShape";
+ public static final String VISUAL_ID = "Pseudostate_ChoiceShape"; //$NON-NLS-1$
/**
* @generated
@@ -86,9 +86,7 @@ public class PseudostateChoiceEditPart extends RoundedCompartmentEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -156,15 +154,13 @@ public class PseudostateChoiceEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -204,6 +200,7 @@ public class PseudostateChoiceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(60, 20);
@@ -230,6 +227,7 @@ public class PseudostateChoiceEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -283,5 +281,4 @@ public class PseudostateChoiceEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateChoiceFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceFloatingLabelEditPart.java
index 066db9ba8dd..0bc797d9957 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateChoiceFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_ChoiceFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateChoiceFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_ChoiceFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateChoiceFloatingLabelEditPart extends FloatingLabelEditPar
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateChoiceFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateChoiceFloatingLabelEditPart extends FloatingLabelEditPar
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java
index 01cb3b35a69..5922621fa6f 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateChoiceStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_ChoiceStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateChoiceStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_ChoiceStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class PseudostateChoiceStereotypeEditPart extends AbstractLabelEditPart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateChoiceStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class PseudostateChoiceStereotypeEditPart extends AbstractLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java
index 403dd6b1083..113b602b462 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class PseudostateDeepHistoryEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_DeepHistoryShape";
+ public static final String VISUAL_ID = "Pseudostate_DeepHistoryShape"; //$NON-NLS-1$
/**
* @generated
@@ -86,9 +86,7 @@ public class PseudostateDeepHistoryEditPart extends RoundedCompartmentEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -156,15 +154,13 @@ public class PseudostateDeepHistoryEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -204,6 +200,7 @@ public class PseudostateDeepHistoryEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(20, 20);
@@ -230,6 +227,7 @@ public class PseudostateDeepHistoryEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -283,5 +281,4 @@ public class PseudostateDeepHistoryEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateDeepHistoryFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryFloatingLabelEditPart.java
index c2716276587..d6212b3dc08 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateDeepHistoryFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_DeepHistoryFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateDeepHistoryFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_DeepHistoryFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateDeepHistoryFloatingLabelEditPart extends FloatingLabelEd
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateDeepHistoryFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateDeepHistoryFloatingLabelEditPart extends FloatingLabelEd
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java
index f78c376c7c3..2bdc15e8aa0 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateDeepHistoryStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_DeepHistoryStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateDeepHistoryStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_DeepHistoryStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class PseudostateDeepHistoryStereotypeEditPart extends AbstractLabelEditP
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateDeepHistoryStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class PseudostateDeepHistoryStereotypeEditPart extends AbstractLabelEditP
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java
index 8e763506090..edc188fe91d 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class PseudostateEntryPointEditPart extends RoundedBorderNamedElementEdit
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_EntryPointShape";
+ public static final String VISUAL_ID = "Pseudostate_EntryPointShape"; //$NON-NLS-1$
/**
* @generated
@@ -87,9 +87,7 @@ public class PseudostateEntryPointEditPart extends RoundedBorderNamedElementEdit
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -157,20 +155,19 @@ public class PseudostateEntryPointEditPart extends RoundedBorderNamedElementEdit
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
* @generated
*/
+ @Override
protected IFigure createNodeShape() {
return primaryShape = new RoundedCompartmentFigure();
}
@@ -204,6 +201,8 @@ public class PseudostateEntryPointEditPart extends RoundedBorderNamedElementEdit
/**
* @generated
*/
+
+ @Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(20, 20);
return result;
@@ -234,8 +233,10 @@ public class PseudostateEntryPointEditPart extends RoundedBorderNamedElementEdit
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
+ @Override
protected IFigure setupContentPane(IFigure nodeShape) {
return nodeShape; // use nodeShape itself as contentPane
}
@@ -286,5 +287,4 @@ public class PseudostateEntryPointEditPart extends RoundedBorderNamedElementEdit
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateEntryPointFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointFloatingLabelEditPart.java
index 531b2c388d8..908fd212b21 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateEntryPointFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_EntryPointFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateEntryPointFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_EntryPointFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateEntryPointFloatingLabelEditPart extends FloatingLabelEdi
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateEntryPointFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateEntryPointFloatingLabelEditPart extends FloatingLabelEdi
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java
index 2d57adcecc2..b0e3755c09c 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java
@@ -1,134 +1,43 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateEntryPointStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_EntryPointStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateEntryPointStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_EntryPointStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -150,245 +59,21 @@ public class PseudostateEntryPointStereotypeEditPart extends AbstractLabelEditPa
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateEntryPointStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -400,438 +85,6 @@ public class PseudostateEntryPointStereotypeEditPart extends AbstractLabelEditPa
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java
index b707291f952..f02c61200d8 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -62,7 +62,7 @@ public class PseudostateExitPointEditPart extends RoundedBorderNamedElementEditP
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_ExitPointShape";
+ public static final String VISUAL_ID = "Pseudostate_ExitPointShape"; //$NON-NLS-1$
/**
* @generated
@@ -89,9 +89,7 @@ public class PseudostateExitPointEditPart extends RoundedBorderNamedElementEditP
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -159,20 +157,19 @@ public class PseudostateExitPointEditPart extends RoundedBorderNamedElementEditP
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
* @generated
*/
+ @Override
protected IFigure createNodeShape() {
return primaryShape = new PseudostateExitPointFigure();
}
@@ -207,6 +204,8 @@ public class PseudostateExitPointEditPart extends RoundedBorderNamedElementEditP
/**
* @generated
*/
+
+ @Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(20, 20);
return result;
@@ -237,8 +236,10 @@ public class PseudostateExitPointEditPart extends RoundedBorderNamedElementEditP
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
+ @Override
protected IFigure setupContentPane(IFigure nodeShape) {
return nodeShape; // use nodeShape itself as contentPane
}
@@ -289,5 +290,4 @@ public class PseudostateExitPointEditPart extends RoundedBorderNamedElementEditP
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateExitPointFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointFloatingLabelEditPart.java
index 359f72d6f23..7b8aad03fbf 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateExitPointFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_ExitPointFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateExitPointFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_ExitPointFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateExitPointFloatingLabelEditPart extends FloatingLabelEdit
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateExitPointFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateExitPointFloatingLabelEditPart extends FloatingLabelEdit
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java
index 9e25517cbcd..6796397adc6 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java
@@ -1,134 +1,43 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateExitPointStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_ExitPointStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateExitPointStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_ExitPointStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -150,245 +59,21 @@ public class PseudostateExitPointStereotypeEditPart extends AbstractLabelEditPar
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateExitPointStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -400,438 +85,6 @@ public class PseudostateExitPointStereotypeEditPart extends AbstractLabelEditPar
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkEditPart.java
index 825efb7e17f..fae829c37b3 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -61,7 +61,7 @@ public class PseudostateForkEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_ForkShape";
+ public static final String VISUAL_ID = "Pseudostate_ForkShape"; //$NON-NLS-1$
/**
* @generated
@@ -87,9 +87,7 @@ public class PseudostateForkEditPart extends RoundedCompartmentEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -158,15 +156,13 @@ public class PseudostateForkEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -206,6 +202,7 @@ public class PseudostateForkEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(10, 40);
@@ -232,6 +229,7 @@ public class PseudostateForkEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -285,5 +283,4 @@ public class PseudostateForkEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateForkNameEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java
index aa78c13a4f3..b0faff0155c 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateForkNameEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_ForkFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateForkNameEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_ForkFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateForkNameEditPart extends FloatingLabelEditPart
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateForkNameEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateForkNameEditPart extends FloatingLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java
index 5a4be4b484e..e9eac1f75c0 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateForkStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_ForkStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateForkStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_ForkStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class PseudostateForkStereotypeEditPart extends AbstractLabelEditPart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateForkStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class PseudostateForkStereotypeEditPart extends AbstractLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java
index 1d53a502723..875f9a0c7d9 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class PseudostateInitialEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_InitialShape";
+ public static final String VISUAL_ID = "Pseudostate_InitialShape"; //$NON-NLS-1$
/**
* @generated
@@ -86,9 +86,7 @@ public class PseudostateInitialEditPart extends RoundedCompartmentEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -156,15 +154,13 @@ public class PseudostateInitialEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -204,6 +200,7 @@ public class PseudostateInitialEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(20, 20);
@@ -230,6 +227,7 @@ public class PseudostateInitialEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -283,5 +281,4 @@ public class PseudostateInitialEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateInitialFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialFloatingLabelEditPart.java
index 38f135bb522..eeca4c62dd7 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateInitialFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_InitialFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateInitialFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_InitialFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateInitialFloatingLabelEditPart extends FloatingLabelEditPa
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateInitialFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateInitialFloatingLabelEditPart extends FloatingLabelEditPa
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java
index 76446f21b4a..2bb16c7a57d 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateInitialStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_InitialStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateInitialStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_InitialStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class PseudostateInitialStereotypeEditPart extends AbstractLabelEditPart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateInitialStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class PseudostateInitialStereotypeEditPart extends AbstractLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java
index 0efeab5cc9e..85946624434 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -61,7 +61,7 @@ public class PseudostateJoinEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_JoinShape";
+ public static final String VISUAL_ID = "Pseudostate_JoinShape"; //$NON-NLS-1$
/**
* @generated
@@ -87,9 +87,7 @@ public class PseudostateJoinEditPart extends RoundedCompartmentEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -158,15 +156,13 @@ public class PseudostateJoinEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -206,6 +202,7 @@ public class PseudostateJoinEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(10, 40);
@@ -232,6 +229,7 @@ public class PseudostateJoinEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -285,5 +283,4 @@ public class PseudostateJoinEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateJoinFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinFloatingLabelEditPart.java
index 526ae080cc6..46c1ff0ad3b 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateJoinFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_JoinFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateJoinFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_JoinFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateJoinFloatingLabelEditPart extends FloatingLabelEditPart
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateJoinFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateJoinFloatingLabelEditPart extends FloatingLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java
index e1744549169..db046d21b6a 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateJoinStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_JoinStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateJoinStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_JoinStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class PseudostateJoinStereotypeEditPart extends AbstractLabelEditPart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateJoinStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class PseudostateJoinStereotypeEditPart extends AbstractLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java
index 2af4e2caa8c..58b0932fc20 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class PseudostateJunctionEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_JunctionShape";
+ public static final String VISUAL_ID = "Pseudostate_JunctionShape"; //$NON-NLS-1$
/**
* @generated
@@ -86,9 +86,7 @@ public class PseudostateJunctionEditPart extends RoundedCompartmentEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -156,15 +154,13 @@ public class PseudostateJunctionEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -204,6 +200,7 @@ public class PseudostateJunctionEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(10, 10);
@@ -230,6 +227,7 @@ public class PseudostateJunctionEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -283,5 +281,4 @@ public class PseudostateJunctionEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateJunctionFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionFloatingLabelEditPart.java
index 459af7839f7..a25dd2a14db 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateJunctionFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_JunctionFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateJunctionFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_JunctionFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateJunctionFloatingLabelEditPart extends FloatingLabelEditP
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateJunctionFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateJunctionFloatingLabelEditPart extends FloatingLabelEditP
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java
index 60952becaaf..ceeaaff00fe 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateJunctionStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_JunctionStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateJunctionStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_JunctionStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class PseudostateJunctionStereotypeEditPart extends AbstractLabelEditPart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateJunctionStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class PseudostateJunctionStereotypeEditPart extends AbstractLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java
index ff1be8541ec..8687c737430 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class PseudostateShallowHistoryEditPart extends RoundedCompartmentEditPar
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_ShallowHistoryShape";
+ public static final String VISUAL_ID = "Pseudostate_ShallowHistoryShape"; //$NON-NLS-1$
/**
* @generated
@@ -86,9 +86,7 @@ public class PseudostateShallowHistoryEditPart extends RoundedCompartmentEditPar
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -156,15 +154,13 @@ public class PseudostateShallowHistoryEditPart extends RoundedCompartmentEditPar
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -204,6 +200,7 @@ public class PseudostateShallowHistoryEditPart extends RoundedCompartmentEditPar
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(20, 20);
@@ -230,6 +227,7 @@ public class PseudostateShallowHistoryEditPart extends RoundedCompartmentEditPar
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -283,5 +281,4 @@ public class PseudostateShallowHistoryEditPart extends RoundedCompartmentEditPar
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateShallowHistoryFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryFloatingLabelEditPart.java
index 6706bc1a1e1..07c9232f553 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateShallowHistoryFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_ShallowHistoryFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateShallowHistoryFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_ShallowHistoryFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateShallowHistoryFloatingLabelEditPart extends FloatingLabe
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateShallowHistoryFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateShallowHistoryFloatingLabelEditPart extends FloatingLabe
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java
index 083c3a3c5bf..82e702a7d3a 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateShallowHistoryStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_ShallowHistoryStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateShallowHistoryStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_ShallowHistoryStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class PseudostateShallowHistoryStereotypeEditPart extends AbstractLabelEd
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateShallowHistoryStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class PseudostateShallowHistoryStereotypeEditPart extends AbstractLabelEd
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java
index 716b9e25af9..1d21825b557 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class PseudostateTerminateEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Pseudostate_TerminateShape";
+ public static final String VISUAL_ID = "Pseudostate_TerminateShape"; //$NON-NLS-1$
/**
* @generated
@@ -86,9 +86,7 @@ public class PseudostateTerminateEditPart extends RoundedCompartmentEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -156,15 +154,13 @@ public class PseudostateTerminateEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -204,6 +200,7 @@ public class PseudostateTerminateEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(4, 4);
@@ -230,6 +227,7 @@ public class PseudostateTerminateEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -283,5 +281,4 @@ public class PseudostateTerminateEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateTerminateFloatingLabelEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateFloatingLabelEditPart.java
index 67300c87f9f..f590959aeeb 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateTerminateFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_TerminateFloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class PseudostateTerminateFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_TerminateFloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class PseudostateTerminateFloatingLabelEditPart extends FloatingLabelEdit
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateTerminateFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class PseudostateTerminateFloatingLabelEditPart extends FloatingLabelEdit
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java
index 145667af686..569ec0bbae3 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java
@@ -1,133 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractWrappingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PseudostateTerminateStereotypeEditPart extends AbstractLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Pseudostate_TerminateStereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+public class PseudostateTerminateStereotypeEditPart extends AbstractWrappingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
- * configuration from a registered edit dialog
- *
* @generated
*/
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Pseudostate_TerminateStereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -149,245 +58,21 @@ public class PseudostateTerminateStereotypeEditPart extends AbstractLabelEditPar
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
}
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), PseudostateTerminateStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -399,438 +84,6 @@ public class PseudostateTerminateStereotypeEditPart extends AbstractLabelEditPar
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java
index 7d028db0f42..0c5953fb9f5 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -36,7 +36,7 @@ public class RegionCompartmentEditPart extends LinkLFShapeCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Region_SubvertexCompartment";
+ public static final String VISUAL_ID = "Region_SubvertexCompartment"; //$NON-NLS-1$
/**
* @generated
@@ -75,7 +75,6 @@ public class RegionCompartmentEditPart extends LinkLFShapeCompartmentEditPart {
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.RegionCompartmentCanonicalEditPolicy());
-
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomRegionCompartmentCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomRegionCompartmentXYLayoutEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionEditPart.java
index 75ca092dc5b..93bc0b39585 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/RegionEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -46,7 +46,7 @@ public class RegionEditPart extends NamedElementEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "Region_Shape";
+ public static final String VISUAL_ID = "Region_Shape"; //$NON-NLS-1$
/**
* @generated
@@ -72,9 +72,7 @@ public class RegionEditPart extends NamedElementEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(EditPolicy.COMPONENT_ROLE, new CustomRegionComponentEditPolicy());
installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
@@ -118,7 +116,6 @@ public class RegionEditPart extends NamedElementEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
-
}
/**
@@ -143,15 +140,12 @@ public class RegionEditPart extends NamedElementEditPart {
* @generated
*/
protected boolean addFixedChild(EditPart childEditPart) {
-
-
if (childEditPart instanceof RegionCompartmentEditPart) {
IFigure pane = getPrimaryShape().getRegionCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((RegionCompartmentEditPart) childEditPart).getFigure());
return true;
}
-
return false;
}
@@ -203,6 +197,7 @@ public class RegionEditPart extends NamedElementEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
@@ -229,6 +224,7 @@ public class RegionEditPart extends NamedElementEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -279,5 +275,4 @@ public class RegionEditPart extends NamedElementEditPart {
((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPart.java
index 8aeca2f459b..eebbd742510 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -37,7 +37,7 @@ public class StateCompartmentEditPart extends LinkLFShapeCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "State_RegionCompartment";
+ public static final String VISUAL_ID = "State_RegionCompartment"; //$NON-NLS-1$
/**
* @generated
@@ -76,7 +76,6 @@ public class StateCompartmentEditPart extends LinkLFShapeCompartmentEditPart {
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.StateCompartmentCanonicalEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomStateCompartmentXYLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomStateCompartmentCreationEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPartTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPartTN.java
index 2a4752bdef7..a81b4292682 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPartTN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateCompartmentEditPartTN.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -37,7 +37,7 @@ public class StateCompartmentEditPartTN extends LinkLFShapeCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "State_RegionCompartment_TN";
+ public static final String VISUAL_ID = "State_RegionCompartment_TN"; //$NON-NLS-1$
/**
* @generated
@@ -76,7 +76,6 @@ public class StateCompartmentEditPartTN extends LinkLFShapeCompartmentEditPart {
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.StateCompartmentCanonicalEditPolicyTN());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomStateCompartmentXYLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomStateCompartmentCreationEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPart.java
index 7b0a83c05be..a52a54ba4bc 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -71,7 +71,7 @@ public class StateEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "State_Shape";
+ public static final String VISUAL_ID = "State_Shape"; //$NON-NLS-1$
/**
* @generated
@@ -98,13 +98,10 @@ public class StateEditPart extends RoundedCompartmentEditPart {
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.StateCanonicalEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -180,15 +177,13 @@ public class StateEditPart extends RoundedCompartmentEditPart {
if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
+ if (false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) {
if (modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
@@ -217,45 +212,27 @@ public class StateEditPart extends RoundedCompartmentEditPart {
((StateNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
-
-
if (childEditPart instanceof StateCompartmentEditPart) {
IFigure pane = getPrimaryShape().getStateCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((StateCompartmentEditPart) childEditPart).getFigure());
return true;
}
-
-
-
- // Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
if (childEditPart instanceof PseudostateEntryPointEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PseudostateEntryPointEditPart) childEditPart).getFigure(), locator);
return true;
}
-
-
-
-
- // Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
if (childEditPart instanceof PseudostateExitPointEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PseudostateExitPointEditPart) childEditPart).getFigure(), locator);
return true;
}
-
-
-
-
- // Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
if (childEditPart instanceof ConnectionPointReferenceEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((ConnectionPointReferenceEditPart) childEditPart).getFigure(), locator);
return true;
}
-
-
return false;
}
@@ -338,6 +315,7 @@ public class StateEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
@@ -364,6 +342,7 @@ public class StateEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
@@ -422,5 +401,4 @@ public class StateEditPart extends RoundedCompartmentEditPart {
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(StateNameEditPart.VISUAL_ID));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPartTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPartTN.java
index d41a8391424..c07444166c1 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPartTN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateEditPartTN.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class StateEditPartTN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "State_Shape_TN";
+ public static final String VISUAL_ID = "State_Shape_TN"; //$NON-NLS-1$
/**
* @generated
@@ -87,13 +87,10 @@ public class StateEditPartTN extends RoundedCompartmentEditPart {
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.StateCanonicalEditPolicyTN());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -151,7 +148,6 @@ public class StateEditPartTN extends RoundedCompartmentEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
-
}
/**
@@ -180,35 +176,22 @@ public class StateEditPartTN extends RoundedCompartmentEditPart {
((StateNameEditPartTN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
-
-
if (childEditPart instanceof StateCompartmentEditPartTN) {
IFigure pane = getPrimaryShape().getStateCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((StateCompartmentEditPartTN) childEditPart).getFigure());
return true;
}
-
-
-
- // Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
if (childEditPart instanceof PseudostateEntryPointEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PseudostateEntryPointEditPart) childEditPart).getFigure(), locator);
return true;
}
-
-
-
-
- // Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
if (childEditPart instanceof PseudostateExitPointEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PseudostateExitPointEditPart) childEditPart).getFigure(), locator);
return true;
}
-
-
return false;
}
@@ -274,6 +257,7 @@ public class StateEditPartTN extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(200, 100);
@@ -300,6 +284,7 @@ public class StateEditPartTN extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateFloatingLabelEditPart.java
index d95cabaa97a..d5acebe3053 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateFloatingLabelEditPart.java
@@ -1,131 +1,40 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractFloatingLabelEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class StateFloatingLabelEditPart extends FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "State_FloatingNameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
+public class StateFloatingLabelEditPart extends AbstractFloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
*/
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "State_FloatingNameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -141,250 +50,19 @@ public class StateFloatingLabelEditPart extends FloatingLabelEditPart
super(view);
}
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
/**
* @generated
*/
@Override
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator) constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshBounds() {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), StateFloatingLabelEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -396,438 +74,6 @@ public class StateFloatingLabelEditPart extends FloatingLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java
index 3139b1c2742..e42116d2442 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -36,7 +36,7 @@ public class StateMachineCompartmentEditPart extends LinkLFShapeCompartmentEditP
/**
* @generated
*/
- public static final String VISUAL_ID = "StateMachine_RegionCompartment";
+ public static final String VISUAL_ID = "StateMachine_RegionCompartment"; //$NON-NLS-1$
/**
* @generated
@@ -75,7 +75,6 @@ public class StateMachineCompartmentEditPart extends LinkLFShapeCompartmentEditP
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.StateMachineCompartmentCanonicalEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomStateMachineCompartmentXYLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomStateMachineCompartmentCreationEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineEditPart.java
index 44e1e59d738..fce5e86cb3f 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -60,7 +60,7 @@ public class StateMachineEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- public static final String VISUAL_ID = "StateMachine_Shape";
+ public static final String VISUAL_ID = "StateMachine_Shape"; //$NON-NLS-1$
/**
* @generated
@@ -87,13 +87,10 @@ public class StateMachineEditPart extends RoundedCompartmentEditPart {
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
-
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
-
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.StateMachineCanonicalEditPolicy());
-
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -151,7 +148,6 @@ public class StateMachineEditPart extends RoundedCompartmentEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
-
}
/**
@@ -180,35 +176,22 @@ public class StateMachineEditPart extends RoundedCompartmentEditPart {
((StateMachineNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
-
-
if (childEditPart instanceof StateMachineCompartmentEditPart) {
IFigure pane = getPrimaryShape().getStateMachineCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((StateMachineCompartmentEditPart) childEditPart).getFigure());
return true;
}
-
-
-
- // Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
if (childEditPart instanceof PseudostateEntryPointEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PseudostateEntryPointEditPart) childEditPart).getFigure(), locator);
return true;
}
-
-
-
-
- // Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
if (childEditPart instanceof PseudostateExitPointEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PseudostateExitPointEditPart) childEditPart).getFigure(), locator);
return true;
}
-
-
return false;
}
@@ -274,6 +257,7 @@ public class StateMachineEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
+
@Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(200, 100);
@@ -300,6 +284,7 @@ public class StateMachineEditPart extends RoundedCompartmentEditPart {
*
* @param nodeShape
* instance of generated figure class
+ *
* @generated
*/
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineNameEditPart.java
index edc529bc137..bea6fbcd204 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateMachineNameEditPart.java
@@ -1,127 +1,38 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractNodeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class StateMachineNameEditPart extends PapyrusCompartmentEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "StateMachine_NameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class StateMachineNameEditPart extends AbstractNodeLabelEditPart {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "StateMachine_NameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -144,212 +55,15 @@ public class StateMachineNameEditPart extends PapyrusCompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
@Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), StateMachineNameEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -357,505 +71,4 @@ public class StateMachineNameEditPart extends PapyrusCompartmentEditPart
}
return parser;
}
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java
index a135be1592c..d7443e241fd 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPart.java
@@ -1,127 +1,38 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractNodeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class StateNameEditPart extends PapyrusCompartmentEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "State_NameLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class StateNameEditPart extends AbstractNodeLabelEditPart {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "State_NameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -144,212 +55,15 @@ public class StateNameEditPart extends PapyrusCompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
@Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), StateNameEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -357,505 +71,4 @@ public class StateNameEditPart extends PapyrusCompartmentEditPart
}
return parser;
}
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPartTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPartTN.java
index cd6a3155002..3b18321458c 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPartTN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/StateNameEditPartTN.java
@@ -1,127 +1,38 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractNodeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class StateNameEditPartTN extends PapyrusCompartmentEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "State_NameLabel_TN";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class StateNameEditPartTN extends AbstractNodeLabelEditPart {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "State_NameLabel_TN"; //$NON-NLS-1$
/**
* @generated
@@ -144,212 +55,15 @@ public class StateNameEditPartTN extends PapyrusCompartmentEditPart
/**
* @generated
*/
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
@Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), StateNameEditPartTN.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -357,505 +71,4 @@ public class StateNameEditPartTN extends PapyrusCompartmentEditPart
}
return parser;
}
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionEditPart.java
index 19e8a2cb2aa..07b5ea50b38 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionEditPart.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -33,7 +33,7 @@ public class TransitionEditPart extends UMLConnectionNodeEditPart implements ITr
/**
* @generated
*/
- public static final String VISUAL_ID = "Transition_Edge";
+ public static final String VISUAL_ID = "Transition_Edge"; //$NON-NLS-1$
/**
* @generated
@@ -58,8 +58,7 @@ public class TransitionEditPart extends UMLConnectionNodeEditPart implements ITr
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof TransitionStereotypeEditPart) {
- ((TransitionStereotypeEditPart) childEditPart).setLabel(
- getPrimaryShape().getAppliedStereotypeLabel());
+ ((TransitionStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
@@ -116,5 +115,4 @@ public class TransitionEditPart extends UMLConnectionNodeEditPart implements ITr
public TransitionFigure getPrimaryShape() {
return (TransitionFigure) getFigure();
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java
index 1f23b098821..5db38e77b3e 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionGuardEditPart.java
@@ -1,131 +1,43 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLinkLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class TransitionGuardEditPart extends PapyrusLabelEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Transition_GuardLabel";
+public class TransitionGuardEditPart extends AbstractLinkLabelEditPart implements ILabelRoleProvider {
/**
* @generated
*/
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Transition_GuardLabel"; //$NON-NLS-1$
/**
* @generated
@@ -156,219 +68,14 @@ public class TransitionGuardEditPart extends PapyrusLabelEditPart
* @generated
*/
@Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), TransitionGuardEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -380,439 +87,6 @@ public class TransitionGuardEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
@@ -842,5 +116,4 @@ public class TransitionGuardEditPart extends PapyrusLabelEditPart
public String getIconPathRole() {
return "platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif";//$NON-NLS-1$
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionNameEditPart.java
index b35ca270b44..98fec0115ee 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionNameEditPart.java
@@ -1,131 +1,43 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLinkLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class TransitionNameEditPart extends PapyrusLabelEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Transition_NameLabel";
+public class TransitionNameEditPart extends AbstractLinkLabelEditPart implements ILabelRoleProvider {
/**
* @generated
*/
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Transition_NameLabel"; //$NON-NLS-1$
/**
* @generated
@@ -156,219 +68,14 @@ public class TransitionNameEditPart extends PapyrusLabelEditPart
* @generated
*/
@Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), TransitionNameEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
@Override
public IParser getParser() {
if (parser == null) {
@@ -380,439 +87,6 @@ public class TransitionNameEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
@Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
@@ -842,5 +116,4 @@ public class TransitionNameEditPart extends PapyrusLabelEditPart
public String getIconPathRole() {
return "platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/name.png";//$NON-NLS-1$
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java
index 2af07f2f140..450824b8234 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java
@@ -1,130 +1,42 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
-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.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-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.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLinkLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class TransitionStereotypeEditPart extends PapyrusLabelEditPart
- implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
-
- /**
- * @generated
- */
- public static final String VISUAL_ID = "Transition_StereotypeLabel";
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
+public class TransitionStereotypeEditPart extends AbstractLinkLabelEditPart implements ILabelRoleProvider {
/**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
* @generated
*/
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
+ public static final String VISUAL_ID = "Transition_StereotypeLabel"; //$NON-NLS-1$
/**
* @generated
@@ -155,160 +67,15 @@ public class TransitionStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
@Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
protected Image getLabelIcon() {
+ // not use element icon
return null;
}
/**
* @generated
*/
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
@Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- ParserUtil.getParserAdapter(getParserElement(), this),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
protected boolean isEditable() {
return false;
}
@@ -317,58 +84,6 @@ public class TransitionStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
@Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), TransitionStereotypeEditPart.this), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
public IParser getParser() {
if (parser == null) {
parser = ParserUtil.getParser(UMLElementTypes.Transition_Edge, getParserElement(), this, VISUAL_ID);
@@ -379,438 +94,13 @@ public class TransitionStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- 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;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- 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 {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- } else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
@Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
public int getDirectEditionType() {
// The label is read-only (defined in GMFGen model)
return IDirectEdition.NO_DIRECT_EDITION;
}
/**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
* @generated
*/
@Override
@@ -825,5 +115,4 @@ public class TransitionStereotypeEditPart extends PapyrusLabelEditPart
public String getIconPathRole() {
return "platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Stereotype.gif";//$NON-NLS-1$
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/UMLEditPartFactory.java
index 54f47f0c01e..2d38825f064 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/UMLEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/UMLEditPartFactory.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.parts;
@@ -40,218 +40,144 @@ public class UMLEditPartFactory implements EditPartFactory {
if (model instanceof View) {
View view = (View) model;
switch (UMLVisualIDRegistry.getVisualID(view)) {
-
case PackageEditPart.VISUAL_ID:
return new PackageEditPart(view);
-
case StateMachineEditPart.VISUAL_ID:
return new StateMachineEditPart(view);
-
case StateMachineNameEditPart.VISUAL_ID:
return new StateMachineNameEditPart(view);
-
case StateEditPartTN.VISUAL_ID:
return new StateEditPartTN(view);
-
case StateNameEditPartTN.VISUAL_ID:
return new StateNameEditPartTN(view);
-
case RegionEditPart.VISUAL_ID:
return new RegionEditPart(view);
-
case FinalStateEditPart.VISUAL_ID:
return new FinalStateEditPart(view);
-
case FinalStateFloatingLabelEditPart.VISUAL_ID:
return new FinalStateFloatingLabelEditPart(view);
-
case FinalStateStereotypeEditPart.VISUAL_ID:
return new FinalStateStereotypeEditPart(view);
-
case StateEditPart.VISUAL_ID:
return new StateEditPart(view);
-
case StateNameEditPart.VISUAL_ID:
return new StateNameEditPart(view);
-
case StateFloatingLabelEditPart.VISUAL_ID:
return new StateFloatingLabelEditPart(view);
-
case PseudostateInitialEditPart.VISUAL_ID:
return new PseudostateInitialEditPart(view);
-
case PseudostateInitialFloatingLabelEditPart.VISUAL_ID:
return new PseudostateInitialFloatingLabelEditPart(view);
-
case PseudostateInitialStereotypeEditPart.VISUAL_ID:
return new PseudostateInitialStereotypeEditPart(view);
-
case PseudostateJoinEditPart.VISUAL_ID:
return new PseudostateJoinEditPart(view);
-
case PseudostateJoinFloatingLabelEditPart.VISUAL_ID:
return new PseudostateJoinFloatingLabelEditPart(view);
-
case PseudostateJoinStereotypeEditPart.VISUAL_ID:
return new PseudostateJoinStereotypeEditPart(view);
-
case PseudostateForkEditPart.VISUAL_ID:
return new PseudostateForkEditPart(view);
-
case PseudostateForkNameEditPart.VISUAL_ID:
return new PseudostateForkNameEditPart(view);
-
case PseudostateForkStereotypeEditPart.VISUAL_ID:
return new PseudostateForkStereotypeEditPart(view);
-
case PseudostateChoiceEditPart.VISUAL_ID:
return new PseudostateChoiceEditPart(view);
-
case PseudostateChoiceFloatingLabelEditPart.VISUAL_ID:
return new PseudostateChoiceFloatingLabelEditPart(view);
-
case PseudostateChoiceStereotypeEditPart.VISUAL_ID:
return new PseudostateChoiceStereotypeEditPart(view);
-
case PseudostateJunctionEditPart.VISUAL_ID:
return new PseudostateJunctionEditPart(view);
-
case PseudostateJunctionFloatingLabelEditPart.VISUAL_ID:
return new PseudostateJunctionFloatingLabelEditPart(view);
-
case PseudostateJunctionStereotypeEditPart.VISUAL_ID:
return new PseudostateJunctionStereotypeEditPart(view);
-
case PseudostateShallowHistoryEditPart.VISUAL_ID:
return new PseudostateShallowHistoryEditPart(view);
-
case PseudostateShallowHistoryFloatingLabelEditPart.VISUAL_ID:
return new PseudostateShallowHistoryFloatingLabelEditPart(view);
-
case PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID:
return new PseudostateShallowHistoryStereotypeEditPart(view);
-
case PseudostateDeepHistoryEditPart.VISUAL_ID:
return new PseudostateDeepHistoryEditPart(view);
-
case PseudostateDeepHistoryFloatingLabelEditPart.VISUAL_ID:
return new PseudostateDeepHistoryFloatingLabelEditPart(view);
-
case PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID:
return new PseudostateDeepHistoryStereotypeEditPart(view);
-
case PseudostateTerminateEditPart.VISUAL_ID:
return new PseudostateTerminateEditPart(view);
-
case PseudostateTerminateFloatingLabelEditPart.VISUAL_ID:
return new PseudostateTerminateFloatingLabelEditPart(view);
-
case PseudostateTerminateStereotypeEditPart.VISUAL_ID:
return new PseudostateTerminateStereotypeEditPart(view);
-
case PseudostateEntryPointEditPart.VISUAL_ID:
return new PseudostateEntryPointEditPart(view);
-
case PseudostateEntryPointFloatingLabelEditPart.VISUAL_ID:
return new PseudostateEntryPointFloatingLabelEditPart(view);
-
case PseudostateEntryPointStereotypeEditPart.VISUAL_ID:
return new PseudostateEntryPointStereotypeEditPart(view);
-
case PseudostateExitPointEditPart.VISUAL_ID:
return new PseudostateExitPointEditPart(view);
-
case PseudostateExitPointFloatingLabelEditPart.VISUAL_ID:
return new PseudostateExitPointFloatingLabelEditPart(view);
-
case PseudostateExitPointStereotypeEditPart.VISUAL_ID:
return new PseudostateExitPointStereotypeEditPart(view);
-
case ConnectionPointReferenceEditPart.VISUAL_ID:
return new ConnectionPointReferenceEditPart(view);
-
case ConnectionPointReferenceNameEditPart.VISUAL_ID:
return new ConnectionPointReferenceNameEditPart(view);
-
case ConnectionPointReferenceStereotypeEditPart.VISUAL_ID:
return new ConnectionPointReferenceStereotypeEditPart(view);
-
case CommentEditPart.VISUAL_ID:
return new CommentEditPart(view);
-
case CommentBodyEditPart.VISUAL_ID:
return new CommentBodyEditPart(view);
-
case ConstraintEditPart.VISUAL_ID:
return new ConstraintEditPart(view);
-
case ConstraintNameLabelEditPart.VISUAL_ID:
return new ConstraintNameLabelEditPart(view);
-
case ConstraintBodyEditPart.VISUAL_ID:
return new ConstraintBodyEditPart(view);
-
case InternalTransitionEditPart.VISUAL_ID:
return new InternalTransitionEditPart(view);
-
case EntryStateBehaviorEditPart.VISUAL_ID:
return new EntryStateBehaviorEditPart(view);
-
case DoActivityStateBehaviorStateEditPart.VISUAL_ID:
return new DoActivityStateBehaviorStateEditPart(view);
-
case ExitStateBehaviorEditPart.VISUAL_ID:
return new ExitStateBehaviorEditPart(view);
-
case DeferrableTriggerEditPart.VISUAL_ID:
return new DeferrableTriggerEditPart(view);
-
case RegionCompartmentEditPart.VISUAL_ID:
return new RegionCompartmentEditPart(view);
-
case StateMachineCompartmentEditPart.VISUAL_ID:
return new StateMachineCompartmentEditPart(view);
-
case StateCompartmentEditPart.VISUAL_ID:
return new StateCompartmentEditPart(view);
-
case StateCompartmentEditPartTN.VISUAL_ID:
return new StateCompartmentEditPartTN(view);
-
case TransitionEditPart.VISUAL_ID:
return new TransitionEditPart(view);
-
case TransitionNameEditPart.VISUAL_ID:
return new TransitionNameEditPart(view);
-
case TransitionGuardEditPart.VISUAL_ID:
return new TransitionGuardEditPart(view);
-
case TransitionStereotypeEditPart.VISUAL_ID:
return new TransitionStereotypeEditPart(view);
-
-
case GeneralizationEditPart.VISUAL_ID:
return new GeneralizationEditPart(view);
-
case GeneralizationStereotypeEditPart.VISUAL_ID:
return new GeneralizationStereotypeEditPart(view);
-
-
case CommentAnnotatedElementEditPart.VISUAL_ID:
return new CommentAnnotatedElementEditPart(view);
-
-
case ConstraintConstrainedElementEditPart.VISUAL_ID:
return new ConstraintConstrainedElementEditPart(view);
-
-
case ContextLinkEditPart.VISUAL_ID:
return new ContextLinkEditPart(view);
-
case ContextLinkAppliedStereotypeEditPart.VISUAL_ID:
return new ContextLinkAppliedStereotypeEditPart(view);
-
}
}
return createUnrecognizedEditPart(context, model);
@@ -270,11 +196,9 @@ public class UMLEditPartFactory implements EditPartFactory {
*/
public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
if (source.getFigure() instanceof IMultilineEditableFigure) {
- return new MultilineCellEditorLocator(
- (IMultilineEditableFigure) source.getFigure());
+ return new MultilineCellEditorLocator((IMultilineEditableFigure) source.getFigure());
} else {
return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
-
}
}
@@ -313,13 +237,11 @@ public class UMLEditPartFactory implements EditPartFactory {
rect.y = getMultilineEditableFigure().getEditionLocation().y;
getMultilineEditableFigure().translateToAbsolute(rect);
if (getMultilineEditableFigure().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width,
- SWT.DEFAULT)));
+ rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
}
if (!rect.equals(new Rectangle(text.getBounds()))) {
text.setBounds(rect.x, rect.y, rect.width, rect.height);
}
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/OpenDiagramEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/OpenDiagramEditPolicy.java
deleted file mode 100644
index 80f1ddc8829..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/OpenDiagramEditPolicy.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.statemachine.edit.policies;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.Style;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.statemachine.part.Messages;
-import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorUtil;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * @generated
- */
-public class OpenDiagramEditPolicy extends OpenEditPolicy {
-
- /**
- * @generated
- */
- @Override
- protected Command getOpenCommand(Request request) {
- EditPart targetEditPart = getTargetEditPart(request);
- if (false == targetEditPart.getModel() instanceof View) {
- return null;
- }
- View view = (View) targetEditPart.getModel();
- Style link = view.getStyle(NotationPackage.eINSTANCE.getHintedDiagramLinkStyle());
- if (false == link instanceof HintedDiagramLinkStyle) {
- return null;
- }
- return new ICommandProxy(new OpenDiagramCommand((HintedDiagramLinkStyle) link));
- }
-
- /**
- * @generated
- */
- private static class OpenDiagramCommand extends AbstractTransactionalCommand {
-
- /**
- * @generated
- */
- private final HintedDiagramLinkStyle diagramFacet;
-
- /**
- * @generated
- */
- OpenDiagramCommand(HintedDiagramLinkStyle linkStyle) {
- // editing domain is taken for original diagram,
- // if we open diagram from another file, we should use another editing domain
- super(TransactionUtil.getEditingDomain(linkStyle), Messages.CommandName_OpenDiagram, null);
- diagramFacet = linkStyle;
- }
-
- // FIXME canExecute if !(readOnly && getDiagramToOpen == null), i.e. open works on ro diagrams only when there's associated diagram already
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- try {
- Diagram diagram = getDiagramToOpen();
- if (diagram == null) {
- diagram = intializeNewDiagram();
- }
- URI uri = EcoreUtil.getURI(diagram);
- String editorName = uri.lastSegment() + '#' + diagram.eResource().getContents().indexOf(diagram);
- IEditorInput editorInput = new URIEditorInput(uri, editorName);
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- page.openEditor(editorInput, getEditorID());
- return CommandResult.newOKCommandResult();
- } catch (Exception ex) {
- throw new ExecutionException("Can't open diagram", ex);
- }
- }
-
- /**
- * @generated
- */
- protected Diagram getDiagramToOpen() {
- return diagramFacet.getDiagramLink();
- }
-
- /**
- * @generated
- */
- protected Diagram intializeNewDiagram() throws ExecutionException {
- Diagram d = ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint());
- if (d == null) {
- throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind");
- }
- diagramFacet.setDiagramLink(d);
- assert diagramFacet.eResource() != null;
- diagramFacet.eResource().getContents().add(d);
- EObject container = diagramFacet.eContainer();
- while (container instanceof View) {
- ((View) container).persist();
- container = container.eContainer();
- }
- try {
- new WorkspaceModifyOperation() {
- @Override
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- try {
- for (Iterator<?> it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource) it.next();
- if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) {
- nextResource.save(UMLDiagramEditorUtil.getSaveOptions());
- }
- }
- } catch (IOException ex) {
- throw new InvocationTargetException(ex, "Save operation failed");
- }
- }
- }.run(null);
- } catch (InvocationTargetException e) {
- throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
- } catch (InterruptedException e) {
- throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
- }
- return d;
- }
-
- /**
- * @generated
- */
- protected EObject getDiagramDomainElement() {
- // use same element as associated with EP
- return ((View) diagramFacet.eContainer()).getElement();
- }
-
- /**
- * @generated
- */
- protected PreferencesHint getPreferencesHint() {
- // XXX prefhint from target diagram's editor?
- return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
- /**
- * @generated
- */
- protected String getDiagramKind() {
- return PackageEditPart.MODEL_ID;
- }
-
- /**
- * @generated
- */
- protected String getEditorID() {
- return UMLDiagramEditor.ID;
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java
index 4919ea8f7db..a567fbbca16 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -1,53 +1,22 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.edit.policies;
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
-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.editpolicies.AbstractBaseItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
@@ -64,280 +33,30 @@ import org.eclipse.uml2.uml.Vertex;
/**
* @generated
*/
-public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
-
- /**
- * Extended request data key to hold editpart visual id.
- *
- * @generated
- */
- public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
- /**
- * Extended request data key to hold the edge view during a reconnect request.
- *
- * @generated
- */
- public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$
- /**
- * @generated
- */
- private final IElementType myElementType;
+public class UMLBaseItemSemanticEditPolicy extends AbstractBaseItemSemanticEditPolicy {
/**
* @generated
*/
protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
- myElementType = elementType;
+ super(elementType);
}
/**
- * Extended request data key to hold editpart visual id.
- * Add visual id of edited editpart to extended data of the request
- * so command switch can decide what kind of diagram element is being edited.
- * It is done in those cases when it's not possible to deduce diagram
- * element kind from domain element.
- * Add the reoriented view to the request extended data so that the view
- * currently edited can be distinguished from other views of the same element
- * and these latter possibly removed if they become inconsistent after reconnect
- *
* @generated
*/
@Override
- @SuppressWarnings("unchecked")
- public Command getCommand(Request request) {
- if (request instanceof ReconnectRequest) {
- Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel();
- if (view instanceof View) {
- String id = UMLVisualIDRegistry.getVisualID((View) view);
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view);
- }
- }
- return super.getCommand(request);
- }
-
- /**
- * Returns visual id from request parameters.
- *
- * @generated
- */
- protected String getVisualID(IEditCommandRequest request) {
- return (String) request.getParameter(VISUAL_ID_KEY);
+ protected String getVisualIdFromView(View view) {
+ return UMLVisualIDRegistry.getVisualID(view);
}
/**
* @generated
*/
@Override
- protected Command getSemanticCommand(IEditCommandRequest request) {
- IEditCommandRequest completedRequest = completeRequest(request);
- Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
- if (completedRequest instanceof DestroyRequest) {
- DestroyRequest destroyRequest = (DestroyRequest) completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
- }
- return semanticCommand;
- }
-
- /**
- * @generated
- */
- protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
- }
-
- /**
- * @generated
- */
- private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
- }
- IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType);
- ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
- if (command != null) {
- if (!(command instanceof CompositeTransactionalCommand)) {
- command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
- }
- return new ICommandProxy(command);
- }
- return editPolicyCommand;
- }
-
- /**
- * @generated
- */
protected IElementType getContextElementType(IEditCommandRequest request) {
IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
- if (req instanceof CreateRelationshipRequest) {
- return getCreateRelationshipCommand((CreateRelationshipRequest) req);
- } else if (req instanceof CreateElementRequest) {
- return getCreateCommand((CreateElementRequest) req);
- } else if (req instanceof ConfigureRequest) {
- return getConfigureCommand((ConfigureRequest) req);
- } else if (req instanceof DestroyElementRequest) {
- return getDestroyElementCommand((DestroyElementRequest) req);
- } else if (req instanceof DestroyReferenceRequest) {
- return getDestroyReferenceCommand((DestroyReferenceRequest) req);
- } else if (req instanceof DuplicateElementsRequest) {
- return getDuplicateCommand((DuplicateElementsRequest) req);
- } else if (req instanceof GetEditContextRequest) {
- return getEditContextCommand((GetEditContextRequest) req);
- } else if (req instanceof MoveRequest) {
- return getMoveCommand((MoveRequest) req);
- } else if (req instanceof ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
- } else if (req instanceof ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
- } else if (req instanceof SetRequest) {
- return getSetCommand((SetRequest) req);
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getConfigureCommand(ConfigureRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType instanceof IElementType) {
- 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;
- }
-
- /**
- * @generated
- */
- protected Command getSetCommand(SetRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getEditContextCommand(GetEditContextRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getMoveCommand(MoveRequest req) {
- EObject targetCEObject = req.getTargetContainer();
- if (targetCEObject != null) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
- if (provider != null) {
- ICommand moveCommand = provider.getEditCommand(req);
- if (moveCommand != null) {
- return new ICommandProxy(moveCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- } else {
- return getGEFWrapper(new MoveElementsCommand(req));
- }
-
- }
-
- /**
- * @generated
- */
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected final Command getGEFWrapper(ICommand cmd) {
- return (cmd == null) ? UnexecutableCommand.INSTANCE : new ICommandProxy(cmd);
- }
-
- /**
- * Returns editing domain from the host edit part.
- *
- * @generated
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart) getHost()).getEditingDomain();
- }
-
- /**
- * Clean all shortcuts to the host element from the same diagram
- *
- * @generated
- */
- protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
- assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for (Iterator<?> it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
- View nextView = (View) it.next();
- if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
- continue;
- }
- cmd.add(new DeleteCommand(getEditingDomain(), nextView));
- }
+ return requestContextElementType != null ? requestContextElementType : getBaseElementType();
}
/**
@@ -359,23 +78,22 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
/**
* @generated
*/
- public LinkConstraints() { // use static method #getLinkConstraints() to access instance
+ public LinkConstraints() {
+ // use static method #getLinkConstraints() to access instance
}
/**
* @generated
*/
public boolean canCreateTransition_Edge(Region container, Vertex source, Vertex target) {
- return canExistTransition_Edge(
- container, null, source, target);
+ return canExistTransition_Edge(container, null, source, target);
}
/**
* @generated
*/
public boolean canCreateGeneralization_Edge(Classifier source, Classifier target) {
- return canExistGeneralization_Edge(
- null, source, target);
+ return canExistGeneralization_Edge(null, source, target);
}
/**
@@ -388,9 +106,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
return false;
}
}
-
- return canExistComment_AnnotatedElementEdge(
- source, target);
+ return canExistComment_AnnotatedElementEdge(source, target);
}
/**
@@ -403,9 +119,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
return false;
}
}
-
- return canExistConstraint_ConstrainedElementEdge(
- source, target);
+ return canExistConstraint_ConstrainedElementEdge(source, target);
}
/**
@@ -418,19 +132,16 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
}
}
if (target != null && (target.getOwnedRules()
- .contains(target))) {
+ .contains(source))) {
return false;
}
-
- return canExistConstraint_ContextEdge(
- source, target);
+ return canExistConstraint_ContextEdge(source, target);
}
/**
* @generated
*/
- public boolean canExistTransition_Edge(Region container, Transition linkInstance, Vertex source,
- Vertex target) {
+ public boolean canExistTransition_Edge(Region container, Transition linkInstance, Vertex source, Vertex target) {
return true;
}
@@ -462,5 +173,4 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
return true;
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/AbstractParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/AbstractParser.java
deleted file mode 100644
index 3fb27060a68..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/AbstractParser.java
+++ /dev/null
@@ -1 +0,0 @@
-// Since GMFT 3.1 we don't generate class AbstractParser into every diagram, instead extend org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractAttributeParser.
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java
index cc754c81f97..0d829c5946a 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/parsers/MessageFormatParser.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.parsers;
@@ -46,6 +46,7 @@ public class MessageFormatParser extends AbstractElementTypeBasedAttributeParser
* @generated
*/
private String defaultPattern;
+
/**
* @generated
*/
@@ -192,12 +193,7 @@ public class MessageFormatParser extends AbstractElementTypeBasedAttributeParser
ParsePosition pos = new ParsePosition(0);
Object[] values = getEditProcessor().parse(editString, pos);
if (values == null) {
- return new ParserEditStatus(
- UMLDiagramEditorPlugin.ID,
- IParserEditStatus.UNEDITABLE,
- NLS.bind(
- Messages.MessageFormatParser_InvalidInputError,
- new Integer(pos.getErrorIndex())));
+ return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, NLS.bind(Messages.MessageFormatParser_InvalidInputError, pos.getErrorIndex()));
}
return validateNewValues(values);
}
@@ -226,10 +222,8 @@ public class MessageFormatParser extends AbstractElementTypeBasedAttributeParser
* @see AbstractFeatureParser#getModificationCommand(EObject, EStructuralFeature, java.lang.Object)
*/
@Override
- protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature,
- final Object value) {
+ protected ICommand getModificationCommand(final EObject element, final EStructuralFeature feature, final Object value) {
ICommand result = null;
-
// If the feature to edit is the name, check that this is not really the internationalization to edit and not the name
if (feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) {
if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) {
@@ -239,7 +233,6 @@ public class MessageFormatParser extends AbstractElementTypeBasedAttributeParser
}
}
}
-
return null != result ? result : super.getModificationCommand(element, feature, value);
}
@@ -251,13 +244,11 @@ public class MessageFormatParser extends AbstractElementTypeBasedAttributeParser
@Override
protected Object getValue(final EObject element, final EStructuralFeature feature) {
Object result = null;
-
if (element instanceof NamedElement && feature.equals(UMLPackage.eINSTANCE.getNamedElement_Name())) {
if (InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element)) {
result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement) element);
}
}
-
return null != result ? result : super.getValue(element, feature);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/DiagramEditorContextMenuProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/DiagramEditorContextMenuProvider.java
index 1c59cb24288..2082563e054 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/DiagramEditorContextMenuProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/DiagramEditorContextMenuProvider.java
@@ -47,18 +47,15 @@ public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider
public void buildContextMenu(final IMenuManager menu) {
getViewer().flush();
try {
- TransactionUtil.getEditingDomain(
- (EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
-
- @Override
- public void run() {
- ContributionItemService.getInstance().contributeToPopupMenu(
- DiagramEditorContextMenuProvider.this, part);
- menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
- }
- });
+ TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ ContributionItemService.getInstance().contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part);
+ menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
+ }
+ });
} catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Error building context menu", e);
+ UMLDiagramEditorPlugin.getInstance().logError("Error building context menu", e); //$NON-NLS-1$
}
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/LoadResourceAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/LoadResourceAction.java
index b6dfed82de8..4ca9a8e3270 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/LoadResourceAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/LoadResourceAction.java
@@ -1,32 +1,23 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.part;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.actions.DefaultLoadResourceAction;
/**
* @generated
*/
public class LoadResourceAction extends DefaultLoadResourceAction {
- /**
- * @generated
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- return super.execute(event);
- }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/Messages.java
index 6acdffdf3a5..d7ed6faf1b5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/Messages.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/Messages.java
@@ -255,326 +255,6 @@ public class Messages extends NLS {
/**
* @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String NodesGroup_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String EdgesGroup_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String RegionCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String RegionCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String StateCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String StateCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String InitialCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String InitialCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String FinalStateCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String FinalStateCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ShallowHistoryCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ShallowHistoryCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String DeepHistoryCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String DeepHistoryCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ForkCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ForkCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String JoinCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String JoinCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ChoiceCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ChoiceCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String JunctionCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String JunctionCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String EntryPointCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String EntryPointCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ExitPointCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ExitPointCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String TerminateCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String TerminateCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ConnectionPointReferenceCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ConnectionPointReferenceCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String StateMachineCommentCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String StateMachineCommentCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ConstraintCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ConstraintCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String TransitionCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String TransitionCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String CommentlinkCreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String CommentlinkCreationTool_desc;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ContextLink3CreationTool_title;
-
- /**
- * @generated
- *
- * @deprecated since 3.2.100, will be removed in Papyrus 5.0, see bug 560722
- */
- @Deprecated
- public static String ContextLink3CreationTool_desc;
-
- /**
- * @generated
*/
public static String RegionCompartmentEditPart_title;
@@ -612,5 +292,6 @@ public class Messages extends NLS {
* @generated
*/
public static String UMLModelingAssistantProviderMessage;
+
// TODO: put accessor fields manually
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ModelElementSelectionPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ModelElementSelectionPage.java
index 81db8d5bb46..bf950b51f6c 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ModelElementSelectionPage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ModelElementSelectionPage.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.part;
@@ -38,5 +38,4 @@ public class ModelElementSelectionPage extends DefaultModelElementSelectionPage
protected String getSelectionTitle() {
return Messages.ModelElementSelectionPageMessage;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizard.java
index 91e18bbc485..6e3ebfaf733 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizard.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizard.java
@@ -105,8 +105,7 @@ public class UMLCreationWizard extends Wizard implements INewWizard {
this.workbench = workbench;
this.selection = selection;
setWindowTitle(Messages.UMLCreationWizardTitle);
- setDefaultPageImageDescriptor(UMLDiagramEditorPlugin.getBundledImageDescriptor(
- "icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(UMLDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$
setNeedsProgressMonitor(true);
}
@@ -115,22 +114,17 @@ public class UMLCreationWizard extends Wizard implements INewWizard {
*/
@Override
public void addPages() {
- diagramModelFilePage = new UMLCreationWizardPage(
- "DiagramModelFile", getSelection(), "PapyrusUMLStateMachine_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
+ diagramModelFilePage = new UMLCreationWizardPage("DiagramModelFile", getSelection(), "PapyrusUMLStateMachine_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
diagramModelFilePage.setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
diagramModelFilePage.setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
addPage(diagramModelFilePage);
-
- domainModelFilePage = new UMLCreationWizardPage(
- "DomainModelFile", getSelection(), "PapyrusUMLStateMachine") { //$NON-NLS-1$ //$NON-NLS-2$
-
+ domainModelFilePage = new UMLCreationWizardPage("DomainModelFile", getSelection(), "PapyrusUMLStateMachine") { //$NON-NLS-1$ //$NON-NLS-2$
@Override
public void setVisible(boolean visible) {
if (visible) {
String fileName = diagramModelFilePage.getFileName();
fileName = fileName.substring(0, fileName.length() - ".PapyrusUMLStateMachine_diagram".length()); //$NON-NLS-1$
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(
- getContainerFullPath(), fileName, "PapyrusUMLStateMachine")); //$NON-NLS-1$
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "PapyrusUMLStateMachine")); //$NON-NLS-1$
}
super.setVisible(visible);
}
@@ -146,19 +140,14 @@ public class UMLCreationWizard extends Wizard implements INewWizard {
@Override
public boolean performFinish() {
IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
-
@Override
- protected void execute(IProgressMonitor monitor)
- throws CoreException, InterruptedException {
- diagram = UMLDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(),
- domainModelFilePage.getURI(),
- monitor);
+ protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
+ diagram = UMLDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(), domainModelFilePage.getURI(), monitor);
if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
try {
UMLDiagramEditorUtil.openDiagram(diagram);
} catch (PartInitException e) {
- ErrorDialog.openError(getContainer().getShell(),
- Messages.UMLCreationWizardOpenEditorError, null, e.getStatus());
+ ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardOpenEditorError, null, e.getStatus());
}
}
}
@@ -169,12 +158,9 @@ public class UMLCreationWizard extends Wizard implements INewWizard {
return false;
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof CoreException) {
- ErrorDialog.openError(getContainer().getShell(),
- Messages.UMLCreationWizardCreationError, null,
- ((CoreException) e.getTargetException()).getStatus());
+ ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardCreationError, null, ((CoreException) e.getTargetException()).getStatus());
} else {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Error creating diagram", e.getTargetException()); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizardPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizardPage.java
index ec765307402..28aa8c6dd2f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizardPage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLCreationWizardPage.java
@@ -76,8 +76,7 @@ public class UMLCreationWizardPage extends WizardNewFileCreationPage {
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(
- getContainerFullPath(), getFileName(), getExtension()));
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), getFileName(), getExtension()));
setPageComplete(validatePage());
}
@@ -90,9 +89,8 @@ public class UMLCreationWizardPage extends WizardNewFileCreationPage {
return false;
}
String extension = getExtension();
- if (extension != null && !getFilePath().toString().endsWith("." + extension)) {
- setErrorMessage(NLS.bind(
- Messages.UMLCreationWizardPageExtensionError, extension));
+ if (extension != null && !getFilePath().toString().endsWith("." + extension)) { //$NON-NLS-1$
+ setErrorMessage(NLS.bind(Messages.UMLCreationWizardPageExtensionError, extension));
return false;
}
return true;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java
index 2ead6ef66ac..b910f650680 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java
@@ -63,6 +63,7 @@ import org.eclipse.ui.part.ShowInContext;
/**
* @generated
*/
+@SuppressWarnings({ "deprecation", "restriction" })
public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderChangeListener, IGotoMarker {
/**
@@ -122,14 +123,6 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
* @generated
*/
@Override
- protected String getContextID() {
- return CONTEXT_ID;
- }
-
- /**
- * @generated
- */
- @Override
protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {
PaletteRoot paletteRoot;
if (existingPaletteRoot == null) {
@@ -146,6 +139,14 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
* @generated
*/
@Override
+ protected String getContextID() {
+ return CONTEXT_ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
protected PreferencesHint getPreferencesHint() {
return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
}
@@ -254,7 +255,6 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
public void commandStackChanged(EventObject event) {
if (Display.getCurrent() == null) {
Display.getDefault().asyncExec(new Runnable() {
-
@Override
public void run() {
firePropertyChange(IEditorPart.PROP_DIRTY);
@@ -314,8 +314,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
public void providerChanged(ProviderChangeEvent event) {
// update the palette if the palette service has changed
if (PapyrusPaletteService.getInstance().equals(event.getSource())) {
- PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this,
- getDefaultPaletteContent());
+ PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this, getDefaultPaletteContent());
}
}
@@ -518,21 +517,18 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
super.initializeGraphicalViewer();
// Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(
- new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
-
- @Override
- protected Object getJavaObject(TransferData data) {
- // It is usual for the transfer data not to be set because it is available locally
- return LocalSelectionTransfer.getTransfer().getSelection();
- }
-
- @Override
- protected TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
+ getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
+ @Override
+ protected Object getJavaObject(TransferData data) {
+ // It is usual for the transfer data not to be set because it is available locally
+ return LocalSelectionTransfer.getTransfer().getSelection();
+ }
+ @Override
+ protected TransactionalEditingDomain getTransactionalEditingDomain() {
+ return getEditingDomain();
+ }
+ });
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorPlugin.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorPlugin.java
index 6ed9d7c6710..0a0c08d1f40 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorPlugin.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorPlugin.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2014 CEA LIST and others.
+ * Copyright (c) 2014 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,7 +10,6 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- * Christian W. Damus (CEA) - bug 410346
*/
package org.eclipse.papyrus.uml.diagram.statemachine.part;
@@ -24,7 +23,7 @@ import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.expressions.UMLOCLFactory;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.UMLBaseItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.statemachine.preferences.DiagramPreferenceInitializer;
@@ -98,10 +97,9 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
instance = this;
myLogHelper = new LogHelper(this);
PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
- adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory();
+ adapterFactory = Activator.getInstance().getItemProvidersAdapterFactory();
DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer();
diagramPreferenceInitializer.initializeDefaultPreferences();
-
}
/**
@@ -129,7 +127,7 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
*/
@Override
public IPreferenceStore getPreferenceStore() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore();
return store;
}
@@ -144,11 +142,9 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
* @generated
*/
public ImageDescriptor getItemImageDescriptor(Object item) {
- IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(
- item, IItemLabelProvider.class);
+ IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);
if (labelProvider != null) {
- return ExtendedImageRegistry.getInstance().getImageDescriptor(
- labelProvider.getImage(item));
+ return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));
}
return null;
}
@@ -179,8 +175,7 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
public static ImageDescriptor findImageDescriptor(String path) {
final IPath p = new Path(path);
if (p.isAbsolute() && p.segmentCount() > 1) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(
- p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
+ return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
} else {
return getBundledImageDescriptor(p.makeAbsolute().toString());
}
@@ -210,8 +205,7 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
* @generated
*/
public static String getString(String key) {
- return Platform.getResourceString(
- getInstance().getBundle(), "%" + key); //$NON-NLS-1$
+ return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorUtil.java
index add31741a08..e5ab9c0cfe4 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditorUtil.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.part;
@@ -69,6 +69,7 @@ import org.eclipse.uml2.uml.UMLFactory;
/**
* @generated
*/
+@SuppressWarnings("deprecation")
public class UMLDiagramEditorUtil {
/**
@@ -112,8 +113,7 @@ public class UMLDiagramEditorUtil {
* @generated
*/
public static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) {
- return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension,
- DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE);
+ return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE);
}
/**
@@ -150,21 +150,16 @@ public class UMLDiagramEditorUtil {
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package model = createInitialModel();
attachModelToResource(model, modelResource);
-
- Diagram diagram = ViewService.createDiagram(
- model,
- PackageEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ Diagram diagram = ViewService.createDiagram(model, PackageEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
if (diagram != null) {
diagramResource.getContents().add(diagram);
diagram.setName(diagramName);
diagram.setElement(model);
}
-
try {
modelResource.save(org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorUtil.getSaveOptions());
diagramResource.save(org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorUtil.getSaveOptions());
} catch (IOException e) {
-
UMLDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$
}
return CommandResult.newOKCommandResult();
@@ -207,7 +202,6 @@ public class UMLDiagramEditorUtil {
*/
public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
diagramPart.getDiagramGraphicalViewer().deselectAll();
-
EditPart firstPrimary = null;
for (EditPart nextPart : editParts) {
diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
@@ -215,7 +209,6 @@ public class UMLDiagramEditorUtil {
firstPrimary = nextPart;
}
}
-
if (!editParts.isEmpty()) {
diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
}
@@ -224,11 +217,9 @@ public class UMLDiagramEditorUtil {
/**
* @generated
*/
- private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element,
- List<EditPart> editPartCollector) {
+ private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, List<EditPart> editPartCollector) {
IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart.getViewer();
final int intialNumOfEditParts = editPartCollector.size();
-
if (element instanceof View) { // support notation element lookup
EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(element);
if (editPart != null) {
@@ -236,7 +227,6 @@ public class UMLDiagramEditorUtil {
return 1;
}
}
-
String elementID = EMFCoreUtil.getProxyID(element);
@SuppressWarnings("unchecked")
List<EditPart> associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class);
@@ -250,7 +240,6 @@ public class UMLDiagramEditorUtil {
editPartCollector.add(nextPart);
}
}
-
if (intialNumOfEditParts == editPartCollector.size()) {
if (!associatedParts.isEmpty()) {
editPartCollector.add(associatedParts.get(0));
@@ -266,13 +255,11 @@ public class UMLDiagramEditorUtil {
/**
* @generated
*/
- public static View findView(DiagramEditPart diagramEditPart, EObject targetElement,
- LazyElement2ViewMap lazyElement2ViewMap) {
+ public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) {
boolean hasStructuralURI = false;
if (targetElement.eResource() instanceof XMLResource) {
hasStructuralURI = ((XMLResource) targetElement.eResource()).getID(targetElement) == null;
}
-
View view = null;
LinkedList<EditPart> editPartHolder = new LinkedList<>();
if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
@@ -281,7 +268,6 @@ public class UMLDiagramEditorUtil {
EditPart editPart = editPartHolder.get(0);
view = editPart.getModel() instanceof View ? (View) editPart.getModel() : null;
}
-
return (view == null) ? diagramEditPart.getDiagramView() : view;
}
@@ -329,7 +315,6 @@ public class UMLDiagramEditorUtil {
}
}
}
-
buildElement2ViewMap(scope, element2ViewMap, elementSet);
}
return element2ViewMap;
@@ -338,12 +323,10 @@ public class UMLDiagramEditorUtil {
/**
* @generated
*/
- private static boolean buildElement2ViewMap(View parentView, Map<EObject, View> element2ViewMap,
- Set<? extends EObject> elements) {
+ private static boolean buildElement2ViewMap(View parentView, Map<EObject, View> element2ViewMap, Set<? extends EObject> elements) {
if (elements.size() == element2ViewMap.size()) {
return true;
}
-
if (parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) && elements.contains(parentView.getElement())) {
element2ViewMap.put(parentView.getElement(), parentView);
if (elements.size() == element2ViewMap.size()) {
@@ -362,6 +345,5 @@ public class UMLDiagramEditorUtil {
}
return complete;
}
- } // LazyElement2ViewMap
-
+ }// LazyElement2ViewMap
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramUpdater.java
index 437af7d9f6d..a1a7d40445c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramUpdater.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramUpdater.java
@@ -1368,8 +1368,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Transition_Edge(Vertex target,
- CrossReferenceAdapter crossReferencer) {
+ protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Transition_Edge(Vertex target, CrossReferenceAdapter crossReferencer) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
for (EStructuralFeature.Setting setting : settings) {
@@ -1389,8 +1388,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Generalization_Edge(Classifier target,
- CrossReferenceAdapter crossReferencer) {
+ protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Generalization_Edge(Classifier target, CrossReferenceAdapter crossReferencer) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
for (EStructuralFeature.Setting setting : settings) {
@@ -1406,7 +1404,6 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Classifier container = (Classifier) link.eContainer();
result.add(new UMLLinkDescriptor(container, target, link, UMLElementTypes.Generalization_Edge, GeneralizationEditPart.VISUAL_ID));
-
}
return result;
}
@@ -1414,8 +1411,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(
- Element target, CrossReferenceAdapter crossReferencer) {
+ protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(Element target, CrossReferenceAdapter crossReferencer) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
for (EStructuralFeature.Setting setting : settings) {
@@ -1429,8 +1425,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(
- Element target, CrossReferenceAdapter crossReferencer) {
+ protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(Element target, CrossReferenceAdapter crossReferencer) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
for (EStructuralFeature.Setting setting : settings) {
@@ -1444,8 +1439,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Constraint_ContextEdge(Namespace target,
- CrossReferenceAdapter crossReferencer) {
+ protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Constraint_ContextEdge(Namespace target, CrossReferenceAdapter crossReferencer) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
for (EStructuralFeature.Setting setting : settings) {
@@ -1496,8 +1490,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(
- Comment source) {
+ protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(Comment source) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
for (Iterator<?> destinations = source.getAnnotatedElements()
.iterator(); destinations.hasNext();) {
@@ -1510,8 +1503,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(
- Constraint source) {
+ protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(Constraint source) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
for (Iterator<?> destinations = source.getConstrainedElements()
.iterator(); destinations.hasNext();) {
@@ -1524,8 +1516,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ContextEdge(
- Constraint source) {
+ protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ContextEdge(Constraint source) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<>();
Namespace destination = source.getContext();
if (destination == null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDocumentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDocumentProvider.java
index 4810de77dcc..db04b4de73d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDocumentProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDocumentProvider.java
@@ -70,6 +70,7 @@ import org.eclipse.ui.part.FileEditorInput;
/**
* @generated
*/
+@SuppressWarnings("restriction")
public class UMLDocumentProvider extends AbstractDocumentProvider implements IDiagramDocumentProvider {
/**
@@ -78,15 +79,11 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
@Override
protected ElementInfo createElementInfo(Object element) throws CoreException {
if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) {
- throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0,
- NLS.bind(
- Messages.UMLDocumentProvider_IncorrectInputError,
- new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
- null));
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError,
+ new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), null)); //$NON-NLS-1$ //$NON-NLS-2$
}
IEditorInput editorInput = (IEditorInput) element;
IDiagramDocument document = (IDiagramDocument) createDocument(editorInput);
-
ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
info.setModificationStamp(computeModificationStamp(info));
info.fStatus = null;
@@ -99,11 +96,8 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
@Override
protected IDocument createDocument(Object element) throws CoreException {
if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) {
- throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0,
- NLS.bind(
- Messages.UMLDocumentProvider_IncorrectInputError,
- new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
- null));
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError,
+ new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), null)); //$NON-NLS-1$ //$NON-NLS-2$
}
IDocument document = createEmptyDocument();
setDocumentContent(document, (IEditorInput) element);
@@ -120,6 +114,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
* the blue-print element
* @param document
* the document to set up
+ *
* @generated
*/
protected void setupDocument(Object element, IDocument document) {
@@ -193,7 +188,6 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
}
});
-
return editingDomain;
}
@@ -249,17 +243,13 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
thrownExcp = (CoreException) e;
} else {
String msg = e.getLocalizedMessage();
- thrownExcp = new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0,
- msg != null ? msg : Messages.UMLDocumentProvider_DiagramLoadingError, e));
+ thrownExcp = new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, msg != null ? msg : Messages.UMLDocumentProvider_DiagramLoadingError, e));
}
throw thrownExcp;
}
} else {
- throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0,
- NLS.bind(
- Messages.UMLDocumentProvider_IncorrectInputError,
- new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
- null));
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError,
+ new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), null)); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -543,15 +533,11 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
* @generated
*/
@Override
- protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite)
- throws CoreException {
+ protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
if (!overwrite && !info.isSynchronized()) {
- throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID,
- IResourceStatus.OUT_OF_SYNC_LOCAL,
- Messages.UMLDocumentProvider_UnsynchronizedFileSaveError,
- null));
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, IResourceStatus.OUT_OF_SYNC_LOCAL, Messages.UMLDocumentProvider_UnsynchronizedFileSaveError, null));
}
info.stopResourceListening();
fireElementStateChanging(element);
@@ -559,9 +545,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
monitor.beginTask(Messages.UMLDocumentProvider_SaveDiagramTask, info.getResourceSet().getResources().size() + 1); // "Saving diagram"
for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
Resource nextResource = it.next();
- monitor.setTaskName(NLS.bind(
- Messages.UMLDocumentProvider_SaveNextResourceTask,
- nextResource.getURI()));
+ monitor.setTaskName(NLS.bind(Messages.UMLDocumentProvider_SaveNextResourceTask, nextResource.getURI()));
if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
try {
nextResource.save(UMLDiagramEditorUtil.getSaveOptions());
@@ -591,16 +575,12 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
newResoruceURI = ((URIEditorInput) element).getURI();
} else {
fireElementStateChangeFailed(element);
- throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0,
- NLS.bind(
- Messages.UMLDocumentProvider_IncorrectInputError,
- new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
- null));
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, NLS.bind(Messages.UMLDocumentProvider_IncorrectInputError,
+ new Object[] { element, "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), null)); //$NON-NLS-1$ //$NON-NLS-2$
}
if (false == document instanceof IDiagramDocument) {
fireElementStateChangeFailed(element);
- throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0,
- "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); //$NON-NLS-1$ //$NON-NLS-2$
}
IDiagramDocument diagramDocument = (IDiagramDocument) document;
final Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
@@ -1023,7 +1003,6 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
}
if (dirtyStateChanged) {
fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);
-
if (!modified) {
myInfo.setModificationStamp(computeModificationStamp(myInfo));
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLInitDiagramFileAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLInitDiagramFileAction.java
index da0be62da2c..5f3eddb57c5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLInitDiagramFileAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLInitDiagramFileAction.java
@@ -89,19 +89,14 @@ public class UMLInitDiagramFileAction implements IObjectActionDelegate {
Resource resource = resourceSet.getResource(domainModelURI, true);
diagramRoot = resource.getContents().get(0);
} catch (WrappedException ex) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
}
if (diagramRoot == null) {
- MessageDialog.openError(getShell(),
- Messages.InitDiagramFile_ResourceErrorDialogTitle,
- Messages.InitDiagramFile_ResourceErrorDialogMessage);
+ MessageDialog.openError(getShell(), Messages.InitDiagramFile_ResourceErrorDialogTitle, Messages.InitDiagramFile_ResourceErrorDialogMessage);
return;
}
Wizard wizard = new UMLNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain);
- wizard.setWindowTitle(NLS.bind(
- Messages.InitDiagramFile_WizardTitle,
- PackageEditPart.MODEL_ID));
+ wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle, PackageEditPart.MODEL_ID));
UMLDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLLinkDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLLinkDescriptor.java
index 2fd2e98263e..312c0a6662e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLLinkDescriptor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLLinkDescriptor.java
@@ -21,7 +21,6 @@ import org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterLinkDescriptor;
* @generated
*/
public class UMLLinkDescriptor extends UpdaterLinkDescriptor {
-
/**
* @generated
*/
@@ -32,8 +31,8 @@ public class UMLLinkDescriptor extends UpdaterLinkDescriptor {
/**
* @generated
*/
- public UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType,
- String linkVID) {
+ public UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType, String linkVID) {
super(source, destination, linkElement, elementType, linkVID);
}
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNewDiagramFileWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNewDiagramFileWizard.java
index b5dc0022b35..5146d8d2604 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNewDiagramFileWizard.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNewDiagramFileWizard.java
@@ -67,14 +67,11 @@ public class UMLNewDiagramFileWizard extends Wizard {
*/
public UMLNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot, TransactionalEditingDomain editingDomain) {
assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$
- assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$
+ assert diagramRoot != null : "Diagram root element must be specified"; //$NON-NLS-1$
assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$
-
myFileCreationPage = new WizardNewFileCreationPage(Messages.UMLNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY);
myFileCreationPage.setTitle(Messages.UMLNewDiagramFileWizard_CreationPageTitle);
- myFileCreationPage.setDescription(NLS.bind(
- Messages.UMLNewDiagramFileWizard_CreationPageDescription,
- PackageEditPart.MODEL_ID));
+ myFileCreationPage.setDescription(NLS.bind(Messages.UMLNewDiagramFileWizard_CreationPageDescription, PackageEditPart.MODEL_ID));
IPath filePath;
String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment());
if (domainModelURI.isPlatformResource()) {
@@ -86,14 +83,11 @@ public class UMLNewDiagramFileWizard extends Wizard {
throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$
}
myFileCreationPage.setContainerFullPath(filePath);
- myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName(
- filePath, fileName, "PapyrusUMLStateMachine_diagram")); //$NON-NLS-1$
-
+ myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName(filePath, fileName, "PapyrusUMLStateMachine_diagram")); //$NON-NLS-1$
diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(Messages.UMLNewDiagramFileWizard_RootSelectionPageName);
diagramRootElementSelectionPage.setTitle(Messages.UMLNewDiagramFileWizard_RootSelectionPageTitle);
diagramRootElementSelectionPage.setDescription(Messages.UMLNewDiagramFileWizard_RootSelectionPageDescription);
diagramRootElementSelectionPage.setModelElement(diagramRoot);
-
myEditingDomain = editingDomain;
}
@@ -118,39 +112,28 @@ public class UMLNewDiagramFileWizard extends Wizard {
URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
ResourceSet resourceSet = myEditingDomain.getResourceSet();
final Resource diagramResource = resourceSet.createResource(diagramModelURI);
- AbstractTransactionalCommand command = new AbstractTransactionalCommand(
- myEditingDomain, Messages.UMLNewDiagramFileWizard_InitDiagramCommand, affectedFiles) {
-
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(myEditingDomain, Messages.UMLNewDiagramFileWizard_InitDiagramCommand, affectedFiles) {
@Override
- protected CommandResult doExecuteWithResult(
- IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
String diagramVID = UMLVisualIDRegistry.getDiagramVisualID(diagramRootElementSelectionPage.getModelElement());
if (diagramVID.equals(PackageEditPart.VISUAL_ID)) {
- return CommandResult.newErrorCommandResult(
- Messages.UMLNewDiagramFileWizard_IncorrectRootError);
+ return CommandResult.newErrorCommandResult(Messages.UMLNewDiagramFileWizard_IncorrectRootError);
}
- Diagram diagram = ViewService.createDiagram(
- diagramRootElementSelectionPage.getModelElement(), PackageEditPart.MODEL_ID,
- UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ Diagram diagram = ViewService.createDiagram(diagramRootElementSelectionPage.getModelElement(), PackageEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
diagramResource.getContents().add(diagram);
return CommandResult.newOKCommandResult();
}
};
try {
- OperationHistoryFactory.getOperationHistory().execute(
- command, new NullProgressMonitor(), null);
+ OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
diagramResource.save(UMLDiagramEditorUtil.getSaveOptions());
UMLDiagramEditorUtil.openDiagram(diagramResource);
} catch (ExecutionException e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Unable to create model and diagram", e); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
} catch (IOException ex) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Save operation failed for: " + diagramModelURI, ex); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Save operation failed for: " + diagramModelURI, ex); //$NON-NLS-1$
} catch (PartInitException ex) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Unable to open editor", ex); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Unable to open editor", ex); //$NON-NLS-1$
}
return true;
}
@@ -184,10 +167,7 @@ public class UMLNewDiagramFileWizard extends Wizard {
setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
return false;
}
- boolean result = ViewService.getInstance().provides(
- new CreateDiagramViewOperation(
- new EObjectAdapter(getModelElement()),
- PackageEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
+ boolean result = ViewService.getInstance().provides(new CreateDiagramViewOperation(new EObjectAdapter(getModelElement()), PackageEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
setErrorMessage(result ? null : Messages.UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage);
return result;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNodeDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNodeDescriptor.java
index f3a0462eb66..edaa366c8cc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNodeDescriptor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLNodeDescriptor.java
@@ -20,11 +20,11 @@ import org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterNodeDescriptor;
* @generated
*/
public class UMLNodeDescriptor extends UpdaterNodeDescriptor {
-
/**
* @generated
*/
public UMLNodeDescriptor(EObject modelElement, String visualID) {
super(modelElement, visualID);
}
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java
index 7633b0028f7..4c87db6183c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java
@@ -87,7 +87,6 @@ import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionGuardEd
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionNameEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionStereotypeEditPart;
import org.eclipse.uml2.uml.Behavior;
-import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.PseudostateKind;
import org.eclipse.uml2.uml.UMLPackage;
@@ -101,10 +100,11 @@ import org.eclipse.uml2.uml.UMLPackage;
*/
public class UMLVisualIDRegistry {
- /**
- * @generated
- */
- private static final String DEBUG_KEY = "org.eclipse.papyrus.uml.diagram.statemachine/debug/visualID"; //$NON-NLS-1$
+ // Uncomment for debug purpose ?
+ // /**
+ // * @generated
+ // */
+ // private static final String DEBUG_KEY = "org.eclipse.papyrus.uml.diagram.statemachine/debug/visualID"; //$NON-NLS-1$
/**
* @generated
@@ -114,7 +114,7 @@ public class UMLVisualIDRegistry {
if (PackageEditPart.MODEL_ID.equals(view.getType())) {
return PackageEditPart.VISUAL_ID;
} else {
- return "";
+ return ""; //$NON-NLS-1$
}
}
return org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry.getVisualID(view.getType());
@@ -154,7 +154,7 @@ public class UMLVisualIDRegistry {
*/
public static String getDiagramVisualID(EObject domainElement) {
if (domainElement == null) {
- return "";
+ return ""; //$NON-NLS-1$
}
return PackageEditPart.VISUAL_ID;
}
@@ -164,11 +164,11 @@ public class UMLVisualIDRegistry {
*/
public static String getNodeVisualID(View containerView, EObject domainElement) {
if (domainElement == null) {
- return "";
+ return ""; //$NON-NLS-1$
}
String containerModelID = org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry.getModelID(containerView);
if (!PackageEditPart.MODEL_ID.equals(containerModelID)) {
- return "";
+ return ""; //$NON-NLS-1$
}
String containerVisualID;
if (PackageEditPart.MODEL_ID.equals(containerModelID)) {
@@ -177,7 +177,7 @@ public class UMLVisualIDRegistry {
if (containerView instanceof Diagram) {
containerVisualID = PackageEditPart.VISUAL_ID;
} else {
- return "";
+ return ""; //$NON-NLS-1$
}
}
if (containerVisualID != null) {
@@ -311,7 +311,7 @@ public class UMLVisualIDRegistry {
break;
}
}
- return "";
+ return ""; //$NON-NLS-1$
}
/**
@@ -627,7 +627,7 @@ public class UMLVisualIDRegistry {
*/
public static String getLinkWithClassVisualID(EObject domainElement) {
if (domainElement == null) {
- return "";
+ return ""; //$NON-NLS-1$
}
if (UMLPackage.eINSTANCE.getTransition().isSuperTypeOf(domainElement.eClass())) {
return TransitionEditPart.VISUAL_ID;
@@ -635,18 +635,19 @@ public class UMLVisualIDRegistry {
if (UMLPackage.eINSTANCE.getGeneralization().isSuperTypeOf(domainElement.eClass())) {
return GeneralizationEditPart.VISUAL_ID;
}
- return "";
+ return ""; //$NON-NLS-1$
}
- /**
- * User can change implementation of this method to handle some specific
- * situations not covered by default logic.
- *
- * @generated
- */
- private static boolean isDiagram(Package element) {
- return true;
- }
+ // Uncomment for debug purpose ?
+ // /**
+ // * User can change implementation of this method to handle some specific
+ // * situations not covered by default logic.
+ // *
+ // * @generated
+ // */
+ // private static boolean isDiagram(Package element) {
+ // return true;
+ // }
/**
* @generated
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ValidateAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ValidateAction.java
index cb708f57c0f..14669845599 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ValidateAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/part/ValidateAction.java
@@ -79,16 +79,12 @@ public class ValidateAction extends Action {
if (workbenchPart instanceof IDiagramWorkbenchPart) {
final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
try {
- new WorkspaceModifyDelegatingOperation(
- new IRunnableWithProgress() {
-
- @Override
- public void run(IProgressMonitor monitor)
- throws InterruptedException, InvocationTargetException {
- runValidation(part.getDiagramEditPart(), part.getDiagram());
- }
- })
- .run(new NullProgressMonitor());
+ new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
+ runValidation(part.getDiagramEditPart(), part.getDiagram());
+ }
+ }).run(new NullProgressMonitor());
} catch (Exception e) {
UMLDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
}
@@ -101,8 +97,7 @@ public class ValidateAction extends Action {
public static void runValidation(View view) {
try {
if (UMLDiagramEditorUtil.openDiagram(view.eResource())) {
- IEditorPart editorPart = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editorPart instanceof IDiagramWorkbenchPart) {
runValidation(((IDiagramWorkbenchPart) editorPart).getDiagramEditPart(), view);
} else {
@@ -110,8 +105,7 @@ public class ValidateAction extends Action {
}
}
} catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Validation action failed", e); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
}
}
@@ -123,9 +117,7 @@ public class ValidateAction extends Action {
if (shell == null) {
shell = new Shell();
}
-
- DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(
- view.getDiagram(), shell);
+ DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(view.getDiagram(), shell);
runValidation(diagramEditPart, view);
}
@@ -137,7 +129,6 @@ public class ValidateAction extends Action {
final View fview = view;
TransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);
UMLValidationProvider.runWithConstraints(txDomain, new Runnable() {
-
@Override
public void run() {
validate(fpart, fview);
@@ -151,7 +142,6 @@ public class ValidateAction extends Action {
private static Diagnostic runEMFValidator(View target) {
if (target.isSetElement() && target.getElement() != null) {
return new Diagnostician() {
-
@Override
public String getObjectLabel(EObject eObject) {
return EMFCoreUtil.getQualifiedName(eObject, true);
@@ -171,8 +161,7 @@ public class ValidateAction extends Action {
}
Diagnostic diagnostic = runEMFValidator(view);
createMarkers(target, diagnostic, diagramEditPart);
- IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance().newValidator(
- EvaluationMode.BATCH);
+ IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
validator.setIncludeLiveConstraints(true);
if (view.isSetElement() && view.getElement() != null) {
IStatus status = validator.validate(view.getElement());
@@ -188,17 +177,12 @@ public class ValidateAction extends Action {
return;
}
final IStatus rootStatus = validationStatus;
- List allStatuses = new ArrayList();
- UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(
- diagramEditPart.getDiagramView(),
- collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses));
- for (Iterator it = allStatuses.iterator(); it.hasNext();) {
- IConstraintStatus nextStatus = (IConstraintStatus) it.next();
- View view = UMLDiagramEditorUtil.findView(
- diagramEditPart, nextStatus.getTarget(), element2ViewMap);
- addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
- EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true),
- nextStatus.getMessage(), nextStatus.getSeverity());
+ List<IConstraintStatus> allStatuses = new ArrayList<>();
+ UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<>(), allStatuses));
+ for (Iterator<IConstraintStatus> it = allStatuses.iterator(); it.hasNext();) {
+ IConstraintStatus nextStatus = it.next();
+ View view = UMLDiagramEditorUtil.findView(diagramEditPart, nextStatus.getTarget(), element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), nextStatus.getMessage(), nextStatus.getSeverity());
}
}
@@ -211,19 +195,14 @@ public class ValidateAction extends Action {
}
final Diagnostic rootStatus = emfValidationStatus;
List<Diagnostic> allDiagnostics = new ArrayList<>();
- UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(
- diagramEditPart.getDiagramView(),
- collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics));
+ UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<>(), allDiagnostics));
for (Iterator<Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
Diagnostic nextDiagnostic = it.next();
List<?> data = nextDiagnostic.getData();
if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
EObject element = (EObject) data.get(0);
- View view = UMLDiagramEditorUtil.findView(
- diagramEditPart, element, element2ViewMap);
- addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
- EMFCoreUtil.getQualifiedName(element, true),
- nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
+ View view = UMLDiagramEditorUtil.findView(diagramEditPart, element, element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
}
}
}
@@ -235,8 +214,7 @@ public class ValidateAction extends Action {
if (target == null) {
return;
}
- UMLMarkerNavigationProvider.addMarker(
- target, elementId, location, message, statusSeverity);
+ UMLMarkerNavigationProvider.addMarker(target, elementId, location, message, statusSeverity);
}
/**
@@ -249,8 +227,7 @@ public class ValidateAction extends Action {
return IStatus.INFO;
} else if (diagnosticSeverity == Diagnostic.WARNING) {
return IStatus.WARNING;
- } else if (diagnosticSeverity == Diagnostic.ERROR
- || diagnosticSeverity == Diagnostic.CANCEL) {
+ } else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
return IStatus.ERROR;
}
return IStatus.INFO;
@@ -259,8 +236,7 @@ public class ValidateAction extends Action {
/**
* @generated
*/
- private static Set<EObject> collectTargetElements(IStatus status, Set<EObject> targetElementCollector,
- List<IConstraintStatus> allConstraintStatuses) {
+ private static Set<EObject> collectTargetElements(IStatus status, Set<EObject> targetElementCollector, List<IConstraintStatus> allConstraintStatuses) {
if (status instanceof IConstraintStatus) {
targetElementCollector.add(((IConstraintStatus) status).getTarget());
allConstraintStatuses.add((IConstraintStatus) status);
@@ -277,8 +253,7 @@ public class ValidateAction extends Action {
/**
* @generated
*/
- private static Set<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector,
- List<Diagnostic> allDiagnostics) {
+ private static Set<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector, List<Diagnostic> allDiagnostics) {
List<?> data = diagnostic.getData();
EObject target = null;
if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/preferences/DiagramPreferenceInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/preferences/DiagramPreferenceInitializer.java
index 31c1752e55f..2293b68d3e9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/preferences/DiagramPreferenceInitializer.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/preferences/DiagramPreferenceInitializer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2014, 2017 CEA LIST.
+ * Copyright (c) 2014 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,7 +10,6 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 512207
*/
package org.eclipse.papyrus.uml.diagram.statemachine.preferences;
@@ -37,7 +36,6 @@ public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer
AppearancePreferencePage.initDefaults(store);
ConnectionsPreferencePage.initDefaults(store);
PrintingPreferencePage.initDefaults(store);
-
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/ElementInitializers.java
index d9a7fc04101..6df0fd4d16a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/ElementInitializers.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/ElementInitializers.java
@@ -47,16 +47,14 @@ public class ElementInitializers {
try {
Object value_0 = name_StateMachine_Shape(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
Region newInstance_1_0 = UMLFactory.eINSTANCE.createRegion();
instance.getRegions()
.add(newInstance_1_0);
Object value_1_0_0 = name_region_StateMachine_Shape(newInstance_1_0);
if (value_1_0_0 != null) {
- newInstance_1_0.setName(
- (String) value_1_0_0);
+ newInstance_1_0.setName((String) value_1_0_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -70,8 +68,7 @@ public class ElementInitializers {
try {
Object value_0 = name_State_Shape_TN(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -85,8 +82,7 @@ public class ElementInitializers {
try {
Object value_0 = name_Region_Shape(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -100,8 +96,7 @@ public class ElementInitializers {
try {
Object value_0 = name_FinalState_Shape(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -115,8 +110,7 @@ public class ElementInitializers {
try {
Object value_0 = name_State_Shape(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -130,15 +124,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_InitialShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_InitialShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -152,15 +143,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_JoinShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_JoinShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -174,15 +162,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_ForkShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_ForkShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -196,15 +181,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_ChoiceShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_ChoiceShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -218,15 +200,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_JunctionShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_JunctionShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -240,15 +219,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_ShallowHistoryShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_ShallowHistoryShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -262,15 +238,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_DeepHistoryShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_DeepHistoryShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -284,15 +257,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_TerminateShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_TerminateShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -306,15 +276,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_EntryPointShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_EntryPointShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -328,15 +295,12 @@ public class ElementInitializers {
try {
Object value_0 = kind_Pseudostate_ExitPointShape(instance);
if (value_0 != null) {
-
value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind(
- (PseudostateKind) value_0);
+ instance.setKind((PseudostateKind) value_0);
}
Object value_1 = name_Pseudostate_ExitPointShape(instance);
if (value_1 != null) {
- instance.setName(
- (String) value_1);
+ instance.setName((String) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -350,8 +314,7 @@ public class ElementInitializers {
try {
Object value_0 = name_ConnectionPointReference_Shape(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -365,8 +328,7 @@ public class ElementInitializers {
try {
Object value_0 = body_Comment_Shape(instance);
if (value_0 != null) {
- instance.setBody(
- (String) value_0);
+ instance.setBody((String) value_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -380,13 +342,11 @@ public class ElementInitializers {
try {
Object value_0 = name_Constraint_Shape(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
Object value_1 = specification_Constraint_Shape(instance);
if (value_1 != null) {
- instance.setSpecification(
- (ValueSpecification) value_1);
+ instance.setSpecification((ValueSpecification) value_1);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -400,8 +360,7 @@ public class ElementInitializers {
try {
Object value_0 = name_Transition_InternalTransitionLabel(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -415,8 +374,7 @@ public class ElementInitializers {
try {
Object value_0 = name_Transition_Edge(instance);
if (value_0 != null) {
- instance.setName(
- (String) value_0);
+ instance.setName((String) value_0);
}
} catch (RuntimeException e) {
UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
@@ -616,7 +574,7 @@ public class ElementInitializers {
* @generated
*/
private String body_Comment_Shape(Comment it) {
- return "";
+ return ""; //$NON-NLS-1$
}
/**
@@ -631,7 +589,7 @@ public class ElementInitializers {
*/
private ValueSpecification specification_Constraint_Shape(Constraint it) {
LiteralString literalString = UMLFactory.eINSTANCE.createLiteralString();
- literalString.setValue("");
+ literalString.setValue(""); //$NON-NLS-1$
return literalString;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLEditPartProvider.java
index b4ce1f4f77e..d24eae4434e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLEditPartProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLEditPartProvider.java
@@ -27,8 +27,6 @@ public class UMLEditPartProvider extends DefaultEditPartProvider {
* @generated
*/
public UMLEditPartProvider() {
- super(new UMLEditPartFactory(),
- UMLVisualIDRegistry.TYPED_INSTANCE,
- PackageEditPart.MODEL_ID);
+ super(new UMLEditPartFactory(), UMLVisualIDRegistry.TYPED_INSTANCE, PackageEditPart.MODEL_ID);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLElementTypes.java
index eb78d1f051d..bb969d9479e 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLElementTypes.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLElementTypes.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.providers;
@@ -180,7 +180,6 @@ public class UMLElementTypes {
* @generated
*/
public static final IElementType Trigger_DeferrableTriggerLabel = getElementTypeByUniqueId("org.eclipse.papyrus.umldi.Trigger_DeferrableTriggerLabel"); //$NON-NLS-1$
-
/**
* @generated
*/
@@ -239,88 +238,34 @@ public class UMLElementTypes {
Object type = hint.getAdapter(IElementType.class);
if (elements == null) {
elements = new IdentityHashMap<>();
-
elements.put(Package_StateMachineDiagram, UMLPackage.eINSTANCE.getPackage());
-
-
elements.put(StateMachine_Shape, UMLPackage.eINSTANCE.getStateMachine());
-
-
elements.put(State_Shape_TN, UMLPackage.eINSTANCE.getState());
-
-
elements.put(Region_Shape, UMLPackage.eINSTANCE.getRegion());
-
-
elements.put(FinalState_Shape, UMLPackage.eINSTANCE.getFinalState());
-
-
elements.put(State_Shape, UMLPackage.eINSTANCE.getState());
-
-
elements.put(Pseudostate_InitialShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_JoinShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_ForkShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_ChoiceShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_JunctionShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_ShallowHistoryShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_DeepHistoryShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_TerminateShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_EntryPointShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(Pseudostate_ExitPointShape, UMLPackage.eINSTANCE.getPseudostate());
-
-
elements.put(ConnectionPointReference_Shape, UMLPackage.eINSTANCE.getConnectionPointReference());
-
-
elements.put(Comment_Shape, UMLPackage.eINSTANCE.getComment());
-
-
elements.put(Constraint_Shape, UMLPackage.eINSTANCE.getConstraint());
-
-
elements.put(Transition_InternalTransitionLabel, UMLPackage.eINSTANCE.getTransition());
-
-
elements.put(Behavior_EntryBehaviorLabel, UMLPackage.eINSTANCE.getBehavior());
-
-
elements.put(Behavior_DoActivityBehaviorLabel, UMLPackage.eINSTANCE.getBehavior());
-
-
elements.put(Behavior_ExitBehaviorLabel, UMLPackage.eINSTANCE.getBehavior());
-
-
elements.put(Trigger_DeferrableTriggerLabel, UMLPackage.eINSTANCE.getTrigger());
-
-
elements.put(Transition_Edge, UMLPackage.eINSTANCE.getTransition());
-
-
elements.put(Generalization_Edge, UMLPackage.eINSTANCE.getGeneralization());
-
elements.put(Comment_AnnotatedElementEdge, UMLPackage.eINSTANCE.getComment_AnnotatedElement());
-
elements.put(Constraint_ConstrainedElementEdge, UMLPackage.eINSTANCE.getConstraint_ConstrainedElement());
-
elements.put(Constraint_ContextEdge, UMLPackage.eINSTANCE.getConstraint_Context());
}
return elements.get(type);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLMarkerNavigationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLMarkerNavigationProvider.java
index 988fd669c58..971b8fe808b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLMarkerNavigationProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLMarkerNavigationProvider.java
@@ -55,8 +55,7 @@ public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationPr
}
EditPart targetEditPart = (EditPart) editPartRegistry.get(targetView);
if (targetEditPart != null) {
- UMLDiagramEditorUtil.selectElementsInDiagram(
- editor, Arrays.asList(new EditPart[] { targetEditPart }));
+ UMLDiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[] { targetEditPart }));
}
}
@@ -67,8 +66,7 @@ public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationPr
try {
resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO);
} catch (CoreException e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Failed to delete validation markers", e); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Failed to delete validation markers", e); //$NON-NLS-1$
}
}
@@ -85,14 +83,12 @@ public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationPr
int markerSeverity = IMarker.SEVERITY_INFO;
if (statusSeverity == IStatus.WARNING) {
markerSeverity = IMarker.SEVERITY_WARNING;
- } else if (statusSeverity == IStatus.ERROR ||
- statusSeverity == IStatus.CANCEL) {
+ } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) {
markerSeverity = IMarker.SEVERITY_ERROR;
}
marker.setAttribute(IMarker.SEVERITY, markerSeverity);
} catch (CoreException e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Failed to create validation marker", e); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
}
return marker;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLParserProvider.java
index 4d3d35b7776..3349e197c23 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLParserProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLParserProvider.java
@@ -770,84 +770,66 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
switch (visualID) {
case StateMachineNameEditPart.VISUAL_ID:
return getStateMachine_NameLabel_Parser();
-
case StateNameEditPartTN.VISUAL_ID:
return getState_NameLabel_TN_Parser();
-
-
case FinalStateFloatingLabelEditPart.VISUAL_ID:
return getFinalState_FloatingNameLabel_Parser();
case FinalStateStereotypeEditPart.VISUAL_ID:
return getFinalState_StereotypeLabel_Parser();
-
case StateNameEditPart.VISUAL_ID:
return getState_NameLabel_Parser();
case StateFloatingLabelEditPart.VISUAL_ID:
return getState_FloatingNameLabel_Parser();
-
case PseudostateInitialFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_InitialFloatingNameLabel_Parser();
case PseudostateInitialStereotypeEditPart.VISUAL_ID:
return getPseudostate_InitialStereotypeLabel_Parser();
-
case PseudostateJoinFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_JoinFloatingNameLabel_Parser();
case PseudostateJoinStereotypeEditPart.VISUAL_ID:
return getPseudostate_JoinStereotypeLabel_Parser();
-
case PseudostateForkNameEditPart.VISUAL_ID:
return getPseudostate_ForkFloatingNameLabel_Parser();
case PseudostateForkStereotypeEditPart.VISUAL_ID:
return getPseudostate_ForkStereotypeLabel_Parser();
-
case PseudostateChoiceFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_ChoiceFloatingNameLabel_Parser();
case PseudostateChoiceStereotypeEditPart.VISUAL_ID:
return getPseudostate_ChoiceStereotypeLabel_Parser();
-
case PseudostateJunctionFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_JunctionFloatingNameLabel_Parser();
case PseudostateJunctionStereotypeEditPart.VISUAL_ID:
return getPseudostate_JunctionStereotypeLabel_Parser();
-
case PseudostateShallowHistoryFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_ShallowHistoryFloatingNameLabel_Parser();
case PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID:
return getPseudostate_ShallowHistoryStereotypeLabel_Parser();
-
case PseudostateDeepHistoryFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_DeepHistoryFloatingNameLabel_Parser();
case PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID:
return getPseudostate_DeepHistoryStereotypeLabel_Parser();
-
case PseudostateTerminateFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_TerminateFloatingNameLabel_Parser();
case PseudostateTerminateStereotypeEditPart.VISUAL_ID:
return getPseudostate_TerminateStereotypeLabel_Parser();
-
case PseudostateEntryPointFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_EntryPointFloatingNameLabel_Parser();
case PseudostateEntryPointStereotypeEditPart.VISUAL_ID:
return getPseudostate_EntryPointStereotypeLabel_Parser();
-
case PseudostateExitPointFloatingLabelEditPart.VISUAL_ID:
return getPseudostate_ExitPointFloatingNameLabel_Parser();
case PseudostateExitPointStereotypeEditPart.VISUAL_ID:
return getPseudostate_ExitPointStereotypeLabel_Parser();
-
case ConnectionPointReferenceNameEditPart.VISUAL_ID:
return getConnectionPointReference_NameLabel_Parser();
case ConnectionPointReferenceStereotypeEditPart.VISUAL_ID:
return getConnectionPointReference_StereotypeLabel_Parser();
-
case CommentBodyEditPart.VISUAL_ID:
return getComment_BodyLabel_Parser();
-
case ConstraintNameLabelEditPart.VISUAL_ID:
return getConstraint_NameLabel_Parser();
case ConstraintBodyEditPart.VISUAL_ID:
return getConstraint_BodyLabel_Parser();
-
case InternalTransitionEditPart.VISUAL_ID:
return getTransition_InternalTransitionLabel_Parser();
case EntryStateBehaviorEditPart.VISUAL_ID:
@@ -864,13 +846,8 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
return getTransition_GuardLabel_Parser();
case TransitionStereotypeEditPart.VISUAL_ID:
return getTransition_StereotypeLabel_Parser();
-
case GeneralizationStereotypeEditPart.VISUAL_ID:
return getGeneralization_StereotypeLabel_Parser();
-
-
-
-
}
}
return null;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java
index 4800ccda03a..9b4e202882c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java
@@ -40,8 +40,7 @@ public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider
@Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = decoratorTarget.getAdapter(EditPart.class);
- if (editPart instanceof GraphicalEditPart ||
- editPart instanceof AbstractConnectionEditPart) {
+ if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
Object model = editPart.getModel();
if ((model instanceof View)) {
View view = (View) model;
@@ -68,8 +67,7 @@ public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider
return false;
}
IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();
- View view = decoratorTarget.getAdapter(
- View.class);
+ View view = decoratorTarget.getAdapter(View.class);
return view != null && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java
index 64aacd5c520..a6b90e5a16e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java
@@ -81,7 +81,6 @@ public class UMLValidationProvider {
* @generated
*/
public static class DefaultCtx implements IClientSelector {
-
/**
* @generated
*/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLViewProvider.java
index 4611ca26c32..5930f9830b2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLViewProvider.java
@@ -32,7 +32,6 @@ import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperatio
import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
@@ -40,23 +39,17 @@ import org.eclipse.gmf.runtime.notation.Connector;
import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.FillStyle;
-import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.Location;
import org.eclipse.gmf.runtime.notation.MeasurementUnit;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
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.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.CommentAnnotatedElementEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.CommentBodyEditPart;
@@ -128,8 +121,6 @@ import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionGuardEd
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionNameEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionStereotypeEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
/**
* @generated
@@ -145,7 +136,6 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
return provides((CreateViewForKindOperation) operation);
}
assert operation instanceof CreateViewOperation;
-
/* we check this view provider is the good one for the currently edited diagram */
if (operation instanceof CreateChildViewOperation) {
View container = ((CreateChildViewOperation) operation).getContainerView();
@@ -154,7 +144,6 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
return false;
}
}
-
if (operation instanceof CreateDiagramViewOperation) {
return provides((CreateDiagramViewOperation) operation);
} else if (operation instanceof CreateEdgeViewOperation) {
@@ -169,24 +158,15 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
* @generated
*/
protected boolean provides(CreateViewForKindOperation op) {
- /*
- * if (op.getViewKind() == Node.class)
- * return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- * if (op.getViewKind() == Edge.class)
- * return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null;
- */
-
// check Diagram Type should be the class diagram
String modelID = UMLVisualIDRegistry.getModelID(op.getContainerView());
if (!getDiagramProvidedId().equals(modelID)) {
return false;
}
-
String visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
if (Node.class.isAssignableFrom(op.getViewKind())) {
return UMLVisualIDRegistry.canCreateNode(op.getContainerView(), visualID);
}
-
return true;
}
@@ -234,18 +214,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
} else {
visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
if (elementType != null) {
-
if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
return false; // foreign element type
}
-
String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
if (!op.getSemanticHint().equals(elementTypeHint)) {
return false; // if semantic hint is specified it should be the same as in element type
}
- // if (domainElement != null && !visualID.equals(org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement))) {
- // return false; // visual id for node EClass should match visual id from element type
- // }
} else {
if (!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(op.getContainerView()))) {
return false; // foreign diagram
@@ -285,7 +260,6 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
}
}
}
-
return UMLVisualIDRegistry.canCreateNode(op.getContainerView(), visualID);
}
@@ -294,20 +268,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
*/
protected boolean provides(CreateEdgeViewOperation op) {
IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
-
if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
return false; // foreign element type
}
-
String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
return false; // our hint is visual id and must be specified, and it should be the same as in element type
}
- // String visualID = org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry.getVisualID(elementTypeHint);
- // org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
- // if (domainElement != null && !visualID.equals(org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement))) {
- // return false; // visual id for link EClass should match visual id from element type
- // }
return true;
}
@@ -330,8 +297,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
* @generated
*/
@Override
- public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
final EObject domainElement = getSemanticElement(semanticAdapter);
final String visualID;
if (semanticHint == null) {
@@ -397,8 +363,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
* @generated
*/
@Override
- public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
IElementType elementType = getSemanticElementType(semanticAdapter);
String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
String vid = UMLVisualIDRegistry.getVisualID(elementTypeHint);
@@ -423,8 +388,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createStateMachine_Shape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createStateMachine_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(StateMachineEditPart.VISUAL_ID));
@@ -433,19 +397,17 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "StateMachine");
- Node stateMachine_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(StateMachineNameEditPart.VISUAL_ID));
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "StateMachine"); //$NON-NLS-1$
+ createLabel(node, UMLVisualIDRegistry.getType(StateMachineNameEditPart.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(StateMachineCompartmentEditPart.VISUAL_ID), false, false, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "StateMachine");
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "StateMachine"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createState_Shape_TN(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createState_Shape_TN(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(StateEditPartTN.VISUAL_ID));
@@ -454,19 +416,17 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "State");
- Node state_NameLabel_TN = createLabel(node, UMLVisualIDRegistry.getType(StateNameEditPartTN.VISUAL_ID));
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "State"); //$NON-NLS-1$
+ createLabel(node, UMLVisualIDRegistry.getType(StateNameEditPartTN.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(StateCompartmentEditPartTN.VISUAL_ID), false, false, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "State");
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "State"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createRegion_Shape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createRegion_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(RegionEditPart.VISUAL_ID));
@@ -474,18 +434,16 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Region");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Region"); //$NON-NLS-1$
createCompartment(node, UMLVisualIDRegistry.getType(RegionCompartmentEditPart.VISUAL_ID), false, false, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Region");
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Region"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createFinalState_Shape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createFinalState_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(FinalStateEditPart.VISUAL_ID));
@@ -493,8 +451,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "FinalState");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "FinalState"); //$NON-NLS-1$
Node finalState_FloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(FinalStateFloatingLabelEditPart.VISUAL_ID));
finalState_FloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location finalState_FloatingNameLabel_Location = (Location) finalState_FloatingNameLabel.getLayoutConstraint();
@@ -511,8 +468,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createState_Shape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createState_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(StateEditPart.VISUAL_ID));
@@ -520,24 +476,22 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "State");
- Node state_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(StateNameEditPart.VISUAL_ID));
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "State"); //$NON-NLS-1$
+ createLabel(node, UMLVisualIDRegistry.getType(StateNameEditPart.VISUAL_ID));
Node state_FloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(StateFloatingLabelEditPart.VISUAL_ID));
state_FloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location state_FloatingNameLabel_Location = (Location) state_FloatingNameLabel.getLayoutConstraint();
state_FloatingNameLabel_Location.setX(40);
state_FloatingNameLabel_Location.setY(0);
createCompartment(node, UMLVisualIDRegistry.getType(StateCompartmentEditPart.VISUAL_ID), false, false, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "State");
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "State"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createPseudostate_InitialShape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createPseudostate_InitialShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateInitialEditPart.VISUAL_ID));
@@ -545,8 +499,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_InitialFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateInitialFloatingLabelEditPart.VISUAL_ID));
pseudostate_InitialFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_InitialFloatingNameLabel_Location = (Location) pseudostate_InitialFloatingNameLabel.getLayoutConstraint();
@@ -563,8 +516,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createPseudostate_JoinShape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createPseudostate_JoinShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateJoinEditPart.VISUAL_ID));
@@ -572,8 +524,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_JoinFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateJoinFloatingLabelEditPart.VISUAL_ID));
pseudostate_JoinFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_JoinFloatingNameLabel_Location = (Location) pseudostate_JoinFloatingNameLabel.getLayoutConstraint();
@@ -590,8 +541,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createPseudostate_ForkShape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createPseudostate_ForkShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateForkEditPart.VISUAL_ID));
@@ -599,8 +549,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_ForkFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateForkNameEditPart.VISUAL_ID));
pseudostate_ForkFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_ForkFloatingNameLabel_Location = (Location) pseudostate_ForkFloatingNameLabel.getLayoutConstraint();
@@ -617,8 +566,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createPseudostate_ChoiceShape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createPseudostate_ChoiceShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateChoiceEditPart.VISUAL_ID));
@@ -626,8 +574,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_ChoiceFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateChoiceFloatingLabelEditPart.VISUAL_ID));
pseudostate_ChoiceFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_ChoiceFloatingNameLabel_Location = (Location) pseudostate_ChoiceFloatingNameLabel.getLayoutConstraint();
@@ -644,8 +591,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createPseudostate_JunctionShape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createPseudostate_JunctionShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateJunctionEditPart.VISUAL_ID));
@@ -653,8 +599,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_JunctionFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateJunctionFloatingLabelEditPart.VISUAL_ID));
pseudostate_JunctionFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_JunctionFloatingNameLabel_Location = (Location) pseudostate_JunctionFloatingNameLabel.getLayoutConstraint();
@@ -671,8 +616,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createPseudostate_ShallowHistoryShape(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createPseudostate_ShallowHistoryShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateShallowHistoryEditPart.VISUAL_ID));
@@ -680,8 +624,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_ShallowHistoryFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateShallowHistoryFloatingLabelEditPart.VISUAL_ID));
pseudostate_ShallowHistoryFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_ShallowHistoryFloatingNameLabel_Location = (Location) pseudostate_ShallowHistoryFloatingNameLabel.getLayoutConstraint();
@@ -698,8 +641,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createPseudostate_DeepHistoryShape(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createPseudostate_DeepHistoryShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateDeepHistoryEditPart.VISUAL_ID));
@@ -707,8 +649,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_DeepHistoryFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateDeepHistoryFloatingLabelEditPart.VISUAL_ID));
pseudostate_DeepHistoryFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_DeepHistoryFloatingNameLabel_Location = (Location) pseudostate_DeepHistoryFloatingNameLabel.getLayoutConstraint();
@@ -725,8 +666,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createPseudostate_TerminateShape(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createPseudostate_TerminateShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateTerminateEditPart.VISUAL_ID));
@@ -734,8 +674,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_TerminateFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateTerminateFloatingLabelEditPart.VISUAL_ID));
pseudostate_TerminateFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_TerminateFloatingNameLabel_Location = (Location) pseudostate_TerminateFloatingNameLabel.getLayoutConstraint();
@@ -752,8 +691,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- public Node createPseudostate_EntryPointShape(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createPseudostate_EntryPointShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateEntryPointEditPart.VISUAL_ID));
@@ -761,8 +699,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_EntryPointFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateEntryPointFloatingLabelEditPart.VISUAL_ID));
pseudostate_EntryPointFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_EntryPointFloatingNameLabel_Location = (Location) pseudostate_EntryPointFloatingNameLabel.getLayoutConstraint();
@@ -773,15 +710,14 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location pseudostate_EntryPointStereotypeLabel_Location = (Location) pseudostate_EntryPointStereotypeLabel.getLayoutConstraint();
pseudostate_EntryPointStereotypeLabel_Location.setX(25);
pseudostate_EntryPointStereotypeLabel_Location.setY(-10);
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createPseudostate_ExitPointShape(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createPseudostate_ExitPointShape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(PseudostateExitPointEditPart.VISUAL_ID));
@@ -789,8 +725,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
Node pseudostate_ExitPointFloatingNameLabel = createLabel(node, UMLVisualIDRegistry.getType(PseudostateExitPointFloatingLabelEditPart.VISUAL_ID));
pseudostate_ExitPointFloatingNameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location pseudostate_ExitPointFloatingNameLabel_Location = (Location) pseudostate_ExitPointFloatingNameLabel.getLayoutConstraint();
@@ -801,15 +736,14 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location pseudostate_ExitPointStereotypeLabel_Location = (Location) pseudostate_ExitPointStereotypeLabel.getLayoutConstraint();
pseudostate_ExitPointStereotypeLabel_Location.setX(25);
pseudostate_ExitPointStereotypeLabel_Location.setY(-10);
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(node, prefStore, "Pseudostate");
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(node, prefStore, "Pseudostate"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createConnectionPointReference_Shape(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createConnectionPointReference_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(ConnectionPointReferenceEditPart.VISUAL_ID));
@@ -817,8 +751,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ConnectionPointReference");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ConnectionPointReference"); //$NON-NLS-1$
Node connectionPointReference_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(ConnectionPointReferenceNameEditPart.VISUAL_ID));
connectionPointReference_NameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location connectionPointReference_NameLabel_Location = (Location) connectionPointReference_NameLabel.getLayoutConstraint();
@@ -829,15 +762,14 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location connectionPointReference_StereotypeLabel_Location = (Location) connectionPointReference_StereotypeLabel.getLayoutConstraint();
connectionPointReference_StereotypeLabel_Location.setX(25);
connectionPointReference_StereotypeLabel_Location.setY(-10);
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(node, prefStore, "ConnectionPointReference");
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(node, prefStore, "ConnectionPointReference"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createComment_Shape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createComment_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(CommentEditPart.VISUAL_ID));
@@ -845,17 +777,15 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment");
- Node comment_BodyLabel = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment"); //$NON-NLS-1$
+ createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
return node;
}
/**
* @generated
*/
- public Node createConstraint_Shape(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ public Node createConstraint_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(UMLVisualIDRegistry.getType(ConstraintEditPart.VISUAL_ID));
@@ -863,74 +793,65 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint");
- Node constraint_NameLabel = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameLabelEditPart.VISUAL_ID));
- Node constraint_BodyLabel = createLabel(node, UMLVisualIDRegistry.getType(ConstraintBodyEditPart.VISUAL_ID));
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint"); //$NON-NLS-1$
+ createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameLabelEditPart.VISUAL_ID));
+ createLabel(node, UMLVisualIDRegistry.getType(ConstraintBodyEditPart.VISUAL_ID));
return node;
}
/**
* @generated
*/
- public Node createTransition_InternalTransitionLabel(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createTransition_InternalTransitionLabel(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(InternalTransitionEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
-
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "InternalTransition");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "InternalTransition"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createBehavior_EntryBehaviorLabel(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createBehavior_EntryBehaviorLabel(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(EntryStateBehaviorEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
-
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "EntryStateBehavior");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "EntryStateBehavior"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createBehavior_DoActivityBehaviorLabel(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createBehavior_DoActivityBehaviorLabel(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(DoActivityStateBehaviorStateEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
-
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DoActivityStateBehavior");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DoActivityStateBehavior"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Node createBehavior_ExitBehaviorLabel(EObject domainElement, View containerView, int index,
- boolean persisted, PreferencesHint preferencesHint) {
+ public Node createBehavior_ExitBehaviorLabel(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
node.setType(UMLVisualIDRegistry.getType(ExitStateBehaviorEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
-
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExitStateBehavior");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExitStateBehavior"); //$NON-NLS-1$
return node;
}
@@ -943,17 +864,16 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setType(UMLVisualIDRegistry.getType(DeferrableTriggerEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
-
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeferrableTrigger");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeferrableTrigger"); //$NON-NLS-1$
return node;
}
/**
* @generated
*/
- public Edge createTransition_Edge(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ @SuppressWarnings("unchecked")
+ public Edge createTransition_Edge(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Connector edge = NotationFactory.eINSTANCE.createConnector();
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
@@ -967,12 +887,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Transition");
- // org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- // if (routing != null) {
- // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- // }
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Transition"); //$NON-NLS-1$
Node transition_NameLabel = createLabel(edge, UMLVisualIDRegistry.getType(TransitionNameEditPart.VISUAL_ID));
transition_NameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location transition_NameLabel_Location = (Location) transition_NameLabel.getLayoutConstraint();
@@ -988,16 +903,15 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location transition_StereotypeLabel_Location = (Location) transition_StereotypeLabel.getLayoutConstraint();
transition_StereotypeLabel_Location.setX(0);
transition_StereotypeLabel_Location.setY(60);
-
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Transition");
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Transition"); //$NON-NLS-1$
return edge;
}
/**
* @generated
*/
- public Edge createGeneralization_Edge(EObject domainElement, View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ @SuppressWarnings("unchecked")
+ public Edge createGeneralization_Edge(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Connector edge = NotationFactory.eINSTANCE.createConnector();
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
@@ -1011,27 +925,21 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Generalization");
- // org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- // if (routing != null) {
- // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- // }
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Generalization"); //$NON-NLS-1$
Node generalization_StereotypeLabel = createLabel(edge, UMLVisualIDRegistry.getType(GeneralizationStereotypeEditPart.VISUAL_ID));
generalization_StereotypeLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location generalization_StereotypeLabel_Location = (Location) generalization_StereotypeLabel.getLayoutConstraint();
generalization_StereotypeLabel_Location.setX(0);
generalization_StereotypeLabel_Location.setY(40);
-
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Generalization");
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Generalization"); //$NON-NLS-1$
return edge;
}
/**
* @generated
*/
- public Edge createComment_AnnotatedElementEdge(View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ @SuppressWarnings("unchecked")
+ public Edge createComment_AnnotatedElementEdge(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Connector edge = NotationFactory.eINSTANCE.createConnector();
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
@@ -1044,21 +952,14 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setType(UMLVisualIDRegistry.getType(CommentAnnotatedElementEditPart.VISUAL_ID));
edge.setElement(null);
// initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- // org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- // if (routing != null) {
- // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- // }
-
return edge;
}
/**
* @generated
*/
- public Edge createConstraint_ConstrainedElementEdge(View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ @SuppressWarnings("unchecked")
+ public Edge createConstraint_ConstrainedElementEdge(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Connector edge = NotationFactory.eINSTANCE.createConnector();
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
@@ -1071,21 +972,14 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setType(UMLVisualIDRegistry.getType(ConstraintConstrainedElementEditPart.VISUAL_ID));
edge.setElement(null);
// initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- // org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- // if (routing != null) {
- // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- // }
-
return edge;
}
/**
* @generated
*/
- public Edge createConstraint_ContextEdge(View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
+ @SuppressWarnings("unchecked")
+ public Edge createConstraint_ContextEdge(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
Connector edge = NotationFactory.eINSTANCE.createConnector();
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
@@ -1099,15 +993,9 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(null);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- // org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE));
- // if (routing != null) {
- // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
- // }
Node constraint_KeywordLabel = createLabel(edge, UMLVisualIDRegistry.getType(ContextLinkAppliedStereotypeEditPart.VISUAL_ID));
constraint_KeywordLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Undefined");
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Undefined"); //$NON-NLS-1$
return edge;
}
@@ -1136,15 +1024,10 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
/**
* @generated
*/
- protected Node createCompartment(View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort,
- boolean canFilter) {
- // SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
- // rv.setShowTitle(showTitle);
- // rv.setCollapsed(isCollapsed);
+ @SuppressWarnings("unchecked")
+ protected Node createCompartment(View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) {
Node rv = NotationFactory.eINSTANCE.createBasicCompartment();
-
rv.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
-
if (hasTitle) {
TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle();
rv.getStyles().add(ts);
@@ -1183,61 +1066,4 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
}
return semanticAdapter.getAdapter(IElementType.class);
}
-
- /**
- * @generated
- */
- private void initFontStyleFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String fontConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.FONT);
- String fontColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_FONT);
-
- FontStyle viewFontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE);
- if (viewFontStyle != null) {
- FontData fontData = PreferenceConverter.getFontData(store, fontConstant);
- viewFontStyle.setFontName(fontData.getName());
- viewFontStyle.setFontHeight(fontData.getHeight());
- viewFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
- viewFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
-
- org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(store, fontColorConstant);
- viewFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
- }
-
- /**
- * @generated
- */
- private void initForegroundFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String lineColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_LINE);
- org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
- }
-
- /**
- * @generated
- */
- private void initBackgroundFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String fillColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_FILL);
- String gradientColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_GRADIENT);
- String gradientPolicyConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.GRADIENT_POLICY);
-
-
- org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(store, fillColorConstant);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
-
-
- FillStyle fillStyle = (FillStyle) view
- .getStyle(NotationPackage.Literals.FILL_STYLE);
- fillStyle
- .setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());
-
- ;
- if (store.getBoolean(gradientPolicyConstant)) {
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(
- store.getString(gradientColorConstant));
- fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
- fillStyle
- .setTransparency(gradientPreferenceConverter.getTransparency());
- }
- }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLVisualTypeProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLVisualTypeProvider.java
index 8008cec6948..748288f975b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLVisualTypeProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLVisualTypeProvider.java
@@ -1,15 +1,15 @@
/**
- * Copyright (c) 2015 Christian W. Damus and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Christian W. Damus - Initial API and implementation
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.providers;
@@ -38,13 +38,11 @@ public class UMLVisualTypeProvider extends AbstractVisualTypeProvider {
@Override
public IElementType getElementType(Diagram diagram, String viewType) {
IElementType result = null;
-
try {
result = UMLElementTypes.getElementType(viewType);
} catch (NumberFormatException e) {
// Not supported by this diagram
}
-
return result;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLPropertySection.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLPropertySection.java
index 71e4213bdfa..150ee24649f 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLPropertySection.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLPropertySection.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.statemachine.sheet;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLSheetLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLSheetLabelProvider.java
index 4b57b5ef6dc..7529d2c40aa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLSheetLabelProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src-gen/org/eclipse/papyrus/uml/diagram/statemachine/sheet/UMLSheetLabelProvider.java
@@ -35,7 +35,7 @@ public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelPr
public String getText(Object element) {
element = unwrap(element);
IElementType etype = getElementType(getView(element));
- return etype == null ? "" : etype.getDisplayName();
+ return etype == null ? "" : etype.getDisplayName(); //$NON-NLS-1$
}
/**
@@ -85,4 +85,5 @@ public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelPr
}
return null;
}
+
}

Back to the top