Bug 580794: [Sirius][ClassDiagram] Refactore the calculus of the displayed label of diagram element
-remove qualified name for single line label
-complete documentation
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Change-Id: Id4b53bf4882a2cdf1b0bbbac859aaefc529149ac
diff --git a/plugins/doc/org.eclipse.papyrus.sirius.doc/src/site/mediawiki/papyrus-sirius-devDoc.mediawiki b/plugins/doc/org.eclipse.papyrus.sirius.doc/src/site/mediawiki/papyrus-sirius-devDoc.mediawiki
index 243d91f..f2f301e 100755
--- a/plugins/doc/org.eclipse.papyrus.sirius.doc/src/site/mediawiki/papyrus-sirius-devDoc.mediawiki
+++ b/plugins/doc/org.eclipse.papyrus.sirius.doc/src/site/mediawiki/papyrus-sirius-devDoc.mediawiki
@@ -84,6 +84,7 @@
*** this service uses the internationalization feature provided by Papyrus
***this service build complex label like : '<<keyword>> <appliedStereotype> labelOfTheElement', where 'labelOfTheElement' can also be a specific construction, like for UML Property: 'name: type [0..*]',
** for nodes used inside a ''Compartment List'', we want a single line label, so we use the service method '''buildSingleLineLabel(Element element, DDiagram diagram)''',
+*** in this case, we never use the qualified name label,
** for others figures, we want a multiline label, so we use '''buildMultilineLabel(Element element, DDiagram diagram)''',
**this service uses the internationalization feature provided by Papyrus
@@ -105,6 +106,7 @@
*''palette'' rules:
** the palette description is given by two folders, one for nodes, named '''Nodes''', one for edges, named '''Edges'''.
** in these folders, the tools should be sorted alphabetically, but the organization also depends on the frequency of use of each element.
+** the label of elements in the palette must have spaces when they have a composed name: '''Data Type''' instead of '''DataType''', '''Duration Observation''' instead of '''DurationObservation'''
*''reconnect'' rules:
**The reconnect tools are defined in a folder called ''Relationships''.
diff --git a/plugins/uml/org.eclipse.papyrus.sirius.uml.diagram.common/src/org/eclipse/papyrus/sirius/uml/diagram/common/core/services/UMLLabelService.java b/plugins/uml/org.eclipse.papyrus.sirius.uml.diagram.common/src/org/eclipse/papyrus/sirius/uml/diagram/common/core/services/UMLLabelService.java
index bde9ef2..83a7410 100755
--- a/plugins/uml/org.eclipse.papyrus.sirius.uml.diagram.common/src/org/eclipse/papyrus/sirius/uml/diagram/common/core/services/UMLLabelService.java
+++ b/plugins/uml/org.eclipse.papyrus.sirius.uml.diagram.common/src/org/eclipse/papyrus/sirius/uml/diagram/common/core/services/UMLLabelService.java
@@ -68,7 +68,7 @@
}
/**
- * This method build a single line label. These labels are used for Nodes inside List Compartment.
+ * This method build a single line label. These labels are used for Nodes inside List Compartment. In this case, the qualified name is never used
*
* @param element
* the element for which we want a label
@@ -78,7 +78,7 @@
* a single line label
*/
public String buildSingleLineLabel(final Element element, final DDiagram diagram) {
- return buildLabel(element, diagram, false);
+ return buildLabel(element, diagram, false, false); // we don't show qualified name in single line label
}
/**
@@ -92,7 +92,7 @@
* a multi line label
*/
public String buildMultilineLabel(final Element element, final DDiagram diagram) {
- return buildLabel(element, diagram, true);
+ return buildLabel(element, diagram, true, isShowingQualifiedName(diagram));
}
@@ -131,11 +131,12 @@
* the current diagram
* @param multiline
* boolean indicating if we want a multiline label or not
+ * @param useQualifiedName
+ * boolean indicating if we must use the qualified name to build the label
* @return
* the label to display in the diagram
*/
- private final String buildLabel(final Element element, final DDiagram diagram, final boolean multiline) {
- boolean useQualifiedName = isShowingQualifiedName(diagram);
+ private final String buildLabel(final Element element, final DDiagram diagram, final boolean multiline, final boolean useQualifiedName) {
this.nameProvider.useQualifiedName(useQualifiedName);
final String keyword = this.keywordProvider.doSwitch(element);