Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Customization of XML serialization
Customization of XML serialization [message #419038] Thu, 08 May 2008 20:13 Go to next message
VincentL is currently offline VincentLFriend
Messages: 88
Registered: July 2009
Member
Hi,

I developped a model with EMF and I want to serialize it with a custom
XML output format.

Here is a brief overview of the contents of my package

MyPackage
TestFile EClass
children EReference 0..*
... with EAttributes
Variable EClass
value EAttribute
name EAttribute
... with other Eattributes
Test Eclass
... with EAttributes
Step Eclass
... with EAttributes
Other Eclasses


I modified the default options of the xml serializatoin and got the
following output:


//---------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<TestFile xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<children xsi:type="Variable" value="myValue1">
<name>myVariableName1</name>
</children>
<children xsi:type="Step">
<children xsi:type="Variable" value="myValue2">
<name>myVariableName1</name>
</children>
</children>
</TestFile>
//---------------------------------------


The current modified XML options are:
ext.setQualified(SeqeditorPackage.eINSTANCE, false);
options.put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
options.put(XMLResource.OPTION_KEEP_DEFAULT_CONTENT, true);


Here are some customization questions:

1- Is is possible to remove all "xsi:" string from the type attributes?

type="Variable" instead of xsi:type="Variable"

2- Is is possible to add a root element <tm> that will include all xml
tag (including the TestFile element)?

3- Is is possible to remove all "xmi", "xmlns:xmi" and "xmlns:xsi"
attribute of the TestFile element?
If necessary these attributes can be set on the <tm> root element. (But
not in the TestFile.

4- Is is possible to output the value of the "value" attribute of the
class variable directly in the body of the xml output instead of adding
a attribute to the xml "variable" tag element.

<child type="variable">myValue1
<name>myVariableName1</name>
</child>

instead of

<child type="variable" value="myValue1">
<name>myVariableName1</name>
</child>

In fact the "Variable" EClass is very special and I would prefer to use
its name attribute as class Name. It is possible to do this?

<myVariableName1>myValue1</myVariableName1>

Thanks a lot.

Vincent
Re: Customization of XML serialization [message #419040 is a reply to message #419038] Thu, 08 May 2008 20:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080107060104090406010605
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Vincent,

You'd need to use substitution groups to eliminate xsi:types.

http://ed-merks.blogspot.com/2007/12/winters-icy-grip.html

More comments below.

Vincent L. wrote:
> Hi,
>
> I developped a model with EMF and I want to serialize it with a custom
> XML output format.
>
> Here is a brief overview of the contents of my package
>
> MyPackage
> TestFile EClass
> children EReference 0..*
> ... with EAttributes
> Variable EClass
> value EAttribute
> name EAttribute
> ... with other Eattributes
> Test Eclass
> ... with EAttributes
> Step Eclass
> ... with EAttributes
> Other Eclasses
>
>
> I modified the default options of the xml serializatoin and got the
> following output:
>
>
> //---------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <TestFile xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <children xsi:type="Variable" value="myValue1">
> <name>myVariableName1</name>
> </children>
> <children xsi:type="Step">
> <children xsi:type="Variable" value="myValue2">
> <name>myVariableName1</name>
> </children>
> </children>
> </TestFile>
> //---------------------------------------
>
>
> The current modified XML options are:
> ext.setQualified(SeqeditorPackage.eINSTANCE, false);
> options.put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
> options.put(XMLResource.OPTION_KEEP_DEFAULT_CONTENT, true);
>
>
> Here are some customization questions:
>
> 1- Is is possible to remove all "xsi:" string from the type attributes?
>
> type="Variable" instead of xsi:type="Variable"
Not and still have it mean the same as xsi:type. It's meta data bout the
type, not just regular data in your model.
>
> 2- Is is possible to add a root element <tm> that will include all xml
> tag (including the TestFile element)?
If you have a global element for that...
>
> 3- Is is possible to remove all "xmi", "xmlns:xmi" and "xmlns:xsi"
> attribute of the TestFile element?
> If necessary these attributes can be set on the <tm> root element.
> (But not in the TestFile.
If you use an XMLResourceImpl instead of an XMIResourceImpl you can get
rid of the xmi stuff. The xsi will only go away if you use substitution
groups.
>
> 4- Is is possible to output the value of the "value" attribute of the
> class variable directly in the body of the xml output instead of
> adding a attribute to the xml "variable" tag element.
You can do with for a complex type with mixed content, but this seems
quite odd to me...
>
> <child type="variable">myValue1
> <name>myVariableName1</name>
> </child>
>
> instead of
>
> <child type="variable" value="myValue1">
> <name>myVariableName1</name>
> </child>
>
> In fact the "Variable" EClass is very special and I would prefer to
> use its name attribute as class Name. It is possible to do this?
>
> <myVariableName1>myValue1</myVariableName1>
I don't think so.
>
> Thanks a lot.
The best I can suggest is you try to write an XML Schema to describes
your syntax and base your model on that...
>
> Vincent


--------------080107060104090406010605
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">
Vincent,<br>
<br>
You'd need to use substitution groups to eliminate xsi:types.<br>
<blockquote><a
href="http://ed-merks.blogspot.com/2007/12/winters-icy-grip.html">http://ed-merks.blogspot.com/2007/12/winters-icy-grip.html</a><br>
</blockquote>
More comments below.<br>
<br>
Vincent L. wrote:
<blockquote cite="mid:fvvmsd$o8p$1@build.eclipse.org" type="cite">Hi,
<br>
<br>
I developped a model with EMF and I want to serialize it with a custom
XML output format.
<br>
<br>
Here is a brief overview of the contents of my package
<br>
<br>
MyPackage
<br>
&nbsp;&nbsp;&nbsp;&nbsp;TestFile EClass
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; children EReference 0..*
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ... with EAttributes
<br>
&nbsp;&nbsp;&nbsp;&nbsp;Variable EClass
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; value EAttribute
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; name EAttribute
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ... with other Eattributes
<br>
&nbsp;&nbsp;&nbsp;&nbsp;Test Eclass
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ... with EAttributes
<br>
&nbsp;&nbsp;&nbsp;&nbsp;Step Eclass
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ... with EAttributes
<br>
&nbsp;&nbsp;&nbsp;&nbsp;Other Eclasses
<br>
<br>
<br>
I modified the default options of the xml serializatoin and got the
following output:
<br>
<br>
<br>
//---------------------------------------
<br>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<br>
&lt;TestFile xmi:version="2.0" xmlns:xmi=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/XMI">"http://www.omg.org/XMI"</a>
xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>&gt;
<br>
&nbsp; &lt;children xsi:type="Variable" value="myValue1"&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt; myVariableName1&lt;/name&gt;
<br>
&nbsp; &lt;/children&gt;
<br>
&nbsp; &lt;children xsi:type="Step"&gt;
<br>
&nbsp;&nbsp;&nbsp; &lt;children xsi:type="Variable" value="myValue2"&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt; myVariableName1&lt;/name&gt;
<br>
&nbsp;&nbsp;&nbsp; &lt;/children&gt;
<br>
&nbsp; &lt;/children&gt;
<br>
&lt;/TestFile&gt;
<br>
//---------------------------------------
<br>
<br>
<br>
The current modified XML options are:
<br>
&nbsp;&nbsp;&nbsp;&nbsp;ext.setQualified(Seq editorPackage.eINSTANCE, false);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;options.put(XMLResou rce.OPTION_EXTENDED_META_DATA, ext);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;options.put(XMLResou rce.OPTION_KEEP_DEFAULT_CONTENT, true);
<br>
<br>
<br>
Here are some customization questions:
<br>
<br>
1- Is is possible to remove all "xsi:" string from the type attributes?
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;type="Variable" instead of xsi:type="Variable"
<br>
</blockquote>
Not and still have it mean the same as xsi:type. It's meta data bout
the type, not just regular data in your model.<br>
<blockquote cite="mid:fvvmsd$o8p$1@build.eclipse.org" type="cite"><br>
2- Is is possible to add a root element &lt;tm&gt; that will include
all xml tag (including the TestFile element)?
<br>
</blockquote>
If you have a global element for that...<br>
<blockquote cite="mid:fvvmsd$o8p$1@build.eclipse.org" type="cite"><br>
3- Is is possible to remove all "xmi", "xmlns:xmi" and "xmlns:xsi"
attribute of the TestFile element?
<br>
If necessary these attributes can be set on the &lt;tm&gt; root
element. (But not in the TestFile.
<br>
</blockquote>
If you use an XMLResourceImpl instead of an XMIResourceImpl you can get
rid of the xmi stuff.&nbsp; The xsi will only go away if you use
substitution groups.<br>
<blockquote cite="mid:fvvmsd$o8p$1@build.eclipse.org" type="cite"><br>
4- Is is possible to output the value of the "value" attribute of the
class variable directly in the body of the xml output instead of adding
a attribute to the xml "variable" tag element.
<br>
</blockquote>
You can do with for a complex type with mixed content, but this seems
quite odd to me...<br>
<blockquote cite="mid:fvvmsd$o8p$1@build.eclipse.org" type="cite"><br>
&lt;child type="variable"&gt;myValue1
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt; myVariableName1&lt;/name&gt;
<br>
&lt;/child&gt;
<br>
<br>
instead of
<br>
<br>
&lt;child type="variable" value="myValue1"&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt; myVariableName1&lt;/name&gt;
<br>
&lt;/child&gt;
<br>
<br>
In fact the "Variable" EClass is very special and I would prefer to use
its name attribute as class Name. It is possible to do this?
<br>
<br>
&lt;myVariableName1&gt;myValue1&lt;/myVariableNa me1&gt;
<br>
</blockquote>
I don't think so.<br>
<blockquote cite="mid:fvvmsd$o8p$1@build.eclipse.org" type="cite"><br>
Thanks a lot.
<br>
</blockquote>
The best I can suggest is you try to write an XML Schema to describes
your syntax and base your model on that...<br>
<blockquote cite="mid:fvvmsd$o8p$1@build.eclipse.org" type="cite"><br>
Vincent
<br>
</blockquote>
<br>
</body>
</html>

--------------080107060104090406010605--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customization of XML serialization [message #419154 is a reply to message #419040] Fri, 09 May 2008 22:55 Go to previous messageGo to next message
VincentL is currently offline VincentLFriend
Messages: 88
Registered: July 2009
Member
Thanks Ed, your answers help me.

Here is another question:

1- When I set the option "setQualified" of my Package to false, the
loading process throw an assertion. Note, that the file was save with
the same options.

Here are my routines to load and save my model. It come from the
generated editor of my model where I only insert the code that adds the
ExtentedMetaData. (It's possible that the code below is not running, I
removed some lines for the purpose of the question...)

If I set the setQualified to true, it works well.

I also attach the assertion message.

Thanks a lot

Vincent



//-------------------------------------------
final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED,
Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);

// Save the resources to the file system.
boolean first = true;
for (Resource resource : editingDomain.getResourceSet().getResources()) {
if ((first || !resource.getContents().isEmpty() ||
isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {

savedResources.add(resource);

final ExtendedMetaData ext = new BasicExtendedMetaData(
ExtendedMetaData.ANNOTATION_URI,
EPackage.Registry.INSTANCE, new HashMap());
ext.setQualified(SeqeditorPackage.eINSTANCE, false);
saveOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, ext);

resource.save(saveOptions);
first = false;
}
}


//-------------------------------------------
URI resourceURI = EditUIUtil.getURI(getEditorInput());
Exception exception = null;
Resource resource = null;
Map<Object, Object> loadOptions =
editingDomain.getResourceSet().getLoadOptions();

final ExtendedMetaData ext = new BasicExtendedMetaData(
ExtendedMetaData.ANNOTATION_URI,
EPackage.Registry.INSTANCE, new HashMap());
ext.setQualified(SeqeditorPackage.eINSTANCE, false);
loadOptions .put(XMLResource.OPTION_EXTENDED_META_DATA, ext);

resource = editingDomain.getResourceSet().getResource(resourceURI, true);
//--------------------------------------------


Here is the assertion:

org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:109)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:95)
at
org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiP ageEditorPart.java:695)
at
org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Mu ltiPageEditorPart.java:287)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:661)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:426)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
at
org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(Ed itorAreaHelper.java:263)
at
org.eclipse.ui.internal.EditorManager.setVisibleEditor(Edito rManager.java:1405)
at
org.eclipse.ui.internal.EditorManager$5.runWithException(Edi torManager.java:939)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:129)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
at
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:801)
at
org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1342)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:129)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
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: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
Re: Customization of XML serialization [message #419155 is a reply to message #419154] Fri, 09 May 2008 23:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Vincent,

Comments below.

Vincent L. wrote:
> Thanks Ed, your answers help me.
>
> Here is another question:
>
> 1- When I set the option "setQualified" of my Package to false, the
> loading process throw an assertion. Note, that the file was save with
> the same options.
It would be good to see the file.
>
> Here are my routines to load and save my model. It come from the
> generated editor of my model where I only insert the code that adds
> the ExtentedMetaData. (It's possible that the code below is not
> running, I removed some lines for the purpose of the question...)
So the code is maybe meaningless?
>
> If I set the setQualified to true, it works well.
This case I would expect to see a namespace in the serialization.
Otherwise, I'd expect the namespace of the root element to be null. If
you try this case by using a schema with a null namespace, you'll see
all the code that's generate for this case.
>
> I also attach the assertion message.
>
> Thanks a lot
>
> Vincent
>
>
>
> //-------------------------------------------
> final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
> saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED,
> Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
>
> // Save the resources to the file system.
> boolean first = true;
> for (Resource resource : editingDomain.getResourceSet().getResources()) {
> if ((first || !resource.getContents().isEmpty() ||
> isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
>
> savedResources.add(resource);
>
> final ExtendedMetaData ext = new BasicExtendedMetaData(
> ExtendedMetaData.ANNOTATION_URI,
> EPackage.Registry.INSTANCE, new HashMap());
> ext.setQualified(SeqeditorPackage.eINSTANCE, false);
So I would imagine your intent is for your saved instance will have a
null namespace? Is that the actual result? I'd suggest trying this
scenario with a null target namespace schema an looking closely at the
generate resource factory...
> saveOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
>
> resource.save(saveOptions);
> first = false;
> }
> }
>
>
> //-------------------------------------------
> URI resourceURI = EditUIUtil.getURI(getEditorInput());
> Exception exception = null;
> Resource resource = null;
> Map<Object, Object> loadOptions =
> editingDomain.getResourceSet().getLoadOptions();
>
> final ExtendedMetaData ext = new BasicExtendedMetaData(
> ExtendedMetaData.ANNOTATION_URI,
> EPackage.Registry.INSTANCE, new HashMap());
> ext.setQualified(SeqeditorPackage.eINSTANCE, false);
> loadOptions .put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
>
> resource = editingDomain.getResourceSet().getResource(resourceURI, true);
> //--------------------------------------------
>
>
> Here is the assertion:
>
> org.eclipse.core.runtime.AssertionFailedException: assertion failed:
> at org.eclipse.core.runtime.Assert.isTrue(Assert.java:109)
> at org.eclipse.core.runtime.Assert.isTrue(Assert.java:95)
> at
> org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiP ageEditorPart.java:695)
>
> at
> org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Mu ltiPageEditorPart.java:287)
>
> at
> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:661)
>
> at
> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:426)
>
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
>
> at
> org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(Ed itorAreaHelper.java:263)
>
> at
> org.eclipse.ui.internal.EditorManager.setVisibleEditor(Edito rManager.java:1405)
>
> at
> org.eclipse.ui.internal.EditorManager$5.runWithException(Edi torManager.java:939)
>
> at
> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:129)
>
> at
> org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
> at
> org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:801)
>
> at
> org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1342)
>
> at
> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:129)
>
> at
> org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
>
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
>
> 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: 508)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
I'll bet there is a cause to this exception which you've not shown...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customization of XML serialization [message #419158 is a reply to message #419155] Sat, 10 May 2008 11:21 Go to previous messageGo to next message
VincentL is currently offline VincentLFriend
Messages: 88
Registered: July 2009
Member
Thanks Ed,

See answers below.

Thanks again.

Vincent


Ed Merks wrote:
> Vincent,
>
> Comments below.
>
> Vincent L. wrote:

>> Thanks Ed, your answers help me.
>>
>> Here is another question:
>>
>> 1- When I set the option "setQualified" of my Package to false, the
>> loading process throw an assertion. Note, that the file was save with
>> the same options.

> It would be good to see the file.

<?xml version="1.0" encoding="UTF-8"?>
<tm xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<child xsi:type="TestFile">
<child xsi:type="Variable">
<name>MyVariable1</name>
<value>myValue</value>
</child>
<child xsi:type="Loop">
<child xsi:type="Step">
<name>MyStep1</name>
<group>Init</group>
<postExpression></postExpression>
<preCondition>True</preCondition>
<preExpression></preExpression>
<statusExpression>self.result.errCode == 0</statusExpression>
<function></function>
<module></module>
<paramIn></paramIn>
<paramOut></paramOut>
<type></type>
</child>
<name>MyLoop1</name>
<group>Init</group>
<postExpression></postExpression>
<preCondition>True</preCondition>
<preExpression></preExpression>
<statusExpression>self.result.errCode == 0</statusExpression>
<initExpression>global i; i=1</initExpression>
<conditionExpression>i&lt;10</conditionExpression>
<incrementExpression>i=i+1</incrementExpression>
</child>
<name>MyTestFile1</name>
<group>Init</group>
<postExpression></postExpression>
<preCondition>True</preCondition>
<preExpression></preExpression>
<statusExpression>self.result.errCode == 0</statusExpression>
</child>
</tm>

>>
>> Here are my routines to load and save my model. It come from the
>> generated editor of my model where I only insert the code that adds
>> the ExtentedMetaData. (It's possible that the code below is not
>> running, I removed some lines for the purpose of the question...)

> So the code is maybe meaningless?

I hope not :-), but here is the complete code of the createModel method
of the generated editor with some "adds". Is the way I get the
LoadOptions from the resourceSet correct? I think my problem come from
there...

