Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » "Initialize by loading" & DocumentRoot
"Initialize by loading" & DocumentRoot [message #423098] Tue, 23 September 2008 07:28 Go to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
Hi,

I saw a strange behavior with my EMF model since I used 2.5M1 (I was
previously using EMF 2.4) :

The generated code cannot instanciate any more objets because the
getESTructuralFeature method seems to return bad initialized
EStructuralFeature objects (For exemple, the createInitialModel of the
generated editor fails).

After looking about this bug, I found that this is happening when an ecore
model is generated from a schema which have elements (so that there is a
generated documentRoot), and when setting the "intialize by loading" to
true (My model is quite large, but it is reproducible with a little one).

I'm very confused with this tricky trouble... How could I manage it ?

Fabrice Dubach
Re: "Initialize by loading" & DocumentRoot [message #423114 is a reply to message #423098] Tue, 23 September 2008 14:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30804
Registered: July 2009
Senior Member
Fabrice,

I tried this with the Library.xsd could run the generated example just
fine, i.e., load the model from the XSD, set Initialize by Loading to
true, General All, and run LibraryExample.java as a Java application...
The editor works too. What could I try to reproduce the problem?


Fabrice Dubach wrote:
> Hi,
>
> I saw a strange behavior with my EMF model since I used 2.5M1 (I was
> previously using EMF 2.4) :
>
> The generated code cannot instanciate any more objets because the
> getESTructuralFeature method seems to return bad initialized
> EStructuralFeature objects (For exemple, the createInitialModel of the
> generated editor fails).
>
> After looking about this bug, I found that this is happening when an ecore
> model is generated from a schema which have elements (so that there is a
> generated documentRoot), and when setting the "intialize by loading" to
> true (My model is quite large, but it is reproducible with a little one).
>
> I'm very confused with this tricky trouble... How could I manage it ?
>
> Fabrice Dubach
>
>
>
Re: "Initialize by loading" & DocumentRoot [message #423123 is a reply to message #423114] Tue, 23 September 2008 14:57 Go to previous messageGo to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
Ed,

Thanks for your helps.
You juste have to add an element declaration in the xsd before loading it,
for exemple :
<xsd:element name="library" type="lib:Library"/>

Fabrice Dubach
Re: "Initialize by loading" & DocumentRoot [message #423124 is a reply to message #423123] Tue, 23 September 2008 15:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30804
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030705010309010805070803
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Fabrice,

The version I use locally is like this and I don't see any problems.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:lib="http://www.example.com/Library"
targetNamespace="http://www.example.com/Library">

<xsd:element name="library" type="lib:Library"/>

<xsd:complexType name="Library">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="books"
type="lib:Book"/>
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="writers" type="lib:Writer"/>
<xsd:element ref="lib:library"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="Book">
<xsd:sequence>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="pages" type="xsd:int"/>
<xsd:element name="category" type="lib:BookCategory"/>
<xsd:element ecore:opposite="books"
ecore:reference="lib:Writer" name="author" type="xsd:anyURI"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="Writer">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element ecore:reference="lib:Book" maxOccurs="unbounded"
minOccurs="0" name="books" type="xsd:anyURI"/>
</xsd:sequence>
</xsd:complexType>

<xsd:simpleType name="BookCategory">
<xsd:restriction base="xsd:NCName">
<xsd:enumeration value="Mystery"/>
<xsd:enumeration value="ScienceFiction"/>
<xsd:enumeration value="Biography"/>
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>




Fabrice Dubach wrote:
> Ed,
>
> Thanks for your helps.
> You juste have to add an element declaration in the xsd before loading it,
> for exemple :
> <xsd:element name="library" type="lib:Library"/>
>
> Fabrice Dubach
>
>
>

--------------030705010309010805070803
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Fabrice,<br>
<br>
The version I use locally is like this and I don't see any problems.<br>
<blockquote><small>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</small><br>
<small>&lt;xsd:schema xmlns:xsd=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
xmlns:ecore=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a>
xmlns:lib=<a class="moz-txt-link-rfc2396E" href="http://www.example.com/Library">"http://www.example.com/Library"</a>
targetNamespace=<a class="moz-txt-link-rfc2396E" href="http://www.example.com/Library">"http://www.example.com/Library"</a>&gt;</small><br>
<br>
<small>&nbsp; &lt;xsd:element name="library" type="lib:Library"/&gt;</small><br>
<br>
<small>&nbsp; &lt;xsd:complexType name="Library"&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="name" type="xsd:string"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element maxOccurs="unbounded" minOccurs="0"
name="books" type="lib:Book"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element maxOccurs="unbounded" minOccurs="0"
name="writers" type="lib:Writer"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element ref="lib:library"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence&gt;</small><br>
<small>&nbsp; &lt;/xsd:complexType&gt;</small><br>
<br>
<small>&nbsp; &lt;xsd:complexType name="Book"&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="title" type="xsd:string"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="pages" type="xsd:int"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="category"
type="lib:BookCategory"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element ecore:opposite="books"
ecore:reference="lib:Writer" name="author" type="xsd:anyURI"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence&gt;</small><br>
<small>&nbsp; &lt;/xsd:complexType&gt;</small><br>
<br>
<small>&nbsp; &lt;xsd:complexType name="Writer"&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp; &lt;xsd:sequence&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="name" type="xsd:string"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element ecore:reference="lib:Book"
maxOccurs="unbounded" minOccurs="0" name="books" type="xsd:anyURI"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence&gt;</small><br>
<small>&nbsp; &lt;/xsd:complexType&gt;</small><br>
<br>
<small>&nbsp; &lt;xsd:simpleType name="BookCategory"&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp; &lt;xsd:restriction base="xsd:NCName"&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:enumeration value="Mystery"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:enumeration value="ScienceFiction"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:enumeration value="Biography"/&gt;</small><br>
<small>&nbsp;&nbsp;&nbsp; &lt;/xsd:restriction&gt;</small><br>
<small>&nbsp; &lt;/xsd:simpleType&gt;</small><br>
<br>
<small>&lt;/xsd:schema&gt;</small><br>
</blockquote>
<br>
<br>
<br>
Fabrice Dubach wrote:
<blockquote cite="mid:gbb04k$var$1@build.eclipse.org" type="cite">
<pre wrap="">Ed,

Thanks for your helps.
You juste have to add an element declaration in the xsd before loading it,
for exemple :
&lt;xsd:element name="library" type="lib:Library"/&gt;

Fabrice Dubach


</pre>
</blockquote>
</body>
</html>

--------------030705010309010805070803--
Re: "Initialize by loading" & DocumentRoot [message #423133 is a reply to message #423124] Tue, 23 September 2008 16:18 Go to previous messageGo to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_006B_01C91DA8.C60B4B70
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I forgot to say that I generate an RCP version, but it seem's to doesn't =
matter anyway...

I made a new clean install and I tried with your file. I did have the =
same issue.=20
My install was made from the Eclipse Ganymede 3.5M1 build 200808071402, =
and the emf- sdo-xsd pack 2.5.0 M1.

I created a new emtpy EMF project, copy & past your xsd file. I =
generated a library.genmodel file loading this xsd in the wizard. I =
modified the "Rich Client Platform" and the "Initialize by loading" =
flags both to true. Than I generated the model code, than the edit code, =
than the Editor Code.

I run the app using the link in the plugin.xml of the generated editor, =
I launched the wizard to create a new library file, than it failed with =
an "FileNotFoudException" (in fact, when I debug it, it failed in the =
createInitialModel method with a null pointer exception)

If I finally changed the "Initialize by loading" flag to false, than =
re-generated the code and it was running good...

What am I doing wrong ? I don't know what to say or to do more... I can =
perhaps send the project in attachment ?

------=_NextPart_000_006B_01C91DA8.C60B4B70
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.6000.16705" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I forgot to say that I generate an RCP =
version, but=20
it seem's to doesn't matter anyway...</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I made a new clean install and I tried =
with your=20
file. I did have the same issue. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>My install was made from the Eclipse =
Ganymede 3.5M1=20
build 200808071402, and the emf- sdo-xsd pack 2.5.0 M1.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I created a new emtpy EMF project, copy =
&amp; past=20
your xsd file. I generated a library.genmodel file loading this xsd in =
the=20
wizard. I modified the "Rich Client Platform" and the "Initialize by =
loading"=20
flags both to true. Than I generated the model code, than the edit code, =
than=20
the Editor Code.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I run the app using the link in the =
plugin.xml of=20
the generated editor, I launched the wizard to create a new library =
file, than=20
it failed with an "FileNotFoudException" (in fact, when I debug it, it =
failed in=20
the createInitialModel method with a null pointer =
exception)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>If I finally changed the "Initialize by =
loading"=20
flag to false, than re-generated the code and it was running=20
good...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>What am I doing wrong ? I don't know =
what to say or=20
to do more... I can perhaps send the project in attachment =
?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_006B_01C91DA8.C60B4B70--
Re: "Initialize by loading" & DocumentRoot [message #423138 is a reply to message #423133] Tue, 23 September 2008 17:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30804
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090300050900040408060806
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Fabrice,

I've seen situations where the .ecore file isn't copied to the bin
folder... This sounds like that kind of case. Can you see the *.ecore
in the bin folder where the .class files are?


Fabrice Dubach wrote:
> I forgot to say that I generate an RCP version, but it seem's to
> doesn't matter anyway...
>
> I made a new clean install and I tried with your file. I did have the
> same issue.
> My install was made from the Eclipse Ganymede 3.5M1 build
> 200808071402, and the emf- sdo-xsd pack 2.5.0 M1.
>
> I created a new emtpy EMF project, copy & past your xsd file. I
> generated a library.genmodel file loading this xsd in the wizard. I
> modified the "Rich Client Platform" and the "Initialize by loading"
> flags both to true. Than I generated the model code, than the edit
> code, than the Editor Code.
>
> I run the app using the link in the plugin.xml of the generated
> editor, I launched the wizard to create a new library file, than it
> failed with an "FileNotFoudException" (in fact, when I debug it, it
> failed in the createInitialModel method with a null pointer exception)
>
> If I finally changed the "Initialize by loading" flag to false, than
> re-generated the code and it was running good...
>
> What am I doing wrong ? I don't know what to say or to do more... I
> can perhaps send the project in attachment ?
>

--------------090300050900040408060806
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Fabrice,<br>
<br>
I've seen situations where the .ecore file isn't copied to the bin
folder...&nbsp; This sounds like that kind of case.&nbsp; Can you see the *.ecore
in the bin folder where the .class files are?<br>
<br>
<br>
Fabrice Dubach wrote:
<blockquote cite="mid:gbb4sk$2vh$1@build.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.6000.16705" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">I forgot to say that I generate an
RCP version, but it seem's to doesn't matter anyway...</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">I made a new clean install and I
tried with your file. I did have the same issue. </font></div>
<div><font face="Arial" size="2">My install was made from the Eclipse
Ganymede 3.5M1 build 200808071402, and the emf- sdo-xsd pack 2.5.0 M1.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">I created a new emtpy EMF project,
copy &amp; past your xsd file. I generated a library.genmodel file
loading this xsd in the wizard. I modified the "Rich Client Platform"
and the "Initialize by loading" flags both to true. Than I generated
the model code, than the edit code, than the Editor Code.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">I run the app using the link in the
plugin.xml of the generated editor, I launched the wizard to create a
new library file, than it failed with an "FileNotFoudException" (in
fact, when I debug it, it failed in the createInitialModel method with
a null pointer exception)</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">If I finally changed the "Initialize
by loading" flag to false, than re-generated the code and it was
running good...</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">What am I doing wrong ? I don't know
what to say or to do more... I can perhaps send the project in
attachment ?</font></div>
<div>&nbsp;</div>
</blockquote>
</body>
</html>

--------------090300050900040408060806--
Re: "Initialize by loading" & DocumentRoot [message #423146 is a reply to message #423138] Tue, 23 September 2008 19:00 Go to previous messageGo to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
Ed,

Yes, I can see it in the bin directory... I verify that is well updated when
I re-generate my code.
Do you have an other idea ?
Perhaps we can compare our project's folders ?
Re: "Initialize by loading" & DocumentRoot [message #423149 is a reply to message #423146] Tue, 23 September 2008 19:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30804
Registered: July 2009
Senior Member
Fabrice,

Does the generated example work? Can you share the full stack trace of
the failure? (You know about looking in the Error Log view or the
<workspace>/.metadata/.log file?) We should publish 3.5M2 today, so
perhaps the problem is gone...


Fabrice Dubach wrote:
> Ed,
>
> Yes, I can see it in the bin directory... I verify that is well updated when
> I re-generate my code.
> Do you have an other idea ?
> Perhaps we can compare our project's folders ?
>
>
>
Re: "Initialize by loading" & DocumentRoot [message #423154 is a reply to message #423149] Tue, 23 September 2008 20:14 Go to previous messageGo to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
> Does the generated example work?
What do you mean by the "generated exemple" ? The mine ? A repository one ?

>We should publish 3.5M2 today, so perhaps the problem is gone...
I hope so, even I would like to understand what's wrong.

> Can you share the full stack trace of the failure? (You know about looking
> in the Error Log view or the <workspace>/.metadata/.log file?)
Here it is (sorry for the size) :

!SESSION 2008-09-23
22:06:58.259 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
Framework arguments: -application
library.editor.LibraryEditorAdvisorApplication
Command-line arguments: -application
library.editor.LibraryEditorAdvisorApplication -data C:\Documents and
Settings\fd\workspace/runtime-library.editor.LibraryEditorAd visorApplication
-dev file:C:/Documents and
Settings/fd/workspace/.metadata/.plugins/org.eclipse.pde.cor e/library.editor.LibraryEditorAdvisorApplication/dev.propert ies
-os win32 -ws win32 -arch x86

!ENTRY library.editor 2 0 2008-09-23 22:07:15.791
!MESSAGE
!STACK 0
java.lang.NullPointerException
at org.eclipse.emf.ecore.util.EcoreUtil.create(EcoreUtil.java:3 206)
at
com.example.library.presentation.LibraryModelWizard.createIn itialModel(LibraryModelWizard.java:202)
at
com.example.library.presentation.LibraryModelWizard$1.run(Li braryModelWizard.java:243)
at
org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:446)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:354)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java: 934)
at
com.example.library.presentation.LibraryModelWizard.performF inish(LibraryModelWizard.java:263)
at
org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDi alog.java:742)
at
org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:373)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:624)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3422)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825 )
at org.eclipse.jface.window.Window.open(Window.java:801)
at
com.example.library.presentation.LibraryActionBarContributor $NewAction.run(LibraryActionBarContributor.java:77)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:251)
at
org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:229)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:583)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:500)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
com.example.library.presentation.LibraryEditorAdvisor$Applic ation.start(LibraryEditorAdvisor.java:107)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:386)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)

