Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2015-03-25 10:31:17 +0000
committerCamille Letavernier2015-04-08 15:39:07 +0000
commit96bb76a770c40ebd04e3f715e67f3bea1edccb80 (patch)
tree1b33600cb80ad2360901bcdda6ecf4fdcfae4051
parent6f2605795dd5ede4be959fa4871dcb0745ec8f9f (diff)
downloadorg.eclipse.papyrus-96bb76a770c40ebd04e3f715e67f3bea1edccb80.tar.gz
org.eclipse.papyrus-96bb76a770c40ebd04e3f715e67f3bea1edccb80.tar.xz
org.eclipse.papyrus-96bb76a770c40ebd04e3f715e67f3bea1edccb80.zip
bug 462381 - [CSS] Floating label shall be selectable on CSS with the
attribute kind=FloatingLabel. https://bugs.eclipse.org/bugs/show_bug.cgi?id=462381 Patch Set 1: -Add all floating label edit parts to notationTypeMap -Modify GMFElementAdapter to take into account other type oof element than compartment to use 'kind' -Improve NotationTypeMap to permit to define a string list seperate by commat to define the mapping between type and humanReadableType: ex: 7509, 1237,4666 <-> floatingLabel. This permit to have only one mapping for several element which have the same humanReadableType Patch Set 2: -restore NotationTypeMap.java -add NotationTypeMapping -remove uml element from gmfgen index -adds xtend generation for NotationTypeMapping -Generate for diagram with Floating Label -Adds missing LabelVisibilityPreference for composite diagram Patch set 3: -Rename notationTypeMap for Floating Label -some fix on human read type -add notationTypeMap for package to Bock definition diagram. This is necessary else the compartment is not displayed Patch set 4-5-6: -rebase Change-Id: I181c95adb639a69621582cc7c454d05891b2d152 Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net> Reviewed-on: https://git.eclipse.org/r/44166 Tested-by: Hudson CI Reviewed-by: Gabriel Pascual <gabriel.pascual@all4tec.net> Reviewed-by: Camille Letavernier <camille.letavernier@cea.fr>
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend71
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java15
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml16
-rw-r--r--plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/plugin.xml20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml157
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml104
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramUpdater.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml35
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml933
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicitySourceEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicityTargetEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorNameEditPart.java336
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationNameEditPart.java344
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationStereotypeLabelEditPart.java344
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/GeneralizationAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowConveyedLabelEditPart.java327
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterAppliedStereotypeEditPart.java339
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterNameEditPart.java353
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortAppliedStereotypeEditPart.java339
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java353
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RepresentationTagLabelEditPart.java327
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingRoleNameEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationNameEditPart.java344
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationStereotypeLabelEditPart.java344
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageAppliedStereotypeEditPart.java320
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageNameEditPart.java325
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml48
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml93
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml35
51 files changed, 8417 insertions, 4964 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend
index ee2a39bf808..17ad3fd2a62 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend
@@ -12,6 +12,14 @@ import xpt.Common
import xpt.editor.extensions
import xpt.plugin.pluginUtils
import org.eclipse.emf.ecore.EObject
+import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel
+import org.eclipse.gmf.codegen.gmfgen.GenCompartment
+import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel
+import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView
+import org.eclipse.papyrus.papyrusgmfgenextension.LabelVisibilityPreference
+import org.eclipse.gmf.codegen.gmfgen.GenLink
+import org.eclipse.gmf.codegen.gmfgen.GenNode
+import org.eclipse.gmf.codegen.gmfgen.GenTopLevelNode
@Singleton class plugin extends xpt.plugin.plugin {
@@ -51,7 +59,8 @@ import org.eclipse.emf.ecore.EObject
«extensionsConstraintProviders(it.editorGen)»
«xptUpdaterExtension.extensions(it.editorGen.diagramUpdater)»
«xptActionExtension.Main(it.editorGen)»
- «additions(it)»
+ «additions(it)»
+ «notationTypesMap(editorGen)»
</plugin>
'''
@@ -174,6 +183,62 @@ import org.eclipse.emf.ecore.EObject
large_icon="«largeIconPath»"
path=""
small_icon="«smallIconPath»">
- </entry>
- '''
+ </entry>
+ '''
+
+ // set notation type mapping extension point
+ def notationTypesMap(GenEditorGenerator it) '''
+«tripleSpace(0)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+«tripleSpace(1)»«xmlGeneratedTag»
+«tripleSpace(1)»<diagramMappings diagramID="«modelID»">
+«tripleSpace(1)» <mapping type="«modelID»" humanReadableType="«modelID.replaceAll('Papyrus|UML|Diagram', '')»Diagram"/>
+ «FOR compartment : diagram.compartments»
+ «compartmentToTypeMap(compartment)»
+ «ENDFOR»
+ «FOR link : diagram.links»
+ «linksToTypeMap(link)»
+ «ENDFOR»
+ «FOR floatingLabel : diagram.eResource.allContents.filter(typeof (GenExternalNodeLabel)).toIterable»
+ «nodesToTypeMap(floatingLabel)»
+ «ENDFOR»
+«tripleSpace(1)»</diagramMappings>
+«tripleSpace(0)»</extension>
+ '''
+ def compartmentToTypeMap(GenCompartment it) '''
+ <mapping
+ humanReadableType="«title.replaceAll('Compartment', '')»"
+ type="«visualID»">
+ </mapping>
+ '''
+
+ def linksToTypeMap(GenLink it) '''
+ «FOR label : labels»
+ «linkLabelToTypeMap(label)»
+ «ENDFOR»
+ '''
+
+ def linkLabelToTypeMap(GenLinkLabel it)'''
+ ««« it is used on a LabelVisibilityPreference...
+ «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.linkLabels.contains(it) && v.role != null].size != 0»
+ <mapping
+ humanReadableType="«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.linkLabels.contains(it)].head.role»"
+ type="«visualID»">
+ </mapping>
+ «ENDIF»
+ '''
+
+ def nodesToTypeMap(GenExternalNodeLabel it)'''
+ ««« it is used on a ExtensionGenView...
+ «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v | v.genView.contains(it) && v.superOwnedEditPart != null].size != 0»
+ «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable»
+ «««...to be extended as floatingLabel
+ «IF "FloatingLabelEditPart".equals(extendedObject.name) »
+ <mapping
+ humanReadableType="Floating Label"
+ type="«visualID»">
+ </mapping>
+ «ENDIF»
+ «ENDFOR»
+ «ENDIF»
+ '''
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
index d04f674860a..d912d4f4723 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
@@ -9,6 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus - bug 461629
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - bug 462381
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.dom;
@@ -37,6 +38,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NamedStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
@@ -324,7 +326,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
@Override
public String getNamespaceURI() {
if (namespaceURI == null) {
- namespaceURI = EMFHelper.getQualifiedName(getSemanticElement().eClass().getEPackage(), ".");
+ namespaceURI = EMFHelper.getQualifiedName(getSemanticElement().eClass().getEPackage(), ".");//$NON-NLS-1$
}
return namespaceURI;
}
@@ -407,15 +409,16 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Returns null if the attribute is not known
*/
protected String doGetAttribute(String attr) {
- if (notationElement instanceof BasicCompartment) {
- // Compartments can be filtered by type (notation::View::type), or by title (From GmfGen model)
+
+ if (notationElement instanceof DecorationNode) {
+ // DecorationNode can be filtered by type (notation::View::type), or by title (From GmfGen model)
// We add the "kind" attribute which is specific to the CSS (More user-friendly)
if ("kind".equals(attr)) {
- BasicCompartment compartment = (BasicCompartment) notationElement;
- String humanType = NotationTypesMap.instance.getHumanReadableType(compartment);
+ DecorationNode node = (DecorationNode) notationElement;
+ String humanType = NotationTypesMap.instance.getHumanReadableType(node);
if (humanType == null) {
- return compartment.getType();
+ return node.getType();
}
return humanType; // 7017, 7018, 7019 for Attribute/Operation/Classifier compartments
// TODO: Create a mapping list between GMF ID (Type) and user-readable labels
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index b5dddc1ef67..0e15e5e0b51 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -281,22 +281,6 @@
humanReadableType="symbol"
type="compartment_shape_display">
</mapping>
- <mapping
- humanReadableType="packagedElements"
- type="7016">
- </mapping>
- <mapping
- humanReadableType="packagedElements"
- type="7030">
- </mapping>
- <mapping
- humanReadableType="packagedElements"
- type="7010">
- </mapping>
- <mapping
- humanReadableType="packagedElements"
- type="7009">
- </mapping>
</extension>
<extension
point="org.eclipse.papyrus.infra.services.decoration.decorationSpecificFunctions">
diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/plugin.xml b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/plugin.xml
index 6eb746f23bd..3d41b03cc32 100644
--- a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/plugin.xml
+++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/plugin.xml
@@ -20,4 +20,24 @@
original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration">
</contribution>
</extension>
+ <extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+
+ <mapping
+ humanReadableType="packagedElements"
+ type="7030">
+ </mapping>
+ <mapping
+ humanReadableType="packagedElements"
+ type="7010">
+ </mapping>
+
+ <mapping
+ humanReadableType="packagedElements"
+ type="7009">
+ </mapping>
+ <mapping
+ humanReadableType="packagedElements"
+ type="7016">
+ </mapping>
+</extension>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
index 4c2438ac550..04a3176a09e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml
@@ -2875,7 +2875,8 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]>
<!-- Diagram specific advices -->
<!-- UML ElementType bindings to Papyrus shared IClientContext -->
-<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <?gmfgen generated="true"?>
<diagramMappings diagramID="PapyrusUMLActivityDiagram">
<mapping type="PapyrusUMLActivityDiagram" humanReadableType="ActivityDiagram"/>
@@ -3016,13 +3017,155 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]>
humanReadableType="Stereotype"
type="6011">
</mapping>
-
-
-
-
-
-
+ <mapping
+ humanReadableType="Floating Label"
+ type="6032">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6027">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6031">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6039">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6038">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6037">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6036">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6020">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6029">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6028">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6035">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6033">
+ </mapping>
+
+ <mapping
+ humanReadableType="Floating Label"
+ type="6040">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6026">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6016">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6025">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6024">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6023">
+ </mapping>
+
+ <mapping
+ humanReadableType="Floating Label"
+ type="6019">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6022">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6021">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6018">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6017">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6030">
+ </mapping>
+
+ <mapping
+ humanReadableType="Floating Label"
+ type="5394">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5395">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5396">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5397">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5398">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5399">
+ </mapping>
+
+ <mapping
+ humanReadableType="Floating Label"
+ type="5400">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5402">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5401">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5403">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5404">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5405">
+ </mapping>
</diagramMappings>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
index d90cb5b0290..6944da2bebf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen
@@ -7466,7 +7466,7 @@
itemSemanticEditPolicyClassName="EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN"
canonicalEditPolicyClassName="EnumerationEnumerationLiteralCompartmentCanonicalEditPolicyCN"
childNodes="/0/@diagram/@childNodes.18"
- title="EnumerationLiteralCompartment"
+ title="literalsCompartment"
node="/0/@diagram/@childNodes.29">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
@@ -7964,7 +7964,7 @@
itemSemanticEditPolicyClassName="EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy"
canonicalEditPolicyClassName="EnumerationEnumerationLiteralCompartmentCanonicalEditPolicy"
childNodes="/0/@diagram/@childNodes.18"
- title="EnumerationLiteralCompartment"
+ title="literalsCompartment"
node="/0/@diagram/@topLevelNodes.8">
<diagramRunTimeClass
href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
index bba1ff79c42..244b273ef05 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
@@ -1302,6 +1302,7 @@
</extension>
<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <?gmfgen generated="true"?>
<diagramMappings diagramID="PapyrusUMLClassDiagram">
<mapping type="PapyrusUMLClassDiagram" humanReadableType="ClassDiagram"/>
@@ -1795,13 +1796,102 @@
humanReadableType="Stereotype"
type="6041">
</mapping>
-
-
-
-
-
-
-
+ <mapping
+ humanReadableType="Stereotype"
+ type="8501">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8509">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8513">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8514">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8515">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8516">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8517">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8518">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8519">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8520">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8522">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8504">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8521">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8505">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8503">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8506">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8507">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8508">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8512">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8510">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8511">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8502">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5155">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5153">
+ </mapping>
</diagramMappings>
</extension>
<extension point="org.eclipse.ui.handlers" id="menu-handlers">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramUpdater.java
index 99402d7348e..fb037c49470 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramUpdater.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramUpdater.java
@@ -156,7 +156,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
return getPackagePackagedelements_7010SemanticChildren(view);
case EnumerationEnumerationLiteralCompartmentEditPartCN.VISUAL_ID:
- return getEnumerationEnumerationLiteralCompartment_7031SemanticChildren(view);
+ return getEnumerationLiteralsCompartment_7031SemanticChildren(view);
case InstanceSpecificationSlotCompartmentEditPartCN.VISUAL_ID:
return getInstanceSpecificationSlots_7035SemanticChildren(view);
case ClassAttributeCompartmentEditPart.VISUAL_ID:
@@ -196,7 +196,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
return getPackagePackagedelements_7016SemanticChildren(view);
case EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID:
- return getEnumerationEnumerationLiteralCompartment_7015SemanticChildren(view);
+ return getEnumerationLiteralsCompartment_7015SemanticChildren(view);
case AssociationClassOperationCompartmentEditPart.VISUAL_ID:
return getAssociationClassOperations_7036SemanticChildren(view);
case AssociationClassNestedClassifierCompartmentEditPart.VISUAL_ID:
@@ -1192,7 +1192,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- public List<UMLNodeDescriptor> getEnumerationEnumerationLiteralCompartment_7031SemanticChildren(View view) {
+ public List<UMLNodeDescriptor> getEnumerationLiteralsCompartment_7031SemanticChildren(View view) {
if (false == view.eContainer() instanceof View) {
return Collections.emptyList();
}
@@ -1885,7 +1885,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
/**
* @generated
*/
- public List<UMLNodeDescriptor> getEnumerationEnumerationLiteralCompartment_7015SemanticChildren(View view) {
+ public List<UMLNodeDescriptor> getEnumerationLiteralsCompartment_7015SemanticChildren(View view) {
if (false == view.eContainer() instanceof View) {
return Collections.emptyList();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
index a3de7cb0137..70d1396756c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml
@@ -694,6 +694,7 @@
</decoratorProvider>
</extension>
<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <?gmfgen generated="true"?>
<diagramMappings diagramID="PapyrusUMLCommunicationDiagram">
<mapping type="PapyrusUMLCommunicationDiagram" humanReadableType="CommunicationDiagram"/>
@@ -701,6 +702,15 @@
humanReadableType="Interaction"
type="7001">
</mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6014">
+ </mapping>
+
+ <mapping
+ humanReadableType="Floating Label"
+ type="6013">
+ </mapping>
</diagramMappings>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml
index f8a2712af37..203982ed7c6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml
@@ -835,6 +835,7 @@
</editpartProvider>
</extension>
<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <?gmfgen generated="true"?>
<diagramMappings diagramID="PapyrusUMLComponentDiagram">
<mapping type="PapyrusUMLComponentDiagram" humanReadableType="ComponentDiagram"/>
@@ -980,8 +981,38 @@
humanReadableType="Name"
type="6025">
</mapping>
-
-
+ <mapping
+ humanReadableType="Floating Label"
+ type="6033">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6026">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6027">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6028">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6029">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6030">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6031">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6032">
+ </mapping>
</diagramMappings>
</extension>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
index 5834e7a7621..ea215cbdc50 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.gmfgen
@@ -8260,5 +8260,42 @@
comment="extend view for affixed node" genView="/0/@diagram/@childNodes.1 /0/@diagram/@childNodes.2"
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.4/@labels.1 /0/@diagram/@links.5/@labels.1 /0/@diagram/@links.6/@labels.1 /0/@diagram/@links.7/@labels.1 /0/@diagram/@links.8/@labels.1 /0/@diagram/@links.9/@labels.1 /0/@diagram/@links.10/@labels.1 /0/@diagram/@links.11/@labels.1 /0/@diagram/@links.12/@labels.1 /0/@diagram/@links.13/@labels.1 /0/@diagram/@links.14/@labels.0 /0/@diagram/@links.15/@labels.0 /0/@diagram/@links.19/@labels.1"
+ externalNodeLabels="/0/@diagram/@topLevelNodes.28/@labels.1 /0/@diagram/@topLevelNodes.27/@labels.1 /0/@diagram/@childNodes.1/@labels.1 /0/@diagram/@childNodes.2/@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.4/@labels.0 /0/@diagram/@links.5/@labels.0 /0/@diagram/@links.6/@labels.0 /0/@diagram/@links.7/@labels.0 /0/@diagram/@links.8/@labels.0 /0/@diagram/@links.9/@labels.0 /0/@diagram/@links.10/@labels.0 /0/@diagram/@links.11/@labels.0 /0/@diagram/@links.12/@labels.0 /0/@diagram/@links.13/@labels.0 /0/@diagram/@links.14/@labels.1"
+ externalNodeLabels="/0/@diagram/@childNodes.1/@labels.0 /0/@diagram/@childNodes.2/@labels.0 /0/@diagram/@topLevelNodes.27/@labels.0 /0/@diagram/@topLevelNodes.28/@labels.0"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
+ comment="Tag"
+ role="Tag"
+ linkLabels="/0/@diagram/@links.18/@labels.0"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
+ comment="ConveyedElements"
+ role="ConveyedElements"
+ iconPathRole=""
+ linkLabels="/0/@diagram/@links.19/@labels.0"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
+ comment="TargetMultiplicity"
+ role="TargetMultiplicity"
+ iconPathRole="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/MultiplicityHandler.gif"
+ linkLabels="/0/@diagram/@links.14/@labels.3"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
+ comment="SourceMultiplicity"
+ role="SourceMultiplicity"
+ iconPathRole="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/MultiplicityHandler.gif"
+ linkLabels="/0/@diagram/@links.14/@labels.2"/>
</papyrusgmfgenextension:PapyrusExtensionRootNode>
</xmi:XMI>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
index 6dc9b452a27..f1ea9c5a1ce 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml
@@ -404,7 +404,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Class.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Class.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Property"
@@ -414,7 +414,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Port"
@@ -424,7 +424,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Port.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Port.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Collaboration"
@@ -434,7 +434,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Collaboration.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Collaboration.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new CollaborationRole"
@@ -444,7 +444,7 @@
large_icon="icons/obj16/CollaborationRole.gif"
path=""
small_icon="icons/obj16/CollaborationRole.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new CollaborationUse"
@@ -454,7 +454,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/CollaborationUse.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/CollaborationUse.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Comment"
@@ -464,7 +464,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Constraint"
@@ -474,7 +474,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new TimeObservation"
@@ -484,7 +484,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeObservation.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/TimeObservation.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new DurationObservation"
@@ -494,7 +494,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationObservation.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DurationObservation.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new InformationItem"
@@ -504,7 +504,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InformationItem.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InformationItem.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Parameter"
@@ -514,7 +514,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Parameter.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Parameter.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Activity"
@@ -524,7 +524,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Activity.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Activity.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Interaction"
@@ -534,7 +534,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new ProtocolStateMachine"
@@ -544,7 +544,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ProtocolStateMachine.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ProtocolStateMachine.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new StateMachine"
@@ -554,7 +554,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/StateMachine.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/StateMachine.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new FunctionBehavior"
@@ -564,7 +564,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/FunctionBehavior.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/FunctionBehavior.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new OpaqueBehavior"
@@ -574,7 +574,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/OpaqueBehavior.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/OpaqueBehavior.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new StringExpression"
@@ -584,7 +584,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/StringExpression.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/StringExpression.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Link (Comment / Constraint)"
@@ -594,7 +594,7 @@
large_icon="icons/obj16/Link.gif"
path=""
small_icon="icons/obj16/Link.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Connector"
@@ -604,7 +604,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new RoleBinding"
@@ -614,7 +614,7 @@
large_icon="icons/obj16/CollaborationRoleBinding.gif"
path=""
small_icon="icons/obj16/CollaborationRoleBinding.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Generalization"
@@ -624,7 +624,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Realization"
@@ -634,7 +634,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Realization.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Realization.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Substitution"
@@ -644,7 +644,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Substitution.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Substitution.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Abstraction"
@@ -654,7 +654,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Usage"
@@ -664,7 +664,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Usage.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Usage.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Dependency"
@@ -674,7 +674,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new representation for an InformationItem"
@@ -684,7 +684,7 @@
large_icon="icons/obj16/Representation.gif"
path=""
small_icon="icons/obj16/Representation.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new InformationFlow"
@@ -694,7 +694,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InformationFlow.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InformationFlow.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Manifestation"
@@ -704,7 +704,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Manifestation.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Manifestation.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Deployment"
@@ -714,7 +714,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Deployment.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Deployment.gif">
- </entry>
+ </entry>
</contribution>
</paletteProvider>
@@ -893,348 +893,6 @@
</extension>
-<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
- <diagramMappings diagramID="CompositeStructure">
- <mapping type="CompositeStructure" humanReadableType="CompositeStructureDiagram"/>
-
- <mapping
- humanReadableType="attributes"
- type="7033">
- </mapping>
-
- <mapping
- humanReadableType="operations"
- type="7034">
- </mapping>
-
- <mapping
- humanReadableType="attributes"
- type="7036">
- </mapping>
-
- <mapping
- humanReadableType="operations"
- type="7037">
- </mapping>
-
- <mapping
- humanReadableType="literals"
- type="7048">
- </mapping>
-
- <mapping
- humanReadableType="literals"
- type="7049">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7050">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7051">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7052">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7053">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7054">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7055">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7056">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7057">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7058">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7059">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7060">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7061">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7063">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7064">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7065">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7066">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7067">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7068">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7069">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7070">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7071">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7072">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7073">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7075">
- </mapping>
-
- <mapping
- humanReadableType="internal structure"
- type="7077">
- </mapping>
-
-
-
-
-
-
-
-
-
-
-
- <mapping
- humanReadableType="Name"
- type="6001">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6015">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6002">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6016">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6003">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6017">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6004">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6018">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6005">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6019">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6006">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6020">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6007">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6021">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6008">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6022">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6027">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6028">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Name"
- type="6009">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6023">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Stereotype"
- type="6025">
- </mapping>
-
- <mapping
- humanReadableType="Name"
- type="6050">
- </mapping>
-
- <mapping
- humanReadableType="SourceMultiplicity"
- type="6051">
- </mapping>
-
- <mapping
- humanReadableType="TargetMultiplicity"
- type="6052">
- </mapping>
-
-
-
- <mapping
- humanReadableType="Stereotype"
- type="6024">
- </mapping>
-
-
-
-
-
-
-
- <mapping
- humanReadableType="Tag"
- type="6030">
- </mapping>
-
-
-
- <mapping
- humanReadableType="ConveyedElements"
- type="6031">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="6032">
- </mapping>
-
-
- </diagramMappings>
- </extension>
<extension
point="org.eclipse.papyrus.infra.gmfdiag.canonical.strategies">
<semanticChildrenStrategy
@@ -1388,6 +1046,533 @@
<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
</binding>
</extension>
+<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <?gmfgen generated="true"?>
+ <diagramMappings diagramID="CompositeStructure">
+ <mapping type="CompositeStructure" humanReadableType="CompositeStructureDiagram"/>
+ <mapping
+ humanReadableType="attributes"
+ type="7033">
+ </mapping>
+ <mapping
+ humanReadableType="operations"
+ type="7034">
+ </mapping>
+ <mapping
+ humanReadableType="attributes"
+ type="7036">
+ </mapping>
+ <mapping
+ humanReadableType="operations"
+ type="7037">
+ </mapping>
+ <mapping
+ humanReadableType="literals"
+ type="7048">
+ </mapping>
+ <mapping
+ humanReadableType="literals"
+ type="7049">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7050">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7051">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7052">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7053">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7054">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7055">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7056">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7057">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7058">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7059">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7060">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7061">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7063">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7064">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7065">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7066">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7067">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7068">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7069">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7070">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7071">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7072">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7073">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7075">
+ </mapping>
+ <mapping
+ humanReadableType="internal structure"
+ type="7077">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6001">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6015">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6002">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6016">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6003">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6017">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6004">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6018">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6005">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6019">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6006">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6020">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6007">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6021">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6008">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6022">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6027">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6028">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6009">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6023">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6025">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="6050">
+ </mapping>
+ <mapping
+ humanReadableType="SourceMultiplicity"
+ type="6051">
+ </mapping>
+ <mapping
+ humanReadableType="TargetMultiplicity"
+ type="6052">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6024">
+ </mapping>
+ <mapping
+ humanReadableType="Tag"
+ type="6030">
+ </mapping>
+ <mapping
+ humanReadableType="ConveyedElements"
+ type="6031">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="6032">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6053">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5125">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6033">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6054">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6055">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6056">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6057">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6058">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6059">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6060">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6061">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6062">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6063">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6064">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6065">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6066">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6067">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6068">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6069">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6070">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6071">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6072">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6073">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6074">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6075">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6076">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6077">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6078">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6079">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6080">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6081">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6082">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6083">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6084">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6085">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6086">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6087">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6088">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6089">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6090">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6091">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6092">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6093">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6094">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6095">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6096">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6097">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6098">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6099">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6100">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6101">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6102">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6103">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6104">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6105">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5151">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5142">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6106">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6107">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6108">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6109">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6110">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6111">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6112">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6113">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6114">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6115">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6116">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6117">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6118">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6119">
+ </mapping>
+ </diagramMappings>
+</extension>
+
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionAppliedStereotypeEditPart.java
index 368289877e4..7e1bd3ec437 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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;
@@ -148,6 +151,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Abstraction_4007, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.AbstractionAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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
*/
@@ -630,12 +678,12 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionNameEditPart.java
index 0fa09699379..76c2cf3d882 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/AbstractionNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* 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;
@@ -148,6 +151,7 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Abstraction_4007, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.AbstractionNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class AbstractionNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java
index 4e5c68951d6..af40f2e7181 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* 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;
@@ -148,6 +151,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.ComponentRealization_4004, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ComponentRealizationAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* 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
*/
@@ -630,12 +678,12 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationNameEditPart.java
index 576c63cda1d..0f22e906c8c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ComponentRealizationNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* 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;
@@ -148,6 +151,7 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.ComponentRealization_4004, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ComponentRealizationNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class ComponentRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorAppliedStereotypeEditPart.java
index 0ff6fc8d143..f63f1efb29d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* 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;
@@ -148,6 +151,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Connector_4013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* 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
*/
@@ -630,12 +678,12 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicitySourceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicitySourceEditPart.java
index c234f5b79e5..88d888d61fd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicitySourceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicitySourceEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* 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;
@@ -148,6 +151,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.SOURCE;
}
@@ -156,12 +160,12 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Connector_4013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorMultiplicitySourceEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* 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
*/
@@ -630,12 +678,12 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class ConnectorMultiplicitySourceEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "SourceMultiplicity";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getIconPathRole() {
+ return "platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/MultiplicityHandler.gif";//$NON-NLS-1$
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicityTargetEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicityTargetEditPart.java
index 2f8e990a1e5..53b9b8738de 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicityTargetEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorMultiplicityTargetEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* 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;
@@ -148,6 +151,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.TARGET;
}
@@ -156,12 +160,12 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Connector_4013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorMultiplicityTargetEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* 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
*/
@@ -630,12 +678,12 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class ConnectorMultiplicityTargetEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "TargetMultiplicity";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getIconPathRole() {
+ return "platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/MultiplicityHandler.gif";//$NON-NLS-1$
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorNameEditPart.java
index 68bf9fc3760..283a64f5174 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ConnectorNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -66,9 +66,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -86,7 +86,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ConnectorNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class ConnectorNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -115,12 +115,14 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* 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;
@@ -152,6 +154,7 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -160,12 +163,12 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -173,12 +176,12 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -186,12 +189,12 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -199,19 +202,20 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -222,6 +226,7 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -229,6 +234,7 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -236,6 +242,7 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -252,12 +259,12 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
*/
protected Image getLabelIcon() {
EObject parserElement = getParserElement();
- if(parserElement == null) {
+ if (parserElement == null) {
return null;
}
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(AppearanceHelper.showElementIcon(view)) {
+ List<View> views = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for (View view : views) {
+ if (AppearanceHelper.showElementIcon(view)) {
return UMLElementTypes.getImage(parserElement.eClass());
}
}
@@ -270,10 +277,12 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -282,26 +291,30 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -314,27 +327,31 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -344,8 +361,9 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -354,6 +372,7 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -361,8 +380,9 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Connector_4013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConnectorNameEditPart.VISUAL_ID));
}
return parser;
@@ -372,8 +392,10 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -402,8 +424,8 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -411,8 +433,8 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -421,47 +443,55 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -483,14 +513,15 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -504,6 +535,7 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -518,20 +550,20 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -539,15 +571,18 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @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);
+ 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);
}
}
}
@@ -556,19 +591,27 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -576,6 +619,7 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -583,12 +627,13 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -598,9 +643,10 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -611,8 +657,9 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -633,30 +680,31 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -664,7 +712,7 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -674,12 +722,13 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -689,20 +738,25 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -712,12 +766,13 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -733,33 +788,39 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
- if(event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation)event.getNewValue()).getSource())) {
+
+ if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
refreshLabel();
}
super.handleNotificationEvent(event);
@@ -768,8 +829,25 @@ public class ConnectorNameEditPart extends PapyrusLabelEditPart implements IText
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyAppliedStereotypeEditPart.java
index c157ceadc12..710c44cd7f3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* 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;
@@ -148,6 +151,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.DependencyAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* 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
*/
@@ -630,12 +678,12 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyNameEditPart.java
index 0c78ba32efa..0cedfc4921c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DependencyNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* 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;
@@ -148,6 +151,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.DependencyNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentAppliedStereotypeEditPart.java
index 187f81ad26c..a0ad111966b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* 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;
@@ -148,6 +151,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Deployment_4009, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.DeploymentAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* 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
*/
@@ -630,12 +678,12 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart im
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentNameEditPart.java
index 4a560e257be..35d4583005e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeploymentNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* 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;
@@ -148,6 +151,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Deployment_4009, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.DeploymentNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationNameEditPart.java
index 4bdf4b1e1e9..886ceb700a4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -65,6 +65,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
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.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -84,7 +85,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class DurationObservationNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class DurationObservationNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -113,12 +114,14 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* 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;
@@ -139,6 +142,7 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
@@ -149,11 +153,12 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
+ return (IBorderItemLocator) constraint;
}
return null;
}
@@ -161,11 +166,12 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @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();
+ 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));
}
@@ -173,12 +179,12 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -186,12 +192,12 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -199,12 +205,12 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -212,19 +218,20 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -235,6 +242,7 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -242,6 +250,7 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -273,10 +282,12 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -285,26 +296,30 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,27 +332,31 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -347,8 +366,9 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -357,6 +377,7 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -364,8 +385,9 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.DurationObservation_2093, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.DurationObservationNameEditPart.VISUAL_ID));
}
return parser;
@@ -375,8 +397,10 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -405,8 +429,8 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -414,8 +438,8 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -424,47 +448,55 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -486,14 +518,15 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -507,6 +540,7 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -521,26 +555,27 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
- View view = (View)getModel();
- if(view.isVisible()) {
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -548,15 +583,18 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @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);
+ 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);
}
}
}
@@ -565,19 +603,27 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -585,6 +631,7 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -592,12 +639,13 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -607,9 +655,10 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -620,8 +669,9 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -642,30 +692,31 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -673,7 +724,7 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -683,12 +734,13 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -698,20 +750,25 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -721,12 +778,13 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -742,26 +800,31 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
@@ -774,6 +837,7 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
defaultText = getLabelTextHelper(label);
@@ -786,4 +850,20 @@ public class DurationObservationNameEditPart extends FloatingLabelEditPart imple
protected IFigure createFigurePrim() {
return new PapyrusWrappingLabel();
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationStereotypeLabelEditPart.java
index ee48473de1f..59bb50fc62d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationStereotypeLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DurationObservationStereotypeLabelEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
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.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;
@@ -86,7 +87,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -115,12 +116,14 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* 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;
@@ -141,6 +144,7 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
@@ -152,11 +156,12 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
+ return (IBorderItemLocator) constraint;
}
return null;
}
@@ -164,11 +169,12 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @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();
+ 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));
}
@@ -176,12 +182,12 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -189,12 +195,12 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -202,12 +208,12 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -215,19 +221,20 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -238,6 +245,7 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -245,6 +253,7 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -276,10 +285,12 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -288,26 +299,30 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -320,27 +335,31 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -350,8 +369,9 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -360,6 +380,7 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -367,8 +388,9 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.DurationObservation_2093, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.DurationObservationStereotypeLabelEditPart.VISUAL_ID));
}
return parser;
@@ -378,8 +400,10 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -408,8 +432,8 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -417,8 +441,8 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -427,47 +451,55 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -489,14 +521,15 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -510,6 +543,7 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -524,26 +558,27 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
- View view = (View)getModel();
- if(view.isVisible()) {
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -551,15 +586,18 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @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);
+ 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);
}
}
}
@@ -568,19 +606,27 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -588,6 +634,7 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -595,12 +642,13 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -610,9 +658,10 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -623,8 +672,9 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -645,30 +695,31 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -676,7 +727,7 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -686,12 +737,13 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -701,20 +753,25 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -724,12 +781,13 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -745,26 +803,31 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
@@ -777,6 +840,7 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
defaultText = getLabelTextHelper(label);
@@ -789,4 +853,20 @@ public class DurationObservationStereotypeLabelEditPart extends AbstractLabelEdi
protected IFigure createFigurePrim() {
return new AppliedStereotypeWrappingLabelFigure();
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/GeneralizationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/GeneralizationAppliedStereotypeEditPart.java
index 7ba4d167a4b..868c2339ace 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/GeneralizationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/GeneralizationAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* 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;
@@ -148,6 +151,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Generalization_4015, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.GeneralizationAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* 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
*/
@@ -630,12 +678,12 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPar
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowAppliedStereotypeEditPart.java
index 62f74de8534..419f8615ff6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* 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;
@@ -148,6 +151,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.InformationFlow_4021, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.InformationFlowAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* 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
*/
@@ -630,12 +678,12 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class InformationFlowAppliedStereotypeEditPart extends PapyrusLabelEditPa
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowConveyedLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowConveyedLabelEditPart.java
index 9df63bab22e..21bc79cd455 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowConveyedLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InformationFlowConveyedLabelEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.AbstractCustomLabelEditPolicy;
@@ -84,7 +85,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -113,12 +114,14 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* 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;
@@ -151,6 +154,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -159,12 +163,12 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -172,12 +176,12 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -185,12 +189,12 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -198,19 +202,20 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -221,6 +226,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -228,6 +234,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -235,6 +242,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -244,7 +252,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
*/
protected EObject getParserElement() {
EObject element = resolveSemanticElement();
- return element != null ? element : (View)getModel();
+ return element != null ? element : (View) getModel();
}
/**
@@ -260,10 +268,12 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -272,26 +282,30 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -304,27 +318,31 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -334,8 +352,9 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -344,6 +363,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -351,8 +371,9 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.InformationFlow_4021, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.InformationFlowConveyedLabelEditPart.VISUAL_ID));
}
return parser;
@@ -362,8 +383,10 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -392,8 +415,8 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -401,8 +424,8 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -411,47 +434,55 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -473,14 +504,15 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -494,6 +526,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -508,20 +541,20 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -529,15 +562,18 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @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);
+ 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);
}
}
}
@@ -546,19 +582,27 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -566,6 +610,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -573,12 +618,13 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -588,9 +634,10 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -601,8 +648,9 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -623,30 +671,31 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -654,7 +703,7 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -664,12 +713,13 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -679,20 +729,25 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -702,12 +757,13 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -723,40 +779,63 @@ public class InformationFlowConveyedLabelEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "ConveyedElements";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationAppliedStereotypeEditPart.java
index 20d055006da..72af7fbf703 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* 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;
@@ -148,6 +151,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.InterfaceRealization_4005, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.InterfaceRealizationAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* 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
*/
@@ -630,12 +678,12 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class InterfaceRealizationAppliedStereotypeEditPart extends PapyrusLabelE
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationNameEditPart.java
index dd01ca5ffa4..5c63c9c6a40 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceRealizationNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* 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;
@@ -148,6 +151,7 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.InterfaceRealization_4005, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.InterfaceRealizationNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class InterfaceRealizationNameEditPart extends PapyrusLabelEditPart imple
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationAppliedStereotypeEditPart.java
index a550cd262e3..41da999169f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* 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;
@@ -148,6 +151,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Manifestation_4012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ManifestationAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* 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
*/
@@ -630,12 +678,12 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationNameEditPart.java
index f1a3c1f81d3..2690a97fea6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ManifestationNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ManifestationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class ManifestationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* 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;
@@ -148,6 +151,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Manifestation_4012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ManifestationNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class ManifestationNameEditPart extends PapyrusLabelEditPart implements I
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterAppliedStereotypeEditPart.java
index b25be49ec8c..77b43324af9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimar
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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;
@@ -86,7 +87,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -115,12 +116,14 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* 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;
@@ -141,6 +144,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
@@ -152,11 +156,12 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
+ return (IBorderItemLocator) constraint;
}
return null;
}
@@ -164,11 +169,12 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @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();
+ 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));
}
@@ -176,12 +182,12 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -189,12 +195,12 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -202,12 +208,12 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -215,19 +221,20 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -238,6 +245,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -245,6 +253,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -276,10 +285,12 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -288,26 +299,30 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -320,27 +335,31 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -350,8 +369,9 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -360,6 +380,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -367,8 +388,9 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Parameter_3088, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -378,8 +400,10 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -408,8 +432,8 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -417,8 +441,8 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -427,47 +451,55 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -489,14 +521,15 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -510,6 +543,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -524,26 +558,27 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
- View view = (View)getModel();
- if(view.isVisible()) {
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -551,15 +586,18 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @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);
+ 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);
}
}
}
@@ -568,19 +606,27 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -588,6 +634,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -595,12 +642,13 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -610,9 +658,10 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -623,8 +672,9 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -645,7 +695,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* 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
*/
@@ -656,12 +706,12 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -669,7 +719,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -679,12 +729,13 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -694,20 +745,25 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -717,12 +773,13 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -738,26 +795,31 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
@@ -770,6 +832,7 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
defaultText = getLabelTextHelper(label);
@@ -782,4 +845,20 @@ public class ParameterAppliedStereotypeEditPart extends PapyrusLabelEditPart imp
protected IFigure createFigurePrim() {
return new AppliedStereotypeWrappingLabelFigure();
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterNameEditPart.java
index 79caf14478b..bab47ad115b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/ParameterNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -65,9 +65,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
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.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.ParameterLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
@@ -86,7 +86,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class ParameterNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class ParameterNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -115,12 +115,14 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* 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;
@@ -141,6 +143,7 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
@@ -152,11 +155,12 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
+ return (IBorderItemLocator) constraint;
}
return null;
}
@@ -164,11 +168,12 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @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();
+ 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));
}
@@ -176,12 +181,12 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -189,12 +194,12 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -202,12 +207,12 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -215,19 +220,20 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -238,6 +244,7 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -245,6 +252,7 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -268,12 +276,12 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
*/
protected Image getLabelIcon() {
EObject parserElement = getParserElement();
- if(parserElement == null) {
+ if (parserElement == null) {
return null;
}
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(AppearanceHelper.showElementIcon(view)) {
+ List<View> views = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for (View view : views) {
+ if (AppearanceHelper.showElementIcon(view)) {
return UMLElementTypes.getImage(parserElement.eClass());
}
}
@@ -286,10 +294,12 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -298,26 +308,30 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -330,27 +344,31 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -360,8 +378,9 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -370,6 +389,7 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -377,8 +397,9 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Parameter_3088, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterNameEditPart.VISUAL_ID));
}
return parser;
@@ -388,8 +409,10 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -418,8 +441,8 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -427,8 +450,8 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -437,47 +460,55 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -499,14 +530,15 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -520,6 +552,7 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -534,26 +567,27 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
- View view = (View)getModel();
- if(view.isVisible()) {
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -561,15 +595,18 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @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);
+ 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);
}
}
}
@@ -578,19 +615,27 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -598,6 +643,7 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -605,12 +651,13 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -620,9 +667,10 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -633,8 +681,9 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -655,30 +704,31 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -686,7 +736,7 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -696,12 +746,13 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -711,20 +762,25 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -734,12 +790,13 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -755,26 +812,31 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
@@ -787,6 +849,7 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
defaultText = getLabelTextHelper(label);
@@ -799,4 +862,20 @@ public class ParameterNameEditPart extends FloatingLabelEditPart implements ITex
protected IFigure createFigurePrim() {
return new WrappingLabel();
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortAppliedStereotypeEditPart.java
index 19233441687..176c9b4c242 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
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.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;
@@ -86,7 +87,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -115,12 +116,14 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* 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;
@@ -141,6 +144,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
@@ -152,11 +156,12 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
+ return (IBorderItemLocator) constraint;
}
return null;
}
@@ -164,11 +169,12 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @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();
+ 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));
}
@@ -176,12 +182,12 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -189,12 +195,12 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -202,12 +208,12 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -215,19 +221,20 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -238,6 +245,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -245,6 +253,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -276,10 +285,12 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -288,26 +299,30 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -320,27 +335,31 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -350,8 +369,9 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -360,6 +380,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -367,8 +388,9 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Port_3069, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -378,8 +400,10 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -408,8 +432,8 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -417,8 +441,8 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -427,47 +451,55 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -489,14 +521,15 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -510,6 +543,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -524,26 +558,27 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
- View view = (View)getModel();
- if(view.isVisible()) {
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -551,15 +586,18 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @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);
+ 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);
}
}
}
@@ -568,19 +606,27 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -588,6 +634,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -595,12 +642,13 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -610,9 +658,10 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -623,8 +672,9 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -645,7 +695,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* 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
*/
@@ -656,12 +706,12 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -669,7 +719,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -679,12 +729,13 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -694,20 +745,25 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -717,12 +773,13 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -738,26 +795,31 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
@@ -770,6 +832,7 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
defaultText = getLabelTextHelper(label);
@@ -782,4 +845,20 @@ public class PortAppliedStereotypeEditPart extends AbstractLabelEditPart impleme
protected IFigure createFigurePrim() {
return new AppliedStereotypeWrappingLabelFigure();
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
index f2795dbf5ec..96bc90918f5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -67,10 +67,10 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.LabelAlignmentEditP
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
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.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IndirectPortLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -88,7 +88,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -117,12 +117,14 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* 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;
@@ -143,6 +145,7 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
@@ -155,11 +158,12 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
+ return (IBorderItemLocator) constraint;
}
return null;
}
@@ -167,11 +171,12 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @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();
+ 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));
}
@@ -179,12 +184,12 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -192,12 +197,12 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -205,12 +210,12 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -218,19 +223,20 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -241,6 +247,7 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -248,6 +255,7 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -271,12 +279,12 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
*/
protected Image getLabelIcon() {
EObject parserElement = getParserElement();
- if(parserElement == null) {
+ if (parserElement == null) {
return null;
}
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(AppearanceHelper.showElementIcon(view)) {
+ List<View> views = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for (View view : views) {
+ if (AppearanceHelper.showElementIcon(view)) {
return UMLElementTypes.getImage(parserElement.eClass());
}
}
@@ -289,10 +297,12 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -301,26 +311,30 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -333,27 +347,31 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -363,8 +381,9 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -373,6 +392,7 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -380,8 +400,9 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Port_3069, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortNameEditPart.VISUAL_ID));
}
return parser;
@@ -391,8 +412,10 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -421,8 +444,8 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -430,8 +453,8 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -440,47 +463,55 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -502,14 +533,15 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -523,6 +555,7 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -537,26 +570,27 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
- View view = (View)getModel();
- if(view.isVisible()) {
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -564,15 +598,18 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @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);
+ 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);
}
}
}
@@ -581,19 +618,27 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -601,6 +646,7 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -608,12 +654,13 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -623,9 +670,10 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -636,8 +684,9 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -658,30 +707,31 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -689,7 +739,7 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -699,12 +749,13 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -714,20 +765,25 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -737,12 +793,13 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -758,26 +815,31 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
@@ -790,6 +852,7 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
defaultText = getLabelTextHelper(label);
@@ -802,4 +865,20 @@ public class PortNameEditPart extends FloatingLabelEditPart implements ITextAwar
protected IFigure createFigurePrim() {
return new PapyrusWrappingLabel();
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationAppliedStereotypeEditPart.java
index 4d03e34b9f1..93be5b043a8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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;
@@ -148,6 +151,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Realization_4006, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.RealizationAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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
*/
@@ -630,12 +678,12 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class RealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationNameEditPart.java
index 9f544526a18..d18d79a2ad3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RealizationNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* 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;
@@ -148,6 +151,7 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Realization_4006, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.RealizationNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class RealizationNameEditPart extends PapyrusLabelEditPart implements ITe
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RepresentationTagLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RepresentationTagLabelEditPart.java
index 119b153fa91..abea56d31b5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RepresentationTagLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RepresentationTagLabelEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* 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;
@@ -148,6 +151,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -241,7 +249,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
*/
protected EObject getParserElement() {
EObject element = resolveSemanticElement();
- return element != null ? element : (View)getModel();
+ return element != null ? element : (View) getModel();
}
/**
@@ -257,10 +265,12 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -269,26 +279,30 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -301,27 +315,31 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -331,8 +349,9 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -341,6 +360,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -348,8 +368,9 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.InformationItemRepresented_4020, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.RepresentationTagLabelEditPart.VISUAL_ID));
}
return parser;
@@ -359,8 +380,10 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -389,8 +412,8 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -398,8 +421,8 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -408,47 +431,55 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -470,14 +501,15 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -491,6 +523,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -505,20 +538,20 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -526,15 +559,18 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @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);
+ 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);
}
}
}
@@ -543,19 +579,27 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -563,6 +607,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -570,12 +615,13 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -585,9 +631,10 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -598,8 +645,9 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -620,30 +668,31 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -651,7 +700,7 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -661,12 +710,13 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -676,20 +726,25 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -699,12 +754,13 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -720,40 +776,63 @@ public class RepresentationTagLabelEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Tag";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingAppliedStereotypeEditPart.java
index 84fbed62809..581aba5822c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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;
@@ -148,6 +151,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4017, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.RoleBindingAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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
*/
@@ -630,12 +678,12 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class RoleBindingAppliedStereotypeEditPart extends PapyrusLabelEditPart i
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingRoleNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingRoleNameEditPart.java
index 67ddff682ef..4a18f006830 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingRoleNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/RoleBindingRoleNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* 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;
@@ -148,6 +151,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.SOURCE;
}
@@ -156,12 +160,12 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4017, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.RoleBindingRoleNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* 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
*/
@@ -630,12 +678,12 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class RoleBindingRoleNameEditPart extends PapyrusLabelEditPart implements
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionAppliedStereotypeEditPart.java
index 6c4ac751f72..d7f8c8aefd3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* 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;
@@ -148,6 +151,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Substitution_4011, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.SubstitutionAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* 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
*/
@@ -630,12 +678,12 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionNameEditPart.java
index 30cf0d52233..078b0b48a83 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/SubstitutionNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* 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;
@@ -148,6 +151,7 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Substitution_4011, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.SubstitutionNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class SubstitutionNameEditPart extends PapyrusLabelEditPart implements IT
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationNameEditPart.java
index 6f7154eb7d0..8bff4f68b97 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -65,6 +65,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
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.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -84,7 +85,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class TimeObservationNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class TimeObservationNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -113,12 +114,14 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* 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;
@@ -139,6 +142,7 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
@@ -149,11 +153,12 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
+ return (IBorderItemLocator) constraint;
}
return null;
}
@@ -161,11 +166,12 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @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();
+ 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));
}
@@ -173,12 +179,12 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -186,12 +192,12 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -199,12 +205,12 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -212,19 +218,20 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -235,6 +242,7 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -242,6 +250,7 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -273,10 +282,12 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -285,26 +296,30 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,27 +332,31 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -347,8 +366,9 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -357,6 +377,7 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -364,8 +385,9 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.TimeObservation_2094, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationNameEditPart.VISUAL_ID));
}
return parser;
@@ -375,8 +397,10 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -405,8 +429,8 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -414,8 +438,8 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -424,47 +448,55 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -486,14 +518,15 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -507,6 +540,7 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -521,26 +555,27 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
- View view = (View)getModel();
- if(view.isVisible()) {
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -548,15 +583,18 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @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);
+ 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);
}
}
}
@@ -565,19 +603,27 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -585,6 +631,7 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -592,12 +639,13 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -607,9 +655,10 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -620,8 +669,9 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -642,30 +692,31 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -673,7 +724,7 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -683,12 +734,13 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -698,20 +750,25 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -721,12 +778,13 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -742,26 +800,31 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
@@ -774,6 +837,7 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
defaultText = getLabelTextHelper(label);
@@ -786,4 +850,20 @@ public class TimeObservationNameEditPart extends FloatingLabelEditPart implement
protected IFigure createFigurePrim() {
return new PapyrusWrappingLabel();
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationStereotypeLabelEditPart.java
index c7230057fb0..8179e314669 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationStereotypeLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/TimeObservationStereotypeLabelEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -64,6 +64,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
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.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;
@@ -86,7 +87,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -115,12 +116,14 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* 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;
@@ -141,6 +144,7 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
@@ -152,11 +156,12 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
+ return (IBorderItemLocator) constraint;
}
return null;
}
@@ -164,11 +169,12 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @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();
+ 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));
}
@@ -176,12 +182,12 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -189,12 +195,12 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -202,12 +208,12 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -215,19 +221,20 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -238,6 +245,7 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -245,6 +253,7 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -276,10 +285,12 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -288,26 +299,30 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -320,27 +335,31 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -350,8 +369,9 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -360,6 +380,7 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -367,8 +388,9 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.TimeObservation_2094, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationStereotypeLabelEditPart.VISUAL_ID));
}
return parser;
@@ -378,8 +400,10 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -408,8 +432,8 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -417,8 +441,8 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -427,47 +451,55 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -489,14 +521,15 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -510,6 +543,7 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -524,26 +558,27 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
- View view = (View)getModel();
- if(view.isVisible()) {
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -551,15 +586,18 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @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);
+ 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);
}
}
}
@@ -568,19 +606,27 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -588,6 +634,7 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -595,12 +642,13 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -610,9 +658,10 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -623,8 +672,9 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -645,30 +695,31 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -676,7 +727,7 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -686,12 +737,13 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -701,20 +753,25 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -724,12 +781,13 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -745,26 +803,31 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
@@ -777,6 +840,7 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
IFigure label = createFigurePrim();
defaultText = getLabelTextHelper(label);
@@ -789,4 +853,20 @@ public class TimeObservationStereotypeLabelEditPart extends AbstractLabelEditPar
protected IFigure createFigurePrim() {
return new AppliedStereotypeWrappingLabelFigure();
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageAppliedStereotypeEditPart.java
index 2750e6532a7..022e39578d6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageAppliedStereotypeEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* 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;
@@ -148,6 +151,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Usage_4008, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.UsageAppliedStereotypeEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,7 +667,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* 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
*/
@@ -630,12 +678,12 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
* @generated
*/
protected boolean checkExtendedEditor() {
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -643,7 +691,7 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -653,12 +701,13 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -668,20 +717,25 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -691,12 +745,13 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -712,40 +767,63 @@ public class UsageAppliedStereotypeEditPart extends PapyrusLabelEditPart impleme
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageNameEditPart.java
index f973846df27..0ed751cd5b2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/UsageNameEditPart.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -63,6 +63,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+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.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
@@ -82,7 +83,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
/**
* @generated
@@ -111,12 +112,14 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* 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;
@@ -148,6 +151,7 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public int getKeyPoint() {
return ConnectionLocator.MIDDLE;
}
@@ -156,12 +160,12 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getText();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getText();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getText();
} else {
- return ((Label)figure).getText();
+ return ((Label) figure).getText();
}
}
@@ -169,12 +173,12 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setText(text);
} else {
- ((Label)figure).setText(text);
+ ((Label) figure).setText(text);
}
}
@@ -182,12 +186,12 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
- if(figure instanceof WrappingLabel) {
- return ((WrappingLabel)figure).getIcon();
- } else if(figure instanceof ILabelFigure) {
- return ((ILabelFigure)figure).getIcon();
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else if (figure instanceof ILabelFigure) {
+ return ((ILabelFigure) figure).getIcon();
} else {
- return ((Label)figure).getIcon();
+ return ((Label) figure).getIcon();
}
}
@@ -195,19 +199,20 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @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);
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else if (figure instanceof ILabelFigure) {
+ ((ILabelFigure) figure).setIcon(icon);
} else {
- ((Label)figure).setIcon(icon);
+ ((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -218,6 +223,7 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -225,6 +231,7 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
@@ -232,6 +239,7 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public void setParser(IParser parser) {
this.parser = parser;
}
@@ -256,10 +264,12 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
- if(text == null || text.length() == 0) {
+ if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
@@ -268,26 +278,30 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
/**
* @generated
*/
+ @Override
public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -300,27 +314,31 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
@Override
public String isValid(final Object value) {
- if(value instanceof String) {
+ if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
+ IParserEditStatus valid =
+ (IParserEditStatus) getEditingDomain().runExclusive(
+ new RunnableWithResult.Impl<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
+
// shouldn't get here
return null;
}
@@ -330,8 +348,9 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
+ if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
@@ -340,6 +359,7 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
@@ -347,8 +367,9 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
public IParser getParser() {
- if(parser == null) {
+ if (parser == null) {
parser = UMLParserProvider.getParser(UMLElementTypes.Usage_4008, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.UsageNameEditPart.VISUAL_ID));
}
return parser;
@@ -358,8 +379,10 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @generated
*/
protected DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -388,8 +411,8 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
@@ -397,8 +420,8 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @generated
*/
private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
@@ -407,47 +430,55 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+
+ if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
- switch(directEditionMode) {
+ 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) {
+ if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ 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));
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
initializeDirectEditManager(theRequest);
return;
- } else if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ } 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) {
+ }
+ 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()) {
+
+ 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());
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -469,14 +500,15 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
// 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);
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -490,6 +522,7 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
@@ -504,20 +537,20 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
*/
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
}
- if(maskLabelPolicy == null) {
+ if (maskLabelPolicy == null) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
}
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
}
}
@@ -525,15 +558,18 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @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);
+ 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);
}
}
}
@@ -542,19 +578,27 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ 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));
+ 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);
}
}
@@ -562,6 +606,7 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
@@ -569,12 +614,13 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
+ 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$
+ 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();
@@ -584,9 +630,10 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
@@ -597,8 +644,9 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
+ if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
@Override
@@ -619,30 +667,31 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* 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()) {
+ if (checkExtendedEditor()) {
initExtendedEditorConfiguration();
return IDirectEdition.EXTENDED_DIRECT_EDITOR;
}
- if(checkDefaultEdition()) {
+ 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) {
+ if (resolveSemanticElement() != null) {
return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
}
return false;
@@ -650,7 +699,7 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
* @generated
*/
@@ -660,12 +709,13 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* Initializes the extended editor configuration
+ *
* @generated
*/
protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
+ if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) {
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -675,20 +725,25 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* 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().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ 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()
+ .eClass().getInstanceClassName());
+ } 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
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
* @generated
*/
protected void performDefaultDirectEditorEdit(final Request theRequest) {
@@ -698,12 +753,13 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
@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);
+ 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;
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
@@ -719,40 +775,63 @@ public class UsageNameEditPart extends PapyrusLabelEditPart implements ITextAwar
/**
* @generated
*/
+ @Override
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer)event.getNewValue();
+ 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)) {
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
- } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ } 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)) {
+ } 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())) {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
- if(getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
- if(resolveSemanticElement() != null) {
+ if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
+
super.handleNotificationEvent(event);
}
/**
* @generated
*/
+ @Override
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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.deployment/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
index e38188544e2..5c94508a83b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
@@ -890,6 +890,7 @@
</extension>
<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <?gmfgen generated="true"?>
<diagramMappings diagramID="PapyrusUMLDeploymentDiagram">
<mapping type="PapyrusUMLDeploymentDiagram" humanReadableType="DeploymentDiagram"/>
@@ -897,22 +898,18 @@
humanReadableType="Model"
type="51">
</mapping>
-
<mapping
humanReadableType="PackageableElement"
type="38">
</mapping>
-
<mapping
humanReadableType="DeviceComposite"
type="17">
</mapping>
-
<mapping
humanReadableType="ExecutionEnvironmentComposite"
type="18">
</mapping>
-
<mapping
humanReadableType="Composite"
type="19">
@@ -922,7 +919,6 @@
humanReadableType="ArtifactComposite"
type="26">
</mapping>
-
<mapping
humanReadableType="Model"
type="52">
@@ -937,7 +933,6 @@
humanReadableType="DeviceComposite"
type="30">
</mapping>
-
<mapping
humanReadableType="ExecutionEnvironmentComposite"
type="31">
@@ -947,25 +942,14 @@
humanReadableType="Composite"
type="32">
</mapping>
-
<mapping
humanReadableType="ArtifactComposite"
type="33">
</mapping>
-
<mapping
humanReadableType="ArtifactComposite"
type="34">
</mapping>
-
-
-
-
-
-
-
-
-
<mapping
humanReadableType="Name"
type="13">
@@ -975,9 +959,6 @@
humanReadableType="Stereotype"
type="14">
</mapping>
-
-
-
<mapping
humanReadableType="Name"
type="10">
@@ -987,32 +968,33 @@
humanReadableType="Stereotype"
type="11">
</mapping>
-
-
-
<mapping
humanReadableType="Stereotype"
type="4">
</mapping>
-
-
-
<mapping
humanReadableType="Name"
type="12">
</mapping>
-
<mapping
humanReadableType="Stereotype"
type="15">
</mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="59">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="60">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="61">
+ </mapping>
+ </diagramMappings>
+</extension>
-
-
-
- </diagramMappings>
- </extension>
-
<extension
point="org.eclipse.gmf.runtime.common.ui.services.parserProviders">
<ParserProvider
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
index d77a9e1e7a9..5936e334466 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
@@ -433,32 +433,6 @@
</listener>
</extension>
-<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
- <diagramMappings diagramID="PapyrusUMLStateMachineDiagram">
- <mapping type="PapyrusUMLStateMachineDiagram" humanReadableType="StateMachineDiagram"/>
-
- <mapping
- humanReadableType="Region"
- type="3002">
- </mapping>
-
- <mapping
- humanReadableType="StateMachine"
- type="2002">
- </mapping>
-
- <mapping
- humanReadableType="State"
- type="6002">
- </mapping>
- </diagramMappings>
- </extension>
-
-
-
-
-
-
<extension
id="PapyrusUMLStateMachineDiagram.palettedefinition"
name="PapyrusUMLStateMachineDiagram Predefined Entries"
@@ -803,6 +777,73 @@
class="org.eclipse.papyrus.uml.diagram.statemachine.custom.preferences.CustomTransitionPreferenceInitializer">
</initializer>
</extension>
+<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <?gmfgen generated="true"?>
+ <diagramMappings diagramID="PapyrusUMLStateMachineDiagram">
+ <mapping type="PapyrusUMLStateMachineDiagram" humanReadableType="StateMachineDiagram"/>
+ <mapping
+ humanReadableType="Region"
+ type="3002">
+ </mapping>
+ <mapping
+ humanReadableType="StateMachine"
+ type="2002">
+ </mapping>
+ <mapping
+ humanReadableType="State"
+ type="6002">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="5001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="19003">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="8001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="9001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="10001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="11001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="12001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="13001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="14001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="15001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="16001">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="17001">
+ </mapping>
+ </diagramMappings>
+</extension>
+
<extension
point="org.eclipse.papyrus.infra.gmfdiag.canonical.strategies">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml
index 2d80472bdc5..d327f5a3d34 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml
@@ -802,6 +802,7 @@
<!-- Custom extension point editpart provider for editing properties of stereotype-->
<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+ <?gmfgen generated="true"?>
<diagramMappings diagramID="UseCase">
<mapping type="UseCase" humanReadableType="UseCaseDiagram"/>
@@ -948,8 +949,38 @@
humanReadableType="Stereotype"
type="6036">
</mapping>
-
-
+ <mapping
+ humanReadableType="Floating Label"
+ type="6045">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6050">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6049">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6046">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6051">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6048">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6038">
+ </mapping>
+ <mapping
+ humanReadableType="Floating Label"
+ type="6047">
+ </mapping>
</diagramMappings>
</extension>
<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">

Back to the top