public void createModel() {
URI resourceURI = EditUIUtil.getURI(getEditorInput());
Exception exception = null;
Resource resource = null;
try {
// Load the resource through the editing domain.
//
Map<Object, Object> options =
editingDomain.getResourceSet().getLoadOptions();

final ExtendedMetaData ext = new BasicExtendedMetaData(
ExtendedMetaData.ANNOTATION_URI,
EPackage.Registry.INSTANCE, new HashMap());

ext.setQualified(SeqeditorPackage.eINSTANCE, false);

// Transform xml attribute to xml element
ext.setFeatureKind(SeqeditorPackage.Literals.TM_OBJECT__NAME ,
ExtendedMetaData.ELEMENT_FEATURE);
...
options.put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
options.put(XMLResource.OPTION_KEEP_DEFAULT_CONTENT, true);

resource = editingDomain.getResourceSet().getResource(resourceURI,
true);
}
catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI,
false);
}
Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
if (diagnostic.getSeverity() != Diagnostic.OK) {
resourceToDiagnosticMap.put(resource,
analyzeResourceProblems(resource, exception));
}
editingDomain.getResourceSet().eAdapters().add(problemIndica tionAdapter);
}


>>
>> If I set the setQualified to true, it works well.

> This case I would expect to see a namespace in the serialization.

