Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Spreadsheet Model(Cannot use a generated method)
EMF Spreadsheet Model [message #656976] Tue, 01 March 2011 08:56 Go to next message
Antoine  is currently offline Antoine Friend
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

http://www.uploadimage.co.uk/images/23792165268833398437.png
Re: EMF Spreadsheet Model [message #657079 is a reply to message #656976] Tue, 01 March 2011 14:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
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
>
>
Re: EMF Spreadsheet Model [message #657255 is a reply to message #657079] Wed, 02 March 2011 08:36 Go to previous message
Antoine  is currently offline Antoine Friend
Messages: 22
Registered: February 2011
Location: Toulouse, France
Junior Member
Hello Ed Merks !

This is the image url: http://www.uploadimage.co.uk/images/23792165268833398437.png can't you see it ?

But never mind, it was that you say. I have and ID for Lines (num), another ID for Cells (id) but I didn't know that ID notion was global, if I distinguish IDs, everything works fine.

Thank you Ed, and Thank you for the EMF Second Edition book, this one helps me so much !! Smile

Antoine
Previous Topic:Package Registry at Development Time
Next Topic:ECore Cardinality & Optionality Issue
Goto Forum:
  


Current Time: Sun Oct 20 11:38:10 GMT 2019

Powered by FUDForum. Page generated in 0.01847 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top