diff options
| author | Mélanie Bats | 2015-01-26 09:57:56 +0000 |
|---|---|---|
| committer | Laurent Redor | 2015-05-18 15:36:37 +0000 |
| commit | 0310bf9e08bd6a301b4ef012445c65df9025a2e7 (patch) | |
| tree | f612aaff311923e29a3a926965af9c1798fe10d2 | |
| parent | f8061e370b1f84329fcdecac18639fad1363dada (diff) | |
| download | org.eclipse.sirius-0310bf9e08bd6a301b4ef012445c65df9025a2e7.tar.gz org.eclipse.sirius-0310bf9e08bd6a301b4ef012445c65df9025a2e7.tar.xz org.eclipse.sirius-0310bf9e08bd6a301b4ef012445c65df9025a2e7.zip | |
[424422] Update viewpoint metamodel to support underline and strike
through in label format
Update in viewpoint metamodel the FontFormat enum to add underline and
strike through as possible formatting styles and remove the normal
value.
Update in viewpoint metamodel the BasicLabelStyleDescription labelFormat
attribute to a multi-valued attribute to be able to define a list of
font format for an element defining a label.
Update in table metamodel to remove the normal default value.
Update in tree metamodel the ForegroundStyleDescription labelFormat
attribute to a multi-valued attribute.
Update the specification editor properties view to support the new
styles.
This commit only contains MM changes so there are compilation problems.
They are expected.
Bug: 424422
Change-Id: Ie4c532f1696d0c596a96f87bd54ceced823ee655
Signed-off-by: Mélanie Bats <melanie.bats@obeo.fr>
33 files changed, 565 insertions, 601 deletions
diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/style/impl/ContainerStyleDescriptionImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/style/impl/ContainerStyleDescriptionImpl.java index ca5f29f4c9..db8cc8317d 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/style/impl/ContainerStyleDescriptionImpl.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/style/impl/ContainerStyleDescriptionImpl.java @@ -11,10 +11,14 @@ */ package org.eclipse.sirius.diagram.description.style.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.sirius.diagram.description.style.BorderedStyleDescription; import org.eclipse.sirius.diagram.description.style.ContainerStyleDescription; import org.eclipse.sirius.diagram.description.style.HideLabelCapabilityStyleDescription; @@ -74,11 +78,12 @@ import org.eclipse.sirius.viewpoint.description.style.TooltipStyleDescription; * @generated */ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDescriptionImpl implements ContainerStyleDescription { + /** * The default value of the '{@link #getBorderSizeComputationExpression() * <em>Border Size Computation Expression</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see #getBorderSizeComputationExpression() * @generated * @ordered @@ -89,7 +94,7 @@ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDe * The cached value of the '{@link #getBorderSizeComputationExpression() * <em>Border Size Computation Expression</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see #getBorderSizeComputationExpression() * @generated * @ordered @@ -127,24 +132,14 @@ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDe protected int labelSize = ContainerStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; /** - * The default value of the '{@link #getLabelFormat() <em>Label Format</em>} - * ' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabelFormat() - * @generated - * @ordered - */ - protected static final FontFormat LABEL_FORMAT_EDEFAULT = FontFormat.NORMAL_LITERAL; - - /** * The cached value of the '{@link #getLabelFormat() <em>Label Format</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getLabelFormat() * @generated * @ordered */ - protected FontFormat labelFormat = ContainerStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + protected EList<FontFormat> labelFormat; /** * The default value of the '{@link #isShowIcon() <em>Show Icon</em>}' @@ -422,22 +417,11 @@ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDe * @generated */ @Override - public FontFormat getLabelFormat() { - return labelFormat; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setLabelFormat(FontFormat newLabelFormat) { - FontFormat oldLabelFormat = labelFormat; - labelFormat = newLabelFormat == null ? ContainerStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT : newLabelFormat; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, StylePackage.CONTAINER_STYLE_DESCRIPTION__LABEL_FORMAT, oldLabelFormat, labelFormat)); + public EList<FontFormat> getLabelFormat() { + if (labelFormat == null) { + labelFormat = new EDataTypeUniqueEList<FontFormat>(FontFormat.class, this, StylePackage.CONTAINER_STYLE_DESCRIPTION__LABEL_FORMAT); } + return labelFormat; } /** @@ -697,6 +681,7 @@ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDe * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -710,7 +695,8 @@ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDe setLabelSize((Integer) newValue); return; case StylePackage.CONTAINER_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat((FontFormat) newValue); + getLabelFormat().clear(); + getLabelFormat().addAll((Collection<? extends FontFormat>) newValue); return; case StylePackage.CONTAINER_STYLE_DESCRIPTION__SHOW_ICON: setShowIcon((Boolean) newValue); @@ -758,7 +744,7 @@ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDe setLabelSize(ContainerStyleDescriptionImpl.LABEL_SIZE_EDEFAULT); return; case StylePackage.CONTAINER_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat(ContainerStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT); + getLabelFormat().clear(); return; case StylePackage.CONTAINER_STYLE_DESCRIPTION__SHOW_ICON: setShowIcon(ContainerStyleDescriptionImpl.SHOW_ICON_EDEFAULT); @@ -804,7 +790,7 @@ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDe case StylePackage.CONTAINER_STYLE_DESCRIPTION__LABEL_SIZE: return labelSize != ContainerStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; case StylePackage.CONTAINER_STYLE_DESCRIPTION__LABEL_FORMAT: - return labelFormat != ContainerStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + return labelFormat != null && !labelFormat.isEmpty(); case StylePackage.CONTAINER_STYLE_DESCRIPTION__SHOW_ICON: return showIcon != ContainerStyleDescriptionImpl.SHOW_ICON_EDEFAULT; case StylePackage.CONTAINER_STYLE_DESCRIPTION__LABEL_EXPRESSION: @@ -984,5 +970,4 @@ public abstract class ContainerStyleDescriptionImpl extends RoundedCornerStyleDe result.append(')'); return result.toString(); } - } // ContainerStyleDescriptionImpl diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/style/impl/NodeStyleDescriptionImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/style/impl/NodeStyleDescriptionImpl.java index 3dc60814e3..691632c2e3 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/style/impl/NodeStyleDescriptionImpl.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/style/impl/NodeStyleDescriptionImpl.java @@ -11,11 +11,15 @@ */ package org.eclipse.sirius.diagram.description.style.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.sirius.diagram.LabelPosition; import org.eclipse.sirius.diagram.ResizeKind; import org.eclipse.sirius.diagram.description.style.BorderedStyleDescription; @@ -83,11 +87,12 @@ import org.eclipse.sirius.viewpoint.description.style.TooltipStyleDescription; * @generated */ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Container implements NodeStyleDescription { + /** * The default value of the '{@link #getBorderSizeComputationExpression() * <em>Border Size Computation Expression</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see #getBorderSizeComputationExpression() * @generated * @ordered @@ -98,7 +103,7 @@ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Contai * The cached value of the '{@link #getBorderSizeComputationExpression() * <em>Border Size Computation Expression</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see #getBorderSizeComputationExpression() * @generated * @ordered @@ -136,24 +141,14 @@ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Contai protected int labelSize = NodeStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; /** - * The default value of the '{@link #getLabelFormat() <em>Label Format</em>} - * ' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabelFormat() - * @generated - * @ordered - */ - protected static final FontFormat LABEL_FORMAT_EDEFAULT = FontFormat.NORMAL_LITERAL; - - /** * The cached value of the '{@link #getLabelFormat() <em>Label Format</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getLabelFormat() * @generated * @ordered */ - protected FontFormat labelFormat = NodeStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + protected EList<FontFormat> labelFormat; /** * The default value of the '{@link #isShowIcon() <em>Show Icon</em>}' @@ -473,22 +468,11 @@ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Contai * @generated */ @Override - public FontFormat getLabelFormat() { - return labelFormat; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setLabelFormat(FontFormat newLabelFormat) { - FontFormat oldLabelFormat = labelFormat; - labelFormat = newLabelFormat == null ? NodeStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT : newLabelFormat; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, StylePackage.NODE_STYLE_DESCRIPTION__LABEL_FORMAT, oldLabelFormat, labelFormat)); + public EList<FontFormat> getLabelFormat() { + if (labelFormat == null) { + labelFormat = new EDataTypeUniqueEList<FontFormat>(FontFormat.class, this, StylePackage.NODE_STYLE_DESCRIPTION__LABEL_FORMAT); } + return labelFormat; } /** @@ -800,6 +784,7 @@ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Contai * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -813,7 +798,8 @@ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Contai setLabelSize((Integer) newValue); return; case StylePackage.NODE_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat((FontFormat) newValue); + getLabelFormat().clear(); + getLabelFormat().addAll((Collection<? extends FontFormat>) newValue); return; case StylePackage.NODE_STYLE_DESCRIPTION__SHOW_ICON: setShowIcon((Boolean) newValue); @@ -867,7 +853,7 @@ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Contai setLabelSize(NodeStyleDescriptionImpl.LABEL_SIZE_EDEFAULT); return; case StylePackage.NODE_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat(NodeStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT); + getLabelFormat().clear(); return; case StylePackage.NODE_STYLE_DESCRIPTION__SHOW_ICON: setShowIcon(NodeStyleDescriptionImpl.SHOW_ICON_EDEFAULT); @@ -919,7 +905,7 @@ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Contai case StylePackage.NODE_STYLE_DESCRIPTION__LABEL_SIZE: return labelSize != NodeStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; case StylePackage.NODE_STYLE_DESCRIPTION__LABEL_FORMAT: - return labelFormat != NodeStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + return labelFormat != null && !labelFormat.isEmpty(); case StylePackage.NODE_STYLE_DESCRIPTION__SHOW_ICON: return showIcon != NodeStyleDescriptionImpl.SHOW_ICON_EDEFAULT; case StylePackage.NODE_STYLE_DESCRIPTION__LABEL_EXPRESSION: @@ -1108,5 +1094,4 @@ public abstract class NodeStyleDescriptionImpl extends MinimalEObjectImpl.Contai result.append(')'); return result.toString(); } - } // NodeStyleDescriptionImpl diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html index 4dcee5c3f4..6522d7dd2b 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html @@ -197,6 +197,9 @@ <li> <code>org.eclipse.sirius.business.api.helper.task.TaskExecutor.undo()/redo()</code> methods are deprecated because they are useless since undo/redo is managed by EMF Transaction. </li> + <li>The API + <code>org.eclipse.sirius.business.api.metamodel.helper.FontFormatHelper</code> has been added. It helps to update label format multi valued features. + </li> </ul> <h4 id="Changesinorg.eclipse.sirius.ui">Changes in <code>org.eclipse.sirius.ui</code> @@ -2732,4 +2735,4 @@ void removeSelectedView(DView view); <li>The ability to print table representations has been disabled for the 0.9 release due to an external dependency issue (see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=422223" target="_blank">bug #422223</a>: for the details). It should be re-introduced in 1.0.</li> </ul> </body> -</html>
\ No newline at end of file +</html> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile index 23b427f656..45f00ec63e 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile @@ -60,6 +60,7 @@ h4. Changes in @org.eclipse.sirius@ * @org.eclipse.sirius.business.api.helper.task.ICommandTask.undo()/redo()@ methods are deprecated because they are useless since undo/redo is managed by EMF Transaction. * @org.eclipse.sirius.tools.api.command.IUndoableCommand@ interface are deprecated because it is useless since undo/redo is managed by EMF Transaction. * @org.eclipse.sirius.business.api.helper.task.TaskExecutor.undo()/redo()@ methods are deprecated because they are useless since undo/redo is managed by EMF Transaction. +* The API @org.eclipse.sirius.business.api.metamodel.helper.FontFormatHelper@ has been added. It helps to update label format multi valued features. h4. Changes in @org.eclipse.sirius.ui@ diff --git a/plugins/org.eclipse.sirius.editor.table/src/org/eclipse/sirius/table/editor/properties/sections/description/spec/foregroundstyledescription/ForegroundStyleDescriptionLabelFormatPropertySection.java b/plugins/org.eclipse.sirius.editor.table/src/org/eclipse/sirius/table/editor/properties/sections/description/spec/foregroundstyledescription/ForegroundStyleDescriptionLabelFormatPropertySection.java index 52bca097fc..cf96430c3e 100644 --- a/plugins/org.eclipse.sirius.editor.table/src/org/eclipse/sirius/table/editor/properties/sections/description/spec/foregroundstyledescription/ForegroundStyleDescriptionLabelFormatPropertySection.java +++ b/plugins/org.eclipse.sirius.editor.table/src/org/eclipse/sirius/table/editor/properties/sections/description/spec/foregroundstyledescription/ForegroundStyleDescriptionLabelFormatPropertySection.java @@ -47,6 +47,10 @@ public class ForegroundStyleDescriptionLabelFormatPropertySection extends Abstra private static final String ITALIC = "Italic"; + private static final String UNDERLINE = "Underline"; + + private static final String STRIKE_THROUGH = "Strike through"; + private static final String TOOL_TIP = "The font formatting style to use for the label"; /** @@ -79,29 +83,36 @@ public class ForegroundStyleDescriptionLabelFormatPropertySection extends Abstra List<String> values = new ArrayList<String>(); values.add(BOLD); values.add(ITALIC); + values.add(UNDERLINE); + values.add(STRIKE_THROUGH); return values; } - private FontFormat getSelectedValue() { + private List<FontFormat> getSelectedValue() { List<?> possibleValues = getChoiceOfValues(); List<Object> selectedValues = new ArrayList<Object>(); - FontFormat fontFormat; + List<FontFormat> fontFormat = new ArrayList<FontFormat>(); for (int i = 0; i < button.length; i++) { if (button[i].getSelection()) selectedValues.add(possibleValues.get(i)); } - if (selectedValues.isEmpty()) { - fontFormat = FontFormat.NORMAL_LITERAL; - } else if (selectedValues.size() == 1) { - if (selectedValues.get(0).equals(ITALIC)) { - fontFormat = FontFormat.ITALIC_LITERAL; - } else { - fontFormat = FontFormat.BOLD_LITERAL; + if (selectedValues.size() > 0) { + for (Object selectedValue : selectedValues) { + if (selectedValue.equals(ITALIC)) { + fontFormat.add(FontFormat.ITALIC_LITERAL); + } + if (selectedValue.equals(BOLD)) { + fontFormat.add(FontFormat.BOLD_LITERAL); + } + if (selectedValue.equals(UNDERLINE)) { + fontFormat.add(FontFormat.UNDERLINE_LITERAL); + } + if (selectedValue.equals(STRIKE_THROUGH)) { + fontFormat.add(FontFormat.STRIKE_THROUGH_LITERAL); + } } - } else { - fontFormat = FontFormat.BOLD_ITALIC_LITERAL; } return fontFormat; @@ -139,7 +150,7 @@ public class ForegroundStyleDescriptionLabelFormatPropertySection extends Abstra final EStructuralFeature eFeature = getFeature(); final IItemPropertyDescriptor propertyDescriptor = getPropertyDescriptor(eFeature); if (propertyDescriptor != null) { - featureText = propertyDescriptor.getLabelProvider(eObject).getText(eObject.eGet(eFeature)).replace(" ", ", "); + featureText = propertyDescriptor.getLabelProvider(eObject).getText(eObject.eGet(eFeature)); return featureText; } return getDefaultFeatureAsText(); @@ -257,16 +268,20 @@ public class ForegroundStyleDescriptionLabelFormatPropertySection extends Abstra } } - private static List<String> convertPropertiesToUI(FontFormat font) { + private static List<String> convertPropertiesToUI(List<FontFormat> font) { List<String> formats = new ArrayList<String>(); - if (font.getValue() == 1) { - formats.add(ITALIC); - } else if (font.getValue() == 2) { - formats.add(BOLD); - } else if (font.getValue() == 3) { - formats.add(ITALIC); - formats.add(BOLD); + for (FontFormat format : font) { + if (format.getValue() == 1) { + formats.add(ITALIC); + } else if (format.getValue() == 2) { + formats.add(BOLD); + } else if (format.getValue() == 3) { + formats.add(UNDERLINE); + } else if (format.getValue() == 4) { + formats.add(STRIKE_THROUGH); + } } + return formats; } diff --git a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/properties/sections/style/basiclabelstyledescription/BasicLabelStyleDescriptionLabelFormatPropertySectionSpec.java b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/properties/sections/style/basiclabelstyledescription/BasicLabelStyleDescriptionLabelFormatPropertySectionSpec.java index 7df8a749b5..79a076f2a9 100644 --- a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/properties/sections/style/basiclabelstyledescription/BasicLabelStyleDescriptionLabelFormatPropertySectionSpec.java +++ b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/properties/sections/style/basiclabelstyledescription/BasicLabelStyleDescriptionLabelFormatPropertySectionSpec.java @@ -49,6 +49,10 @@ public class BasicLabelStyleDescriptionLabelFormatPropertySectionSpec extends Ab private static final String ITALIC = "Italic"; + private static final String UNDERLINE = "Underline"; + + private static final String STRIKE_THROUGH = "Strike through"; + private static final String TOOL_TIP = "The font formatting style to use for the label"; public BasicLabelStyleDescriptionLabelFormatPropertySectionSpec() { @@ -78,29 +82,36 @@ public class BasicLabelStyleDescriptionLabelFormatPropertySectionSpec extends Ab List<String> values = new ArrayList<String>(); values.add(BOLD); values.add(ITALIC); + values.add(UNDERLINE); + values.add(STRIKE_THROUGH); return values; } - protected FontFormat getSelectedValue() { + protected List<FontFormat> getSelectedValue() { List<?> possibleValues = getChoiceOfValues(); List<Object> selectedValues = new ArrayList<Object>(); - FontFormat fontFormat; + List<FontFormat> fontFormat = new ArrayList<FontFormat>(); for (int i = 0; i < button.length; i++) { if (button[i].getSelection()) selectedValues.add(possibleValues.get(i)); } - if (selectedValues.isEmpty()) { - fontFormat = FontFormat.NORMAL_LITERAL; - } else if (selectedValues.size() == 1) { - if (selectedValues.get(0).equals(ITALIC)) { - fontFormat = FontFormat.ITALIC_LITERAL; - } else { - fontFormat = FontFormat.BOLD_LITERAL; + if (selectedValues.size() > 0) { + for (Object selectedValue : selectedValues) { + if (selectedValue.equals(ITALIC)) { + fontFormat.add(FontFormat.ITALIC_LITERAL); + } + if (selectedValue.equals(BOLD)) { + fontFormat.add(FontFormat.BOLD_LITERAL); + } + if (selectedValue.equals(UNDERLINE)) { + fontFormat.add(FontFormat.UNDERLINE_LITERAL); + } + if (selectedValue.equals(STRIKE_THROUGH)) { + fontFormat.add(FontFormat.STRIKE_THROUGH_LITERAL); + } } - } else { - fontFormat = FontFormat.BOLD_ITALIC_LITERAL; } return fontFormat; @@ -138,7 +149,7 @@ public class BasicLabelStyleDescriptionLabelFormatPropertySectionSpec extends Ab final EStructuralFeature eFeature = getFeature(); final IItemPropertyDescriptor propertyDescriptor = getPropertyDescriptor(eFeature); if (propertyDescriptor != null) { - featureText = propertyDescriptor.getLabelProvider(eObject).getText(eObject.eGet(eFeature)).replace(" ", ", "); + featureText = propertyDescriptor.getLabelProvider(eObject).getText(eObject.eGet(eFeature)); return featureText; } return getDefaultFeatureAsText(); @@ -267,16 +278,20 @@ public class BasicLabelStyleDescriptionLabelFormatPropertySectionSpec extends Ab return attribute; } - public static List<String> convertPropertiesToUI(FontFormat font) { + public static List<String> convertPropertiesToUI(List<FontFormat> font) { List<String> formats = new ArrayList<String>(); - if (font.getValue() == 1) { - formats.add(ITALIC); - } else if (font.getValue() == 2) { - formats.add(BOLD); - } else if (font.getValue() == 3) { - formats.add(ITALIC); - formats.add(BOLD); + for (FontFormat format : font) { + if (format.getValue() == 1) { + formats.add(ITALIC); + } else if (format.getValue() == 2) { + formats.add(BOLD); + } else if (format.getValue() == 3) { + formats.add(UNDERLINE); + } else if (format.getValue() == 4) { + formats.add(STRIKE_THROUGH); + } } + return formats; } diff --git a/plugins/org.eclipse.sirius.table/model/table.ecore b/plugins/org.eclipse.sirius.table/model/table.ecore index cf3937ca37..c9523db549 100644 --- a/plugins/org.eclipse.sirius.table/model/table.ecore +++ b/plugins/org.eclipse.sirius.table/model/table.ecore @@ -132,8 +132,8 @@ <details key="documentation" value="The font size."/> </eAnnotations> </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="labelFormat" eType="ecore:EEnum ../../org.eclipse.sirius/model/viewpoint.ecore#//FontFormat" - defaultValueLiteral="normal"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="labelFormat" upperBound="4" + eType="ecore:EEnum ../../org.eclipse.sirius/model/viewpoint.ecore#//FontFormat"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> <details key="documentation" value="The font format."/> </eAnnotations> @@ -519,8 +519,8 @@ <details key="documentation" value="The font size."/> </eAnnotations> </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="labelFormat" eType="ecore:EEnum ../../org.eclipse.sirius/model/viewpoint.ecore#//FontFormat" - defaultValueLiteral="normal"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="labelFormat" upperBound="4" + eType="ecore:EEnum ../../org.eclipse.sirius/model/viewpoint.ecore#//FontFormat"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> <details key="documentation" value="The font format."/> </eAnnotations> diff --git a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/DTableElementStyle.java b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/DTableElementStyle.java index a96c89e95c..a141fc33eb 100644 --- a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/DTableElementStyle.java +++ b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/DTableElementStyle.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.table.metamodel.table; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.viewpoint.FontFormat; import org.eclipse.sirius.viewpoint.RGBValues; @@ -88,21 +89,7 @@ public interface DTableElementStyle extends EObject { * @model default="normal" * @generated */ - FontFormat getLabelFormat(); - - /** - * Sets the value of the ' - * {@link org.eclipse.sirius.table.metamodel.table.DTableElementStyle#getLabelFormat - * <em>Label Format</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param value - * the new value of the '<em>Label Format</em>' attribute. - * @see org.eclipse.sirius.viewpoint.FontFormat - * @see #getLabelFormat() - * @generated - */ - void setLabelFormat(FontFormat value); + EList<FontFormat> getLabelFormat(); /** * Returns the value of the '<em><b>Foreground Color</b></em>' attribute. diff --git a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/TablePackage.java b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/TablePackage.java index 2d9e472c2f..c001517df2 100644 --- a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/TablePackage.java +++ b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/TablePackage.java @@ -1619,11 +1619,11 @@ public interface TablePackage extends EPackage { EAttribute getDTableElementStyle_LabelSize(); /** - * Returns the meta object for the attribute ' + * Returns the meta object for the attribute list ' * {@link org.eclipse.sirius.table.metamodel.table.DTableElementStyle#getLabelFormat * <em>Label Format</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * - * @return the meta object for the attribute '<em>Label Format</em>'. + * @return the meta object for the attribute list '<em>Label Format</em>'. * @see org.eclipse.sirius.table.metamodel.table.DTableElementStyle#getLabelFormat() * @see #getDTableElementStyle() * @generated @@ -2095,7 +2095,7 @@ public interface TablePackage extends EPackage { /** * The meta object literal for the '<em><b>Label Format</b></em>' - * attribute feature. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list feature. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ diff --git a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/DescriptionPackage.java b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/DescriptionPackage.java index abb9e14a40..fd82f9938a 100644 --- a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/DescriptionPackage.java +++ b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/DescriptionPackage.java @@ -4340,11 +4340,11 @@ public interface DescriptionPackage extends EPackage { EAttribute getForegroundStyleDescription_LabelSize(); /** - * Returns the meta object for the attribute ' + * Returns the meta object for the attribute list ' * {@link org.eclipse.sirius.table.metamodel.table.description.ForegroundStyleDescription#getLabelFormat * <em>Label Format</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * - * @return the meta object for the attribute '<em>Label Format</em>'. + * @return the meta object for the attribute list '<em>Label Format</em>'. * @see org.eclipse.sirius.table.metamodel.table.description.ForegroundStyleDescription#getLabelFormat() * @see #getForegroundStyleDescription() * @generated @@ -5411,7 +5411,7 @@ public interface DescriptionPackage extends EPackage { /** * The meta object literal for the '<em><b>Label Format</b></em>' - * attribute feature. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list feature. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ diff --git a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/ForegroundStyleDescription.java b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/ForegroundStyleDescription.java index d5540d6ec4..2dfd13cb64 100644 --- a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/ForegroundStyleDescription.java +++ b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/ForegroundStyleDescription.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.table.metamodel.table.description; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.viewpoint.FontFormat; import org.eclipse.sirius.viewpoint.description.ColorDescription; @@ -79,21 +80,7 @@ public interface ForegroundStyleDescription extends EObject { * @model default="normal" * @generated */ - FontFormat getLabelFormat(); - - /** - * Sets the value of the ' - * {@link org.eclipse.sirius.table.metamodel.table.description.ForegroundStyleDescription#getLabelFormat - * <em>Label Format</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param value - * the new value of the '<em>Label Format</em>' attribute. - * @see org.eclipse.sirius.viewpoint.FontFormat - * @see #getLabelFormat() - * @generated - */ - void setLabelFormat(FontFormat value); + EList<FontFormat> getLabelFormat(); /** * Returns the value of the '<em><b>Fore Ground Color</b></em>' reference. diff --git a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/impl/DescriptionPackageImpl.java b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/impl/DescriptionPackageImpl.java index 53ed8f79c1..32e3669834 100644 --- a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/impl/DescriptionPackageImpl.java +++ b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/impl/DescriptionPackageImpl.java @@ -58,6 +58,7 @@ import org.eclipse.sirius.viewpoint.description.tool.ToolPackage; * @generated */ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionPackage { + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @@ -263,7 +264,7 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * method {@link #init init()}, which also performs initialization of the * package, or returns the registered package, if one already exists. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage#eNS_URI * @see #init() @@ -289,7 +290,7 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * when that field is accessed. Clients should not invoke it directly. * Instead, they should simply access that field to obtain the package. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() @@ -635,8 +636,8 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * @generated */ @Override - public EAttribute getLineMapping_DomainClass() { - return (EAttribute) lineMappingEClass.getEStructuralFeatures().get(4); + public EReference getLineMapping_AllSubLines() { + return (EReference) lineMappingEClass.getEStructuralFeatures().get(2); } /** @@ -645,8 +646,8 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * @generated */ @Override - public EReference getLineMapping_Create() { - return (EReference) lineMappingEClass.getEStructuralFeatures().get(5); + public EReference getLineMapping_ReusedInMappings() { + return (EReference) lineMappingEClass.getEStructuralFeatures().get(3); } /** @@ -655,8 +656,8 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * @generated */ @Override - public EReference getLineMapping_Delete() { - return (EReference) lineMappingEClass.getEStructuralFeatures().get(6); + public EAttribute getLineMapping_DomainClass() { + return (EAttribute) lineMappingEClass.getEStructuralFeatures().get(4); } /** @@ -665,8 +666,8 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * @generated */ @Override - public EAttribute getLineMapping_SemanticCandidatesExpression() { - return (EAttribute) lineMappingEClass.getEStructuralFeatures().get(7); + public EReference getLineMapping_Create() { + return (EReference) lineMappingEClass.getEStructuralFeatures().get(5); } /** @@ -675,8 +676,8 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * @generated */ @Override - public EAttribute getLineMapping_HeaderLabelExpression() { - return (EAttribute) lineMappingEClass.getEStructuralFeatures().get(8); + public EReference getLineMapping_Delete() { + return (EReference) lineMappingEClass.getEStructuralFeatures().get(6); } /** @@ -685,8 +686,8 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * @generated */ @Override - public EReference getLineMapping_AllSubLines() { - return (EReference) lineMappingEClass.getEStructuralFeatures().get(2); + public EAttribute getLineMapping_SemanticCandidatesExpression() { + return (EAttribute) lineMappingEClass.getEStructuralFeatures().get(7); } /** @@ -695,8 +696,8 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * @generated */ @Override - public EReference getLineMapping_ReusedInMappings() { - return (EReference) lineMappingEClass.getEStructuralFeatures().get(3); + public EAttribute getLineMapping_HeaderLabelExpression() { + return (EAttribute) lineMappingEClass.getEStructuralFeatures().get(8); } /** @@ -1566,7 +1567,7 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public void initializePackageContents() { @@ -1882,7 +1883,7 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP EPackageImpl.IS_GENERATED_INSTANCE_CLASS); initEAttribute(getForegroundStyleDescription_LabelSize(), theEcorePackage.getEInt(), "labelSize", "12", 0, 1, ForegroundStyleDescription.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - initEAttribute(getForegroundStyleDescription_LabelFormat(), theViewpointPackage.getFontFormat(), "labelFormat", "normal", 0, 1, ForegroundStyleDescription.class, !EPackageImpl.IS_TRANSIENT, + initEAttribute(getForegroundStyleDescription_LabelFormat(), theViewpointPackage.getFontFormat(), "labelFormat", null, 0, 4, ForegroundStyleDescription.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); initEReference(getForegroundStyleDescription_ForeGroundColor(), theDescriptionPackage_1.getColorDescription(), null, "foreGroundColor", null, 1, 1, ForegroundStyleDescription.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, @@ -2000,5 +2001,4 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP addAnnotation(getForegroundConditionalStyle_PredicateExpression(), source, new String[] {}); addAnnotation(getBackgroundConditionalStyle_PredicateExpression(), source, new String[] {}); } - } // DescriptionPackageImpl diff --git a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/impl/ForegroundStyleDescriptionImpl.java b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/impl/ForegroundStyleDescriptionImpl.java index bc0b6e0c8c..3628235e36 100644 --- a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/impl/ForegroundStyleDescriptionImpl.java +++ b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/description/impl/ForegroundStyleDescriptionImpl.java @@ -10,11 +10,15 @@ *******************************************************************************/ package org.eclipse.sirius.table.metamodel.table.description.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage; import org.eclipse.sirius.table.metamodel.table.description.ForegroundStyleDescription; import org.eclipse.sirius.viewpoint.FontFormat; @@ -41,6 +45,7 @@ import org.eclipse.sirius.viewpoint.description.ColorDescription; * @generated */ public class ForegroundStyleDescriptionImpl extends MinimalEObjectImpl.Container implements ForegroundStyleDescription { + /** * The default value of the '{@link #getLabelSize() <em>Label Size</em>}' * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -62,24 +67,14 @@ public class ForegroundStyleDescriptionImpl extends MinimalEObjectImpl.Container protected int labelSize = ForegroundStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; /** - * The default value of the '{@link #getLabelFormat() <em>Label Format</em>} - * ' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabelFormat() - * @generated - * @ordered - */ - protected static final FontFormat LABEL_FORMAT_EDEFAULT = FontFormat.NORMAL_LITERAL; - - /** * The cached value of the '{@link #getLabelFormat() <em>Label Format</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getLabelFormat() * @generated * @ordered */ - protected FontFormat labelFormat = ForegroundStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + protected EList<FontFormat> labelFormat; /** * The cached value of the '{@link #getForeGroundColor() @@ -141,22 +136,11 @@ public class ForegroundStyleDescriptionImpl extends MinimalEObjectImpl.Container * @generated */ @Override - public FontFormat getLabelFormat() { - return labelFormat; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setLabelFormat(FontFormat newLabelFormat) { - FontFormat oldLabelFormat = labelFormat; - labelFormat = newLabelFormat == null ? ForegroundStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT : newLabelFormat; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__LABEL_FORMAT, oldLabelFormat, labelFormat)); + public EList<FontFormat> getLabelFormat() { + if (labelFormat == null) { + labelFormat = new EDataTypeUniqueEList<FontFormat>(FontFormat.class, this, DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__LABEL_FORMAT); } + return labelFormat; } /** @@ -227,6 +211,7 @@ public class ForegroundStyleDescriptionImpl extends MinimalEObjectImpl.Container * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -234,7 +219,8 @@ public class ForegroundStyleDescriptionImpl extends MinimalEObjectImpl.Container setLabelSize((Integer) newValue); return; case DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat((FontFormat) newValue); + getLabelFormat().clear(); + getLabelFormat().addAll((Collection<? extends FontFormat>) newValue); return; case DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__FORE_GROUND_COLOR: setForeGroundColor((ColorDescription) newValue); @@ -255,7 +241,7 @@ public class ForegroundStyleDescriptionImpl extends MinimalEObjectImpl.Container setLabelSize(ForegroundStyleDescriptionImpl.LABEL_SIZE_EDEFAULT); return; case DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat(ForegroundStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT); + getLabelFormat().clear(); return; case DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__FORE_GROUND_COLOR: setForeGroundColor((ColorDescription) null); @@ -275,7 +261,7 @@ public class ForegroundStyleDescriptionImpl extends MinimalEObjectImpl.Container case DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__LABEL_SIZE: return labelSize != ForegroundStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; case DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__LABEL_FORMAT: - return labelFormat != ForegroundStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + return labelFormat != null && !labelFormat.isEmpty(); case DescriptionPackage.FOREGROUND_STYLE_DESCRIPTION__FORE_GROUND_COLOR: return foreGroundColor != null; } @@ -301,5 +287,4 @@ public class ForegroundStyleDescriptionImpl extends MinimalEObjectImpl.Container result.append(')'); return result.toString(); } - } // ForegroundStyleDescriptionImpl diff --git a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/impl/DTableElementStyleImpl.java b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/impl/DTableElementStyleImpl.java index d0cc7623f0..15387c5ccb 100644 --- a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/impl/DTableElementStyleImpl.java +++ b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/impl/DTableElementStyleImpl.java @@ -10,10 +10,14 @@ *******************************************************************************/ package org.eclipse.sirius.table.metamodel.table.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.sirius.table.metamodel.table.DTableElementStyle; import org.eclipse.sirius.table.metamodel.table.TablePackage; import org.eclipse.sirius.viewpoint.FontFormat; @@ -51,6 +55,7 @@ import org.eclipse.sirius.viewpoint.ViewpointPackage; * @generated */ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container implements DTableElementStyle { + /** * The default value of the '{@link #getLabelSize() <em>Label Size</em>}' * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -72,24 +77,14 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme protected int labelSize = DTableElementStyleImpl.LABEL_SIZE_EDEFAULT; /** - * The default value of the '{@link #getLabelFormat() <em>Label Format</em>} - * ' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabelFormat() - * @generated - * @ordered - */ - protected static final FontFormat LABEL_FORMAT_EDEFAULT = FontFormat.NORMAL_LITERAL; - - /** * The cached value of the '{@link #getLabelFormat() <em>Label Format</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getLabelFormat() * @generated * @ordered */ - protected FontFormat labelFormat = DTableElementStyleImpl.LABEL_FORMAT_EDEFAULT; + protected EList<FontFormat> labelFormat; /** * The default value of the '{@link #isDefaultForegroundStyle() @@ -228,22 +223,11 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public FontFormat getLabelFormat() { - return labelFormat; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setLabelFormat(FontFormat newLabelFormat) { - FontFormat oldLabelFormat = labelFormat; - labelFormat = newLabelFormat == null ? DTableElementStyleImpl.LABEL_FORMAT_EDEFAULT : newLabelFormat; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__LABEL_FORMAT, oldLabelFormat, labelFormat)); + public EList<FontFormat> getLabelFormat() { + if (labelFormat == null) { + labelFormat = new EDataTypeUniqueEList<FontFormat>(FontFormat.class, this, TablePackage.DTABLE_ELEMENT_STYLE__LABEL_FORMAT); } + return labelFormat; } /** @@ -252,8 +236,8 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public RGBValues getForegroundColor() { - return foregroundColor; + public boolean isDefaultForegroundStyle() { + return defaultForegroundStyle; } /** @@ -262,11 +246,11 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public void setForegroundColor(RGBValues newForegroundColor) { - RGBValues oldForegroundColor = foregroundColor; - foregroundColor = newForegroundColor; + public void setDefaultForegroundStyle(boolean newDefaultForegroundStyle) { + boolean oldDefaultForegroundStyle = defaultForegroundStyle; + defaultForegroundStyle = newDefaultForegroundStyle; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__FOREGROUND_COLOR, oldForegroundColor, foregroundColor)); + eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__DEFAULT_FOREGROUND_STYLE, oldDefaultForegroundStyle, defaultForegroundStyle)); } } @@ -276,8 +260,8 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public RGBValues getBackgroundColor() { - return backgroundColor; + public boolean isDefaultBackgroundStyle() { + return defaultBackgroundStyle; } /** @@ -286,11 +270,11 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public void setBackgroundColor(RGBValues newBackgroundColor) { - RGBValues oldBackgroundColor = backgroundColor; - backgroundColor = newBackgroundColor; + public void setDefaultBackgroundStyle(boolean newDefaultBackgroundStyle) { + boolean oldDefaultBackgroundStyle = defaultBackgroundStyle; + defaultBackgroundStyle = newDefaultBackgroundStyle; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__BACKGROUND_COLOR, oldBackgroundColor, backgroundColor)); + eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__DEFAULT_BACKGROUND_STYLE, oldDefaultBackgroundStyle, defaultBackgroundStyle)); } } @@ -300,8 +284,8 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public boolean isDefaultForegroundStyle() { - return defaultForegroundStyle; + public RGBValues getForegroundColor() { + return foregroundColor; } /** @@ -310,11 +294,11 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public void setDefaultForegroundStyle(boolean newDefaultForegroundStyle) { - boolean oldDefaultForegroundStyle = defaultForegroundStyle; - defaultForegroundStyle = newDefaultForegroundStyle; + public void setForegroundColor(RGBValues newForegroundColor) { + RGBValues oldForegroundColor = foregroundColor; + foregroundColor = newForegroundColor; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__DEFAULT_FOREGROUND_STYLE, oldDefaultForegroundStyle, defaultForegroundStyle)); + eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__FOREGROUND_COLOR, oldForegroundColor, foregroundColor)); } } @@ -324,8 +308,8 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public boolean isDefaultBackgroundStyle() { - return defaultBackgroundStyle; + public RGBValues getBackgroundColor() { + return backgroundColor; } /** @@ -334,11 +318,11 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * @generated */ @Override - public void setDefaultBackgroundStyle(boolean newDefaultBackgroundStyle) { - boolean oldDefaultBackgroundStyle = defaultBackgroundStyle; - defaultBackgroundStyle = newDefaultBackgroundStyle; + public void setBackgroundColor(RGBValues newBackgroundColor) { + RGBValues oldBackgroundColor = backgroundColor; + backgroundColor = newBackgroundColor; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__DEFAULT_BACKGROUND_STYLE, oldDefaultBackgroundStyle, defaultBackgroundStyle)); + eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.DTABLE_ELEMENT_STYLE__BACKGROUND_COLOR, oldBackgroundColor, backgroundColor)); } } @@ -371,6 +355,7 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -378,7 +363,8 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme setLabelSize((Integer) newValue); return; case TablePackage.DTABLE_ELEMENT_STYLE__LABEL_FORMAT: - setLabelFormat((FontFormat) newValue); + getLabelFormat().clear(); + getLabelFormat().addAll((Collection<? extends FontFormat>) newValue); return; case TablePackage.DTABLE_ELEMENT_STYLE__DEFAULT_FOREGROUND_STYLE: setDefaultForegroundStyle((Boolean) newValue); @@ -408,7 +394,7 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme setLabelSize(DTableElementStyleImpl.LABEL_SIZE_EDEFAULT); return; case TablePackage.DTABLE_ELEMENT_STYLE__LABEL_FORMAT: - setLabelFormat(DTableElementStyleImpl.LABEL_FORMAT_EDEFAULT); + getLabelFormat().clear(); return; case TablePackage.DTABLE_ELEMENT_STYLE__DEFAULT_FOREGROUND_STYLE: setDefaultForegroundStyle(DTableElementStyleImpl.DEFAULT_FOREGROUND_STYLE_EDEFAULT); @@ -437,7 +423,7 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme case TablePackage.DTABLE_ELEMENT_STYLE__LABEL_SIZE: return labelSize != DTableElementStyleImpl.LABEL_SIZE_EDEFAULT; case TablePackage.DTABLE_ELEMENT_STYLE__LABEL_FORMAT: - return labelFormat != DTableElementStyleImpl.LABEL_FORMAT_EDEFAULT; + return labelFormat != null && !labelFormat.isEmpty(); case TablePackage.DTABLE_ELEMENT_STYLE__DEFAULT_FOREGROUND_STYLE: return defaultForegroundStyle != DTableElementStyleImpl.DEFAULT_FOREGROUND_STYLE_EDEFAULT; case TablePackage.DTABLE_ELEMENT_STYLE__DEFAULT_BACKGROUND_STYLE: @@ -477,5 +463,4 @@ public class DTableElementStyleImpl extends MinimalEObjectImpl.Container impleme result.append(')'); return result.toString(); } - } // DTableElementStyleImpl diff --git a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/impl/TablePackageImpl.java b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/impl/TablePackageImpl.java index 07be7ce6f6..66f4997af5 100644 --- a/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/impl/TablePackageImpl.java +++ b/plugins/org.eclipse.sirius.table/src-gen/org/eclipse/sirius/table/metamodel/table/impl/TablePackageImpl.java @@ -41,6 +41,7 @@ import org.eclipse.sirius.viewpoint.ViewpointPackage; * @generated */ public class TablePackageImpl extends EPackageImpl implements TablePackage { + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @@ -127,7 +128,7 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * method {@link #init init()}, which also performs initialization of the * package, or returns the registered package, if one already exists. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.sirius.table.metamodel.table.TablePackage#eNS_URI * @see #init() @@ -153,7 +154,7 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * that field is accessed. Clients should not invoke it directly. Instead, * they should simply access that field to obtain the package. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() @@ -219,8 +220,8 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * @generated */ @Override - public EReference getDTable_Description() { - return (EReference) dTableEClass.getEStructuralFeatures().get(2); + public EAttribute getDTable_HeaderColumnWidth() { + return (EAttribute) dTableEClass.getEStructuralFeatures().get(1); } /** @@ -229,8 +230,8 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * @generated */ @Override - public EAttribute getDTable_HeaderColumnWidth() { - return (EAttribute) dTableEClass.getEStructuralFeatures().get(1); + public EReference getDTable_Description() { + return (EReference) dTableEClass.getEStructuralFeatures().get(2); } /** @@ -629,8 +630,8 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * @generated */ @Override - public EAttribute getDTableElementStyle_ForegroundColor() { - return (EAttribute) dTableElementStyleEClass.getEStructuralFeatures().get(4); + public EAttribute getDTableElementStyle_DefaultForegroundStyle() { + return (EAttribute) dTableElementStyleEClass.getEStructuralFeatures().get(2); } /** @@ -639,8 +640,8 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * @generated */ @Override - public EAttribute getDTableElementStyle_BackgroundColor() { - return (EAttribute) dTableElementStyleEClass.getEStructuralFeatures().get(5); + public EAttribute getDTableElementStyle_DefaultBackgroundStyle() { + return (EAttribute) dTableElementStyleEClass.getEStructuralFeatures().get(3); } /** @@ -649,8 +650,8 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * @generated */ @Override - public EAttribute getDTableElementStyle_DefaultForegroundStyle() { - return (EAttribute) dTableElementStyleEClass.getEStructuralFeatures().get(2); + public EAttribute getDTableElementStyle_ForegroundColor() { + return (EAttribute) dTableElementStyleEClass.getEStructuralFeatures().get(4); } /** @@ -659,8 +660,8 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * @generated */ @Override - public EAttribute getDTableElementStyle_DefaultBackgroundStyle() { - return (EAttribute) dTableElementStyleEClass.getEStructuralFeatures().get(3); + public EAttribute getDTableElementStyle_BackgroundColor() { + return (EAttribute) dTableElementStyleEClass.getEStructuralFeatures().get(5); } /** @@ -764,7 +765,7 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public void initializePackageContents() { @@ -915,7 +916,7 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { initEClass(dTableElementStyleEClass, DTableElementStyle.class, "DTableElementStyle", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); initEAttribute(getDTableElementStyle_LabelSize(), theEcorePackage.getEInt(), "labelSize", "8", 0, 1, DTableElementStyle.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - initEAttribute(getDTableElementStyle_LabelFormat(), theViewpointPackage.getFontFormat(), "labelFormat", "normal", 0, 1, DTableElementStyle.class, !EPackageImpl.IS_TRANSIENT, + initEAttribute(getDTableElementStyle_LabelFormat(), theViewpointPackage.getFontFormat(), "labelFormat", null, 0, 4, DTableElementStyle.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); initEAttribute(getDTableElementStyle_DefaultForegroundStyle(), theEcorePackage.getEBoolean(), "defaultForegroundStyle", "false", 0, 1, DTableElementStyle.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); @@ -929,5 +930,4 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { // Create resource createResource(TablePackage.eNS_URI); } - } // TablePackageImpl diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java index e64bae123d..1e982950e7 100644 --- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java +++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java @@ -26,6 +26,7 @@ import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.ReflectiveItemProvider; import org.eclipse.sirius.business.api.logger.RuntimeLoggerInterpreter; import org.eclipse.sirius.business.api.logger.RuntimeLoggerManager; +import org.eclipse.sirius.business.api.metamodel.helper.FontFormatHelper; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.common.tools.DslCommonPlugin; @@ -580,7 +581,7 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl style.setForegroundStyleOrigin(cell.getColumn().getOriginMapping()); } if (bestForegroundStyleDesc.getLabelFormat() != null && !isEqual(style.getLabelFormat(), bestForegroundStyleDesc.getLabelFormat())) { - style.setLabelFormat(bestForegroundStyleDesc.getLabelFormat()); + FontFormatHelper.setFontFormat(style.getLabelFormat(), bestForegroundStyleDesc.getLabelFormat()); } if (bestForegroundStyleDesc.getLabelSize() != -1 && style.getLabelSize() != bestForegroundStyleDesc.getLabelSize()) { style.setLabelSize(bestForegroundStyleDesc.getLabelSize()); @@ -642,7 +643,7 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl boolean defaultStyleDescription = new StyleUpdaterQuery(line.getOriginMapping()).isDefaultForegroundColor(bestForegroundStyle.getForeGroundColor()); colorUpdater.updateForegroundColor(style, bestForegroundStyle.getForeGroundColor(), defaultStyleDescription, line.getTarget()); if (bestForegroundStyle.getLabelFormat() != null && !isEqual(style.getLabelFormat(), bestForegroundStyle.getLabelFormat())) { - style.setLabelFormat(bestForegroundStyle.getLabelFormat()); + FontFormatHelper.setFontFormat(style.getLabelFormat(), bestForegroundStyle.getLabelFormat()); } if (bestForegroundStyle.getLabelSize() != -1 && style.getLabelSize() != bestForegroundStyle.getLabelSize()) { style.setLabelSize(bestForegroundStyle.getLabelSize()); @@ -653,7 +654,7 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl style.eUnset(TablePackage.eINSTANCE.getDTableElementStyle_ForegroundColor()); } if (style.getLabelFormat() != null) { - style.setLabelFormat(null); + style.getLabelFormat().clear(); } if (style.eIsSet(TablePackage.eINSTANCE.getDTableElementStyle_LabelSize())) { style.eUnset(TablePackage.eINSTANCE.getDTableElementStyle_LabelSize()); @@ -717,7 +718,7 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl boolean defaultStyleDescription = new StyleUpdaterQuery(styleUpdater).isDefaultForegroundColor(bestForegroundStyle.getForeGroundColor()); colorUpdater.updateForegroundColor(style, bestForegroundStyle.getForeGroundColor(), defaultStyleDescription, column.getTarget()); if (bestForegroundStyle.getLabelFormat() != null && !isEqual(style.getLabelFormat(), bestForegroundStyle.getLabelFormat())) { - style.setLabelFormat(bestForegroundStyle.getLabelFormat()); + FontFormatHelper.setFontFormat(style.getLabelFormat(), bestForegroundStyle.getLabelFormat()); } if (bestForegroundStyle.getLabelSize() != -1 && style.getLabelSize() != bestForegroundStyle.getLabelSize()) { style.setLabelSize(bestForegroundStyle.getLabelSize()); diff --git a/plugins/org.eclipse.sirius.tree/src-gen/org/eclipse/sirius/tree/description/impl/TreeItemStyleDescriptionImpl.java b/plugins/org.eclipse.sirius.tree/src-gen/org/eclipse/sirius/tree/description/impl/TreeItemStyleDescriptionImpl.java index e40fde947d..e0f30e779c 100644 --- a/plugins/org.eclipse.sirius.tree/src-gen/org/eclipse/sirius/tree/description/impl/TreeItemStyleDescriptionImpl.java +++ b/plugins/org.eclipse.sirius.tree/src-gen/org/eclipse/sirius/tree/description/impl/TreeItemStyleDescriptionImpl.java @@ -10,11 +10,15 @@ *******************************************************************************/ package org.eclipse.sirius.tree.description.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.sirius.tree.description.DescriptionPackage; import org.eclipse.sirius.tree.description.TreeItemStyleDescription; import org.eclipse.sirius.viewpoint.FontFormat; @@ -60,6 +64,7 @@ import org.eclipse.sirius.viewpoint.description.style.StylePackage; * @generated */ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container implements TreeItemStyleDescription { + /** * The default value of the '{@link #getLabelSize() <em>Label Size</em>}' * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -81,24 +86,14 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i protected int labelSize = TreeItemStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; /** - * The default value of the '{@link #getLabelFormat() <em>Label Format</em>} - * ' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabelFormat() - * @generated - * @ordered - */ - protected static final FontFormat LABEL_FORMAT_EDEFAULT = FontFormat.NORMAL_LITERAL; - - /** * The cached value of the '{@link #getLabelFormat() <em>Label Format</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getLabelFormat() * @generated * @ordered */ - protected FontFormat labelFormat = TreeItemStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + protected EList<FontFormat> labelFormat; /** * The default value of the '{@link #isShowIcon() <em>Show Icon</em>}' @@ -230,8 +225,8 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public String getLabelExpression() { - return labelExpression; + public int getLabelSize() { + return labelSize; } /** @@ -240,11 +235,11 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public void setLabelExpression(String newLabelExpression) { - String oldLabelExpression = labelExpression; - labelExpression = newLabelExpression; + public void setLabelSize(int newLabelSize) { + int oldLabelSize = labelSize; + labelSize = newLabelSize; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_EXPRESSION, oldLabelExpression, labelExpression)); + eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_SIZE, oldLabelSize, labelSize)); } } @@ -254,8 +249,11 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public LabelAlignment getLabelAlignment() { - return labelAlignment; + public EList<FontFormat> getLabelFormat() { + if (labelFormat == null) { + labelFormat = new EDataTypeUniqueEList<FontFormat>(FontFormat.class, this, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_FORMAT); + } + return labelFormat; } /** @@ -264,12 +262,8 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public void setLabelAlignment(LabelAlignment newLabelAlignment) { - LabelAlignment oldLabelAlignment = labelAlignment; - labelAlignment = newLabelAlignment == null ? TreeItemStyleDescriptionImpl.LABEL_ALIGNMENT_EDEFAULT : newLabelAlignment; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_ALIGNMENT, oldLabelAlignment, labelAlignment)); - } + public boolean isShowIcon() { + return showIcon; } /** @@ -278,17 +272,12 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public ColorDescription getLabelColor() { - if (labelColor != null && labelColor.eIsProxy()) { - InternalEObject oldLabelColor = (InternalEObject) labelColor; - labelColor = (ColorDescription) eResolveProxy(oldLabelColor); - if (labelColor != oldLabelColor) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_COLOR, oldLabelColor, labelColor)); - } - } + public void setShowIcon(boolean newShowIcon) { + boolean oldShowIcon = showIcon; + showIcon = newShowIcon; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__SHOW_ICON, oldShowIcon, showIcon)); } - return labelColor; } /** @@ -296,8 +285,9 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * * @generated */ - public ColorDescription basicGetLabelColor() { - return labelColor; + @Override + public String getLabelExpression() { + return labelExpression; } /** @@ -306,11 +296,11 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public void setLabelColor(ColorDescription newLabelColor) { - ColorDescription oldLabelColor = labelColor; - labelColor = newLabelColor; + public void setLabelExpression(String newLabelExpression) { + String oldLabelExpression = labelExpression; + labelExpression = newLabelExpression; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_COLOR, oldLabelColor, labelColor)); + eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_EXPRESSION, oldLabelExpression, labelExpression)); } } @@ -320,22 +310,17 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public String getIconPath() { - return iconPath; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setIconPath(String newIconPath) { - String oldIconPath = iconPath; - iconPath = newIconPath; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__ICON_PATH, oldIconPath, iconPath)); + public ColorDescription getLabelColor() { + if (labelColor != null && labelColor.eIsProxy()) { + InternalEObject oldLabelColor = (InternalEObject) labelColor; + labelColor = (ColorDescription) eResolveProxy(oldLabelColor); + if (labelColor != oldLabelColor) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_COLOR, oldLabelColor, labelColor)); + } + } } + return labelColor; } /** @@ -343,9 +328,8 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * * @generated */ - @Override - public int getLabelSize() { - return labelSize; + public ColorDescription basicGetLabelColor() { + return labelColor; } /** @@ -354,11 +338,11 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public void setLabelSize(int newLabelSize) { - int oldLabelSize = labelSize; - labelSize = newLabelSize; + public void setLabelColor(ColorDescription newLabelColor) { + ColorDescription oldLabelColor = labelColor; + labelColor = newLabelColor; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_SIZE, oldLabelSize, labelSize)); + eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_COLOR, oldLabelColor, labelColor)); } } @@ -368,8 +352,8 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public FontFormat getLabelFormat() { - return labelFormat; + public String getIconPath() { + return iconPath; } /** @@ -378,11 +362,11 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public void setLabelFormat(FontFormat newLabelFormat) { - FontFormat oldLabelFormat = labelFormat; - labelFormat = newLabelFormat == null ? TreeItemStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT : newLabelFormat; + public void setIconPath(String newIconPath) { + String oldIconPath = iconPath; + iconPath = newIconPath; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_FORMAT, oldLabelFormat, labelFormat)); + eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__ICON_PATH, oldIconPath, iconPath)); } } @@ -392,8 +376,8 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public boolean isShowIcon() { - return showIcon; + public LabelAlignment getLabelAlignment() { + return labelAlignment; } /** @@ -402,11 +386,11 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * @generated */ @Override - public void setShowIcon(boolean newShowIcon) { - boolean oldShowIcon = showIcon; - showIcon = newShowIcon; + public void setLabelAlignment(LabelAlignment newLabelAlignment) { + LabelAlignment oldLabelAlignment = labelAlignment; + labelAlignment = newLabelAlignment == null ? TreeItemStyleDescriptionImpl.LABEL_ALIGNMENT_EDEFAULT : newLabelAlignment; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__SHOW_ICON, oldShowIcon, showIcon)); + eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_ALIGNMENT, oldLabelAlignment, labelAlignment)); } } @@ -491,6 +475,7 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -498,7 +483,8 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i setLabelSize((Integer) newValue); return; case DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat((FontFormat) newValue); + getLabelFormat().clear(); + getLabelFormat().addAll((Collection<? extends FontFormat>) newValue); return; case DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__SHOW_ICON: setShowIcon((Boolean) newValue); @@ -534,7 +520,7 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i setLabelSize(TreeItemStyleDescriptionImpl.LABEL_SIZE_EDEFAULT); return; case DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat(TreeItemStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT); + getLabelFormat().clear(); return; case DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__SHOW_ICON: setShowIcon(TreeItemStyleDescriptionImpl.SHOW_ICON_EDEFAULT); @@ -569,7 +555,7 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i case DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_SIZE: return labelSize != TreeItemStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; case DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_FORMAT: - return labelFormat != TreeItemStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + return labelFormat != null && !labelFormat.isEmpty(); case DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__SHOW_ICON: return showIcon != TreeItemStyleDescriptionImpl.SHOW_ICON_EDEFAULT; case DescriptionPackage.TREE_ITEM_STYLE_DESCRIPTION__LABEL_EXPRESSION: @@ -685,5 +671,4 @@ public class TreeItemStyleDescriptionImpl extends MinimalEObjectImpl.Container i result.append(')'); return result.toString(); } - } // TreeItemStyleDescriptionImpl diff --git a/plugins/org.eclipse.sirius.tree/src-gen/org/eclipse/sirius/tree/impl/TreeItemStyleImpl.java b/plugins/org.eclipse.sirius.tree/src-gen/org/eclipse/sirius/tree/impl/TreeItemStyleImpl.java index 31bec348b0..72ef90b89c 100644 --- a/plugins/org.eclipse.sirius.tree/src-gen/org/eclipse/sirius/tree/impl/TreeItemStyleImpl.java +++ b/plugins/org.eclipse.sirius.tree/src-gen/org/eclipse/sirius/tree/impl/TreeItemStyleImpl.java @@ -10,9 +10,13 @@ *******************************************************************************/ package org.eclipse.sirius.tree.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.sirius.tree.TreeItemStyle; import org.eclipse.sirius.tree.TreePackage; import org.eclipse.sirius.viewpoint.BasicLabelStyle; @@ -50,6 +54,7 @@ import org.eclipse.sirius.viewpoint.impl.StyleImpl; * @generated */ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { + /** * The default value of the '{@link #getLabelSize() <em>Label Size</em>}' * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -71,24 +76,14 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { protected int labelSize = TreeItemStyleImpl.LABEL_SIZE_EDEFAULT; /** - * The default value of the '{@link #getLabelFormat() <em>Label Format</em>} - * ' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabelFormat() - * @generated - * @ordered - */ - protected static final FontFormat LABEL_FORMAT_EDEFAULT = FontFormat.NORMAL_LITERAL; - - /** * The cached value of the '{@link #getLabelFormat() <em>Label Format</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getLabelFormat() * @generated * @ordered */ - protected FontFormat labelFormat = TreeItemStyleImpl.LABEL_FORMAT_EDEFAULT; + protected EList<FontFormat> labelFormat; /** * The default value of the '{@link #isShowIcon() <em>Show Icon</em>}' @@ -243,22 +238,11 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { * @generated */ @Override - public FontFormat getLabelFormat() { - return labelFormat; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setLabelFormat(FontFormat newLabelFormat) { - FontFormat oldLabelFormat = labelFormat; - labelFormat = newLabelFormat == null ? TreeItemStyleImpl.LABEL_FORMAT_EDEFAULT : newLabelFormat; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_ITEM_STYLE__LABEL_FORMAT, oldLabelFormat, labelFormat)); + public EList<FontFormat> getLabelFormat() { + if (labelFormat == null) { + labelFormat = new EDataTypeUniqueEList<FontFormat>(FontFormat.class, this, TreePackage.TREE_ITEM_STYLE__LABEL_FORMAT); } + return labelFormat; } /** @@ -291,8 +275,8 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { * @generated */ @Override - public LabelAlignment getLabelAlignment() { - return labelAlignment; + public String getIconPath() { + return iconPath; } /** @@ -301,11 +285,11 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { * @generated */ @Override - public void setLabelAlignment(LabelAlignment newLabelAlignment) { - LabelAlignment oldLabelAlignment = labelAlignment; - labelAlignment = newLabelAlignment == null ? TreeItemStyleImpl.LABEL_ALIGNMENT_EDEFAULT : newLabelAlignment; + public void setIconPath(String newIconPath) { + String oldIconPath = iconPath; + iconPath = newIconPath; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_ITEM_STYLE__LABEL_ALIGNMENT, oldLabelAlignment, labelAlignment)); + eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_ITEM_STYLE__ICON_PATH, oldIconPath, iconPath)); } } @@ -339,8 +323,8 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { * @generated */ @Override - public String getIconPath() { - return iconPath; + public LabelAlignment getLabelAlignment() { + return labelAlignment; } /** @@ -349,11 +333,11 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { * @generated */ @Override - public void setIconPath(String newIconPath) { - String oldIconPath = iconPath; - iconPath = newIconPath; + public void setLabelAlignment(LabelAlignment newLabelAlignment) { + LabelAlignment oldLabelAlignment = labelAlignment; + labelAlignment = newLabelAlignment == null ? TreeItemStyleImpl.LABEL_ALIGNMENT_EDEFAULT : newLabelAlignment; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_ITEM_STYLE__ICON_PATH, oldIconPath, iconPath)); + eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_ITEM_STYLE__LABEL_ALIGNMENT, oldLabelAlignment, labelAlignment)); } } @@ -412,6 +396,7 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -419,7 +404,8 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { setLabelSize((Integer) newValue); return; case TreePackage.TREE_ITEM_STYLE__LABEL_FORMAT: - setLabelFormat((FontFormat) newValue); + getLabelFormat().clear(); + getLabelFormat().addAll((Collection<? extends FontFormat>) newValue); return; case TreePackage.TREE_ITEM_STYLE__SHOW_ICON: setShowIcon((Boolean) newValue); @@ -452,7 +438,7 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { setLabelSize(TreeItemStyleImpl.LABEL_SIZE_EDEFAULT); return; case TreePackage.TREE_ITEM_STYLE__LABEL_FORMAT: - setLabelFormat(TreeItemStyleImpl.LABEL_FORMAT_EDEFAULT); + getLabelFormat().clear(); return; case TreePackage.TREE_ITEM_STYLE__SHOW_ICON: setShowIcon(TreeItemStyleImpl.SHOW_ICON_EDEFAULT); @@ -484,7 +470,7 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { case TreePackage.TREE_ITEM_STYLE__LABEL_SIZE: return labelSize != TreeItemStyleImpl.LABEL_SIZE_EDEFAULT; case TreePackage.TREE_ITEM_STYLE__LABEL_FORMAT: - return labelFormat != TreeItemStyleImpl.LABEL_FORMAT_EDEFAULT; + return labelFormat != null && !labelFormat.isEmpty(); case TreePackage.TREE_ITEM_STYLE__SHOW_ICON: return showIcon != TreeItemStyleImpl.SHOW_ICON_EDEFAULT; case TreePackage.TREE_ITEM_STYLE__ICON_PATH: @@ -596,5 +582,4 @@ public class TreeItemStyleImpl extends StyleImpl implements TreeItemStyle { result.append(')'); return result.toString(); } - } // TreeItemStyleImpl diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/refresh/DTreeElementSynchronizerSpec.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/refresh/DTreeElementSynchronizerSpec.java index 1ed07b1ed5..551f3dd390 100644 --- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/refresh/DTreeElementSynchronizerSpec.java +++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/refresh/DTreeElementSynchronizerSpec.java @@ -16,11 +16,13 @@ import java.util.Iterator; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.business.api.logger.RuntimeLoggerManager; +import org.eclipse.sirius.business.api.metamodel.helper.FontFormatHelper; import org.eclipse.sirius.common.tools.api.interpreter.EvaluationException; import org.eclipse.sirius.common.tools.api.interpreter.IInterpreter; import org.eclipse.sirius.common.tools.api.interpreter.IInterpreterSiriusVariables; import org.eclipse.sirius.common.tools.api.util.StringUtil; -import org.eclipse.sirius.business.api.logger.RuntimeLoggerManager; +import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor; import org.eclipse.sirius.tree.DTree; import org.eclipse.sirius.tree.DTreeElement; import org.eclipse.sirius.tree.DTreeItem; @@ -38,7 +40,6 @@ import org.eclipse.sirius.tree.impl.DTreeElementSynchronizerImpl; import org.eclipse.sirius.tree.tools.api.interpreter.IInterpreterSiriusTreeVariables; import org.eclipse.sirius.viewpoint.DSemanticDecorator; import org.eclipse.sirius.viewpoint.FontFormat; -import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor; /** * Tree element synchronizer. @@ -192,7 +193,7 @@ public class DTreeElementSynchronizerSpec extends DTreeElementSynchronizerImpl { colorUpdater.updateBackgroundColor(style, bestTreeItemStyle.getBackgroundColor(), treeItem.getTarget()); colorUpdater.updateLabelColor(style, bestTreeItemStyle.getLabelColor(), treeItem.getTarget()); if (bestTreeItemStyle.getLabelFormat() != null && !isEqual(style.getLabelFormat(), bestTreeItemStyle.getLabelFormat())) { - style.setLabelFormat(bestTreeItemStyle.getLabelFormat()); + FontFormatHelper.setFontFormat(style.getLabelFormat(), bestTreeItemStyle.getLabelFormat()); } if (bestTreeItemStyle.getLabelSize() != -1 && style.getLabelSize() != bestTreeItemStyle.getLabelSize()) { style.setLabelSize(bestTreeItemStyle.getLabelSize()); diff --git a/plugins/org.eclipse.sirius.ui/plugin.properties b/plugins/org.eclipse.sirius.ui/plugin.properties index c564fc03c1..7ac1bbcb44 100644 --- a/plugins/org.eclipse.sirius.ui/plugin.properties +++ b/plugins/org.eclipse.sirius.ui/plugin.properties @@ -1032,3 +1032,5 @@ _UI_Viewpoint_customizes_feature = Customizes _UI_EStructuralFeatureCustomization_applyOnAll_feature = Apply On All _UI_EStructuralFeatureCustomization_applyOnAll_description = If true, this customization will be applied on all style description. _UI_DAnalysis_semanticResources_feature = Semantic Resources +_UI_FontFormat_underline_literal = Underline +_UI_FontFormat_strike_through_literal = StrikeThrough diff --git a/plugins/org.eclipse.sirius/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius/META-INF/MANIFEST.MF index 065ec8b730..5baa104bf8 100644 --- a/plugins/org.eclipse.sirius/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius/META-INF/MANIFEST.MF @@ -22,6 +22,7 @@ Export-Package: org.eclipse.sirius.business.api.action;version="2.0.4", org.eclipse.sirius.business.api.helper.task;version="2.0.4", org.eclipse.sirius.business.api.helper.task.label;version="2.0.4", org.eclipse.sirius.business.api.logger;version="2.0.4", + org.eclipse.sirius.business.api.metamodel.helper;version="3.0.0", org.eclipse.sirius.business.api.migration;version="3.0.0", org.eclipse.sirius.business.api.modelingproject;version="2.0.4", org.eclipse.sirius.business.api.preferences;version="2.0.4", diff --git a/plugins/org.eclipse.sirius/model/viewpoint.ecore b/plugins/org.eclipse.sirius/model/viewpoint.ecore index 99fe17f8e6..ef3395ccca 100644 --- a/plugins/org.eclipse.sirius/model/viewpoint.ecore +++ b/plugins/org.eclipse.sirius/model/viewpoint.ecore @@ -172,10 +172,10 @@ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> <details key="documentation" value="The format of the font."/> </eAnnotations> - <eLiterals name="normal"/> - <eLiterals name="italic" value="1"/> - <eLiterals name="bold" value="2"/> - <eLiterals name="bold_italic" value="3"/> + <eLiterals name="italic"/> + <eLiterals name="bold" value="1"/> + <eLiterals name="underline" value="2"/> + <eLiterals name="strike_through" value="3"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Style" abstract="true" eSuperTypes="#//DRefreshable #//Customizable"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> @@ -234,8 +234,8 @@ <details key="documentation" value="The font size."/> </eAnnotations> </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="labelFormat" eType="#//FontFormat" - defaultValueLiteral="normal"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="labelFormat" upperBound="4" + eType="#//FontFormat"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> <details key="documentation" value="The font format."/> </eAnnotations> @@ -856,8 +856,8 @@ <details key="documentation" value="The font size."/> </eAnnotations> </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="labelFormat" eType="#//FontFormat" - defaultValueLiteral="normal"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="labelFormat" upperBound="4" + eType="#//FontFormat"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> <details key="documentation" value="The font format."/> </eAnnotations> diff --git a/plugins/org.eclipse.sirius/model/viewpoint.genmodel b/plugins/org.eclipse.sirius/model/viewpoint.genmodel index b7a6481d19..18a0168e76 100644 --- a/plugins/org.eclipse.sirius/model/viewpoint.genmodel +++ b/plugins/org.eclipse.sirius/model/viewpoint.genmodel @@ -13,10 +13,10 @@ <genPackages prefix="Viewpoint" basePackage="org.eclipse.sirius" disposableProviderFactory="true" ecorePackage="viewpoint.ecore#/"> <genEnums ecoreEnum="viewpoint.ecore#//FontFormat"> - <genEnumLiterals ecoreEnumLiteral="viewpoint.ecore#//FontFormat/normal"/> <genEnumLiterals ecoreEnumLiteral="viewpoint.ecore#//FontFormat/italic"/> <genEnumLiterals ecoreEnumLiteral="viewpoint.ecore#//FontFormat/bold"/> - <genEnumLiterals ecoreEnumLiteral="viewpoint.ecore#//FontFormat/bold_italic"/> + <genEnumLiterals ecoreEnumLiteral="viewpoint.ecore#//FontFormat/underline"/> + <genEnumLiterals ecoreEnumLiteral="viewpoint.ecore#//FontFormat/strike_through"/> </genEnums> <genEnums typeSafeEnumCompatible="false" ecoreEnum="viewpoint.ecore#//LabelAlignment"> <genEnumLiterals ecoreEnumLiteral="viewpoint.ecore#//LabelAlignment/CENTER"/> diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/BasicLabelStyle.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/BasicLabelStyle.java index 5febb0a22d..4d81864811 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/BasicLabelStyle.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/BasicLabelStyle.java @@ -11,6 +11,8 @@ */ package org.eclipse.sirius.viewpoint; +import org.eclipse.emf.common.util.EList; + /** * <!-- begin-user-doc --> A representation of the model object ' * <em><b>Basic Label Style</b></em>'. <!-- end-user-doc --> @@ -79,21 +81,7 @@ public interface BasicLabelStyle extends Customizable { * @model default="normal" * @generated */ - FontFormat getLabelFormat(); - - /** - * Sets the value of the ' - * {@link org.eclipse.sirius.viewpoint.BasicLabelStyle#getLabelFormat - * <em>Label Format</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param value - * the new value of the '<em>Label Format</em>' attribute. - * @see org.eclipse.sirius.viewpoint.FontFormat - * @see #getLabelFormat() - * @generated - */ - void setLabelFormat(FontFormat value); + EList<FontFormat> getLabelFormat(); /** * Returns the value of the '<em><b>Show Icon</b></em>' attribute. The diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/FontFormat.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/FontFormat.java index 8eb3983b40..466eeb68cb 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/FontFormat.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/FontFormat.java @@ -29,16 +29,6 @@ import org.eclipse.emf.common.util.Enumerator; */ public enum FontFormat implements Enumerator { /** - * The '<em><b>Normal</b></em>' literal object. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #NORMAL - * @generated - * @ordered - */ - NORMAL_LITERAL(0, "normal", "normal"), - - /** * The '<em><b>Italic</b></em>' literal object. <!-- begin-user-doc --> <!-- * end-user-doc --> * @@ -46,7 +36,7 @@ public enum FontFormat implements Enumerator { * @generated * @ordered */ - ITALIC_LITERAL(1, "italic", "italic"), + ITALIC_LITERAL(0, "italic", "italic"), /** * The '<em><b>Bold</b></em>' literal object. <!-- begin-user-doc --> <!-- @@ -56,32 +46,27 @@ public enum FontFormat implements Enumerator { * @generated * @ordered */ - BOLD_LITERAL(2, "bold", "bold"), + BOLD_LITERAL(1, "bold", "bold"), /** - * The '<em><b>Bold italic</b></em>' literal object. <!-- begin-user-doc --> + * The '<em><b>Underline</b></em>' literal object. <!-- begin-user-doc --> * <!-- end-user-doc --> * - * @see #BOLD_ITALIC + * @see #UNDERLINE * @generated * @ordered */ - BOLD_ITALIC_LITERAL(3, "bold_italic", "bold_italic"); + UNDERLINE_LITERAL(2, "underline", "underline"), /** - * The '<em><b>Normal</b></em>' literal value. <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>Normal</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> + * The '<em><b>Strike through</b></em>' literal object. <!-- begin-user-doc + * --> <!-- end-user-doc --> * - * @see #NORMAL_LITERAL - * @model name="normal" + * @see #STRIKE_THROUGH * @generated * @ordered */ - public static final int NORMAL = 0; + STRIKE_THROUGH_LITERAL(3, "strike_through", "strike_through"); /** * The '<em><b>Italic</b></em>' literal value. <!-- begin-user-doc --> @@ -96,7 +81,7 @@ public enum FontFormat implements Enumerator { * @generated * @ordered */ - public static final int ITALIC = 1; + public static final int ITALIC = 0; /** * The '<em><b>Bold</b></em>' literal value. <!-- begin-user-doc --> @@ -111,22 +96,38 @@ public enum FontFormat implements Enumerator { * @generated * @ordered */ - public static final int BOLD = 2; + public static final int BOLD = 1; + + /** + * The '<em><b>Underline</b></em>' literal value. <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>Underline</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @see #UNDERLINE_LITERAL + * @model name="underline" + * @generated + * @ordered + */ + public static final int UNDERLINE = 2; /** - * The '<em><b>Bold italic</b></em>' literal value. <!-- begin-user-doc --> + * The '<em><b>Strike through</b></em>' literal value. <!-- begin-user-doc + * --> * <p> - * If the meaning of '<em><b>Bold italic</b></em>' literal object isn't + * If the meaning of '<em><b>Strike through</b></em>' literal object isn't * clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> * - * @see #BOLD_ITALIC_LITERAL - * @model name="bold_italic" + * @see #STRIKE_THROUGH_LITERAL + * @model name="strike_through" * @generated * @ordered */ - public static final int BOLD_ITALIC = 3; + public static final int STRIKE_THROUGH = 3; /** * An array of all the '<em><b>Font Format</b></em>' enumerators. <!-- @@ -134,7 +135,7 @@ public enum FontFormat implements Enumerator { * * @generated */ - private static final FontFormat[] VALUES_ARRAY = new FontFormat[] { NORMAL_LITERAL, ITALIC_LITERAL, BOLD_LITERAL, BOLD_ITALIC_LITERAL, }; + private static final FontFormat[] VALUES_ARRAY = new FontFormat[] { ITALIC_LITERAL, BOLD_LITERAL, UNDERLINE_LITERAL, STRIKE_THROUGH_LITERAL, }; /** * A public read-only list of all the '<em><b>Font Format</b></em>' @@ -182,14 +183,14 @@ public enum FontFormat implements Enumerator { */ public static FontFormat get(int value) { switch (value) { - case NORMAL: - return NORMAL_LITERAL; case ITALIC: return ITALIC_LITERAL; case BOLD: return BOLD_LITERAL; - case BOLD_ITALIC: - return BOLD_ITALIC_LITERAL; + case UNDERLINE: + return UNDERLINE_LITERAL; + case STRIKE_THROUGH: + return STRIKE_THROUGH_LITERAL; } return null; } diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/ViewpointPackage.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/ViewpointPackage.java index f9db04ed55..8e56262c98 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/ViewpointPackage.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/ViewpointPackage.java @@ -2024,11 +2024,11 @@ public interface ViewpointPackage extends EPackage { EAttribute getBasicLabelStyle_LabelSize(); /** - * Returns the meta object for the attribute ' + * Returns the meta object for the attribute list ' * {@link org.eclipse.sirius.viewpoint.BasicLabelStyle#getLabelFormat * <em>Label Format</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * - * @return the meta object for the attribute '<em>Label Format</em>'. + * @return the meta object for the attribute list '<em>Label Format</em>'. * @see org.eclipse.sirius.viewpoint.BasicLabelStyle#getLabelFormat() * @see #getBasicLabelStyle() * @generated @@ -2763,7 +2763,7 @@ public interface ViewpointPackage extends EPackage { /** * The meta object literal for the '<em><b>Label Format</b></em>' - * attribute feature. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list feature. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/BasicLabelStyleDescription.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/BasicLabelStyleDescription.java index 0ba95ba487..186951acd4 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/BasicLabelStyleDescription.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/BasicLabelStyleDescription.java @@ -11,6 +11,7 @@ */ package org.eclipse.sirius.viewpoint.description.style; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.viewpoint.FontFormat; import org.eclipse.sirius.viewpoint.description.ColorDescription; @@ -91,21 +92,7 @@ public interface BasicLabelStyleDescription extends EObject { * @model default="normal" * @generated */ - FontFormat getLabelFormat(); - - /** - * Sets the value of the ' - * {@link org.eclipse.sirius.viewpoint.description.style.BasicLabelStyleDescription#getLabelFormat - * <em>Label Format</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param value - * the new value of the '<em>Label Format</em>' attribute. - * @see org.eclipse.sirius.viewpoint.FontFormat - * @see #getLabelFormat() - * @generated - */ - void setLabelFormat(FontFormat value); + EList<FontFormat> getLabelFormat(); /** * Returns the value of the '<em><b>Show Icon</b></em>' attribute. The diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/StylePackage.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/StylePackage.java index 849a2a1d49..6f447f3acc 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/StylePackage.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/StylePackage.java @@ -401,11 +401,11 @@ public interface StylePackage extends EPackage { EAttribute getBasicLabelStyleDescription_LabelSize(); /** - * Returns the meta object for the attribute ' + * Returns the meta object for the attribute list ' * {@link org.eclipse.sirius.viewpoint.description.style.BasicLabelStyleDescription#getLabelFormat * <em>Label Format</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> * - * @return the meta object for the attribute '<em>Label Format</em>'. + * @return the meta object for the attribute list '<em>Label Format</em>'. * @see org.eclipse.sirius.viewpoint.description.style.BasicLabelStyleDescription#getLabelFormat() * @see #getBasicLabelStyleDescription() * @generated @@ -655,7 +655,7 @@ public interface StylePackage extends EPackage { /** * The meta object literal for the '<em><b>Label Format</b></em>' - * attribute feature. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list feature. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/impl/BasicLabelStyleDescriptionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/impl/BasicLabelStyleDescriptionImpl.java index a4449f0ab7..f97bfe85e3 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/impl/BasicLabelStyleDescriptionImpl.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/impl/BasicLabelStyleDescriptionImpl.java @@ -11,11 +11,15 @@ */ package org.eclipse.sirius.viewpoint.description.style.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.sirius.viewpoint.FontFormat; import org.eclipse.sirius.viewpoint.description.ColorDescription; import org.eclipse.sirius.viewpoint.description.style.BasicLabelStyleDescription; @@ -51,6 +55,7 @@ import org.eclipse.sirius.viewpoint.description.style.StylePackage; * @generated */ public class BasicLabelStyleDescriptionImpl extends MinimalEObjectImpl.Container implements BasicLabelStyleDescription { + /** * The default value of the '{@link #getLabelSize() <em>Label Size</em>}' * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -72,24 +77,14 @@ public class BasicLabelStyleDescriptionImpl extends MinimalEObjectImpl.Container protected int labelSize = BasicLabelStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; /** - * The default value of the '{@link #getLabelFormat() <em>Label Format</em>} - * ' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabelFormat() - * @generated - * @ordered - */ - protected static final FontFormat LABEL_FORMAT_EDEFAULT = FontFormat.NORMAL_LITERAL; - - /** * The cached value of the '{@link #getLabelFormat() <em>Label Format</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getLabelFormat() * @generated * @ordered */ - protected FontFormat labelFormat = BasicLabelStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + protected EList<FontFormat> labelFormat; /** * The default value of the '{@link #isShowIcon() <em>Show Icon</em>}' @@ -212,22 +207,11 @@ public class BasicLabelStyleDescriptionImpl extends MinimalEObjectImpl.Container * @generated */ @Override - public FontFormat getLabelFormat() { - return labelFormat; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setLabelFormat(FontFormat newLabelFormat) { - FontFormat oldLabelFormat = labelFormat; - labelFormat = newLabelFormat == null ? BasicLabelStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT : newLabelFormat; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__LABEL_FORMAT, oldLabelFormat, labelFormat)); + public EList<FontFormat> getLabelFormat() { + if (labelFormat == null) { + labelFormat = new EDataTypeUniqueEList<FontFormat>(FontFormat.class, this, StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__LABEL_FORMAT); } + return labelFormat; } /** @@ -376,6 +360,7 @@ public class BasicLabelStyleDescriptionImpl extends MinimalEObjectImpl.Container * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -383,7 +368,8 @@ public class BasicLabelStyleDescriptionImpl extends MinimalEObjectImpl.Container setLabelSize((Integer) newValue); return; case StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat((FontFormat) newValue); + getLabelFormat().clear(); + getLabelFormat().addAll((Collection<? extends FontFormat>) newValue); return; case StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__SHOW_ICON: setShowIcon((Boolean) newValue); @@ -413,7 +399,7 @@ public class BasicLabelStyleDescriptionImpl extends MinimalEObjectImpl.Container setLabelSize(BasicLabelStyleDescriptionImpl.LABEL_SIZE_EDEFAULT); return; case StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__LABEL_FORMAT: - setLabelFormat(BasicLabelStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT); + getLabelFormat().clear(); return; case StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__SHOW_ICON: setShowIcon(BasicLabelStyleDescriptionImpl.SHOW_ICON_EDEFAULT); @@ -442,7 +428,7 @@ public class BasicLabelStyleDescriptionImpl extends MinimalEObjectImpl.Container case StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__LABEL_SIZE: return labelSize != BasicLabelStyleDescriptionImpl.LABEL_SIZE_EDEFAULT; case StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__LABEL_FORMAT: - return labelFormat != BasicLabelStyleDescriptionImpl.LABEL_FORMAT_EDEFAULT; + return labelFormat != null && !labelFormat.isEmpty(); case StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__SHOW_ICON: return showIcon != BasicLabelStyleDescriptionImpl.SHOW_ICON_EDEFAULT; case StylePackage.BASIC_LABEL_STYLE_DESCRIPTION__LABEL_EXPRESSION: @@ -480,5 +466,4 @@ public class BasicLabelStyleDescriptionImpl extends MinimalEObjectImpl.Container result.append(')'); return result.toString(); } - } // BasicLabelStyleDescriptionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/impl/StylePackageImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/impl/StylePackageImpl.java index 3b5238c0b0..56a0e2666b 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/impl/StylePackageImpl.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/description/style/impl/StylePackageImpl.java @@ -43,6 +43,7 @@ import org.eclipse.sirius.viewpoint.impl.ViewpointPackageImpl; * @generated */ public class StylePackageImpl extends EPackageImpl implements StylePackage { + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @@ -94,7 +95,7 @@ public class StylePackageImpl extends EPackageImpl implements StylePackage { * method {@link #init init()}, which also performs initialization of the * package, or returns the registered package, if one already exists. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.sirius.viewpoint.description.style.StylePackage#eNS_URI * @see #init() @@ -120,7 +121,7 @@ public class StylePackageImpl extends EPackageImpl implements StylePackage { * that field is accessed. Clients should not invoke it directly. Instead, * they should simply access that field to obtain the package. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() @@ -434,7 +435,7 @@ public class StylePackageImpl extends EPackageImpl implements StylePackage { * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public void initializePackageContents() { @@ -467,7 +468,7 @@ public class StylePackageImpl extends EPackageImpl implements StylePackage { EPackageImpl.IS_GENERATED_INSTANCE_CLASS); initEAttribute(getBasicLabelStyleDescription_LabelSize(), theEcorePackage.getEInt(), "labelSize", "8", 0, 1, BasicLabelStyleDescription.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - initEAttribute(getBasicLabelStyleDescription_LabelFormat(), theViewpointPackage.getFontFormat(), "labelFormat", "normal", 0, 1, BasicLabelStyleDescription.class, !EPackageImpl.IS_TRANSIENT, + initEAttribute(getBasicLabelStyleDescription_LabelFormat(), theViewpointPackage.getFontFormat(), "labelFormat", null, 0, 4, BasicLabelStyleDescription.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); initEAttribute(getBasicLabelStyleDescription_ShowIcon(), theEcorePackage.getEBoolean(), "showIcon", "true", 0, 1, BasicLabelStyleDescription.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); @@ -539,5 +540,4 @@ public class StylePackageImpl extends EPackageImpl implements StylePackage { "diagram.DDiagramElement | the current view for which the label is calculated." }); addAnnotation(getTooltipStyleDescription_TooltipExpression(), source, new String[] { "view", "viewpoint.DSemanticDecorator | the current view." }); } - } // StylePackageImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/BasicLabelStyleImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/BasicLabelStyleImpl.java index a313e0ac12..03afc37c51 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/BasicLabelStyleImpl.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/BasicLabelStyleImpl.java @@ -11,9 +11,13 @@ */ package org.eclipse.sirius.viewpoint.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; import org.eclipse.sirius.viewpoint.BasicLabelStyle; import org.eclipse.sirius.viewpoint.FontFormat; import org.eclipse.sirius.viewpoint.RGBValues; @@ -45,6 +49,7 @@ import org.eclipse.sirius.viewpoint.ViewpointPackage; * @generated */ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelStyle { + /** * The default value of the '{@link #getLabelSize() <em>Label Size</em>}' * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -66,24 +71,14 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS protected int labelSize = BasicLabelStyleImpl.LABEL_SIZE_EDEFAULT; /** - * The default value of the '{@link #getLabelFormat() <em>Label Format</em>} - * ' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabelFormat() - * @generated - * @ordered - */ - protected static final FontFormat LABEL_FORMAT_EDEFAULT = FontFormat.NORMAL_LITERAL; - - /** * The cached value of the '{@link #getLabelFormat() <em>Label Format</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getLabelFormat() * @generated * @ordered */ - protected FontFormat labelFormat = BasicLabelStyleImpl.LABEL_FORMAT_EDEFAULT; + protected EList<FontFormat> labelFormat; /** * The default value of the '{@link #isShowIcon() <em>Show Icon</em>}' @@ -194,22 +189,11 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS * @generated */ @Override - public FontFormat getLabelFormat() { - return labelFormat; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setLabelFormat(FontFormat newLabelFormat) { - FontFormat oldLabelFormat = labelFormat; - labelFormat = newLabelFormat == null ? BasicLabelStyleImpl.LABEL_FORMAT_EDEFAULT : newLabelFormat; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ViewpointPackage.BASIC_LABEL_STYLE__LABEL_FORMAT, oldLabelFormat, labelFormat)); + public EList<FontFormat> getLabelFormat() { + if (labelFormat == null) { + labelFormat = new EDataTypeUniqueEList<FontFormat>(FontFormat.class, this, ViewpointPackage.BASIC_LABEL_STYLE__LABEL_FORMAT); } + return labelFormat; } /** @@ -242,8 +226,8 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS * @generated */ @Override - public RGBValues getLabelColor() { - return labelColor; + public String getIconPath() { + return iconPath; } /** @@ -252,11 +236,11 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS * @generated */ @Override - public void setLabelColor(RGBValues newLabelColor) { - RGBValues oldLabelColor = labelColor; - labelColor = newLabelColor; + public void setIconPath(String newIconPath) { + String oldIconPath = iconPath; + iconPath = newIconPath; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ViewpointPackage.BASIC_LABEL_STYLE__LABEL_COLOR, oldLabelColor, labelColor)); + eNotify(new ENotificationImpl(this, Notification.SET, ViewpointPackage.BASIC_LABEL_STYLE__ICON_PATH, oldIconPath, iconPath)); } } @@ -266,8 +250,8 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS * @generated */ @Override - public String getIconPath() { - return iconPath; + public RGBValues getLabelColor() { + return labelColor; } /** @@ -276,11 +260,11 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS * @generated */ @Override - public void setIconPath(String newIconPath) { - String oldIconPath = iconPath; - iconPath = newIconPath; + public void setLabelColor(RGBValues newLabelColor) { + RGBValues oldLabelColor = labelColor; + labelColor = newLabelColor; if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ViewpointPackage.BASIC_LABEL_STYLE__ICON_PATH, oldIconPath, iconPath)); + eNotify(new ENotificationImpl(this, Notification.SET, ViewpointPackage.BASIC_LABEL_STYLE__LABEL_COLOR, oldLabelColor, labelColor)); } } @@ -311,6 +295,7 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -318,7 +303,8 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS setLabelSize((Integer) newValue); return; case ViewpointPackage.BASIC_LABEL_STYLE__LABEL_FORMAT: - setLabelFormat((FontFormat) newValue); + getLabelFormat().clear(); + getLabelFormat().addAll((Collection<? extends FontFormat>) newValue); return; case ViewpointPackage.BASIC_LABEL_STYLE__SHOW_ICON: setShowIcon((Boolean) newValue); @@ -345,7 +331,7 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS setLabelSize(BasicLabelStyleImpl.LABEL_SIZE_EDEFAULT); return; case ViewpointPackage.BASIC_LABEL_STYLE__LABEL_FORMAT: - setLabelFormat(BasicLabelStyleImpl.LABEL_FORMAT_EDEFAULT); + getLabelFormat().clear(); return; case ViewpointPackage.BASIC_LABEL_STYLE__SHOW_ICON: setShowIcon(BasicLabelStyleImpl.SHOW_ICON_EDEFAULT); @@ -371,7 +357,7 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS case ViewpointPackage.BASIC_LABEL_STYLE__LABEL_SIZE: return labelSize != BasicLabelStyleImpl.LABEL_SIZE_EDEFAULT; case ViewpointPackage.BASIC_LABEL_STYLE__LABEL_FORMAT: - return labelFormat != BasicLabelStyleImpl.LABEL_FORMAT_EDEFAULT; + return labelFormat != null && !labelFormat.isEmpty(); case ViewpointPackage.BASIC_LABEL_STYLE__SHOW_ICON: return showIcon != BasicLabelStyleImpl.SHOW_ICON_EDEFAULT; case ViewpointPackage.BASIC_LABEL_STYLE__ICON_PATH: @@ -407,5 +393,4 @@ public class BasicLabelStyleImpl extends CustomizableImpl implements BasicLabelS result.append(')'); return result.toString(); } - } // BasicLabelStyleImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/ViewpointPackageImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/ViewpointPackageImpl.java index a061acb846..22ae0d0804 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/ViewpointPackageImpl.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/ViewpointPackageImpl.java @@ -69,6 +69,7 @@ import org.eclipse.sirius.viewpoint.description.validation.impl.ValidationPackag * @generated */ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPackage { + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @@ -288,7 +289,7 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * method {@link #init init()}, which also performs initialization of the * package, or returns the registered package, if one already exists. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.sirius.viewpoint.ViewpointPackage#eNS_URI * @see #init() @@ -314,7 +315,7 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * that field is accessed. Clients should not invoke it directly. Instead, * they should simply access that field to obtain the package. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() @@ -396,6 +397,16 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * @generated */ @Override + public EAttribute getDAnalysis_SemanticResources() { + return (EAttribute) dAnalysisEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public EReference getDAnalysis_Models() { return (EReference) dAnalysisEClass.getEStructuralFeatures().get(2); } @@ -456,16 +467,6 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * @generated */ @Override - public EAttribute getDAnalysis_SemanticResources() { - return (EAttribute) dAnalysisEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override public EClass getDFeatureExtension() { return dFeatureExtensionEClass; } @@ -786,26 +787,6 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * @generated */ @Override - public EDataType getRGBValues() { - return rgbValuesEDataType; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EDataType getResourceDescriptor() { - return resourceDescriptorEDataType; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override public EClass getDAnalysisSessionEObject() { return dAnalysisSessionEObjectEClass; } @@ -1026,8 +1007,8 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * @generated */ @Override - public EAttribute getBasicLabelStyle_LabelColor() { - return (EAttribute) basicLabelStyleEClass.getEStructuralFeatures().get(4); + public EAttribute getBasicLabelStyle_IconPath() { + return (EAttribute) basicLabelStyleEClass.getEStructuralFeatures().get(3); } /** @@ -1036,8 +1017,8 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * @generated */ @Override - public EAttribute getBasicLabelStyle_IconPath() { - return (EAttribute) basicLabelStyleEClass.getEStructuralFeatures().get(3); + public EAttribute getBasicLabelStyle_LabelColor() { + return (EAttribute) basicLabelStyleEClass.getEStructuralFeatures().get(4); } /** @@ -1096,6 +1077,26 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * @generated */ @Override + public EDataType getRGBValues() { + return rgbValuesEDataType; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EDataType getResourceDescriptor() { + return resourceDescriptorEDataType; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public ViewpointFactory getViewpointFactory() { return (ViewpointFactory) getEFactoryInstance(); } @@ -1234,7 +1235,7 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public void initializePackageContents() { @@ -1433,7 +1434,7 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka initEClass(basicLabelStyleEClass, BasicLabelStyle.class, "BasicLabelStyle", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); initEAttribute(getBasicLabelStyle_LabelSize(), theEcorePackage.getEInt(), "labelSize", "8", 0, 1, BasicLabelStyle.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - initEAttribute(getBasicLabelStyle_LabelFormat(), this.getFontFormat(), "labelFormat", "normal", 0, 1, BasicLabelStyle.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, + initEAttribute(getBasicLabelStyle_LabelFormat(), this.getFontFormat(), "labelFormat", null, 0, 4, BasicLabelStyle.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); initEAttribute(getBasicLabelStyle_ShowIcon(), theEcorePackage.getEBoolean(), "showIcon", "true", 0, 1, BasicLabelStyle.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); @@ -1448,10 +1449,10 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka // Initialize enums and add enum literals initEEnum(fontFormatEEnum, FontFormat.class, "FontFormat"); - addEEnumLiteral(fontFormatEEnum, FontFormat.NORMAL_LITERAL); addEEnumLiteral(fontFormatEEnum, FontFormat.ITALIC_LITERAL); addEEnumLiteral(fontFormatEEnum, FontFormat.BOLD_LITERAL); - addEEnumLiteral(fontFormatEEnum, FontFormat.BOLD_ITALIC_LITERAL); + addEEnumLiteral(fontFormatEEnum, FontFormat.UNDERLINE_LITERAL); + addEEnumLiteral(fontFormatEEnum, FontFormat.STRIKE_THROUGH_LITERAL); initEEnum(labelAlignmentEEnum, LabelAlignment.class, "LabelAlignment"); addEEnumLiteral(labelAlignmentEEnum, LabelAlignment.CENTER); @@ -1485,5 +1486,4 @@ public class ViewpointPackageImpl extends EPackageImpl implements ViewpointPacka addAnnotation(this, source, new String[] { "deprecated", "Anything tagged as deprecated will disappear quite soon.\n\n", "to be renamed", "Anything tagged \"to be renamed\" will be renamed, at least in the UI\n" }); } - } // ViewpointPackageImpl diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/metamodel/helper/FontFormatHelper.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/metamodel/helper/FontFormatHelper.java new file mode 100644 index 0000000000..bb5cf66e43 --- /dev/null +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/metamodel/helper/FontFormatHelper.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * Copyright (c) 2015 THALES GLOBAL SERVICES. + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ + +package org.eclipse.sirius.business.api.metamodel.helper; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.eclipse.sirius.viewpoint.FontFormat; + +import com.google.common.collect.Lists; + +/** + * This class helps to update label format multi valued features. Do not use + * directly add or addAll on {@see BasicLabelStyle#getLabelFormat()}. + * + * @author mbats + */ +public final class FontFormatHelper { + private FontFormatHelper() { + } + + /** + * Set the font format. Pay attention to update the minimum of values and to + * keep the list ordered. + * + * @param labelFormat + * Font format list to update + * @param newValue + * New values + */ + public static void setFontFormat(List<FontFormat> labelFormat, final Collection<? extends FontFormat> newValue) { + // Get elements to add + List<FontFormat> toAdd = Lists.newArrayList(newValue); + toAdd.removeAll(labelFormat); + Collections.sort(toAdd); + + // Get elements to remove + List<FontFormat> toRemove = Lists.newArrayList(labelFormat); + toRemove.removeAll(newValue); + + // Update the list + for (FontFormat fontFormat : toRemove) { + labelFormat.remove(fontFormat); + } + for (FontFormat fontFormat : toAdd) { + labelFormat.add(getIndex(labelFormat, fontFormat), fontFormat); + } + } + + /** + * Set the font format. Pay attention to keep the list ordered. + * + * @param labelFormat + * Font format list to update + * @param newValue + * New value + */ + public static void setFontFormat(List<FontFormat> labelFormat, FontFormat newValue) { + if (labelFormat.contains(newValue)) { + return; + } + + labelFormat.add(getIndex(labelFormat, newValue), newValue); + } + + /** + * Get the index where to add the new label format value. + * + * @param labelFormat + * Label format + * @param newValue + * New value + * @return Index where new value must be added + */ + private static int getIndex(List<FontFormat> labelFormat, FontFormat newValue) { + int index = 0; + for (FontFormat fontFormat : labelFormat) { + if (fontFormat.getValue() > newValue.getValue()) { + return index; + } + index++; + } + return index; + } +} |