Yes, the namespace appears when I set the option to true.

<?xml version="1.0" encoding="UTF-8"?>
<seqeditor:tm xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:seqeditor="http://www.opalrt.com/tm.ui.seqeditor">
<child xsi:type="seqeditor:'TestFile'">
...
</child>
</seqeditor:tm>


> Otherwise, I'd expect the namespace of the root element to be null. If
> you try this case by using a schema with a null namespace, you'll see
> all the code that's generate for this case.

Yes, when I set the NS Prefix to an empty string (and setQualified to
true), the save's output looks like what I want. But the setFeatureKind
function of the load options doesn't seem to work anymore. (I got error
like : FeatureNotFoundException: Feature 'name' not found). So,
everything tell me that the load options aren't set correctly...

<?xml version="1.0" encoding="UTF-8"?>
<tm xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<child xsi:type="'TestFile'">
...
</child>
</tm>

>>
>> I also attach the assertion message.
>>
>> Thanks a lot
>>
>> Vincent
>>
>>
>>
>> //-------------------------------------------
>> final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
>> saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED,
>> Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
>>
>> // Save the resources to the file system.
>> boolean first = true;
>> for (Resource resource : editingDomain.getResourceSet().getResources()) {
>> if ((first || !resource.getContents().isEmpty() ||
>> isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
>>
>> savedResources.add(resource);
>>
>> final ExtendedMetaData ext = new BasicExtendedMetaData(
>> ExtendedMetaData.ANNOTATION_URI,
>> EPackage.Registry.INSTANCE, new HashMap());
>> ext.setQualified(SeqeditorPackage.eINSTANCE, false);

> So I would imagine your intent is for your saved instance will have a
> null namespace? Is that the actual result? I'd suggest trying this
> scenario with a null target namespace schema an looking closely at the
> generate resource factory...

It seems to work, but all other load options are still ignore as I
mentionned above.

So changing the NS prefix of the ecore file is the correct place to set
the target namespace to null?


>> saveOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
>> resource.save(saveOptions);
>> first = false;
>> }
>> }
>>
>>
>> //-------------------------------------------
>> URI resourceURI = EditUIUtil.getURI(getEditorInput());
>> Exception exception = null;
>> Resource resource = null;
>> Map<Object, Object> loadOptions =
>> editingDomain.getResourceSet().getLoadOptions();
>>
>> final ExtendedMetaData ext = new BasicExtendedMetaData(
>> ExtendedMetaData.ANNOTATION_URI,
>> EPackage.Registry.INSTANCE, new HashMap());
>> ext.setQualified(SeqeditorPackage.eINSTANCE, false);
>> loadOptions .put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
>> resource =
>> editingDomain.getResourceSet().getResource(resourceURI, true);
>> //--------------------------------------------
>>
>>
>> Here is the assertion:
>>
>> org.eclipse.core.runtime.AssertionFailedException: assertion failed:
>> at org.eclipse.core.runtime.Assert.isTrue(Assert.java:109)
>> at org.eclipse.core.runtime.Assert.isTrue(Assert.java:95)
>> at
>> org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiP ageEditorPart.java:695)
>>
>> at
>> org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Mu ltiPageEditorPart.java:287)
>>
>> at
>> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:661)
>>
>> at
>> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:426)
>>
>> at
>> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
>>
>> at
>> org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(Ed itorAreaHelper.java:263)
>>
>> at
>> org.eclipse.ui.internal.EditorManager.setVisibleEditor(Edito rManager.java:1405)
>>
>> at
>> org.eclipse.ui.internal.EditorManager$5.runWithException(Edi torManager.java:939)
>>
>> at
>> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
>>
>> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
>> at
>> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:129)
>>
>> at
>> org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
>> at
>> org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:801)
>>
>> at
>> org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1342)
>>
>> at
>> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
>>
>> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
>> at
>> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:129)
>>
>> at
>> org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
>> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
>> at
>> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
>>
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
>>
>> at
>> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>> at
>> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>>
>> at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
>>
>> 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: 508)
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
>> at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
> I'll bet there is a cause to this exception which you've not shown...
Re: Customization of XML serialization [message #419161 is a reply to message #419158] Sat, 10 May 2008 21:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Vincent,

Comments below.

Vincent L. wrote:
> Thanks Ed,
>
> See answers below.
>
> Thanks again.
>
> Vincent
>
>
> Ed Merks wrote:
>> Vincent,
>>
>> Comments below.
>>
>> Vincent L. wrote:
>
>>> Thanks Ed, your answers help me.
>>>
>>> Here is another question:
>>>
>>> 1- When I set the option "setQualified" of my Package to false, the
>>> loading process throw an assertion. Note, that the file was save
>>> with the same options.
>
>> It would be good to see the file.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <tm xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <child xsi:type="TestFile">
> <child xsi:type="Variable">
> <name>MyVariable1</name>
> <value>myValue</value>
> </child>
> <child xsi:type="Loop">
> <child xsi:type="Step">
> <name>MyStep1</name>
> <group>Init</group>
> <postExpression></postExpression>
> <preCondition>True</preCondition>
> <preExpression></preExpression>
> <statusExpression>self.result.errCode == 0</statusExpression>
> <function></function>
> <module></module>
> <paramIn></paramIn>
> <paramOut></paramOut>
> <type></type>
> </child>
> <name>MyLoop1</name>
> <group>Init</group>
> <postExpression></postExpression>
> <preCondition>True</preCondition>
> <preExpression></preExpression>
> <statusExpression>self.result.errCode == 0</statusExpression>
> <initExpression>global i; i=1</initExpression>
> <conditionExpression>i&lt;10</conditionExpression>
> <incrementExpression>i=i+1</incrementExpression>
> </child>
> <name>MyTestFile1</name>
> <group>Init</group>
> <postExpression></postExpression>
> <preCondition>True</preCondition>
> <preExpression></preExpression>
> <statusExpression>self.result.errCode == 0</statusExpression>
> </child>
> </tm>
>
>>>
>>> Here are my routines to load and save my model. It come from the
>>> generated editor of my model where I only insert the code that adds
>>> the ExtentedMetaData. (It's possible that the code below is not
>>> running, I removed some lines for the purpose of the question...)
>
>> So the code is maybe meaningless?
>
> I hope not :-), but here is the complete code of the createModel
> method of the generated editor with some "adds". Is the way I get the
> LoadOptions from the resourceSet correct? I think my problem come from
> there...
>
> public void createModel() {
> URI resourceURI = EditUIUtil.getURI(getEditorInput());
> Exception exception = null;
> Resource resource = null;
> try {
> // Load the resource through the editing domain.
> //
> Map<Object, Object> options =
> editingDomain.getResourceSet().getLoadOptions();
>
> final ExtendedMetaData ext = new BasicExtendedMetaData(
> ExtendedMetaData.ANNOTATION_URI,
> EPackage.Registry.INSTANCE, new HashMap());
>
> ext.setQualified(SeqeditorPackage.eINSTANCE, false);
You really shouldn't be changing the generated instance itself. These
annotations should be on the model before you generated it. If you'd
ensured the annotations where there on the model the generated uses, it
would have generated a resource factory implementation that works properly.
>
> // Transform xml attribute to xml element
> ext.setFeatureKind(SeqeditorPackage.Literals.TM_OBJECT__NAME ,
> ExtendedMetaData.ELEMENT_FEATURE);
Same here.
> ...
> options.put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
> options.put(XMLResource.OPTION_KEEP_DEFAULT_CONTENT, true);
>
> resource = editingDomain.getResourceSet().getResource(resourceURI,
> true);
The options are generally best by the resource factory when the resource
is created, not like this.
> }
> catch (Exception e) {
> exception = e;
> resource = editingDomain.getResourceSet().getResource(resourceURI,
> false);
> }
> Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
> if (diagnostic.getSeverity() != Diagnostic.OK) {
> resourceToDiagnosticMap.put(resource,
> analyzeResourceProblems(resource, exception));
> }
>
> editingDomain.getResourceSet().eAdapters().add(problemIndica tionAdapter);
> }
>
>
>>>
>>> If I set the setQualified to true, it works well.
>
>> This case I would expect to see a namespace in the serialization.
>
> Yes, the namespace appears when I set the option to true.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <seqeditor:tm xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:seqeditor="http://www.opalrt.com/tm.ui.seqeditor">
> <child xsi:type="seqeditor:'TestFile'">
> ...
> </child>
> </seqeditor:tm>
Once you've tried these annotations on the actual model being generated,
have a look at the generated resource factory and be sure it's getting used.
>
>
>> Otherwise, I'd expect the namespace of the root element to be null.
>> If you try this case by using a schema with a null namespace, you'll
>> see all the code that's generate for this case.
>
> Yes, when I set the NS Prefix to an empty string (and setQualified to
> true),
These are two unrelated ideas.
> the save's output looks like what I want. But the setFeatureKind
> function of the load options doesn't seem to work anymore. (I got
> error like : FeatureNotFoundException: Feature 'name' not found). So,
> everything tell me that the load options aren't set correctly...
>
> <?xml version="1.0" encoding="UTF-8"?>
> <tm xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <child xsi:type="'TestFile'">
> ...
> </child>
> </tm>
>
>>>
>>> I also attach the assertion message.
>>>
>>> Thanks a lot
>>>
>>> Vincent
>>>
>>>
>>>
>>> //-------------------------------------------
>>> final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
>>> saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED,
>>> Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
>>>
>>> // Save the resources to the file system.
>>> boolean first = true;
>>> for (Resource resource :
>>> editingDomain.getResourceSet().getResources()) {
>>> if ((first || !resource.getContents().isEmpty() ||
>>> isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
>>>
>>> savedResources.add(resource);
>>>
>>> final ExtendedMetaData ext = new BasicExtendedMetaData(
>>> ExtendedMetaData.ANNOTATION_URI,
>>> EPackage.Registry.INSTANCE, new HashMap());
>>> ext.setQualified(SeqeditorPackage.eINSTANCE, false);
>
>> So I would imagine your intent is for your saved instance will have a
>> null namespace? Is that the actual result? I'd suggest trying this
>> scenario with a null target namespace schema an looking closely at
>> the generate resource factory...
>
> It seems to work, but all other load options are still ignore as I
> mentionned above.
>
> So changing the NS prefix of the ecore file is the correct place to
> set the target namespace to null?
The prefix and the namespace are separate concepts. A null target
namespace schema can't have a prefix. A schema with a target namespace
generally should have a prefix except when there are no unqualified
local element declarations.
>
>
>>> saveOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
>>> resource.save(saveOptions);
>>> first = false;
>>> }
>>> }
>>>
>>>
>>> //-------------------------------------------
>>> URI resourceURI = EditUIUtil.getURI(getEditorInput());
>>> Exception exception = null;
>>> Resource resource = null;
>>> Map<Object, Object> loadOptions =
>>> editingDomain.getResourceSet().getLoadOptions();
>>>
>>> final ExtendedMetaData ext = new BasicExtendedMetaData(
>>> ExtendedMetaData.ANNOTATION_URI,
>>> EPackage.Registry.INSTANCE, new HashMap());
>>> ext.setQualified(SeqeditorPackage.eINSTANCE, false);
>>> loadOptions .put(XMLResource.OPTION_EXTENDED_META_DATA, ext);
>>> resource =
>>> editingDomain.getResourceSet().getResource(resourceURI, true);
>>> //--------------------------------------------
>>>
>>>
>>> Here is the assertion:
>>>
>>> org.eclipse.core.runtime.AssertionFailedException: assertion failed:
>>> at org.eclipse.core.runtime.Assert.isTrue(Assert.java:109)
>>> at org.eclipse.core.runtime.Assert.isTrue(Assert.java:95)
>>> at
>>> org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiP ageEditorPart.java:695)
>>>
>>> at
>>> org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Mu ltiPageEditorPart.java:287)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:661)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:426)
>>>
>>> at
>>> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(Ed itorAreaHelper.java:263)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorManager.setVisibleEditor(Edito rManager.java:1405)
>>>
>>> at
>>> org.eclipse.ui.internal.EditorManager$5.runWithException(Edi torManager.java:939)
>>>
>>> at
>>> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
>>>
>>> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
>>> at
>>> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:129)
>>>
>>> at
>>> org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
>>> at
>>> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
>>> at
>>> org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:801)
>>>
>>> at
>>> org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1342)
>>>
>>> at
>>> org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
>>>
>>> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
>>> at
>>> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:129)
>>>
>>> at
>>> org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
>>> at
>>> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
>>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
>>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
>>> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
>>> at
>>> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
>>>
>>> at
>>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
>>>
>>> at
>>> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>>> at
>>> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>>>
>>> at
>>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
>>>
>>> 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: 508)
>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
>> I'll bet there is a cause to this exception which you've not shown...
I would suggest making a very simple schema without a target namespace
and using that to generate an EMF model project and long with the test
project to see it in action. That will illustrate, via the options set
up in the resource factory impl, the options you'll need. The resulting
..ecore file will show you what annotations you should put on your Ecore
model to get the results you want. If you do it properly, the generated
results should work out of the box...


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Installing EMF on eclipse 3.4 M6
Next Topic:Can the Validation Framework return the line number?
Goto Forum:
  


Current Time: Thu Apr 25 00:10:59 GMT 2024

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

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

Back to the top