Bug 463662 - Prohibit a size of 0 pixel for a label
Summary: Prohibit a size of 0 pixel for a label
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 0.9   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.1.0   Edit
Assignee: Steve Monnier CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-04-01 06:34 EDT by Laurent Redor CLA
Modified: 2015-10-16 09:11 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Redor CLA 2015-04-01 06:34:26 EDT
A label size of 0 pixel should be forbidden. Indeed, SWT does not handle a Font with 0 pixel.

Currently, if the specifier uses 0 for a label size, this provides the below error:

java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:4462)
	at org.eclipse.swt.SWT.error(SWT.java:4396)
	at org.eclipse.swt.SWT.error(SWT.java:4367)
	at org.eclipse.swt.graphics.FontData.setHeight(FontData.java:340)
	at org.eclipse.swt.graphics.FontData.<init>(FontData.java:200)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refreshFont(GraphicalEditPart.java:890)
	at org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramContainerEditPart.refreshFont(AbstractDiagramContainerEditPart.java:125)

There are 2 concerned fields:
* BasicLabelStyleDescription.labelSize (for diagram and tree)
* ForegroundStyleDescription.labelSize (for table)

The corresponding property sections, BasicLabelStyleDescriptionLabelSizePropertySection and ForegroundStyleDescriptionLabelSizePropertySection, should forbid that.
And perhaps a validation rule should be added.
Comment 1 Eclipse Genie CLA 2015-04-01 09:28:12 EDT
New Gerrit change created: https://git.eclipse.org/r/45001
Comment 2 Maxime Porhel CLA 2015-04-08 04:52:43 EDT
DTreeElementSynchronizerSpec, StyleHelper and DtableElementSynchronizer should also avoid to set 0 value for the font size. 
They might set 1 as minimum value.
Comment 3 Maxime Porhel CLA 2015-04-08 04:57:13 EDT
Steps to reproduce (User): 
 Open a diagram
 Select an element
 Change the label size in the style tab of the properties views
 The error is logged in the error log


Step to reproduce (Specifier)
 Open a VSM 
 Select or create any label (style) description
 Descrese the label size in the label tab: 1 should the minimum possible value.
Comment 4 Maxime Porhel CLA 2015-04-08 04:59:28 EDT
DTreeElementSynchronizerSpec, StyleHelper and DtableElementSynchronizer modification will prevent the error also in case of a style custmization forcing a 0 value. 

Note: the hide label and hide label per defualt capabilities should soon arrive on container and lists. This should cover the cases for which a specifier might want to set a 0 size.
Comment 5 Eclipse Genie CLA 2015-07-22 09:03:12 EDT
New Gerrit change created: https://git.eclipse.org/r/52347
Comment 7 Steve Monnier CLA 2015-07-29 11:00:03 EDT
Pushed on the master branch
Comment 8 Florian Barbin CLA 2015-09-23 09:01:14 EDT
Verified with 3.1.0.201509211006
Comment 9 Pierre-Charles David CLA 2015-10-16 09:11:58 EDT
Available in Sirius 3.1.0.