!ENTRY org.eclipse.emf.edit.ui 2 0 2008-09-23 22:07:15.822
!MESSAGE lib.library (Le fichier sp
Re: "Initialize by loading" & DocumentRoot [message #423155 is a reply to message #423154] Tue, 23 September 2008 20:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30804
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040509040107070902020104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Frabrice,

When you invoke "Generate Test Code" there will be an XyzExample.java
that should just run as a Java application with no errors...

The wizard code looks like this:

protected EObject createInitialModel()
{
EClass eClass =
ExtendedMetaData.INSTANCE.getDocumentRoot(libraryPackage);
EStructuralFeature eStructuralFeature =
eClass.getEStructuralFeature(initialObjectCreationPage.getIn itialObjectName());
EObject rootObject = libraryFactory.create(eClass);
rootObject.eSet(eStructuralFeature,
EcoreUtil.create((EClass)eStructuralFeature.getEType()));
return rootObject;
}

This implies that the document root EClass is found, but it can't find a
feature with a matching name. Is there something wrong with the
document root's features that there is no matching feature found?

It's hard to imagine given that elsewhere the choices are populated like
this:

protected Collection<String> getInitialObjectNames()
{
if (initialObjectNames == null)
{
initialObjectNames = new ArrayList<String>();
for (EStructuralFeature eStructuralFeature :
ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.IN STANCE.getDocumentRoot(libraryPackage)))
{
if (eStructuralFeature.isChangeable())
{
EClassifier eClassifier = eStructuralFeature.getEType();
if (eClassifier instanceof EClass)
{
EClass eClass = (EClass)eClassifier;
if (!eClass.isAbstract())
{
initialObjectNames.add(eStructuralFeature.getName());
// If you add this code does it ever print false?
System.put.println("?" +
(eClass.getEStructuralFeature(eStructuralFeature.getName()) ==
eStructuralFeature));

}
}
}
}



Fabrice Dubach wrote:
>> Does the generated example work?
>>
> What do you mean by the "generated exemple" ? The mine ? A repository one ?
>
>
>> We should publish 3.5M2 today, so perhaps the problem is gone...
>>
> I hope so, even I would like to understand what's wrong.
>
>
>> Can you share the full stack trace of the failure? (You know about looking
>> in the Error Log view or the <workspace>/.metadata/.log file?)
>>
> Here it is (sorry for the size) :
>
> !SESSION 2008-09-23
> 22:06:58.259 -----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.6.0_07
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
> Framework arguments: -application
> library.editor.LibraryEditorAdvisorApplication
> Command-line arguments: -application
> library.editor.LibraryEditorAdvisorApplication -data C:\Documents and
> Settings\fd\workspace/runtime-library.editor.LibraryEditorAd visorApplication
> -dev file:C:/Documents and
> Settings/fd/workspace/.metadata/.plugins/org.eclipse.pde.cor e/library.editor.LibraryEditorAdvisorApplication/dev.propert ies
> -os win32 -ws win32 -arch x86
>
> !ENTRY library.editor 2 0 2008-09-23 22:07:15.791
> !MESSAGE
> !STACK 0
> java.lang.NullPointerException
> at org.eclipse.emf.ecore.util.EcoreUtil.create(EcoreUtil.java:3 206)
> at
> com.example.library.presentation.LibraryModelWizard.createIn itialModel(LibraryModelWizard.java:202)
> at
> com.example.library.presentation.LibraryModelWizard$1.run(Li braryModelWizard.java:243)
> at
> org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:446)
> at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:354)
> at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java: 934)
> at
> com.example.library.presentation.LibraryModelWizard.performF inish(LibraryModelWizard.java:263)
> at
> org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDi alog.java:742)
> at
> org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:373)
> at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:624)
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:228)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3823)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3422)
> at org.eclipse.jface.window.Window.runEventLoop(Window.java:825 )
> at org.eclipse.jface.window.Window.open(Window.java:801)
> at
> com.example.library.presentation.LibraryActionBarContributor $NewAction.run(LibraryActionBarContributor.java:77)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:251)
> at
> org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:229)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:583)
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:500)
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3823)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3422)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> com.example.library.presentation.LibraryEditorAdvisor$Applic ation.start(LibraryEditorAdvisor.java:107)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:386)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
>
> !ENTRY org.eclipse.emf.edit.ui 2 0 2008-09-23 22:07:15.822
> !MESSAGE lib.library (Le fichier sp
Re: "Initialize by loading" & DocumentRoot [message #423156 is a reply to message #423155] Tue, 23 September 2008 21:11 Go to previous messageGo to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
The exemple test code failed, the console output is :

Enter a list of file paths or URIs that have content like this:
Exception in thread "main" java.lang.ClassCastException: The feature
'library's type 'null' does not permit a value of type 'Library'
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$BasicFeatu reMapEntry.validate(EStructuralFeatureImpl.java:2909)
at
org.eclipse.emf.ecore.util.FeatureMapUtil.createEntry(Featur eMapUtil.java:181)
at
org.eclipse.emf.ecore.util.BasicFeatureMap.createEntry(Basic FeatureMap.java:102)
at org.eclipse.emf.ecore.util.BasicFeatureMap.set(BasicFeatureM ap.java:1216)
at
com.example.library.impl.DocumentRootImpl.setLibrary(Documen tRootImpl.java:156)
at com.example.library.tests.LibraryExample.main(LibraryExample .java:70)

What I saw when I tryed to debug my own model (before I found that a
simplier model like the library's one could reproduce this behavior) is that
the EStructuralFeature objects was well instanciated (including the name
attribute), but not its EType attribut. So, in the createInitialModel, the
eStructuralFeature is found but it is the EcoreUtil.create which failed.
Re: "Initialize by loading" & DocumentRoot [message #423157 is a reply to message #423156] Tue, 23 September 2008 21:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30804
Registered: July 2009
Senior Member
Fabrice,

So this has nothing to do with RCP anyway. Yet all this works for me.
I vaguely recall Dave having done something related to this which caused
a problem that was subsequently fixed. Please try the M2 build when it
comes out, or the most recent I build. Sorry for the hassle...


Fabrice Dubach wrote:
> The exemple test code failed, the console output is :
>
> Enter a list of file paths or URIs that have content like this:
> Exception in thread "main" java.lang.ClassCastException: The feature
> 'library's type 'null' does not permit a value of type 'Library'
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$BasicFeatu reMapEntry.validate(EStructuralFeatureImpl.java:2909)
> at
> org.eclipse.emf.ecore.util.FeatureMapUtil.createEntry(Featur eMapUtil.java:181)
> at
> org.eclipse.emf.ecore.util.BasicFeatureMap.createEntry(Basic FeatureMap.java:102)
> at org.eclipse.emf.ecore.util.BasicFeatureMap.set(BasicFeatureM ap.java:1216)
> at
> com.example.library.impl.DocumentRootImpl.setLibrary(Documen tRootImpl.java:156)
> at com.example.library.tests.LibraryExample.main(LibraryExample .java:70)
>
> What I saw when I tryed to debug my own model (before I found that a
> simplier model like the library's one could reproduce this behavior) is that
> the EStructuralFeature objects was well instanciated (including the name
> attribute), but not its EType attribut. So, in the createInitialModel, the
> eStructuralFeature is found but it is the EcoreUtil.create which failed.
>
>
>
Re: "Initialize by loading" & DocumentRoot [message #423158 is a reply to message #423157] Tue, 23 September 2008 21:39 Go to previous messageGo to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
Ed,

Thank you for the time you spent. That's what I thought also about the RCP.
I look forward to the M2 and I'll keep you abreast.

Fabrice Dubach

"Ed Merks" <Ed.Merks@gmail.com> a
Re: "Initialize by loading" & DocumentRoot [message #423165 is a reply to message #423158] Wed, 24 September 2008 07:05 Go to previous messageGo to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
Ed,

I tried with your latest integration build, as you expected, the problem was
fixed.

Thanks,

Fabrice Dubach
Re: "Initialize by loading" & DocumentRoot [message #423174 is a reply to message #423165] Wed, 24 September 2008 11:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30804
Registered: July 2009
Senior Member
Fabrice,

Sorry you wasted your time on it. :-(


Fabrice Dubach wrote:
> Ed,
>
> I tried with your latest integration build, as you expected, the problem was
> fixed.
>
> Thanks,
>
> Fabrice Dubach
>
>
>
Previous Topic:Problems with read-only resources in an editing domain
Next Topic:Finding an CDOObject based on its intrinsic ID
Goto Forum:
  


Current Time: Sun Jan 19 19:34:21 GMT 2020

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

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

Back to the top