Cause an unsettable EInt attribute to be unset by default? [message #1142338] |
Thu, 17 October 2013 15:00 |
Eclipse User |
|
|
|
Hello everybody.
In E4 we have a modelled UI. Our Window class has 4 integer attributes to represent the x, y, height, and width of the window. We'd like to make these unsettable by default. When unset, they default to wherever the OS chooses to place the window; when set, they are used to force the window bounds.
Is there any way to modify the .ecore to cause these fields to default to an unset state? Or do I have to modify the generated WindowImpl to set the appropriate __ESet variables?
/**
* The default value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected static final int X_EDEFAULT = 0;
/**
* The cached value of the '{@link #getX() <em>X</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getX()
* @generated
* @ordered
*/
protected int x = X_EDEFAULT;
/**
* This is true if the X attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean xESet;
Thanks!
Brian.
|
|
|
|
Re: Cause an unsettable EInt attribute to be unset by default? [message #1142421 is a reply to message #1142366] |
Thu, 17 October 2013 16:07 |
Eclipse User |
|
|
|
Thanks for the reply Ed. I had already done what you suggested (I should have included the extract from the .ecore), but it makes no difference. I suspect it's because EInts have a default of 0, and not null like a reference object.
<eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
unsettable="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="<p>
The 'X' position of this window
</p>"/>
</eAnnotations>
</eStructuralFeatures>
Brian.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03211 seconds