EMF Spreadsheet Model [message #656976] |
Tue, 01 March 2011 08:56 |
Antoine Messages: 22 Registered: February 2011 Location: Toulouse, France |
Junior Member |
|
|
Hello everyone !
I've made a simple spreadsheet model (that you can see at the end of this post) with EMF (Ecore and Ecore Diag).
I've generated the Model Code, Edit and Editor plugins by EMF but when I define a relatedHeader in a Cell with an already defined HeaderElement (method setRelatedHeader(HeaderElement e)), it seems to work but when I load the ressource in the editor, it fails and I have this error for each Cell where there is a relatedHeader:
org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'spreadsheet.impl.LineImpl@dbe4e5 (num: 2)' is not legal. (platform:/resource/Test/model/Example.spreadsheet, 37, 67)
[...]
Caused by: java.lang.ClassCastException: spreadsheet.impl.LineImpl cannot be cast to spreadsheet.HeaderElement
[...]
If I open the file with a XML editor, this one looks fine :
<?xml version="1.0" encoding="ASCII"?>
<spreadsheet:Spreadsheet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:spreadsheet="spreadsheet" name="ExampleICD">
<containedSheets name="TestSheet1">
<containedLines num="2">
<containedCells content="Value1" x="1" y="2"relatedHeader="1"/>
<containedCells content="12" x="2" y="2" relatedHeader="2"/>
</containedLines>
<containedLines num="3">
<containedCells content="Value2" x="1" y="3" relatedHeader="1"/>
<containedCells content="54" x="2" y="3" relatedHeader="2"/>
</containedLines>
<header content="Name" x="1" y="1" relatedHeader="1" id="1"/>
<header content="Value" x="2" y="1" relatedHeader="2" id="2"/>
</containedSheets>
</spreadsheet:Spreadsheet>
If I didn't create any relatedHeader in a Cell, the editor accepts to open it.
So is it a modelisation error, or a bug from me or EMF ? Anybody knows ?
Thank you
Antoine
|
|
|
Re: EMF Spreadsheet Model [message #657079 is a reply to message #656976] |
Tue, 01 March 2011 14:38 |
Ed Merks Messages: 33133 Registered: July 2009 |
Senior Member |
|
|
Antoine,
Comments below.
Antoine wrote:
> Hello everyone !
>
> I've made a simple spreadsheet model (that you can see at the end of
> this post) with EMF (Ecore and Ecore Diag).
No, I don't see them.
>
> I've generated the Model Code, Edit and Editor plugins by EMF but when
> I define a relatedHeader in a Cell with an already defined
> HeaderElement (method setRelatedHeader(HeaderElement e)), it seems to
> work but when I load the ressource in the editor, it fails and I have
> this error for each Cell where there is a relatedHeader:
>
> org.eclipse.emf.ecore.xmi.IllegalValueException: Value
> 'spreadsheet.impl.LineImpl@dbe4e5 (num: 2)' is not legal.
> (platform:/resource/Test/model/Example.spreadsheet, 37, 67)
> [...]
> Caused by: java.lang.ClassCastException: spreadsheet.impl.LineImpl
> cannot be cast to spreadsheet.HeaderElement
Is it possible that you have more than one object with the same ID, i.e,
with ID "1" or "2"? Even if the objects are of different type, the ID
must be unique within the resource. Try invoking "Validate..." in the
editor before you save to check for this.
> [...]
>
> If I open the file with a XML editor, this one looks fine :
> <?xml version="1.0" encoding="ASCII"?>
> <spreadsheet:Spreadsheet xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI" xmlns:spreadsheet="spreadsheet"
> name="ExampleICD">
> <containedSheets name="TestSheet1">
> <containedLines num="2">
> <containedCells content="Value1" x="1" y="2"relatedHeader="1"/>
> <containedCells content="12" x="2" y="2" relatedHeader="2"/>
> </containedLines>
> <containedLines num="3">
> <containedCells content="Value2" x="1" y="3" relatedHeader="1"/>
> <containedCells content="54" x="2" y="3" relatedHeader="2"/>
> </containedLines>
> <header content="Name" x="1" y="1" relatedHeader="1" id="1"/>
> <header content="Value" x="2" y="1" relatedHeader="2" id="2"/>
> </containedSheets>
> </spreadsheet:Spreadsheet>
>
> If I didn't create any relatedHeader in a Cell, the editor accepts to
> open it.
>
> So is it a modelisation error, or a bug from me or EMF ? Anybody knows ?
I suspect you're using num and id as IDs and that there are two things
with ID "2".
>
> Thank you
>
> Antoine
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02049 seconds