diff options
| author | Mélanie Bats | 2016-01-21 15:25:05 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2016-01-21 15:45:41 +0000 |
| commit | 18eee6912ff84f61c5a1c0d7b44a79b8672ba0be (patch) | |
| tree | d3c77f92027ff81be7a853e4989500c3c0e244ce | |
| parent | c5936dfac7409960e869e179cb1a8107b5019e68 (diff) | |
| download | org.eclipse.sirius-18eee6912ff84f61c5a1c0d7b44a79b8672ba0be.tar.gz org.eclipse.sirius-18eee6912ff84f61c5a1c0d7b44a79b8672ba0be.tar.xz org.eclipse.sirius-18eee6912ff84f61c5a1c0d7b44a79b8672ba0be.zip | |
[482528] Contribute label description to the view extension description
A new LabelDescription is defined in properties.ecore.
The LabelDescription is a new kind of widget which describes
a label in the properties view.
Bug: 482528
Change-Id: I3d3354a60e0f71b460287147cc5bac2bbb351a62
Signed-off-by: Mélanie Bats <melanie.bats@obeo.fr>
18 files changed, 483 insertions, 35 deletions
diff --git a/incubation/org.eclipse.sirius.properties.edit/icons/full/ctool16/CreateContainerDescription_widgets_LabelDescription.gif b/incubation/org.eclipse.sirius.properties.edit/icons/full/ctool16/CreateContainerDescription_widgets_LabelDescription.gif Binary files differnew file mode 100644 index 0000000000..1027a3df4c --- /dev/null +++ b/incubation/org.eclipse.sirius.properties.edit/icons/full/ctool16/CreateContainerDescription_widgets_LabelDescription.gif diff --git a/incubation/org.eclipse.sirius.properties.edit/icons/full/obj16/LabelDescription.gif b/incubation/org.eclipse.sirius.properties.edit/icons/full/obj16/LabelDescription.gif Binary files differnew file mode 100644 index 0000000000..89ad5da38a --- /dev/null +++ b/incubation/org.eclipse.sirius.properties.edit/icons/full/obj16/LabelDescription.gif diff --git a/incubation/org.eclipse.sirius.properties.edit/plugin.properties b/incubation/org.eclipse.sirius.properties.edit/plugin.properties index 7098fc2862..90e160fbec 100644 --- a/incubation/org.eclipse.sirius.properties.edit/plugin.properties +++ b/incubation/org.eclipse.sirius.properties.edit/plugin.properties @@ -48,3 +48,4 @@ _UI_WidgetDescription_labelExpression_feature = Label Expression _UI_TextDescription_valueExpression_feature = Value Expression _UI_TextDescription_initialOperation_feature = Initial Operation _UI_Unknown_feature = Unspecified +_UI_LabelDescription_type = Label Description diff --git a/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ContainerDescriptionItemProvider.java b/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ContainerDescriptionItemProvider.java index 7816d70aa8..290fd7eb2a 100644 --- a/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ContainerDescriptionItemProvider.java +++ b/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ContainerDescriptionItemProvider.java @@ -192,6 +192,11 @@ public class ContainerDescriptionItemProvider (createChildParameter (PropertiesPackage.Literals.CONTAINER_DESCRIPTION__WIDGETS, PropertiesFactory.eINSTANCE.createTextDescription())); + + newChildDescriptors.add + (createChildParameter + (PropertiesPackage.Literals.CONTAINER_DESCRIPTION__WIDGETS, + PropertiesFactory.eINSTANCE.createLabelDescription())); } /** diff --git a/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/LabelDescriptionItemProvider.java b/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/LabelDescriptionItemProvider.java new file mode 100644 index 0000000000..dd044f3d8c --- /dev/null +++ b/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/LabelDescriptionItemProvider.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) 2015 Obeo. + * 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.properties.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; + +import org.eclipse.sirius.properties.LabelDescription; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.properties.LabelDescription} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class LabelDescriptionItemProvider extends WidgetDescriptionItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public LabelDescriptionItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This returns LabelDescription.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/LabelDescription")); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) { + String label = ((LabelDescription)object).getIdentifier(); + return label == null || label.length() == 0 ? + getString("_UI_LabelDescription_type") : + getString("_UI_LabelDescription_type") + " " + label; + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/PropertiesItemProviderAdapterFactory.java b/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/PropertiesItemProviderAdapterFactory.java index a6d1c8e4db..b8300e2b9f 100644 --- a/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/PropertiesItemProviderAdapterFactory.java +++ b/incubation/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/PropertiesItemProviderAdapterFactory.java @@ -213,6 +213,29 @@ public class PropertiesItemProviderAdapterFactory extends PropertiesAdapterFacto } /** + * This keeps track of the one adapter used for all {@link org.eclipse.sirius.properties.LabelDescription} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected LabelDescriptionItemProvider labelDescriptionItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.properties.LabelDescription}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createLabelDescriptionAdapter() { + if (labelDescriptionItemProvider == null) { + labelDescriptionItemProvider = new LabelDescriptionItemProvider(this); + } + + return labelDescriptionItemProvider; + } + + /** * This returns the root adapter factory that contains this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -316,6 +339,7 @@ public class PropertiesItemProviderAdapterFactory extends PropertiesAdapterFacto if (groupDescriptionItemProvider != null) groupDescriptionItemProvider.dispose(); if (containerDescriptionItemProvider != null) containerDescriptionItemProvider.dispose(); if (textDescriptionItemProvider != null) textDescriptionItemProvider.dispose(); + if (labelDescriptionItemProvider != null) labelDescriptionItemProvider.dispose(); } /** diff --git a/incubation/org.eclipse.sirius.properties/model/properties.ecore b/incubation/org.eclipse.sirius.properties/model/properties.ecore index c884bb5e1b..ec77a622f1 100644 --- a/incubation/org.eclipse.sirius.properties/model/properties.ecore +++ b/incubation/org.eclipse.sirius.properties/model/properties.ecore @@ -51,4 +51,5 @@ eType="ecore:EClass ../../org.eclipse.sirius/model/viewpoint.ecore#//description/tool/InitialOperation" containment="true"/> </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="LabelDescription" eSuperTypes="#//WidgetDescription"/> </ecore:EPackage> diff --git a/incubation/org.eclipse.sirius.properties/model/properties.genmodel b/incubation/org.eclipse.sirius.properties/model/properties.genmodel index dd717f9401..1027c7c8e3 100644 --- a/incubation/org.eclipse.sirius.properties/model/properties.genmodel +++ b/incubation/org.eclipse.sirius.properties/model/properties.genmodel @@ -45,5 +45,6 @@ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute properties.ecore#//TextDescription/valueExpression"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference properties.ecore#//TextDescription/initialOperation"/> </genClasses> + <genClasses ecoreClass="properties.ecore#//LabelDescription"/> </genPackages> </genmodel:GenModel> diff --git a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/LabelDescription.java b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/LabelDescription.java new file mode 100644 index 0000000000..e239533e0c --- /dev/null +++ b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/LabelDescription.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2015 Obeo. + * 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.properties; + + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Label Description</b></em>'. + * <!-- end-user-doc --> + * + * + * @see org.eclipse.sirius.properties.PropertiesPackage#getLabelDescription() + * @model + * @generated + */ +public interface LabelDescription extends WidgetDescription { +} // LabelDescription diff --git a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/PropertiesFactory.java b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/PropertiesFactory.java index 7730a5c02b..528ad16845 100644 --- a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/PropertiesFactory.java +++ b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/PropertiesFactory.java @@ -76,6 +76,15 @@ public interface PropertiesFactory extends EFactory { TextDescription createTextDescription(); /** + * Returns a new object of class '<em>Label Description</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Label Description</em>'. + * @generated + */ + LabelDescription createLabelDescription(); + + /** * Returns the package supported by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/PropertiesPackage.java b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/PropertiesPackage.java index 79d9b7cf90..2f3dcc3796 100644 --- a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/PropertiesPackage.java +++ b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/PropertiesPackage.java @@ -398,6 +398,44 @@ public interface PropertiesPackage extends EPackage { /** + * The meta object id for the '{@link org.eclipse.sirius.properties.impl.LabelDescriptionImpl <em>Label Description</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.sirius.properties.impl.LabelDescriptionImpl + * @see org.eclipse.sirius.properties.impl.PropertiesPackageImpl#getLabelDescription() + * @generated + */ + int LABEL_DESCRIPTION = 6; + + /** + * The feature id for the '<em><b>Identifier</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LABEL_DESCRIPTION__IDENTIFIER = WIDGET_DESCRIPTION__IDENTIFIER; + + /** + * The feature id for the '<em><b>Label Expression</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LABEL_DESCRIPTION__LABEL_EXPRESSION = WIDGET_DESCRIPTION__LABEL_EXPRESSION; + + /** + * The number of structural features of the '<em>Label Description</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LABEL_DESCRIPTION_FEATURE_COUNT = WIDGET_DESCRIPTION_FEATURE_COUNT + 0; + + + /** * Returns the meta object for class '{@link org.eclipse.sirius.properties.ViewExtensionDescription <em>View Extension Description</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -700,6 +738,16 @@ public interface PropertiesPackage extends EPackage { EReference getTextDescription_InitialOperation(); /** + * Returns the meta object for class '{@link org.eclipse.sirius.properties.LabelDescription <em>Label Description</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Label Description</em>'. + * @see org.eclipse.sirius.properties.LabelDescription + * @generated + */ + EClass getLabelDescription(); + + /** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -957,6 +1005,16 @@ public interface PropertiesPackage extends EPackage { */ EReference TEXT_DESCRIPTION__INITIAL_OPERATION = eINSTANCE.getTextDescription_InitialOperation(); + /** + * The meta object literal for the '{@link org.eclipse.sirius.properties.impl.LabelDescriptionImpl <em>Label Description</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.sirius.properties.impl.LabelDescriptionImpl + * @see org.eclipse.sirius.properties.impl.PropertiesPackageImpl#getLabelDescription() + * @generated + */ + EClass LABEL_DESCRIPTION = eINSTANCE.getLabelDescription(); + } } //PropertiesPackage diff --git a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/LabelDescriptionImpl.java b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/LabelDescriptionImpl.java new file mode 100644 index 0000000000..ea94f3c543 --- /dev/null +++ b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/LabelDescriptionImpl.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2015 Obeo. + * 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.properties.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.sirius.properties.LabelDescription; +import org.eclipse.sirius.properties.PropertiesPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Label Description</b></em>'. + * <!-- end-user-doc --> + * <p> + * </p> + * + * @generated + */ +public class LabelDescriptionImpl extends WidgetDescriptionImpl implements LabelDescription { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected LabelDescriptionImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return PropertiesPackage.Literals.LABEL_DESCRIPTION; + } + +} //LabelDescriptionImpl diff --git a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesFactoryImpl.java b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesFactoryImpl.java index 90a824dca7..b1d6689a0d 100644 --- a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesFactoryImpl.java +++ b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesFactoryImpl.java @@ -70,6 +70,7 @@ public class PropertiesFactoryImpl extends EFactoryImpl implements PropertiesFac case PropertiesPackage.GROUP_DESCRIPTION: return createGroupDescription(); case PropertiesPackage.CONTAINER_DESCRIPTION: return createContainerDescription(); case PropertiesPackage.TEXT_DESCRIPTION: return createTextDescription(); + case PropertiesPackage.LABEL_DESCRIPTION: return createLabelDescription(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -130,6 +131,16 @@ public class PropertiesFactoryImpl extends EFactoryImpl implements PropertiesFac * <!-- end-user-doc --> * @generated */ + public LabelDescription createLabelDescription() { + LabelDescriptionImpl labelDescription = new LabelDescriptionImpl(); + return labelDescription; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public PropertiesPackage getPropertiesPackage() { return (PropertiesPackage)getEPackage(); } diff --git a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java index 566c64318f..52db0ac19e 100644 --- a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java +++ b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java @@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.impl.EPackageImpl; import org.eclipse.sirius.properties.ContainerDescription; import org.eclipse.sirius.properties.GroupDescription; +import org.eclipse.sirius.properties.LabelDescription; import org.eclipse.sirius.properties.PageDescription; import org.eclipse.sirius.properties.PropertiesFactory; import org.eclipse.sirius.properties.PropertiesPackage; @@ -84,6 +85,13 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac private EClass textDescriptionEClass = null; /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass labelDescriptionEClass = null; + + /** * Creates an instance of the model <b>Package</b>, registered with * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package * package URI value. @@ -404,6 +412,15 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac * <!-- end-user-doc --> * @generated */ + public EClass getLabelDescription() { + return labelDescriptionEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public PropertiesFactory getPropertiesFactory() { return (PropertiesFactory)getEFactoryInstance(); } @@ -460,6 +477,8 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac textDescriptionEClass = createEClass(TEXT_DESCRIPTION); createEAttribute(textDescriptionEClass, TEXT_DESCRIPTION__VALUE_EXPRESSION); createEReference(textDescriptionEClass, TEXT_DESCRIPTION__INITIAL_OPERATION); + + labelDescriptionEClass = createEClass(LABEL_DESCRIPTION); } /** @@ -497,6 +516,7 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac // Add supertypes to classes viewExtensionDescriptionEClass.getESuperTypes().add(theDescriptionPackage.getExtension()); textDescriptionEClass.getESuperTypes().add(this.getWidgetDescription()); + labelDescriptionEClass.getESuperTypes().add(this.getWidgetDescription()); // Initialize classes and features; add operations and parameters initEClass(viewExtensionDescriptionEClass, ViewExtensionDescription.class, "ViewExtensionDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -533,6 +553,8 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac initEAttribute(getTextDescription_ValueExpression(), theDescriptionPackage.getInterpretedExpression(), "valueExpression", null, 0, 1, TextDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getTextDescription_InitialOperation(), theToolPackage.getInitialOperation(), null, "initialOperation", null, 1, 1, TextDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(labelDescriptionEClass, LabelDescription.class, "LabelDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + // Create resource createResource(eNS_URI); } diff --git a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/util/PropertiesAdapterFactory.java b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/util/PropertiesAdapterFactory.java index d1624f4817..8d009379f6 100644 --- a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/util/PropertiesAdapterFactory.java +++ b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/util/PropertiesAdapterFactory.java @@ -103,6 +103,10 @@ public class PropertiesAdapterFactory extends AdapterFactoryImpl { return createTextDescriptionAdapter(); } @Override + public Adapter caseLabelDescription(LabelDescription object) { + return createLabelDescriptionAdapter(); + } + @Override public Adapter caseExtension(Extension object) { return createExtensionAdapter(); } @@ -211,6 +215,20 @@ public class PropertiesAdapterFactory extends AdapterFactoryImpl { } /** + * Creates a new adapter for an object of class '{@link org.eclipse.sirius.properties.LabelDescription <em>Label Description</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.sirius.properties.LabelDescription + * @generated + */ + public Adapter createLabelDescriptionAdapter() { + return null; + } + + /** * Creates a new adapter for an object of class '{@link org.eclipse.sirius.viewpoint.description.Extension <em>Extension</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; diff --git a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/util/PropertiesSwitch.java b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/util/PropertiesSwitch.java index 3bce2f8887..670a2cc148 100644 --- a/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/util/PropertiesSwitch.java +++ b/incubation/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/util/PropertiesSwitch.java @@ -132,6 +132,13 @@ public class PropertiesSwitch<T> { if (result == null) result = defaultCase(theEObject); return result; } + case PropertiesPackage.LABEL_DESCRIPTION: { + LabelDescription labelDescription = (LabelDescription)theEObject; + T result = caseLabelDescription(labelDescription); + if (result == null) result = caseWidgetDescription(labelDescription); + if (result == null) result = defaultCase(theEObject); + return result; + } default: return defaultCase(theEObject); } } @@ -227,6 +234,21 @@ public class PropertiesSwitch<T> { } /** + * Returns the result of interpreting the object as an instance of '<em>Label Description</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Label Description</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLabelDescription(LabelDescription object) { + return null; + } + + /** * Returns the result of interpreting the object as an instance of '<em>Extension</em>'. * <!-- begin-user-doc --> * This implementation returns null; diff --git a/incubation/org.eclipse.sirius.sample.properties/description/project.odesign b/incubation/org.eclipse.sirius.sample.properties/description/project.odesign index 47e1c46be3..1e27ee55ed 100644 --- a/incubation/org.eclipse.sirius.sample.properties/description/project.odesign +++ b/incubation/org.eclipse.sirius.sample.properties/description/project.odesign @@ -1,43 +1,124 @@ <?xml version="1.0" encoding="UTF-8"?> -<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:properties="http://www.eclipse.org/sirius/properties/1.0.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/description/tool/1.1.0" name="project" version="11.0.0.201511131800"> - <ownedViewpoints name="Design"> - <ownedRepresentations xsi:type="description_1:DiagramDescription" name="Class Diagram" domainClass="ecore.EPackage" enablePopupBars="true"> - <defaultLayer name="Default"> - <containerMappings name="CD_Class" domainClass="ecore.EClass" childrenPresentation="List"> - <subNodeMappings name="CD_Attribute" semanticCandidatesExpression="feature:eAllContents" domainClass="ecore.EAttribute"> - <style xsi:type="style:BundledImageDescription" labelPosition="node" resizeKind="NSEW"> - <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> - <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> - <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> +<description:Group + xmi:version="2.0" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" + xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" + xmlns:properties="http://www.eclipse.org/sirius/properties/1.0.0" + xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" + xmlns:tool="http://www.eclipse.org/sirius/description/tool/1.1.0" + name="project" + version="11.0.0.201511131800"> + <ownedViewpoints + name="Design"> + <ownedRepresentations + xsi:type="description_1:DiagramDescription" + name="Class Diagram" + domainClass="ecore.EPackage" + enablePopupBars="true"> + <defaultLayer + name="Default"> + <containerMappings + name="CD_Class" + domainClass="ecore.EClass" + childrenPresentation="List"> + <subNodeMappings + name="CD_Attribute" + semanticCandidatesExpression="feature:eAllContents" + domainClass="ecore.EAttribute"> + <style + xsi:type="style:BundledImageDescription" + labelPosition="node" + resizeKind="NSEW"> + <borderColor + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <color + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> </style> </subNodeMappings> - <subNodeMappings name="CD_Reference" semanticCandidatesExpression="feature:eAllContents" domainClass="ecore.EReference"> - <style xsi:type="style:BundledImageDescription" labelPosition="node" resizeKind="NSEW"> - <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> - <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> - <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <subNodeMappings + name="CD_Reference" + semanticCandidatesExpression="feature:eAllContents" + domainClass="ecore.EReference"> + <style + xsi:type="style:BundledImageDescription" + labelPosition="node" + resizeKind="NSEW"> + <borderColor + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <color + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> </style> </subNodeMappings> - <style xsi:type="style:FlatContainerStyleDescription" borderSizeComputationExpression="1"> - <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> - <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> - <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> - <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_gray']"/> + <style + xsi:type="style:FlatContainerStyleDescription" + borderSizeComputationExpression="1"> + <borderColor + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + <foregroundColor + xsi:type="description:SystemColor" + href="environment:/viewpoint#//@systemColors/@entries[name='light_gray']"/> </style> </containerMappings> </defaultLayer> </ownedRepresentations> </ownedViewpoints> - <extensions xsi:type="properties:ViewExtensionDescription" identifier="Properties" defaultPage="//@extensions.0/@pages.0" labelExpression="aql:self.name" preconditionExpression=""> - <pages identifier="All EClass attributes" labelExpression="aql:self.name" domainClass="ecore.EAttribute" semanticCandidateExpression="aql:self.eContents(ecore::EAttribute)" groups="//@extensions.0/@groups.0"/> - <pages identifier="Single EAttribute" labelExpression="aql:self.name" domainClass="ecore.EAttribute" semanticCandidateExpression="var:self" groups="//@extensions.0/@groups.0"/> - <groups identifier="EAttribute properties" labelExpression="" domainClass="ecore.EAttribute" semanticCandidateExpression=""> + <extensions + xsi:type="properties:ViewExtensionDescription" + identifier="Properties" + defaultPage="//@extensions.0/@pages.0" + labelExpression="aql:self.name" + preconditionExpression=""> + <pages identifier="All EClass attributes" + labelExpression="aql:self.name" + domainClass="ecore.EAttribute" + semanticCandidateExpression="aql:self.eContents(ecore::EAttribute)" + groups="//@extensions.0/@groups.0"/> + <pages identifier="Single EAttribute" + labelExpression="aql:self.name" + domainClass="ecore.EAttribute" + semanticCandidateExpression="var:self" + groups="//@extensions.0/@groups.0"/> + <groups + identifier="EAttribute properties" + labelExpression="" + domainClass="ecore.EAttribute" + semanticCandidateExpression=""> <container> - <widgets xsi:type="properties:TextDescription" identifier="Name" labelExpression="Name" valueExpression="feature:name"> + <widgets + xsi:type="properties:TextDescription" + identifier="Name" + labelExpression="Name" + valueExpression="feature:name"> <initialOperation> - <firstModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="aql:newValue"/> + <firstModelOperations + xsi:type="tool:SetValue" + featureName="name" + valueExpression="aql:newValue"/> </initialOperation> </widgets> + <widgets + xsi:type="properties:LabelDescription" + identifier="Label" + labelExpression="feature:name"/> </container> </groups> </extensions> diff --git a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/ViewDescriptionConverter.java b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/ViewDescriptionConverter.java index 5826520408..9a4e7343cb 100644 --- a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/ViewDescriptionConverter.java +++ b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/ViewDescriptionConverter.java @@ -18,6 +18,7 @@ import java.util.regex.Pattern; import org.eclipse.eef.EEFContainerDescription; import org.eclipse.eef.EEFGroupDescription; +import org.eclipse.eef.EEFLabelDescription; import org.eclipse.eef.EEFPageDescription; import org.eclipse.eef.EEFTextDescription; import org.eclipse.eef.EEFViewDescription; @@ -30,6 +31,7 @@ import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.common.interpreter.api.IEvaluationResult; import org.eclipse.sirius.common.interpreter.api.IInterpreter; import org.eclipse.sirius.properties.GroupDescription; +import org.eclipse.sirius.properties.LabelDescription; import org.eclipse.sirius.properties.PageDescription; import org.eclipse.sirius.properties.TextDescription; import org.eclipse.sirius.properties.WidgetDescription; @@ -141,13 +143,13 @@ public class ViewDescriptionConverter { */ private EEFGroupDescription createGroup(GroupDescription groupDescription, EObject groupTarget, EEFViewDescription view) { EEFGroupDescription group = EefFactory.eINSTANCE.createEEFGroupDescription(); - group.setIdentifier(groupDescription.getIdentifier()); - // TODO: should be setLabel() - group.setLabelExpression(computeString(groupTarget, groupDescription.getLabelExpression())); - - convertGroupContents(groupDescription, group); - view.getGroups().add(group); - return group; + group.setIdentifier(groupDescription.getIdentifier()); + // TODO: should be setLabel() + group.setLabelExpression(computeString(groupTarget, groupDescription.getLabelExpression())); + + convertGroupContents(groupDescription, group); + view.getGroups().add(group); + return group; } private void convertGroupContents(GroupDescription groupDescription, EEFGroupDescription group) { @@ -156,6 +158,8 @@ public class ViewDescriptionConverter { for (WidgetDescription widgetDescription : groupDescription.getContainer().getWidgets()) { if (widgetDescription instanceof TextDescription) { containerDesc.getWidgets().add(createEEFTextDescription((TextDescription) widgetDescription)); + } else if (widgetDescription instanceof LabelDescription) { + containerDesc.getWidgets().add(createEEFLabelDescription((LabelDescription) widgetDescription)); } } @@ -174,6 +178,14 @@ public class ViewDescriptionConverter { return eefTextDescription; } + private EEFLabelDescription createEEFLabelDescription(LabelDescription labelDescription) { + EEFLabelDescription eefLabelDescription = EefFactory.eINSTANCE.createEEFLabelDescription(); + + eefLabelDescription.setIdentifier(labelDescription.getIdentifier()); + eefLabelDescription.setLabelExpression(labelDescription.getLabelExpression()); + return eefLabelDescription; + } + private static Map<String, Object> singletonEnv(String name, Object value) { Map<String, Object> env = Maps.newHashMap(); env.put(name, value); @@ -199,9 +211,10 @@ public class ViewDescriptionConverter { return Collections.emptyList(); } } - + /** - * Tests if a string is blank (i.e. null, empty, or containing only whitespace). + * Tests if a string is blank (i.e. null, empty, or containing only + * whitespace). * * @param s * the string to test. |
