EEF generated classes do not compile [message #500537] |
Thu, 26 November 2009 09:48  |
Eclipse User |
|
|
|
Hello there,
I have installed the latest nightly build of EEF to try it out.
Some of the generated EditionComponent classes do not compile
here is the faulty generated code :
///////////////////////////////////// start of code
/**
* Initialize the semantic model listener for live editing mode
*
* @return the semantic model listener
*/
private AdapterImpl initializeSemanticAdapter() {
return new EContentAdapter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged (org.eclipse.emf.common.notify.Notification)
*/
public void notifyChanged(Notification msg) {
if (basePart == null)
BackgroundColorPropertiesEditionComponent.this.dispose();
else {
if (PropertiesPackage.eINSTANCE.getBackgroundColor_Value().equa ls(msg.getFeature()) && basePart != null){
if (msg.getNewValue() != null)//////////////////////////// comment from SeB : here is the faulty code !!!
//FIXME invalid case in liveUpdater(), Case : model = Attribute(1) : value - view = Text
else
basePart.setValue("");
}
}
}
};
}
///////////////////////////////////// end of code
Can you tell me what is going wrong ?
Than you.
SeB.
PS : here is the my ecore metamodel.
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="css"
nsURI="http://www.nds.com/skinning/Css" nsPrefix="css">
<eClassifiers xsi:type="ecore:EClass" name="Model">
<eStructuralFeatures xsi:type="ecore:EReference" name="cssBlocks" upperBound="-1"
eType="#//CssBlocks" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="comments" upperBound="-1"
eType="#//Comments" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="CssBlocks">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="selector" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="properties" upperBound="-1"
eType="#//properties/Property" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Comments">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="beforeComments" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="testSampleUrlList" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="afterComments" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eSubpackages name="properties" nsURI="http://www.nds.com/skinning/Css/properties"
nsPrefix="properties">
<eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true"/>
<eClassifiers xsi:type="ecore:EClass" name="Color" eSuperTypes="#//properties/Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1"
eType="#//datatypes/RgbColor"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BackgroundColor" eSuperTypes="#//properties/Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1"
eType="#//datatypes/RgbColor"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AnyOther" eSuperTypes="#//properties/Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FontFamily" eSuperTypes="#//properties/Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fontList" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BackgroundImage" eSuperTypes="#//properties/Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1"
eType="#//datatypes/Uri"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Visibility" eSuperTypes="#//properties/Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1"
eType="#//datatypes/VISIBILITY"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FontSize" eSuperTypes="#//properties/Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="size" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BackgroundRepeat" eSuperTypes="#//properties/Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1"
eType="#//datatypes/BACKGROUND_REPEAT"/>
</eClassifiers>
</eSubpackages>
<eSubpackages name="datatypes" nsURI="http://www.nds.com/skinning/Css/datatypes"
nsPrefix="datatypes">
<eClassifiers xsi:type="ecore:EDataType" name="RgbColor" instanceClassName="org.eclipse.swt.graphics.RGB"/>
<eClassifiers xsi:type="ecore:EDataType" name="Uri" instanceClassName="java.net.URI"/>
<eClassifiers xsi:type="ecore:EEnum" name="VISIBILITY">
<eLiterals name="VISIBLE" literal="visible"/>
<eLiterals name="HIDDEN" value="1" literal="hidden"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="BACKGROUND_REPEAT">
<eLiterals name="REPEAT" literal="repeat"/>
<eLiterals name="REPEAT_X" value="1" literal="repeat-x"/>
<eLiterals name="REPEAT_Y" value="2" literal="repeat-y"/>
<eLiterals name="NO_REPEAT" value="3" literal="no-repeat"/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>
|
|
|
|
|
|
Re: EEF generated classes do not compile [message #500948 is a reply to message #500905] |
Mon, 30 November 2009 07:31  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------060804070303070404040600
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
hi Seb,
This is indeed what we are actually doing :)
In the next integration version of EEF, you would be able to do so.
Cheers,
seb.fr a
|
|
|
Re: EEF generated classes do not compile [message #621622 is a reply to message #500627] |
Fri, 27 November 2009 04:04  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------010809070708090700020201
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Hi again,
Sorry i just looked to your metamodel and here is the problem :
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
lowerBound="1"
eType="#//datatypes/RgbColor"/>
you are trying to map a custom edatatype ( rgbcolor ) with a text. this
is not supported now by EEF.
you can avoid this generated part by replacing your element editor
"background_value" with a "custom element editor". EEF will generates
empty code that needs to be filled by you to handle th mapping manually.
cheers,
Stéphane Bouchet a écrit :
> Hi Seb,
>
> It looks like your EEF component models contains some mapping that are
> not yet supported by the generation.
>
> typically, you are trying to map the colorbackground feature with a text
> widget. What is the EType used by this feature ?
>
> Cheers,
>
>
> seb.fr a écrit :
>> Hello there,
>>
>> I have installed the latest nightly build of EEF to try it out.
>> Some of the generated EditionComponent classes do not compile
>> here is the faulty generated code :
>>
>> ///////////////////////////////////// start of code
>> /**
>> * Initialize the semantic model listener for live editing mode
>> * * @return the semantic model listener
>> */
>> private AdapterImpl initializeSemanticAdapter() {
>> return new EContentAdapter() {
>>
>> /**
>> * {@inheritDoc}
>> * * @see
>> org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged
>> (org.eclipse.emf.common.notify.Notification)
>> */
>> public void notifyChanged(Notification msg) {
>> if (basePart == null)
>>
>> BackgroundColorPropertiesEditionComponent.this.dispose();
>> else {
>> if
>> (PropertiesPackage.eINSTANCE.getBackgroundColor_Value().equa
>> ls(msg.getFeature()) && basePart != null){
>> if (msg.getNewValue() !=
>> null)//////////////////////////// comment from SeB : here is the
>> faulty code !!!
>> //FIXME invalid case in liveUpdater(), Case : model = Attribute(1) :
>> value - view = Text
>> else
>> basePart.setValue("");
>> }
>>
>>
>> }
>> }
>>
>> };
>> }
>> ///////////////////////////////////// end of code
>>
>> Can you tell me what is going wrong ?
>>
>> Than you.
>>
>> SeB.
>>backgrou
>> PS : here is the my ecore metamodel.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ecore:EPackage xmi:version="2.0"
>> xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="css"
>> nsURI="http://www.nds.com/skinning/Css" nsPrefix="css">
>> <eClassifiers xsi:type="ecore:EClass" name="Model">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="cssBlocks"
>> upperBound="-1"
>> eType="#//CssBlocks" containment="true"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="comments"
>> upperBound="-1"
>> eType="#//Comments" containment="true"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="CssBlocks">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="selector"
>> lowerBound="1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="properties"
>> upperBound="-1"
>> eType="#//properties/Property" containment="true"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Comments">
>> <eStructuralFeatures xsi:type="ecore:EAttribute"
>> name="beforeComments" upperBound="-1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute"
>> name="testSampleUrlList" upperBound="-1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute"
>> name="afterComments" upperBound="-1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> </eClassifiers>
>> <eSubpackages name="properties"
>> nsURI="http://www.nds.com/skinning/Css/properties"
>> nsPrefix="properties">
>> <eClassifiers xsi:type="ecore:EClass" name="Property"
>> abstract="true"/>
>> <eClassifiers xsi:type="ecore:EClass" name="Color"
>> eSuperTypes="#//properties/Property">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
>> lowerBound="1"
>> eType="#//datatypes/RgbColor"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="BackgroundColor"
>> eSuperTypes="#//properties/Property">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
>> lowerBound="1"
>> eType="#//datatypes/RgbColor"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="AnyOther"
>> eSuperTypes="#//properties/Property">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> lowerBound="1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
>> lowerBound="1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="FontFamily"
>> eSuperTypes="#//properties/Property">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="fontList"
>> upperBound="-1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="BackgroundImage"
>> eSuperTypes="#//properties/Property">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
>> lowerBound="1"
>> eType="#//datatypes/Uri"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="Visibility"
>> eSuperTypes="#//properties/Property">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
>> lowerBound="1"
>> eType="#//datatypes/VISIBILITY"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="FontSize"
>> eSuperTypes="#//properties/Property">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="size"
>> lowerBound="1"
>> eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="BackgroundRepeat"
>> eSuperTypes="#//properties/Property">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
>> lowerBound="1"
>> eType="#//datatypes/BACKGROUND_REPEAT"/>
>> </eClassifiers>
>> </eSubpackages>
>> <eSubpackages name="datatypes"
>> nsURI="http://www.nds.com/skinning/Css/datatypes"
>> nsPrefix="datatypes">
>> <eClassifiers xsi:type="ecore:EDataType" name="RgbColor"
>> instanceClassName="org.eclipse.swt.graphics.RGB"/>
>> <eClassifiers xsi:type="ecore:EDataType" name="Uri"
>> instanceClassName="java.net.URI"/>
>> <eClassifiers xsi:type="ecore:EEnum" name="VISIBILITY">
>> <eLiterals name="VISIBLE" literal="visible"/>
>> <eLiterals name="HIDDEN" value="1" literal="hidden"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EEnum" name="BACKGROUND_REPEAT">
>> <eLiterals name="REPEAT" literal="repeat"/>
>> <eLiterals name="REPEAT_X" value="1" literal="repeat-x"/>
>> <eLiterals name="REPEAT_Y" value="2" literal="repeat-y"/>
>> <eLiterals name="NO_REPEAT" value="3" literal="no-repeat"/>
>> </eClassifiers>
>> </eSubpackages>
>> </ecore:EPackage>
>>
>
--------------010809070708090700020201
Content-Type: text/x-vcard; charset=utf-8;
name="stephane_bouchet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="stephane_bouchet.vcf"
YmVnaW46dmNhcmQNCmZuO3F1b3RlZC1wcmludGFibGU6U3Q9QzM9QTlwaGFu ZSBCb3VjaGV0
DQpuO3F1b3RlZC1wcmludGFibGU6Qm91Y2hldDtTdD1DMz1BOXBoYW5lDQpv cmc6T2Jlbw0K
YWRyO3F1b3RlZC1wcmludGFibGU6Ozs7UmV6PUMzPUE5Ozs0NDQwMDtGcmFu Y2UNCmVtYWls
O2ludGVybmV0OnN0ZXBoYW5lLmJvdWNoZXRAb2Jlby5mcg0KeC1tb3ppbGxh LWh0bWw6RkFM
U0UNCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------010809070708090700020201--
|
|
|
Re: EEF generated classes do not compile [message #621860 is a reply to message #500630] |
Mon, 30 November 2009 04:20  |
Eclipse User |
|
|
|
Originally posted by: sgandon.nds.com
Hi Stéphane,
if this is a matter of data type conversion I would suggest EEF uses the default EMF conversion behaviour.
EMF creates data conversion methods when the genmodel is used for generation.
There are 2 methods
createMyDataFromString()
and
convertMyDataToString()
found in the factory implementation class that serves this purpose in EMF genererated code (look at Data Type section in http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.html).
So I would suggest that EEF use the
org.eclipse.emf.ecore.util.EcoreUtil.createFromString(EDataT ype eDataType,java.lang.String literal)
org.eclipse.emf.ecore.util.EcoreUtil.convertToString(EDataTy pe eDataType, java.lang.Object value)
for converting the Data to and from text.
This would allow for default EEF generation without any error.
SeB.
[quote title=Stephane Bouchet wrote on Fri, 27 November 2009 04:04]This is a multi-part message in MIME format.
--------------010809070708090700020201
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Hi again,
Sorry i just looked to your metamodel and here is the problem :
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
lowerBound="1"
eType="#//datatypes/RgbColor"/>
you are trying to map a custom edatatype ( rgbcolor ) with a text. this
is not supported now by EEF.
you can avoid this generated part by replacing your element editor
"background_value" with a "custom element editor". EEF will generates
empty code that needs to be filled by you to handle th mapping manually.
cheers,
|
|
|
Re: EEF generated classes do not compile [message #621867 is a reply to message #500905] |
Mon, 30 November 2009 07:31  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------060804070303070404040600
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
hi Seb,
This is indeed what we are actually doing :)
In the next integration version of EEF, you would be able to do so.
Cheers,
seb.fr a
|
|
|
Powered by
FUDForum. Page generated in 0.04697 seconds